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;
523 const char *cH = strstr(option,"H");
524 const char *cD = strstr(option,"D"); // Digits branches in TreeD
525 const char *cS = strstr(option,"S"); // Digits branches in TreeS
526 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
527 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
528 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
529 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
530 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
531 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
533 TBranch * branch = 0x0;
535 // Creating Branches for Hits
539 fHits = new TClonesArray("AliMUONHit",1000);
540 // if (gAlice->GetMCApp())
541 // gAlice->GetMCApp()->AddHitList (fHits);
545 sprintf(branchname,"%sHits",GetName());
546 branch = TreeH()->GetBranch(branchname);
548 AliInfo(Form("MakeBranch","Branch %s is already in tree.",branchname));
551 branch = TreeH()->Branch(branchname,&fHits,kBufferSize);
552 //Info("MakeBranch","Making Branch %s for hits \n",branchname);
555 //Creating Branches for Digits
564 // one branch for digits per chamber
567 fDigits = new TObjArray(AliMUONConstants::NCh());
568 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++)
570 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
572 fDigits->AddAt(tca,iDetectionPlane);
577 fNdigits = new Int_t[AliMUONConstants::NCh()];
578 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++)
580 fNdigits[iDetectionPlane]=0;
583 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++)
585 sprintf(branchname,"%sDigits%d",GetName(),iDetectionPlane+1);
586 branch = treeD->GetBranch(branchname);
589 AliInfo(Form("Branch %s is already in tree.",branchname));
592 TClonesArray * digits = Digits(iDetectionPlane);
593 branch = treeD->Branch(branchname, &digits, kBufferSize,1);
600 // one branch for global trigger
602 sprintf(branchname,"%sGlobalTrigger",GetName());
604 if (fGlobalTrigger == 0x0)
606 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger");
609 branch = treeD->GetBranch(branchname);
612 AliInfo(Form("Branch GlobalTrigger is already in treeD."));
615 branch = treeD->Branch(branchname, &fGlobalTrigger, kBufferSize);
618 // one branch for regional trigger
620 sprintf(branchname,"%sRegionalTrigger",GetName());
623 if (fRegionalTrigger == 0x0)
625 fRegionalTrigger = new TClonesArray("AliMUONRegionalTrigger",16);
626 fNregionaltrigger = 0;
628 branch = treeD->GetBranch(branchname);
631 AliInfo(Form("Branch RegionalTrigger is already in treeD."));
634 branch = treeD->Branch(branchname, &fRegionalTrigger, kBufferSize);
638 // one branch for local trigger
640 sprintf(branchname,"%sLocalTrigger",GetName());
643 if (fLocalTrigger == 0x0)
645 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
648 branch = treeD->GetBranch(branchname);
651 AliInfo(Form("Branch LocalTrigger is already in treeD."));
654 branch = treeD->Branch(branchname, &fLocalTrigger, kBufferSize);
657 //Creating Branches for SDigits
658 if (TreeS() && cS ) {
659 // one branch for Sdigits per chamber
660 if (fSDigits == 0x0) {
661 fSDigits = new TObjArray(AliMUONConstants::NCh());
662 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
663 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
665 fSDigits->AddAt(tca,iDetectionPlane);
668 if (fNSdigits == 0x0) {
669 fNSdigits = new Int_t[AliMUONConstants::NCh()];
670 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
671 fNSdigits[iDetectionPlane]=0;
674 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
675 sprintf(branchname,"%sSDigits%d",GetName(),iDetectionPlane+1);
677 branch = TreeS()->GetBranch(branchname);
679 AliInfo(Form("Branch %s is already in tree.",branchname));
682 TClonesArray * sdigits = SDigits(iDetectionPlane);
683 branch = TreeS()->Branch(branchname, &sdigits, kBufferSize,1);
684 //Info("MakeBranch","Making Branch %s for sdigits in detection plane %d\n",branchname,iDetectionPlane+1);
688 if (TreeR() && cRC ) {
689 // one branch for raw clusters per tracking detection plane
692 if (fRawClusters == 0x0) {
693 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
694 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
695 TClonesArray * tca = new TClonesArray("AliMUONRawCluster",1000);
697 fRawClusters->AddAt(tca,i);
701 if (fNrawclusters == 0x0) {
702 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
703 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
708 for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) {
709 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
711 branch = TreeR()->GetBranch(branchname);
713 AliInfo(Form("Branch %s is already in tree.",branchname));
716 branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize);
717 //Info("MakeBranch","Making Branch %s for rawcluster in detection plane %d\n",branchname,i+1);
721 if (TreeR() && cTC ) {
723 // one branch for global trigger
725 sprintf(branchname,"%sGlobalTrigger",GetName());
728 if (fGlobalTrigger == 0x0) {
729 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger");
732 branch = TreeR()->GetBranch(branchname);
734 AliInfo(Form("Branch GlobalTrigger is already in treeR."));
737 branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize);
738 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
741 // one branch for regional trigger
743 sprintf(branchname,"%sRegionalTrigger",GetName());
746 if (fRegionalTrigger == 0x0) {
747 fRegionalTrigger = new TClonesArray("AliMUONRegionalTrigger",16);
748 fNregionaltrigger = 0;
750 branch = TreeR()->GetBranch(branchname);
752 AliInfo(Form("Branch RegionalTrigger is already in treeR."));
755 branch = TreeR()->Branch(branchname, &fRegionalTrigger, kBufferSize);
758 // one branch for local trigger
760 sprintf(branchname,"%sLocalTrigger",GetName());
763 if (fLocalTrigger == 0x0) {
764 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
767 branch = TreeR()->GetBranch(branchname);
769 AliInfo(Form("Branch LocalTrigger is already in treeR."));
772 branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize);
773 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
776 if (TreeT() && cRT ) {
777 if (fRecTracks == 0x0) fRecTracks = new TClonesArray("AliMUONTrack",100);
779 sprintf(branchname,"%sTrack",GetName());
780 branch = TreeT()->GetBranch(branchname);
782 AliInfo(Form("Branch %s is already in tree.",GetName()));
785 branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize);
786 //Info("MakeBranch","Making Branch %s for tracks \n",branchname);
789 if (TreeT() && cRL ) {
790 if (fRecTriggerTracks == 0x0) fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
791 fNrectriggertracks = 0;
792 sprintf(branchname,"%sTriggerTrack",GetName());
793 branch = TreeT()->GetBranch(branchname);
795 AliInfo(Form("Branch %s is already in tree.",GetName()));
798 branch = TreeT()->Branch(branchname,&fRecTriggerTracks,kBufferSize);
799 //Info("MakeBranch","Making Branch %s for trigger tracks \n",branchname);
802 //____________________________________________________________________________
803 TClonesArray* AliMUONData::RawClusters(Int_t DetectionPlane)
805 /// Getting Raw Clusters
808 return ( (TClonesArray*) fRawClusters->At(DetectionPlane) );
813 //____________________________________________________________________________
815 AliMUONData::LocalTrigger() const
817 /// Getting local trigger
819 return fLocalTrigger;
822 //____________________________________________________________________________
824 AliMUONData::RegionalTrigger() const
826 /// Getting regional trigger
828 return fRegionalTrigger;
831 //____________________________________________________________________________
833 AliMUONData::GetNtracks() const
835 /// Get number of entries in hits three
838 if (fLoader && fLoader->TreeH())
839 ntrk = (Int_t) fLoader->TreeH()->GetEntries();
843 //____________________________________________________________________________
845 AliMUONData::GetDigits() const
847 /// Load the digits from TreeD for the current event.
849 Int_t event = fLoader->GetRunLoader()->GetEventNumber();
850 if ( fCurrentEvent != event )
852 if (fLoader->TreeD()) {
853 fLoader->TreeD()->GetEvent(0);
854 fCurrentEvent = event;
859 //____________________________________________________________________________
861 AliMUONData::GlobalTrigger() const
863 /// Return the global trigger
865 return fGlobalTrigger;
868 //____________________________________________________________________________
869 void AliMUONData::ResetDigits()
871 /// Reset number of digits and the digits array for this detector
873 if (fDigits == 0x0) return;
874 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
875 if ((*fDigits)[i]) ((TClonesArray*)fDigits->At(i))->Clear("C");
876 if (fNdigits) fNdigits[i]=0;
879 //____________________________________________________________________________
880 void AliMUONData::ResetSDigits()
882 /// Reset number of Sdigits and the Sdigits array for this detector
884 if (fSDigits == 0x0) return;
885 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
886 if ((*fSDigits)[i]) ((TClonesArray*)fSDigits->At(i))->Clear();
887 if (fNSdigits) fNSdigits[i]=0;
890 //______________________________________________________________________________
891 void AliMUONData::ResetHits()
893 /// Reset number of clusters and the cluster array for this detector
896 if (fHits) fHits->Clear();
898 //_______________________________________________________________________________
899 void AliMUONData::ResetRawClusters()
901 /// Reset number of raw clusters and the raw clust array for this detector
903 for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) {
904 if ((*fRawClusters)[i]) ((TClonesArray*)fRawClusters->At(i))->Clear();
905 if (fNrawclusters) fNrawclusters[i]=0;
908 //_______________________________________________________________________________
909 void AliMUONData::ResetTrigger()
911 /// Reset Local and Global Trigger
914 if (fGlobalTrigger) fGlobalTrigger->Clear();
915 fNregionaltrigger = 0;
916 if (fRegionalTrigger) fRegionalTrigger->Clear();
918 if (fLocalTrigger) fLocalTrigger->Clear();
921 //____________________________________________________________________________
922 void AliMUONData::ResetRecTracks()
924 /// Reset tracks information
927 if (fRecTracks) fRecTracks->Delete(); // necessary to delete in case of memory allocation
929 //____________________________________________________________________________
930 void AliMUONData::ResetRecTriggerTracks()
932 /// Reset tracks information
934 fNrectriggertracks = 0;
935 if (fRecTriggerTracks) fRecTriggerTracks->Delete(); // necessary to delete in case of memory allocation
937 //_____________________________________________________________________________
938 void AliMUONData::SetTreeAddress(Option_t* option)
940 /// Setting Addresses to the events trees
942 const char *cH = strstr(option,"H");
943 const char *cD = strstr(option,"D"); // Digits branches in TreeD
944 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
945 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
946 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
947 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
948 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
949 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
950 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
952 // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree.
954 TBranch * branch = 0x0;
956 AliDebug(1,Form("option=%s",option));
958 // Branch address for hit tree
959 if ( TreeH() && cH ) {
961 fHits = new TClonesArray("AliMUONHit",1000);
962 // if (gAlice->GetMCApp())
963 // gAlice->GetMCApp()->AddHitList (fHits); Moved to AliMUON
967 if (TreeH() && fHits && cH) {
968 sprintf(branchname,"%sHits",GetName());
969 branch = TreeH()->GetBranch(branchname);
971 // Info("SetTreeAddress","(%s) Setting for Hits",GetName());
972 branch->SetAddress(&fHits);
974 else { //can be invoked before branch creation
975 //AliWarning(Form("(%s) Failed for Hits. Can not find branch in tree.",GetName()));
980 // Branch address for digit tree
982 if (fDigits == 0x0 && cD) {
983 fDigits = new TObjArray(AliMUONConstants::NCh());
984 fNdigits= new Int_t[AliMUONConstants::NCh()];
985 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
986 fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i);
990 if (fLocalTrigger == 0x0 && cGLT) {
991 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
993 if (fRegionalTrigger == 0x0 && cGLT) {
994 fRegionalTrigger = new TClonesArray("AliMUONRegionalTrigger",16);
996 if (fGlobalTrigger== 0x0 && cGLT) {
997 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
1001 if (TreeD() && fDigits && cD) {
1002 for (int i=0; i<AliMUONConstants::NCh(); i++) {
1003 sprintf(branchname,"%sDigits%d",GetName(),i+1);
1005 branch = TreeD()->GetBranch(branchname);
1006 TClonesArray * digits = Digits(i);
1008 branch->SetAddress( &digits );
1010 else AliWarning(Form("(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i));
1014 if ( TreeD() && fLocalTrigger && cGLT) {
1015 sprintf(branchname,"%sLocalTrigger",GetName());
1016 branch = TreeD()->GetBranch(branchname);
1017 if (branch) branch->SetAddress(&fLocalTrigger);
1018 else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeD.",GetName()));
1020 if ( TreeD() && fRegionalTrigger && cGLT) {
1021 sprintf(branchname,"%sRegionalTrigger",GetName());
1022 branch = TreeD()->GetBranch(branchname);
1023 if (branch) branch->SetAddress(&fRegionalTrigger);
1024 else AliWarning(Form("(%s) Failed for RegionalTrigger. Can not find branch in treeD.",GetName()));
1026 if ( TreeD() && fGlobalTrigger && cGLT) {
1027 sprintf(branchname,"%sGlobalTrigger",GetName());
1028 branch = TreeD()->GetBranch(branchname);
1029 if (branch) branch->SetAddress(&fGlobalTrigger);
1030 else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeD.",GetName()));
1034 // Branch address for Sdigit tree
1037 if (fSDigits == 0x0)
1039 AliDebug(1,"Creating fSDigits TObjArray");
1040 fSDigits = new TObjArray(AliMUONConstants::NCh());
1041 fNSdigits= new Int_t[AliMUONConstants::NCh()];
1042 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++)
1044 TClonesArray* a = new TClonesArray("AliMUONDigit",10000);
1045 fSDigits->AddAt(a,i);
1046 AliDebug(1,Form("fSDigits[%d]=%p",i,a));
1052 AliDebug(1,Form("fSDigits already there = %p",fSDigits));
1056 if (TreeS() && fSDigits && cS) {
1057 AliDebug(1,"Setting branch addresses");
1058 for (int i=0; i<AliMUONConstants::NCh(); i++) {
1059 sprintf(branchname,"%sSDigits%d",GetName(),i+1);
1061 AliDebug(1,Form("TreeS=%p for ich=%d branchname=%s",
1062 TreeS(),i,branchname));
1063 branch = TreeS()->GetBranch(branchname);
1064 TClonesArray * sdigits = SDigits(i);
1065 if (branch) branch->SetAddress( &sdigits );
1066 else AliWarning(Form("(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i));
1072 // Branch address for rawclusters, globaltrigger and local trigger tree
1074 if (fRawClusters == 0x0 && cRC) {
1075 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
1076 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
1077 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
1078 fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i);
1082 if (fLocalTrigger == 0x0 && cTC) {
1083 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
1085 if (fRegionalTrigger == 0x0 && cTC) {
1086 fRegionalTrigger = new TClonesArray("AliMUONRegionalTrigger",16);
1088 if (fGlobalTrigger== 0x0 && cTC) {
1089 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
1093 if ( TreeR() && fRawClusters && cRC && !strstr(cRC,"RCC")) {
1094 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
1095 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
1097 branch = TreeR()->GetBranch(branchname);
1098 if (branch) branch->SetAddress( &((*fRawClusters)[i]) );
1099 else AliWarning(Form("(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i));
1103 if ( TreeR() && fLocalTrigger && cTC) {
1104 sprintf(branchname,"%sLocalTrigger",GetName());
1105 branch = TreeR()->GetBranch(branchname);
1106 if (branch) branch->SetAddress(&fLocalTrigger);
1107 else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeR.",GetName()));
1110 if ( TreeR() && fRegionalTrigger && cTC) {
1111 sprintf(branchname,"%sRegionalTrigger",GetName());
1112 branch = TreeR()->GetBranch(branchname);
1113 if (branch) branch->SetAddress(&fRegionalTrigger);
1114 else AliWarning(Form("(%s) Failed for RegionalTrigger. Can not find branch in treeR.",GetName()));
1117 if ( TreeR() && fGlobalTrigger && cTC) {
1118 sprintf(branchname,"%sGlobalTrigger",GetName());
1119 branch = TreeR()->GetBranch(branchname);
1120 if (branch) branch->SetAddress(&fGlobalTrigger);
1121 else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeR.",GetName()));
1125 if (fRecTracks == 0x0 && cRT) {
1126 fRecTracks = new TClonesArray("AliMUONTrack",100);
1130 if ( TreeT() && fRecTracks && cRT ) {
1131 sprintf(branchname,"%sTrack",GetName());
1132 branch = TreeT()->GetBranch(branchname);
1133 if (branch) branch->SetAddress(&fRecTracks);
1134 else AliWarning(Form("(%s) Failed for Tracks. Can not find branch in tree.",GetName()));
1138 if (fRecTriggerTracks == 0x0 && cRL) {
1139 fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
1143 if ( TreeT() && fRecTriggerTracks && cRL ) {
1144 sprintf(branchname,"%sTriggerTrack",GetName());
1145 branch = TreeT()->GetBranch(branchname);
1146 if (branch) branch->SetAddress(&fRecTriggerTracks);
1147 else AliWarning(Form("(%s) Failed for Trigger Tracks. Can not find branch in tree.",GetName()));
1153 //_____________________________________________________________________________
1155 AliMUONData::Print(Option_t* opt) const
1157 /// Dump object on screen
1159 TString options(opt);
1162 if ( options.Contains("D") )
1164 for ( Int_t ich = 0; ich < AliMUONConstants::NCh(); ++ich)
1166 TClonesArray* digits = Digits(ich);
1167 Int_t ndigits = digits->GetEntriesFast();
1168 for ( Int_t id = 0; id < ndigits; ++id )
1170 AliMUONDigit* digit =
1171 static_cast<AliMUONDigit*>(digits->UncheckedAt(id));
1177 if ( options.Contains("S") )
1179 for ( Int_t ich = 0; ich < AliMUONConstants::NCh(); ++ich)
1181 TClonesArray* digits = SDigits(ich);
1182 Int_t ndigits = digits->GetEntriesFast();
1183 for ( Int_t id = 0; id < ndigits; ++id )
1185 AliMUONDigit* digit =
1186 static_cast<AliMUONDigit*>(digits->UncheckedAt(id));