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 **************************************************************************/
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
23 /// Gines Martinez, Subatech, September 2003
26 #include "AliMUONData.h"
29 #include "AliMUONConstants.h"
30 #include "AliMUONDigit.h"
31 #include "AliMUONGlobalTrigger.h"
32 #include "AliMUONHit.h"
33 #include "AliMUONLocalTrigger.h"
34 #include "AliMUONRawCluster.h"
35 #include "AliMUONTrack.h"
36 #include "AliMUONTriggerTrack.h"
37 #include "AliRunLoader.h"
43 //_____________________________________________________________________________
44 AliMUONData::AliMUONData():
54 fRecTriggerTracks(0x0),
62 fNrectriggertracks(0),
66 // Default constructor
68 //_____________________________________________________________________________
69 AliMUONData::AliMUONData(AliLoader * loader, const char* name, const char* title):
79 fRecTriggerTracks(0x0),
87 fNrectriggertracks(0),
91 // Constructor for AliMUONData
94 //_____________________________________________________________________________
95 AliMUONData::AliMUONData(const AliMUONData& rMUONData):TNamed(rMUONData)
97 // Protected copy constructor
99 AliFatal("Not implemented.");
102 //_____________________________________________________________________________
103 AliMUONData::~AliMUONData()
105 // Destructor for AliMUONData
120 fRawClusters->Delete();
124 fGlobalTrigger->Delete();
125 delete fGlobalTrigger;
128 fLocalTrigger->Delete();
129 delete fLocalTrigger;
132 fRecTracks->Delete();
135 if (fRecTriggerTracks){
136 fRecTriggerTracks->Delete();
137 delete fRecTriggerTracks;
141 //_____________________________________________________________________________
142 AliMUONData& AliMUONData::operator=(const AliMUONData& rhs)
144 // Protected assignement operator
146 if (this == &rhs) return *this;
148 AliFatal("Not implemented.");
154 //_____________________________________________________________________________
155 void AliMUONData::AddDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
158 // Add a MUON digit to the list of Digits of the detection plane id
160 TClonesArray &ldigits = * Digits(id) ;
161 new(ldigits[fNdigits[id]++]) AliMUONDigit(tracks,charges,digits);
163 //_____________________________________________________________________________
164 void AliMUONData::AddDigit(Int_t id, const AliMUONDigit& digit)
167 // Add a MUON digit to the list of Digits of the detection plane id
169 TClonesArray &ldigits = * Digits(id) ;
170 new(ldigits[fNdigits[id]++]) AliMUONDigit(digit);
172 //_____________________________________________________________________________
173 void AliMUONData::AddSDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *sdigits)
176 // Add a MUON Sdigit to the list of SDigits of the detection plane id
178 TClonesArray &lSdigits = * SDigits(id) ;
179 new(lSdigits[fNSdigits[id]++]) AliMUONDigit(tracks,charges,sdigits);
181 //_____________________________________________________________________________
182 void AliMUONData::AddSDigit(Int_t id, const AliMUONDigit& Sdigit)
185 // Add a MUON Sdigit to the list of SDigits of the detection plane id
187 TClonesArray &lSdigits = * SDigits(id) ;
188 new(lSdigits[fNSdigits[id]++]) AliMUONDigit(Sdigit);
191 //_____________________________________________________________________________
192 void AliMUONData::AddGlobalTrigger(const AliMUONGlobalTrigger& trigger )
194 // add a MUON Global Trigger to the list (only one GlobalTrigger per event !);
195 TClonesArray &globalTrigger = *fGlobalTrigger;
196 new(globalTrigger[fNglobaltrigger++]) AliMUONGlobalTrigger(trigger);
198 //____________________________________________________________________________
199 void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber,
200 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
201 Float_t tof, Float_t momentum, Float_t theta,
202 Float_t phi, Float_t length, Float_t destep,
203 Float_t Xref,Float_t Yref,Float_t Zref)
205 // Add new hit to the hit list
206 TClonesArray &lhits = *fHits;
207 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber,
209 tof, momentum, theta,
213 //____________________________________________________________________________
214 void AliMUONData::AddHit2(Int_t fIshunt, Int_t track, Int_t detElemId,
215 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
216 Float_t tof, Float_t momentum, Float_t theta,
217 Float_t phi, Float_t length, Float_t destep,
218 Float_t Xref,Float_t Yref,Float_t Zref)
220 // Add new hit to the hit list
221 TClonesArray &lhits = *fHits;
222 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, detElemId,
224 tof, momentum, theta,
226 Xref,Yref,Zref, true);
228 //____________________________________________________________________________
229 void AliMUONData::AddLocalTrigger(const AliMUONLocalTrigger& trigger)
231 // add a MUON Local Trigger to the list
232 TClonesArray &localTrigger = *fLocalTrigger;
233 new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(trigger);
235 //_____________________________________________________________________________
236 void AliMUONData::AddRawCluster(Int_t id, const AliMUONRawCluster& c)
239 // Add a MUON rawcluster to the list in the detection plane id
241 TClonesArray &lrawcl = *((TClonesArray*) fRawClusters->At(id));
242 new(lrawcl[fNrawclusters[id]++]) AliMUONRawCluster(c);
244 //_____________________________________________________________________________
245 void AliMUONData::AddRecTrack(const AliMUONTrack& track)
248 // Add a MUON rectrack
250 TClonesArray &lrectracks = *fRecTracks;
251 new(lrectracks[fNrectracks++]) AliMUONTrack(track);
253 //_____________________________________________________________________________
254 void AliMUONData::AddRecTriggerTrack(const AliMUONTriggerTrack& triggertrack)
257 // Add a MUON triggerrectrack
259 TClonesArray &lrectriggertracks = *fRecTriggerTracks;
260 new(lrectriggertracks[fNrectriggertracks++]) AliMUONTriggerTrack(triggertrack);
262 //____________________________________________________________________________
263 TClonesArray* AliMUONData::Digits(Int_t DetectionPlane) const
265 //Getting List of Digits
267 return ( (TClonesArray*) fDigits->At(DetectionPlane) );
271 //____________________________________________________________________________
272 TClonesArray* AliMUONData::SDigits(Int_t DetectionPlane) const
274 //Getting List of SDigits
276 return ( (TClonesArray*) fSDigits->At(DetectionPlane) );
280 //____________________________________________________________________________
281 Bool_t AliMUONData::IsRawClusterBranchesInTree()
283 // Checking if there are RawCluster Branches In TreeR
285 AliError("No treeR in memory");
290 sprintf(branchname,"%sRawClusters1",GetName());
291 TBranch * branch = 0x0;
292 branch = TreeR()->GetBranch(branchname);
293 if (branch) return kTRUE;
297 //____________________________________________________________________________
298 Bool_t AliMUONData::IsDigitsBranchesInTree()
300 // Checking if there are RawCluster Branches In TreeR
302 AliError("No treeD in memory");
307 sprintf(branchname,"%sDigits1",GetName());
308 TBranch * branch = 0x0;
309 branch = TreeD()->GetBranch(branchname);
310 if (branch) return kTRUE;
314 //____________________________________________________________________________
315 Bool_t AliMUONData::IsTriggerBranchesInTree()
317 // Checking if there are Trigger Branches In TreeR
319 AliError("No treeR in memory");
324 sprintf(branchname,"%sLocalTrigger",GetName());
325 TBranch * branch = 0x0;
326 branch = TreeR()->GetBranch(branchname);
327 if (branch) return kTRUE;
331 //____________________________________________________________________________
332 Bool_t AliMUONData::IsTriggerBranchesInTreeD()
334 // Checking if there are Trigger Branches In TreeR
336 AliError("No treeD in memory");
341 sprintf(branchname,"%sLocalTrigger",GetName());
342 TBranch * branch = 0x0;
343 branch = TreeD()->GetBranch(branchname);
344 if (branch) return kTRUE;
349 //____________________________________________________________________________
350 Bool_t AliMUONData::IsTrackBranchesInTree()
352 // Checking if there are Track Branches In TreeT
354 AliError("No treeT in memory");
359 sprintf(branchname,"%sTrack",GetName());
360 TBranch * branch = 0x0;
361 branch = TreeT()->GetBranch(branchname);
362 if (branch) return kTRUE;
366 //____________________________________________________________________________
367 Bool_t AliMUONData::IsTriggerTrackBranchesInTree()
369 // Checking if there are TriggerTrack Branches In TreeT
371 AliError("No treeT in memory");
376 sprintf(branchname,"%sTriggerTrack",GetName());
377 TBranch * branch = 0x0;
378 branch = TreeT()->GetBranch(branchname);
379 if (branch) return kTRUE;
383 //____________________________________________________________________________
384 void AliMUONData::Fill(Option_t* option)
386 // Method to fill the trees
387 const char *cH = strstr(option,"H");
388 const char *cD = strstr(option,"D"); // Digits branches in TreeD
389 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
390 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
391 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
392 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
393 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
394 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
396 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
399 TBranch * branch = 0x0;
409 if ( TreeD() && cD && cGLT )
411 // Writing digits and (global+local) trigger at once.
418 if ( IsTriggerBranchesInTreeD() )
420 for (int i=0; i<AliMUONConstants::NCh(); i++)
422 sprintf(branchname,"%sDigits%d",GetName(),i+1);
423 branch = TreeD()->GetBranch(branchname);
433 if ( TreeD() && cGLT )
435 if ( IsDigitsBranchesInTree() )
437 sprintf(branchname,"%sLocalTrigger",GetName());
438 branch = TreeD()->GetBranch(branchname);
440 sprintf(branchname,"%sGlobalTrigger",GetName());
441 branch = TreeD()->GetBranch(branchname);
449 } // end of TreeD() handling.
459 if ( TreeR() && cRC && cTC )
465 if ( TreeR() && cRC )
467 if ( IsTriggerBranchesInTree() )
469 // Branch per branch filling
470 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++)
472 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
473 branch = TreeR()->GetBranch(branchname);
485 if (IsRawClusterBranchesInTree())
487 // Branch per branch filling
488 sprintf(branchname,"%sLocalTrigger",GetName());
489 branch = TreeR()->GetBranch(branchname);
491 sprintf(branchname,"%sGlobalTrigger",GetName());
492 branch = TreeR()->GetBranch(branchname);
504 if ( TreeT() && cRT && cRL )
510 if ( TreeT() && cRT )
512 if (IsTriggerTrackBranchesInTree())
514 sprintf(branchname,"%sTrack",GetName());
515 branch = TreeT()->GetBranch(branchname);
524 if ( TreeT() && cRL )
526 if (IsTrackBranchesInTree())
528 sprintf(branchname,"%sTriggerTrack",GetName());
529 branch = TreeT()->GetBranch(branchname);
540 //_____________________________________________________________________________
541 void AliMUONData::MakeBranch(Option_t* option)
544 // Create Tree branches for the MUON.
546 const Int_t kBufferSize = 4000;
550 const char *cH = strstr(option,"H");
551 const char *cD = strstr(option,"D"); // Digits branches in TreeD
552 const char *cS = strstr(option,"S"); // Digits branches in TreeS
553 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
554 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
555 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
556 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
557 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
558 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
560 TBranch * branch = 0x0;
562 // Creating Branches for Hits
566 fHits = new TClonesArray("AliMUONHit",1000);
567 // if (gAlice->GetMCApp())
568 // gAlice->GetMCApp()->AddHitList (fHits);
572 sprintf(branchname,"%sHits",GetName());
573 branch = TreeH()->GetBranch(branchname);
575 AliInfo(Form("MakeBranch","Branch %s is already in tree.",branchname));
578 branch = TreeH()->Branch(branchname,&fHits,kBufferSize);
579 //Info("MakeBranch","Making Branch %s for hits \n",branchname);
582 //Creating Branches for Digits
591 // one branch for digits per chamber
594 fDigits = new TObjArray(AliMUONConstants::NCh());
595 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++)
597 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
599 fDigits->AddAt(tca,iDetectionPlane);
604 fNdigits = new Int_t[AliMUONConstants::NCh()];
605 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++)
607 fNdigits[iDetectionPlane]=0;
610 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++)
612 sprintf(branchname,"%sDigits%d",GetName(),iDetectionPlane+1);
613 branch = treeD->GetBranch(branchname);
616 AliInfo(Form("Branch %s is already in tree.",branchname));
619 TClonesArray * digits = Digits(iDetectionPlane);
620 branch = treeD->Branch(branchname, &digits, kBufferSize,1);
627 // one branch for global trigger
629 sprintf(branchname,"%sGlobalTrigger",GetName());
631 if (fGlobalTrigger == 0x0)
633 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger");
636 branch = treeD->GetBranch(branchname);
639 AliInfo(Form("Branch GlobalTrigger is already in treeD."));
642 branch = treeD->Branch(branchname, &fGlobalTrigger, kBufferSize);
645 // one branch for local trigger
647 sprintf(branchname,"%sLocalTrigger",GetName());
650 if (fLocalTrigger == 0x0)
652 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
655 branch = treeD->GetBranch(branchname);
658 AliInfo(Form("Branch LocalTrigger is already in treeD."));
661 branch = treeD->Branch(branchname, &fLocalTrigger, kBufferSize);
664 //Creating Branches for SDigits
665 if (TreeS() && cS ) {
666 // one branch for Sdigits per chamber
667 if (fSDigits == 0x0) {
668 fSDigits = new TObjArray(AliMUONConstants::NCh());
669 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
670 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
672 fSDigits->AddAt(tca,iDetectionPlane);
675 if (fNSdigits == 0x0) {
676 fNSdigits = new Int_t[AliMUONConstants::NCh()];
677 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
678 fNSdigits[iDetectionPlane]=0;
681 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
682 sprintf(branchname,"%sSDigits%d",GetName(),iDetectionPlane+1);
684 branch = TreeS()->GetBranch(branchname);
686 AliInfo(Form("Branch %s is already in tree.",branchname));
689 TClonesArray * sdigits = SDigits(iDetectionPlane);
690 branch = TreeS()->Branch(branchname, &sdigits, kBufferSize,1);
691 //Info("MakeBranch","Making Branch %s for sdigits in detection plane %d\n",branchname,iDetectionPlane+1);
695 if (TreeR() && cRC ) {
696 // one branch for raw clusters per tracking detection plane
699 if (fRawClusters == 0x0) {
700 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
701 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
702 TClonesArray * tca = new TClonesArray("AliMUONRawCluster",1000);
704 fRawClusters->AddAt(tca,i);
708 if (fNrawclusters == 0x0) {
709 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
710 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
715 for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) {
716 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
718 branch = TreeR()->GetBranch(branchname);
720 AliInfo(Form("Branch %s is already in tree.",branchname));
723 branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize);
724 //Info("MakeBranch","Making Branch %s for rawcluster in detection plane %d\n",branchname,i+1);
728 if (TreeR() && cTC ) {
730 // one branch for global trigger
732 sprintf(branchname,"%sGlobalTrigger",GetName());
735 if (fGlobalTrigger == 0x0) {
736 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger");
739 branch = TreeR()->GetBranch(branchname);
741 AliInfo(Form("Branch GlobalTrigger is already in treeR."));
744 branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize);
745 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
748 // one branch for local trigger
750 sprintf(branchname,"%sLocalTrigger",GetName());
753 if (fLocalTrigger == 0x0) {
754 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
757 branch = TreeR()->GetBranch(branchname);
759 AliInfo(Form("Branch LocalTrigger is already in treeR."));
762 branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize);
763 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
766 if (TreeT() && cRT ) {
767 if (fRecTracks == 0x0) fRecTracks = new TClonesArray("AliMUONTrack",100);
769 sprintf(branchname,"%sTrack",GetName());
770 branch = TreeT()->GetBranch(branchname);
772 AliInfo(Form("Branch %s is already in tree.",GetName()));
775 branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize);
776 //Info("MakeBranch","Making Branch %s for tracks \n",branchname);
779 if (TreeT() && cRL ) {
780 if (fRecTriggerTracks == 0x0) fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
781 fNrectriggertracks = 0;
782 sprintf(branchname,"%sTriggerTrack",GetName());
783 branch = TreeT()->GetBranch(branchname);
785 AliInfo(Form("Branch %s is already in tree.",GetName()));
788 branch = TreeT()->Branch(branchname,&fRecTriggerTracks,kBufferSize);
789 //Info("MakeBranch","Making Branch %s for trigger tracks \n",branchname);
792 //____________________________________________________________________________
793 TClonesArray* AliMUONData::RawClusters(Int_t DetectionPlane)
795 // Getting Raw Clusters
797 return ( (TClonesArray*) fRawClusters->At(DetectionPlane) );
802 //____________________________________________________________________________
804 AliMUONData::LocalTrigger() const
806 return fLocalTrigger;
809 //____________________________________________________________________________
811 AliMUONData::GetDigits() const
813 // Load the digits from TreeD for the current event.
814 Int_t event = fLoader->GetRunLoader()->GetEventNumber();
815 if ( fCurrentEvent != event )
817 fLoader->TreeD()->GetEvent(0);
818 fCurrentEvent = event;
822 //____________________________________________________________________________
824 AliMUONData::GlobalTrigger() const
826 // Return the global trigger
827 return fGlobalTrigger;
830 //____________________________________________________________________________
831 void AliMUONData::ResetDigits()
834 // Reset number of digits and the digits array for this detector
836 if (fDigits == 0x0) return;
837 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
838 if ((*fDigits)[i]) ((TClonesArray*)fDigits->At(i))->Clear("C");
839 if (fNdigits) fNdigits[i]=0;
842 //____________________________________________________________________________
843 void AliMUONData::ResetSDigits()
846 // Reset number of Sdigits and the Sdigits array for this detector
848 if (fSDigits == 0x0) return;
849 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
850 if ((*fSDigits)[i]) ((TClonesArray*)fSDigits->At(i))->Clear();
851 if (fNSdigits) fNSdigits[i]=0;
854 //______________________________________________________________________________
855 void AliMUONData::ResetHits()
857 // Reset number of clusters and the cluster array for this detector
859 if (fHits) fHits->Clear();
861 //_______________________________________________________________________________
862 void AliMUONData::ResetRawClusters()
864 // Reset number of raw clusters and the raw clust array for this detector
866 for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) {
867 if ((*fRawClusters)[i]) ((TClonesArray*)fRawClusters->At(i))->Clear();
868 if (fNrawclusters) fNrawclusters[i]=0;
871 //_______________________________________________________________________________
872 void AliMUONData::ResetTrigger()
874 // Reset Local and Global Trigger
876 if (fGlobalTrigger) fGlobalTrigger->Clear();
878 if (fLocalTrigger) fLocalTrigger->Clear();
880 //____________________________________________________________________________
881 void AliMUONData::ResetRecTracks()
883 // Reset tracks information
885 if (fRecTracks) fRecTracks->Delete(); // necessary to delete in case of memory allocation
887 //____________________________________________________________________________
888 void AliMUONData::ResetRecTriggerTracks()
890 // Reset tracks information
891 fNrectriggertracks = 0;
892 if (fRecTriggerTracks) fRecTriggerTracks->Delete(); // necessary to delete in case of memory allocation
894 //_____________________________________________________________________________
895 void AliMUONData::SetTreeAddress(Option_t* option)
897 //Setting Addresses to the events trees
898 const char *cH = strstr(option,"H");
899 const char *cD = strstr(option,"D"); // Digits branches in TreeD
900 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
901 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
902 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
903 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
904 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
905 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
906 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
908 // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree.
910 TBranch * branch = 0x0;
912 AliDebug(1,Form("option=%s",option));
914 // Branch address for hit tree
915 if ( TreeH() && cH ) {
917 fHits = new TClonesArray("AliMUONHit",1000);
918 // if (gAlice->GetMCApp())
919 // gAlice->GetMCApp()->AddHitList (fHits); Moved to AliMUON
923 if (TreeH() && fHits && cH) {
924 sprintf(branchname,"%sHits",GetName());
925 branch = TreeH()->GetBranch(branchname);
927 // Info("SetTreeAddress","(%s) Setting for Hits",GetName());
928 branch->SetAddress(&fHits);
930 else { //can be invoked before branch creation
931 AliWarning(Form("(%s) Failed for Hits. Can not find branch in tree.",GetName()));
936 // Branch address for digit tree
938 if (fDigits == 0x0 && cD) {
939 fDigits = new TObjArray(AliMUONConstants::NCh());
940 fNdigits= new Int_t[AliMUONConstants::NCh()];
941 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
942 fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i);
946 if (fLocalTrigger == 0x0 && cGLT) {
947 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
949 if (fGlobalTrigger== 0x0 && cGLT) {
950 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
954 if (TreeD() && fDigits && cD) {
955 for (int i=0; i<AliMUONConstants::NCh(); i++) {
956 sprintf(branchname,"%sDigits%d",GetName(),i+1);
958 branch = TreeD()->GetBranch(branchname);
959 TClonesArray * digits = Digits(i);
961 branch->SetAddress( &digits );
963 else AliWarning(Form("(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i));
967 if ( TreeD() && fLocalTrigger && cGLT) {
968 sprintf(branchname,"%sLocalTrigger",GetName());
969 branch = TreeD()->GetBranch(branchname);
970 if (branch) branch->SetAddress(&fLocalTrigger);
971 else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeD.",GetName()));
973 if ( TreeD() && fGlobalTrigger && cGLT) {
974 sprintf(branchname,"%sGlobalTrigger",GetName());
975 branch = TreeD()->GetBranch(branchname);
976 if (branch) branch->SetAddress(&fGlobalTrigger);
977 else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeD.",GetName()));
981 // Branch address for Sdigit tree
986 AliDebug(1,"Creating fSDigits TObjArray");
987 fSDigits = new TObjArray(AliMUONConstants::NCh());
988 fNSdigits= new Int_t[AliMUONConstants::NCh()];
989 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++)
991 TClonesArray* a = new TClonesArray("AliMUONDigit",10000);
992 fSDigits->AddAt(a,i);
993 AliDebug(1,Form("fSDigits[%d]=%p",i,a));
999 AliDebug(1,Form("fSDigits already there = %p",fSDigits));
1003 if (TreeS() && fSDigits && cS) {
1004 AliDebug(1,"Setting branch addresses");
1005 for (int i=0; i<AliMUONConstants::NCh(); i++) {
1006 sprintf(branchname,"%sSDigits%d",GetName(),i+1);
1008 AliDebug(1,Form("TreeS=%p for ich=%d branchname=%s",
1009 TreeS(),i,branchname));
1010 branch = TreeS()->GetBranch(branchname);
1011 TClonesArray * sdigits = SDigits(i);
1012 if (branch) branch->SetAddress( &sdigits );
1013 else AliWarning(Form("(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i));
1019 // Branch address for rawclusters, globaltrigger and local trigger tree
1021 if (fRawClusters == 0x0 && cRC) {
1022 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
1023 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
1024 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
1025 fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i);
1029 if (fLocalTrigger == 0x0 && cTC) {
1030 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
1032 if (fGlobalTrigger== 0x0 && cTC) {
1033 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
1037 if ( TreeR() && fRawClusters && cRC && !strstr(cRC,"RCC")) {
1038 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
1039 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
1041 branch = TreeR()->GetBranch(branchname);
1042 if (branch) branch->SetAddress( &((*fRawClusters)[i]) );
1043 else AliWarning(Form("(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i));
1047 if ( TreeR() && fLocalTrigger && cTC) {
1048 sprintf(branchname,"%sLocalTrigger",GetName());
1049 branch = TreeR()->GetBranch(branchname);
1050 if (branch) branch->SetAddress(&fLocalTrigger);
1051 else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeR.",GetName()));
1053 if ( TreeR() && fGlobalTrigger && cTC) {
1054 sprintf(branchname,"%sGlobalTrigger",GetName());
1055 branch = TreeR()->GetBranch(branchname);
1056 if (branch) branch->SetAddress(&fGlobalTrigger);
1057 else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeR.",GetName()));
1061 if (fRecTracks == 0x0 && cRT) {
1062 fRecTracks = new TClonesArray("AliMUONTrack",100);
1066 if ( TreeT() && fRecTracks && cRT ) {
1067 sprintf(branchname,"%sTrack",GetName());
1068 branch = TreeT()->GetBranch(branchname);
1069 if (branch) branch->SetAddress(&fRecTracks);
1070 else AliWarning(Form("(%s) Failed for Tracks. Can not find branch in tree.",GetName()));
1074 if (fRecTriggerTracks == 0x0 && cRL) {
1075 fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
1079 if ( TreeT() && fRecTriggerTracks && cRL ) {
1080 sprintf(branchname,"%sTriggerTrack",GetName());
1081 branch = TreeT()->GetBranch(branchname);
1082 if (branch) branch->SetAddress(&fRecTriggerTracks);
1083 else AliWarning(Form("(%s) Failed for Trigger Tracks. Can not find branch in tree.",GetName()));
1089 //_____________________________________________________________________________
1091 AliMUONData::Print(Option_t* opt) const
1093 // Dump object on screen
1094 TString options(opt);
1097 if ( options.Contains("D") )
1099 for ( Int_t ich = 0; ich < AliMUONConstants::NCh(); ++ich)
1101 TClonesArray* digits = Digits(ich);
1102 Int_t ndigits = digits->GetEntriesFast();
1103 for ( Int_t id = 0; id < ndigits; ++id )
1105 AliMUONDigit* digit =
1106 static_cast<AliMUONDigit*>(digits->UncheckedAt(id));
1112 if ( options.Contains("S") )
1114 for ( Int_t ich = 0; ich < AliMUONConstants::NCh(); ++ich)
1116 TClonesArray* digits = SDigits(ich);
1117 Int_t ndigits = digits->GetEntriesFast();
1118 for ( Int_t id = 0; id < ndigits; ++id )
1120 AliMUONDigit* digit =
1121 static_cast<AliMUONDigit*>(digits->UncheckedAt(id));