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::GetDigits() const
835 /// Load the digits from TreeD for the current event.
837 Int_t event = fLoader->GetRunLoader()->GetEventNumber();
838 if ( fCurrentEvent != event )
840 if (fLoader->TreeD()) {
841 fLoader->TreeD()->GetEvent(0);
842 fCurrentEvent = event;
847 //____________________________________________________________________________
849 AliMUONData::GlobalTrigger() const
851 /// Return the global trigger
853 return fGlobalTrigger;
856 //____________________________________________________________________________
857 void AliMUONData::ResetDigits()
859 /// Reset number of digits and the digits array for this detector
861 if (fDigits == 0x0) return;
862 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
863 if ((*fDigits)[i]) ((TClonesArray*)fDigits->At(i))->Clear("C");
864 if (fNdigits) fNdigits[i]=0;
867 //____________________________________________________________________________
868 void AliMUONData::ResetSDigits()
870 /// Reset number of Sdigits and the Sdigits array for this detector
872 if (fSDigits == 0x0) return;
873 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
874 if ((*fSDigits)[i]) ((TClonesArray*)fSDigits->At(i))->Clear();
875 if (fNSdigits) fNSdigits[i]=0;
878 //______________________________________________________________________________
879 void AliMUONData::ResetHits()
881 /// Reset number of clusters and the cluster array for this detector
884 if (fHits) fHits->Clear();
886 //_______________________________________________________________________________
887 void AliMUONData::ResetRawClusters()
889 /// Reset number of raw clusters and the raw clust array for this detector
891 for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) {
892 if ((*fRawClusters)[i]) ((TClonesArray*)fRawClusters->At(i))->Clear();
893 if (fNrawclusters) fNrawclusters[i]=0;
896 //_______________________________________________________________________________
897 void AliMUONData::ResetTrigger()
899 /// Reset Local and Global Trigger
902 if (fGlobalTrigger) fGlobalTrigger->Clear();
903 fNregionaltrigger = 0;
904 if (fRegionalTrigger) fRegionalTrigger->Clear();
906 if (fLocalTrigger) fLocalTrigger->Clear();
909 //____________________________________________________________________________
910 void AliMUONData::ResetRecTracks()
912 /// Reset tracks information
915 if (fRecTracks) fRecTracks->Delete(); // necessary to delete in case of memory allocation
917 //____________________________________________________________________________
918 void AliMUONData::ResetRecTriggerTracks()
920 /// Reset tracks information
922 fNrectriggertracks = 0;
923 if (fRecTriggerTracks) fRecTriggerTracks->Delete(); // necessary to delete in case of memory allocation
925 //_____________________________________________________________________________
926 void AliMUONData::SetTreeAddress(Option_t* option)
928 /// Setting Addresses to the events trees
930 const char *cH = strstr(option,"H");
931 const char *cD = strstr(option,"D"); // Digits branches in TreeD
932 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
933 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
934 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
935 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
936 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
937 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
938 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
940 // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree.
942 TBranch * branch = 0x0;
944 AliDebug(1,Form("option=%s",option));
946 // Branch address for hit tree
947 if ( TreeH() && cH ) {
949 fHits = new TClonesArray("AliMUONHit",1000);
950 // if (gAlice->GetMCApp())
951 // gAlice->GetMCApp()->AddHitList (fHits); Moved to AliMUON
955 if (TreeH() && fHits && cH) {
956 sprintf(branchname,"%sHits",GetName());
957 branch = TreeH()->GetBranch(branchname);
959 // Info("SetTreeAddress","(%s) Setting for Hits",GetName());
960 branch->SetAddress(&fHits);
962 else { //can be invoked before branch creation
963 //AliWarning(Form("(%s) Failed for Hits. Can not find branch in tree.",GetName()));
968 // Branch address for digit tree
970 if (fDigits == 0x0 && cD) {
971 fDigits = new TObjArray(AliMUONConstants::NCh());
972 fNdigits= new Int_t[AliMUONConstants::NCh()];
973 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
974 fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i);
978 if (fLocalTrigger == 0x0 && cGLT) {
979 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
981 if (fRegionalTrigger == 0x0 && cGLT) {
982 fRegionalTrigger = new TClonesArray("AliMUONRegionalTrigger",16);
984 if (fGlobalTrigger== 0x0 && cGLT) {
985 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
989 if (TreeD() && fDigits && cD) {
990 for (int i=0; i<AliMUONConstants::NCh(); i++) {
991 sprintf(branchname,"%sDigits%d",GetName(),i+1);
993 branch = TreeD()->GetBranch(branchname);
994 TClonesArray * digits = Digits(i);
996 branch->SetAddress( &digits );
998 else AliWarning(Form("(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i));
1002 if ( TreeD() && fLocalTrigger && cGLT) {
1003 sprintf(branchname,"%sLocalTrigger",GetName());
1004 branch = TreeD()->GetBranch(branchname);
1005 if (branch) branch->SetAddress(&fLocalTrigger);
1006 else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeD.",GetName()));
1008 if ( TreeD() && fRegionalTrigger && cGLT) {
1009 sprintf(branchname,"%sRegionalTrigger",GetName());
1010 branch = TreeD()->GetBranch(branchname);
1011 if (branch) branch->SetAddress(&fRegionalTrigger);
1012 else AliWarning(Form("(%s) Failed for RegionalTrigger. Can not find branch in treeD.",GetName()));
1014 if ( TreeD() && fGlobalTrigger && cGLT) {
1015 sprintf(branchname,"%sGlobalTrigger",GetName());
1016 branch = TreeD()->GetBranch(branchname);
1017 if (branch) branch->SetAddress(&fGlobalTrigger);
1018 else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeD.",GetName()));
1022 // Branch address for Sdigit tree
1025 if (fSDigits == 0x0)
1027 AliDebug(1,"Creating fSDigits TObjArray");
1028 fSDigits = new TObjArray(AliMUONConstants::NCh());
1029 fNSdigits= new Int_t[AliMUONConstants::NCh()];
1030 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++)
1032 TClonesArray* a = new TClonesArray("AliMUONDigit",10000);
1033 fSDigits->AddAt(a,i);
1034 AliDebug(1,Form("fSDigits[%d]=%p",i,a));
1040 AliDebug(1,Form("fSDigits already there = %p",fSDigits));
1044 if (TreeS() && fSDigits && cS) {
1045 AliDebug(1,"Setting branch addresses");
1046 for (int i=0; i<AliMUONConstants::NCh(); i++) {
1047 sprintf(branchname,"%sSDigits%d",GetName(),i+1);
1049 AliDebug(1,Form("TreeS=%p for ich=%d branchname=%s",
1050 TreeS(),i,branchname));
1051 branch = TreeS()->GetBranch(branchname);
1052 TClonesArray * sdigits = SDigits(i);
1053 if (branch) branch->SetAddress( &sdigits );
1054 else AliWarning(Form("(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i));
1060 // Branch address for rawclusters, globaltrigger and local trigger tree
1062 if (fRawClusters == 0x0 && cRC) {
1063 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
1064 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
1065 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
1066 fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i);
1070 if (fLocalTrigger == 0x0 && cTC) {
1071 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
1073 if (fRegionalTrigger == 0x0 && cTC) {
1074 fRegionalTrigger = new TClonesArray("AliMUONRegionalTrigger",16);
1076 if (fGlobalTrigger== 0x0 && cTC) {
1077 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
1081 if ( TreeR() && fRawClusters && cRC && !strstr(cRC,"RCC")) {
1082 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
1083 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
1085 branch = TreeR()->GetBranch(branchname);
1086 if (branch) branch->SetAddress( &((*fRawClusters)[i]) );
1087 else AliWarning(Form("(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i));
1091 if ( TreeR() && fLocalTrigger && cTC) {
1092 sprintf(branchname,"%sLocalTrigger",GetName());
1093 branch = TreeR()->GetBranch(branchname);
1094 if (branch) branch->SetAddress(&fLocalTrigger);
1095 else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeR.",GetName()));
1098 if ( TreeR() && fRegionalTrigger && cTC) {
1099 sprintf(branchname,"%sRegionalTrigger",GetName());
1100 branch = TreeR()->GetBranch(branchname);
1101 if (branch) branch->SetAddress(&fRegionalTrigger);
1102 else AliWarning(Form("(%s) Failed for RegionalTrigger. Can not find branch in treeR.",GetName()));
1105 if ( TreeR() && fGlobalTrigger && cTC) {
1106 sprintf(branchname,"%sGlobalTrigger",GetName());
1107 branch = TreeR()->GetBranch(branchname);
1108 if (branch) branch->SetAddress(&fGlobalTrigger);
1109 else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeR.",GetName()));
1113 if (fRecTracks == 0x0 && cRT) {
1114 fRecTracks = new TClonesArray("AliMUONTrack",100);
1118 if ( TreeT() && fRecTracks && cRT ) {
1119 sprintf(branchname,"%sTrack",GetName());
1120 branch = TreeT()->GetBranch(branchname);
1121 if (branch) branch->SetAddress(&fRecTracks);
1122 else AliWarning(Form("(%s) Failed for Tracks. Can not find branch in tree.",GetName()));
1126 if (fRecTriggerTracks == 0x0 && cRL) {
1127 fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
1131 if ( TreeT() && fRecTriggerTracks && cRL ) {
1132 sprintf(branchname,"%sTriggerTrack",GetName());
1133 branch = TreeT()->GetBranch(branchname);
1134 if (branch) branch->SetAddress(&fRecTriggerTracks);
1135 else AliWarning(Form("(%s) Failed for Trigger Tracks. Can not find branch in tree.",GetName()));
1141 //_____________________________________________________________________________
1143 AliMUONData::Print(Option_t* opt) const
1145 /// Dump object on screen
1147 TString options(opt);
1150 if ( options.Contains("D") )
1152 for ( Int_t ich = 0; ich < AliMUONConstants::NCh(); ++ich)
1154 TClonesArray* digits = Digits(ich);
1155 Int_t ndigits = digits->GetEntriesFast();
1156 for ( Int_t id = 0; id < ndigits; ++id )
1158 AliMUONDigit* digit =
1159 static_cast<AliMUONDigit*>(digits->UncheckedAt(id));
1165 if ( options.Contains("S") )
1167 for ( Int_t ich = 0; ich < AliMUONConstants::NCh(); ++ich)
1169 TClonesArray* digits = SDigits(ich);
1170 Int_t ndigits = digits->GetEntriesFast();
1171 for ( Int_t id = 0; id < ndigits; ++id )
1173 AliMUONDigit* digit =
1174 static_cast<AliMUONDigit*>(digits->UncheckedAt(id));