]>
Commit | Line | Data |
---|---|---|
05e1b6ea | 1 | |
2 | //_____________________________________________________________________________ | |
3 | // Class for UPC data | |
4 | // Author: Jaroslav Adam | |
5 | // | |
6 | // UPC event containing trigger, VZERO, ZDC, tracks and MC | |
7 | //_____________________________________________________________________________ | |
8 | ||
9 | #include "TH1I.h" | |
10 | #include "TObjString.h" | |
11 | #include "TString.h" | |
12 | #include "TClonesArray.h" | |
13 | #include "TParticle.h" | |
14 | ||
15 | #include "AliUPCTrack.h" | |
16 | #include "AliUPCMuonTrack.h" | |
17 | ||
18 | #include "AliUPCEvent.h" | |
19 | ||
20 | ClassImp(AliUPCEvent) | |
21 | ||
22 | TClonesArray *AliUPCEvent::fgUPCTracks = 0; | |
23 | TClonesArray *AliUPCEvent::fgUPCMuonTracks = 0; | |
24 | TClonesArray *AliUPCEvent::fgMCParticles = 0; | |
25 | ||
26 | //_____________________________________________________________________________ | |
27 | AliUPCEvent::AliUPCEvent() | |
28 | :TObject(), | |
29 | fFlags(0), fL0inputs(0), fRecoPass(0), | |
30 | fDataFilnam(0x0), fEvtNum(0), fRunNum(0), | |
31 | fVtxChi2perNDF(0), fVtxNContributors(0), fVtxTitle(0x0), | |
32 | fVtxSPDchi2perNDF(0), fVtxSPDnContributors(0), fVtxSPDtitle(0x0), | |
33 | fNTracklets(0), fNSPDfiredInner(0), fNSPDfiredOuter(0), | |
34 | fV0ADecision(0), fV0CDecision(0), fBBtriggerV0C(0), fBBFlagV0C(0), | |
35 | fZNCEnergy(0), fZPCEnergy(0), fZNAEnergy(0), fZPAEnergy(0), | |
36 | fZNCtdc(0), fZPCtdc(0), fZNAtdc(0), fZPAtdc(0), | |
37 | fUPCTracks(0x0), fNtracks(0), fUPCMuonTracks(0x0), fNmuons(0), | |
38 | fMCParticles(0x0), fNmc(0) | |
39 | { | |
40 | // Default constructor | |
41 | ||
42 | for(Int_t itrg=0; itrg<NTRG; itrg++) fTrgClasses[itrg] = kFALSE; | |
43 | for(Int_t i=0; i<3; i++) {fVtxPos[i] = 0.; fVtxSPDpos[i] = 0.; fVtxMCpos[i] = 0.;} | |
44 | for(Int_t i=0; i<6; i++) {fVtxCov[i] = 0.; fVtxSPDcov[i] = 0.;} | |
45 | ||
46 | if(!fgUPCTracks) { | |
47 | fgUPCTracks = new TClonesArray("AliUPCTrack"); | |
48 | fUPCTracks = fgUPCTracks; | |
49 | fUPCTracks->SetOwner(kTRUE); | |
50 | } | |
51 | if(!fgUPCMuonTracks) { | |
52 | fgUPCMuonTracks = new TClonesArray("AliUPCMuonTrack"); | |
53 | fUPCMuonTracks = fgUPCMuonTracks; | |
54 | fUPCMuonTracks->SetOwner(kTRUE); | |
55 | } | |
56 | ||
57 | ||
58 | if(!fDataFilnam) { | |
59 | fDataFilnam = new TObjString(); | |
60 | fDataFilnam->SetString(""); | |
61 | } | |
62 | ||
63 | if(!fVtxTitle) { | |
64 | fVtxTitle = new TObjString(); | |
65 | fVtxTitle->SetString(""); | |
66 | } | |
67 | ||
68 | if(!fVtxSPDtitle) { | |
69 | fVtxSPDtitle = new TObjString(); | |
70 | fVtxSPDtitle->SetString(""); | |
71 | } | |
72 | ||
73 | //if(!fUPCTracks) fUPCTracks = new TClonesArray("AliUPCTrack"); | |
74 | //if(!fUPCMuonTracks) fUPCMuonTracks = new TClonesArray("AliUPCMuonTrack"); | |
75 | } | |
76 | ||
77 | //_____________________________________________________________________________ | |
78 | AliUPCEvent::~AliUPCEvent() | |
79 | { | |
80 | // destructor | |
81 | ||
82 | if(fDataFilnam) {delete fDataFilnam; fDataFilnam = 0x0;} | |
83 | if(fVtxTitle) {delete fVtxTitle; fVtxTitle=0x0;} | |
84 | if(fVtxSPDtitle) {delete fVtxSPDtitle; fVtxSPDtitle=0x0;} | |
85 | if(fUPCTracks) {delete fUPCTracks; fUPCTracks = 0x0;} | |
86 | if(fUPCMuonTracks) {delete fUPCMuonTracks; fUPCMuonTracks = 0x0;} | |
87 | if(fMCParticles) {delete fMCParticles; fMCParticles = 0x0;} | |
88 | } | |
89 | ||
90 | //_____________________________________________________________________________ | |
91 | void AliUPCEvent::ClearEvent() | |
92 | { | |
93 | // clear event variables | |
94 | ||
95 | Clear(); // Clear to TObject | |
96 | ||
97 | fBBtriggerV0C = 0; | |
98 | fBBFlagV0C = 0; | |
99 | for(Int_t itrg=0; itrg<NTRG; itrg++) fTrgClasses[itrg] = kFALSE; | |
100 | ||
101 | if(fUPCTracks) {fUPCTracks->Clear("C"); fNtracks = 0;} | |
102 | if(fUPCMuonTracks) {fUPCMuonTracks->Clear("C"); fNmuons = 0;} | |
103 | if(fMCParticles) {fMCParticles->Clear("C"); fNmc = 0;} | |
104 | } | |
105 | ||
106 | //_____________________________________________________________________________ | |
107 | void AliUPCEvent::SetIsESD(Bool_t isESD) | |
108 | { | |
109 | //set event as created from ESD, otherwise AOD assumed | |
110 | ||
111 | if(!isESD) return; | |
112 | ||
113 | fFlags |= (1 << 0); | |
114 | ||
115 | } | |
116 | ||
117 | //_____________________________________________________________________________ | |
118 | void AliUPCEvent::SetIsMC(Bool_t isMC) | |
119 | { | |
120 | // set the event as MC, initialize mc array | |
121 | ||
122 | if(!isMC) return; | |
123 | ||
124 | if(!fgMCParticles) { | |
125 | fgMCParticles = new TClonesArray("TParticle"); | |
126 | fMCParticles = fgMCParticles; | |
127 | fMCParticles->SetOwner(kTRUE); | |
128 | } | |
129 | fFlags |= (1 << 1); | |
130 | ||
131 | } | |
132 | ||
133 | //_____________________________________________________________________________ | |
134 | void AliUPCEvent::SetTriggerClass(Int_t idx, Bool_t fired) | |
135 | { | |
136 | // set trigger class at index idx | |
137 | ||
138 | if(idx < 0 || idx >= NTRG) return; | |
139 | fTrgClasses[idx] = fired; | |
140 | } | |
141 | ||
142 | //_____________________________________________________________________________ | |
143 | void AliUPCEvent::SetInputFileName(const char *s) | |
144 | { | |
145 | // set name of the input file | |
146 | ||
147 | fDataFilnam->Clear(); | |
148 | fDataFilnam->SetString(s); | |
149 | ||
150 | } | |
151 | ||
152 | //_____________________________________________________________________________ | |
153 | void AliUPCEvent::SetPrimaryVertex(Double_t *pos, Double_t chi2, Double_t *cov, Int_t ncontrib) | |
154 | { | |
155 | // set default primary vertex | |
156 | ||
157 | for(Int_t i=0; i<3; i++) fVtxPos[i] = pos[i]; | |
158 | for(Int_t i=0; i<6; i++) fVtxCov[i] = cov[i]; | |
159 | fVtxChi2perNDF = chi2; | |
160 | fVtxNContributors = ncontrib; | |
161 | } | |
162 | ||
163 | //_____________________________________________________________________________ | |
164 | void AliUPCEvent::SetPrimaryVertexTitle(const char *s) | |
165 | { | |
166 | // set title of default primary vertex | |
167 | ||
168 | fVtxTitle->Clear(); | |
169 | fVtxTitle->SetString(s); | |
170 | } | |
171 | ||
172 | //_____________________________________________________________________________ | |
173 | void AliUPCEvent::SetPrimaryVertexSPD(Double_t *pos, Double_t chi2, Double_t *cov, Int_t ncontrib) | |
174 | { | |
175 | // set SPD primary vertex | |
176 | ||
177 | for(Int_t i=0; i<3; i++) fVtxSPDpos[i] = pos[i]; | |
178 | for(Int_t i=0; i<6; i++) fVtxSPDcov[i] = cov[i]; | |
179 | fVtxSPDchi2perNDF = chi2; | |
180 | fVtxSPDnContributors = ncontrib; | |
181 | } | |
182 | ||
183 | //_____________________________________________________________________________ | |
184 | void AliUPCEvent::SetPrimaryVertexSPDtitle(const char *s) | |
185 | { | |
186 | // set title of default primary vertex | |
187 | ||
188 | fVtxSPDtitle->Clear(); | |
189 | fVtxSPDtitle->SetString(s); | |
190 | } | |
191 | ||
192 | //_____________________________________________________________________________ | |
193 | void AliUPCEvent::SetPrimaryVertexMC(Float_t *pos) | |
194 | { | |
195 | // set generated primary vertex | |
196 | ||
197 | for(Int_t i=0; i<3; i++) fVtxMCpos[i] = pos[i]; | |
198 | } | |
199 | ||
200 | //_____________________________________________________________________________ | |
201 | void AliUPCEvent::SetBBtriggerV0Cmask(UInt_t ibit) | |
202 | { | |
203 | // fill offline fired cells in V0C setting the corresponding bits in the bit mask | |
204 | // AliUPCEvent::ClearEvent should be called to initialize the mask | |
205 | ||
206 | fBBtriggerV0C |= (1 << ibit); | |
207 | } | |
208 | ||
209 | //_____________________________________________________________________________ | |
210 | void AliUPCEvent::SetBBFlagV0Cmask(UInt_t ibit) | |
211 | { | |
212 | // fill online fired cells in V0C setting the corresponding bits in the bit mask | |
213 | // AliUPCEvent::ClearEvent should be called to initialize the mask | |
214 | ||
215 | fBBFlagV0C |= (1 << ibit); | |
216 | } | |
217 | ||
218 | //_____________________________________________________________________________ | |
219 | AliUPCTrack *AliUPCEvent::AddTrack(void) | |
220 | { | |
221 | // construct new upc central track | |
222 | /* | |
223 | if(!fgUPCTracks) { | |
224 | fgUPCTracks = new TClonesArray("AliUPCTrack"); | |
225 | fUPCTracks = fgUPCTracks; | |
226 | fUPCTracks->SetOwner(kTRUE); | |
227 | } | |
228 | */ | |
229 | if(!fUPCTracks) return 0x0; | |
230 | ||
231 | AliUPCTrack *track = (AliUPCTrack*) fUPCTracks->ConstructedAt(fNtracks++); | |
232 | return track; | |
233 | } | |
234 | ||
235 | //_____________________________________________________________________________ | |
236 | AliUPCMuonTrack *AliUPCEvent::AddMuonTrack(void) | |
237 | { | |
238 | // construct new upc muon track | |
239 | ||
240 | if(!fUPCMuonTracks) return 0x0; | |
241 | ||
242 | AliUPCMuonTrack *track = (AliUPCMuonTrack*) fUPCMuonTracks->ConstructedAt(fNmuons++); | |
243 | return track; | |
244 | } | |
245 | ||
246 | //_____________________________________________________________________________ | |
247 | TParticle *AliUPCEvent::AddMCParticle(void) | |
248 | { | |
249 | // construct new mc TParticle | |
250 | ||
251 | if(!fMCParticles) return 0x0; | |
252 | ||
253 | TParticle *part = (TParticle*) fMCParticles->ConstructedAt(fNmc++); | |
254 | return part; | |
255 | } | |
256 | ||
257 | //_____________________________________________________________________________ | |
258 | Bool_t AliUPCEvent::GetIsESD(void) const | |
259 | { | |
260 | // return kTRUE if event is ESD, otherwise AOD assumed | |
261 | ||
262 | if( fFlags & (1 << 0) ) return kTRUE; | |
263 | ||
264 | return kFALSE; | |
265 | ||
266 | } | |
267 | ||
268 | //_____________________________________________________________________________ | |
269 | Bool_t AliUPCEvent::GetIsMC(void) const | |
270 | { | |
271 | // return kTRUE if event is MC | |
272 | ||
273 | if( fFlags & (1 << 1) ) return kTRUE; | |
274 | ||
275 | return kFALSE; | |
276 | ||
277 | } | |
278 | ||
279 | //_____________________________________________________________________________ | |
280 | Bool_t AliUPCEvent::GetFlagBit(UChar_t ibit) const | |
281 | { | |
282 | // return kTRUE if bit is set | |
283 | ||
284 | if( fFlags & (1 << ibit) ) return kTRUE; | |
285 | ||
286 | return kFALSE; | |
287 | ||
288 | } | |
289 | ||
290 | //_____________________________________________________________________________ | |
291 | Bool_t AliUPCEvent::GetTriggerClass(Int_t idx) const | |
292 | { | |
293 | // returns kTRUE if trigger class at idx was fired, otherwise kFALSE; | |
294 | ||
295 | if(idx < 0 || idx >= NTRG) return kFALSE; | |
296 | return fTrgClasses[idx]; | |
297 | } | |
298 | ||
299 | //_____________________________________________________________________________ | |
300 | void AliUPCEvent::GetPrimaryVertex(Double_t *pos, Double_t &chi2, Double_t *cov, Int_t &ncontrib) const | |
301 | { | |
302 | // get default primary vertex | |
303 | ||
304 | for(Int_t i=0; i<3; i++) pos[i] = fVtxPos[i]; | |
305 | for(Int_t i=0; i<6; i++) cov[i] = fVtxCov[i]; | |
306 | chi2 = fVtxChi2perNDF; | |
307 | ncontrib = fVtxNContributors; | |
308 | } | |
309 | ||
310 | //_____________________________________________________________________________ | |
311 | void AliUPCEvent::GetPrimaryVertexSPD(Double_t *pos, Double_t &chi2, Double_t *cov, Int_t &ncontrib) const | |
312 | { | |
313 | // get SPD primary vertex | |
314 | ||
315 | for(Int_t i=0; i<3; i++) pos[i] = fVtxSPDpos[i]; | |
316 | for(Int_t i=0; i<6; i++) cov[i] = fVtxSPDcov[i]; | |
317 | chi2 = fVtxSPDchi2perNDF; | |
318 | ncontrib = fVtxSPDnContributors; | |
319 | } | |
320 | ||
321 | //_____________________________________________________________________________ | |
322 | void AliUPCEvent::GetPrimaryVertexMC(Float_t *pos) const | |
323 | { | |
324 | // get generated primary vertex | |
325 | ||
326 | for(Int_t i=0; i<3; i++) pos[i] = fVtxMCpos[i]; | |
327 | } | |
328 | ||
329 | //_____________________________________________________________________________ | |
330 | Int_t AliUPCEvent::GetNV0ChitsOffline(void) const | |
331 | { | |
332 | // get number of fired cells of V0C, offline | |
333 | ||
334 | Int_t nHits = 0; | |
335 | for (UInt_t iv=0; iv<32; iv++) {if( fBBtriggerV0C & (1 << iv) ) nHits++;} | |
336 | ||
337 | return nHits; | |
338 | } | |
339 | ||
340 | //_____________________________________________________________________________ | |
341 | Int_t AliUPCEvent::GetNV0ChitsOnline(void) const | |
342 | { | |
343 | // get number of fired cells of V0C, online | |
344 | ||
345 | Int_t nHits = 0; | |
346 | for (UInt_t iv=0; iv<32; iv++) {if( fBBFlagV0C & (1 << iv) ) nHits++;} | |
347 | ||
348 | return nHits; | |
349 | } | |
350 | ||
351 | //_____________________________________________________________________________ | |
352 | Bool_t AliUPCEvent::GetAllZDCtdc(void) const | |
353 | { | |
354 | // get the final tdc of all ZDCs, return kTRUE if at least one tdc is set, | |
355 | // return kFALSE only if all tdc are empty | |
356 | ||
357 | if( fZNCtdc || fZPCtdc || fZNAtdc || fZPAtdc ) return kTRUE; | |
358 | return kFALSE; | |
359 | } | |
360 | ||
361 | //_____________________________________________________________________________ | |
362 | AliUPCTrack *AliUPCEvent::GetTrack(Int_t iTrack) const | |
363 | { | |
364 | // get upc central track | |
365 | ||
366 | if(!fUPCTracks) return 0x0; | |
367 | ||
368 | return (AliUPCTrack*) fUPCTracks->At(iTrack); | |
369 | } | |
370 | ||
371 | //_____________________________________________________________________________ | |
372 | AliUPCMuonTrack *AliUPCEvent::GetMuonTrack(Int_t iTrack) const | |
373 | { | |
374 | // get upc muon track | |
375 | ||
376 | if(!fUPCMuonTracks) return 0x0; | |
377 | ||
378 | return (AliUPCMuonTrack*) fUPCMuonTracks->At(iTrack); | |
379 | } | |
380 | ||
381 | //_____________________________________________________________________________ | |
382 | TParticle *AliUPCEvent::GetMCParticle(Int_t iMC) const | |
383 | { | |
384 | // get mc TParticle | |
385 | ||
386 | if(!fMCParticles) return 0x0; | |
387 | ||
388 | return (TParticle*) fMCParticles->At(iMC); | |
389 | } | |
390 | ||
391 | /* | |
392 | //_____________________________________________________________________________ | |
393 | AliUPCEvent::AliUPCEvent(const AliUPCEvent &o) | |
394 | :TObject(o), | |
395 | fNTracklets(o.fNTracklets) | |
396 | { | |
397 | ||
398 | // Copy constructor | |
399 | ||
400 | } | |
401 | ||
402 | //_____________________________________________________________________________ | |
403 | AliUPCEvent &AliUPCEvent::operator=(const AliUPCEvent &o) | |
404 | { | |
405 | ||
406 | if(this==&o) return *this; | |
407 | AliUPCEvent::operator=(o); | |
408 | ||
409 | // Assignment operator | |
410 | fNTracklets = o.fNTracklets; | |
411 | ||
412 | return *this; | |
413 | ||
414 | } | |
415 | */ | |
416 | ||
417 | ||
418 | ||
419 | ||
420 | ||
421 | ||
422 | ||
423 | ||
424 | ||
425 | ||
426 | ||
427 | ||
428 | ||
429 | ||
430 | ||
431 | ||
432 | ||
433 | ||
434 | ||
435 | ||
436 | ||
437 | ||
438 | ||
439 | ||
440 | ||
441 | ||
442 | ||
443 | ||
444 | ||
445 | ||
446 | ||
447 | ||
448 | ||
449 | ||
450 | ||
451 | ||
452 | ||
453 | ||
454 | ||
455 | ||
456 | ||
457 | ||
458 |