KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVFAZIAReader.cpp
1#define KVFAZIAReader_cxx
2// The class definition in KVFAZIAReader.h has been generated automatically
3// by the ROOT utility TTree::MakeSelector(). This class is derived
4// from the ROOT class TSelector. For more information on the TSelector
5// framework see $ROOTSYS/README/README.SELECTOR or the ROOT User Manual.
6
7// The following methods are defined in this file:
8// Begin(): called every time a loop on the tree starts,
9// a convenient place to create your histograms.
10// SlaveBegin(): called after Begin(), when on PROOF called only on the
11// slave servers.
12// Process(): called for each event, in this function you decide what
13// to read and fill your histograms.
14// SlaveTerminate: called at the end of the loop on the tree, when on PROOF
15// called only on the slave servers.
16// Terminate(): called at the end of the loop on the tree,
17// a convenient place to draw/fit your histograms.
18//
19// To use this file, try the following session on your Tree T:
20//
21// Root > T->Process("KVFAZIAReader.C")
22// Root > T->Process("KVFAZIAReader.C","some options")
23// Root > T->Process("KVFAZIAReader.C+")
24//
25
26#include "KVFAZIAReader.h"
27#include "KVDataAnalyser.h"
28#include "KVFAZIARawDataAnalyser.h"
29#include "KVFAZIA.h"
30#include "KVClassFactory.h"
31
32#include "TSystem.h"
33
35
36
37
41
42void KVFAZIAReader::SlaveBegin(TTree* /*tree*/)
43{
44 // The SlaveBegin() function is called after the Begin() function.
45 // When running with PROOF SlaveBegin() is called on each slave server.
46 // The tree argument is deprecated (on PROOF 0 is passed).
47
48 Info("KVFAZIAReader::SlaveBegin", "called");
49 gDataAnalyser->preInitAnalysis();
50}
51
52
53
55
57{
58
59 return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0;
60
61}
62
63
64
83
85{
86 // The Process() function is called for each entry in the tree (or possibly
87 // keyed object in the case of PROOF) to be processed. The entry argument
88 // specifies which entry in the currently loaded tree is to be processed.
89 // It can be passed to either KVFAZIAReader::GetEntry() or TBranch::GetEntry()
90 // to read either all or the required parts of the data. When processing
91 // keyed objects with PROOF, the object is already loaded and is available
92 // via the fObject pointer.
93 //
94 // This function should contain the "body" of the analysis. It can contain
95 // simple or elaborate selection criteria, run algorithms on the data
96 // of the event and typically fill histograms.
97 //
98 // The processing can be stopped by calling Abort().
99 //
100 // Use fStatus to set the return value of TTree::Process().
101 //
102 // The return value is currently not used.
103
105 fEventsRead += 1;
106
107 RawEvent->Clear();
108
109 GetEntry(entry);
111
112 if (GetNumberOfReadEntries() % 10000 == 0) {
113 Info("KVFAZIAReader::Process", "%d read entries", GetNumberOfReadEntries());
114 ProcInfo_t pid;
115 if (gSystem->GetProcInfo(&pid) == 0) {
116 std::cout << " ------------- Process infos -------------" << std::endl;
117 printf(" CpuSys = %f s. CpuUser = %f s. ResMem = %f MB VirtMem = %f MB\n",
118 pid.fCpuSys, pid.fCpuUser, pid.fMemResident / 1024., pid.fMemVirtual / 1024.);
119 }
120 }
121 return Analysis();
122}
123
124
125
126
131
133{
134 // The Terminate() function is the last function to be called during
135 // a query. It always runs on the client, it can be used to present
136 // the results graphically or save the results to file.
137 Info("KVFAZIAReader::Terminate", "%d events read", GetNumberOfReadEntries());
138 EndRun();
139 EndAnalysis();
140
141}
142
143
144
154
156{
157 // The Init() function is called when the selector needs to initialize
158 // a new tree or chain. Typically here the branch addresses and branch
159 // pointers of the tree will be set.
160 // It is normally not necessary to make changes to the generated
161 // code, but the routine can be extended by the user if needed.
162 // Init() will be called many times when running on PROOF
163 // (once per file to be processed).
164
165 // Set branch addresses and branch pointers
166 Info("KVFAZIAReader::Init", "called");
167 RawEvent = 0;
168
169 if (!tree)
170 return;
171 fChain = tree;
173 fChain->SetBranchAddress("rawevent", &RawEvent);
174 fEventsRead = 0;
176
177}
178
179
180
187
189{
190 // The Notify() function is called when a new file is opened. This
191 // can be either for a new TTree in a TChain or when when a new TTree
192 // is started when using PROOF. It is normally not necessary to make changes
193 // to the generated code, but the routine can be extended by the
194 // user if needed. The return value is currently not used.
195 if (fNotifyCalled) return kTRUE; // avoid multiple calls at beginning of analysis
197
198 Info("Notify", "Beginning analysis of file %s (%lld events)", fChain->GetCurrentFile()->GetName(), fChain->GetTree()->GetEntries());
199 gDataAnalyser->preInitRun();
200 fCurrentRun = ((KVFAZIARawDataAnalyser*)gDataAnalyser)->GetCurrentRunNumber();
201 InitRun(); //user initialisations for run
202
203 return kTRUE;
204}
205
206
207
210
211void KVFAZIAReader::Make(const Char_t* kvsname)
212{
213 // Automatic generation of KVFAZIAReader-derived class for KaliVeda analysis
214
215 KVClassFactory cf(kvsname, "User analysis class", Class_Name(), kTRUE);
216 cf.AddImplIncludeFile("KVSignal.h");
217 cf.AddImplIncludeFile("KVPSAResult.h");
218 cf.AddImplIncludeFile("KVNameValueList.h");
219 cf.AddImplIncludeFile("TClonesArray.h");
220 cf.AddImplIncludeFile("KVBatchSystem.h");
221 cf.AddImplIncludeFile("KVFAZIA.h");
222 cf.GenerateCode();
223}
224
225
int Int_t
bool Bool_t
char Char_t
constexpr Bool_t kFALSE
constexpr Bool_t kTRUE
R__EXTERN TSystem * gSystem
Factory class for generating skeleton files for new classes.
void GenerateCode()
Generate header and implementation file for currently-defined class.
void AddImplIncludeFile(const Char_t *filename)
virtual void preInitAnalysis()
virtual void preInitRun()
virtual void Clear(Option_t *opt="")
Pilot analysis of raw FAZIA data.
void Clear(Option_t *="")
Info("Clear","IsCalled");.
TClonesArray * GetSignals() const
Read FAZIA data.
virtual Bool_t Process(Long64_t entry)
virtual void Init(TTree *tree)
virtual void Terminate()
virtual Bool_t Analysis()
KVDetectorEvent * GetDetectorEvent() const
TTree * fChain
pointer to the analyzed TTree or TChain
virtual void EndAnalysis()
static void Make(const Char_t *kvsname="MyOwnKVFAZIAReader")
Automatic generation of KVFAZIAReader-derived class for KaliVeda analysis.
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
Int_t GetNumberOfReadEntries() const
KVFAZIARawEvent * RawEvent
Bool_t fNotifyCalled
virtual Bool_t Notify()
virtual void EndRun()
virtual void InitRun()
void GetDetectorEvent(KVDetectorEvent *detev, const TSeqCollection *dets)
Definition KVFAZIA.cpp:500
const char * GetName() const override
virtual void Info(const char *method, const char *msgfmt,...) const
static const char * Class_Name()
virtual int GetProcInfo(ProcInfo_t *info) const
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
TFile * GetCurrentFile() const
virtual void SetMakeClass(Int_t make)
virtual Long64_t GetEntries() const
virtual TTree * GetTree() const
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)
long long Long64_t
void Info(const char *location, const char *fmt,...)
Long_t fMemVirtual
Float_t fCpuSys
Long_t fMemResident
Float_t fCpuUser
ClassImp(TPyArg)