]>
Commit | Line | Data |
---|---|---|
a1f80595 | 1 | #ifndef AliFMDInput_H |
2 | #define AliFMDInput_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights | |
4 | * reserved. | |
5 | * | |
6 | * See cxx source for full Copyright notice | |
7 | */ | |
02a27b50 | 8 | //___________________________________________________________________ |
9 | // | |
10 | // The classes defined here, are utility classes for reading in data | |
11 | // for the FMD. They are put in a seperate library to not polute the | |
12 | // normal libraries. The classes are intended to be used as base | |
13 | // classes for customized class that do some sort of analysis on the | |
14 | // various types of data produced by the FMD. | |
c2fc1258 | 15 | /** @file AliFMDInput.h |
16 | @author Christian Holm Christensen <cholm@nbi.dk> | |
17 | @date Mon Mar 27 12:42:40 2006 | |
18 | @brief FMD utility classes for reading FMD data | |
19 | */ | |
a1f80595 | 20 | //___________________________________________________________________ |
9f662337 | 21 | /** @defgroup FMD_util Utility classes. |
22 | ||
23 | The classes defined here, are utility classes for reading in data | |
24 | for the FMD. They are put in a seperate library to not polute the | |
25 | normal libraries. The classes are intended to be used as base | |
26 | classes for customized class that do some sort of analysis on the | |
27 | various types of data produced by the FMD. | |
28 | */ | |
8f6ee336 | 29 | #include <TObject.h> |
a1f80595 | 30 | #ifndef ROOT_TString |
31 | # include <TString.h> | |
32 | #endif | |
8f6ee336 | 33 | class AliRunLoader; |
34 | class AliLoader; | |
35 | class AliStack; | |
36 | class AliRun; | |
d760ea03 | 37 | class AliRawReader; |
8f6ee336 | 38 | class AliFMD; |
39 | class AliFMDHit; | |
bf000c32 | 40 | class AliFMDDigit; |
41 | class AliFMDSDigit; | |
42 | class AliFMDRecPoint; | |
df137876 | 43 | class AliESDEvent; |
bf000c32 | 44 | class AliESDFMD; |
8f6ee336 | 45 | class TString; |
46 | class TClonesArray; | |
47 | class TTree; | |
48 | class TGeoManager; | |
49 | class TParticle; | |
bf000c32 | 50 | class TChain; |
a1f80595 | 51 | |
52 | //___________________________________________________________________ | |
9f662337 | 53 | /** @class AliFMDInput |
54 | @brief Base class for reading in various FMD data. | |
55 | The class loops over all found events. For each event the | |
56 | specified data is read in. The class then loops over all | |
57 | elements of the read data, and process these with user defined | |
58 | code. | |
59 | @code | |
60 | struct DigitInput : public AliFMDInput | |
61 | { | |
62 | DigitInput() | |
63 | { | |
64 | // Load digits | |
65 | AddLoad(kDigits); | |
66 | // Make a histogram | |
67 | fHist = new TH1F("adc", "ADC spectra", 1024, -.5, 1023.5); | |
68 | } | |
69 | // Process one digit. | |
70 | Bool_t ProcessDigit(AliFMDDigit* d) | |
71 | { | |
72 | fHist->Fill(d->Counts()); | |
73 | return kTRUE; | |
74 | } | |
75 | // After processing all events, display spectrum | |
76 | Bool_t Finish() | |
77 | { | |
78 | fHist->Draw(); | |
79 | } | |
80 | TH1F* fHist; | |
81 | }; | |
82 | ||
83 | void AdcSpectrum() | |
84 | { | |
85 | DigitInput di; | |
86 | di.Run(); | |
87 | } | |
88 | @endcode | |
89 | This class allows for writing small scripts, that can be compiled | |
90 | with AcLIC, to do all sorts of tests, quick prototyping, and so | |
91 | on. It has proven to be quiet useful. One can load more than | |
92 | one type of data in one derived class, to for example to make | |
93 | comparisons between hits and reconstructed points. See also the | |
94 | various scripts in @c FMD/scripts. | |
95 | @ingroup FMD_util | |
96 | */ | |
a1f80595 | 97 | class AliFMDInput : public TObject |
98 | { | |
99 | public: | |
9f662337 | 100 | /** The kinds of data that can be read in. */ |
a1f80595 | 101 | enum ETrees { |
8f6ee336 | 102 | kHits = 1, // Hits |
103 | kKinematics, // Kinematics (from sim) | |
104 | kDigits, // Digits | |
105 | kSDigits, // Summable digits | |
106 | kHeader, // Header information | |
107 | kRecPoints, // Reconstructed points | |
bf000c32 | 108 | kESD, // Load ESD's |
d760ea03 | 109 | kRaw, // Read raw data |
f95a63c4 | 110 | kGeometry, // Not really a tree |
111 | kTracks // Hits and tracs - for BG study | |
a1f80595 | 112 | }; |
9f662337 | 113 | /** CTOR */ |
a1f80595 | 114 | AliFMDInput(); |
9f662337 | 115 | /** CTOR |
116 | @param gAliceFile galice file */ | |
a1f80595 | 117 | AliFMDInput(const char* gAliceFile); |
9f662337 | 118 | /** DTOR */ |
a1f80595 | 119 | virtual ~AliFMDInput() {} |
120 | ||
9f662337 | 121 | /** Add a data type to load |
122 | @param tree Data to load */ | |
a1f80595 | 123 | virtual void AddLoad(ETrees tree) { SETBIT(fTreeMask, tree); } |
9f662337 | 124 | /** Remove a data type to load |
125 | @param tree Data to @e not load */ | |
a1f80595 | 126 | virtual void RemoveLoad(ETrees tree) { CLRBIT(fTreeMask, tree); } |
9f662337 | 127 | /** @return # of available events */ |
a1f80595 | 128 | virtual Int_t NEvents() const; |
129 | ||
9f662337 | 130 | /** Initialize the class. If a user class overloads this member |
131 | function, then this @e must be explicitly called | |
132 | @return @c false on error */ | |
a1f80595 | 133 | virtual Bool_t Init(); |
9f662337 | 134 | /** Callled at the beginning of each event. If a user class |
135 | overloads this member function, then this @e must be explicitly | |
136 | called. | |
137 | @param event Event number | |
138 | @return @c false on error */ | |
a1f80595 | 139 | virtual Bool_t Begin(Int_t event); |
9f662337 | 140 | /** Process one event. This loops over all the loaded data. Users |
141 | can overload this member function, but then it's @e strongly | |
142 | recommended to explicitly call this classes version. | |
143 | @return @c false on error */ | |
bf000c32 | 144 | virtual Bool_t Event(); |
9f662337 | 145 | /** Called at the end of each event. |
146 | @return @c false on error */ | |
a1f80595 | 147 | virtual Bool_t End(); |
9f662337 | 148 | /** Called at the end of the run. |
149 | @return @c false on error */ | |
a1f80595 | 150 | virtual Bool_t Finish() { return kTRUE; } |
9f662337 | 151 | /** Run a full job. |
152 | @return @c false on error */ | |
a1f80595 | 153 | virtual Bool_t Run(); |
bf000c32 | 154 | |
9f662337 | 155 | /** Loop over all hits, and call ProcessHit with that hit, and |
156 | optionally the corresponding kinematics track. | |
157 | @return @c false on error */ | |
bf000c32 | 158 | virtual Bool_t ProcessHits(); |
f95a63c4 | 159 | /** Loop over all tracks, and call ProcessTrack with each hit for |
160 | that track | |
161 | @return @c false on error */ | |
162 | virtual Bool_t ProcessTracks(); | |
9f662337 | 163 | /** Loop over all digits, and call ProcessDigit for each digit. |
164 | @return @c false on error */ | |
bf000c32 | 165 | virtual Bool_t ProcessDigits(); |
9f662337 | 166 | /** Loop over all summable digits, and call ProcessSDigit for each |
167 | digit. | |
168 | @return @c false on error */ | |
bf000c32 | 169 | virtual Bool_t ProcessSDigits(); |
9f662337 | 170 | /** Loop over all digits read from raw data files, and call |
171 | ProcessRawDigit for each digit. | |
172 | @return @c false on error */ | |
d760ea03 | 173 | virtual Bool_t ProcessRawDigits(); |
9f662337 | 174 | /** Loop over all reconstructed points, and call ProcessRecPoint for |
175 | each reconstructed point. | |
176 | @return @c false on error */ | |
bf000c32 | 177 | virtual Bool_t ProcessRecPoints(); |
a9579262 | 178 | /** Loop over all ESD data, and call ProcessESD for each entry. |
179 | @return @c false on error */ | |
180 | virtual Bool_t ProcessESDs(); | |
bf000c32 | 181 | |
9f662337 | 182 | /** Process one hit, and optionally it's corresponding kinematics |
183 | track. Users should over this to process each hit. | |
a9579262 | 184 | @param h Hit |
185 | @param p Associated track | |
9f662337 | 186 | @return @c false on error */ |
a9579262 | 187 | virtual Bool_t ProcessHit(AliFMDHit* h, TParticle* p); |
f95a63c4 | 188 | /** Process one hit per track. Users should over this to process |
189 | each hit. | |
190 | @param i Track number | |
191 | @param p Track | |
192 | @param h Associated Hit | |
193 | @return @c false on error */ | |
194 | virtual Bool_t ProcessTrack(Int_t i, TParticle* p, AliFMDHit* h); | |
a9579262 | 195 | /** Process one digit. Users should over this to process each |
196 | digit. | |
197 | @param digit Digit | |
9f662337 | 198 | @return @c false on error */ |
a9579262 | 199 | virtual Bool_t ProcessDigit(AliFMDDigit* digit); |
9f662337 | 200 | /** Process one summable digit. Users should over this to process |
201 | each summable digit. | |
a9579262 | 202 | @param sdigit Summable digit |
9f662337 | 203 | @return @c false on error */ |
a9579262 | 204 | virtual Bool_t ProcessSDigit(AliFMDSDigit* sdigit); |
9f662337 | 205 | /** Process one digit from raw data files. Users should over this |
206 | to process each raw digit. | |
a9579262 | 207 | @param digit Raw digit |
9f662337 | 208 | @return @c false on error */ |
a9579262 | 209 | virtual Bool_t ProcessRawDigit(AliFMDDigit* digit); |
9f662337 | 210 | /** Process one reconstructed point. Users should over this to |
211 | process each reconstructed point. | |
a9579262 | 212 | @param point Reconstructed point |
9f662337 | 213 | @return @c false on error */ |
a9579262 | 214 | virtual Bool_t ProcessRecPoint(AliFMDRecPoint* point); |
9f662337 | 215 | /** Process ESD data for the FMD. Users should overload this to |
216 | deal with ESD data. | |
a9579262 | 217 | @param d Detector number (1-3) |
218 | @param r Ring identifier ('I' or 'O') | |
219 | @param s Sector number (0-19, or 0-39) | |
220 | @param t Strip number (0-511, or 0-255) | |
221 | @param eta Psuedo-rapidity | |
222 | @param mult Psuedo-multiplicity | |
9f662337 | 223 | @return @c false on error */ |
a9579262 | 224 | virtual Bool_t ProcessESD(UShort_t, Char_t, UShort_t, UShort_t, |
225 | Float_t, Float_t); | |
69893a66 | 226 | /** Service function to make a logarithmic axis. |
227 | @param n Number of bins | |
228 | @param min Minimum of axis | |
229 | @param max Maximum of axis. | |
230 | @return An array with the bin boundaries. */ | |
231 | static TArrayF MakeLogScale(Int_t n, Double_t min, Double_t max); | |
a1f80595 | 232 | protected: |
02a27b50 | 233 | /** Copy ctor |
234 | @param o Object to copy from */ | |
b5ee4425 | 235 | AliFMDInput(const AliFMDInput& o) |
236 | : TObject(o), | |
237 | fGAliceFile(""), | |
238 | fLoader(0), | |
239 | fRun(0), | |
240 | fStack(0), | |
241 | fFMDLoader(0), | |
242 | fReader(0), | |
243 | fFMD(0), | |
b5ee4425 | 244 | fESD(0), |
df137876 | 245 | fESDEvent(0), |
b5ee4425 | 246 | fTreeE(0), |
247 | fTreeH(0), | |
248 | fTreeD(0), | |
249 | fTreeS(0), | |
250 | fTreeR(0), | |
251 | fTreeA(0), | |
252 | fChainE(0), | |
253 | fArrayE(0), | |
254 | fArrayH(0), | |
255 | fArrayD(0), | |
256 | fArrayS(0), | |
257 | fArrayR(0), | |
258 | fArrayA(0), | |
259 | fGeoManager(0), | |
260 | fTreeMask(0), | |
261 | fIsInit(kFALSE) | |
262 | {} | |
02a27b50 | 263 | /** Assignement operator |
264 | @return REference to this */ | |
265 | AliFMDInput& operator=(const AliFMDInput&) { return *this; } | |
266 | ||
a1f80595 | 267 | TString fGAliceFile; // File name of gAlice file |
268 | AliRunLoader* fLoader; // Loader of FMD data | |
269 | AliRun* fRun; // Run information | |
270 | AliStack* fStack; // Stack of particles | |
271 | AliLoader* fFMDLoader; // Loader of FMD data | |
d760ea03 | 272 | AliRawReader* fReader; // Raw data reader |
a1f80595 | 273 | AliFMD* fFMD; // FMD object |
bf000c32 | 274 | AliESDFMD* fESD; // FMD ESD data |
df137876 | 275 | AliESDEvent* fESDEvent; // ESD Event object. |
a1f80595 | 276 | TTree* fTreeE; // Header tree |
277 | TTree* fTreeH; // Hits tree | |
278 | TTree* fTreeD; // Digit tree | |
279 | TTree* fTreeS; // SDigit tree | |
280 | TTree* fTreeR; // RecPoint tree | |
d760ea03 | 281 | TTree* fTreeA; // Raw data tree |
bf000c32 | 282 | TChain* fChainE; // Chain of ESD's |
a1f80595 | 283 | TClonesArray* fArrayE; // Event info array |
284 | TClonesArray* fArrayH; // Hit info array | |
285 | TClonesArray* fArrayD; // Digit info array | |
286 | TClonesArray* fArrayS; // SDigit info array | |
d760ea03 | 287 | TClonesArray* fArrayR; // Rec points info array |
288 | TClonesArray* fArrayA; // Raw data (digits) info array | |
8f6ee336 | 289 | TGeoManager* fGeoManager; // Geometry manager |
a1f80595 | 290 | Int_t fTreeMask; // Which tree's to load |
02a27b50 | 291 | Bool_t fIsInit; // Have we been initialized |
69893a66 | 292 | Int_t fEventCount; // Event counter |
a1f80595 | 293 | ClassDef(AliFMDInput,0) //Hits for detector FMD |
294 | }; | |
295 | ||
a9579262 | 296 | inline Bool_t AliFMDInput::ProcessHit(AliFMDHit*,TParticle*) { return kTRUE; } |
f95a63c4 | 297 | inline Bool_t AliFMDInput::ProcessTrack(Int_t,TParticle*, |
298 | AliFMDHit*) { return kTRUE; } | |
a9579262 | 299 | inline Bool_t AliFMDInput::ProcessDigit(AliFMDDigit*) { return kTRUE; } |
300 | inline Bool_t AliFMDInput::ProcessSDigit(AliFMDSDigit*) { return kTRUE; } | |
301 | inline Bool_t AliFMDInput::ProcessRawDigit(AliFMDDigit*) { return kTRUE; } | |
302 | inline Bool_t AliFMDInput::ProcessRecPoint(AliFMDRecPoint*) { return kTRUE; } | |
303 | inline Bool_t AliFMDInput::ProcessESD(UShort_t,Char_t,UShort_t,UShort_t, | |
304 | Float_t,Float_t) { return kTRUE; } | |
305 | ||
a1f80595 | 306 | |
a1f80595 | 307 | #endif |
308 | //____________________________________________________________________ | |
309 | // | |
310 | // Local Variables: | |
311 | // mode: C++ | |
312 | // End: | |
313 | // | |
314 | // EOF | |
315 | // |