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