]>
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$ */ | |
6309cf6e | 17 | |
6309cf6e | 18 | //Root includes |
1a1cdff8 | 19 | #include "TNamed.h" |
6309cf6e | 20 | //AliRoot includes |
1a1cdff8 | 21 | #include "AliLoader.h" |
22 | #include "AliMUONConstants.h" | |
6309cf6e | 23 | #include "AliMUONData.h" |
24 | #include "AliMUONDigit.h" | |
25 | #include "AliMUONHit.h" | |
26 | #include "AliMUONLocalTrigger.h" | |
27 | #include "AliMUONGlobalTrigger.h" | |
28 | #include "AliMUONRawCluster.h" | |
dcd2690d | 29 | #include "AliMUONTrack.h" |
6309cf6e | 30 | |
31 | ClassImp(AliMUONData) | |
32 | ||
33 | //_____________________________________________________________________________ | |
34 | AliMUONData::AliMUONData():TNamed() | |
35 | { | |
36 | fLoader = 0x0; | |
37 | fHits = 0x0; // One event in treeH per primary track | |
38 | fDigits = 0x0; // One event in treeH per detection plane | |
ce3f5e87 | 39 | fNdigits = 0x0; |
6309cf6e | 40 | fRawClusters = 0x0; //One event in TreeR/RawclusterBranch per tracking detection plane |
41 | fGlobalTrigger = 0x0; //! List of Global Trigger 1st event in TreeR/GlobalTriggerBranch | |
dcd2690d | 42 | fLocalTrigger = 0x0; //! List of Local Trigger, 1st event in TreeR/LocalTriggerBranch |
43 | fRecTracks = 0x0; | |
6309cf6e | 44 | //default constructor |
45 | } | |
46 | //_____________________________________________________________________________ | |
47 | AliMUONData::AliMUONData(AliLoader * loader, const char* name, const char* title): | |
48 | TNamed(name,title) | |
49 | { | |
50 | fLoader = loader; | |
b1c7d777 | 51 | fHits = 0x0; // One event in treeH per primary track |
52 | fDigits = 0x0; // One event in treeH per detection plane | |
53 | fNdigits = 0x0; | |
54 | fRawClusters = 0x0; //One event in TreeR/RawclusterBranch per tracking detection plane | |
55 | fGlobalTrigger = 0x0; //! List of Global Trigger 1st event in TreeR/GlobalTriggerBranch | |
56 | fLocalTrigger = 0x0; //! List of Local Trigger, 1st event in TreeR/LocalTriggerBranch | |
57 | fRecTracks = 0x0; | |
6309cf6e | 58 | fNhits = 0; |
6309cf6e | 59 | fNglobaltrigger =0; |
6309cf6e | 60 | fNlocaltrigger = 0; |
b1c7d777 | 61 | fNrectracks = 0; |
62 | // fHits = new TClonesArray("AliMUONHit",1000); | |
63 | // fNhits = 0; | |
64 | // fDigits = new TObjArray(AliMUONConstants::NCh()); | |
65 | // fNdigits = new Int_t[AliMUONConstants::NCh()]; | |
66 | // for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) { | |
67 | // fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),iDetectionPlane); | |
68 | // fNdigits[iDetectionPlane]=0; | |
69 | // } | |
70 | // fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh()); | |
71 | // fNrawclusters = new Int_t[AliMUONConstants::NTrackingCh()]; | |
72 | // for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NTrackingCh();iDetectionPlane++) { | |
73 | // fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),iDetectionPlane); | |
74 | // fNrawclusters[iDetectionPlane]=0; | |
75 | // } | |
76 | // fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1); | |
77 | // fNglobaltrigger =0; | |
78 | // fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234); | |
79 | // fNlocaltrigger = 0; | |
80 | // fRecTracks = new TClonesArray("AliMUONTrack", 10); | |
81 | // fNrectracks = 0; // really needed or GetEntriesFast sufficient ???? | |
82 | ||
83 | ||
6309cf6e | 84 | //default constructor |
85 | } | |
86 | //_____________________________________________________________________________ | |
87 | AliMUONData::AliMUONData(const AliMUONData& rMUONData):TNamed(rMUONData) | |
88 | { | |
89 | // Dummy copy constructor | |
90 | ; | |
91 | } | |
92 | //_____________________________________________________________________________ | |
93 | AliMUONData::~AliMUONData() | |
94 | { | |
95 | if (fHits) { | |
96 | fHits->Delete(); | |
97 | delete fHits; | |
98 | } | |
99 | if (fDigits) { | |
100 | fDigits->Delete(); | |
101 | delete fDigits; | |
102 | } | |
103 | if (fRawClusters) { | |
104 | fRawClusters->Delete(); | |
105 | delete fRawClusters; | |
106 | } | |
107 | if (fGlobalTrigger){ | |
108 | fGlobalTrigger->Delete(); | |
109 | delete fGlobalTrigger; | |
110 | } | |
111 | if (fLocalTrigger){ | |
112 | fLocalTrigger->Delete(); | |
113 | delete fLocalTrigger; | |
114 | } | |
dcd2690d | 115 | if (fRecTracks){ |
116 | fRecTracks->Delete(); | |
117 | delete fRecTracks; | |
118 | } | |
6309cf6e | 119 | //detructor |
120 | } | |
121 | //_____________________________________________________________________________ | |
122 | void AliMUONData::AddDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits) | |
123 | { | |
124 | // | |
125 | // Add a MUON digit to the list of Digits of the detection plane id | |
126 | // | |
1a1cdff8 | 127 | TClonesArray &ldigits = * Digits(id) ; |
6309cf6e | 128 | new(ldigits[fNdigits[id]++]) AliMUONDigit(tracks,charges,digits); |
129 | } | |
130 | //_____________________________________________________________________________ | |
131 | void AliMUONData::AddGlobalTrigger(Int_t *singlePlus, Int_t *singleMinus, | |
132 | Int_t *singleUndef, | |
133 | Int_t *pairUnlike, Int_t *pairLike) | |
134 | { | |
135 | // add a MUON Global Trigger to the list (only one GlobalTrigger per event !) | |
136 | TClonesArray &globalTrigger = *fGlobalTrigger; | |
137 | new(globalTrigger[fNglobaltrigger++]) | |
138 | AliMUONGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike); | |
139 | } | |
140 | //_____________________________________________________________________________ | |
141 | void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber, | |
142 | Int_t idpart, Float_t X, Float_t Y, Float_t Z, | |
143 | Float_t tof, Float_t momentum, Float_t theta, | |
144 | Float_t phi, Float_t length, Float_t destep) | |
145 | { | |
146 | TClonesArray &lhits = *fHits; | |
147 | new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber, | |
148 | idpart, X, Y, Z, | |
149 | tof, momentum, theta, | |
150 | phi, length, destep); | |
151 | } | |
152 | //____________________________________________________________________________ | |
1391e633 | 153 | void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber, |
154 | Int_t idpart, Float_t X, Float_t Y, Float_t Z, | |
155 | Float_t tof, Float_t momentum, Float_t theta, | |
156 | Float_t phi, Float_t length, Float_t destep, | |
157 | Float_t Xref,Float_t Yref,Float_t Zref) | |
158 | { | |
159 | TClonesArray &lhits = *fHits; | |
160 | new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber, | |
161 | idpart, X, Y, Z, | |
162 | tof, momentum, theta, | |
163 | phi, length, destep, | |
164 | Xref,Yref,Zref); | |
165 | } | |
166 | //____________________________________________________________________________ | |
6309cf6e | 167 | void AliMUONData::AddLocalTrigger(Int_t *localtr) |
168 | { | |
169 | // add a MUON Local Trigger to the list | |
170 | TClonesArray &localTrigger = *fLocalTrigger; | |
171 | new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(localtr); | |
172 | } | |
173 | //_____________________________________________________________________________ | |
174 | void AliMUONData::AddRawCluster(Int_t id, const AliMUONRawCluster& c) | |
175 | { | |
176 | // | |
177 | // Add a MUON rawcluster to the list in the detection plane id | |
178 | // | |
179 | TClonesArray &lrawcl = *((TClonesArray*) fRawClusters->At(id)); | |
180 | new(lrawcl[fNrawclusters[id]++]) AliMUONRawCluster(c); | |
181 | } | |
dcd2690d | 182 | //_____________________________________________________________________________ |
183 | void AliMUONData::AddRecTrack(const AliMUONTrack& track) | |
184 | { | |
185 | // | |
186 | // Add a MUON rectrack | |
187 | // | |
188 | TClonesArray &lrectracks = *fRecTracks; | |
189 | new(lrectracks[fNrectracks++]) AliMUONTrack(track); | |
190 | } | |
ce3f5e87 | 191 | //____________________________________________________________________________ |
c1d45bdf | 192 | Bool_t AliMUONData::IsRawClusterBranchesInTree() |
193 | { | |
194 | if (TreeR()==0x0) { | |
195 | Error("TreeR","No treeR in memory"); | |
196 | return kFALSE; | |
197 | } | |
198 | else { | |
199 | char branchname[30]; | |
200 | sprintf(branchname,"%sRawClusters1",GetName()); | |
201 | TBranch * branch = 0x0; | |
202 | branch = TreeR()->GetBranch(branchname); | |
203 | if (branch) return kTRUE; | |
204 | else return kFALSE; | |
205 | } | |
206 | } | |
207 | //____________________________________________________________________________ | |
208 | Bool_t AliMUONData::IsTriggerBranchesInTree() | |
209 | { | |
210 | if (TreeR()==0x0) { | |
211 | Error("TreeR","No treeR in memory"); | |
212 | return kFALSE; | |
213 | } | |
214 | else { | |
215 | char branchname[30]; | |
216 | sprintf(branchname,"%sLocalTrigger",GetName()); | |
217 | TBranch * branch = 0x0; | |
218 | branch = TreeR()->GetBranch(branchname); | |
219 | if (branch) return kTRUE; | |
220 | else return kFALSE; | |
221 | } | |
222 | } | |
223 | //____________________________________________________________________________ | |
1a1cdff8 | 224 | void AliMUONData::Fill(Option_t* option) |
225 | { | |
226 | // Method to fill the trees | |
227 | const char *cH = strstr(option,"H"); | |
228 | const char *cD = strstr(option,"D"); // Digits branches in TreeD | |
229 | const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR | |
230 | const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR | |
231 | const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT | |
232 | //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP | |
233 | ||
234 | char branchname[30]; | |
235 | TBranch * branch = 0x0; | |
236 | ||
237 | // | |
238 | // Filling TreeH | |
239 | if ( TreeH() && cH ) { | |
240 | TreeH()->Fill(); | |
241 | } | |
242 | // | |
243 | // Filling TreeD | |
244 | if ( TreeD() && cD) { | |
245 | TreeD()->Fill(); | |
246 | } | |
c1d45bdf | 247 | |
1a1cdff8 | 248 | // |
249 | // filling rawclusters | |
c1d45bdf | 250 | if ( TreeR() && cRC ) { |
251 | if ( IsTriggerBranchesInTree() ) { | |
252 | // Branch per branch filling | |
253 | for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) { | |
254 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); | |
255 | branch = TreeR()->GetBranch(branchname); | |
256 | branch->Fill(); | |
257 | } | |
258 | } | |
259 | else TreeR()->Fill(); | |
1a1cdff8 | 260 | } |
c1d45bdf | 261 | |
1a1cdff8 | 262 | // |
263 | // filling trigger | |
264 | if ( TreeR() && cGLT) { | |
346357f4 | 265 | if (IsRawClusterBranchesInTree()) { |
c1d45bdf | 266 | // Branch per branch filling |
267 | sprintf(branchname,"%sLocalTrigger",GetName()); | |
268 | branch = TreeR()->GetBranch(branchname); | |
269 | branch->Fill(); | |
270 | sprintf(branchname,"%sGlobalTrigger",GetName()); | |
271 | branch = TreeR()->GetBranch(branchname); | |
272 | branch->Fill(); | |
273 | } | |
274 | else TreeR()->Fill(); | |
1a1cdff8 | 275 | } |
276 | // | |
277 | // filling tracks | |
278 | if ( TreeT() && cRT ) { | |
279 | sprintf(branchname,"%sTrack",GetName()); | |
280 | branch = TreeT()->GetBranch(branchname); | |
281 | branch->Fill(); | |
282 | } | |
283 | } | |
284 | //_____________________________________________________________________________ | |
6309cf6e | 285 | void AliMUONData::MakeBranch(Option_t* option) |
286 | { | |
287 | // | |
288 | // Create Tree branches for the MUON. | |
289 | // | |
290 | const Int_t kBufferSize = 4000; | |
291 | char branchname[30]; | |
292 | ||
293 | const char *cH = strstr(option,"H"); | |
294 | const char *cD = strstr(option,"D"); // Digits branches in TreeD | |
295 | const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR | |
296 | const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR | |
297 | const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT | |
298 | const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP | |
299 | ||
300 | TBranch * branch = 0x0; | |
301 | ||
302 | // Creating Branches for Hits | |
303 | if (TreeH() && cH) { | |
304 | if (fHits == 0x0) fHits = new TClonesArray("AliMUONHit",1000); | |
305 | fNhits = 0; | |
306 | sprintf(branchname,"%sHits",GetName()); | |
307 | branch = TreeH()->GetBranch(branchname); | |
308 | if (branch) { | |
309 | Info("MakeBranch","Branch %s is already in tree.",GetName()); | |
310 | return ; | |
311 | } | |
312 | branch = TreeH()->Branch(branchname,&fHits,kBufferSize); | |
313 | Info("MakeBranch","Making Branch %s for hits \n",branchname); | |
314 | } | |
315 | ||
316 | //Creating Branches for Digits | |
317 | if (TreeD() && cD ) { | |
318 | // one branch for digits per chamber | |
319 | if (fDigits == 0x0) { | |
ce3f5e87 | 320 | fDigits = new TObjArray(AliMUONConstants::NCh()); |
6309cf6e | 321 | for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) { |
322 | fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),iDetectionPlane); | |
ce3f5e87 | 323 | } |
324 | } | |
325 | if (fNdigits == 0x0) { | |
326 | fNdigits = new Int_t[AliMUONConstants::NCh()]; | |
327 | for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) { | |
6309cf6e | 328 | fNdigits[iDetectionPlane]=0; |
329 | } | |
330 | } | |
331 | for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) { | |
332 | sprintf(branchname,"%sDigits%d",GetName(),iDetectionPlane+1); | |
333 | branch = 0x0; | |
334 | branch = TreeD()->GetBranch(branchname); | |
335 | if (branch) { | |
336 | Info("MakeBranch","Branch %s is already in tree.",GetName()); | |
337 | return; | |
338 | } | |
1a1cdff8 | 339 | TClonesArray * digits = Digits(iDetectionPlane); |
ce3f5e87 | 340 | branch = TreeD()->Branch(branchname, &digits, kBufferSize); |
6309cf6e | 341 | Info("MakeBranch","Making Branch %s for digits in detection plane %d\n",branchname,iDetectionPlane+1); |
342 | } | |
343 | } | |
344 | ||
345 | if (TreeR() && cRC ) { | |
346 | // one branch for raw clusters per tracking detection plane | |
347 | // | |
348 | Int_t i; | |
349 | if (fRawClusters == 0x0) { | |
350 | fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh()); | |
6309cf6e | 351 | for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) { |
352 | fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i); | |
ce3f5e87 | 353 | } |
354 | } | |
355 | ||
356 | if (fNrawclusters == 0x0) { | |
357 | fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()]; | |
358 | for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) { | |
6309cf6e | 359 | fNrawclusters[i]=0; |
360 | } | |
361 | } | |
362 | ||
363 | for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) { | |
364 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); | |
365 | branch = 0x0; | |
366 | branch = TreeR()->GetBranch(branchname); | |
367 | if (branch) { | |
368 | Info("MakeBranch","Branch %s is already in tree.",GetName()); | |
369 | return; | |
370 | } | |
371 | branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize); | |
372 | Info("MakeBranch","Making Branch %s for rawcluster in detection plane %d\n",branchname,i+1); | |
373 | } | |
374 | } | |
375 | ||
376 | if (TreeR() && cGLT ) { | |
377 | // | |
378 | // one branch for global trigger | |
379 | // | |
380 | sprintf(branchname,"%sGlobalTrigger",GetName()); | |
381 | branch = 0x0; | |
382 | ||
383 | if (fGlobalTrigger == 0x0) { | |
384 | fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1); | |
385 | fNglobaltrigger = 0; | |
386 | } | |
387 | branch = TreeR()->GetBranch(branchname); | |
388 | if (branch) { | |
389 | Info("MakeBranch","Branch %s is already in tree.",GetName()); | |
390 | return ; | |
391 | } | |
392 | branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize); | |
393 | Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname); | |
394 | ||
395 | // | |
396 | // one branch for local trigger | |
397 | // | |
398 | sprintf(branchname,"%sLocalTrigger",GetName()); | |
399 | branch = 0x0; | |
400 | ||
401 | if (fLocalTrigger == 0x0) { | |
402 | fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234); | |
403 | fNlocaltrigger = 0; | |
404 | } | |
405 | branch = TreeR()->GetBranch(branchname); | |
406 | if (branch) { | |
407 | Info("MakeBranch","Branch %s is already in tree.",GetName()); | |
408 | return; | |
409 | } | |
410 | branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize); | |
411 | Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname); | |
412 | } | |
413 | ||
dcd2690d | 414 | if (TreeT() && cRT ) { |
415 | if (fRecTracks == 0x0) fRecTracks = new TClonesArray("AliMUONTrack",10); | |
416 | fNrectracks = 0; | |
417 | sprintf(branchname,"%sTrack",GetName()); | |
418 | branch = TreeT()->GetBranch(branchname); | |
419 | if (branch) { | |
420 | Info("MakeBranch","Branch %s is already in tree.",GetName()); | |
421 | return ; | |
422 | } | |
423 | branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize); | |
424 | Info("MakeBranch","Making Branch %s for tracks \n",branchname); | |
425 | } | |
426 | ||
427 | if (TreeP() && cRP ) { | |
6309cf6e | 428 | Info("MakeBranch","Making Branch for TreeP is not yet ready. \n"); |
429 | } | |
430 | } | |
431 | ||
432 | //____________________________________________________________________________ | |
433 | void AliMUONData::ResetDigits() | |
434 | { | |
435 | // | |
436 | // Reset number of digits and the digits array for this detector | |
437 | // | |
438 | if (fDigits == 0x0) return; | |
439 | for ( int i=0;i<AliMUONConstants::NCh();i++ ) { | |
440 | if ((*fDigits)[i]) ((TClonesArray*)fDigits->At(i))->Clear(); | |
441 | if (fNdigits) fNdigits[i]=0; | |
442 | } | |
443 | } | |
444 | //______________________________________________________________________________ | |
445 | void AliMUONData::ResetHits() | |
446 | { | |
447 | // Reset number of clusters and the cluster array for this detector | |
448 | fNhits = 0; | |
449 | if (fHits) fHits->Clear(); | |
450 | } | |
451 | //_______________________________________________________________________________ | |
452 | void AliMUONData::ResetRawClusters() | |
453 | { | |
454 | // Reset number of raw clusters and the raw clust array for this detector | |
455 | // | |
456 | for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) { | |
457 | if ((*fRawClusters)[i]) ((TClonesArray*)fRawClusters->At(i))->Clear(); | |
458 | if (fNrawclusters) fNrawclusters[i]=0; | |
459 | } | |
460 | } | |
461 | //_______________________________________________________________________________ | |
462 | void AliMUONData::ResetTrigger() | |
463 | { | |
464 | // Reset Local and Global Trigger | |
465 | fNglobaltrigger = 0; | |
466 | if (fGlobalTrigger) fGlobalTrigger->Clear(); | |
467 | fNlocaltrigger = 0; | |
468 | if (fLocalTrigger) fLocalTrigger->Clear(); | |
469 | } | |
dcd2690d | 470 | //____________________________________________________________________________ |
471 | void AliMUONData::ResetRecTracks() | |
472 | { | |
473 | // Reset tracks information | |
474 | fNrectracks = 0; | |
475 | if (fRecTracks) fRecTracks->Clear(); | |
476 | } | |
6309cf6e | 477 | //_____________________________________________________________________________ |
ce3f5e87 | 478 | void AliMUONData::SetTreeAddress(Option_t* option) |
6309cf6e | 479 | { |
ce3f5e87 | 480 | const char *cH = strstr(option,"H"); |
481 | const char *cD = strstr(option,"D"); // Digits branches in TreeD | |
482 | const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR | |
483 | const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR | |
dcd2690d | 484 | const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT |
ce3f5e87 | 485 | //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP |
486 | ||
6309cf6e | 487 | // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree. |
488 | char branchname[30]; | |
489 | TBranch * branch = 0x0; | |
490 | ||
491 | // | |
492 | // Branch address for hit tree | |
ce3f5e87 | 493 | if ( TreeH() && cH ) { |
6309cf6e | 494 | if (fHits == 0x0) fHits = new TClonesArray("AliMUONHit",1000); |
495 | fNhits =0; | |
496 | } | |
ce3f5e87 | 497 | if (TreeH() && fHits && cH) { |
6309cf6e | 498 | sprintf(branchname,"%sHits",GetName()); |
499 | branch = TreeH()->GetBranch(branchname); | |
500 | if (branch) { | |
501 | Info("SetTreeAddress","(%s) Setting for Hits",GetName()); | |
502 | branch->SetAddress(&fHits); | |
503 | } | |
504 | else { //can be invoked before branch creation | |
505 | Warning("SetTreeAddress","(%s) Failed for Hits. Can not find branch in tree.",GetName()); | |
506 | } | |
507 | } | |
508 | ||
509 | // | |
510 | // Branch address for digit tree | |
ce3f5e87 | 511 | if ( TreeD() && cD) { |
6309cf6e | 512 | if (fDigits == 0x0) { |
513 | fDigits = new TObjArray(AliMUONConstants::NCh()); | |
514 | fNdigits= new Int_t[AliMUONConstants::NCh()]; | |
515 | for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) { | |
516 | fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i); | |
517 | fNdigits[i]=0; | |
518 | } | |
519 | } | |
520 | } | |
521 | ||
ce3f5e87 | 522 | if (TreeD() && fDigits && cD) { |
6309cf6e | 523 | for (int i=0; i<AliMUONConstants::NCh(); i++) { |
524 | sprintf(branchname,"%sDigits%d",GetName(),i+1); | |
525 | branch = TreeD()->GetBranch(branchname); | |
1a1cdff8 | 526 | TClonesArray * digits = Digits(i); |
ce3f5e87 | 527 | if (branch) branch->SetAddress( &digits ); |
6309cf6e | 528 | else Warning("SetTreeAddress","(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i); |
529 | } | |
530 | } | |
531 | ||
532 | // | |
533 | // Branch address for rawclusters, globaltrigger and local trigger tree | |
534 | if (TreeR() ) { | |
ce3f5e87 | 535 | if (fRawClusters == 0x0 && cRC) { |
6309cf6e | 536 | fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh()); |
537 | fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()]; | |
538 | for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) { | |
539 | fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i); | |
540 | fNrawclusters[i]=0; | |
541 | } | |
542 | } | |
ce3f5e87 | 543 | if (fLocalTrigger == 0x0 && cGLT) { |
6309cf6e | 544 | fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234); |
545 | } | |
ce3f5e87 | 546 | if (fGlobalTrigger== 0x0 && cGLT) { |
6309cf6e | 547 | fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1); |
548 | } | |
549 | ||
550 | } | |
ce3f5e87 | 551 | if ( TreeR() && fRawClusters && cRC) { |
6309cf6e | 552 | for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) { |
553 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); | |
554 | if (fRawClusters) { | |
555 | branch = TreeR()->GetBranch(branchname); | |
556 | if (branch) branch->SetAddress(&((*fRawClusters)[i])); | |
557 | else Warning("SetTreeAddress","(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i); | |
558 | } | |
559 | } | |
560 | } | |
ce3f5e87 | 561 | if ( TreeR() && fLocalTrigger && cGLT) { |
6309cf6e | 562 | sprintf(branchname,"%sLocalTrigger",GetName()); |
563 | branch = TreeR()->GetBranch(branchname); | |
564 | if (branch) branch->SetAddress(&fLocalTrigger); | |
565 | else Warning("SetTreeAddress","(%s) Failed for LocalTrigger. Can not find branch in tree.",GetName()); | |
566 | } | |
ce3f5e87 | 567 | if ( TreeR() && fGlobalTrigger && cGLT) { |
6309cf6e | 568 | sprintf(branchname,"%sGlobalTrigger",GetName()); |
569 | branch = TreeR()->GetBranch(branchname); | |
570 | if (branch) branch->SetAddress(&fGlobalTrigger); | |
571 | else Warning("SetTreeAddress","(%s) Failed for LocalTrigger. Can not find branch in tree.",GetName()); | |
572 | } | |
dcd2690d | 573 | |
574 | if ( TreeT() && fRecTracks && cRT ) { | |
575 | sprintf(branchname,"%sTrack",GetName()); | |
576 | branch = TreeT()->GetBranch(branchname); | |
577 | if (branch) branch->SetAddress(&fRecTracks); | |
578 | else Warning("SetTreeAddress","(%s) Failed for Tracks. Can not find branch in tree.",GetName()); | |
579 | } | |
6309cf6e | 580 | } |
581 | //_____________________________________________________________________________ |