KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVINDRAGeneDataSelector.cpp
Go to the documentation of this file.
1 #define KVINDRAGeneDataSelector_cxx
2 
4 #include <TH2.h>
5 #include <TStyle.h>
6 #include "KVClassFactory.h"
7 
9 
10 
11 
12 
13 
18 void KVINDRAGeneDataSelector::Begin(TTree* /*tree*/)
19 {
20  // The Begin() function is called at the start of the query.
21  // When running with PROOF Begin() is only called on the client.
22  // The tree argument is deprecated (on PROOF 0 is passed).
23 
24  TString option = GetOption();
25 
26  InitAnalysis(); //user initialisations for analysis
27 
28 }
29 
30 
31 
36 
38 {
39  // The SlaveBegin() function is called after the Begin() function.
40  // When running with PROOF SlaveBegin() is called on each slave server.
41  // The tree argument is deprecated (on PROOF 0 is passed).
42 
43  TString option = GetOption();
44 
45 }
46 
47 
48 
67 
69 {
70  // The Process() function is called for each entry in the tree (or possibly
71  // keyed object in the case of PROOF) to be processed. The entry argument
72  // specifies which entry in the currently loaded tree is to be processed.
73  // It can be passed to either KVINDRAGeneDataSelector::GetEntry() or TBranch::GetEntry()
74  // to read either all or the required parts of the data. When processing
75  // keyed objects with PROOF, the object is already loaded and is available
76  // via the fObject pointer.
77  //
78  // This function should contain the "body" of the analysis. It can contain
79  // simple or elaborate selection criteria, run algorithms on the data
80  // of the event and typically fill histograms.
81  //
82  // The processing can be stopped by calling Abort().
83  //
84  // Use fStatus to set the return value of TTree::Process().
85  //
86  // The return value is currently not used.
87 
88  fTreeEntry = entry;
89  GetEntry(entry);
90 
91  Analysis();
92 
93  // Testing whether EndRun() should be called
94  if (AtEndOfRun()) {
95  EndRun(); //user routine end of run
96  delete gIndra; // Absolutely necessay to keep the coherence between
97  gIndra = 0; // the pointers to the detectors and the TRef's
99  }
100 
101  return kTRUE;
102 }
103 
104 
105 
110 
112 {
113  // The SlaveTerminate() function is called after all entries or objects
114  // have been processed. When running with PROOF SlaveTerminate() is called
115  // on each slave server.
116 
117 }
118 
119 
120 
125 
127 {
128  // The Terminate() function is the last function to be called during
129  // a query. It always runs on the client, it can be used to present
130  // the results graphically or save the results to file.
131 
132  if (needToCallEndRun) {
133  EndRun();
134  delete gIndra; // Absolutely necessay to keep the coherence between
135  gIndra = 0; // the pointers to the detectors and the TRef's
136  }
137  EndAnalysis();
138 }
139 
140 
141 
146 
148 {
149 //
150 // Check whether the end of run is reached for the current tree
151 //
152 
153  Bool_t ok = (fTreeEntry + 1 == fChain->GetTree()->GetEntries());
154 
155  return ok;
156 }
157 
158 
159 
160 
163 
165 {
166  //Automatic generation of derived class for gene data analysis
167 
168  KVClassFactory cf(kvsname, "User gene data analysis class", "KVINDRAGeneDataSelector");
169  cf.AddMethod("InitAnalysis", "void");
170  cf.AddMethod("InitRun", "void");
171  cf.AddMethod("Analysis", "Bool_t");
172  cf.AddMethod("EndRun", "void");
173  cf.AddMethod("EndAnalysis", "void");
174  KVString body;
175  //initanalysis
176  body = " //Initialisation of e.g. histograms, performed once at beginning of analysis";
177  cf.AddMethodBody("InitAnalysis", body);
178  //initrun
179  body = " //Initialisation performed at beginning of each run\n";
180  body += " //Int RunNumber holds number of current run\n";
181  cf.AddMethodBody("InitRun", body);
182  //Analysis
183  body = " //Analysis method called for each event\n";
184  body += " //Int RunNumber holds number of current run\n";
185  body += " //Int EventNumber holds number of current event\n";
186  body += " //KVINDRATriggerInfo* TriggerInfo holds info on INDRA trigger for current event\n";
187  body += " return kTRUE;";
188  cf.AddMethodBody("Analysis", body);
189  //endrunĂ¹
190  body = " //Method called at end of each run";
191  cf.AddMethodBody("EndRun", body);
192  //endanalysis
193  body = " //Method called at end of analysis: save/display histograms etc.";
194  cf.AddMethodBody("EndAnalysis", body);
195  cf.GenerateCode();
196 }
197 
198 
KVINDRA * gIndra
Definition: KVINDRA.cpp:88
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
char Char_t
const Bool_t kFALSE
bool Bool_t
const Bool_t kTRUE
Factory class for generating skeleton files for new classes.
void GenerateCode()
Generate header and implementation file for currently-defined class.
void AddMethodBody(const Char_t *method_name, const KVString &body)
KVClassMethod * AddMethod(const Char_t *name, const Char_t *return_type, const Char_t *access="public", Bool_t isVirtual=kFALSE, Bool_t isConst=kFALSE)
For analysing INDRA pulser & laser data.
Bool_t needToCallEndRun
tells if one needs to call EndRun
virtual Bool_t Process(Long64_t entry)
TTree * fChain
pointer to the analyzed TTree or TChain
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
virtual void SlaveBegin(TTree *tree)
static void Make(const Char_t *kvsname)
Automatic generation of derived class for gene data analysis.
Long64_t fTreeEntry
this is the current TTree entry number, i.e. the argument passed to TSelector::Process(Long64_t entry...
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
virtual const char * GetOption() const
virtual TTree * GetTree() const
virtual Long64_t GetEntries() const
long long Long64_t