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