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