]>
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$ */ | |
f0945e46 | 17 | |
18 | /// AliMUONData class | |
19 | /// | |
20 | /// Class containing MUON data: hits, digits, rawclusters, globaltrigger, localtrigger, etc .. | |
21 | /// The classe makes the lik between the MUON data lists and the event trees from loaders | |
22 | /// | |
23 | /// Gines Martinez, Subatech, September 2003 | |
24 | /// | |
9140dcef | 25 | |
6309cf6e | 26 | #include "AliMUONData.h" |
c82862d3 | 27 | |
28 | #include "AliLog.h" | |
29 | #include "AliMUONConstants.h" | |
6309cf6e | 30 | #include "AliMUONDigit.h" |
c82862d3 | 31 | #include "AliMUONGlobalTrigger.h" |
6309cf6e | 32 | #include "AliMUONHit.h" |
33 | #include "AliMUONLocalTrigger.h" | |
6309cf6e | 34 | #include "AliMUONRawCluster.h" |
dcd2690d | 35 | #include "AliMUONTrack.h" |
276c44b7 | 36 | #include "AliMUONTriggerTrack.h" |
f0945e46 | 37 | #include "AliRunLoader.h" |
38 | #include "TArrayI.h" | |
c82862d3 | 39 | #include "TString.h" |
30178c30 | 40 | |
6309cf6e | 41 | ClassImp(AliMUONData) |
42 | ||
43 | //_____________________________________________________________________________ | |
1017e5bf | 44 | AliMUONData::AliMUONData(): |
45 | TNamed(), | |
46 | fLoader(0x0), | |
47 | fHits(0x0), | |
48 | fDigits(0x0), | |
49 | fSDigits(0x0), | |
50 | fRawClusters(0x0), | |
51 | fGlobalTrigger(0x0), | |
52 | fLocalTrigger(0x0), | |
53 | fRecTracks(0x0), | |
54 | fRecTriggerTracks(0x0), | |
55 | fNhits(0), | |
56 | fNdigits(0x0), | |
57 | fNSdigits(0x0), | |
58 | fNrawclusters(0x0), | |
59 | fNglobaltrigger(0), | |
60 | fNlocaltrigger(0), | |
61 | fNrectracks(0), | |
62 | fNrectriggertracks(0), | |
f0945e46 | 63 | fSplitLevel(0), |
64 | fCurrentEvent(-1) | |
6309cf6e | 65 | { |
9140dcef | 66 | // Default constructor |
6309cf6e | 67 | } |
68 | //_____________________________________________________________________________ | |
69 | AliMUONData::AliMUONData(AliLoader * loader, const char* name, const char* title): | |
1017e5bf | 70 | TNamed(name,title), |
71 | fLoader(loader), | |
72 | fHits(0x0), | |
73 | fDigits(0x0), | |
74 | fSDigits(0x0), | |
75 | fRawClusters(0x0), | |
76 | fGlobalTrigger(0x0), | |
77 | fLocalTrigger(0x0), | |
78 | fRecTracks(0x0), | |
79 | fRecTriggerTracks(0x0), | |
80 | fNhits(0), | |
81 | fNdigits(0x0), | |
82 | fNSdigits(0x0), | |
83 | fNrawclusters(0x0), | |
84 | fNglobaltrigger(0), | |
85 | fNlocaltrigger(0), | |
86 | fNrectracks(0), | |
87 | fNrectriggertracks(0), | |
f0945e46 | 88 | fSplitLevel(0), |
89 | fCurrentEvent(-1) | |
6309cf6e | 90 | { |
9140dcef | 91 | // Constructor for AliMUONData |
6309cf6e | 92 | } |
e3ea1889 | 93 | |
6309cf6e | 94 | //_____________________________________________________________________________ |
95 | AliMUONData::AliMUONData(const AliMUONData& rMUONData):TNamed(rMUONData) | |
96 | { | |
e3ea1889 | 97 | // Protected copy constructor |
98 | ||
8c343c7c | 99 | AliFatal("Not implemented."); |
6309cf6e | 100 | } |
e3ea1889 | 101 | |
6309cf6e | 102 | //_____________________________________________________________________________ |
103 | AliMUONData::~AliMUONData() | |
104 | { | |
9140dcef | 105 | // Destructor for AliMUONData |
6309cf6e | 106 | if (fHits) { |
107 | fHits->Delete(); | |
108 | delete fHits; | |
109 | } | |
c82862d3 | 110 | |
6309cf6e | 111 | if (fDigits) { |
112 | fDigits->Delete(); | |
113 | delete fDigits; | |
114 | } | |
d1775029 | 115 | if (fSDigits) { |
116 | fSDigits->Delete(); | |
117 | delete fSDigits; | |
118 | } | |
6309cf6e | 119 | if (fRawClusters) { |
120 | fRawClusters->Delete(); | |
121 | delete fRawClusters; | |
122 | } | |
123 | if (fGlobalTrigger){ | |
124 | fGlobalTrigger->Delete(); | |
125 | delete fGlobalTrigger; | |
126 | } | |
127 | if (fLocalTrigger){ | |
128 | fLocalTrigger->Delete(); | |
129 | delete fLocalTrigger; | |
130 | } | |
dcd2690d | 131 | if (fRecTracks){ |
132 | fRecTracks->Delete(); | |
133 | delete fRecTracks; | |
134 | } | |
276c44b7 | 135 | if (fRecTriggerTracks){ |
136 | fRecTriggerTracks->Delete(); | |
137 | delete fRecTriggerTracks; | |
138 | } | |
6309cf6e | 139 | } |
e3ea1889 | 140 | |
141 | //_____________________________________________________________________________ | |
142 | AliMUONData& AliMUONData::operator=(const AliMUONData& rhs) | |
143 | { | |
144 | // Protected assignement operator | |
145 | ||
146 | if (this == &rhs) return *this; | |
147 | ||
8c343c7c | 148 | AliFatal("Not implemented."); |
e3ea1889 | 149 | |
150 | return *this; | |
151 | } | |
152 | ||
153 | ||
6309cf6e | 154 | //_____________________________________________________________________________ |
155 | void AliMUONData::AddDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits) | |
156 | { | |
157 | // | |
158 | // Add a MUON digit to the list of Digits of the detection plane id | |
159 | // | |
1a1cdff8 | 160 | TClonesArray &ldigits = * Digits(id) ; |
6309cf6e | 161 | new(ldigits[fNdigits[id]++]) AliMUONDigit(tracks,charges,digits); |
162 | } | |
163 | //_____________________________________________________________________________ | |
61adb9bd | 164 | void AliMUONData::AddDigit(Int_t id, const AliMUONDigit& digit) |
165 | { | |
166 | // | |
167 | // Add a MUON digit to the list of Digits of the detection plane id | |
168 | // | |
169 | TClonesArray &ldigits = * Digits(id) ; | |
170 | new(ldigits[fNdigits[id]++]) AliMUONDigit(digit); | |
171 | } | |
172 | //_____________________________________________________________________________ | |
30178c30 | 173 | void AliMUONData::AddSDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *sdigits) |
d1775029 | 174 | { |
175 | // | |
176 | // Add a MUON Sdigit to the list of SDigits of the detection plane id | |
177 | // | |
178 | TClonesArray &lSdigits = * SDigits(id) ; | |
30178c30 | 179 | new(lSdigits[fNSdigits[id]++]) AliMUONDigit(tracks,charges,sdigits); |
d1775029 | 180 | } |
181 | //_____________________________________________________________________________ | |
182 | void AliMUONData::AddSDigit(Int_t id, const AliMUONDigit& Sdigit) | |
183 | { | |
184 | // | |
185 | // Add a MUON Sdigit to the list of SDigits of the detection plane id | |
186 | // | |
187 | TClonesArray &lSdigits = * SDigits(id) ; | |
188 | new(lSdigits[fNSdigits[id]++]) AliMUONDigit(Sdigit); | |
189 | } | |
190 | //_____________________________________________________________________________ | |
6309cf6e | 191 | void AliMUONData::AddGlobalTrigger(Int_t *singlePlus, Int_t *singleMinus, |
192 | Int_t *singleUndef, | |
193 | Int_t *pairUnlike, Int_t *pairLike) | |
194 | { | |
195 | // add a MUON Global Trigger to the list (only one GlobalTrigger per event !) | |
ce3e25a8 | 196 | |
6309cf6e | 197 | TClonesArray &globalTrigger = *fGlobalTrigger; |
198 | new(globalTrigger[fNglobaltrigger++]) | |
199 | AliMUONGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike); | |
200 | } | |
201 | //_____________________________________________________________________________ | |
61adb9bd | 202 | void AliMUONData::AddGlobalTrigger(const AliMUONGlobalTrigger& trigger ) |
203 | { | |
ce3e25a8 | 204 | // add a MUON Global Trigger to the list (only one GlobalTrigger per event !); |
61adb9bd | 205 | TClonesArray &globalTrigger = *fGlobalTrigger; |
206 | new(globalTrigger[fNglobaltrigger++]) AliMUONGlobalTrigger(trigger); | |
207 | } | |
d59b2ec3 | 208 | //____________________________________________________________________________ |
6309cf6e | 209 | void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber, |
210 | Int_t idpart, Float_t X, Float_t Y, Float_t Z, | |
211 | Float_t tof, Float_t momentum, Float_t theta, | |
d59b2ec3 | 212 | Float_t phi, Float_t length, Float_t destep, |
213 | Float_t Xref,Float_t Yref,Float_t Zref) | |
6309cf6e | 214 | { |
d59b2ec3 | 215 | // Add new hit to the hit list |
6309cf6e | 216 | TClonesArray &lhits = *fHits; |
217 | new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber, | |
218 | idpart, X, Y, Z, | |
219 | tof, momentum, theta, | |
d59b2ec3 | 220 | phi, length, destep, |
8690a0a6 | 221 | Xref,Yref,Zref); |
6309cf6e | 222 | } |
223 | //____________________________________________________________________________ | |
d59b2ec3 | 224 | void AliMUONData::AddHit2(Int_t fIshunt, Int_t track, Int_t detElemId, |
1391e633 | 225 | Int_t idpart, Float_t X, Float_t Y, Float_t Z, |
226 | Float_t tof, Float_t momentum, Float_t theta, | |
227 | Float_t phi, Float_t length, Float_t destep, | |
228 | Float_t Xref,Float_t Yref,Float_t Zref) | |
229 | { | |
9140dcef | 230 | // Add new hit to the hit list |
1391e633 | 231 | TClonesArray &lhits = *fHits; |
d59b2ec3 | 232 | new(lhits[fNhits++]) AliMUONHit(fIshunt, track, detElemId, |
1391e633 | 233 | idpart, X, Y, Z, |
234 | tof, momentum, theta, | |
235 | phi, length, destep, | |
d59b2ec3 | 236 | Xref,Yref,Zref, true); |
61adb9bd | 237 | } |
238 | //____________________________________________________________________________ | |
2be06f1e | 239 | void AliMUONData::AddLocalTrigger(const Int_t *localtr, const TArrayI& digits) |
6309cf6e | 240 | { |
241 | // add a MUON Local Trigger to the list | |
242 | TClonesArray &localTrigger = *fLocalTrigger; | |
2be06f1e | 243 | new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(localtr, digits); |
6309cf6e | 244 | } |
61adb9bd | 245 | //____________________________________________________________________________ |
246 | void AliMUONData::AddLocalTrigger(const AliMUONLocalTrigger& trigger) | |
247 | { | |
248 | // add a MUON Local Trigger to the list | |
249 | TClonesArray &localTrigger = *fLocalTrigger; | |
250 | new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(trigger); | |
251 | } | |
6309cf6e | 252 | //_____________________________________________________________________________ |
253 | void AliMUONData::AddRawCluster(Int_t id, const AliMUONRawCluster& c) | |
254 | { | |
255 | // | |
256 | // Add a MUON rawcluster to the list in the detection plane id | |
257 | // | |
258 | TClonesArray &lrawcl = *((TClonesArray*) fRawClusters->At(id)); | |
259 | new(lrawcl[fNrawclusters[id]++]) AliMUONRawCluster(c); | |
260 | } | |
dcd2690d | 261 | //_____________________________________________________________________________ |
262 | void AliMUONData::AddRecTrack(const AliMUONTrack& track) | |
263 | { | |
264 | // | |
265 | // Add a MUON rectrack | |
266 | // | |
267 | TClonesArray &lrectracks = *fRecTracks; | |
268 | new(lrectracks[fNrectracks++]) AliMUONTrack(track); | |
61adb9bd | 269 | // printf("TTTTTT %d ,\n",((AliMUONTrack*)fRecTracks->At(fNrectracks-1))->GetNTrackHits()); |
dcd2690d | 270 | } |
276c44b7 | 271 | //_____________________________________________________________________________ |
272 | void AliMUONData::AddRecTriggerTrack(const AliMUONTriggerTrack& triggertrack) | |
273 | { | |
274 | // | |
275 | // Add a MUON triggerrectrack | |
276 | // | |
277 | TClonesArray &lrectriggertracks = *fRecTriggerTracks; | |
278 | new(lrectriggertracks[fNrectriggertracks++]) AliMUONTriggerTrack(triggertrack); | |
279 | // printf("TTTTTT %d ,\n",((AliMUONTrack*)fRecTracks->At(fNrectracks-1))->GetNTrackHits()); | |
280 | } | |
281 | ||
ce3f5e87 | 282 | //____________________________________________________________________________ |
c82862d3 | 283 | TClonesArray* AliMUONData::Digits(Int_t DetectionPlane) const |
1eccde20 | 284 | { |
9140dcef | 285 | //Getting List of Digits |
1eccde20 | 286 | if (fDigits) |
287 | return ( (TClonesArray*) fDigits->At(DetectionPlane) ); | |
288 | else | |
289 | return NULL; | |
290 | } | |
291 | //____________________________________________________________________________ | |
c82862d3 | 292 | TClonesArray* AliMUONData::SDigits(Int_t DetectionPlane) const |
d1775029 | 293 | { |
294 | //Getting List of SDigits | |
295 | if (fSDigits) | |
296 | return ( (TClonesArray*) fSDigits->At(DetectionPlane) ); | |
297 | else | |
298 | return NULL; | |
299 | } | |
300 | //____________________________________________________________________________ | |
c1d45bdf | 301 | Bool_t AliMUONData::IsRawClusterBranchesInTree() |
302 | { | |
9140dcef | 303 | // Checking if there are RawCluster Branches In TreeR |
c1d45bdf | 304 | if (TreeR()==0x0) { |
8c343c7c | 305 | AliError("No treeR in memory"); |
c1d45bdf | 306 | return kFALSE; |
307 | } | |
308 | else { | |
309 | char branchname[30]; | |
310 | sprintf(branchname,"%sRawClusters1",GetName()); | |
311 | TBranch * branch = 0x0; | |
312 | branch = TreeR()->GetBranch(branchname); | |
313 | if (branch) return kTRUE; | |
314 | else return kFALSE; | |
315 | } | |
316 | } | |
317 | //____________________________________________________________________________ | |
ce3e25a8 | 318 | Bool_t AliMUONData::IsDigitsBranchesInTree() |
319 | { | |
320 | // Checking if there are RawCluster Branches In TreeR | |
321 | if (TreeD()==0x0) { | |
8c343c7c | 322 | AliError("No treeD in memory"); |
ce3e25a8 | 323 | return kFALSE; |
324 | } | |
325 | else { | |
326 | char branchname[30]; | |
327 | sprintf(branchname,"%sDigits1",GetName()); | |
328 | TBranch * branch = 0x0; | |
329 | branch = TreeD()->GetBranch(branchname); | |
330 | if (branch) return kTRUE; | |
331 | else return kFALSE; | |
332 | } | |
333 | } | |
334 | //____________________________________________________________________________ | |
c1d45bdf | 335 | Bool_t AliMUONData::IsTriggerBranchesInTree() |
336 | { | |
9140dcef | 337 | // Checking if there are Trigger Branches In TreeR |
c1d45bdf | 338 | if (TreeR()==0x0) { |
8c343c7c | 339 | AliError("No treeR in memory"); |
c1d45bdf | 340 | return kFALSE; |
341 | } | |
342 | else { | |
343 | char branchname[30]; | |
344 | sprintf(branchname,"%sLocalTrigger",GetName()); | |
345 | TBranch * branch = 0x0; | |
346 | branch = TreeR()->GetBranch(branchname); | |
347 | if (branch) return kTRUE; | |
348 | else return kFALSE; | |
349 | } | |
350 | } | |
ce3e25a8 | 351 | //____________________________________________________________________________ |
352 | Bool_t AliMUONData::IsTriggerBranchesInTreeD() | |
353 | { | |
354 | // Checking if there are Trigger Branches In TreeR | |
355 | if (TreeD()==0x0) { | |
8c343c7c | 356 | AliError("No treeD in memory"); |
ce3e25a8 | 357 | return kFALSE; |
358 | } | |
359 | else { | |
360 | char branchname[30]; | |
361 | sprintf(branchname,"%sLocalTrigger",GetName()); | |
362 | TBranch * branch = 0x0; | |
363 | branch = TreeD()->GetBranch(branchname); | |
364 | if (branch) return kTRUE; | |
365 | else return kFALSE; | |
366 | } | |
367 | } | |
368 | ||
c1d45bdf | 369 | //____________________________________________________________________________ |
276c44b7 | 370 | Bool_t AliMUONData::IsTrackBranchesInTree() |
371 | { | |
372 | // Checking if there are Track Branches In TreeT | |
373 | if (TreeT()==0x0) { | |
8c343c7c | 374 | AliError("No treeT in memory"); |
276c44b7 | 375 | return kFALSE; |
376 | } | |
377 | else { | |
378 | char branchname[30]; | |
379 | sprintf(branchname,"%sTrack",GetName()); | |
380 | TBranch * branch = 0x0; | |
381 | branch = TreeT()->GetBranch(branchname); | |
382 | if (branch) return kTRUE; | |
383 | else return kFALSE; | |
384 | } | |
385 | } | |
386 | //____________________________________________________________________________ | |
387 | Bool_t AliMUONData::IsTriggerTrackBranchesInTree() | |
388 | { | |
389 | // Checking if there are TriggerTrack Branches In TreeT | |
390 | if (TreeT()==0x0) { | |
8c343c7c | 391 | AliError("No treeT in memory"); |
276c44b7 | 392 | return kFALSE; |
393 | } | |
394 | else { | |
395 | char branchname[30]; | |
396 | sprintf(branchname,"%sTriggerTrack",GetName()); | |
397 | TBranch * branch = 0x0; | |
398 | branch = TreeT()->GetBranch(branchname); | |
399 | if (branch) return kTRUE; | |
400 | else return kFALSE; | |
401 | } | |
402 | } | |
403 | //____________________________________________________________________________ | |
1a1cdff8 | 404 | void AliMUONData::Fill(Option_t* option) |
405 | { | |
406 | // Method to fill the trees | |
407 | const char *cH = strstr(option,"H"); | |
408 | const char *cD = strstr(option,"D"); // Digits branches in TreeD | |
d1775029 | 409 | const char *cS = strstr(option,"S"); // SDigits branches in TreeS |
1a1cdff8 | 410 | const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR |
ce3e25a8 | 411 | const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD |
412 | const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR | |
1a1cdff8 | 413 | const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT |
ce3e25a8 | 414 | const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT |
61adb9bd | 415 | |
1a1cdff8 | 416 | //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP |
417 | ||
418 | char branchname[30]; | |
419 | TBranch * branch = 0x0; | |
420 | ||
1a1cdff8 | 421 | // Filling TreeH |
f0945e46 | 422 | if ( TreeH() && cH ) |
423 | { | |
1a1cdff8 | 424 | TreeH()->Fill(); |
425 | } | |
ce3e25a8 | 426 | |
1a1cdff8 | 427 | // Filling TreeD |
ce3e25a8 | 428 | |
c82862d3 | 429 | if ( TreeD() && cD && cGLT ) |
430 | { | |
f0945e46 | 431 | // Writing digits and (global+local) trigger at once. |
c82862d3 | 432 | TreeD()->Fill(); |
433 | } | |
f0945e46 | 434 | else |
435 | { | |
436 | if ( TreeD() && cD ) | |
437 | { | |
438 | if ( IsTriggerBranchesInTreeD() ) | |
439 | { | |
440 | for (int i=0; i<AliMUONConstants::NCh(); i++) | |
441 | { | |
442 | sprintf(branchname,"%sDigits%d",GetName(),i+1); | |
443 | branch = TreeD()->GetBranch(branchname); | |
444 | branch->Fill(); | |
445 | } | |
446 | } | |
447 | else | |
448 | { | |
449 | TreeD()->Fill(); | |
ce3e25a8 | 450 | } |
f0945e46 | 451 | } |
452 | ||
453 | if ( TreeD() && cGLT ) | |
454 | { | |
455 | if ( IsDigitsBranchesInTree() ) | |
456 | { | |
457 | sprintf(branchname,"%sLocalTrigger",GetName()); | |
458 | branch = TreeD()->GetBranch(branchname); | |
459 | branch->Fill(); | |
460 | sprintf(branchname,"%sGlobalTrigger",GetName()); | |
461 | branch = TreeD()->GetBranch(branchname); | |
462 | branch->Fill(); | |
463 | } | |
464 | else | |
465 | { | |
466 | TreeD()->Fill(); | |
467 | } | |
468 | } | |
469 | } // end of TreeD() handling. | |
ce3e25a8 | 470 | |
d1775029 | 471 | // Filling TreeS |
f0945e46 | 472 | if ( TreeS() && cS) |
473 | { | |
d1775029 | 474 | TreeS()->Fill(); |
475 | } | |
c1d45bdf | 476 | |
f0945e46 | 477 | // Filling TreeR |
478 | ||
479 | if ( TreeR() && cRC && cTC ) | |
480 | { | |
481 | TreeR()->Fill(); | |
482 | } | |
483 | else | |
484 | { | |
485 | if ( TreeR() && cRC ) | |
486 | { | |
487 | if ( IsTriggerBranchesInTree() ) | |
488 | { | |
c1d45bdf | 489 | // Branch per branch filling |
f0945e46 | 490 | for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) |
491 | { | |
492 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); | |
493 | branch = TreeR()->GetBranch(branchname); | |
494 | branch->Fill(); | |
495 | } | |
496 | } | |
497 | else | |
498 | { | |
499 | TreeR()->Fill(); | |
500 | } | |
501 | } | |
502 | ||
503 | if ( TreeR() && cTC) | |
504 | { | |
505 | if (IsRawClusterBranchesInTree()) | |
506 | { | |
507 | // Branch per branch filling | |
508 | sprintf(branchname,"%sLocalTrigger",GetName()); | |
509 | branch = TreeR()->GetBranch(branchname); | |
510 | branch->Fill(); | |
511 | sprintf(branchname,"%sGlobalTrigger",GetName()); | |
512 | branch = TreeR()->GetBranch(branchname); | |
513 | branch->Fill(); | |
514 | } | |
515 | else | |
516 | { | |
517 | TreeR()->Fill(); | |
c1d45bdf | 518 | } |
519 | } | |
1a1cdff8 | 520 | } |
f0945e46 | 521 | |
522 | // Filling TreeT | |
c1d45bdf | 523 | |
f0945e46 | 524 | if ( TreeT() && cRT && cRL ) |
525 | { | |
526 | TreeT()->Fill(); | |
1a1cdff8 | 527 | } |
f0945e46 | 528 | else |
529 | { | |
530 | if ( TreeT() && cRT ) | |
531 | { | |
532 | if (IsTriggerTrackBranchesInTree()) | |
533 | { | |
534 | sprintf(branchname,"%sTrack",GetName()); | |
535 | branch = TreeT()->GetBranch(branchname); | |
536 | branch->Fill(); | |
537 | } | |
538 | else | |
539 | { | |
540 | TreeT()->Fill(); | |
541 | } | |
542 | } | |
543 | ||
544 | if ( TreeT() && cRL ) | |
545 | { | |
546 | if (IsTrackBranchesInTree()) | |
547 | { | |
548 | sprintf(branchname,"%sTriggerTrack",GetName()); | |
549 | branch = TreeT()->GetBranch(branchname); | |
550 | branch->Fill(); | |
551 | } | |
552 | else | |
553 | { | |
554 | TreeT()->Fill(); | |
555 | } | |
276c44b7 | 556 | } |
1a1cdff8 | 557 | } |
558 | } | |
c82862d3 | 559 | |
1a1cdff8 | 560 | //_____________________________________________________________________________ |
6309cf6e | 561 | void AliMUONData::MakeBranch(Option_t* option) |
562 | { | |
563 | // | |
564 | // Create Tree branches for the MUON. | |
565 | // | |
566 | const Int_t kBufferSize = 4000; | |
567 | char branchname[30]; | |
568 | ||
c82862d3 | 569 | |
6309cf6e | 570 | const char *cH = strstr(option,"H"); |
571 | const char *cD = strstr(option,"D"); // Digits branches in TreeD | |
d1775029 | 572 | const char *cS = strstr(option,"S"); // Digits branches in TreeS |
6309cf6e | 573 | const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR |
ce3e25a8 | 574 | const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD |
575 | const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR | |
6309cf6e | 576 | const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT |
276c44b7 | 577 | const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT |
c82862d3 | 578 | //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP |
579 | ||
6309cf6e | 580 | TBranch * branch = 0x0; |
581 | ||
582 | // Creating Branches for Hits | |
583 | if (TreeH() && cH) { | |
c82862d3 | 584 | |
1988766a | 585 | if (fHits == 0x0) { |
c82862d3 | 586 | fHits = new TClonesArray("AliMUONHit",1000); |
587 | // if (gAlice->GetMCApp()) | |
588 | // gAlice->GetMCApp()->AddHitList (fHits); | |
1988766a | 589 | } |
c82862d3 | 590 | |
6309cf6e | 591 | fNhits = 0; |
592 | sprintf(branchname,"%sHits",GetName()); | |
593 | branch = TreeH()->GetBranch(branchname); | |
594 | if (branch) { | |
f0945e46 | 595 | AliInfo(Form("MakeBranch","Branch %s is already in tree.",branchname)); |
6309cf6e | 596 | return ; |
597 | } | |
c6ce342a | 598 | branch = TreeH()->Branch(branchname,&fHits,kBufferSize); |
cba99c31 | 599 | //Info("MakeBranch","Making Branch %s for hits \n",branchname); |
6309cf6e | 600 | } |
601 | ||
602 | //Creating Branches for Digits | |
c82862d3 | 603 | TTree* treeD = 0x0; |
604 | if ( cD || cGLT ) | |
605 | { | |
606 | treeD = TreeD(); | |
607 | } | |
608 | ||
609 | if ( treeD && cD ) | |
610 | { | |
6309cf6e | 611 | // one branch for digits per chamber |
c82862d3 | 612 | if (fDigits == 0x0) |
613 | { | |
ce3f5e87 | 614 | fDigits = new TObjArray(AliMUONConstants::NCh()); |
c82862d3 | 615 | for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) |
616 | { | |
617 | TClonesArray * tca = new TClonesArray("AliMUONDigit",10000); | |
618 | tca->SetOwner(); | |
619 | fDigits->AddAt(tca,iDetectionPlane); | |
ce3f5e87 | 620 | } |
621 | } | |
c82862d3 | 622 | if (fNdigits == 0x0) |
623 | { | |
ce3f5e87 | 624 | fNdigits = new Int_t[AliMUONConstants::NCh()]; |
c82862d3 | 625 | for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) |
626 | { | |
627 | fNdigits[iDetectionPlane]=0; | |
6309cf6e | 628 | } |
629 | } | |
c82862d3 | 630 | for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) |
631 | { | |
6309cf6e | 632 | sprintf(branchname,"%sDigits%d",GetName(),iDetectionPlane+1); |
c82862d3 | 633 | branch = treeD->GetBranch(branchname); |
634 | if (branch) | |
635 | { | |
f0945e46 | 636 | AliInfo(Form("Branch %s is already in tree.",branchname)); |
c82862d3 | 637 | return; |
6309cf6e | 638 | } |
1a1cdff8 | 639 | TClonesArray * digits = Digits(iDetectionPlane); |
c82862d3 | 640 | branch = treeD->Branch(branchname, &digits, kBufferSize,1); |
641 | } | |
6309cf6e | 642 | } |
c82862d3 | 643 | |
644 | if ( treeD && cGLT ) | |
645 | { | |
ce3e25a8 | 646 | // |
647 | // one branch for global trigger | |
648 | // | |
649 | sprintf(branchname,"%sGlobalTrigger",GetName()); | |
ce3e25a8 | 650 | |
c82862d3 | 651 | if (fGlobalTrigger == 0x0) |
652 | { | |
ce3e25a8 | 653 | fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger"); |
654 | fNglobaltrigger = 0; | |
655 | } | |
c82862d3 | 656 | branch = treeD->GetBranch(branchname); |
657 | if (branch) | |
658 | { | |
8c343c7c | 659 | AliInfo(Form("Branch GlobalTrigger is already in treeD.")); |
ce3e25a8 | 660 | return ; |
661 | } | |
c82862d3 | 662 | branch = treeD->Branch(branchname, &fGlobalTrigger, kBufferSize); |
663 | ||
ce3e25a8 | 664 | // |
665 | // one branch for local trigger | |
666 | // | |
667 | sprintf(branchname,"%sLocalTrigger",GetName()); | |
668 | branch = 0x0; | |
669 | ||
c82862d3 | 670 | if (fLocalTrigger == 0x0) |
671 | { | |
ce3e25a8 | 672 | fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234); |
673 | fNlocaltrigger = 0; | |
674 | } | |
c82862d3 | 675 | branch = treeD->GetBranch(branchname); |
676 | if (branch) | |
677 | { | |
8c343c7c | 678 | AliInfo(Form("Branch LocalTrigger is already in treeD.")); |
ce3e25a8 | 679 | return; |
680 | } | |
c82862d3 | 681 | branch = treeD->Branch(branchname, &fLocalTrigger, kBufferSize); |
ce3e25a8 | 682 | } |
c82862d3 | 683 | |
d1775029 | 684 | //Creating Branches for SDigits |
685 | if (TreeS() && cS ) { | |
686 | // one branch for Sdigits per chamber | |
687 | if (fSDigits == 0x0) { | |
688 | fSDigits = new TObjArray(AliMUONConstants::NCh()); | |
689 | for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) { | |
c82862d3 | 690 | TClonesArray * tca = new TClonesArray("AliMUONDigit",10000); |
691 | tca->SetOwner(); | |
692 | fSDigits->AddAt(tca,iDetectionPlane); | |
d1775029 | 693 | } |
694 | } | |
695 | if (fNSdigits == 0x0) { | |
696 | fNSdigits = new Int_t[AliMUONConstants::NCh()]; | |
697 | for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) { | |
c82862d3 | 698 | fNSdigits[iDetectionPlane]=0; |
d1775029 | 699 | } |
700 | } | |
701 | for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) { | |
702 | sprintf(branchname,"%sSDigits%d",GetName(),iDetectionPlane+1); | |
703 | branch = 0x0; | |
704 | branch = TreeS()->GetBranch(branchname); | |
705 | if (branch) { | |
f0945e46 | 706 | AliInfo(Form("Branch %s is already in tree.",branchname)); |
c82862d3 | 707 | return; |
d1775029 | 708 | } |
30178c30 | 709 | TClonesArray * sdigits = SDigits(iDetectionPlane); |
710 | branch = TreeS()->Branch(branchname, &sdigits, kBufferSize,1); | |
711 | //Info("MakeBranch","Making Branch %s for sdigits in detection plane %d\n",branchname,iDetectionPlane+1); | |
c82862d3 | 712 | } |
d1775029 | 713 | } |
c82862d3 | 714 | |
6309cf6e | 715 | if (TreeR() && cRC ) { |
716 | // one branch for raw clusters per tracking detection plane | |
717 | // | |
718 | Int_t i; | |
719 | if (fRawClusters == 0x0) { | |
720 | fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh()); | |
6309cf6e | 721 | for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) { |
c82862d3 | 722 | TClonesArray * tca = new TClonesArray("AliMUONRawCluster",1000); |
723 | tca->SetOwner(); | |
724 | fRawClusters->AddAt(tca,i); | |
ce3f5e87 | 725 | } |
726 | } | |
c82862d3 | 727 | |
ce3f5e87 | 728 | if (fNrawclusters == 0x0) { |
729 | fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()]; | |
730 | for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) { | |
c82862d3 | 731 | fNrawclusters[i]=0; |
6309cf6e | 732 | } |
733 | } | |
734 | ||
735 | for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) { | |
736 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); | |
737 | branch = 0x0; | |
738 | branch = TreeR()->GetBranch(branchname); | |
739 | if (branch) { | |
f0945e46 | 740 | AliInfo(Form("Branch %s is already in tree.",branchname)); |
c82862d3 | 741 | return; |
6309cf6e | 742 | } |
c6ce342a | 743 | branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize); |
cba99c31 | 744 | //Info("MakeBranch","Making Branch %s for rawcluster in detection plane %d\n",branchname,i+1); |
6309cf6e | 745 | } |
746 | } | |
c82862d3 | 747 | |
ce3e25a8 | 748 | if (TreeR() && cTC ) { |
6309cf6e | 749 | // |
750 | // one branch for global trigger | |
751 | // | |
752 | sprintf(branchname,"%sGlobalTrigger",GetName()); | |
753 | branch = 0x0; | |
754 | ||
755 | if (fGlobalTrigger == 0x0) { | |
c6ce342a | 756 | fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger"); |
6309cf6e | 757 | fNglobaltrigger = 0; |
758 | } | |
759 | branch = TreeR()->GetBranch(branchname); | |
760 | if (branch) { | |
8c343c7c | 761 | AliInfo(Form("Branch GlobalTrigger is already in treeR.")); |
6309cf6e | 762 | return ; |
763 | } | |
c6ce342a | 764 | branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize); |
cba99c31 | 765 | //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname); |
6309cf6e | 766 | |
767 | // | |
768 | // one branch for local trigger | |
769 | // | |
770 | sprintf(branchname,"%sLocalTrigger",GetName()); | |
771 | branch = 0x0; | |
772 | ||
773 | if (fLocalTrigger == 0x0) { | |
774 | fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234); | |
775 | fNlocaltrigger = 0; | |
776 | } | |
777 | branch = TreeR()->GetBranch(branchname); | |
778 | if (branch) { | |
8c343c7c | 779 | AliInfo(Form("Branch LocalTrigger is already in treeR.")); |
6309cf6e | 780 | return; |
781 | } | |
c6ce342a | 782 | branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize); |
cba99c31 | 783 | //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname); |
6309cf6e | 784 | } |
785 | ||
dcd2690d | 786 | if (TreeT() && cRT ) { |
374ebd7d | 787 | if (fRecTracks == 0x0) fRecTracks = new TClonesArray("AliMUONTrack",100); |
dcd2690d | 788 | fNrectracks = 0; |
789 | sprintf(branchname,"%sTrack",GetName()); | |
790 | branch = TreeT()->GetBranch(branchname); | |
791 | if (branch) { | |
8c343c7c | 792 | AliInfo(Form("Branch %s is already in tree.",GetName())); |
dcd2690d | 793 | return ; |
794 | } | |
795 | branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize); | |
cba99c31 | 796 | //Info("MakeBranch","Making Branch %s for tracks \n",branchname); |
dcd2690d | 797 | } |
c82862d3 | 798 | // trigger tracks |
276c44b7 | 799 | if (TreeT() && cRL ) { |
800 | if (fRecTriggerTracks == 0x0) fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100); | |
801 | fNrectriggertracks = 0; | |
802 | sprintf(branchname,"%sTriggerTrack",GetName()); | |
803 | branch = TreeT()->GetBranch(branchname); | |
804 | if (branch) { | |
8c343c7c | 805 | AliInfo(Form("Branch %s is already in tree.",GetName())); |
276c44b7 | 806 | return ; |
807 | } | |
808 | branch = TreeT()->Branch(branchname,&fRecTriggerTracks,kBufferSize); | |
cba99c31 | 809 | //Info("MakeBranch","Making Branch %s for trigger tracks \n",branchname); |
276c44b7 | 810 | } |
6309cf6e | 811 | } |
1eccde20 | 812 | //____________________________________________________________________________ |
813 | TClonesArray* AliMUONData::RawClusters(Int_t DetectionPlane) | |
814 | { | |
9140dcef | 815 | // Getting Raw Clusters |
1eccde20 | 816 | if (fRawClusters) |
817 | return ( (TClonesArray*) fRawClusters->At(DetectionPlane) ); | |
818 | else | |
819 | return NULL; | |
820 | } | |
f0945e46 | 821 | |
6309cf6e | 822 | //____________________________________________________________________________ |
f0945e46 | 823 | TClonesArray* |
824 | AliMUONData::LocalTrigger() const | |
276c44b7 | 825 | { |
f0945e46 | 826 | return fLocalTrigger; |
276c44b7 | 827 | } |
f0945e46 | 828 | |
276c44b7 | 829 | //____________________________________________________________________________ |
f0945e46 | 830 | void |
831 | AliMUONData::GetDigits() const | |
276c44b7 | 832 | { |
f0945e46 | 833 | // Load the digits from TreeD for the current event. |
834 | Int_t event = fLoader->GetRunLoader()->GetEventNumber(); | |
835 | if ( fCurrentEvent != event ) | |
836 | { | |
837 | fLoader->TreeD()->GetEvent(0); | |
838 | fCurrentEvent = event; | |
839 | } | |
276c44b7 | 840 | } |
f0945e46 | 841 | |
842 | //____________________________________________________________________________ | |
843 | TClonesArray* | |
844 | AliMUONData::GlobalTrigger() const | |
845 | { | |
846 | // Return the global trigger | |
847 | return fGlobalTrigger; | |
848 | } | |
849 | ||
276c44b7 | 850 | //____________________________________________________________________________ |
6309cf6e | 851 | void AliMUONData::ResetDigits() |
852 | { | |
853 | // | |
854 | // Reset number of digits and the digits array for this detector | |
855 | // | |
856 | if (fDigits == 0x0) return; | |
857 | for ( int i=0;i<AliMUONConstants::NCh();i++ ) { | |
f68d0cf6 | 858 | if ((*fDigits)[i]) ((TClonesArray*)fDigits->At(i))->Clear("C"); |
6309cf6e | 859 | if (fNdigits) fNdigits[i]=0; |
860 | } | |
861 | } | |
d1775029 | 862 | //____________________________________________________________________________ |
863 | void AliMUONData::ResetSDigits() | |
864 | { | |
865 | // | |
866 | // Reset number of Sdigits and the Sdigits array for this detector | |
867 | // | |
868 | if (fSDigits == 0x0) return; | |
869 | for ( int i=0;i<AliMUONConstants::NCh();i++ ) { | |
870 | if ((*fSDigits)[i]) ((TClonesArray*)fSDigits->At(i))->Clear(); | |
871 | if (fNSdigits) fNSdigits[i]=0; | |
872 | } | |
873 | } | |
6309cf6e | 874 | //______________________________________________________________________________ |
875 | void AliMUONData::ResetHits() | |
876 | { | |
877 | // Reset number of clusters and the cluster array for this detector | |
878 | fNhits = 0; | |
879 | if (fHits) fHits->Clear(); | |
880 | } | |
881 | //_______________________________________________________________________________ | |
882 | void AliMUONData::ResetRawClusters() | |
883 | { | |
884 | // Reset number of raw clusters and the raw clust array for this detector | |
885 | // | |
886 | for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) { | |
887 | if ((*fRawClusters)[i]) ((TClonesArray*)fRawClusters->At(i))->Clear(); | |
888 | if (fNrawclusters) fNrawclusters[i]=0; | |
889 | } | |
890 | } | |
891 | //_______________________________________________________________________________ | |
892 | void AliMUONData::ResetTrigger() | |
893 | { | |
894 | // Reset Local and Global Trigger | |
895 | fNglobaltrigger = 0; | |
896 | if (fGlobalTrigger) fGlobalTrigger->Clear(); | |
897 | fNlocaltrigger = 0; | |
898 | if (fLocalTrigger) fLocalTrigger->Clear(); | |
899 | } | |
dcd2690d | 900 | //____________________________________________________________________________ |
901 | void AliMUONData::ResetRecTracks() | |
902 | { | |
903 | // Reset tracks information | |
904 | fNrectracks = 0; | |
34f1bfa0 | 905 | if (fRecTracks) fRecTracks->Delete(); // necessary to delete in case of memory allocation |
dcd2690d | 906 | } |
276c44b7 | 907 | //____________________________________________________________________________ |
908 | void AliMUONData::ResetRecTriggerTracks() | |
909 | { | |
910 | // Reset tracks information | |
911 | fNrectriggertracks = 0; | |
34f1bfa0 | 912 | if (fRecTriggerTracks) fRecTriggerTracks->Delete(); // necessary to delete in case of memory allocation |
276c44b7 | 913 | } |
6309cf6e | 914 | //_____________________________________________________________________________ |
ce3f5e87 | 915 | void AliMUONData::SetTreeAddress(Option_t* option) |
6309cf6e | 916 | { |
9140dcef | 917 | //Setting Addresses to the events trees |
ce3f5e87 | 918 | const char *cH = strstr(option,"H"); |
919 | const char *cD = strstr(option,"D"); // Digits branches in TreeD | |
d1775029 | 920 | const char *cS = strstr(option,"S"); // SDigits branches in TreeS |
ce3f5e87 | 921 | const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR |
ce3e25a8 | 922 | const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD |
923 | const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR | |
dcd2690d | 924 | const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT |
276c44b7 | 925 | const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT |
c82862d3 | 926 | //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP |
ce3f5e87 | 927 | |
6309cf6e | 928 | // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree. |
929 | char branchname[30]; | |
930 | TBranch * branch = 0x0; | |
c82862d3 | 931 | |
932 | AliDebug(1,Form("option=%s",option)); | |
6309cf6e | 933 | // |
934 | // Branch address for hit tree | |
ce3f5e87 | 935 | if ( TreeH() && cH ) { |
c82862d3 | 936 | if (fHits == 0x0) { |
937 | fHits = new TClonesArray("AliMUONHit",1000); | |
938 | // if (gAlice->GetMCApp()) | |
939 | // gAlice->GetMCApp()->AddHitList (fHits); Moved to AliMUON | |
88cf591d | 940 | } |
6309cf6e | 941 | fNhits =0; |
942 | } | |
ce3f5e87 | 943 | if (TreeH() && fHits && cH) { |
6309cf6e | 944 | sprintf(branchname,"%sHits",GetName()); |
945 | branch = TreeH()->GetBranch(branchname); | |
946 | if (branch) { | |
d652f85c | 947 | // Info("SetTreeAddress","(%s) Setting for Hits",GetName()); |
6309cf6e | 948 | branch->SetAddress(&fHits); |
949 | } | |
950 | else { //can be invoked before branch creation | |
8c343c7c | 951 | AliWarning(Form("(%s) Failed for Hits. Can not find branch in tree.",GetName())); |
6309cf6e | 952 | } |
953 | } | |
954 | ||
955 | // | |
956 | // Branch address for digit tree | |
95e68a13 | 957 | if ( TreeD() ) { |
958 | if (fDigits == 0x0 && cD) { | |
6309cf6e | 959 | fDigits = new TObjArray(AliMUONConstants::NCh()); |
960 | fNdigits= new Int_t[AliMUONConstants::NCh()]; | |
961 | for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) { | |
c82862d3 | 962 | fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i); |
963 | fNdigits[i]=0; | |
6309cf6e | 964 | } |
965 | } | |
ce3e25a8 | 966 | if (fLocalTrigger == 0x0 && cGLT) { |
967 | fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234); | |
968 | } | |
969 | if (fGlobalTrigger== 0x0 && cGLT) { | |
c82862d3 | 970 | fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1); |
ce3e25a8 | 971 | } |
6309cf6e | 972 | } |
c82862d3 | 973 | |
ce3f5e87 | 974 | if (TreeD() && fDigits && cD) { |
6309cf6e | 975 | for (int i=0; i<AliMUONConstants::NCh(); i++) { |
976 | sprintf(branchname,"%sDigits%d",GetName(),i+1); | |
d652f85c | 977 | if (fDigits) { |
c82862d3 | 978 | branch = TreeD()->GetBranch(branchname); |
979 | TClonesArray * digits = Digits(i); | |
980 | if (branch) { | |
981 | branch->SetAddress( &digits ); | |
982 | } | |
983 | else AliWarning(Form("(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i)); | |
d652f85c | 984 | } |
6309cf6e | 985 | } |
986 | } | |
ce3e25a8 | 987 | if ( TreeD() && fLocalTrigger && cGLT) { |
988 | sprintf(branchname,"%sLocalTrigger",GetName()); | |
989 | branch = TreeD()->GetBranch(branchname); | |
990 | if (branch) branch->SetAddress(&fLocalTrigger); | |
8c343c7c | 991 | else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeD.",GetName())); |
ce3e25a8 | 992 | } |
993 | if ( TreeD() && fGlobalTrigger && cGLT) { | |
994 | sprintf(branchname,"%sGlobalTrigger",GetName()); | |
995 | branch = TreeD()->GetBranch(branchname); | |
996 | if (branch) branch->SetAddress(&fGlobalTrigger); | |
8c343c7c | 997 | else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeD.",GetName())); |
ce3e25a8 | 998 | } |
c82862d3 | 999 | |
d1775029 | 1000 | // |
1001 | // Branch address for Sdigit tree | |
c82862d3 | 1002 | if ( TreeS() && cS) |
1003 | { | |
1004 | if (fSDigits == 0x0) | |
1005 | { | |
1006 | AliDebug(1,"Creating fSDigits TObjArray"); | |
d1775029 | 1007 | fSDigits = new TObjArray(AliMUONConstants::NCh()); |
1008 | fNSdigits= new Int_t[AliMUONConstants::NCh()]; | |
c82862d3 | 1009 | for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) |
1010 | { | |
1011 | TClonesArray* a = new TClonesArray("AliMUONDigit",10000); | |
1012 | fSDigits->AddAt(a,i); | |
1013 | AliDebug(1,Form("fSDigits[%d]=%p",i,a)); | |
1014 | fNSdigits[i]=0; | |
d1775029 | 1015 | } |
1016 | } | |
c82862d3 | 1017 | else |
1018 | { | |
1019 | AliDebug(1,Form("fSDigits already there = %p",fSDigits)); | |
1020 | } | |
d1775029 | 1021 | } |
c82862d3 | 1022 | |
d1775029 | 1023 | if (TreeS() && fSDigits && cS) { |
c82862d3 | 1024 | AliDebug(1,"Setting branch addresses"); |
d1775029 | 1025 | for (int i=0; i<AliMUONConstants::NCh(); i++) { |
1026 | sprintf(branchname,"%sSDigits%d",GetName(),i+1); | |
1027 | if (fSDigits) { | |
c82862d3 | 1028 | AliDebug(1,Form("TreeS=%p for ich=%d branchname=%s", |
1029 | TreeS(),i,branchname)); | |
1030 | branch = TreeS()->GetBranch(branchname); | |
1031 | TClonesArray * sdigits = SDigits(i); | |
1032 | if (branch) branch->SetAddress( &sdigits ); | |
1033 | else AliWarning(Form("(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i)); | |
d1775029 | 1034 | } |
1035 | } | |
1036 | } | |
6309cf6e | 1037 | |
1038 | // | |
1039 | // Branch address for rawclusters, globaltrigger and local trigger tree | |
1040 | if (TreeR() ) { | |
ce3f5e87 | 1041 | if (fRawClusters == 0x0 && cRC) { |
6309cf6e | 1042 | fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh()); |
1043 | fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()]; | |
1044 | for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) { | |
c82862d3 | 1045 | fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i); |
1046 | fNrawclusters[i]=0; | |
6309cf6e | 1047 | } |
1048 | } | |
ce3e25a8 | 1049 | if (fLocalTrigger == 0x0 && cTC) { |
6309cf6e | 1050 | fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234); |
1051 | } | |
ce3e25a8 | 1052 | if (fGlobalTrigger== 0x0 && cTC) { |
c82862d3 | 1053 | fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1); |
6309cf6e | 1054 | } |
c82862d3 | 1055 | |
6309cf6e | 1056 | } |
cc87ebcd | 1057 | if ( TreeR() && fRawClusters && cRC && !strstr(cRC,"RCC")) { |
6309cf6e | 1058 | for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) { |
1059 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); | |
1060 | if (fRawClusters) { | |
c82862d3 | 1061 | branch = TreeR()->GetBranch(branchname); |
1062 | if (branch) branch->SetAddress( &((*fRawClusters)[i]) ); | |
1063 | else AliWarning(Form("(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i)); | |
6309cf6e | 1064 | } |
1065 | } | |
1066 | } | |
ce3e25a8 | 1067 | if ( TreeR() && fLocalTrigger && cTC) { |
6309cf6e | 1068 | sprintf(branchname,"%sLocalTrigger",GetName()); |
1069 | branch = TreeR()->GetBranch(branchname); | |
1070 | if (branch) branch->SetAddress(&fLocalTrigger); | |
8c343c7c | 1071 | else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeR.",GetName())); |
6309cf6e | 1072 | } |
ce3e25a8 | 1073 | if ( TreeR() && fGlobalTrigger && cTC) { |
6309cf6e | 1074 | sprintf(branchname,"%sGlobalTrigger",GetName()); |
1075 | branch = TreeR()->GetBranch(branchname); | |
1076 | if (branch) branch->SetAddress(&fGlobalTrigger); | |
8c343c7c | 1077 | else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeR.",GetName())); |
6309cf6e | 1078 | } |
c82862d3 | 1079 | |
8547965d | 1080 | if ( TreeT() ) { |
61adb9bd | 1081 | if (fRecTracks == 0x0 && cRT) { |
8547965d | 1082 | fRecTracks = new TClonesArray("AliMUONTrack",100); |
1083 | } | |
c82862d3 | 1084 | |
8547965d | 1085 | } |
dcd2690d | 1086 | if ( TreeT() && fRecTracks && cRT ) { |
1087 | sprintf(branchname,"%sTrack",GetName()); | |
1088 | branch = TreeT()->GetBranch(branchname); | |
1089 | if (branch) branch->SetAddress(&fRecTracks); | |
8c343c7c | 1090 | else AliWarning(Form("(%s) Failed for Tracks. Can not find branch in tree.",GetName())); |
dcd2690d | 1091 | } |
c82862d3 | 1092 | // trigger tracks |
276c44b7 | 1093 | if ( TreeT() ) { |
1094 | if (fRecTriggerTracks == 0x0 && cRL) { | |
1095 | fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100); | |
1096 | } | |
c82862d3 | 1097 | |
276c44b7 | 1098 | } |
1099 | if ( TreeT() && fRecTriggerTracks && cRL ) { | |
1100 | sprintf(branchname,"%sTriggerTrack",GetName()); | |
1101 | branch = TreeT()->GetBranch(branchname); | |
1102 | if (branch) branch->SetAddress(&fRecTriggerTracks); | |
8c343c7c | 1103 | else AliWarning(Form("(%s) Failed for Trigger Tracks. Can not find branch in tree.",GetName())); |
276c44b7 | 1104 | } |
c82862d3 | 1105 | |
1106 | ||
6309cf6e | 1107 | } |
c82862d3 | 1108 | |
6309cf6e | 1109 | //_____________________________________________________________________________ |
c82862d3 | 1110 | void |
1111 | AliMUONData::Print(Option_t* opt) const | |
1112 | { | |
f0945e46 | 1113 | // Dump object on screen |
c82862d3 | 1114 | TString options(opt); |
1115 | options.ToUpper(); | |
1116 | ||
1117 | if ( options.Contains("D") ) | |
1118 | { | |
1119 | for ( Int_t ich = 0; ich < AliMUONConstants::NCh(); ++ich) | |
1120 | { | |
1121 | TClonesArray* digits = Digits(ich); | |
1122 | Int_t ndigits = digits->GetEntriesFast(); | |
1123 | for ( Int_t id = 0; id < ndigits; ++id ) | |
1124 | { | |
1125 | AliMUONDigit* digit = | |
1126 | static_cast<AliMUONDigit*>(digits->UncheckedAt(id)); | |
1127 | digit->Print(); | |
1128 | } | |
1129 | } | |
1130 | } | |
1131 | ||
1132 | if ( options.Contains("S") ) | |
1133 | { | |
1134 | for ( Int_t ich = 0; ich < AliMUONConstants::NCh(); ++ich) | |
1135 | { | |
1136 | TClonesArray* digits = SDigits(ich); | |
1137 | Int_t ndigits = digits->GetEntriesFast(); | |
1138 | for ( Int_t id = 0; id < ndigits; ++id ) | |
1139 | { | |
1140 | AliMUONDigit* digit = | |
1141 | static_cast<AliMUONDigit*>(digits->UncheckedAt(id)); | |
1142 | digit->Print(); | |
1143 | } | |
1144 | } | |
1145 | } | |
1146 | ||
3cdccc77 | 1147 | } |