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