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