]>
Commit | Line | Data |
---|---|---|
50837721 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
9140dcef | 17 | // AliMUONData classes |
18 | // Class containing MUON data: hits, digits, rawclusters, globaltrigger, localtrigger, etc .. | |
19 | // The classe makes the lik between the MUON data lists and the event trees from loaders | |
20 | // Gines Martinez, Subatech, September 2003 | |
21 | // | |
22 | ||
6309cf6e | 23 | //Root includes |
1a1cdff8 | 24 | #include "TNamed.h" |
374ebd7d | 25 | //AliRoot include |
1988766a | 26 | #include "AliRun.h" |
27 | #include "AliMC.h" | |
1a1cdff8 | 28 | #include "AliLoader.h" |
29 | #include "AliMUONConstants.h" | |
6309cf6e | 30 | #include "AliMUONData.h" |
31 | #include "AliMUONDigit.h" | |
32 | #include "AliMUONHit.h" | |
33 | #include "AliMUONLocalTrigger.h" | |
34 | #include "AliMUONGlobalTrigger.h" | |
35 | #include "AliMUONRawCluster.h" | |
dcd2690d | 36 | #include "AliMUONTrack.h" |
276c44b7 | 37 | #include "AliMUONTriggerTrack.h" |
6309cf6e | 38 | ClassImp(AliMUONData) |
39 | ||
40 | //_____________________________________________________________________________ | |
1017e5bf | 41 | AliMUONData::AliMUONData(): |
42 | TNamed(), | |
43 | fLoader(0x0), | |
44 | fHits(0x0), | |
45 | fDigits(0x0), | |
46 | fSDigits(0x0), | |
47 | fRawClusters(0x0), | |
48 | fGlobalTrigger(0x0), | |
49 | fLocalTrigger(0x0), | |
50 | fRecTracks(0x0), | |
51 | fRecTriggerTracks(0x0), | |
52 | fNhits(0), | |
53 | fNdigits(0x0), | |
54 | fNSdigits(0x0), | |
55 | fNrawclusters(0x0), | |
56 | fNglobaltrigger(0), | |
57 | fNlocaltrigger(0), | |
58 | fNrectracks(0), | |
59 | fNrectriggertracks(0), | |
60 | fSplitLevel(0) | |
6309cf6e | 61 | { |
9140dcef | 62 | // Default constructor |
6309cf6e | 63 | } |
64 | //_____________________________________________________________________________ | |
65 | AliMUONData::AliMUONData(AliLoader * loader, const char* name, const char* title): | |
1017e5bf | 66 | TNamed(name,title), |
67 | fLoader(loader), | |
68 | fHits(0x0), | |
69 | fDigits(0x0), | |
70 | fSDigits(0x0), | |
71 | fRawClusters(0x0), | |
72 | fGlobalTrigger(0x0), | |
73 | fLocalTrigger(0x0), | |
74 | fRecTracks(0x0), | |
75 | fRecTriggerTracks(0x0), | |
76 | fNhits(0), | |
77 | fNdigits(0x0), | |
78 | fNSdigits(0x0), | |
79 | fNrawclusters(0x0), | |
80 | fNglobaltrigger(0), | |
81 | fNlocaltrigger(0), | |
82 | fNrectracks(0), | |
83 | fNrectriggertracks(0), | |
84 | fSplitLevel(0) | |
6309cf6e | 85 | { |
9140dcef | 86 | // Constructor for AliMUONData |
1017e5bf | 87 | |
b1c7d777 | 88 | // fHits = new TClonesArray("AliMUONHit",1000); |
89 | // fNhits = 0; | |
90 | // fDigits = new TObjArray(AliMUONConstants::NCh()); | |
91 | // fNdigits = new Int_t[AliMUONConstants::NCh()]; | |
92 | // for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) { | |
93 | // fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),iDetectionPlane); | |
94 | // fNdigits[iDetectionPlane]=0; | |
95 | // } | |
96 | // fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh()); | |
97 | // fNrawclusters = new Int_t[AliMUONConstants::NTrackingCh()]; | |
98 | // for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NTrackingCh();iDetectionPlane++) { | |
99 | // fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),iDetectionPlane); | |
100 | // fNrawclusters[iDetectionPlane]=0; | |
101 | // } | |
102 | // fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1); | |
103 | // fNglobaltrigger =0; | |
104 | // fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234); | |
105 | // fNlocaltrigger = 0; | |
374ebd7d | 106 | // fRecTracks = new TClonesArray("AliMUONTrack", 100); |
b1c7d777 | 107 | // fNrectracks = 0; // really needed or GetEntriesFast sufficient ???? |
108 | ||
109 | ||
6309cf6e | 110 | } |
e3ea1889 | 111 | |
6309cf6e | 112 | //_____________________________________________________________________________ |
113 | AliMUONData::AliMUONData(const AliMUONData& rMUONData):TNamed(rMUONData) | |
114 | { | |
e3ea1889 | 115 | // Protected copy constructor |
116 | ||
117 | Fatal("AliMUONData", "Not implemented."); | |
6309cf6e | 118 | } |
e3ea1889 | 119 | |
6309cf6e | 120 | //_____________________________________________________________________________ |
121 | AliMUONData::~AliMUONData() | |
122 | { | |
9140dcef | 123 | // Destructor for AliMUONData |
6309cf6e | 124 | if (fHits) { |
125 | fHits->Delete(); | |
126 | delete fHits; | |
127 | } | |
128 | if (fDigits) { | |
129 | fDigits->Delete(); | |
130 | delete fDigits; | |
131 | } | |
d1775029 | 132 | if (fSDigits) { |
133 | fSDigits->Delete(); | |
134 | delete fSDigits; | |
135 | } | |
6309cf6e | 136 | if (fRawClusters) { |
137 | fRawClusters->Delete(); | |
138 | delete fRawClusters; | |
139 | } | |
140 | if (fGlobalTrigger){ | |
141 | fGlobalTrigger->Delete(); | |
142 | delete fGlobalTrigger; | |
143 | } | |
144 | if (fLocalTrigger){ | |
145 | fLocalTrigger->Delete(); | |
146 | delete fLocalTrigger; | |
147 | } | |
dcd2690d | 148 | if (fRecTracks){ |
149 | fRecTracks->Delete(); | |
150 | delete fRecTracks; | |
151 | } | |
276c44b7 | 152 | if (fRecTriggerTracks){ |
153 | fRecTriggerTracks->Delete(); | |
154 | delete fRecTriggerTracks; | |
155 | } | |
6309cf6e | 156 | //detructor |
157 | } | |
e3ea1889 | 158 | |
159 | //_____________________________________________________________________________ | |
160 | AliMUONData& AliMUONData::operator=(const AliMUONData& rhs) | |
161 | { | |
162 | // Protected assignement operator | |
163 | ||
164 | if (this == &rhs) return *this; | |
165 | ||
166 | Fatal("operator=", "Not implemented."); | |
167 | ||
168 | return *this; | |
169 | } | |
170 | ||
171 | ||
6309cf6e | 172 | //_____________________________________________________________________________ |
173 | void AliMUONData::AddDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits) | |
174 | { | |
175 | // | |
176 | // Add a MUON digit to the list of Digits of the detection plane id | |
177 | // | |
1a1cdff8 | 178 | TClonesArray &ldigits = * Digits(id) ; |
6309cf6e | 179 | new(ldigits[fNdigits[id]++]) AliMUONDigit(tracks,charges,digits); |
180 | } | |
181 | //_____________________________________________________________________________ | |
61adb9bd | 182 | void AliMUONData::AddDigit(Int_t id, const AliMUONDigit& digit) |
183 | { | |
184 | // | |
185 | // Add a MUON digit to the list of Digits of the detection plane id | |
186 | // | |
187 | TClonesArray &ldigits = * Digits(id) ; | |
188 | new(ldigits[fNdigits[id]++]) AliMUONDigit(digit); | |
189 | } | |
190 | //_____________________________________________________________________________ | |
d1775029 | 191 | void AliMUONData::AddSDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *Sdigits) |
192 | { | |
193 | // | |
194 | // Add a MUON Sdigit to the list of SDigits of the detection plane id | |
195 | // | |
196 | TClonesArray &lSdigits = * SDigits(id) ; | |
197 | new(lSdigits[fNSdigits[id]++]) AliMUONDigit(tracks,charges,Sdigits); | |
198 | } | |
199 | //_____________________________________________________________________________ | |
200 | void AliMUONData::AddSDigit(Int_t id, const AliMUONDigit& Sdigit) | |
201 | { | |
202 | // | |
203 | // Add a MUON Sdigit to the list of SDigits of the detection plane id | |
204 | // | |
205 | TClonesArray &lSdigits = * SDigits(id) ; | |
206 | new(lSdigits[fNSdigits[id]++]) AliMUONDigit(Sdigit); | |
207 | } | |
208 | //_____________________________________________________________________________ | |
6309cf6e | 209 | void AliMUONData::AddGlobalTrigger(Int_t *singlePlus, Int_t *singleMinus, |
210 | Int_t *singleUndef, | |
211 | Int_t *pairUnlike, Int_t *pairLike) | |
212 | { | |
213 | // add a MUON Global Trigger to the list (only one GlobalTrigger per event !) | |
214 | TClonesArray &globalTrigger = *fGlobalTrigger; | |
215 | new(globalTrigger[fNglobaltrigger++]) | |
216 | AliMUONGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike); | |
217 | } | |
218 | //_____________________________________________________________________________ | |
61adb9bd | 219 | void AliMUONData::AddGlobalTrigger(const AliMUONGlobalTrigger& trigger ) |
220 | { | |
221 | // add a MUON Global Trigger to the list (only one GlobalTrigger per event !) | |
222 | TClonesArray &globalTrigger = *fGlobalTrigger; | |
223 | new(globalTrigger[fNglobaltrigger++]) AliMUONGlobalTrigger(trigger); | |
224 | } | |
225 | //_____________________________________________________________________________ | |
6309cf6e | 226 | void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber, |
227 | Int_t idpart, Float_t X, Float_t Y, Float_t Z, | |
228 | Float_t tof, Float_t momentum, Float_t theta, | |
229 | Float_t phi, Float_t length, Float_t destep) | |
230 | { | |
9140dcef | 231 | // Add new hit to the hit list |
6309cf6e | 232 | TClonesArray &lhits = *fHits; |
233 | new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber, | |
234 | idpart, X, Y, Z, | |
235 | tof, momentum, theta, | |
236 | phi, length, destep); | |
237 | } | |
238 | //____________________________________________________________________________ | |
1391e633 | 239 | void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber, |
240 | Int_t idpart, Float_t X, Float_t Y, Float_t Z, | |
241 | Float_t tof, Float_t momentum, Float_t theta, | |
242 | Float_t phi, Float_t length, Float_t destep, | |
243 | Float_t Xref,Float_t Yref,Float_t Zref) | |
244 | { | |
9140dcef | 245 | // Add new hit to the hit list |
1391e633 | 246 | TClonesArray &lhits = *fHits; |
247 | new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber, | |
248 | idpart, X, Y, Z, | |
249 | tof, momentum, theta, | |
250 | phi, length, destep, | |
251 | Xref,Yref,Zref); | |
252 | } | |
253 | //____________________________________________________________________________ | |
61adb9bd | 254 | void AliMUONData::AddHit(const AliMUONHit& hit) |
255 | { | |
256 | TClonesArray &lhits = *fHits; | |
257 | new(lhits[fNhits++]) AliMUONHit(hit); | |
258 | } | |
259 | //____________________________________________________________________________ | |
6309cf6e | 260 | void AliMUONData::AddLocalTrigger(Int_t *localtr) |
261 | { | |
262 | // add a MUON Local Trigger to the list | |
263 | TClonesArray &localTrigger = *fLocalTrigger; | |
264 | new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(localtr); | |
265 | } | |
61adb9bd | 266 | //____________________________________________________________________________ |
267 | void AliMUONData::AddLocalTrigger(const AliMUONLocalTrigger& trigger) | |
268 | { | |
269 | // add a MUON Local Trigger to the list | |
270 | TClonesArray &localTrigger = *fLocalTrigger; | |
271 | new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(trigger); | |
272 | } | |
6309cf6e | 273 | //_____________________________________________________________________________ |
274 | void AliMUONData::AddRawCluster(Int_t id, const AliMUONRawCluster& c) | |
275 | { | |
276 | // | |
277 | // Add a MUON rawcluster to the list in the detection plane id | |
278 | // | |
279 | TClonesArray &lrawcl = *((TClonesArray*) fRawClusters->At(id)); | |
280 | new(lrawcl[fNrawclusters[id]++]) AliMUONRawCluster(c); | |
281 | } | |
dcd2690d | 282 | //_____________________________________________________________________________ |
283 | void AliMUONData::AddRecTrack(const AliMUONTrack& track) | |
284 | { | |
285 | // | |
286 | // Add a MUON rectrack | |
287 | // | |
288 | TClonesArray &lrectracks = *fRecTracks; | |
289 | new(lrectracks[fNrectracks++]) AliMUONTrack(track); | |
61adb9bd | 290 | // printf("TTTTTT %d ,\n",((AliMUONTrack*)fRecTracks->At(fNrectracks-1))->GetNTrackHits()); |
dcd2690d | 291 | } |
276c44b7 | 292 | //_____________________________________________________________________________ |
293 | void AliMUONData::AddRecTriggerTrack(const AliMUONTriggerTrack& triggertrack) | |
294 | { | |
295 | // | |
296 | // Add a MUON triggerrectrack | |
297 | // | |
298 | TClonesArray &lrectriggertracks = *fRecTriggerTracks; | |
299 | new(lrectriggertracks[fNrectriggertracks++]) AliMUONTriggerTrack(triggertrack); | |
300 | // printf("TTTTTT %d ,\n",((AliMUONTrack*)fRecTracks->At(fNrectracks-1))->GetNTrackHits()); | |
301 | } | |
302 | ||
ce3f5e87 | 303 | //____________________________________________________________________________ |
1eccde20 | 304 | TClonesArray* AliMUONData::Digits(Int_t DetectionPlane) |
305 | { | |
9140dcef | 306 | //Getting List of Digits |
1eccde20 | 307 | if (fDigits) |
308 | return ( (TClonesArray*) fDigits->At(DetectionPlane) ); | |
309 | else | |
310 | return NULL; | |
311 | } | |
312 | //____________________________________________________________________________ | |
d1775029 | 313 | TClonesArray* AliMUONData::SDigits(Int_t DetectionPlane) |
314 | { | |
315 | //Getting List of SDigits | |
316 | if (fSDigits) | |
317 | return ( (TClonesArray*) fSDigits->At(DetectionPlane) ); | |
318 | else | |
319 | return NULL; | |
320 | } | |
321 | //____________________________________________________________________________ | |
c1d45bdf | 322 | Bool_t AliMUONData::IsRawClusterBranchesInTree() |
323 | { | |
9140dcef | 324 | // Checking if there are RawCluster Branches In TreeR |
c1d45bdf | 325 | if (TreeR()==0x0) { |
326 | Error("TreeR","No treeR in memory"); | |
327 | return kFALSE; | |
328 | } | |
329 | else { | |
330 | char branchname[30]; | |
331 | sprintf(branchname,"%sRawClusters1",GetName()); | |
332 | TBranch * branch = 0x0; | |
333 | branch = TreeR()->GetBranch(branchname); | |
334 | if (branch) return kTRUE; | |
335 | else return kFALSE; | |
336 | } | |
337 | } | |
338 | //____________________________________________________________________________ | |
339 | Bool_t AliMUONData::IsTriggerBranchesInTree() | |
340 | { | |
9140dcef | 341 | // Checking if there are Trigger Branches In TreeR |
c1d45bdf | 342 | if (TreeR()==0x0) { |
343 | Error("TreeR","No treeR in memory"); | |
344 | return kFALSE; | |
345 | } | |
346 | else { | |
347 | char branchname[30]; | |
348 | sprintf(branchname,"%sLocalTrigger",GetName()); | |
349 | TBranch * branch = 0x0; | |
350 | branch = TreeR()->GetBranch(branchname); | |
351 | if (branch) return kTRUE; | |
352 | else return kFALSE; | |
353 | } | |
354 | } | |
355 | //____________________________________________________________________________ | |
276c44b7 | 356 | Bool_t AliMUONData::IsTrackBranchesInTree() |
357 | { | |
358 | // Checking if there are Track Branches In TreeT | |
359 | if (TreeT()==0x0) { | |
360 | Error("TreeT","No treeT in memory"); | |
361 | return kFALSE; | |
362 | } | |
363 | else { | |
364 | char branchname[30]; | |
365 | sprintf(branchname,"%sTrack",GetName()); | |
366 | TBranch * branch = 0x0; | |
367 | branch = TreeT()->GetBranch(branchname); | |
368 | if (branch) return kTRUE; | |
369 | else return kFALSE; | |
370 | } | |
371 | } | |
372 | //____________________________________________________________________________ | |
373 | Bool_t AliMUONData::IsTriggerTrackBranchesInTree() | |
374 | { | |
375 | // Checking if there are TriggerTrack Branches In TreeT | |
376 | if (TreeT()==0x0) { | |
377 | Error("TreeT","No treeT in memory"); | |
378 | return kFALSE; | |
379 | } | |
380 | else { | |
381 | char branchname[30]; | |
382 | sprintf(branchname,"%sTriggerTrack",GetName()); | |
383 | TBranch * branch = 0x0; | |
384 | branch = TreeT()->GetBranch(branchname); | |
385 | if (branch) return kTRUE; | |
386 | else return kFALSE; | |
387 | } | |
388 | } | |
389 | //____________________________________________________________________________ | |
1a1cdff8 | 390 | void AliMUONData::Fill(Option_t* option) |
391 | { | |
392 | // Method to fill the trees | |
393 | const char *cH = strstr(option,"H"); | |
394 | const char *cD = strstr(option,"D"); // Digits branches in TreeD | |
d1775029 | 395 | const char *cS = strstr(option,"S"); // SDigits branches in TreeS |
1a1cdff8 | 396 | const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR |
397 | const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR | |
398 | const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT | |
276c44b7 | 399 | const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT |
61adb9bd | 400 | |
1a1cdff8 | 401 | //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP |
402 | ||
403 | char branchname[30]; | |
404 | TBranch * branch = 0x0; | |
405 | ||
406 | // | |
407 | // Filling TreeH | |
408 | if ( TreeH() && cH ) { | |
409 | TreeH()->Fill(); | |
410 | } | |
411 | // | |
412 | // Filling TreeD | |
413 | if ( TreeD() && cD) { | |
414 | TreeD()->Fill(); | |
415 | } | |
d1775029 | 416 | // Filling TreeS |
417 | if ( TreeS() && cS) { | |
418 | TreeS()->Fill(); | |
419 | } | |
c1d45bdf | 420 | |
1a1cdff8 | 421 | // |
422 | // filling rawclusters | |
c1d45bdf | 423 | if ( TreeR() && cRC ) { |
424 | if ( IsTriggerBranchesInTree() ) { | |
425 | // Branch per branch filling | |
426 | for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) { | |
427 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); | |
428 | branch = TreeR()->GetBranch(branchname); | |
429 | branch->Fill(); | |
430 | } | |
431 | } | |
432 | else TreeR()->Fill(); | |
1a1cdff8 | 433 | } |
c1d45bdf | 434 | |
1a1cdff8 | 435 | // |
436 | // filling trigger | |
437 | if ( TreeR() && cGLT) { | |
346357f4 | 438 | if (IsRawClusterBranchesInTree()) { |
c1d45bdf | 439 | // Branch per branch filling |
440 | sprintf(branchname,"%sLocalTrigger",GetName()); | |
441 | branch = TreeR()->GetBranch(branchname); | |
442 | branch->Fill(); | |
443 | sprintf(branchname,"%sGlobalTrigger",GetName()); | |
444 | branch = TreeR()->GetBranch(branchname); | |
445 | branch->Fill(); | |
446 | } | |
447 | else TreeR()->Fill(); | |
1a1cdff8 | 448 | } |
449 | // | |
450 | // filling tracks | |
451 | if ( TreeT() && cRT ) { | |
276c44b7 | 452 | if (IsTriggerTrackBranchesInTree()) { |
453 | sprintf(branchname,"%sTrack",GetName()); | |
454 | branch = TreeT()->GetBranch(branchname); | |
455 | branch->Fill(); | |
456 | } | |
457 | else TreeT()->Fill(); | |
458 | } | |
459 | // filling trigger tracks | |
460 | if ( TreeT() && cRL ) { | |
461 | if (IsTrackBranchesInTree()) { | |
462 | sprintf(branchname,"%sTriggerTrack",GetName()); | |
463 | branch = TreeT()->GetBranch(branchname); | |
464 | branch->Fill(); | |
465 | } | |
466 | else TreeT()->Fill(); | |
1a1cdff8 | 467 | } |
276c44b7 | 468 | // if ( TreeT() && cRL ) { |
61adb9bd | 469 | // sprintf(branchname,"%sTrackTrig",GetName()); |
470 | // TreeT()->Fill(); | |
471 | // } | |
1a1cdff8 | 472 | } |
473 | //_____________________________________________________________________________ | |
6309cf6e | 474 | void AliMUONData::MakeBranch(Option_t* option) |
475 | { | |
476 | // | |
477 | // Create Tree branches for the MUON. | |
478 | // | |
479 | const Int_t kBufferSize = 4000; | |
480 | char branchname[30]; | |
481 | ||
276c44b7 | 482 | |
6309cf6e | 483 | const char *cH = strstr(option,"H"); |
484 | const char *cD = strstr(option,"D"); // Digits branches in TreeD | |
d1775029 | 485 | const char *cS = strstr(option,"S"); // Digits branches in TreeS |
6309cf6e | 486 | const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR |
487 | const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR | |
488 | const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT | |
276c44b7 | 489 | const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT |
61adb9bd | 490 | //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP |
276c44b7 | 491 | |
6309cf6e | 492 | TBranch * branch = 0x0; |
493 | ||
494 | // Creating Branches for Hits | |
495 | if (TreeH() && cH) { | |
1988766a | 496 | |
497 | if (fHits == 0x0) { | |
498 | fHits = new TClonesArray("AliMUONHit",1000); | |
307d9d04 | 499 | // if (gAlice->GetMCApp()) |
500 | // gAlice->GetMCApp()->AddHitList (fHits); | |
1988766a | 501 | } |
502 | ||
6309cf6e | 503 | fNhits = 0; |
504 | sprintf(branchname,"%sHits",GetName()); | |
505 | branch = TreeH()->GetBranch(branchname); | |
506 | if (branch) { | |
507 | Info("MakeBranch","Branch %s is already in tree.",GetName()); | |
508 | return ; | |
509 | } | |
c6ce342a | 510 | branch = TreeH()->Branch(branchname,&fHits,kBufferSize); |
cba99c31 | 511 | //Info("MakeBranch","Making Branch %s for hits \n",branchname); |
6309cf6e | 512 | } |
513 | ||
514 | //Creating Branches for Digits | |
515 | if (TreeD() && cD ) { | |
516 | // one branch for digits per chamber | |
517 | if (fDigits == 0x0) { | |
ce3f5e87 | 518 | fDigits = new TObjArray(AliMUONConstants::NCh()); |
6309cf6e | 519 | for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) { |
1017e5bf | 520 | TClonesArray * tca = new TClonesArray("AliMUONDigit",10000); |
521 | tca->SetOwner(); | |
522 | fDigits->AddAt(tca,iDetectionPlane); | |
ce3f5e87 | 523 | } |
524 | } | |
525 | if (fNdigits == 0x0) { | |
526 | fNdigits = new Int_t[AliMUONConstants::NCh()]; | |
527 | for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) { | |
6309cf6e | 528 | fNdigits[iDetectionPlane]=0; |
529 | } | |
530 | } | |
531 | for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) { | |
532 | sprintf(branchname,"%sDigits%d",GetName(),iDetectionPlane+1); | |
533 | branch = 0x0; | |
534 | branch = TreeD()->GetBranch(branchname); | |
535 | if (branch) { | |
536 | Info("MakeBranch","Branch %s is already in tree.",GetName()); | |
537 | return; | |
538 | } | |
1a1cdff8 | 539 | TClonesArray * digits = Digits(iDetectionPlane); |
d652f85c | 540 | branch = TreeD()->Branch(branchname, &digits, kBufferSize,1); |
cba99c31 | 541 | //Info("MakeBranch","Making Branch %s for digits in detection plane %d\n",branchname,iDetectionPlane+1); |
6309cf6e | 542 | } |
543 | } | |
544 | ||
d1775029 | 545 | //Creating Branches for SDigits |
546 | if (TreeS() && cS ) { | |
547 | // one branch for Sdigits per chamber | |
548 | if (fSDigits == 0x0) { | |
549 | fSDigits = new TObjArray(AliMUONConstants::NCh()); | |
550 | for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) { | |
1017e5bf | 551 | TClonesArray * tca = new TClonesArray("AliMUONDigit",10000); |
552 | tca->SetOwner(); | |
553 | fSDigits->AddAt(tca,iDetectionPlane); | |
d1775029 | 554 | } |
555 | } | |
556 | if (fNSdigits == 0x0) { | |
557 | fNSdigits = new Int_t[AliMUONConstants::NCh()]; | |
558 | for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) { | |
559 | fNSdigits[iDetectionPlane]=0; | |
560 | } | |
561 | } | |
562 | for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) { | |
563 | sprintf(branchname,"%sSDigits%d",GetName(),iDetectionPlane+1); | |
564 | branch = 0x0; | |
565 | branch = TreeS()->GetBranch(branchname); | |
566 | if (branch) { | |
567 | Info("MakeBranch","Branch %s is already in tree.",GetName()); | |
568 | return; | |
569 | } | |
570 | TClonesArray * Sdigits = SDigits(iDetectionPlane); | |
571 | branch = TreeS()->Branch(branchname, &Sdigits, kBufferSize,1); | |
572 | //Info("MakeBranch","Making Branch %s for Sdigits in detection plane %d\n",branchname,iDetectionPlane+1); | |
573 | } | |
574 | } | |
575 | ||
6309cf6e | 576 | if (TreeR() && cRC ) { |
577 | // one branch for raw clusters per tracking detection plane | |
578 | // | |
579 | Int_t i; | |
580 | if (fRawClusters == 0x0) { | |
581 | fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh()); | |
6309cf6e | 582 | for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) { |
1017e5bf | 583 | TClonesArray * tca = new TClonesArray("AliMUONRawCluster",1000); |
584 | tca->SetOwner(); | |
585 | fRawClusters->AddAt(tca,i); | |
ce3f5e87 | 586 | } |
587 | } | |
588 | ||
589 | if (fNrawclusters == 0x0) { | |
590 | fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()]; | |
591 | for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) { | |
6309cf6e | 592 | fNrawclusters[i]=0; |
593 | } | |
594 | } | |
595 | ||
596 | for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) { | |
597 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); | |
598 | branch = 0x0; | |
599 | branch = TreeR()->GetBranch(branchname); | |
600 | if (branch) { | |
601 | Info("MakeBranch","Branch %s is already in tree.",GetName()); | |
602 | return; | |
603 | } | |
c6ce342a | 604 | branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize); |
cba99c31 | 605 | //Info("MakeBranch","Making Branch %s for rawcluster in detection plane %d\n",branchname,i+1); |
6309cf6e | 606 | } |
607 | } | |
608 | ||
609 | if (TreeR() && cGLT ) { | |
610 | // | |
611 | // one branch for global trigger | |
612 | // | |
613 | sprintf(branchname,"%sGlobalTrigger",GetName()); | |
614 | branch = 0x0; | |
615 | ||
616 | if (fGlobalTrigger == 0x0) { | |
c6ce342a | 617 | fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger"); |
6309cf6e | 618 | fNglobaltrigger = 0; |
619 | } | |
620 | branch = TreeR()->GetBranch(branchname); | |
621 | if (branch) { | |
622 | Info("MakeBranch","Branch %s is already in tree.",GetName()); | |
623 | return ; | |
624 | } | |
c6ce342a | 625 | branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize); |
cba99c31 | 626 | //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname); |
6309cf6e | 627 | |
628 | // | |
629 | // one branch for local trigger | |
630 | // | |
631 | sprintf(branchname,"%sLocalTrigger",GetName()); | |
632 | branch = 0x0; | |
633 | ||
634 | if (fLocalTrigger == 0x0) { | |
635 | fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234); | |
636 | fNlocaltrigger = 0; | |
637 | } | |
638 | branch = TreeR()->GetBranch(branchname); | |
639 | if (branch) { | |
640 | Info("MakeBranch","Branch %s is already in tree.",GetName()); | |
641 | return; | |
642 | } | |
c6ce342a | 643 | branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize); |
cba99c31 | 644 | //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname); |
6309cf6e | 645 | } |
646 | ||
dcd2690d | 647 | if (TreeT() && cRT ) { |
374ebd7d | 648 | if (fRecTracks == 0x0) fRecTracks = new TClonesArray("AliMUONTrack",100); |
dcd2690d | 649 | fNrectracks = 0; |
650 | sprintf(branchname,"%sTrack",GetName()); | |
651 | branch = TreeT()->GetBranch(branchname); | |
652 | if (branch) { | |
653 | Info("MakeBranch","Branch %s is already in tree.",GetName()); | |
654 | return ; | |
655 | } | |
656 | branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize); | |
cba99c31 | 657 | //Info("MakeBranch","Making Branch %s for tracks \n",branchname); |
dcd2690d | 658 | } |
276c44b7 | 659 | // trigger tracks |
660 | if (TreeT() && cRL ) { | |
661 | if (fRecTriggerTracks == 0x0) fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100); | |
662 | fNrectriggertracks = 0; | |
663 | sprintf(branchname,"%sTriggerTrack",GetName()); | |
664 | branch = TreeT()->GetBranch(branchname); | |
665 | if (branch) { | |
666 | Info("MakeBranch","Branch %s is already in tree.",GetName()); | |
667 | return ; | |
668 | } | |
669 | branch = TreeT()->Branch(branchname,&fRecTriggerTracks,kBufferSize); | |
cba99c31 | 670 | //Info("MakeBranch","Making Branch %s for trigger tracks \n",branchname); |
276c44b7 | 671 | } |
6309cf6e | 672 | } |
1eccde20 | 673 | //____________________________________________________________________________ |
674 | TClonesArray* AliMUONData::RawClusters(Int_t DetectionPlane) | |
675 | { | |
9140dcef | 676 | // Getting Raw Clusters |
1eccde20 | 677 | if (fRawClusters) |
678 | return ( (TClonesArray*) fRawClusters->At(DetectionPlane) ); | |
679 | else | |
680 | return NULL; | |
681 | } | |
6309cf6e | 682 | //____________________________________________________________________________ |
276c44b7 | 683 | TClonesArray* AliMUONData::LocalTrigger() |
684 | { | |
685 | // Getting Local Trigger | |
686 | if (fLocalTrigger) | |
687 | return ( (TClonesArray*) fLocalTrigger ); | |
688 | else | |
689 | return NULL; | |
690 | } | |
691 | //____________________________________________________________________________ | |
692 | TClonesArray* AliMUONData::GlobalTrigger() | |
693 | { | |
694 | // Getting Global Trigger | |
695 | if (fGlobalTrigger) | |
696 | return ( (TClonesArray*) fGlobalTrigger ); | |
697 | else | |
698 | return NULL; | |
699 | } | |
700 | //____________________________________________________________________________ | |
6309cf6e | 701 | void AliMUONData::ResetDigits() |
702 | { | |
703 | // | |
704 | // Reset number of digits and the digits array for this detector | |
705 | // | |
706 | if (fDigits == 0x0) return; | |
707 | for ( int i=0;i<AliMUONConstants::NCh();i++ ) { | |
708 | if ((*fDigits)[i]) ((TClonesArray*)fDigits->At(i))->Clear(); | |
709 | if (fNdigits) fNdigits[i]=0; | |
710 | } | |
711 | } | |
d1775029 | 712 | //____________________________________________________________________________ |
713 | void AliMUONData::ResetSDigits() | |
714 | { | |
715 | // | |
716 | // Reset number of Sdigits and the Sdigits array for this detector | |
717 | // | |
718 | if (fSDigits == 0x0) return; | |
719 | for ( int i=0;i<AliMUONConstants::NCh();i++ ) { | |
720 | if ((*fSDigits)[i]) ((TClonesArray*)fSDigits->At(i))->Clear(); | |
721 | if (fNSdigits) fNSdigits[i]=0; | |
722 | } | |
723 | } | |
6309cf6e | 724 | //______________________________________________________________________________ |
725 | void AliMUONData::ResetHits() | |
726 | { | |
727 | // Reset number of clusters and the cluster array for this detector | |
728 | fNhits = 0; | |
729 | if (fHits) fHits->Clear(); | |
730 | } | |
731 | //_______________________________________________________________________________ | |
732 | void AliMUONData::ResetRawClusters() | |
733 | { | |
734 | // Reset number of raw clusters and the raw clust array for this detector | |
735 | // | |
736 | for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) { | |
737 | if ((*fRawClusters)[i]) ((TClonesArray*)fRawClusters->At(i))->Clear(); | |
738 | if (fNrawclusters) fNrawclusters[i]=0; | |
739 | } | |
740 | } | |
741 | //_______________________________________________________________________________ | |
742 | void AliMUONData::ResetTrigger() | |
743 | { | |
744 | // Reset Local and Global Trigger | |
745 | fNglobaltrigger = 0; | |
746 | if (fGlobalTrigger) fGlobalTrigger->Clear(); | |
747 | fNlocaltrigger = 0; | |
748 | if (fLocalTrigger) fLocalTrigger->Clear(); | |
749 | } | |
dcd2690d | 750 | //____________________________________________________________________________ |
751 | void AliMUONData::ResetRecTracks() | |
752 | { | |
753 | // Reset tracks information | |
754 | fNrectracks = 0; | |
755 | if (fRecTracks) fRecTracks->Clear(); | |
756 | } | |
276c44b7 | 757 | //____________________________________________________________________________ |
758 | void AliMUONData::ResetRecTriggerTracks() | |
759 | { | |
760 | // Reset tracks information | |
761 | fNrectriggertracks = 0; | |
762 | if (fRecTriggerTracks) fRecTriggerTracks->Clear(); | |
763 | } | |
6309cf6e | 764 | //_____________________________________________________________________________ |
ce3f5e87 | 765 | void AliMUONData::SetTreeAddress(Option_t* option) |
6309cf6e | 766 | { |
9140dcef | 767 | //Setting Addresses to the events trees |
ce3f5e87 | 768 | const char *cH = strstr(option,"H"); |
769 | const char *cD = strstr(option,"D"); // Digits branches in TreeD | |
d1775029 | 770 | const char *cS = strstr(option,"S"); // SDigits branches in TreeS |
ce3f5e87 | 771 | const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR |
772 | const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR | |
dcd2690d | 773 | const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT |
276c44b7 | 774 | const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT |
ce3f5e87 | 775 | //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP |
776 | ||
6309cf6e | 777 | // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree. |
778 | char branchname[30]; | |
779 | TBranch * branch = 0x0; | |
780 | ||
781 | // | |
782 | // Branch address for hit tree | |
ce3f5e87 | 783 | if ( TreeH() && cH ) { |
88cf591d | 784 | if (fHits == 0x0) { |
785 | fHits = new TClonesArray("AliMUONHit",1000); | |
d1775029 | 786 | // if (gAlice->GetMCApp()) |
787 | // gAlice->GetMCApp()->AddHitList (fHits); Moved to AliMUON | |
88cf591d | 788 | } |
6309cf6e | 789 | fNhits =0; |
790 | } | |
ce3f5e87 | 791 | if (TreeH() && fHits && cH) { |
6309cf6e | 792 | sprintf(branchname,"%sHits",GetName()); |
793 | branch = TreeH()->GetBranch(branchname); | |
794 | if (branch) { | |
d652f85c | 795 | // Info("SetTreeAddress","(%s) Setting for Hits",GetName()); |
6309cf6e | 796 | branch->SetAddress(&fHits); |
797 | } | |
798 | else { //can be invoked before branch creation | |
799 | Warning("SetTreeAddress","(%s) Failed for Hits. Can not find branch in tree.",GetName()); | |
800 | } | |
801 | } | |
802 | ||
803 | // | |
804 | // Branch address for digit tree | |
ce3f5e87 | 805 | if ( TreeD() && cD) { |
6309cf6e | 806 | if (fDigits == 0x0) { |
807 | fDigits = new TObjArray(AliMUONConstants::NCh()); | |
808 | fNdigits= new Int_t[AliMUONConstants::NCh()]; | |
809 | for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) { | |
810 | fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i); | |
811 | fNdigits[i]=0; | |
812 | } | |
813 | } | |
814 | } | |
815 | ||
ce3f5e87 | 816 | if (TreeD() && fDigits && cD) { |
6309cf6e | 817 | for (int i=0; i<AliMUONConstants::NCh(); i++) { |
818 | sprintf(branchname,"%sDigits%d",GetName(),i+1); | |
d652f85c | 819 | if (fDigits) { |
820 | branch = TreeD()->GetBranch(branchname); | |
821 | TClonesArray * digits = Digits(i); | |
d1775029 | 822 | if (branch) { |
823 | branch->SetAddress( &digits ); | |
824 | } | |
d652f85c | 825 | else Warning("SetTreeAddress","(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i); |
826 | } | |
6309cf6e | 827 | } |
828 | } | |
d1775029 | 829 | // |
830 | // Branch address for Sdigit tree | |
831 | if ( TreeS() && cS) { | |
832 | if (fSDigits == 0x0) { | |
833 | fSDigits = new TObjArray(AliMUONConstants::NCh()); | |
834 | fNSdigits= new Int_t[AliMUONConstants::NCh()]; | |
835 | for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) { | |
836 | fSDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i); | |
837 | fNSdigits[i]=0; | |
838 | } | |
839 | } | |
840 | } | |
841 | ||
842 | if (TreeS() && fSDigits && cS) { | |
843 | for (int i=0; i<AliMUONConstants::NCh(); i++) { | |
844 | sprintf(branchname,"%sSDigits%d",GetName(),i+1); | |
845 | if (fSDigits) { | |
846 | branch = TreeS()->GetBranch(branchname); | |
847 | TClonesArray * Sdigits = SDigits(i); | |
848 | if (branch) branch->SetAddress( &Sdigits ); | |
849 | else Warning("SetTreeAddress","(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i); | |
850 | } | |
851 | } | |
852 | } | |
6309cf6e | 853 | |
854 | // | |
855 | // Branch address for rawclusters, globaltrigger and local trigger tree | |
856 | if (TreeR() ) { | |
ce3f5e87 | 857 | if (fRawClusters == 0x0 && cRC) { |
6309cf6e | 858 | fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh()); |
859 | fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()]; | |
860 | for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) { | |
861 | fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i); | |
862 | fNrawclusters[i]=0; | |
863 | } | |
864 | } | |
ce3f5e87 | 865 | if (fLocalTrigger == 0x0 && cGLT) { |
6309cf6e | 866 | fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234); |
867 | } | |
ce3f5e87 | 868 | if (fGlobalTrigger== 0x0 && cGLT) { |
6309cf6e | 869 | fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1); |
870 | } | |
871 | ||
872 | } | |
ce3f5e87 | 873 | if ( TreeR() && fRawClusters && cRC) { |
6309cf6e | 874 | for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) { |
875 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); | |
876 | if (fRawClusters) { | |
877 | branch = TreeR()->GetBranch(branchname); | |
d652f85c | 878 | if (branch) branch->SetAddress( &((*fRawClusters)[i]) ); |
6309cf6e | 879 | else Warning("SetTreeAddress","(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i); |
880 | } | |
881 | } | |
882 | } | |
ce3f5e87 | 883 | if ( TreeR() && fLocalTrigger && cGLT) { |
6309cf6e | 884 | sprintf(branchname,"%sLocalTrigger",GetName()); |
885 | branch = TreeR()->GetBranch(branchname); | |
886 | if (branch) branch->SetAddress(&fLocalTrigger); | |
887 | else Warning("SetTreeAddress","(%s) Failed for LocalTrigger. Can not find branch in tree.",GetName()); | |
888 | } | |
ce3f5e87 | 889 | if ( TreeR() && fGlobalTrigger && cGLT) { |
6309cf6e | 890 | sprintf(branchname,"%sGlobalTrigger",GetName()); |
891 | branch = TreeR()->GetBranch(branchname); | |
892 | if (branch) branch->SetAddress(&fGlobalTrigger); | |
893 | else Warning("SetTreeAddress","(%s) Failed for LocalTrigger. Can not find branch in tree.",GetName()); | |
894 | } | |
dcd2690d | 895 | |
8547965d | 896 | if ( TreeT() ) { |
61adb9bd | 897 | if (fRecTracks == 0x0 && cRT) { |
8547965d | 898 | fRecTracks = new TClonesArray("AliMUONTrack",100); |
899 | } | |
61adb9bd | 900 | |
8547965d | 901 | } |
dcd2690d | 902 | if ( TreeT() && fRecTracks && cRT ) { |
903 | sprintf(branchname,"%sTrack",GetName()); | |
904 | branch = TreeT()->GetBranch(branchname); | |
905 | if (branch) branch->SetAddress(&fRecTracks); | |
906 | else Warning("SetTreeAddress","(%s) Failed for Tracks. Can not find branch in tree.",GetName()); | |
907 | } | |
276c44b7 | 908 | // trigger tracks |
909 | if ( TreeT() ) { | |
910 | if (fRecTriggerTracks == 0x0 && cRL) { | |
911 | fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100); | |
912 | } | |
913 | ||
914 | } | |
915 | if ( TreeT() && fRecTriggerTracks && cRL ) { | |
916 | sprintf(branchname,"%sTriggerTrack",GetName()); | |
917 | branch = TreeT()->GetBranch(branchname); | |
918 | if (branch) branch->SetAddress(&fRecTriggerTracks); | |
919 | else Warning("SetTreeAddress","(%s) Failed for Trigger Tracks. Can not find branch in tree.",GetName()); | |
920 | } | |
921 | ||
61adb9bd | 922 | |
6309cf6e | 923 | } |
924 | //_____________________________________________________________________________ |