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 "AliMUONHit.h"
31 #include "AliMUONDigit.h"
32 #include "AliMUONGlobalTrigger.h"
33 #include "AliMUONLocalTrigger.h"
34 #include "AliMUONRegionalTrigger.h"
35 #include "AliMUONRawCluster.h"
36 #include "AliMUONTrack.h"
37 #include "AliMUONTriggerTrack.h"
38 #include "AliRunLoader.h"
46 //_____________________________________________________________________________
47 AliMUONData::AliMUONData():
56 fRegionalTrigger(0x0),
58 fRecTriggerTracks(0x0),
67 fNrectriggertracks(0),
71 // Default constructor
73 //_____________________________________________________________________________
74 AliMUONData::AliMUONData(AliLoader * loader, const char* name, const char* title):
83 fRegionalTrigger(0x0),
85 fRecTriggerTracks(0x0),
94 fNrectriggertracks(0),
98 /// Standard constructor
101 //_____________________________________________________________________________
102 AliMUONData::~AliMUONData()
104 /// Destructor for AliMUONData
119 fRawClusters->Delete();
123 fGlobalTrigger->Delete();
124 delete fGlobalTrigger;
126 if (fRegionalTrigger){
127 fRegionalTrigger->Delete();
128 delete fRegionalTrigger;
131 fLocalTrigger->Delete();
132 delete fLocalTrigger;
135 fRecTracks->Delete();
138 if (fRecTriggerTracks){
139 fRecTriggerTracks->Delete();
140 delete fRecTriggerTracks;
143 //____________________________________________________________________________
144 void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t detElemId,
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)
150 // Add new hit to the hit list
152 TClonesArray &lhits = *fHits;
153 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, detElemId,
155 tof, momentum, theta,
159 //_____________________________________________________________________________
160 void AliMUONData::AddDigit(Int_t id, const AliMUONDigit& digit)
162 /// Add a MUON digit to the list of Digits of the detection plane id
164 TClonesArray &ldigits = * Digits(id) ;
165 new(ldigits[fNdigits[id]++]) AliMUONDigit(digit);
167 //_____________________________________________________________________________
168 void AliMUONData::AddSDigit(Int_t id, const AliMUONDigit& Sdigit)
170 /// Add a MUON Sdigit to the list of SDigits of the detection plane id
172 TClonesArray &lSdigits = * SDigits(id) ;
173 new(lSdigits[fNSdigits[id]++]) AliMUONDigit(Sdigit);
176 //_____________________________________________________________________________
177 void AliMUONData::AddGlobalTrigger(const AliMUONGlobalTrigger& trigger )
179 /// Add a MUON Global Trigger to the list (only one GlobalTrigger per event !);
181 TClonesArray &globalTrigger = *fGlobalTrigger;
182 new(globalTrigger[fNglobaltrigger++]) AliMUONGlobalTrigger(trigger);
185 //____________________________________________________________________________
186 void AliMUONData::AddRegionalTrigger(const AliMUONRegionalTrigger& trigger)
188 /// add a MUON regional Trigger to the list
189 TClonesArray ®ionalTrigger = *fRegionalTrigger;
190 new(regionalTrigger[fNregionaltrigger++]) AliMUONRegionalTrigger(trigger);
192 //____________________________________________________________________________
193 void AliMUONData::AddLocalTrigger(const AliMUONLocalTrigger& trigger)
195 /// add a MUON Local Trigger to the list
197 TClonesArray &localTrigger = *fLocalTrigger;
198 new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(trigger);
201 //_____________________________________________________________________________
202 void AliMUONData::AddRawCluster(Int_t id, const AliMUONRawCluster& c)
204 /// Add a MUON rawcluster to the list in the detection plane id
206 TClonesArray &lrawcl = *((TClonesArray*) fRawClusters->At(id));
207 new(lrawcl[fNrawclusters[id]++]) AliMUONRawCluster(c);
209 //_____________________________________________________________________________
210 void AliMUONData::AddRecTrack(const AliMUONTrack& track)
212 /// Add a MUON rectrack
214 TClonesArray &lrectracks = *fRecTracks;
215 new(lrectracks[fNrectracks++]) AliMUONTrack(track);
217 //_____________________________________________________________________________
218 void AliMUONData::AddRecTriggerTrack(const AliMUONTriggerTrack& triggertrack)
220 /// Add a MUON triggerrectrack
222 TClonesArray &lrectriggertracks = *fRecTriggerTracks;
223 new(lrectriggertracks[fNrectriggertracks++]) AliMUONTriggerTrack(triggertrack);
225 //____________________________________________________________________________
226 TClonesArray* AliMUONData::Digits(Int_t DetectionPlane) const
228 /// Getting List of Digits
231 return ( (TClonesArray*) fDigits->At(DetectionPlane) );
235 //____________________________________________________________________________
236 TClonesArray* AliMUONData::SDigits(Int_t DetectionPlane) const
238 /// Getting List of SDigits
241 return ( (TClonesArray*) fSDigits->At(DetectionPlane) );
245 //____________________________________________________________________________
246 Bool_t AliMUONData::IsRawClusterBranchesInTree()
248 /// Checking if there are RawCluster Branches In TreeR
251 AliError("No treeR in memory");
256 sprintf(branchname,"%sRawClusters1",GetName());
257 TBranch * branch = 0x0;
258 branch = TreeR()->GetBranch(branchname);
259 if (branch) return kTRUE;
263 //____________________________________________________________________________
264 Bool_t AliMUONData::IsDigitsBranchesInTree()
266 /// Checking if there are RawCluster Branches In TreeR
269 AliError("No treeD in memory");
274 sprintf(branchname,"%sDigits1",GetName());
275 TBranch * branch = 0x0;
276 branch = TreeD()->GetBranch(branchname);
277 if (branch) return kTRUE;
281 //____________________________________________________________________________
282 Bool_t AliMUONData::IsTriggerBranchesInTree()
284 /// Checking if there are Trigger Branches In TreeR
286 AliError("No treeR in memory");
291 sprintf(branchname,"%sLocalTrigger",GetName());
292 TBranch * branch = 0x0;
293 branch = TreeR()->GetBranch(branchname);
294 if (branch) return kTRUE;
298 //____________________________________________________________________________
299 Bool_t AliMUONData::IsTriggerBranchesInTreeD()
301 /// Checking if there are Trigger Branches In TreeR
303 AliError("No treeD in memory");
308 sprintf(branchname,"%sLocalTrigger",GetName());
309 TBranch * branch = 0x0;
310 branch = TreeD()->GetBranch(branchname);
311 if (branch) return kTRUE;
316 //____________________________________________________________________________
317 Bool_t AliMUONData::IsTrackBranchesInTree()
319 /// Checking if there are Track Branches In TreeT
321 AliError("No treeT in memory");
326 sprintf(branchname,"%sTrack",GetName());
327 TBranch * branch = 0x0;
328 branch = TreeT()->GetBranch(branchname);
329 if (branch) return kTRUE;
333 //____________________________________________________________________________
334 Bool_t AliMUONData::IsTriggerTrackBranchesInTree()
336 /// Checking if there are TriggerTrack Branches In TreeT
338 AliError("No treeT in memory");
343 sprintf(branchname,"%sTriggerTrack",GetName());
344 TBranch * branch = 0x0;
345 branch = TreeT()->GetBranch(branchname);
346 if (branch) return kTRUE;
350 //____________________________________________________________________________
351 void AliMUONData::Fill(Option_t* option)
353 /// Method to fill the trees
354 const char *cH = strstr(option,"H");
355 const char *cD = strstr(option,"D"); // Digits branches in TreeD
356 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
357 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
358 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
359 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
360 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
361 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
363 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
366 TBranch * branch = 0x0;
376 if ( TreeD() && cD && cGLT )
378 // Writing digits and (global+local) trigger at once.
385 if ( IsTriggerBranchesInTreeD() )
387 for (int i=0; i<AliMUONConstants::NCh(); i++)
389 sprintf(branchname,"%sDigits%d",GetName(),i+1);
390 branch = TreeD()->GetBranch(branchname);
400 if ( TreeD() && cGLT )
402 if ( IsDigitsBranchesInTree() )
404 sprintf(branchname,"%sLocalTrigger",GetName());
405 branch = TreeD()->GetBranch(branchname);
407 sprintf(branchname,"%sRegionalTrigger",GetName());
408 branch = TreeD()->GetBranch(branchname);
410 sprintf(branchname,"%sGlobalTrigger",GetName());
411 branch = TreeD()->GetBranch(branchname);
420 } // end of TreeD() handling.
430 if ( TreeR() && cRC && cTC )
436 if ( TreeR() && cRC )
438 if ( IsTriggerBranchesInTree() )
440 // Branch per branch filling
441 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++)
443 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
444 branch = TreeR()->GetBranch(branchname);
456 if (IsRawClusterBranchesInTree())
458 // Branch per branch filling
459 sprintf(branchname,"%sLocalTrigger",GetName());
460 branch = TreeR()->GetBranch(branchname);
462 sprintf(branchname,"%sRegionalTrigger",GetName());
463 branch = TreeR()->GetBranch(branchname);
465 sprintf(branchname,"%sGlobalTrigger",GetName());
466 branch = TreeR()->GetBranch(branchname);
478 if ( TreeT() && cRT && cRL )
484 if ( TreeT() && cRT )
486 if (IsTriggerTrackBranchesInTree())
488 sprintf(branchname,"%sTrack",GetName());
489 branch = TreeT()->GetBranch(branchname);
498 if ( TreeT() && cRL )
500 if (IsTrackBranchesInTree())
502 sprintf(branchname,"%sTriggerTrack",GetName());
503 branch = TreeT()->GetBranch(branchname);
514 //_____________________________________________________________________________
515 void AliMUONData::MakeBranch(Option_t* option)
517 /// Create Tree branches for the MUON.
519 const Int_t kBufferSize = 4000;
522 //Setting Data Container
523 SetDataContainer(option);
525 const char *cH = strstr(option,"H");
526 const char *cD = strstr(option,"D"); // Digits branches in TreeD
527 const char *cS = strstr(option,"S"); // Digits branches in TreeS
528 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
529 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
530 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
531 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
532 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
533 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
535 TBranch * branch = 0x0;
537 // Creating Branches for Hits
539 sprintf(branchname,"%sHits",GetName());
540 branch = TreeH()->GetBranch(branchname);
542 AliInfo(Form("MakeBranch","Branch %s is already in tree.",branchname));
545 branch = TreeH()->Branch(branchname,&fHits,kBufferSize);
546 //Info("MakeBranch","Making Branch %s for hits \n",branchname);
549 //Creating Branches for Digits
558 // one branch for digits per chamber
559 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++)
561 sprintf(branchname,"%sDigits%d",GetName(),iDetectionPlane+1);
562 branch = treeD->GetBranch(branchname);
565 AliInfo(Form("Branch %s is already in tree.",branchname));
568 TClonesArray * digits = Digits(iDetectionPlane);
569 branch = treeD->Branch(branchname, &digits, kBufferSize,1);
576 // one branch for global trigger
578 sprintf(branchname,"%sGlobalTrigger",GetName());
579 branch = treeD->GetBranch(branchname);
582 AliInfo(Form("Branch GlobalTrigger is already in treeD."));
585 branch = treeD->Branch(branchname, &fGlobalTrigger, kBufferSize);
588 // one branch for regional trigger
590 sprintf(branchname,"%sRegionalTrigger",GetName());
592 branch = treeD->GetBranch(branchname);
595 AliInfo(Form("Branch RegionalTrigger is already in treeD."));
598 branch = treeD->Branch(branchname, &fRegionalTrigger, kBufferSize);
602 // one branch for local trigger
604 sprintf(branchname,"%sLocalTrigger",GetName());
606 branch = treeD->GetBranch(branchname);
609 AliInfo(Form("Branch LocalTrigger is already in treeD."));
612 branch = treeD->Branch(branchname, &fLocalTrigger, kBufferSize);
615 //Creating Branches for SDigits
616 if (TreeS() && cS ) {
617 // one branch for Sdigits per chamber
618 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
619 sprintf(branchname,"%sSDigits%d",GetName(),iDetectionPlane+1);
621 branch = TreeS()->GetBranch(branchname);
623 AliInfo(Form("Branch %s is already in tree.",branchname));
626 TClonesArray * sdigits = SDigits(iDetectionPlane);
627 branch = TreeS()->Branch(branchname, &sdigits, kBufferSize,1);
628 //Info("MakeBranch","Making Branch %s for sdigits in detection plane %d\n",branchname,iDetectionPlane+1);
632 if (TreeR() && cRC ) {
633 // one branch for raw clusters per tracking detection plane
636 for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) {
637 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
639 branch = TreeR()->GetBranch(branchname);
641 AliInfo(Form("Branch %s is already in tree.",branchname));
644 branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize);
645 //Info("MakeBranch","Making Branch %s for rawcluster in detection plane %d\n",branchname,i+1);
649 if (TreeR() && cTC ) {
651 // one branch for global trigger
653 sprintf(branchname,"%sGlobalTrigger",GetName());
655 branch = TreeR()->GetBranch(branchname);
657 AliInfo(Form("Branch GlobalTrigger is already in treeR."));
660 branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize);
661 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
664 // one branch for regional trigger
666 sprintf(branchname,"%sRegionalTrigger",GetName());
668 branch = TreeR()->GetBranch(branchname);
670 AliInfo(Form("Branch RegionalTrigger is already in treeR."));
673 branch = TreeR()->Branch(branchname, &fRegionalTrigger, kBufferSize);
676 // one branch for local trigger
678 sprintf(branchname,"%sLocalTrigger",GetName());
680 branch = TreeR()->GetBranch(branchname);
682 AliInfo(Form("Branch LocalTrigger is already in treeR."));
685 branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize);
686 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
689 if (TreeT() && cRT ) {
690 sprintf(branchname,"%sTrack",GetName());
691 branch = TreeT()->GetBranch(branchname);
693 AliInfo(Form("Branch %s is already in tree.",GetName()));
696 branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize);
697 //Info("MakeBranch","Making Branch %s for tracks \n",branchname);
700 if (TreeT() && cRL ) {
701 sprintf(branchname,"%sTriggerTrack",GetName());
702 branch = TreeT()->GetBranch(branchname);
704 AliInfo(Form("Branch %s is already in tree.",GetName()));
707 branch = TreeT()->Branch(branchname,&fRecTriggerTracks,kBufferSize);
708 //Info("MakeBranch","Making Branch %s for trigger tracks \n",branchname);
711 //____________________________________________________________________________
712 TClonesArray* AliMUONData::RawClusters(Int_t DetectionPlane)
714 /// Getting Raw Clusters
717 return ( (TClonesArray*) fRawClusters->At(DetectionPlane) );
722 //____________________________________________________________________________
724 AliMUONData::LocalTrigger() const
726 /// Getting local trigger
728 return fLocalTrigger;
731 //____________________________________________________________________________
733 AliMUONData::RegionalTrigger() const
735 /// Getting regional trigger
737 return fRegionalTrigger;
740 //____________________________________________________________________________
742 AliMUONData::GetNtracks() const
744 /// Get number of entries in hits three
747 if (fLoader && fLoader->TreeH())
748 ntrk = (Int_t) fLoader->TreeH()->GetEntries();
752 //____________________________________________________________________________
754 AliMUONData::GetDigits() const
756 /// Load the digits from TreeD for the current event.
758 Int_t event = fLoader->GetRunLoader()->GetEventNumber();
759 if ( fCurrentEvent != event )
761 if (fLoader->TreeD()) {
762 fLoader->TreeD()->GetEvent(0);
763 fCurrentEvent = event;
768 //____________________________________________________________________________
770 AliMUONData::GlobalTrigger() const
772 /// Return the global trigger
774 return fGlobalTrigger;
777 //____________________________________________________________________________
778 void AliMUONData::ResetDigits()
780 /// Reset number of digits and the digits array for this detector
782 if (fDigits == 0x0) return;
783 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
784 if ((*fDigits)[i]) ((TClonesArray*)fDigits->At(i))->Clear("C");
785 if (fNdigits) fNdigits[i]=0;
788 //____________________________________________________________________________
789 void AliMUONData::ResetSDigits()
791 /// Reset number of Sdigits and the Sdigits array for this detector
793 if (fSDigits == 0x0) return;
794 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
795 if ((*fSDigits)[i]) ((TClonesArray*)fSDigits->At(i))->Clear();
796 if (fNSdigits) fNSdigits[i]=0;
799 //______________________________________________________________________________
800 void AliMUONData::ResetHits()
802 /// Reset number of clusters and the cluster array for this detector
805 if (fHits) fHits->Clear();
807 //_______________________________________________________________________________
808 void AliMUONData::ResetRawClusters()
810 /// Reset number of raw clusters and the raw clust array for this detector
812 for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) {
813 if ((*fRawClusters)[i]) ((TClonesArray*)fRawClusters->At(i))->Clear();
814 if (fNrawclusters) fNrawclusters[i]=0;
817 //_______________________________________________________________________________
818 void AliMUONData::ResetTrigger()
820 /// Reset Local and Global Trigger
823 if (fGlobalTrigger) fGlobalTrigger->Clear();
824 fNregionaltrigger = 0;
825 if (fRegionalTrigger) fRegionalTrigger->Clear();
827 if (fLocalTrigger) fLocalTrigger->Clear();
830 //____________________________________________________________________________
831 void AliMUONData::ResetRecTracks()
833 /// Reset tracks information
836 if (fRecTracks) fRecTracks->Delete(); // necessary to delete in case of memory allocation
838 //____________________________________________________________________________
839 void AliMUONData::ResetRecTriggerTracks()
841 /// Reset tracks information
843 fNrectriggertracks = 0;
844 if (fRecTriggerTracks) fRecTriggerTracks->Delete(); // necessary to delete in case of memory allocation
846 //____________________________________________________________________________
847 void AliMUONData::SetDataContainer(Option_t* option)
849 /// Setting data containers of muon data
850 const char *cH = strstr(option,"H");
851 const char *cD = strstr(option,"D"); // Digits
852 const char *cS = strstr(option,"S"); // SDigits
853 const char *cRC = strstr(option,"RC"); // RawCluster
854 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger
855 const char *cTC = strstr(option,"TC"); // global and local Trigger
856 const char *cRT = strstr(option,"RT"); // Reconstructed Tracks
857 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Tracks
858 //const char *cRP = strstr(option,"RP"); // Reconstructed Particles
859 AliDebug(1,Form("option=%s",option));
861 // Clones array for hits
864 fHits = new TClonesArray("AliMUONHit",1000);
870 // ObjArray of ClonesArrays for Digits
872 if (fDigits == 0x0 ) {
873 fDigits = new TObjArray(AliMUONConstants::NCh());
874 fNdigits= new Int_t[AliMUONConstants::NCh()];
875 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
876 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
878 fDigits->AddAt(tca,i);
883 AliDebug(1,Form("fDigits already there = %p",fSDigits));
889 // ClonesArrays for Trigger
891 if (fLocalTrigger == 0x0) {
892 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
894 if (fRegionalTrigger == 0x0) {
895 fRegionalTrigger = new TClonesArray("AliMUONRegionalTrigger",16);
897 if (fGlobalTrigger== 0x0) {
898 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
904 // Container for Sdigits
906 if (fSDigits == 0x0) {
907 AliDebug(1,"Creating fSDigits TObjArray");
908 fSDigits = new TObjArray(AliMUONConstants::NCh());
909 fNSdigits= new Int_t[AliMUONConstants::NCh()];
910 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
911 TClonesArray* a = new TClonesArray("AliMUONDigit",10000);
913 fSDigits->AddAt(a,i);
914 AliDebug(1,Form("fSDigits[%d]=%p",i,a));
919 AliDebug(1,Form("fSDigits already there = %p",fSDigits));
925 // Containers for rawclusters, globaltrigger and local trigger tree
927 if (fRawClusters == 0x0) {
928 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
929 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
930 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
931 TClonesArray* tca = new TClonesArray("AliMUONRawCluster",10000);
933 fRawClusters->AddAt(tca,i);
940 if (fLocalTrigger == 0x0) {
941 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
943 if (fRegionalTrigger == 0x0) {
944 fRegionalTrigger = new TClonesArray("AliMUONRegionalTrigger",16);
946 if (fGlobalTrigger== 0x0) {
947 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
949 // ResetTrigger(); This is not necessary here since trigger info ins copied from digits info on flight to RecPoint output
953 // Containers for rectracks and rectrigger tracks
955 if (fRecTracks == 0x0) {
956 fRecTracks = new TClonesArray("AliMUONTrack",100);
961 if (fRecTriggerTracks == 0x0 && cRL) {
962 fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
964 ResetRecTriggerTracks();
968 //____________________________________________________________________________
969 void AliMUONData::SetTreeAddress(Option_t* option)
971 // Setting Data containers
972 SetDataContainer(option);
974 /// Setting Addresses to the events trees
976 const char *cH = strstr(option,"H");
977 const char *cD = strstr(option,"D"); // Digits branches in TreeD
978 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
979 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
980 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
981 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
982 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
983 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
984 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
986 // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree.
988 TBranch * branch = 0x0;
990 AliDebug(1,Form("option=%s",option));
992 // Branch address for hit tree
993 if (TreeH() && fHits && cH) {
994 sprintf(branchname,"%sHits",GetName());
995 branch = TreeH()->GetBranch(branchname);
997 // Info("SetTreeAddress","(%s) Setting for Hits",GetName());
998 branch->SetAddress(&fHits);
1000 else { //can be invoked before branch creation
1001 //AliWarning(Form("(%s) Failed for Hits. Can not find branch in tree.",GetName()));
1006 // Branch address for digit tree
1007 if (TreeD() && fDigits && cD) {
1008 for (int i=0; i<AliMUONConstants::NCh(); i++) {
1009 sprintf(branchname,"%sDigits%d",GetName(),i+1);
1011 branch = TreeD()->GetBranch(branchname);
1012 TClonesArray * digits = Digits(i);
1014 branch->SetAddress( &digits );
1016 else AliWarning(Form("(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i));
1020 if ( TreeD() && fLocalTrigger && cGLT) {
1021 sprintf(branchname,"%sLocalTrigger",GetName());
1022 branch = TreeD()->GetBranch(branchname);
1023 if (branch) branch->SetAddress(&fLocalTrigger);
1024 else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeD.",GetName()));
1026 if ( TreeD() && fRegionalTrigger && cGLT) {
1027 sprintf(branchname,"%sRegionalTrigger",GetName());
1028 branch = TreeD()->GetBranch(branchname);
1029 if (branch) branch->SetAddress(&fRegionalTrigger);
1030 else AliWarning(Form("(%s) Failed for RegionalTrigger. Can not find branch in treeD.",GetName()));
1032 if ( TreeD() && fGlobalTrigger && cGLT) {
1033 sprintf(branchname,"%sGlobalTrigger",GetName());
1034 branch = TreeD()->GetBranch(branchname);
1035 if (branch) branch->SetAddress(&fGlobalTrigger);
1036 else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeD.",GetName()));
1040 // Branch address for Sdigit tree
1041 if (TreeS() && fSDigits && cS) {
1042 AliDebug(1,"Setting branch addresses");
1043 for (int i=0; i<AliMUONConstants::NCh(); i++) {
1044 sprintf(branchname,"%sSDigits%d",GetName(),i+1);
1046 AliDebug(1,Form("TreeS=%p for ich=%d branchname=%s",
1047 TreeS(),i,branchname));
1048 branch = TreeS()->GetBranch(branchname);
1049 TClonesArray * sdigits = SDigits(i);
1050 if (branch) branch->SetAddress( &sdigits );
1051 else AliWarning(Form("(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i));
1057 // Branch address for rawclusters, globaltrigger and local trigger tree
1058 if ( TreeR() && fRawClusters && cRC && !strstr(cRC,"RCC")) {
1059 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
1060 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
1062 branch = TreeR()->GetBranch(branchname);
1063 if (branch) branch->SetAddress( &((*fRawClusters)[i]) );
1064 else AliWarning(Form("(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i));
1068 if ( TreeR() && fLocalTrigger && cTC) {
1069 sprintf(branchname,"%sLocalTrigger",GetName());
1070 branch = TreeR()->GetBranch(branchname);
1071 if (branch) branch->SetAddress(&fLocalTrigger);
1072 else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeR.",GetName()));
1074 if ( TreeR() && fRegionalTrigger && cTC) {
1075 sprintf(branchname,"%sRegionalTrigger",GetName());
1076 branch = TreeR()->GetBranch(branchname);
1077 if (branch) branch->SetAddress(&fRegionalTrigger);
1078 else AliWarning(Form("(%s) Failed for RegionalTrigger. Can not find branch in treeR.",GetName()));
1080 if ( TreeR() && fGlobalTrigger && cTC) {
1081 sprintf(branchname,"%sGlobalTrigger",GetName());
1082 branch = TreeR()->GetBranch(branchname);
1083 if (branch) branch->SetAddress(&fGlobalTrigger);
1084 else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeR.",GetName()));
1088 if ( TreeT() && fRecTracks && cRT ) {
1089 sprintf(branchname,"%sTrack",GetName());
1090 branch = TreeT()->GetBranch(branchname);
1091 if (branch) branch->SetAddress(&fRecTracks);
1092 else AliWarning(Form("(%s) Failed for Tracks. Can not find branch in tree.",GetName()));
1095 if ( TreeT() && fRecTriggerTracks && cRL ) {
1096 sprintf(branchname,"%sTriggerTrack",GetName());
1097 branch = TreeT()->GetBranch(branchname);
1098 if (branch) branch->SetAddress(&fRecTriggerTracks);
1099 else AliWarning(Form("(%s) Failed for Trigger Tracks. Can not find branch in tree.",GetName()));
1103 //_____________________________________________________________________________
1105 AliMUONData::Print(Option_t* opt) const
1107 /// Dump object on screen
1109 TString options(opt);
1112 if ( options.Contains("D") )
1114 for ( Int_t ich = 0; ich < AliMUONConstants::NCh(); ++ich)
1116 TClonesArray* digits = Digits(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));
1127 if ( options.Contains("S") )
1129 for ( Int_t ich = 0; ich < AliMUONConstants::NCh(); ++ich)
1131 TClonesArray* digits = SDigits(ich);
1132 Int_t ndigits = digits->GetEntriesFast();
1133 for ( Int_t id = 0; id < ndigits; ++id )
1135 AliMUONDigit* digit =
1136 static_cast<AliMUONDigit*>(digits->UncheckedAt(id));