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