1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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
28 #include "AliLoader.h"
29 #include "AliMUONConstants.h"
30 #include "AliMUONData.h"
31 #include "AliMUONDigit.h"
32 #include "AliMUONHit.h"
33 #include "AliMUONLocalTrigger.h"
34 #include "AliMUONGlobalTrigger.h"
35 #include "AliMUONRawCluster.h"
36 #include "AliMUONTrack.h"
37 #include "AliMUONTriggerTrack.h"
40 //_____________________________________________________________________________
41 AliMUONData::AliMUONData():
51 fRecTriggerTracks(0x0),
59 fNrectriggertracks(0),
62 // Default constructor
64 //_____________________________________________________________________________
65 AliMUONData::AliMUONData(AliLoader * loader, const char* name, const char* title):
75 fRecTriggerTracks(0x0),
83 fNrectriggertracks(0),
86 // Constructor for AliMUONData
88 // fHits = new TClonesArray("AliMUONHit",1000);
90 // fDigits = new TObjArray(AliMUONConstants::NCh());
91 // fNdigits = new Int_t[AliMUONConstants::NCh()];
92 // for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
93 // fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),iDetectionPlane);
94 // fNdigits[iDetectionPlane]=0;
96 // fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
97 // fNrawclusters = new Int_t[AliMUONConstants::NTrackingCh()];
98 // for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NTrackingCh();iDetectionPlane++) {
99 // fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),iDetectionPlane);
100 // fNrawclusters[iDetectionPlane]=0;
102 // fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
103 // fNglobaltrigger =0;
104 // fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
105 // fNlocaltrigger = 0;
106 // fRecTracks = new TClonesArray("AliMUONTrack", 100);
107 // fNrectracks = 0; // really needed or GetEntriesFast sufficient ????
112 //_____________________________________________________________________________
113 AliMUONData::AliMUONData(const AliMUONData& rMUONData):TNamed(rMUONData)
115 // Protected copy constructor
117 Fatal("AliMUONData", "Not implemented.");
120 //_____________________________________________________________________________
121 AliMUONData::~AliMUONData()
123 // Destructor for AliMUONData
137 fRawClusters->Delete();
141 fGlobalTrigger->Delete();
142 delete fGlobalTrigger;
145 fLocalTrigger->Delete();
146 delete fLocalTrigger;
149 fRecTracks->Delete();
152 if (fRecTriggerTracks){
153 fRecTriggerTracks->Delete();
154 delete fRecTriggerTracks;
159 //_____________________________________________________________________________
160 AliMUONData& AliMUONData::operator=(const AliMUONData& rhs)
162 // Protected assignement operator
164 if (this == &rhs) return *this;
166 Fatal("operator=", "Not implemented.");
172 //_____________________________________________________________________________
173 void AliMUONData::AddDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
176 // Add a MUON digit to the list of Digits of the detection plane id
178 TClonesArray &ldigits = * Digits(id) ;
179 new(ldigits[fNdigits[id]++]) AliMUONDigit(tracks,charges,digits);
181 //_____________________________________________________________________________
182 void AliMUONData::AddDigit(Int_t id, const AliMUONDigit& digit)
185 // Add a MUON digit to the list of Digits of the detection plane id
187 TClonesArray &ldigits = * Digits(id) ;
188 new(ldigits[fNdigits[id]++]) AliMUONDigit(digit);
190 //_____________________________________________________________________________
191 void AliMUONData::AddSDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *Sdigits)
194 // Add a MUON Sdigit to the list of SDigits of the detection plane id
196 TClonesArray &lSdigits = * SDigits(id) ;
197 new(lSdigits[fNSdigits[id]++]) AliMUONDigit(tracks,charges,Sdigits);
199 //_____________________________________________________________________________
200 void AliMUONData::AddSDigit(Int_t id, const AliMUONDigit& Sdigit)
203 // Add a MUON Sdigit to the list of SDigits of the detection plane id
205 TClonesArray &lSdigits = * SDigits(id) ;
206 new(lSdigits[fNSdigits[id]++]) AliMUONDigit(Sdigit);
208 //_____________________________________________________________________________
209 void AliMUONData::AddGlobalTrigger(Int_t *singlePlus, Int_t *singleMinus,
211 Int_t *pairUnlike, Int_t *pairLike)
213 // add a MUON Global Trigger to the list (only one GlobalTrigger per event !)
214 TClonesArray &globalTrigger = *fGlobalTrigger;
215 new(globalTrigger[fNglobaltrigger++])
216 AliMUONGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike);
218 //_____________________________________________________________________________
219 void AliMUONData::AddGlobalTrigger(const AliMUONGlobalTrigger& trigger )
221 // add a MUON Global Trigger to the list (only one GlobalTrigger per event !)
222 TClonesArray &globalTrigger = *fGlobalTrigger;
223 new(globalTrigger[fNglobaltrigger++]) AliMUONGlobalTrigger(trigger);
225 //_____________________________________________________________________________
226 void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber,
227 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
228 Float_t tof, Float_t momentum, Float_t theta,
229 Float_t phi, Float_t length, Float_t destep)
231 // Add new hit to the hit list
232 TClonesArray &lhits = *fHits;
233 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber,
235 tof, momentum, theta,
236 phi, length, destep);
238 //____________________________________________________________________________
239 void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber,
240 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
241 Float_t tof, Float_t momentum, Float_t theta,
242 Float_t phi, Float_t length, Float_t destep,
243 Float_t Xref,Float_t Yref,Float_t Zref)
245 // Add new hit to the hit list
246 TClonesArray &lhits = *fHits;
247 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber,
249 tof, momentum, theta,
253 //____________________________________________________________________________
254 void AliMUONData::AddHit(const AliMUONHit& hit)
256 TClonesArray &lhits = *fHits;
257 new(lhits[fNhits++]) AliMUONHit(hit);
259 //____________________________________________________________________________
260 void AliMUONData::AddLocalTrigger(Int_t *localtr)
262 // add a MUON Local Trigger to the list
263 TClonesArray &localTrigger = *fLocalTrigger;
264 new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(localtr);
266 //____________________________________________________________________________
267 void AliMUONData::AddLocalTrigger(const AliMUONLocalTrigger& trigger)
269 // add a MUON Local Trigger to the list
270 TClonesArray &localTrigger = *fLocalTrigger;
271 new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(trigger);
273 //_____________________________________________________________________________
274 void AliMUONData::AddRawCluster(Int_t id, const AliMUONRawCluster& c)
277 // Add a MUON rawcluster to the list in the detection plane id
279 TClonesArray &lrawcl = *((TClonesArray*) fRawClusters->At(id));
280 new(lrawcl[fNrawclusters[id]++]) AliMUONRawCluster(c);
282 //_____________________________________________________________________________
283 void AliMUONData::AddRecTrack(const AliMUONTrack& track)
286 // Add a MUON rectrack
288 TClonesArray &lrectracks = *fRecTracks;
289 new(lrectracks[fNrectracks++]) AliMUONTrack(track);
290 // printf("TTTTTT %d ,\n",((AliMUONTrack*)fRecTracks->At(fNrectracks-1))->GetNTrackHits());
292 //_____________________________________________________________________________
293 void AliMUONData::AddRecTriggerTrack(const AliMUONTriggerTrack& triggertrack)
296 // Add a MUON triggerrectrack
298 TClonesArray &lrectriggertracks = *fRecTriggerTracks;
299 new(lrectriggertracks[fNrectriggertracks++]) AliMUONTriggerTrack(triggertrack);
300 // printf("TTTTTT %d ,\n",((AliMUONTrack*)fRecTracks->At(fNrectracks-1))->GetNTrackHits());
303 //____________________________________________________________________________
304 TClonesArray* AliMUONData::Digits(Int_t DetectionPlane)
306 //Getting List of Digits
308 return ( (TClonesArray*) fDigits->At(DetectionPlane) );
312 //____________________________________________________________________________
313 TClonesArray* AliMUONData::SDigits(Int_t DetectionPlane)
315 //Getting List of SDigits
317 return ( (TClonesArray*) fSDigits->At(DetectionPlane) );
321 //____________________________________________________________________________
322 Bool_t AliMUONData::IsRawClusterBranchesInTree()
324 // Checking if there are RawCluster Branches In TreeR
326 Error("TreeR","No treeR in memory");
331 sprintf(branchname,"%sRawClusters1",GetName());
332 TBranch * branch = 0x0;
333 branch = TreeR()->GetBranch(branchname);
334 if (branch) return kTRUE;
338 //____________________________________________________________________________
339 Bool_t AliMUONData::IsTriggerBranchesInTree()
341 // Checking if there are Trigger Branches In TreeR
343 Error("TreeR","No treeR in memory");
348 sprintf(branchname,"%sLocalTrigger",GetName());
349 TBranch * branch = 0x0;
350 branch = TreeR()->GetBranch(branchname);
351 if (branch) return kTRUE;
355 //____________________________________________________________________________
356 Bool_t AliMUONData::IsTrackBranchesInTree()
358 // Checking if there are Track Branches In TreeT
360 Error("TreeT","No treeT in memory");
365 sprintf(branchname,"%sTrack",GetName());
366 TBranch * branch = 0x0;
367 branch = TreeT()->GetBranch(branchname);
368 if (branch) return kTRUE;
372 //____________________________________________________________________________
373 Bool_t AliMUONData::IsTriggerTrackBranchesInTree()
375 // Checking if there are TriggerTrack Branches In TreeT
377 Error("TreeT","No treeT in memory");
382 sprintf(branchname,"%sTriggerTrack",GetName());
383 TBranch * branch = 0x0;
384 branch = TreeT()->GetBranch(branchname);
385 if (branch) return kTRUE;
389 //____________________________________________________________________________
390 void AliMUONData::Fill(Option_t* option)
392 // Method to fill the trees
393 const char *cH = strstr(option,"H");
394 const char *cD = strstr(option,"D"); // Digits branches in TreeD
395 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
396 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
397 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR
398 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
399 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
401 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
404 TBranch * branch = 0x0;
408 if ( TreeH() && cH ) {
413 if ( TreeD() && cD) {
417 if ( TreeS() && cS) {
422 // filling rawclusters
423 if ( TreeR() && cRC ) {
424 if ( IsTriggerBranchesInTree() ) {
425 // Branch per branch filling
426 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
427 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
428 branch = TreeR()->GetBranch(branchname);
432 else TreeR()->Fill();
437 if ( TreeR() && cGLT) {
438 if (IsRawClusterBranchesInTree()) {
439 // Branch per branch filling
440 sprintf(branchname,"%sLocalTrigger",GetName());
441 branch = TreeR()->GetBranch(branchname);
443 sprintf(branchname,"%sGlobalTrigger",GetName());
444 branch = TreeR()->GetBranch(branchname);
447 else TreeR()->Fill();
451 if ( TreeT() && cRT ) {
452 if (IsTriggerTrackBranchesInTree()) {
453 sprintf(branchname,"%sTrack",GetName());
454 branch = TreeT()->GetBranch(branchname);
457 else TreeT()->Fill();
459 // filling trigger tracks
460 if ( TreeT() && cRL ) {
461 if (IsTrackBranchesInTree()) {
462 sprintf(branchname,"%sTriggerTrack",GetName());
463 branch = TreeT()->GetBranch(branchname);
466 else TreeT()->Fill();
468 // if ( TreeT() && cRL ) {
469 // sprintf(branchname,"%sTrackTrig",GetName());
473 //_____________________________________________________________________________
474 void AliMUONData::MakeBranch(Option_t* option)
477 // Create Tree branches for the MUON.
479 const Int_t kBufferSize = 4000;
483 const char *cH = strstr(option,"H");
484 const char *cD = strstr(option,"D"); // Digits branches in TreeD
485 const char *cS = strstr(option,"S"); // Digits branches in TreeS
486 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
487 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR
488 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
489 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
490 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
492 TBranch * branch = 0x0;
494 // Creating Branches for Hits
498 fHits = new TClonesArray("AliMUONHit",1000);
499 // if (gAlice->GetMCApp())
500 // gAlice->GetMCApp()->AddHitList (fHits);
504 sprintf(branchname,"%sHits",GetName());
505 branch = TreeH()->GetBranch(branchname);
507 Info("MakeBranch","Branch %s is already in tree.",GetName());
510 branch = TreeH()->Branch(branchname,&fHits,kBufferSize);
511 //Info("MakeBranch","Making Branch %s for hits \n",branchname);
514 //Creating Branches for Digits
515 if (TreeD() && cD ) {
516 // one branch for digits per chamber
517 if (fDigits == 0x0) {
518 fDigits = new TObjArray(AliMUONConstants::NCh());
519 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
520 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
522 fDigits->AddAt(tca,iDetectionPlane);
525 if (fNdigits == 0x0) {
526 fNdigits = new Int_t[AliMUONConstants::NCh()];
527 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
528 fNdigits[iDetectionPlane]=0;
531 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
532 sprintf(branchname,"%sDigits%d",GetName(),iDetectionPlane+1);
534 branch = TreeD()->GetBranch(branchname);
536 Info("MakeBranch","Branch %s is already in tree.",GetName());
539 TClonesArray * digits = Digits(iDetectionPlane);
540 branch = TreeD()->Branch(branchname, &digits, kBufferSize,1);
541 //Info("MakeBranch","Making Branch %s for digits in detection plane %d\n",branchname,iDetectionPlane+1);
545 //Creating Branches for SDigits
546 if (TreeS() && cS ) {
547 // one branch for Sdigits per chamber
548 if (fSDigits == 0x0) {
549 fSDigits = new TObjArray(AliMUONConstants::NCh());
550 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
551 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
553 fSDigits->AddAt(tca,iDetectionPlane);
556 if (fNSdigits == 0x0) {
557 fNSdigits = new Int_t[AliMUONConstants::NCh()];
558 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
559 fNSdigits[iDetectionPlane]=0;
562 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
563 sprintf(branchname,"%sSDigits%d",GetName(),iDetectionPlane+1);
565 branch = TreeS()->GetBranch(branchname);
567 Info("MakeBranch","Branch %s is already in tree.",GetName());
570 TClonesArray * Sdigits = SDigits(iDetectionPlane);
571 branch = TreeS()->Branch(branchname, &Sdigits, kBufferSize,1);
572 //Info("MakeBranch","Making Branch %s for Sdigits in detection plane %d\n",branchname,iDetectionPlane+1);
576 if (TreeR() && cRC ) {
577 // one branch for raw clusters per tracking detection plane
580 if (fRawClusters == 0x0) {
581 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
582 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
583 TClonesArray * tca = new TClonesArray("AliMUONRawCluster",1000);
585 fRawClusters->AddAt(tca,i);
589 if (fNrawclusters == 0x0) {
590 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
591 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
596 for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) {
597 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
599 branch = TreeR()->GetBranch(branchname);
601 Info("MakeBranch","Branch %s is already in tree.",GetName());
604 branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize);
605 //Info("MakeBranch","Making Branch %s for rawcluster in detection plane %d\n",branchname,i+1);
609 if (TreeR() && cGLT ) {
611 // one branch for global trigger
613 sprintf(branchname,"%sGlobalTrigger",GetName());
616 if (fGlobalTrigger == 0x0) {
617 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger");
620 branch = TreeR()->GetBranch(branchname);
622 Info("MakeBranch","Branch %s is already in tree.",GetName());
625 branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize);
626 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
629 // one branch for local trigger
631 sprintf(branchname,"%sLocalTrigger",GetName());
634 if (fLocalTrigger == 0x0) {
635 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
638 branch = TreeR()->GetBranch(branchname);
640 Info("MakeBranch","Branch %s is already in tree.",GetName());
643 branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize);
644 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
647 if (TreeT() && cRT ) {
648 if (fRecTracks == 0x0) fRecTracks = new TClonesArray("AliMUONTrack",100);
650 sprintf(branchname,"%sTrack",GetName());
651 branch = TreeT()->GetBranch(branchname);
653 Info("MakeBranch","Branch %s is already in tree.",GetName());
656 branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize);
657 //Info("MakeBranch","Making Branch %s for tracks \n",branchname);
660 if (TreeT() && cRL ) {
661 if (fRecTriggerTracks == 0x0) fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
662 fNrectriggertracks = 0;
663 sprintf(branchname,"%sTriggerTrack",GetName());
664 branch = TreeT()->GetBranch(branchname);
666 Info("MakeBranch","Branch %s is already in tree.",GetName());
669 branch = TreeT()->Branch(branchname,&fRecTriggerTracks,kBufferSize);
670 //Info("MakeBranch","Making Branch %s for trigger tracks \n",branchname);
673 //____________________________________________________________________________
674 TClonesArray* AliMUONData::RawClusters(Int_t DetectionPlane)
676 // Getting Raw Clusters
678 return ( (TClonesArray*) fRawClusters->At(DetectionPlane) );
682 //____________________________________________________________________________
683 TClonesArray* AliMUONData::LocalTrigger()
685 // Getting Local Trigger
687 return ( (TClonesArray*) fLocalTrigger );
691 //____________________________________________________________________________
692 TClonesArray* AliMUONData::GlobalTrigger()
694 // Getting Global Trigger
696 return ( (TClonesArray*) fGlobalTrigger );
700 //____________________________________________________________________________
701 void AliMUONData::ResetDigits()
704 // Reset number of digits and the digits array for this detector
706 if (fDigits == 0x0) return;
707 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
708 if ((*fDigits)[i]) ((TClonesArray*)fDigits->At(i))->Clear();
709 if (fNdigits) fNdigits[i]=0;
712 //____________________________________________________________________________
713 void AliMUONData::ResetSDigits()
716 // Reset number of Sdigits and the Sdigits array for this detector
718 if (fSDigits == 0x0) return;
719 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
720 if ((*fSDigits)[i]) ((TClonesArray*)fSDigits->At(i))->Clear();
721 if (fNSdigits) fNSdigits[i]=0;
724 //______________________________________________________________________________
725 void AliMUONData::ResetHits()
727 // Reset number of clusters and the cluster array for this detector
729 if (fHits) fHits->Clear();
731 //_______________________________________________________________________________
732 void AliMUONData::ResetRawClusters()
734 // Reset number of raw clusters and the raw clust array for this detector
736 for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) {
737 if ((*fRawClusters)[i]) ((TClonesArray*)fRawClusters->At(i))->Clear();
738 if (fNrawclusters) fNrawclusters[i]=0;
741 //_______________________________________________________________________________
742 void AliMUONData::ResetTrigger()
744 // Reset Local and Global Trigger
746 if (fGlobalTrigger) fGlobalTrigger->Clear();
748 if (fLocalTrigger) fLocalTrigger->Clear();
750 //____________________________________________________________________________
751 void AliMUONData::ResetRecTracks()
753 // Reset tracks information
755 if (fRecTracks) fRecTracks->Clear();
757 //____________________________________________________________________________
758 void AliMUONData::ResetRecTriggerTracks()
760 // Reset tracks information
761 fNrectriggertracks = 0;
762 if (fRecTriggerTracks) fRecTriggerTracks->Clear();
764 //_____________________________________________________________________________
765 void AliMUONData::SetTreeAddress(Option_t* option)
767 //Setting Addresses to the events trees
768 const char *cH = strstr(option,"H");
769 const char *cD = strstr(option,"D"); // Digits branches in TreeD
770 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
771 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
772 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR
773 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
774 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
775 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
777 // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree.
779 TBranch * branch = 0x0;
782 // Branch address for hit tree
783 if ( TreeH() && cH ) {
785 fHits = new TClonesArray("AliMUONHit",1000);
786 // if (gAlice->GetMCApp())
787 // gAlice->GetMCApp()->AddHitList (fHits); Moved to AliMUON
791 if (TreeH() && fHits && cH) {
792 sprintf(branchname,"%sHits",GetName());
793 branch = TreeH()->GetBranch(branchname);
795 // Info("SetTreeAddress","(%s) Setting for Hits",GetName());
796 branch->SetAddress(&fHits);
798 else { //can be invoked before branch creation
799 Warning("SetTreeAddress","(%s) Failed for Hits. Can not find branch in tree.",GetName());
804 // Branch address for digit tree
805 if ( TreeD() && cD) {
806 if (fDigits == 0x0) {
807 fDigits = new TObjArray(AliMUONConstants::NCh());
808 fNdigits= new Int_t[AliMUONConstants::NCh()];
809 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
810 fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i);
816 if (TreeD() && fDigits && cD) {
817 for (int i=0; i<AliMUONConstants::NCh(); i++) {
818 sprintf(branchname,"%sDigits%d",GetName(),i+1);
820 branch = TreeD()->GetBranch(branchname);
821 TClonesArray * digits = Digits(i);
823 branch->SetAddress( &digits );
825 else Warning("SetTreeAddress","(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i);
830 // Branch address for Sdigit tree
831 if ( TreeS() && cS) {
832 if (fSDigits == 0x0) {
833 fSDigits = new TObjArray(AliMUONConstants::NCh());
834 fNSdigits= new Int_t[AliMUONConstants::NCh()];
835 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
836 fSDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i);
842 if (TreeS() && fSDigits && cS) {
843 for (int i=0; i<AliMUONConstants::NCh(); i++) {
844 sprintf(branchname,"%sSDigits%d",GetName(),i+1);
846 branch = TreeS()->GetBranch(branchname);
847 TClonesArray * Sdigits = SDigits(i);
848 if (branch) branch->SetAddress( &Sdigits );
849 else Warning("SetTreeAddress","(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i);
855 // Branch address for rawclusters, globaltrigger and local trigger tree
857 if (fRawClusters == 0x0 && cRC) {
858 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
859 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
860 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
861 fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i);
865 if (fLocalTrigger == 0x0 && cGLT) {
866 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
868 if (fGlobalTrigger== 0x0 && cGLT) {
869 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
873 if ( TreeR() && fRawClusters && cRC) {
874 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
875 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
877 branch = TreeR()->GetBranch(branchname);
878 if (branch) branch->SetAddress( &((*fRawClusters)[i]) );
879 else Warning("SetTreeAddress","(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i);
883 if ( TreeR() && fLocalTrigger && cGLT) {
884 sprintf(branchname,"%sLocalTrigger",GetName());
885 branch = TreeR()->GetBranch(branchname);
886 if (branch) branch->SetAddress(&fLocalTrigger);
887 else Warning("SetTreeAddress","(%s) Failed for LocalTrigger. Can not find branch in tree.",GetName());
889 if ( TreeR() && fGlobalTrigger && cGLT) {
890 sprintf(branchname,"%sGlobalTrigger",GetName());
891 branch = TreeR()->GetBranch(branchname);
892 if (branch) branch->SetAddress(&fGlobalTrigger);
893 else Warning("SetTreeAddress","(%s) Failed for LocalTrigger. Can not find branch in tree.",GetName());
897 if (fRecTracks == 0x0 && cRT) {
898 fRecTracks = new TClonesArray("AliMUONTrack",100);
902 if ( TreeT() && fRecTracks && cRT ) {
903 sprintf(branchname,"%sTrack",GetName());
904 branch = TreeT()->GetBranch(branchname);
905 if (branch) branch->SetAddress(&fRecTracks);
906 else Warning("SetTreeAddress","(%s) Failed for Tracks. Can not find branch in tree.",GetName());
910 if (fRecTriggerTracks == 0x0 && cRL) {
911 fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
915 if ( TreeT() && fRecTriggerTracks && cRL ) {
916 sprintf(branchname,"%sTriggerTrack",GetName());
917 branch = TreeT()->GetBranch(branchname);
918 if (branch) branch->SetAddress(&fRecTriggerTracks);
919 else Warning("SetTreeAddress","(%s) Failed for Trigger Tracks. Can not find branch in tree.",GetName());
924 //_____________________________________________________________________________