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 **************************************************************************/
17 // AliMUONData classes
18 // Class containing MUON data: hits, digits, rawclusters, globaltrigger, localtrigger, etc ..
19 // The classe makes the lik between the MUON data lists and the event trees from loaders
20 // Gines Martinez, Subatech, September 2003
23 #include "AliMUONData.h"
26 #include "AliMUONConstants.h"
27 #include "AliMUONDigit.h"
28 #include "AliMUONGlobalTrigger.h"
29 #include "AliMUONHit.h"
30 #include "AliMUONLocalTrigger.h"
31 #include "AliMUONRawCluster.h"
32 #include "AliMUONTrack.h"
33 #include "AliMUONTriggerTrack.h"
38 //_____________________________________________________________________________
39 AliMUONData::AliMUONData():
49 fRecTriggerTracks(0x0),
57 fNrectriggertracks(0),
60 // Default constructor
62 //_____________________________________________________________________________
63 AliMUONData::AliMUONData(AliLoader * loader, const char* name, const char* title):
73 fRecTriggerTracks(0x0),
81 fNrectriggertracks(0),
84 // Constructor for AliMUONData
86 // fHits = new TClonesArray("AliMUONHit",1000);
88 // fDigits = new TObjArray(AliMUONConstants::NCh());
89 // fNdigits = new Int_t[AliMUONConstants::NCh()];
90 // for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
91 // fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),iDetectionPlane);
92 // fNdigits[iDetectionPlane]=0;
94 // fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
95 // fNrawclusters = new Int_t[AliMUONConstants::NTrackingCh()];
96 // for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NTrackingCh();iDetectionPlane++) {
97 // fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),iDetectionPlane);
98 // fNrawclusters[iDetectionPlane]=0;
100 // fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
101 // fNglobaltrigger =0;
102 // fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
103 // fNlocaltrigger = 0;
104 // fRecTracks = new TClonesArray("AliMUONTrack", 100);
105 // fNrectracks = 0; // really needed or GetEntriesFast sufficient ????
110 //_____________________________________________________________________________
111 AliMUONData::AliMUONData(const AliMUONData& rMUONData):TNamed(rMUONData)
113 // Protected copy constructor
115 AliFatal("Not implemented.");
118 //_____________________________________________________________________________
119 AliMUONData::~AliMUONData()
121 // Destructor for AliMUONData
136 fRawClusters->Delete();
140 fGlobalTrigger->Delete();
141 delete fGlobalTrigger;
144 fLocalTrigger->Delete();
145 delete fLocalTrigger;
148 fRecTracks->Delete();
151 if (fRecTriggerTracks){
152 fRecTriggerTracks->Delete();
153 delete fRecTriggerTracks;
158 //_____________________________________________________________________________
159 AliMUONData& AliMUONData::operator=(const AliMUONData& rhs)
161 // Protected assignement operator
163 if (this == &rhs) return *this;
165 AliFatal("Not implemented.");
171 //_____________________________________________________________________________
172 void AliMUONData::AddDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
175 // Add a MUON digit to the list of Digits of the detection plane id
177 TClonesArray &ldigits = * Digits(id) ;
178 new(ldigits[fNdigits[id]++]) AliMUONDigit(tracks,charges,digits);
180 //_____________________________________________________________________________
181 void AliMUONData::AddDigit(Int_t id, const AliMUONDigit& digit)
184 // Add a MUON digit to the list of Digits of the detection plane id
186 TClonesArray &ldigits = * Digits(id) ;
187 new(ldigits[fNdigits[id]++]) AliMUONDigit(digit);
189 //_____________________________________________________________________________
190 void AliMUONData::AddSDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *sdigits)
193 // Add a MUON Sdigit to the list of SDigits of the detection plane id
195 TClonesArray &lSdigits = * SDigits(id) ;
196 new(lSdigits[fNSdigits[id]++]) AliMUONDigit(tracks,charges,sdigits);
198 //_____________________________________________________________________________
199 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);
207 //_____________________________________________________________________________
208 void AliMUONData::AddGlobalTrigger(Int_t *singlePlus, Int_t *singleMinus,
210 Int_t *pairUnlike, Int_t *pairLike)
212 // add a MUON Global Trigger to the list (only one GlobalTrigger per event !)
214 TClonesArray &globalTrigger = *fGlobalTrigger;
215 new(globalTrigger[fNglobaltrigger++])
216 AliMUONGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike);
218 //_____________________________________________________________________________
219 void AliMUONData::AddGlobalTrigger(const AliMUONGlobalTrigger& trigger )
221 // add a MUON Global Trigger to the list (only one GlobalTrigger per event !);
222 TClonesArray &globalTrigger = *fGlobalTrigger;
223 new(globalTrigger[fNglobaltrigger++]) AliMUONGlobalTrigger(trigger);
225 //____________________________________________________________________________
226 void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber,
227 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
228 Float_t tof, Float_t momentum, Float_t theta,
229 Float_t phi, Float_t length, Float_t destep,
230 Float_t Xref,Float_t Yref,Float_t Zref)
232 // Add new hit to the hit list
233 TClonesArray &lhits = *fHits;
234 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber,
236 tof, momentum, theta,
240 //____________________________________________________________________________
241 void AliMUONData::AddHit2(Int_t fIshunt, Int_t track, Int_t detElemId,
242 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
243 Float_t tof, Float_t momentum, Float_t theta,
244 Float_t phi, Float_t length, Float_t destep,
245 Float_t Xref,Float_t Yref,Float_t Zref)
247 // Add new hit to the hit list
248 TClonesArray &lhits = *fHits;
249 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, detElemId,
251 tof, momentum, theta,
253 Xref,Yref,Zref, true);
255 //____________________________________________________________________________
256 void AliMUONData::AddLocalTrigger(const Int_t *localtr, const TArrayI& digits)
258 // add a MUON Local Trigger to the list
259 TClonesArray &localTrigger = *fLocalTrigger;
260 new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(localtr, digits);
262 //____________________________________________________________________________
263 void AliMUONData::AddLocalTrigger(const AliMUONLocalTrigger& trigger)
265 // add a MUON Local Trigger to the list
266 TClonesArray &localTrigger = *fLocalTrigger;
267 new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(trigger);
269 //_____________________________________________________________________________
270 void AliMUONData::AddRawCluster(Int_t id, const AliMUONRawCluster& c)
273 // Add a MUON rawcluster to the list in the detection plane id
275 TClonesArray &lrawcl = *((TClonesArray*) fRawClusters->At(id));
276 new(lrawcl[fNrawclusters[id]++]) AliMUONRawCluster(c);
278 //_____________________________________________________________________________
279 void AliMUONData::AddRecTrack(const AliMUONTrack& track)
282 // Add a MUON rectrack
284 TClonesArray &lrectracks = *fRecTracks;
285 new(lrectracks[fNrectracks++]) AliMUONTrack(track);
286 // printf("TTTTTT %d ,\n",((AliMUONTrack*)fRecTracks->At(fNrectracks-1))->GetNTrackHits());
288 //_____________________________________________________________________________
289 void AliMUONData::AddRecTriggerTrack(const AliMUONTriggerTrack& triggertrack)
292 // Add a MUON triggerrectrack
294 TClonesArray &lrectriggertracks = *fRecTriggerTracks;
295 new(lrectriggertracks[fNrectriggertracks++]) AliMUONTriggerTrack(triggertrack);
296 // printf("TTTTTT %d ,\n",((AliMUONTrack*)fRecTracks->At(fNrectracks-1))->GetNTrackHits());
299 //____________________________________________________________________________
300 TClonesArray* AliMUONData::Digits(Int_t DetectionPlane) const
302 //Getting List of Digits
304 return ( (TClonesArray*) fDigits->At(DetectionPlane) );
308 //____________________________________________________________________________
309 TClonesArray* AliMUONData::SDigits(Int_t DetectionPlane) const
311 //Getting List of SDigits
313 return ( (TClonesArray*) fSDigits->At(DetectionPlane) );
317 //____________________________________________________________________________
318 Bool_t AliMUONData::IsRawClusterBranchesInTree()
320 // Checking if there are RawCluster Branches In TreeR
322 AliError("No treeR in memory");
327 sprintf(branchname,"%sRawClusters1",GetName());
328 TBranch * branch = 0x0;
329 branch = TreeR()->GetBranch(branchname);
330 if (branch) return kTRUE;
334 //____________________________________________________________________________
335 Bool_t AliMUONData::IsDigitsBranchesInTree()
337 // Checking if there are RawCluster Branches In TreeR
339 AliError("No treeD in memory");
344 sprintf(branchname,"%sDigits1",GetName());
345 TBranch * branch = 0x0;
346 branch = TreeD()->GetBranch(branchname);
347 if (branch) return kTRUE;
351 //____________________________________________________________________________
352 Bool_t AliMUONData::IsTriggerBranchesInTree()
354 // Checking if there are Trigger Branches In TreeR
356 AliError("No treeR in memory");
361 sprintf(branchname,"%sLocalTrigger",GetName());
362 TBranch * branch = 0x0;
363 branch = TreeR()->GetBranch(branchname);
364 if (branch) return kTRUE;
368 //____________________________________________________________________________
369 Bool_t AliMUONData::IsTriggerBranchesInTreeD()
371 // Checking if there are Trigger Branches In TreeR
373 AliError("No treeD in memory");
378 sprintf(branchname,"%sLocalTrigger",GetName());
379 TBranch * branch = 0x0;
380 branch = TreeD()->GetBranch(branchname);
381 if (branch) return kTRUE;
386 //____________________________________________________________________________
387 Bool_t AliMUONData::IsTrackBranchesInTree()
389 // Checking if there are Track Branches In TreeT
391 AliError("No treeT in memory");
396 sprintf(branchname,"%sTrack",GetName());
397 TBranch * branch = 0x0;
398 branch = TreeT()->GetBranch(branchname);
399 if (branch) return kTRUE;
403 //____________________________________________________________________________
404 Bool_t AliMUONData::IsTriggerTrackBranchesInTree()
406 // Checking if there are TriggerTrack Branches In TreeT
408 AliError("No treeT in memory");
413 sprintf(branchname,"%sTriggerTrack",GetName());
414 TBranch * branch = 0x0;
415 branch = TreeT()->GetBranch(branchname);
416 if (branch) return kTRUE;
420 //____________________________________________________________________________
421 void AliMUONData::Fill(Option_t* option)
423 // Method to fill the trees
424 const char *cH = strstr(option,"H");
425 const char *cD = strstr(option,"D"); // Digits branches in TreeD
426 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
427 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
428 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
429 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
430 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
431 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
433 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
436 TBranch * branch = 0x0;
439 if ( TreeH() && cH ) {
445 if ( TreeD() && cD && cGLT )
450 if ( TreeD() && cD ) {
451 if ( IsTriggerBranchesInTreeD() ) {
452 for (int i=0; i<AliMUONConstants::NCh(); i++) {
453 sprintf(branchname,"%sDigits%d",GetName(),i+1);
454 branch = TreeD()->GetBranch(branchname);
462 if ( TreeD() && cGLT ) {
463 if ( IsDigitsBranchesInTree() ) {
464 sprintf(branchname,"%sLocalTrigger",GetName());
465 branch = TreeD()->GetBranch(branchname);
467 sprintf(branchname,"%sGlobalTrigger",GetName());
468 branch = TreeD()->GetBranch(branchname);
475 if ( TreeS() && cS) {
480 // filling rawclusters
481 if ( TreeR() && cRC ) {
482 if ( IsTriggerBranchesInTree() ) {
483 // Branch per branch filling
484 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
485 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
486 branch = TreeR()->GetBranch(branchname);
490 else TreeR()->Fill();
495 if ( TreeR() && cTC) {
496 if (IsRawClusterBranchesInTree()) {
497 // Branch per branch filling
498 sprintf(branchname,"%sLocalTrigger",GetName());
499 branch = TreeR()->GetBranch(branchname);
501 sprintf(branchname,"%sGlobalTrigger",GetName());
502 branch = TreeR()->GetBranch(branchname);
505 else TreeR()->Fill();
509 if ( TreeT() && cRT ) {
510 if (IsTriggerTrackBranchesInTree()) {
511 sprintf(branchname,"%sTrack",GetName());
512 branch = TreeT()->GetBranch(branchname);
515 else TreeT()->Fill();
517 // filling trigger tracks
518 if ( TreeT() && cRL ) {
519 if (IsTrackBranchesInTree()) {
520 sprintf(branchname,"%sTriggerTrack",GetName());
521 branch = TreeT()->GetBranch(branchname);
524 else TreeT()->Fill();
526 // if ( TreeT() && cRL ) {
527 // sprintf(branchname,"%sTrackTrig",GetName());
532 //_____________________________________________________________________________
533 void AliMUONData::MakeBranch(Option_t* option)
536 // Create Tree branches for the MUON.
538 const Int_t kBufferSize = 4000;
542 const char *cH = strstr(option,"H");
543 const char *cD = strstr(option,"D"); // Digits branches in TreeD
544 const char *cS = strstr(option,"S"); // Digits branches in TreeS
545 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
546 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
547 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
548 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
549 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
550 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
552 TBranch * branch = 0x0;
554 // Creating Branches for Hits
558 fHits = new TClonesArray("AliMUONHit",1000);
559 // if (gAlice->GetMCApp())
560 // gAlice->GetMCApp()->AddHitList (fHits);
564 sprintf(branchname,"%sHits",GetName());
565 branch = TreeH()->GetBranch(branchname);
567 AliInfo(Form("MakeBranch","Branch %s is already in tree.",GetName()));
570 branch = TreeH()->Branch(branchname,&fHits,kBufferSize);
571 //Info("MakeBranch","Making Branch %s for hits \n",branchname);
574 //Creating Branches for Digits
583 // one branch for digits per chamber
586 fDigits = new TObjArray(AliMUONConstants::NCh());
587 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++)
589 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
591 fDigits->AddAt(tca,iDetectionPlane);
596 fNdigits = new Int_t[AliMUONConstants::NCh()];
597 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++)
599 fNdigits[iDetectionPlane]=0;
602 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++)
604 sprintf(branchname,"%sDigits%d",GetName(),iDetectionPlane+1);
605 branch = treeD->GetBranch(branchname);
608 AliInfo(Form("Branch %s is already in tree.",GetName()));
611 TClonesArray * digits = Digits(iDetectionPlane);
612 branch = treeD->Branch(branchname, &digits, kBufferSize,1);
619 // one branch for global trigger
621 sprintf(branchname,"%sGlobalTrigger",GetName());
623 if (fGlobalTrigger == 0x0)
625 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger");
628 branch = treeD->GetBranch(branchname);
631 AliInfo(Form("Branch GlobalTrigger is already in treeD."));
634 branch = treeD->Branch(branchname, &fGlobalTrigger, kBufferSize);
637 // one branch for local trigger
639 sprintf(branchname,"%sLocalTrigger",GetName());
642 if (fLocalTrigger == 0x0)
644 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
647 branch = treeD->GetBranch(branchname);
650 AliInfo(Form("Branch LocalTrigger is already in treeD."));
653 branch = treeD->Branch(branchname, &fLocalTrigger, kBufferSize);
656 //Creating Branches for SDigits
657 if (TreeS() && cS ) {
658 // one branch for Sdigits per chamber
659 if (fSDigits == 0x0) {
660 fSDigits = new TObjArray(AliMUONConstants::NCh());
661 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
662 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
664 fSDigits->AddAt(tca,iDetectionPlane);
667 if (fNSdigits == 0x0) {
668 fNSdigits = new Int_t[AliMUONConstants::NCh()];
669 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
670 fNSdigits[iDetectionPlane]=0;
673 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
674 sprintf(branchname,"%sSDigits%d",GetName(),iDetectionPlane+1);
676 branch = TreeS()->GetBranch(branchname);
678 AliInfo(Form("Branch %s is already in tree.",GetName()));
681 TClonesArray * sdigits = SDigits(iDetectionPlane);
682 branch = TreeS()->Branch(branchname, &sdigits, kBufferSize,1);
683 //Info("MakeBranch","Making Branch %s for sdigits in detection plane %d\n",branchname,iDetectionPlane+1);
687 if (TreeR() && cRC ) {
688 // one branch for raw clusters per tracking detection plane
691 if (fRawClusters == 0x0) {
692 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
693 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
694 TClonesArray * tca = new TClonesArray("AliMUONRawCluster",1000);
696 fRawClusters->AddAt(tca,i);
700 if (fNrawclusters == 0x0) {
701 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
702 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
707 for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) {
708 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
710 branch = TreeR()->GetBranch(branchname);
712 AliInfo(Form("Branch %s is already in tree.",GetName()));
715 branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize);
716 //Info("MakeBranch","Making Branch %s for rawcluster in detection plane %d\n",branchname,i+1);
720 if (TreeR() && cTC ) {
722 // one branch for global trigger
724 sprintf(branchname,"%sGlobalTrigger",GetName());
727 if (fGlobalTrigger == 0x0) {
728 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger");
731 branch = TreeR()->GetBranch(branchname);
733 AliInfo(Form("Branch GlobalTrigger is already in treeR."));
736 branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize);
737 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
740 // one branch for local trigger
742 sprintf(branchname,"%sLocalTrigger",GetName());
745 if (fLocalTrigger == 0x0) {
746 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
749 branch = TreeR()->GetBranch(branchname);
751 AliInfo(Form("Branch LocalTrigger is already in treeR."));
754 branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize);
755 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
758 if (TreeT() && cRT ) {
759 if (fRecTracks == 0x0) fRecTracks = new TClonesArray("AliMUONTrack",100);
761 sprintf(branchname,"%sTrack",GetName());
762 branch = TreeT()->GetBranch(branchname);
764 AliInfo(Form("Branch %s is already in tree.",GetName()));
767 branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize);
768 //Info("MakeBranch","Making Branch %s for tracks \n",branchname);
771 if (TreeT() && cRL ) {
772 if (fRecTriggerTracks == 0x0) fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
773 fNrectriggertracks = 0;
774 sprintf(branchname,"%sTriggerTrack",GetName());
775 branch = TreeT()->GetBranch(branchname);
777 AliInfo(Form("Branch %s is already in tree.",GetName()));
780 branch = TreeT()->Branch(branchname,&fRecTriggerTracks,kBufferSize);
781 //Info("MakeBranch","Making Branch %s for trigger tracks \n",branchname);
784 //____________________________________________________________________________
785 TClonesArray* AliMUONData::RawClusters(Int_t DetectionPlane)
787 // Getting Raw Clusters
789 return ( (TClonesArray*) fRawClusters->At(DetectionPlane) );
793 //____________________________________________________________________________
794 TClonesArray* AliMUONData::LocalTrigger()
796 // Getting Local Trigger
798 return ( (TClonesArray*) fLocalTrigger );
802 //____________________________________________________________________________
803 TClonesArray* AliMUONData::GlobalTrigger()
805 // Getting Global Trigger
807 return ( (TClonesArray*) fGlobalTrigger );
811 //____________________________________________________________________________
812 void AliMUONData::ResetDigits()
815 // Reset number of digits and the digits array for this detector
817 if (fDigits == 0x0) return;
818 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
819 if ((*fDigits)[i]) ((TClonesArray*)fDigits->At(i))->Clear("C");
820 if (fNdigits) fNdigits[i]=0;
823 //____________________________________________________________________________
824 void AliMUONData::ResetSDigits()
827 // Reset number of Sdigits and the Sdigits array for this detector
829 if (fSDigits == 0x0) return;
830 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
831 if ((*fSDigits)[i]) ((TClonesArray*)fSDigits->At(i))->Clear();
832 if (fNSdigits) fNSdigits[i]=0;
835 //______________________________________________________________________________
836 void AliMUONData::ResetHits()
838 // Reset number of clusters and the cluster array for this detector
840 if (fHits) fHits->Clear();
842 //_______________________________________________________________________________
843 void AliMUONData::ResetRawClusters()
845 // Reset number of raw clusters and the raw clust array for this detector
847 for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) {
848 if ((*fRawClusters)[i]) ((TClonesArray*)fRawClusters->At(i))->Clear();
849 if (fNrawclusters) fNrawclusters[i]=0;
852 //_______________________________________________________________________________
853 void AliMUONData::ResetTrigger()
855 // Reset Local and Global Trigger
857 if (fGlobalTrigger) fGlobalTrigger->Clear();
859 if (fLocalTrigger) fLocalTrigger->Clear();
861 //____________________________________________________________________________
862 void AliMUONData::ResetRecTracks()
864 // Reset tracks information
866 if (fRecTracks) fRecTracks->Delete(); // necessary to delete in case of memory allocation
868 //____________________________________________________________________________
869 void AliMUONData::ResetRecTriggerTracks()
871 // Reset tracks information
872 fNrectriggertracks = 0;
873 if (fRecTriggerTracks) fRecTriggerTracks->Delete(); // necessary to delete in case of memory allocation
875 //_____________________________________________________________________________
876 void AliMUONData::SetTreeAddress(Option_t* option)
878 //Setting Addresses to the events trees
879 const char *cH = strstr(option,"H");
880 const char *cD = strstr(option,"D"); // Digits branches in TreeD
881 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
882 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
883 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
884 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
885 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
886 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
887 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
889 // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree.
891 TBranch * branch = 0x0;
893 AliDebug(1,Form("option=%s",option));
895 // Branch address for hit tree
896 if ( TreeH() && cH ) {
898 fHits = new TClonesArray("AliMUONHit",1000);
899 // if (gAlice->GetMCApp())
900 // gAlice->GetMCApp()->AddHitList (fHits); Moved to AliMUON
904 if (TreeH() && fHits && cH) {
905 sprintf(branchname,"%sHits",GetName());
906 branch = TreeH()->GetBranch(branchname);
908 // Info("SetTreeAddress","(%s) Setting for Hits",GetName());
909 branch->SetAddress(&fHits);
911 else { //can be invoked before branch creation
912 AliWarning(Form("(%s) Failed for Hits. Can not find branch in tree.",GetName()));
917 // Branch address for digit tree
919 if (fDigits == 0x0 && cD) {
920 fDigits = new TObjArray(AliMUONConstants::NCh());
921 fNdigits= new Int_t[AliMUONConstants::NCh()];
922 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
923 fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i);
927 if (fLocalTrigger == 0x0 && cGLT) {
928 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
930 if (fGlobalTrigger== 0x0 && cGLT) {
931 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
935 if (TreeD() && fDigits && cD) {
936 for (int i=0; i<AliMUONConstants::NCh(); i++) {
937 sprintf(branchname,"%sDigits%d",GetName(),i+1);
939 branch = TreeD()->GetBranch(branchname);
940 TClonesArray * digits = Digits(i);
942 branch->SetAddress( &digits );
944 else AliWarning(Form("(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i));
948 if ( TreeD() && fLocalTrigger && cGLT) {
949 sprintf(branchname,"%sLocalTrigger",GetName());
950 branch = TreeD()->GetBranch(branchname);
951 if (branch) branch->SetAddress(&fLocalTrigger);
952 else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeD.",GetName()));
954 if ( TreeD() && fGlobalTrigger && cGLT) {
955 sprintf(branchname,"%sGlobalTrigger",GetName());
956 branch = TreeD()->GetBranch(branchname);
957 if (branch) branch->SetAddress(&fGlobalTrigger);
958 else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeD.",GetName()));
962 // Branch address for Sdigit tree
967 AliDebug(1,"Creating fSDigits TObjArray");
968 fSDigits = new TObjArray(AliMUONConstants::NCh());
969 fNSdigits= new Int_t[AliMUONConstants::NCh()];
970 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++)
972 TClonesArray* a = new TClonesArray("AliMUONDigit",10000);
973 fSDigits->AddAt(a,i);
974 AliDebug(1,Form("fSDigits[%d]=%p",i,a));
980 AliDebug(1,Form("fSDigits already there = %p",fSDigits));
984 if (TreeS() && fSDigits && cS) {
985 AliDebug(1,"Setting branch addresses");
986 for (int i=0; i<AliMUONConstants::NCh(); i++) {
987 sprintf(branchname,"%sSDigits%d",GetName(),i+1);
989 AliDebug(1,Form("TreeS=%p for ich=%d branchname=%s",
990 TreeS(),i,branchname));
991 branch = TreeS()->GetBranch(branchname);
992 TClonesArray * sdigits = SDigits(i);
993 if (branch) branch->SetAddress( &sdigits );
994 else AliWarning(Form("(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i));
1000 // Branch address for rawclusters, globaltrigger and local trigger tree
1002 if (fRawClusters == 0x0 && cRC) {
1003 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
1004 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
1005 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
1006 fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i);
1010 if (fLocalTrigger == 0x0 && cTC) {
1011 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
1013 if (fGlobalTrigger== 0x0 && cTC) {
1014 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
1018 if ( TreeR() && fRawClusters && cRC && !strstr(cRC,"RCC")) {
1019 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
1020 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
1022 branch = TreeR()->GetBranch(branchname);
1023 if (branch) branch->SetAddress( &((*fRawClusters)[i]) );
1024 else AliWarning(Form("(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i));
1028 if ( TreeR() && fLocalTrigger && cTC) {
1029 sprintf(branchname,"%sLocalTrigger",GetName());
1030 branch = TreeR()->GetBranch(branchname);
1031 if (branch) branch->SetAddress(&fLocalTrigger);
1032 else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeR.",GetName()));
1034 if ( TreeR() && fGlobalTrigger && cTC) {
1035 sprintf(branchname,"%sGlobalTrigger",GetName());
1036 branch = TreeR()->GetBranch(branchname);
1037 if (branch) branch->SetAddress(&fGlobalTrigger);
1038 else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeR.",GetName()));
1042 if (fRecTracks == 0x0 && cRT) {
1043 fRecTracks = new TClonesArray("AliMUONTrack",100);
1047 if ( TreeT() && fRecTracks && cRT ) {
1048 sprintf(branchname,"%sTrack",GetName());
1049 branch = TreeT()->GetBranch(branchname);
1050 if (branch) branch->SetAddress(&fRecTracks);
1051 else AliWarning(Form("(%s) Failed for Tracks. Can not find branch in tree.",GetName()));
1055 if (fRecTriggerTracks == 0x0 && cRL) {
1056 fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
1060 if ( TreeT() && fRecTriggerTracks && cRL ) {
1061 sprintf(branchname,"%sTriggerTrack",GetName());
1062 branch = TreeT()->GetBranch(branchname);
1063 if (branch) branch->SetAddress(&fRecTriggerTracks);
1064 else AliWarning(Form("(%s) Failed for Trigger Tracks. Can not find branch in tree.",GetName()));
1070 //_____________________________________________________________________________
1072 AliMUONData::Print(Option_t* opt) const
1074 TString options(opt);
1077 if ( options.Contains("D") )
1079 for ( Int_t ich = 0; ich < AliMUONConstants::NCh(); ++ich)
1081 TClonesArray* digits = Digits(ich);
1082 Int_t ndigits = digits->GetEntriesFast();
1083 for ( Int_t id = 0; id < ndigits; ++id )
1085 AliMUONDigit* digit =
1086 static_cast<AliMUONDigit*>(digits->UncheckedAt(id));
1092 if ( options.Contains("S") )
1094 for ( Int_t ich = 0; ich < AliMUONConstants::NCh(); ++ich)
1096 TClonesArray* digits = SDigits(ich);
1097 Int_t ndigits = digits->GetEntriesFast();
1098 for ( Int_t id = 0; id < ndigits; ++id )
1100 AliMUONDigit* digit =
1101 static_cast<AliMUONDigit*>(digits->UncheckedAt(id));