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