]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONData.cxx
Removing obsolete constants.
[u/mrichter/AliRoot.git] / MUON / AliMUONData.cxx
CommitLineData
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$ */
f0945e46 17
18/// AliMUONData class
19///
20/// Class containing MUON data: hits, digits, rawclusters, globaltrigger, localtrigger, etc ..
21/// The classe makes the lik between the MUON data lists and the event trees from loaders
22///
23/// Gines Martinez, Subatech, September 2003
24///
9140dcef 25
6309cf6e 26#include "AliMUONData.h"
c82862d3 27
28#include "AliLog.h"
29#include "AliMUONConstants.h"
47dc4ee7 30#include "AliMUONHit.h"
6309cf6e 31#include "AliMUONDigit.h"
c82862d3 32#include "AliMUONGlobalTrigger.h"
6309cf6e 33#include "AliMUONLocalTrigger.h"
47dc4ee7 34#include "AliMUONRegionalTrigger.h"
6309cf6e 35#include "AliMUONRawCluster.h"
dcd2690d 36#include "AliMUONTrack.h"
276c44b7 37#include "AliMUONTriggerTrack.h"
f0945e46 38#include "AliRunLoader.h"
39#include "TArrayI.h"
c82862d3 40#include "TString.h"
30178c30 41
5398f946 42/// \cond CLASSIMP
6309cf6e 43ClassImp(AliMUONData)
5398f946 44/// \endcond
6309cf6e 45
46//_____________________________________________________________________________
1017e5bf 47 AliMUONData::AliMUONData():
48 TNamed(),
49 fLoader(0x0),
50 fHits(0x0),
51 fDigits(0x0),
52 fSDigits(0x0),
53 fRawClusters(0x0),
54 fGlobalTrigger(0x0),
55 fLocalTrigger(0x0),
47dc4ee7 56 fRegionalTrigger(0x0),
1017e5bf 57 fRecTracks(0x0),
58 fRecTriggerTracks(0x0),
59 fNhits(0),
60 fNdigits(0x0),
61 fNSdigits(0x0),
62 fNrawclusters(0x0),
63 fNglobaltrigger(0),
64 fNlocaltrigger(0),
47dc4ee7 65 fNregionaltrigger(0),
1017e5bf 66 fNrectracks(0),
67 fNrectriggertracks(0),
f0945e46 68 fSplitLevel(0),
69 fCurrentEvent(-1)
6309cf6e 70{
9140dcef 71 // Default constructor
6309cf6e 72}
73//_____________________________________________________________________________
74AliMUONData::AliMUONData(AliLoader * loader, const char* name, const char* title):
1017e5bf 75 TNamed(name,title),
76 fLoader(loader),
77 fHits(0x0),
78 fDigits(0x0),
79 fSDigits(0x0),
80 fRawClusters(0x0),
81 fGlobalTrigger(0x0),
82 fLocalTrigger(0x0),
47dc4ee7 83 fRegionalTrigger(0x0),
1017e5bf 84 fRecTracks(0x0),
85 fRecTriggerTracks(0x0),
86 fNhits(0),
87 fNdigits(0x0),
88 fNSdigits(0x0),
89 fNrawclusters(0x0),
90 fNglobaltrigger(0),
91 fNlocaltrigger(0),
47dc4ee7 92 fNregionaltrigger(0),
1017e5bf 93 fNrectracks(0),
94 fNrectriggertracks(0),
f0945e46 95 fSplitLevel(0),
96 fCurrentEvent(-1)
6309cf6e 97{
5398f946 98/// Standard constructor
6309cf6e 99}
e3ea1889 100
6309cf6e 101//_____________________________________________________________________________
102AliMUONData::~AliMUONData()
103{
5398f946 104/// Destructor for AliMUONData
6309cf6e 105 if (fHits) {
106 fHits->Delete();
107 delete fHits;
108 }
c82862d3 109
6309cf6e 110 if (fDigits) {
111 fDigits->Delete();
112 delete fDigits;
113 }
d1775029 114 if (fSDigits) {
115 fSDigits->Delete();
116 delete fSDigits;
117 }
6309cf6e 118 if (fRawClusters) {
119 fRawClusters->Delete();
120 delete fRawClusters;
121 }
122 if (fGlobalTrigger){
123 fGlobalTrigger->Delete();
124 delete fGlobalTrigger;
125 }
47dc4ee7 126 if (fRegionalTrigger){
127 fRegionalTrigger->Delete();
128 delete fRegionalTrigger;
129 }
6309cf6e 130 if (fLocalTrigger){
131 fLocalTrigger->Delete();
132 delete fLocalTrigger;
133 }
dcd2690d 134 if (fRecTracks){
135 fRecTracks->Delete();
136 delete fRecTracks;
137 }
276c44b7 138 if (fRecTriggerTracks){
139 fRecTriggerTracks->Delete();
140 delete fRecTriggerTracks;
141 }
6309cf6e 142}
47dc4ee7 143//____________________________________________________________________________
144void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber,
145 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
146 Float_t tof, Float_t momentum, Float_t theta,
147 Float_t phi, Float_t length, Float_t destep,
148 Float_t Xref,Float_t Yref,Float_t Zref)
149{
150/// Add new hit to the hit list
151
152 TClonesArray &lhits = *fHits;
153 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber,
154 idpart, X, Y, Z,
155 tof, momentum, theta,
156 phi, length, destep,
157 Xref,Yref,Zref);
158}
159//____________________________________________________________________________
160void AliMUONData::AddHit2(Int_t fIshunt, Int_t track, Int_t detElemId,
161 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
162 Float_t tof, Float_t momentum, Float_t theta,
163 Float_t phi, Float_t length, Float_t destep,
164 Float_t Xref,Float_t Yref,Float_t Zref)
165{
166 // Add new hit to the hit list
e3ea1889 167
47dc4ee7 168 TClonesArray &lhits = *fHits;
169 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, detElemId,
170 idpart, X, Y, Z,
171 tof, momentum, theta,
172 phi, length, destep,
173 Xref,Yref,Zref, true);
174}
6309cf6e 175//_____________________________________________________________________________
176void AliMUONData::AddDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
177{
5398f946 178/// Add a MUON digit to the list of Digits of the detection plane id
179
1a1cdff8 180 TClonesArray &ldigits = * Digits(id) ;
6309cf6e 181 new(ldigits[fNdigits[id]++]) AliMUONDigit(tracks,charges,digits);
182}
183//_____________________________________________________________________________
61adb9bd 184void AliMUONData::AddDigit(Int_t id, const AliMUONDigit& digit)
185{
5398f946 186/// Add a MUON digit to the list of Digits of the detection plane id
187
61adb9bd 188 TClonesArray &ldigits = * Digits(id) ;
189 new(ldigits[fNdigits[id]++]) AliMUONDigit(digit);
190}
191//_____________________________________________________________________________
30178c30 192void AliMUONData::AddSDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *sdigits)
d1775029 193{
5398f946 194/// Add a MUON Sdigit to the list of SDigits of the detection plane id
195
d1775029 196 TClonesArray &lSdigits = * SDigits(id) ;
30178c30 197 new(lSdigits[fNSdigits[id]++]) AliMUONDigit(tracks,charges,sdigits);
d1775029 198}
199//_____________________________________________________________________________
200void AliMUONData::AddSDigit(Int_t id, const AliMUONDigit& Sdigit)
201{
5398f946 202/// Add a MUON Sdigit to the list of SDigits of the detection plane id
203
d1775029 204 TClonesArray &lSdigits = * SDigits(id) ;
205 new(lSdigits[fNSdigits[id]++]) AliMUONDigit(Sdigit);
206}
2cf44ef3 207
6309cf6e 208//_____________________________________________________________________________
61adb9bd 209void AliMUONData::AddGlobalTrigger(const AliMUONGlobalTrigger& trigger )
210{
5398f946 211/// Add a MUON Global Trigger to the list (only one GlobalTrigger per event !);
212
61adb9bd 213 TClonesArray &globalTrigger = *fGlobalTrigger;
214 new(globalTrigger[fNglobaltrigger++]) AliMUONGlobalTrigger(trigger);
215}
5398f946 216
6309cf6e 217//____________________________________________________________________________
47dc4ee7 218void AliMUONData::AddRegionalTrigger(const AliMUONRegionalTrigger& trigger)
1391e633 219{
47dc4ee7 220/// add a MUON regional Trigger to the list
221 TClonesArray &regionalTrigger = *fRegionalTrigger;
222 new(regionalTrigger[fNregionaltrigger++]) AliMUONRegionalTrigger(trigger);
61adb9bd 223}
224//____________________________________________________________________________
61adb9bd 225void AliMUONData::AddLocalTrigger(const AliMUONLocalTrigger& trigger)
226{
5398f946 227/// add a MUON Local Trigger to the list
228
61adb9bd 229 TClonesArray &localTrigger = *fLocalTrigger;
230 new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(trigger);
231}
47dc4ee7 232
6309cf6e 233//_____________________________________________________________________________
234void AliMUONData::AddRawCluster(Int_t id, const AliMUONRawCluster& c)
235{
5398f946 236/// Add a MUON rawcluster to the list in the detection plane id
237
6309cf6e 238 TClonesArray &lrawcl = *((TClonesArray*) fRawClusters->At(id));
239 new(lrawcl[fNrawclusters[id]++]) AliMUONRawCluster(c);
240}
dcd2690d 241//_____________________________________________________________________________
242void AliMUONData::AddRecTrack(const AliMUONTrack& track)
243{
5398f946 244/// Add a MUON rectrack
245
dcd2690d 246 TClonesArray &lrectracks = *fRecTracks;
247 new(lrectracks[fNrectracks++]) AliMUONTrack(track);
248}
276c44b7 249//_____________________________________________________________________________
250void AliMUONData::AddRecTriggerTrack(const AliMUONTriggerTrack& triggertrack)
251{
5398f946 252/// Add a MUON triggerrectrack
253
276c44b7 254 TClonesArray &lrectriggertracks = *fRecTriggerTracks;
255 new(lrectriggertracks[fNrectriggertracks++]) AliMUONTriggerTrack(triggertrack);
276c44b7 256}
ce3f5e87 257//____________________________________________________________________________
c82862d3 258TClonesArray* AliMUONData::Digits(Int_t DetectionPlane) const
1eccde20 259{
5398f946 260/// Getting List of Digits
261
1eccde20 262 if (fDigits)
263 return ( (TClonesArray*) fDigits->At(DetectionPlane) );
264 else
265 return NULL;
266}
267//____________________________________________________________________________
c82862d3 268TClonesArray* AliMUONData::SDigits(Int_t DetectionPlane) const
d1775029 269{
5398f946 270/// Getting List of SDigits
271
d1775029 272 if (fSDigits)
273 return ( (TClonesArray*) fSDigits->At(DetectionPlane) );
274 else
275 return NULL;
276}
277//____________________________________________________________________________
c1d45bdf 278Bool_t AliMUONData::IsRawClusterBranchesInTree()
279{
5398f946 280/// Checking if there are RawCluster Branches In TreeR
281
c1d45bdf 282 if (TreeR()==0x0) {
8c343c7c 283 AliError("No treeR in memory");
c1d45bdf 284 return kFALSE;
285 }
286 else {
287 char branchname[30];
288 sprintf(branchname,"%sRawClusters1",GetName());
289 TBranch * branch = 0x0;
290 branch = TreeR()->GetBranch(branchname);
291 if (branch) return kTRUE;
292 else return kFALSE;
293 }
294}
295//____________________________________________________________________________
ce3e25a8 296Bool_t AliMUONData::IsDigitsBranchesInTree()
297{
5398f946 298/// Checking if there are RawCluster Branches In TreeR
299
ce3e25a8 300 if (TreeD()==0x0) {
8c343c7c 301 AliError("No treeD in memory");
ce3e25a8 302 return kFALSE;
303 }
304 else {
305 char branchname[30];
306 sprintf(branchname,"%sDigits1",GetName());
307 TBranch * branch = 0x0;
308 branch = TreeD()->GetBranch(branchname);
309 if (branch) return kTRUE;
310 else return kFALSE;
311 }
312}
313//____________________________________________________________________________
c1d45bdf 314Bool_t AliMUONData::IsTriggerBranchesInTree()
315{
5398f946 316/// Checking if there are Trigger Branches In TreeR
c1d45bdf 317 if (TreeR()==0x0) {
8c343c7c 318 AliError("No treeR in memory");
c1d45bdf 319 return kFALSE;
320 }
321 else {
322 char branchname[30];
323 sprintf(branchname,"%sLocalTrigger",GetName());
324 TBranch * branch = 0x0;
325 branch = TreeR()->GetBranch(branchname);
326 if (branch) return kTRUE;
327 else return kFALSE;
328 }
329}
ce3e25a8 330//____________________________________________________________________________
331Bool_t AliMUONData::IsTriggerBranchesInTreeD()
332{
5398f946 333/// Checking if there are Trigger Branches In TreeR
ce3e25a8 334 if (TreeD()==0x0) {
8c343c7c 335 AliError("No treeD in memory");
ce3e25a8 336 return kFALSE;
337 }
338 else {
339 char branchname[30];
340 sprintf(branchname,"%sLocalTrigger",GetName());
341 TBranch * branch = 0x0;
342 branch = TreeD()->GetBranch(branchname);
343 if (branch) return kTRUE;
344 else return kFALSE;
345 }
346}
347
c1d45bdf 348//____________________________________________________________________________
276c44b7 349Bool_t AliMUONData::IsTrackBranchesInTree()
350{
5398f946 351/// Checking if there are Track Branches In TreeT
276c44b7 352 if (TreeT()==0x0) {
8c343c7c 353 AliError("No treeT in memory");
276c44b7 354 return kFALSE;
355 }
356 else {
357 char branchname[30];
358 sprintf(branchname,"%sTrack",GetName());
359 TBranch * branch = 0x0;
360 branch = TreeT()->GetBranch(branchname);
361 if (branch) return kTRUE;
362 else return kFALSE;
363 }
364}
365//____________________________________________________________________________
366Bool_t AliMUONData::IsTriggerTrackBranchesInTree()
367{
5398f946 368/// Checking if there are TriggerTrack Branches In TreeT
276c44b7 369 if (TreeT()==0x0) {
8c343c7c 370 AliError("No treeT in memory");
276c44b7 371 return kFALSE;
372 }
373 else {
374 char branchname[30];
375 sprintf(branchname,"%sTriggerTrack",GetName());
376 TBranch * branch = 0x0;
377 branch = TreeT()->GetBranch(branchname);
378 if (branch) return kTRUE;
379 else return kFALSE;
380 }
381}
382//____________________________________________________________________________
1a1cdff8 383void AliMUONData::Fill(Option_t* option)
384{
5398f946 385/// Method to fill the trees
1a1cdff8 386 const char *cH = strstr(option,"H");
387 const char *cD = strstr(option,"D"); // Digits branches in TreeD
d1775029 388 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
1a1cdff8 389 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
ce3e25a8 390 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
391 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
1a1cdff8 392 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
ce3e25a8 393 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
61adb9bd 394
1a1cdff8 395 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
396
397 char branchname[30];
398 TBranch * branch = 0x0;
399
1a1cdff8 400 // Filling TreeH
f0945e46 401 if ( TreeH() && cH )
402 {
1a1cdff8 403 TreeH()->Fill();
404 }
ce3e25a8 405
1a1cdff8 406 // Filling TreeD
ce3e25a8 407
c82862d3 408 if ( TreeD() && cD && cGLT )
409 {
f0945e46 410 // Writing digits and (global+local) trigger at once.
c82862d3 411 TreeD()->Fill();
412 }
f0945e46 413 else
414 {
415 if ( TreeD() && cD )
416 {
417 if ( IsTriggerBranchesInTreeD() )
418 {
419 for (int i=0; i<AliMUONConstants::NCh(); i++)
420 {
421 sprintf(branchname,"%sDigits%d",GetName(),i+1);
422 branch = TreeD()->GetBranch(branchname);
423 branch->Fill();
424 }
425 }
426 else
427 {
428 TreeD()->Fill();
ce3e25a8 429 }
f0945e46 430 }
431
432 if ( TreeD() && cGLT )
433 {
434 if ( IsDigitsBranchesInTree() )
435 {
436 sprintf(branchname,"%sLocalTrigger",GetName());
437 branch = TreeD()->GetBranch(branchname);
438 branch->Fill();
47dc4ee7 439 sprintf(branchname,"%sRegionalTrigger",GetName());
440 branch = TreeD()->GetBranch(branchname);
441 branch->Fill();
f0945e46 442 sprintf(branchname,"%sGlobalTrigger",GetName());
443 branch = TreeD()->GetBranch(branchname);
444 branch->Fill();
47dc4ee7 445
f0945e46 446 }
447 else
448 {
449 TreeD()->Fill();
450 }
451 }
452 } // end of TreeD() handling.
ce3e25a8 453
d1775029 454 // Filling TreeS
f0945e46 455 if ( TreeS() && cS)
456 {
d1775029 457 TreeS()->Fill();
458 }
c1d45bdf 459
f0945e46 460 // Filling TreeR
461
462 if ( TreeR() && cRC && cTC )
463 {
464 TreeR()->Fill();
465 }
466 else
467 {
468 if ( TreeR() && cRC )
469 {
470 if ( IsTriggerBranchesInTree() )
471 {
c1d45bdf 472 // Branch per branch filling
f0945e46 473 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++)
474 {
475 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
476 branch = TreeR()->GetBranch(branchname);
477 branch->Fill();
478 }
479 }
480 else
481 {
482 TreeR()->Fill();
483 }
484 }
485
486 if ( TreeR() && cTC)
487 {
488 if (IsRawClusterBranchesInTree())
489 {
490 // Branch per branch filling
491 sprintf(branchname,"%sLocalTrigger",GetName());
492 branch = TreeR()->GetBranch(branchname);
493 branch->Fill();
47dc4ee7 494 sprintf(branchname,"%sRegionalTrigger",GetName());
495 branch = TreeR()->GetBranch(branchname);
496 branch->Fill();
f0945e46 497 sprintf(branchname,"%sGlobalTrigger",GetName());
498 branch = TreeR()->GetBranch(branchname);
499 branch->Fill();
500 }
501 else
502 {
503 TreeR()->Fill();
c1d45bdf 504 }
505 }
1a1cdff8 506 }
f0945e46 507
508 // Filling TreeT
c1d45bdf 509
f0945e46 510 if ( TreeT() && cRT && cRL )
511 {
512 TreeT()->Fill();
1a1cdff8 513 }
f0945e46 514 else
515 {
516 if ( TreeT() && cRT )
517 {
518 if (IsTriggerTrackBranchesInTree())
519 {
520 sprintf(branchname,"%sTrack",GetName());
521 branch = TreeT()->GetBranch(branchname);
522 branch->Fill();
523 }
524 else
525 {
526 TreeT()->Fill();
527 }
528 }
529
530 if ( TreeT() && cRL )
531 {
532 if (IsTrackBranchesInTree())
533 {
534 sprintf(branchname,"%sTriggerTrack",GetName());
535 branch = TreeT()->GetBranch(branchname);
536 branch->Fill();
537 }
538 else
539 {
540 TreeT()->Fill();
541 }
276c44b7 542 }
1a1cdff8 543 }
544}
c82862d3 545
1a1cdff8 546//_____________________________________________________________________________
6309cf6e 547void AliMUONData::MakeBranch(Option_t* option)
548{
5398f946 549/// Create Tree branches for the MUON.
550
6309cf6e 551 const Int_t kBufferSize = 4000;
552 char branchname[30];
553
c82862d3 554
6309cf6e 555 const char *cH = strstr(option,"H");
556 const char *cD = strstr(option,"D"); // Digits branches in TreeD
d1775029 557 const char *cS = strstr(option,"S"); // Digits branches in TreeS
6309cf6e 558 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
ce3e25a8 559 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
47dc4ee7 560 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
6309cf6e 561 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
276c44b7 562 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
c82862d3 563 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
564
6309cf6e 565 TBranch * branch = 0x0;
566
567 // Creating Branches for Hits
568 if (TreeH() && cH) {
c82862d3 569
1988766a 570 if (fHits == 0x0) {
c82862d3 571 fHits = new TClonesArray("AliMUONHit",1000);
572 // if (gAlice->GetMCApp())
573 // gAlice->GetMCApp()->AddHitList (fHits);
1988766a 574 }
c82862d3 575
6309cf6e 576 fNhits = 0;
577 sprintf(branchname,"%sHits",GetName());
578 branch = TreeH()->GetBranch(branchname);
579 if (branch) {
f0945e46 580 AliInfo(Form("MakeBranch","Branch %s is already in tree.",branchname));
6309cf6e 581 return ;
582 }
c6ce342a 583 branch = TreeH()->Branch(branchname,&fHits,kBufferSize);
cba99c31 584 //Info("MakeBranch","Making Branch %s for hits \n",branchname);
6309cf6e 585 }
586
587 //Creating Branches for Digits
c82862d3 588 TTree* treeD = 0x0;
589 if ( cD || cGLT )
590 {
591 treeD = TreeD();
592 }
593
594 if ( treeD && cD )
595 {
6309cf6e 596 // one branch for digits per chamber
c82862d3 597 if (fDigits == 0x0)
598 {
ce3f5e87 599 fDigits = new TObjArray(AliMUONConstants::NCh());
c82862d3 600 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++)
601 {
602 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
603 tca->SetOwner();
604 fDigits->AddAt(tca,iDetectionPlane);
ce3f5e87 605 }
606 }
c82862d3 607 if (fNdigits == 0x0)
608 {
ce3f5e87 609 fNdigits = new Int_t[AliMUONConstants::NCh()];
c82862d3 610 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++)
611 {
612 fNdigits[iDetectionPlane]=0;
6309cf6e 613 }
614 }
c82862d3 615 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++)
616 {
6309cf6e 617 sprintf(branchname,"%sDigits%d",GetName(),iDetectionPlane+1);
c82862d3 618 branch = treeD->GetBranch(branchname);
619 if (branch)
620 {
f0945e46 621 AliInfo(Form("Branch %s is already in tree.",branchname));
c82862d3 622 return;
6309cf6e 623 }
1a1cdff8 624 TClonesArray * digits = Digits(iDetectionPlane);
c82862d3 625 branch = treeD->Branch(branchname, &digits, kBufferSize,1);
626 }
6309cf6e 627 }
c82862d3 628
629 if ( treeD && cGLT )
630 {
ce3e25a8 631 //
632 // one branch for global trigger
633 //
634 sprintf(branchname,"%sGlobalTrigger",GetName());
ce3e25a8 635
c82862d3 636 if (fGlobalTrigger == 0x0)
637 {
ce3e25a8 638 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger");
639 fNglobaltrigger = 0;
640 }
c82862d3 641 branch = treeD->GetBranch(branchname);
642 if (branch)
643 {
8c343c7c 644 AliInfo(Form("Branch GlobalTrigger is already in treeD."));
ce3e25a8 645 return ;
646 }
c82862d3 647 branch = treeD->Branch(branchname, &fGlobalTrigger, kBufferSize);
648
47dc4ee7 649 //
650 // one branch for regional trigger
651 //
652 sprintf(branchname,"%sRegionalTrigger",GetName());
653 branch = 0x0;
654
655 if (fRegionalTrigger == 0x0)
656 {
657 fRegionalTrigger = new TClonesArray("AliMUONRegionalTrigger",16);
658 fNregionaltrigger = 0;
659 }
660 branch = treeD->GetBranch(branchname);
661 if (branch)
662 {
663 AliInfo(Form("Branch RegionalTrigger is already in treeD."));
664 return;
665 }
666 branch = treeD->Branch(branchname, &fRegionalTrigger, kBufferSize);
667
668
ce3e25a8 669 //
670 // one branch for local trigger
671 //
672 sprintf(branchname,"%sLocalTrigger",GetName());
673 branch = 0x0;
674
c82862d3 675 if (fLocalTrigger == 0x0)
676 {
ce3e25a8 677 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
678 fNlocaltrigger = 0;
679 }
c82862d3 680 branch = treeD->GetBranch(branchname);
681 if (branch)
682 {
8c343c7c 683 AliInfo(Form("Branch LocalTrigger is already in treeD."));
ce3e25a8 684 return;
685 }
c82862d3 686 branch = treeD->Branch(branchname, &fLocalTrigger, kBufferSize);
ce3e25a8 687 }
c82862d3 688
d1775029 689 //Creating Branches for SDigits
690 if (TreeS() && cS ) {
691 // one branch for Sdigits per chamber
692 if (fSDigits == 0x0) {
693 fSDigits = new TObjArray(AliMUONConstants::NCh());
694 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
c82862d3 695 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
696 tca->SetOwner();
697 fSDigits->AddAt(tca,iDetectionPlane);
d1775029 698 }
699 }
700 if (fNSdigits == 0x0) {
701 fNSdigits = new Int_t[AliMUONConstants::NCh()];
702 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
c82862d3 703 fNSdigits[iDetectionPlane]=0;
d1775029 704 }
705 }
706 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
707 sprintf(branchname,"%sSDigits%d",GetName(),iDetectionPlane+1);
708 branch = 0x0;
709 branch = TreeS()->GetBranch(branchname);
710 if (branch) {
f0945e46 711 AliInfo(Form("Branch %s is already in tree.",branchname));
c82862d3 712 return;
d1775029 713 }
30178c30 714 TClonesArray * sdigits = SDigits(iDetectionPlane);
715 branch = TreeS()->Branch(branchname, &sdigits, kBufferSize,1);
716 //Info("MakeBranch","Making Branch %s for sdigits in detection plane %d\n",branchname,iDetectionPlane+1);
c82862d3 717 }
d1775029 718 }
c82862d3 719
6309cf6e 720 if (TreeR() && cRC ) {
721 // one branch for raw clusters per tracking detection plane
722 //
723 Int_t i;
724 if (fRawClusters == 0x0) {
725 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
6309cf6e 726 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
c82862d3 727 TClonesArray * tca = new TClonesArray("AliMUONRawCluster",1000);
728 tca->SetOwner();
729 fRawClusters->AddAt(tca,i);
ce3f5e87 730 }
731 }
c82862d3 732
ce3f5e87 733 if (fNrawclusters == 0x0) {
734 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
735 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
c82862d3 736 fNrawclusters[i]=0;
6309cf6e 737 }
738 }
739
740 for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) {
741 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
742 branch = 0x0;
743 branch = TreeR()->GetBranch(branchname);
744 if (branch) {
f0945e46 745 AliInfo(Form("Branch %s is already in tree.",branchname));
c82862d3 746 return;
6309cf6e 747 }
c6ce342a 748 branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize);
cba99c31 749 //Info("MakeBranch","Making Branch %s for rawcluster in detection plane %d\n",branchname,i+1);
6309cf6e 750 }
751 }
c82862d3 752
ce3e25a8 753 if (TreeR() && cTC ) {
6309cf6e 754 //
755 // one branch for global trigger
756 //
757 sprintf(branchname,"%sGlobalTrigger",GetName());
758 branch = 0x0;
759
760 if (fGlobalTrigger == 0x0) {
c6ce342a 761 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger");
6309cf6e 762 fNglobaltrigger = 0;
763 }
764 branch = TreeR()->GetBranch(branchname);
765 if (branch) {
8c343c7c 766 AliInfo(Form("Branch GlobalTrigger is already in treeR."));
6309cf6e 767 return ;
768 }
c6ce342a 769 branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize);
cba99c31 770 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
47dc4ee7 771
772 //
773 // one branch for regional trigger
774 //
775 sprintf(branchname,"%sRegionalTrigger",GetName());
776 branch = 0x0;
6309cf6e 777
47dc4ee7 778 if (fRegionalTrigger == 0x0) {
779 fRegionalTrigger = new TClonesArray("AliMUONRegionalTrigger",16);
780 fNregionaltrigger = 0;
781 }
782 branch = TreeR()->GetBranch(branchname);
783 if (branch) {
784 AliInfo(Form("Branch RegionalTrigger is already in treeR."));
785 return;
786 }
787 branch = TreeR()->Branch(branchname, &fRegionalTrigger, kBufferSize);
788
6309cf6e 789 //
790 // one branch for local trigger
791 //
792 sprintf(branchname,"%sLocalTrigger",GetName());
793 branch = 0x0;
794
795 if (fLocalTrigger == 0x0) {
796 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
797 fNlocaltrigger = 0;
798 }
799 branch = TreeR()->GetBranch(branchname);
800 if (branch) {
8c343c7c 801 AliInfo(Form("Branch LocalTrigger is already in treeR."));
6309cf6e 802 return;
803 }
c6ce342a 804 branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize);
cba99c31 805 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
6309cf6e 806 }
807
dcd2690d 808 if (TreeT() && cRT ) {
374ebd7d 809 if (fRecTracks == 0x0) fRecTracks = new TClonesArray("AliMUONTrack",100);
dcd2690d 810 fNrectracks = 0;
811 sprintf(branchname,"%sTrack",GetName());
812 branch = TreeT()->GetBranch(branchname);
813 if (branch) {
8c343c7c 814 AliInfo(Form("Branch %s is already in tree.",GetName()));
dcd2690d 815 return ;
816 }
817 branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize);
cba99c31 818 //Info("MakeBranch","Making Branch %s for tracks \n",branchname);
dcd2690d 819 }
c82862d3 820 // trigger tracks
276c44b7 821 if (TreeT() && cRL ) {
822 if (fRecTriggerTracks == 0x0) fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
823 fNrectriggertracks = 0;
824 sprintf(branchname,"%sTriggerTrack",GetName());
825 branch = TreeT()->GetBranch(branchname);
826 if (branch) {
8c343c7c 827 AliInfo(Form("Branch %s is already in tree.",GetName()));
276c44b7 828 return ;
829 }
830 branch = TreeT()->Branch(branchname,&fRecTriggerTracks,kBufferSize);
cba99c31 831 //Info("MakeBranch","Making Branch %s for trigger tracks \n",branchname);
276c44b7 832 }
6309cf6e 833}
1eccde20 834//____________________________________________________________________________
835TClonesArray* AliMUONData::RawClusters(Int_t DetectionPlane)
836{
5398f946 837/// Getting Raw Clusters
838
1eccde20 839 if (fRawClusters)
840 return ( (TClonesArray*) fRawClusters->At(DetectionPlane) );
841 else
842 return NULL;
843}
f0945e46 844
6309cf6e 845//____________________________________________________________________________
f0945e46 846TClonesArray*
847AliMUONData::LocalTrigger() const
276c44b7 848{
5398f946 849/// Getting local trigger
850
f0945e46 851 return fLocalTrigger;
276c44b7 852}
f0945e46 853
1a46cb76 854//____________________________________________________________________________
855TClonesArray*
856AliMUONData::RegionalTrigger() const
857{
858/// Getting regional trigger
859
860 return fRegionalTrigger;
861}
862
276c44b7 863//____________________________________________________________________________
f0945e46 864void
865AliMUONData::GetDigits() const
276c44b7 866{
5398f946 867/// Load the digits from TreeD for the current event.
868
f0945e46 869 Int_t event = fLoader->GetRunLoader()->GetEventNumber();
870 if ( fCurrentEvent != event )
871 {
698b2e52 872 if (fLoader->TreeD()) {
873 fLoader->TreeD()->GetEvent(0);
874 fCurrentEvent = event;
875 }
f0945e46 876 }
276c44b7 877}
f0945e46 878
879//____________________________________________________________________________
880TClonesArray*
881AliMUONData::GlobalTrigger() const
882{
5398f946 883/// Return the global trigger
884
f0945e46 885 return fGlobalTrigger;
886}
887
276c44b7 888//____________________________________________________________________________
6309cf6e 889void AliMUONData::ResetDigits()
890{
5398f946 891/// Reset number of digits and the digits array for this detector
892
6309cf6e 893 if (fDigits == 0x0) return;
894 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
f68d0cf6 895 if ((*fDigits)[i]) ((TClonesArray*)fDigits->At(i))->Clear("C");
6309cf6e 896 if (fNdigits) fNdigits[i]=0;
897 }
898}
d1775029 899//____________________________________________________________________________
900void AliMUONData::ResetSDigits()
901{
5398f946 902/// Reset number of Sdigits and the Sdigits array for this detector
903
d1775029 904 if (fSDigits == 0x0) return;
905 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
906 if ((*fSDigits)[i]) ((TClonesArray*)fSDigits->At(i))->Clear();
907 if (fNSdigits) fNSdigits[i]=0;
908 }
909}
6309cf6e 910//______________________________________________________________________________
911void AliMUONData::ResetHits()
912{
5398f946 913/// Reset number of clusters and the cluster array for this detector
914
6309cf6e 915 fNhits = 0;
916 if (fHits) fHits->Clear();
917}
918//_______________________________________________________________________________
919void AliMUONData::ResetRawClusters()
920{
5398f946 921/// Reset number of raw clusters and the raw clust array for this detector
922
6309cf6e 923 for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) {
924 if ((*fRawClusters)[i]) ((TClonesArray*)fRawClusters->At(i))->Clear();
925 if (fNrawclusters) fNrawclusters[i]=0;
926 }
927}
928//_______________________________________________________________________________
929void AliMUONData::ResetTrigger()
930{
5398f946 931/// Reset Local and Global Trigger
932
6309cf6e 933 fNglobaltrigger = 0;
934 if (fGlobalTrigger) fGlobalTrigger->Clear();
47dc4ee7 935 fNregionaltrigger = 0;
936 if (fRegionalTrigger) fRegionalTrigger->Clear();
6309cf6e 937 fNlocaltrigger = 0;
938 if (fLocalTrigger) fLocalTrigger->Clear();
47dc4ee7 939
6309cf6e 940}
dcd2690d 941//____________________________________________________________________________
942void AliMUONData::ResetRecTracks()
943{
5398f946 944/// Reset tracks information
945
dcd2690d 946 fNrectracks = 0;
34f1bfa0 947 if (fRecTracks) fRecTracks->Delete(); // necessary to delete in case of memory allocation
dcd2690d 948}
276c44b7 949//____________________________________________________________________________
950void AliMUONData::ResetRecTriggerTracks()
951{
5398f946 952/// Reset tracks information
953
276c44b7 954 fNrectriggertracks = 0;
34f1bfa0 955 if (fRecTriggerTracks) fRecTriggerTracks->Delete(); // necessary to delete in case of memory allocation
276c44b7 956}
6309cf6e 957//_____________________________________________________________________________
ce3f5e87 958void AliMUONData::SetTreeAddress(Option_t* option)
6309cf6e 959{
5398f946 960/// Setting Addresses to the events trees
961
ce3f5e87 962 const char *cH = strstr(option,"H");
963 const char *cD = strstr(option,"D"); // Digits branches in TreeD
d1775029 964 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
ce3f5e87 965 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
ce3e25a8 966 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
967 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
dcd2690d 968 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
276c44b7 969 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
c82862d3 970 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
ce3f5e87 971
6309cf6e 972 // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree.
973 char branchname[30];
974 TBranch * branch = 0x0;
c82862d3 975
976 AliDebug(1,Form("option=%s",option));
6309cf6e 977 //
978 // Branch address for hit tree
ce3f5e87 979 if ( TreeH() && cH ) {
c82862d3 980 if (fHits == 0x0) {
981 fHits = new TClonesArray("AliMUONHit",1000);
982 // if (gAlice->GetMCApp())
983 // gAlice->GetMCApp()->AddHitList (fHits); Moved to AliMUON
88cf591d 984 }
6309cf6e 985 fNhits =0;
986 }
ce3f5e87 987 if (TreeH() && fHits && cH) {
6309cf6e 988 sprintf(branchname,"%sHits",GetName());
989 branch = TreeH()->GetBranch(branchname);
990 if (branch) {
d652f85c 991 // Info("SetTreeAddress","(%s) Setting for Hits",GetName());
6309cf6e 992 branch->SetAddress(&fHits);
993 }
994 else { //can be invoked before branch creation
8c343c7c 995 AliWarning(Form("(%s) Failed for Hits. Can not find branch in tree.",GetName()));
6309cf6e 996 }
997 }
998
999 //
1000 // Branch address for digit tree
95e68a13 1001 if ( TreeD() ) {
1002 if (fDigits == 0x0 && cD) {
6309cf6e 1003 fDigits = new TObjArray(AliMUONConstants::NCh());
1004 fNdigits= new Int_t[AliMUONConstants::NCh()];
1005 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
c82862d3 1006 fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i);
1007 fNdigits[i]=0;
6309cf6e 1008 }
1009 }
ce3e25a8 1010 if (fLocalTrigger == 0x0 && cGLT) {
1011 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
1012 }
47dc4ee7 1013 if (fRegionalTrigger == 0x0 && cGLT) {
1014 fRegionalTrigger = new TClonesArray("AliMUONRegionalTrigger",16);
1015 }
ce3e25a8 1016 if (fGlobalTrigger== 0x0 && cGLT) {
c82862d3 1017 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
ce3e25a8 1018 }
6309cf6e 1019 }
c82862d3 1020
ce3f5e87 1021 if (TreeD() && fDigits && cD) {
6309cf6e 1022 for (int i=0; i<AliMUONConstants::NCh(); i++) {
1023 sprintf(branchname,"%sDigits%d",GetName(),i+1);
d652f85c 1024 if (fDigits) {
c82862d3 1025 branch = TreeD()->GetBranch(branchname);
1026 TClonesArray * digits = Digits(i);
1027 if (branch) {
1028 branch->SetAddress( &digits );
1029 }
1030 else AliWarning(Form("(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i));
d652f85c 1031 }
6309cf6e 1032 }
1033 }
ce3e25a8 1034 if ( TreeD() && fLocalTrigger && cGLT) {
1035 sprintf(branchname,"%sLocalTrigger",GetName());
1036 branch = TreeD()->GetBranch(branchname);
1037 if (branch) branch->SetAddress(&fLocalTrigger);
8c343c7c 1038 else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeD.",GetName()));
ce3e25a8 1039 }
47dc4ee7 1040 if ( TreeD() && fRegionalTrigger && cGLT) {
1041 sprintf(branchname,"%sRegionalTrigger",GetName());
1042 branch = TreeD()->GetBranch(branchname);
1043 if (branch) branch->SetAddress(&fRegionalTrigger);
1044 else AliWarning(Form("(%s) Failed for RegionalTrigger. Can not find branch in treeD.",GetName()));
1045 }
ce3e25a8 1046 if ( TreeD() && fGlobalTrigger && cGLT) {
1047 sprintf(branchname,"%sGlobalTrigger",GetName());
1048 branch = TreeD()->GetBranch(branchname);
1049 if (branch) branch->SetAddress(&fGlobalTrigger);
8c343c7c 1050 else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeD.",GetName()));
ce3e25a8 1051 }
c82862d3 1052
d1775029 1053 //
1054 // Branch address for Sdigit tree
c82862d3 1055 if ( TreeS() && cS)
1056 {
1057 if (fSDigits == 0x0)
1058 {
1059 AliDebug(1,"Creating fSDigits TObjArray");
d1775029 1060 fSDigits = new TObjArray(AliMUONConstants::NCh());
1061 fNSdigits= new Int_t[AliMUONConstants::NCh()];
c82862d3 1062 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++)
1063 {
1064 TClonesArray* a = new TClonesArray("AliMUONDigit",10000);
1065 fSDigits->AddAt(a,i);
1066 AliDebug(1,Form("fSDigits[%d]=%p",i,a));
1067 fNSdigits[i]=0;
d1775029 1068 }
1069 }
c82862d3 1070 else
1071 {
1072 AliDebug(1,Form("fSDigits already there = %p",fSDigits));
1073 }
d1775029 1074 }
c82862d3 1075
d1775029 1076 if (TreeS() && fSDigits && cS) {
c82862d3 1077 AliDebug(1,"Setting branch addresses");
d1775029 1078 for (int i=0; i<AliMUONConstants::NCh(); i++) {
1079 sprintf(branchname,"%sSDigits%d",GetName(),i+1);
1080 if (fSDigits) {
c82862d3 1081 AliDebug(1,Form("TreeS=%p for ich=%d branchname=%s",
1082 TreeS(),i,branchname));
1083 branch = TreeS()->GetBranch(branchname);
1084 TClonesArray * sdigits = SDigits(i);
1085 if (branch) branch->SetAddress( &sdigits );
1086 else AliWarning(Form("(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i));
d1775029 1087 }
1088 }
1089 }
6309cf6e 1090
1091 //
1092 // Branch address for rawclusters, globaltrigger and local trigger tree
1093 if (TreeR() ) {
ce3f5e87 1094 if (fRawClusters == 0x0 && cRC) {
6309cf6e 1095 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
1096 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
1097 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
c82862d3 1098 fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i);
1099 fNrawclusters[i]=0;
6309cf6e 1100 }
1101 }
ce3e25a8 1102 if (fLocalTrigger == 0x0 && cTC) {
6309cf6e 1103 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
1104 }
47dc4ee7 1105 if (fRegionalTrigger == 0x0 && cTC) {
1106 fRegionalTrigger = new TClonesArray("AliMUONRegionalTrigger",16);
1107 }
ce3e25a8 1108 if (fGlobalTrigger== 0x0 && cTC) {
c82862d3 1109 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
6309cf6e 1110 }
c82862d3 1111
6309cf6e 1112 }
cc87ebcd 1113 if ( TreeR() && fRawClusters && cRC && !strstr(cRC,"RCC")) {
6309cf6e 1114 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
1115 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
1116 if (fRawClusters) {
c82862d3 1117 branch = TreeR()->GetBranch(branchname);
1118 if (branch) branch->SetAddress( &((*fRawClusters)[i]) );
1119 else AliWarning(Form("(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i));
6309cf6e 1120 }
1121 }
1122 }
ce3e25a8 1123 if ( TreeR() && fLocalTrigger && cTC) {
6309cf6e 1124 sprintf(branchname,"%sLocalTrigger",GetName());
1125 branch = TreeR()->GetBranch(branchname);
1126 if (branch) branch->SetAddress(&fLocalTrigger);
8c343c7c 1127 else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeR.",GetName()));
6309cf6e 1128 }
47dc4ee7 1129
1130 if ( TreeR() && fRegionalTrigger && cTC) {
1131 sprintf(branchname,"%sRegionalTrigger",GetName());
1132 branch = TreeR()->GetBranch(branchname);
1133 if (branch) branch->SetAddress(&fRegionalTrigger);
1134 else AliWarning(Form("(%s) Failed for RegionalTrigger. Can not find branch in treeR.",GetName()));
1135 }
1136
ce3e25a8 1137 if ( TreeR() && fGlobalTrigger && cTC) {
6309cf6e 1138 sprintf(branchname,"%sGlobalTrigger",GetName());
1139 branch = TreeR()->GetBranch(branchname);
1140 if (branch) branch->SetAddress(&fGlobalTrigger);
8c343c7c 1141 else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeR.",GetName()));
6309cf6e 1142 }
c82862d3 1143
8547965d 1144 if ( TreeT() ) {
61adb9bd 1145 if (fRecTracks == 0x0 && cRT) {
8547965d 1146 fRecTracks = new TClonesArray("AliMUONTrack",100);
1147 }
c82862d3 1148
8547965d 1149 }
dcd2690d 1150 if ( TreeT() && fRecTracks && cRT ) {
1151 sprintf(branchname,"%sTrack",GetName());
1152 branch = TreeT()->GetBranch(branchname);
1153 if (branch) branch->SetAddress(&fRecTracks);
8c343c7c 1154 else AliWarning(Form("(%s) Failed for Tracks. Can not find branch in tree.",GetName()));
dcd2690d 1155 }
c82862d3 1156 // trigger tracks
276c44b7 1157 if ( TreeT() ) {
1158 if (fRecTriggerTracks == 0x0 && cRL) {
1159 fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
1160 }
c82862d3 1161
276c44b7 1162 }
1163 if ( TreeT() && fRecTriggerTracks && cRL ) {
1164 sprintf(branchname,"%sTriggerTrack",GetName());
1165 branch = TreeT()->GetBranch(branchname);
1166 if (branch) branch->SetAddress(&fRecTriggerTracks);
8c343c7c 1167 else AliWarning(Form("(%s) Failed for Trigger Tracks. Can not find branch in tree.",GetName()));
276c44b7 1168 }
c82862d3 1169
1170
6309cf6e 1171}
c82862d3 1172
6309cf6e 1173//_____________________________________________________________________________
c82862d3 1174void
1175AliMUONData::Print(Option_t* opt) const
1176{
5398f946 1177/// Dump object on screen
1178
c82862d3 1179 TString options(opt);
1180 options.ToUpper();
1181
1182 if ( options.Contains("D") )
1183 {
1184 for ( Int_t ich = 0; ich < AliMUONConstants::NCh(); ++ich)
1185 {
1186 TClonesArray* digits = Digits(ich);
1187 Int_t ndigits = digits->GetEntriesFast();
1188 for ( Int_t id = 0; id < ndigits; ++id )
1189 {
1190 AliMUONDigit* digit =
1191 static_cast<AliMUONDigit*>(digits->UncheckedAt(id));
1192 digit->Print();
1193 }
1194 }
1195 }
1196
1197 if ( options.Contains("S") )
1198 {
1199 for ( Int_t ich = 0; ich < AliMUONConstants::NCh(); ++ich)
1200 {
1201 TClonesArray* digits = SDigits(ich);
1202 Int_t ndigits = digits->GetEntriesFast();
1203 for ( Int_t id = 0; id < ndigits; ++id )
1204 {
1205 AliMUONDigit* digit =
1206 static_cast<AliMUONDigit*>(digits->UncheckedAt(id));
1207 digit->Print();
1208 }
1209 }
1210 }
1211
3cdccc77 1212}