]>
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" |
374ebd7d | 20 | //AliRoot include |
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; | |
374ebd7d | 82 | // fRecTracks = new TClonesArray("AliMUONTrack", 100); |
b1c7d777 | 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 | //____________________________________________________________________________ |
1eccde20 | 194 | TClonesArray* AliMUONData::Digits(Int_t DetectionPlane) |
195 | { | |
196 | if (fDigits) | |
197 | return ( (TClonesArray*) fDigits->At(DetectionPlane) ); | |
198 | else | |
199 | return NULL; | |
200 | } | |
201 | //____________________________________________________________________________ | |
c1d45bdf | 202 | Bool_t AliMUONData::IsRawClusterBranchesInTree() |
203 | { | |
204 | if (TreeR()==0x0) { | |
205 | Error("TreeR","No treeR in memory"); | |
206 | return kFALSE; | |
207 | } | |
208 | else { | |
209 | char branchname[30]; | |
210 | sprintf(branchname,"%sRawClusters1",GetName()); | |
211 | TBranch * branch = 0x0; | |
212 | branch = TreeR()->GetBranch(branchname); | |
213 | if (branch) return kTRUE; | |
214 | else return kFALSE; | |
215 | } | |
216 | } | |
217 | //____________________________________________________________________________ | |
218 | Bool_t AliMUONData::IsTriggerBranchesInTree() | |
219 | { | |
220 | if (TreeR()==0x0) { | |
221 | Error("TreeR","No treeR in memory"); | |
222 | return kFALSE; | |
223 | } | |
224 | else { | |
225 | char branchname[30]; | |
226 | sprintf(branchname,"%sLocalTrigger",GetName()); | |
227 | TBranch * branch = 0x0; | |
228 | branch = TreeR()->GetBranch(branchname); | |
229 | if (branch) return kTRUE; | |
230 | else return kFALSE; | |
231 | } | |
232 | } | |
233 | //____________________________________________________________________________ | |
1a1cdff8 | 234 | void AliMUONData::Fill(Option_t* option) |
235 | { | |
236 | // Method to fill the trees | |
237 | const char *cH = strstr(option,"H"); | |
238 | const char *cD = strstr(option,"D"); // Digits branches in TreeD | |
239 | const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR | |
240 | const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR | |
241 | const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT | |
242 | //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP | |
243 | ||
244 | char branchname[30]; | |
245 | TBranch * branch = 0x0; | |
246 | ||
247 | // | |
248 | // Filling TreeH | |
249 | if ( TreeH() && cH ) { | |
250 | TreeH()->Fill(); | |
251 | } | |
252 | // | |
253 | // Filling TreeD | |
254 | if ( TreeD() && cD) { | |
255 | TreeD()->Fill(); | |
256 | } | |
c1d45bdf | 257 | |
1a1cdff8 | 258 | // |
259 | // filling rawclusters | |
c1d45bdf | 260 | if ( TreeR() && cRC ) { |
261 | if ( IsTriggerBranchesInTree() ) { | |
262 | // Branch per branch filling | |
263 | for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) { | |
264 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); | |
265 | branch = TreeR()->GetBranch(branchname); | |
266 | branch->Fill(); | |
267 | } | |
268 | } | |
269 | else TreeR()->Fill(); | |
1a1cdff8 | 270 | } |
c1d45bdf | 271 | |
1a1cdff8 | 272 | // |
273 | // filling trigger | |
274 | if ( TreeR() && cGLT) { | |
346357f4 | 275 | if (IsRawClusterBranchesInTree()) { |
c1d45bdf | 276 | // Branch per branch filling |
277 | sprintf(branchname,"%sLocalTrigger",GetName()); | |
278 | branch = TreeR()->GetBranch(branchname); | |
279 | branch->Fill(); | |
280 | sprintf(branchname,"%sGlobalTrigger",GetName()); | |
281 | branch = TreeR()->GetBranch(branchname); | |
282 | branch->Fill(); | |
283 | } | |
284 | else TreeR()->Fill(); | |
1a1cdff8 | 285 | } |
286 | // | |
287 | // filling tracks | |
288 | if ( TreeT() && cRT ) { | |
289 | sprintf(branchname,"%sTrack",GetName()); | |
8547965d | 290 | TreeT()->Fill(); |
1a1cdff8 | 291 | } |
292 | } | |
293 | //_____________________________________________________________________________ | |
6309cf6e | 294 | void AliMUONData::MakeBranch(Option_t* option) |
295 | { | |
296 | // | |
297 | // Create Tree branches for the MUON. | |
298 | // | |
299 | const Int_t kBufferSize = 4000; | |
300 | char branchname[30]; | |
301 | ||
302 | const char *cH = strstr(option,"H"); | |
303 | const char *cD = strstr(option,"D"); // Digits branches in TreeD | |
304 | const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR | |
305 | const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR | |
306 | const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT | |
307 | const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP | |
308 | ||
309 | TBranch * branch = 0x0; | |
310 | ||
311 | // Creating Branches for Hits | |
312 | if (TreeH() && cH) { | |
313 | if (fHits == 0x0) fHits = new TClonesArray("AliMUONHit",1000); | |
314 | fNhits = 0; | |
315 | sprintf(branchname,"%sHits",GetName()); | |
316 | branch = TreeH()->GetBranch(branchname); | |
317 | if (branch) { | |
318 | Info("MakeBranch","Branch %s is already in tree.",GetName()); | |
319 | return ; | |
320 | } | |
d652f85c | 321 | branch = TreeH()->Branch(branchname,&fHits,kBufferSize,fSplitLevel); |
6309cf6e | 322 | Info("MakeBranch","Making Branch %s for hits \n",branchname); |
323 | } | |
324 | ||
325 | //Creating Branches for Digits | |
326 | if (TreeD() && cD ) { | |
327 | // one branch for digits per chamber | |
328 | if (fDigits == 0x0) { | |
ce3f5e87 | 329 | fDigits = new TObjArray(AliMUONConstants::NCh()); |
6309cf6e | 330 | for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) { |
331 | fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),iDetectionPlane); | |
ce3f5e87 | 332 | } |
333 | } | |
334 | if (fNdigits == 0x0) { | |
335 | fNdigits = new Int_t[AliMUONConstants::NCh()]; | |
336 | for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) { | |
6309cf6e | 337 | fNdigits[iDetectionPlane]=0; |
338 | } | |
339 | } | |
340 | for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) { | |
341 | sprintf(branchname,"%sDigits%d",GetName(),iDetectionPlane+1); | |
342 | branch = 0x0; | |
343 | branch = TreeD()->GetBranch(branchname); | |
344 | if (branch) { | |
345 | Info("MakeBranch","Branch %s is already in tree.",GetName()); | |
346 | return; | |
347 | } | |
1a1cdff8 | 348 | TClonesArray * digits = Digits(iDetectionPlane); |
d652f85c | 349 | branch = TreeD()->Branch(branchname, &digits, kBufferSize,1); |
6309cf6e | 350 | Info("MakeBranch","Making Branch %s for digits in detection plane %d\n",branchname,iDetectionPlane+1); |
351 | } | |
352 | } | |
353 | ||
354 | if (TreeR() && cRC ) { | |
355 | // one branch for raw clusters per tracking detection plane | |
356 | // | |
357 | Int_t i; | |
358 | if (fRawClusters == 0x0) { | |
359 | fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh()); | |
6309cf6e | 360 | for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) { |
d652f85c | 361 | fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",1000),i); |
ce3f5e87 | 362 | } |
363 | } | |
364 | ||
365 | if (fNrawclusters == 0x0) { | |
366 | fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()]; | |
367 | for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) { | |
6309cf6e | 368 | fNrawclusters[i]=0; |
369 | } | |
370 | } | |
371 | ||
372 | for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) { | |
373 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); | |
374 | branch = 0x0; | |
375 | branch = TreeR()->GetBranch(branchname); | |
376 | if (branch) { | |
377 | Info("MakeBranch","Branch %s is already in tree.",GetName()); | |
378 | return; | |
379 | } | |
d652f85c | 380 | branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize,fSplitLevel); |
6309cf6e | 381 | Info("MakeBranch","Making Branch %s for rawcluster in detection plane %d\n",branchname,i+1); |
382 | } | |
383 | } | |
384 | ||
385 | if (TreeR() && cGLT ) { | |
386 | // | |
387 | // one branch for global trigger | |
388 | // | |
389 | sprintf(branchname,"%sGlobalTrigger",GetName()); | |
390 | branch = 0x0; | |
391 | ||
392 | if (fGlobalTrigger == 0x0) { | |
d652f85c | 393 | fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",fSplitLevel); |
6309cf6e | 394 | fNglobaltrigger = 0; |
395 | } | |
396 | branch = TreeR()->GetBranch(branchname); | |
397 | if (branch) { | |
398 | Info("MakeBranch","Branch %s is already in tree.",GetName()); | |
399 | return ; | |
400 | } | |
d652f85c | 401 | branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize,fSplitLevel); |
6309cf6e | 402 | Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname); |
403 | ||
404 | // | |
405 | // one branch for local trigger | |
406 | // | |
407 | sprintf(branchname,"%sLocalTrigger",GetName()); | |
408 | branch = 0x0; | |
409 | ||
410 | if (fLocalTrigger == 0x0) { | |
411 | fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234); | |
412 | fNlocaltrigger = 0; | |
413 | } | |
414 | branch = TreeR()->GetBranch(branchname); | |
415 | if (branch) { | |
416 | Info("MakeBranch","Branch %s is already in tree.",GetName()); | |
417 | return; | |
418 | } | |
d652f85c | 419 | branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize,fSplitLevel); |
6309cf6e | 420 | Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname); |
421 | } | |
422 | ||
dcd2690d | 423 | if (TreeT() && cRT ) { |
374ebd7d | 424 | if (fRecTracks == 0x0) fRecTracks = new TClonesArray("AliMUONTrack",100); |
dcd2690d | 425 | fNrectracks = 0; |
426 | sprintf(branchname,"%sTrack",GetName()); | |
427 | branch = TreeT()->GetBranch(branchname); | |
428 | if (branch) { | |
429 | Info("MakeBranch","Branch %s is already in tree.",GetName()); | |
430 | return ; | |
431 | } | |
432 | branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize); | |
433 | Info("MakeBranch","Making Branch %s for tracks \n",branchname); | |
434 | } | |
435 | ||
436 | if (TreeP() && cRP ) { | |
6309cf6e | 437 | Info("MakeBranch","Making Branch for TreeP is not yet ready. \n"); |
438 | } | |
439 | } | |
1eccde20 | 440 | //____________________________________________________________________________ |
441 | TClonesArray* AliMUONData::RawClusters(Int_t DetectionPlane) | |
442 | { | |
443 | if (fRawClusters) | |
444 | return ( (TClonesArray*) fRawClusters->At(DetectionPlane) ); | |
445 | else | |
446 | return NULL; | |
447 | } | |
6309cf6e | 448 | //____________________________________________________________________________ |
449 | void AliMUONData::ResetDigits() | |
450 | { | |
451 | // | |
452 | // Reset number of digits and the digits array for this detector | |
453 | // | |
454 | if (fDigits == 0x0) return; | |
455 | for ( int i=0;i<AliMUONConstants::NCh();i++ ) { | |
456 | if ((*fDigits)[i]) ((TClonesArray*)fDigits->At(i))->Clear(); | |
457 | if (fNdigits) fNdigits[i]=0; | |
458 | } | |
459 | } | |
460 | //______________________________________________________________________________ | |
461 | void AliMUONData::ResetHits() | |
462 | { | |
463 | // Reset number of clusters and the cluster array for this detector | |
464 | fNhits = 0; | |
465 | if (fHits) fHits->Clear(); | |
466 | } | |
467 | //_______________________________________________________________________________ | |
468 | void AliMUONData::ResetRawClusters() | |
469 | { | |
470 | // Reset number of raw clusters and the raw clust array for this detector | |
471 | // | |
472 | for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) { | |
473 | if ((*fRawClusters)[i]) ((TClonesArray*)fRawClusters->At(i))->Clear(); | |
474 | if (fNrawclusters) fNrawclusters[i]=0; | |
475 | } | |
476 | } | |
477 | //_______________________________________________________________________________ | |
478 | void AliMUONData::ResetTrigger() | |
479 | { | |
480 | // Reset Local and Global Trigger | |
481 | fNglobaltrigger = 0; | |
482 | if (fGlobalTrigger) fGlobalTrigger->Clear(); | |
483 | fNlocaltrigger = 0; | |
484 | if (fLocalTrigger) fLocalTrigger->Clear(); | |
485 | } | |
dcd2690d | 486 | //____________________________________________________________________________ |
487 | void AliMUONData::ResetRecTracks() | |
488 | { | |
489 | // Reset tracks information | |
490 | fNrectracks = 0; | |
491 | if (fRecTracks) fRecTracks->Clear(); | |
492 | } | |
6309cf6e | 493 | //_____________________________________________________________________________ |
ce3f5e87 | 494 | void AliMUONData::SetTreeAddress(Option_t* option) |
6309cf6e | 495 | { |
ce3f5e87 | 496 | const char *cH = strstr(option,"H"); |
497 | const char *cD = strstr(option,"D"); // Digits branches in TreeD | |
498 | const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR | |
499 | const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR | |
dcd2690d | 500 | const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT |
ce3f5e87 | 501 | //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP |
502 | ||
6309cf6e | 503 | // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree. |
504 | char branchname[30]; | |
505 | TBranch * branch = 0x0; | |
506 | ||
507 | // | |
508 | // Branch address for hit tree | |
ce3f5e87 | 509 | if ( TreeH() && cH ) { |
6309cf6e | 510 | if (fHits == 0x0) fHits = new TClonesArray("AliMUONHit",1000); |
511 | fNhits =0; | |
512 | } | |
ce3f5e87 | 513 | if (TreeH() && fHits && cH) { |
6309cf6e | 514 | sprintf(branchname,"%sHits",GetName()); |
515 | branch = TreeH()->GetBranch(branchname); | |
516 | if (branch) { | |
d652f85c | 517 | // Info("SetTreeAddress","(%s) Setting for Hits",GetName()); |
6309cf6e | 518 | branch->SetAddress(&fHits); |
519 | } | |
520 | else { //can be invoked before branch creation | |
521 | Warning("SetTreeAddress","(%s) Failed for Hits. Can not find branch in tree.",GetName()); | |
522 | } | |
523 | } | |
524 | ||
525 | // | |
526 | // Branch address for digit tree | |
ce3f5e87 | 527 | if ( TreeD() && cD) { |
6309cf6e | 528 | if (fDigits == 0x0) { |
529 | fDigits = new TObjArray(AliMUONConstants::NCh()); | |
530 | fNdigits= new Int_t[AliMUONConstants::NCh()]; | |
531 | for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) { | |
532 | fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i); | |
533 | fNdigits[i]=0; | |
534 | } | |
535 | } | |
536 | } | |
537 | ||
ce3f5e87 | 538 | if (TreeD() && fDigits && cD) { |
6309cf6e | 539 | for (int i=0; i<AliMUONConstants::NCh(); i++) { |
540 | sprintf(branchname,"%sDigits%d",GetName(),i+1); | |
d652f85c | 541 | if (fDigits) { |
542 | branch = TreeD()->GetBranch(branchname); | |
543 | TClonesArray * digits = Digits(i); | |
544 | if (branch) branch->SetAddress( &digits ); | |
545 | else Warning("SetTreeAddress","(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i); | |
546 | } | |
6309cf6e | 547 | } |
548 | } | |
549 | ||
550 | // | |
551 | // Branch address for rawclusters, globaltrigger and local trigger tree | |
552 | if (TreeR() ) { | |
ce3f5e87 | 553 | if (fRawClusters == 0x0 && cRC) { |
6309cf6e | 554 | fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh()); |
555 | fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()]; | |
556 | for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) { | |
557 | fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i); | |
558 | fNrawclusters[i]=0; | |
559 | } | |
560 | } | |
ce3f5e87 | 561 | if (fLocalTrigger == 0x0 && cGLT) { |
6309cf6e | 562 | fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234); |
563 | } | |
ce3f5e87 | 564 | if (fGlobalTrigger== 0x0 && cGLT) { |
6309cf6e | 565 | fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1); |
566 | } | |
567 | ||
568 | } | |
ce3f5e87 | 569 | if ( TreeR() && fRawClusters && cRC) { |
6309cf6e | 570 | for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) { |
571 | sprintf(branchname,"%sRawClusters%d",GetName(),i+1); | |
572 | if (fRawClusters) { | |
573 | branch = TreeR()->GetBranch(branchname); | |
d652f85c | 574 | if (branch) branch->SetAddress( &((*fRawClusters)[i]) ); |
6309cf6e | 575 | else Warning("SetTreeAddress","(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i); |
576 | } | |
577 | } | |
578 | } | |
ce3f5e87 | 579 | if ( TreeR() && fLocalTrigger && cGLT) { |
6309cf6e | 580 | sprintf(branchname,"%sLocalTrigger",GetName()); |
581 | branch = TreeR()->GetBranch(branchname); | |
582 | if (branch) branch->SetAddress(&fLocalTrigger); | |
583 | else Warning("SetTreeAddress","(%s) Failed for LocalTrigger. Can not find branch in tree.",GetName()); | |
584 | } | |
ce3f5e87 | 585 | if ( TreeR() && fGlobalTrigger && cGLT) { |
6309cf6e | 586 | sprintf(branchname,"%sGlobalTrigger",GetName()); |
587 | branch = TreeR()->GetBranch(branchname); | |
588 | if (branch) branch->SetAddress(&fGlobalTrigger); | |
589 | else Warning("SetTreeAddress","(%s) Failed for LocalTrigger. Can not find branch in tree.",GetName()); | |
590 | } | |
dcd2690d | 591 | |
8547965d | 592 | if ( TreeT() ) { |
593 | if (fRecTracks == 0x0 && cRT ) { | |
594 | fRecTracks = new TClonesArray("AliMUONTrack",100); | |
595 | } | |
596 | } | |
dcd2690d | 597 | if ( TreeT() && fRecTracks && cRT ) { |
598 | sprintf(branchname,"%sTrack",GetName()); | |
599 | branch = TreeT()->GetBranch(branchname); | |
600 | if (branch) branch->SetAddress(&fRecTracks); | |
601 | else Warning("SetTreeAddress","(%s) Failed for Tracks. Can not find branch in tree.",GetName()); | |
602 | } | |
6309cf6e | 603 | } |
604 | //_____________________________________________________________________________ |