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