SummarySet.h
1 #include "TObject.h"
2 #include "TString.h"
3 #include "TChain.h"
4 #include "AnitaConventions.h"
5 #include "TGraphAntarctica.h"
6 #include "AnitaEventSummary.h"
7 
8 #ifndef ACCLAIM_SUMMARY_SET_H
9 #define ACCLAIM_SUMMARY_SET_H
10 
11 // This is a guess at the version number, if this doesn't work for you
12 // feel free to try harder to track down the change
13 #if ROOT_VERSION_CODE < ROOT_VERSION(6,0,8)
14 #define TCHAIN_NENTRIES_DEFAULT TChain::kBigNumber
15 #else
16 #define TCHAIN_NENTRIES_DEFAULT TChain::kMaxEntries
17 #endif
18 
19 
20 class TH2D;
21 class TH2DAntarctica;
23 class TProof;
24 
25 namespace Acclaim
26 {
27 
28  // class AnalysisPlot;
29  // class AnalysisProf;
30 
31  class SummarySet {
32  public:
33  SummarySet(const char* pathToSummaryFiles, const char* treeName = "sumTree", const char* summaryBranchName = "sum", bool useProof = false);
34  virtual ~SummarySet();
35 
36  Long64_t N() const {return fN;}
37  AnitaEventSummary * summary() const { return fSum;}
38 
39  Long64_t getEntry(Long64_t entry);
40  Long64_t getEvent(UInt_t eventNumber);
41  Long64_t first(){return getEntry(0);}
42  Long64_t last(){return fN > 0 ? getEntry(fN-1) : -1;}
43 
44  UInt_t getFirstTime(){return fFirstTime;}
45  UInt_t getLastTime(){return fLastTime;}
46  UInt_t getFirstEventNumber(){return fFirstEventNumber;}
47  UInt_t getLastEventNumber(){return fLastEventNumber;}
48 
49  // AnalysisProf* bookTimeAnalysisProf(const char* name, const char* title, int nx, int ny, double yMin, double yMax);
50  // AnalysisProf* bookEventNumberAnalysisProf(const char* name, const char* title, int nx, int ny, double yMin, double yMax);
51 
52  // AnalysisPlot* bookTimeAnalysisPlot(const char* name, const char* title, int nx, int ny, double yMin, double yMax);
53  // AnalysisPlot* bookEventNumberAnalysisPlot(const char* name, const char* title, int nx, int ny, double yMin, double yMax);
54 
55  TH2D* bookTimeHistogram(const char* name, const char* title, int nx, int ny, double yMin, double yMax);
56  TH2D* bookEventNumberHistogram(const char* name, const char* title, int nx, int ny, double yMin, double yMax);
57 
58 
59  Long64_t Process(TSelector* selector, Option_t* option = "", Long64_t nentries = TCHAIN_NENTRIES_DEFAULT, Long64_t firstentry = 0);
60 
61  TProfile2DAntarctica* makeAntarcticaProf(AnitaPol::AnitaPol_t pol=AnitaPol::kNotAPol, const char* name="", const char* title="", Int_t nx=-1, Int_t ny=-1);
62  TH2DAntarctica* makeAntarcticaHist(AnitaPol::AnitaPol_t pol=AnitaPol::kNotAPol, const char* name="", const char* title="", Int_t nx=-1, Int_t ny=-1);
63 
64 
65  Double_t getTotalSize() const;
66  TGraphAntarctica* makePayloadLocationGraph(int stride = TGraphAntarctica::defaultGpsTreeStride);
67 
68 
69  // If I keep adding these wrapper functions at some point it might make sense to inherit from TChain...
70  TChain* getChain(){return fChain;}
71  Long64_t Draw(const char* varexp, const TCut &selection, Option_t *option = "", Long64_t nentries = TCHAIN_NENTRIES_DEFAULT, Long64_t firstentry = 0);
72  Long64_t Draw(const char* varexp,const char* selection="", Option_t* option = "", Long64_t nentries = TCHAIN_NENTRIES_DEFAULT, Long64_t firstentry = 0);
73 
79  Double_t getBytesPerEvent() const {
80  return N() > 0 ? getTotalSize()/N() : 0;
81  }
82  void SetUseProof(bool useProof=true) {fUseProof = useProof;}
83  Bool_t GetUseProof() {return fUseProof;}
84  void addFlagChain(const char* flagFileGlob, const char* flagTreeName = "flagTree");
85 
86  TObject* getDrawOutput() {TObject* o = fDrawOutput; fDrawOutput = NULL; return o;}
87 
88  static TProof* startProof();
89 
90  protected:
91 
92  void init();
93  void initProof();
94  void renameProofCanvas(const char* varexp);
95  void findHist(const char* varexp);
96 
97  TString fPathToSummaryFiles;
98  TString fTreeName;
100 
101  TChain* fChain;
102  Long64_t fN;
104 
105  UInt_t fFirstTime;
107  UInt_t fLastTime;
109  Bool_t fUseProof;
110  TProof* fProof;
111  Bool_t fBuiltIndex;
112 
113  TChain* fFlagChain;
116  TObject* fDrawOutput;
117  };
118 }
119 
120 
121 #endif //ACCLAIM_SUMMARY_SET_H
Double_t getBytesPerEvent() const
Definition: SummarySet.h:79
UInt_t fFirstTime
Pointer to the current entry in the chain, access with SummarySet::summary()
Definition: SummarySet.h:105
TChain * fChain
Branch name of the AnitaEventSummary, default is "sum".
Definition: SummarySet.h:101
Bool_t fUseProof
The eventNumber of the last entry in the summary chain, useful for booking histograms.
Definition: SummarySet.h:109
UInt_t fLastEventNumber
The realTime of the last entry in the summary chain, useful for booking histograms.
Definition: SummarySet.h:108
static TProof * startProof()
You take it, you own it, you delete it.
Definition: SummarySet.cxx:61
TObject * fDrawOutput
Event number stored with flags to double check event matching.
Definition: SummarySet.h:116
UInt_t fLastTime
The eventNumber of the first entry in the summary chain, useful for booking histograms.
Definition: SummarySet.h:107
AnitaEventSummary * fSum
The number of entries in the AnitaEventSummary chain, access with SummarySet::N() ...
Definition: SummarySet.h:103
void renameProofCanvas(const char *varexp)
Definition: SummarySet.cxx:341
Long64_t fN
The chain of TTrees containing the AnitaEventSummary.
Definition: SummarySet.h:102
Namespace which wraps everything in the library.
USeful in for loops.
TChain * fFlagChain
Built chain index?
Definition: SummarySet.h:113
AnitaEventSummary::EventFlags * fFlags
An optional chain of TTrees containing just AnitaEventSummary::EventFlags.
Definition: SummarySet.h:114
Long64_t getEntry(Long64_t entry)
Definition: SummarySet.cxx:179
UInt_t fFirstEventNumber
The realTime of the first entry in the summary chain, useful for booking histograms.
Definition: SummarySet.h:106
TProof * fProof
Switch on the Parallel ROOT Facility, for speedy histogram plotting.
Definition: SummarySet.h:110
Long64_t getEvent(UInt_t eventNumber)
Definition: SummarySet.cxx:208
UInt_t fFlagEventNumber
Pointer to tree entry of optional flags.
Definition: SummarySet.h:115
TString fSummaryBranchName
The name of the TTrees, default is "sumTree".
Definition: SummarySet.h:99
TGraphAntarctica * makePayloadLocationGraph(int stride=TGraphAntarctica::defaultGpsTreeStride)
Definition: SummarySet.cxx:418
Bool_t fBuiltIndex
Pointer to the PROOF session.
Definition: SummarySet.h:111
Common analysis format between UCorrelator and Acclaim.
void findHist(const char *varexp)
Definition: SummarySet.cxx:306
enum AnitaPol::EAnitaPol AnitaPol_t
Polarisation enumeration.
Double_t getTotalSize() const
Definition: SummarySet.cxx:152
TString fTreeName
The glob passed to the TChain.
Definition: SummarySet.h:98