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 iChamber,
145 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
146 Float_t tof, Float_t momentum, Float_t theta,
147 Float_t phi, Float_t length, Float_t destep,
148 Float_t Xref,Float_t Yref,Float_t Zref)
150 /// Add new hit to the hit list
152 TClonesArray &lhits = *fHits;
153 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber,
155 tof, momentum, theta,
159 //____________________________________________________________________________
160 void AliMUONData::AddHit2(Int_t fIshunt, Int_t track, Int_t detElemId,
161 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
162 Float_t tof, Float_t momentum, Float_t theta,
163 Float_t phi, Float_t length, Float_t destep,
164 Float_t Xref,Float_t Yref,Float_t Zref)
166 // Add new hit to the hit list
168 TClonesArray &lhits = *fHits;
169 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, detElemId,
171 tof, momentum, theta,
173 Xref,Yref,Zref, true);
175 //_____________________________________________________________________________
176 void AliMUONData::AddDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
178 /// Add a MUON digit to the list of Digits of the detection plane id
180 TClonesArray &ldigits = * Digits(id) ;
181 new(ldigits[fNdigits[id]++]) AliMUONDigit(tracks,charges,digits);
183 //_____________________________________________________________________________
184 void AliMUONData::AddDigit(Int_t id, const AliMUONDigit& digit)
186 /// Add a MUON digit to the list of Digits of the detection plane id
188 TClonesArray &ldigits = * Digits(id) ;
189 new(ldigits[fNdigits[id]++]) AliMUONDigit(digit);
191 //_____________________________________________________________________________
192 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)
202 /// Add a MUON Sdigit to the list of SDigits of the detection plane id
204 TClonesArray &lSdigits = * SDigits(id) ;
205 new(lSdigits[fNSdigits[id]++]) AliMUONDigit(Sdigit);
208 //_____________________________________________________________________________
209 void AliMUONData::AddGlobalTrigger(const AliMUONGlobalTrigger& trigger )
211 /// Add a MUON Global Trigger to the list (only one GlobalTrigger per event !);
213 TClonesArray &globalTrigger = *fGlobalTrigger;
214 new(globalTrigger[fNglobaltrigger++]) AliMUONGlobalTrigger(trigger);
217 //____________________________________________________________________________
218 void AliMUONData::AddRegionalTrigger(const AliMUONRegionalTrigger& trigger)
220 /// add a MUON regional Trigger to the list
221 TClonesArray ®ionalTrigger = *fRegionalTrigger;
222 new(regionalTrigger[fNregionaltrigger++]) AliMUONRegionalTrigger(trigger);
224 //____________________________________________________________________________
225 void AliMUONData::AddLocalTrigger(const AliMUONLocalTrigger& trigger)
227 /// add a MUON Local Trigger to the list
229 TClonesArray &localTrigger = *fLocalTrigger;
230 new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(trigger);
233 //_____________________________________________________________________________
234 void AliMUONData::AddRawCluster(Int_t id, const AliMUONRawCluster& c)
236 /// Add a MUON rawcluster to the list in the detection plane id
238 TClonesArray &lrawcl = *((TClonesArray*) fRawClusters->At(id));
239 new(lrawcl[fNrawclusters[id]++]) AliMUONRawCluster(c);
241 //_____________________________________________________________________________
242 void AliMUONData::AddRecTrack(const AliMUONTrack& track)
244 /// Add a MUON rectrack
246 TClonesArray &lrectracks = *fRecTracks;
247 new(lrectracks[fNrectracks++]) AliMUONTrack(track);
249 //_____________________________________________________________________________
250 void AliMUONData::AddRecTriggerTrack(const AliMUONTriggerTrack& triggertrack)
252 /// Add a MUON triggerrectrack
254 TClonesArray &lrectriggertracks = *fRecTriggerTracks;
255 new(lrectriggertracks[fNrectriggertracks++]) AliMUONTriggerTrack(triggertrack);
257 //____________________________________________________________________________
258 TClonesArray* AliMUONData::Digits(Int_t DetectionPlane) const
260 /// Getting List of Digits
263 return ( (TClonesArray*) fDigits->At(DetectionPlane) );
267 //____________________________________________________________________________
268 TClonesArray* AliMUONData::SDigits(Int_t DetectionPlane) const
270 /// Getting List of SDigits
273 return ( (TClonesArray*) fSDigits->At(DetectionPlane) );
277 //____________________________________________________________________________
278 Bool_t AliMUONData::IsRawClusterBranchesInTree()
280 /// Checking if there are RawCluster Branches In TreeR
283 AliError("No treeR in memory");
288 sprintf(branchname,"%sRawClusters1",GetName());
289 TBranch * branch = 0x0;
290 branch = TreeR()->GetBranch(branchname);
291 if (branch) return kTRUE;
295 //____________________________________________________________________________
296 Bool_t AliMUONData::IsDigitsBranchesInTree()
298 /// Checking if there are RawCluster Branches In TreeR
301 AliError("No treeD in memory");
306 sprintf(branchname,"%sDigits1",GetName());
307 TBranch * branch = 0x0;
308 branch = TreeD()->GetBranch(branchname);
309 if (branch) return kTRUE;
313 //____________________________________________________________________________
314 Bool_t AliMUONData::IsTriggerBranchesInTree()
316 /// Checking if there are Trigger Branches In TreeR
318 AliError("No treeR in memory");
323 sprintf(branchname,"%sLocalTrigger",GetName());
324 TBranch * branch = 0x0;
325 branch = TreeR()->GetBranch(branchname);
326 if (branch) return kTRUE;
330 //____________________________________________________________________________
331 Bool_t AliMUONData::IsTriggerBranchesInTreeD()
333 /// Checking if there are Trigger Branches In TreeR
335 AliError("No treeD in memory");
340 sprintf(branchname,"%sLocalTrigger",GetName());
341 TBranch * branch = 0x0;
342 branch = TreeD()->GetBranch(branchname);
343 if (branch) return kTRUE;
348 //____________________________________________________________________________
349 Bool_t AliMUONData::IsTrackBranchesInTree()
351 /// Checking if there are Track Branches In TreeT
353 AliError("No treeT in memory");
358 sprintf(branchname,"%sTrack",GetName());
359 TBranch * branch = 0x0;
360 branch = TreeT()->GetBranch(branchname);
361 if (branch) return kTRUE;
365 //____________________________________________________________________________
366 Bool_t AliMUONData::IsTriggerTrackBranchesInTree()
368 /// Checking if there are TriggerTrack Branches In TreeT
370 AliError("No treeT in memory");
375 sprintf(branchname,"%sTriggerTrack",GetName());
376 TBranch * branch = 0x0;
377 branch = TreeT()->GetBranch(branchname);
378 if (branch) return kTRUE;
382 //____________________________________________________________________________
383 void AliMUONData::Fill(Option_t* option)
385 /// Method to fill the trees
386 const char *cH = strstr(option,"H");
387 const char *cD = strstr(option,"D"); // Digits branches in TreeD
388 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
389 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
390 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
391 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
392 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
393 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
395 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
398 TBranch * branch = 0x0;
408 if ( TreeD() && cD && cGLT )
410 // Writing digits and (global+local) trigger at once.
417 if ( IsTriggerBranchesInTreeD() )
419 for (int i=0; i<AliMUONConstants::NCh(); i++)
421 sprintf(branchname,"%sDigits%d",GetName(),i+1);
422 branch = TreeD()->GetBranch(branchname);
432 if ( TreeD() && cGLT )
434 if ( IsDigitsBranchesInTree() )
436 sprintf(branchname,"%sLocalTrigger",GetName());
437 branch = TreeD()->GetBranch(branchname);
439 sprintf(branchname,"%sRegionalTrigger",GetName());
440 branch = TreeD()->GetBranch(branchname);
442 sprintf(branchname,"%sGlobalTrigger",GetName());
443 branch = TreeD()->GetBranch(branchname);
452 } // end of TreeD() handling.
462 if ( TreeR() && cRC && cTC )
468 if ( TreeR() && cRC )
470 if ( IsTriggerBranchesInTree() )
472 // Branch per branch filling
473 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++)
475 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
476 branch = TreeR()->GetBranch(branchname);
488 if (IsRawClusterBranchesInTree())
490 // Branch per branch filling
491 sprintf(branchname,"%sLocalTrigger",GetName());
492 branch = TreeR()->GetBranch(branchname);
494 sprintf(branchname,"%sRegionalTrigger",GetName());
495 branch = TreeR()->GetBranch(branchname);
497 sprintf(branchname,"%sGlobalTrigger",GetName());
498 branch = TreeR()->GetBranch(branchname);
510 if ( TreeT() && cRT && cRL )
516 if ( TreeT() && cRT )
518 if (IsTriggerTrackBranchesInTree())
520 sprintf(branchname,"%sTrack",GetName());
521 branch = TreeT()->GetBranch(branchname);
530 if ( TreeT() && cRL )
532 if (IsTrackBranchesInTree())
534 sprintf(branchname,"%sTriggerTrack",GetName());
535 branch = TreeT()->GetBranch(branchname);
546 //_____________________________________________________________________________
547 void AliMUONData::MakeBranch(Option_t* option)
549 /// Create Tree branches for the MUON.
551 const Int_t kBufferSize = 4000;
555 const char *cH = strstr(option,"H");
556 const char *cD = strstr(option,"D"); // Digits branches in TreeD
557 const char *cS = strstr(option,"S"); // Digits branches in TreeS
558 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
559 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
560 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
561 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
562 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
563 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
565 TBranch * branch = 0x0;
567 // Creating Branches for Hits
571 fHits = new TClonesArray("AliMUONHit",1000);
572 // if (gAlice->GetMCApp())
573 // gAlice->GetMCApp()->AddHitList (fHits);
577 sprintf(branchname,"%sHits",GetName());
578 branch = TreeH()->GetBranch(branchname);
580 AliInfo(Form("MakeBranch","Branch %s is already in tree.",branchname));
583 branch = TreeH()->Branch(branchname,&fHits,kBufferSize);
584 //Info("MakeBranch","Making Branch %s for hits \n",branchname);
587 //Creating Branches for Digits
596 // one branch for digits per chamber
599 fDigits = new TObjArray(AliMUONConstants::NCh());
600 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++)
602 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
604 fDigits->AddAt(tca,iDetectionPlane);
609 fNdigits = new Int_t[AliMUONConstants::NCh()];
610 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++)
612 fNdigits[iDetectionPlane]=0;
615 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++)
617 sprintf(branchname,"%sDigits%d",GetName(),iDetectionPlane+1);
618 branch = treeD->GetBranch(branchname);
621 AliInfo(Form("Branch %s is already in tree.",branchname));
624 TClonesArray * digits = Digits(iDetectionPlane);
625 branch = treeD->Branch(branchname, &digits, kBufferSize,1);
632 // one branch for global trigger
634 sprintf(branchname,"%sGlobalTrigger",GetName());
636 if (fGlobalTrigger == 0x0)
638 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger");
641 branch = treeD->GetBranch(branchname);
644 AliInfo(Form("Branch GlobalTrigger is already in treeD."));
647 branch = treeD->Branch(branchname, &fGlobalTrigger, kBufferSize);
650 // one branch for regional trigger
652 sprintf(branchname,"%sRegionalTrigger",GetName());
655 if (fRegionalTrigger == 0x0)
657 fRegionalTrigger = new TClonesArray("AliMUONRegionalTrigger",16);
658 fNregionaltrigger = 0;
660 branch = treeD->GetBranch(branchname);
663 AliInfo(Form("Branch RegionalTrigger is already in treeD."));
666 branch = treeD->Branch(branchname, &fRegionalTrigger, kBufferSize);
670 // one branch for local trigger
672 sprintf(branchname,"%sLocalTrigger",GetName());
675 if (fLocalTrigger == 0x0)
677 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
680 branch = treeD->GetBranch(branchname);
683 AliInfo(Form("Branch LocalTrigger is already in treeD."));
686 branch = treeD->Branch(branchname, &fLocalTrigger, kBufferSize);
689 //Creating Branches for SDigits
690 if (TreeS() && cS ) {
691 // one branch for Sdigits per chamber
692 if (fSDigits == 0x0) {
693 fSDigits = new TObjArray(AliMUONConstants::NCh());
694 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
695 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
697 fSDigits->AddAt(tca,iDetectionPlane);
700 if (fNSdigits == 0x0) {
701 fNSdigits = new Int_t[AliMUONConstants::NCh()];
702 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
703 fNSdigits[iDetectionPlane]=0;
706 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
707 sprintf(branchname,"%sSDigits%d",GetName(),iDetectionPlane+1);
709 branch = TreeS()->GetBranch(branchname);
711 AliInfo(Form("Branch %s is already in tree.",branchname));
714 TClonesArray * sdigits = SDigits(iDetectionPlane);
715 branch = TreeS()->Branch(branchname, &sdigits, kBufferSize,1);
716 //Info("MakeBranch","Making Branch %s for sdigits in detection plane %d\n",branchname,iDetectionPlane+1);
720 if (TreeR() && cRC ) {
721 // one branch for raw clusters per tracking detection plane
724 if (fRawClusters == 0x0) {
725 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
726 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
727 TClonesArray * tca = new TClonesArray("AliMUONRawCluster",1000);
729 fRawClusters->AddAt(tca,i);
733 if (fNrawclusters == 0x0) {
734 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
735 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
740 for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) {
741 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
743 branch = TreeR()->GetBranch(branchname);
745 AliInfo(Form("Branch %s is already in tree.",branchname));
748 branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize);
749 //Info("MakeBranch","Making Branch %s for rawcluster in detection plane %d\n",branchname,i+1);
753 if (TreeR() && cTC ) {
755 // one branch for global trigger
757 sprintf(branchname,"%sGlobalTrigger",GetName());
760 if (fGlobalTrigger == 0x0) {
761 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger");
764 branch = TreeR()->GetBranch(branchname);
766 AliInfo(Form("Branch GlobalTrigger is already in treeR."));
769 branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize);
770 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
773 // one branch for regional trigger
775 sprintf(branchname,"%sRegionalTrigger",GetName());
778 if (fRegionalTrigger == 0x0) {
779 fRegionalTrigger = new TClonesArray("AliMUONRegionalTrigger",16);
780 fNregionaltrigger = 0;
782 branch = TreeR()->GetBranch(branchname);
784 AliInfo(Form("Branch RegionalTrigger is already in treeR."));
787 branch = TreeR()->Branch(branchname, &fRegionalTrigger, kBufferSize);
790 // one branch for local trigger
792 sprintf(branchname,"%sLocalTrigger",GetName());
795 if (fLocalTrigger == 0x0) {
796 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
799 branch = TreeR()->GetBranch(branchname);
801 AliInfo(Form("Branch LocalTrigger is already in treeR."));
804 branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize);
805 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
808 if (TreeT() && cRT ) {
809 if (fRecTracks == 0x0) fRecTracks = new TClonesArray("AliMUONTrack",100);
811 sprintf(branchname,"%sTrack",GetName());
812 branch = TreeT()->GetBranch(branchname);
814 AliInfo(Form("Branch %s is already in tree.",GetName()));
817 branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize);
818 //Info("MakeBranch","Making Branch %s for tracks \n",branchname);
821 if (TreeT() && cRL ) {
822 if (fRecTriggerTracks == 0x0) fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
823 fNrectriggertracks = 0;
824 sprintf(branchname,"%sTriggerTrack",GetName());
825 branch = TreeT()->GetBranch(branchname);
827 AliInfo(Form("Branch %s is already in tree.",GetName()));
830 branch = TreeT()->Branch(branchname,&fRecTriggerTracks,kBufferSize);
831 //Info("MakeBranch","Making Branch %s for trigger tracks \n",branchname);
834 //____________________________________________________________________________
835 TClonesArray* AliMUONData::RawClusters(Int_t DetectionPlane)
837 /// Getting Raw Clusters
840 return ( (TClonesArray*) fRawClusters->At(DetectionPlane) );
845 //____________________________________________________________________________
847 AliMUONData::LocalTrigger() const
849 /// Getting local trigger
851 return fLocalTrigger;
854 //____________________________________________________________________________
856 AliMUONData::GetDigits() const
858 /// Load the digits from TreeD for the current event.
860 Int_t event = fLoader->GetRunLoader()->GetEventNumber();
861 if ( fCurrentEvent != event )
863 if (fLoader->TreeD()) {
864 fLoader->TreeD()->GetEvent(0);
865 fCurrentEvent = event;
870 //____________________________________________________________________________
872 AliMUONData::GlobalTrigger() const
874 /// Return the global trigger
876 return fGlobalTrigger;
879 //____________________________________________________________________________
880 void AliMUONData::ResetDigits()
882 /// Reset number of digits and the digits array for this detector
884 if (fDigits == 0x0) return;
885 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
886 if ((*fDigits)[i]) ((TClonesArray*)fDigits->At(i))->Clear("C");
887 if (fNdigits) fNdigits[i]=0;
890 //____________________________________________________________________________
891 void AliMUONData::ResetSDigits()
893 /// Reset number of Sdigits and the Sdigits array for this detector
895 if (fSDigits == 0x0) return;
896 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
897 if ((*fSDigits)[i]) ((TClonesArray*)fSDigits->At(i))->Clear();
898 if (fNSdigits) fNSdigits[i]=0;
901 //______________________________________________________________________________
902 void AliMUONData::ResetHits()
904 /// Reset number of clusters and the cluster array for this detector
907 if (fHits) fHits->Clear();
909 //_______________________________________________________________________________
910 void AliMUONData::ResetRawClusters()
912 /// Reset number of raw clusters and the raw clust array for this detector
914 for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) {
915 if ((*fRawClusters)[i]) ((TClonesArray*)fRawClusters->At(i))->Clear();
916 if (fNrawclusters) fNrawclusters[i]=0;
919 //_______________________________________________________________________________
920 void AliMUONData::ResetTrigger()
922 /// Reset Local and Global Trigger
925 if (fGlobalTrigger) fGlobalTrigger->Clear();
926 fNregionaltrigger = 0;
927 if (fRegionalTrigger) fRegionalTrigger->Clear();
929 if (fLocalTrigger) fLocalTrigger->Clear();
932 //____________________________________________________________________________
933 void AliMUONData::ResetRecTracks()
935 /// Reset tracks information
938 if (fRecTracks) fRecTracks->Delete(); // necessary to delete in case of memory allocation
940 //____________________________________________________________________________
941 void AliMUONData::ResetRecTriggerTracks()
943 /// Reset tracks information
945 fNrectriggertracks = 0;
946 if (fRecTriggerTracks) fRecTriggerTracks->Delete(); // necessary to delete in case of memory allocation
948 //_____________________________________________________________________________
949 void AliMUONData::SetTreeAddress(Option_t* option)
951 /// Setting Addresses to the events trees
953 const char *cH = strstr(option,"H");
954 const char *cD = strstr(option,"D"); // Digits branches in TreeD
955 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
956 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
957 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
958 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
959 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
960 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
961 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
963 // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree.
965 TBranch * branch = 0x0;
967 AliDebug(1,Form("option=%s",option));
969 // Branch address for hit tree
970 if ( TreeH() && cH ) {
972 fHits = new TClonesArray("AliMUONHit",1000);
973 // if (gAlice->GetMCApp())
974 // gAlice->GetMCApp()->AddHitList (fHits); Moved to AliMUON
978 if (TreeH() && fHits && cH) {
979 sprintf(branchname,"%sHits",GetName());
980 branch = TreeH()->GetBranch(branchname);
982 // Info("SetTreeAddress","(%s) Setting for Hits",GetName());
983 branch->SetAddress(&fHits);
985 else { //can be invoked before branch creation
986 AliWarning(Form("(%s) Failed for Hits. Can not find branch in tree.",GetName()));
991 // Branch address for digit tree
993 if (fDigits == 0x0 && cD) {
994 fDigits = new TObjArray(AliMUONConstants::NCh());
995 fNdigits= new Int_t[AliMUONConstants::NCh()];
996 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
997 fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i);
1001 if (fLocalTrigger == 0x0 && cGLT) {
1002 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
1004 if (fRegionalTrigger == 0x0 && cGLT) {
1005 fRegionalTrigger = new TClonesArray("AliMUONRegionalTrigger",16);
1007 if (fGlobalTrigger== 0x0 && cGLT) {
1008 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
1012 if (TreeD() && fDigits && cD) {
1013 for (int i=0; i<AliMUONConstants::NCh(); i++) {
1014 sprintf(branchname,"%sDigits%d",GetName(),i+1);
1016 branch = TreeD()->GetBranch(branchname);
1017 TClonesArray * digits = Digits(i);
1019 branch->SetAddress( &digits );
1021 else AliWarning(Form("(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i));
1025 if ( TreeD() && fLocalTrigger && cGLT) {
1026 sprintf(branchname,"%sLocalTrigger",GetName());
1027 branch = TreeD()->GetBranch(branchname);
1028 if (branch) branch->SetAddress(&fLocalTrigger);
1029 else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeD.",GetName()));
1031 if ( TreeD() && fRegionalTrigger && cGLT) {
1032 sprintf(branchname,"%sRegionalTrigger",GetName());
1033 branch = TreeD()->GetBranch(branchname);
1034 if (branch) branch->SetAddress(&fRegionalTrigger);
1035 else AliWarning(Form("(%s) Failed for RegionalTrigger. Can not find branch in treeD.",GetName()));
1037 if ( TreeD() && fGlobalTrigger && cGLT) {
1038 sprintf(branchname,"%sGlobalTrigger",GetName());
1039 branch = TreeD()->GetBranch(branchname);
1040 if (branch) branch->SetAddress(&fGlobalTrigger);
1041 else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeD.",GetName()));
1045 // Branch address for Sdigit tree
1048 if (fSDigits == 0x0)
1050 AliDebug(1,"Creating fSDigits TObjArray");
1051 fSDigits = new TObjArray(AliMUONConstants::NCh());
1052 fNSdigits= new Int_t[AliMUONConstants::NCh()];
1053 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++)
1055 TClonesArray* a = new TClonesArray("AliMUONDigit",10000);
1056 fSDigits->AddAt(a,i);
1057 AliDebug(1,Form("fSDigits[%d]=%p",i,a));
1063 AliDebug(1,Form("fSDigits already there = %p",fSDigits));
1067 if (TreeS() && fSDigits && cS) {
1068 AliDebug(1,"Setting branch addresses");
1069 for (int i=0; i<AliMUONConstants::NCh(); i++) {
1070 sprintf(branchname,"%sSDigits%d",GetName(),i+1);
1072 AliDebug(1,Form("TreeS=%p for ich=%d branchname=%s",
1073 TreeS(),i,branchname));
1074 branch = TreeS()->GetBranch(branchname);
1075 TClonesArray * sdigits = SDigits(i);
1076 if (branch) branch->SetAddress( &sdigits );
1077 else AliWarning(Form("(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i));
1083 // Branch address for rawclusters, globaltrigger and local trigger tree
1085 if (fRawClusters == 0x0 && cRC) {
1086 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
1087 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
1088 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
1089 fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i);
1093 if (fLocalTrigger == 0x0 && cTC) {
1094 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
1096 if (fRegionalTrigger == 0x0 && cTC) {
1097 fRegionalTrigger = new TClonesArray("AliMUONRegionalTrigger",16);
1099 if (fGlobalTrigger== 0x0 && cTC) {
1100 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
1104 if ( TreeR() && fRawClusters && cRC && !strstr(cRC,"RCC")) {
1105 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
1106 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
1108 branch = TreeR()->GetBranch(branchname);
1109 if (branch) branch->SetAddress( &((*fRawClusters)[i]) );
1110 else AliWarning(Form("(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i));
1114 if ( TreeR() && fLocalTrigger && cTC) {
1115 sprintf(branchname,"%sLocalTrigger",GetName());
1116 branch = TreeR()->GetBranch(branchname);
1117 if (branch) branch->SetAddress(&fLocalTrigger);
1118 else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeR.",GetName()));
1121 if ( TreeR() && fRegionalTrigger && cTC) {
1122 sprintf(branchname,"%sRegionalTrigger",GetName());
1123 branch = TreeR()->GetBranch(branchname);
1124 if (branch) branch->SetAddress(&fRegionalTrigger);
1125 else AliWarning(Form("(%s) Failed for RegionalTrigger. Can not find branch in treeR.",GetName()));
1128 if ( TreeR() && fGlobalTrigger && cTC) {
1129 sprintf(branchname,"%sGlobalTrigger",GetName());
1130 branch = TreeR()->GetBranch(branchname);
1131 if (branch) branch->SetAddress(&fGlobalTrigger);
1132 else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeR.",GetName()));
1136 if (fRecTracks == 0x0 && cRT) {
1137 fRecTracks = new TClonesArray("AliMUONTrack",100);
1141 if ( TreeT() && fRecTracks && cRT ) {
1142 sprintf(branchname,"%sTrack",GetName());
1143 branch = TreeT()->GetBranch(branchname);
1144 if (branch) branch->SetAddress(&fRecTracks);
1145 else AliWarning(Form("(%s) Failed for Tracks. Can not find branch in tree.",GetName()));
1149 if (fRecTriggerTracks == 0x0 && cRL) {
1150 fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
1154 if ( TreeT() && fRecTriggerTracks && cRL ) {
1155 sprintf(branchname,"%sTriggerTrack",GetName());
1156 branch = TreeT()->GetBranch(branchname);
1157 if (branch) branch->SetAddress(&fRecTriggerTracks);
1158 else AliWarning(Form("(%s) Failed for Trigger Tracks. Can not find branch in tree.",GetName()));
1164 //_____________________________________________________________________________
1166 AliMUONData::Print(Option_t* opt) const
1168 /// Dump object on screen
1170 TString options(opt);
1173 if ( options.Contains("D") )
1175 for ( Int_t ich = 0; ich < AliMUONConstants::NCh(); ++ich)
1177 TClonesArray* digits = Digits(ich);
1178 Int_t ndigits = digits->GetEntriesFast();
1179 for ( Int_t id = 0; id < ndigits; ++id )
1181 AliMUONDigit* digit =
1182 static_cast<AliMUONDigit*>(digits->UncheckedAt(id));
1188 if ( options.Contains("S") )
1190 for ( Int_t ich = 0; ich < AliMUONConstants::NCh(); ++ich)
1192 TClonesArray* digits = SDigits(ich);
1193 Int_t ndigits = digits->GetEntriesFast();
1194 for ( Int_t id = 0; id < ndigits; ++id )
1196 AliMUONDigit* digit =
1197 static_cast<AliMUONDigit*>(digits->UncheckedAt(id));