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
26 #include "AliMUONConstants.h"
27 #include "AliMUONData.h"
28 #include "AliMUONDigit.h"
29 #include "AliMUONHit.h"
30 #include "AliMUONLocalTrigger.h"
31 #include "AliMUONGlobalTrigger.h"
32 #include "AliMUONRawCluster.h"
33 #include "AliMUONTrack.h"
34 #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 Fatal("AliMUONData", "Not implemented.");
118 //_____________________________________________________________________________
119 AliMUONData::~AliMUONData()
121 // Destructor for AliMUONData
135 fRawClusters->Delete();
139 fGlobalTrigger->Delete();
140 delete fGlobalTrigger;
143 fLocalTrigger->Delete();
144 delete fLocalTrigger;
147 fRecTracks->Delete();
150 if (fRecTriggerTracks){
151 fRecTriggerTracks->Delete();
152 delete fRecTriggerTracks;
157 //_____________________________________________________________________________
158 AliMUONData& AliMUONData::operator=(const AliMUONData& rhs)
160 // Protected assignement operator
162 if (this == &rhs) return *this;
164 Fatal("operator=", "Not implemented.");
170 //_____________________________________________________________________________
171 void AliMUONData::AddDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
174 // Add a MUON digit to the list of Digits of the detection plane id
176 TClonesArray &ldigits = * Digits(id) ;
177 new(ldigits[fNdigits[id]++]) AliMUONDigit(tracks,charges,digits);
179 //_____________________________________________________________________________
180 void AliMUONData::AddDigit(Int_t id, const AliMUONDigit& digit)
183 // Add a MUON digit to the list of Digits of the detection plane id
185 TClonesArray &ldigits = * Digits(id) ;
186 new(ldigits[fNdigits[id]++]) AliMUONDigit(digit);
188 //_____________________________________________________________________________
189 void AliMUONData::AddSDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *sdigits)
192 // Add a MUON Sdigit to the list of SDigits of the detection plane id
194 TClonesArray &lSdigits = * SDigits(id) ;
195 new(lSdigits[fNSdigits[id]++]) AliMUONDigit(tracks,charges,sdigits);
197 //_____________________________________________________________________________
198 void AliMUONData::AddSDigit(Int_t id, const AliMUONDigit& Sdigit)
201 // Add a MUON Sdigit to the list of SDigits of the detection plane id
203 TClonesArray &lSdigits = * SDigits(id) ;
204 new(lSdigits[fNSdigits[id]++]) AliMUONDigit(Sdigit);
206 //_____________________________________________________________________________
207 void AliMUONData::AddGlobalTrigger(Int_t *singlePlus, Int_t *singleMinus,
209 Int_t *pairUnlike, Int_t *pairLike)
211 // add a MUON Global Trigger to the list (only one GlobalTrigger per event !)
213 TClonesArray &globalTrigger = *fGlobalTrigger;
214 new(globalTrigger[fNglobaltrigger++])
215 AliMUONGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike);
217 //_____________________________________________________________________________
218 void AliMUONData::AddGlobalTrigger(const AliMUONGlobalTrigger& trigger )
220 // add a MUON Global Trigger to the list (only one GlobalTrigger per event !);
221 TClonesArray &globalTrigger = *fGlobalTrigger;
222 new(globalTrigger[fNglobaltrigger++]) AliMUONGlobalTrigger(trigger);
224 //_____________________________________________________________________________
225 void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber,
226 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
227 Float_t tof, Float_t momentum, Float_t theta,
228 Float_t phi, Float_t length, Float_t destep)
230 // Add new hit to the hit list
231 TClonesArray &lhits = *fHits;
232 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber,
234 tof, momentum, theta,
235 phi, length, destep);
237 //____________________________________________________________________________
238 void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber,
239 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
240 Float_t tof, Float_t momentum, Float_t theta,
241 Float_t phi, Float_t length, Float_t destep,
242 Float_t Xref,Float_t Yref,Float_t Zref)
244 // Add new hit to the hit list
245 TClonesArray &lhits = *fHits;
246 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber,
248 tof, momentum, theta,
252 //____________________________________________________________________________
253 void AliMUONData::AddHit(const AliMUONHit& hit)
255 TClonesArray &lhits = *fHits;
256 new(lhits[fNhits++]) AliMUONHit(hit);
258 //____________________________________________________________________________
259 void AliMUONData::AddLocalTrigger(Int_t *localtr)
261 // add a MUON Local Trigger to the list
262 TClonesArray &localTrigger = *fLocalTrigger;
263 new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(localtr);
265 //____________________________________________________________________________
266 void AliMUONData::AddLocalTrigger(const AliMUONLocalTrigger& trigger)
268 // add a MUON Local Trigger to the list
269 TClonesArray &localTrigger = *fLocalTrigger;
270 new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(trigger);
272 //_____________________________________________________________________________
273 void AliMUONData::AddRawCluster(Int_t id, const AliMUONRawCluster& c)
276 // Add a MUON rawcluster to the list in the detection plane id
278 TClonesArray &lrawcl = *((TClonesArray*) fRawClusters->At(id));
279 new(lrawcl[fNrawclusters[id]++]) AliMUONRawCluster(c);
281 //_____________________________________________________________________________
282 void AliMUONData::AddRecTrack(const AliMUONTrack& track)
285 // Add a MUON rectrack
287 TClonesArray &lrectracks = *fRecTracks;
288 new(lrectracks[fNrectracks++]) AliMUONTrack(track);
289 // printf("TTTTTT %d ,\n",((AliMUONTrack*)fRecTracks->At(fNrectracks-1))->GetNTrackHits());
291 //_____________________________________________________________________________
292 void AliMUONData::AddRecTriggerTrack(const AliMUONTriggerTrack& triggertrack)
295 // Add a MUON triggerrectrack
297 TClonesArray &lrectriggertracks = *fRecTriggerTracks;
298 new(lrectriggertracks[fNrectriggertracks++]) AliMUONTriggerTrack(triggertrack);
299 // printf("TTTTTT %d ,\n",((AliMUONTrack*)fRecTracks->At(fNrectracks-1))->GetNTrackHits());
302 //____________________________________________________________________________
303 TClonesArray* AliMUONData::Digits(Int_t DetectionPlane)
305 //Getting List of Digits
307 return ( (TClonesArray*) fDigits->At(DetectionPlane) );
311 //____________________________________________________________________________
312 TClonesArray* AliMUONData::SDigits(Int_t DetectionPlane)
314 //Getting List of SDigits
316 return ( (TClonesArray*) fSDigits->At(DetectionPlane) );
320 //____________________________________________________________________________
321 Bool_t AliMUONData::IsRawClusterBranchesInTree()
323 // Checking if there are RawCluster Branches In TreeR
325 Error("TreeR","No treeR in memory");
330 sprintf(branchname,"%sRawClusters1",GetName());
331 TBranch * branch = 0x0;
332 branch = TreeR()->GetBranch(branchname);
333 if (branch) return kTRUE;
337 //____________________________________________________________________________
338 Bool_t AliMUONData::IsDigitsBranchesInTree()
340 // Checking if there are RawCluster Branches In TreeR
342 Error("TreeD","No treeD in memory");
347 sprintf(branchname,"%sDigits1",GetName());
348 TBranch * branch = 0x0;
349 branch = TreeD()->GetBranch(branchname);
350 if (branch) return kTRUE;
354 //____________________________________________________________________________
355 Bool_t AliMUONData::IsTriggerBranchesInTree()
357 // Checking if there are Trigger Branches In TreeR
359 Error("TreeR","No treeR in memory");
364 sprintf(branchname,"%sLocalTrigger",GetName());
365 TBranch * branch = 0x0;
366 branch = TreeR()->GetBranch(branchname);
367 if (branch) return kTRUE;
371 //____________________________________________________________________________
372 Bool_t AliMUONData::IsTriggerBranchesInTreeD()
374 // Checking if there are Trigger Branches In TreeR
376 Error("TreeD","No treeD in memory");
381 sprintf(branchname,"%sLocalTrigger",GetName());
382 TBranch * branch = 0x0;
383 branch = TreeD()->GetBranch(branchname);
384 if (branch) return kTRUE;
389 //____________________________________________________________________________
390 Bool_t AliMUONData::IsTrackBranchesInTree()
392 // Checking if there are Track Branches In TreeT
394 Error("TreeT","No treeT in memory");
399 sprintf(branchname,"%sTrack",GetName());
400 TBranch * branch = 0x0;
401 branch = TreeT()->GetBranch(branchname);
402 if (branch) return kTRUE;
406 //____________________________________________________________________________
407 Bool_t AliMUONData::IsTriggerTrackBranchesInTree()
409 // Checking if there are TriggerTrack Branches In TreeT
411 Error("TreeT","No treeT in memory");
416 sprintf(branchname,"%sTriggerTrack",GetName());
417 TBranch * branch = 0x0;
418 branch = TreeT()->GetBranch(branchname);
419 if (branch) return kTRUE;
423 //____________________________________________________________________________
424 void AliMUONData::Fill(Option_t* option)
426 // Method to fill the trees
427 const char *cH = strstr(option,"H");
428 const char *cD = strstr(option,"D"); // Digits branches in TreeD
429 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
430 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
431 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
432 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
433 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
434 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
436 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
439 TBranch * branch = 0x0;
442 if ( TreeH() && cH ) {
448 if ( TreeD() && cD ) {
449 if ( IsTriggerBranchesInTreeD() ) {
450 for (int i=0; i<AliMUONConstants::NCh(); i++) {
451 sprintf(branchname,"%sDigits%d",GetName(),i+1);
452 branch = TreeD()->GetBranch(branchname);
460 if ( TreeD() && cGLT ) {
461 if ( IsDigitsBranchesInTree() ) {
462 sprintf(branchname,"%sLocalTrigger",GetName());
463 branch = TreeD()->GetBranch(branchname);
465 sprintf(branchname,"%sGlobalTrigger",GetName());
466 branch = TreeD()->GetBranch(branchname);
473 if ( TreeS() && cS) {
478 // filling rawclusters
479 if ( TreeR() && cRC ) {
480 if ( IsTriggerBranchesInTree() ) {
481 // Branch per branch filling
482 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
483 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
484 branch = TreeR()->GetBranch(branchname);
488 else TreeR()->Fill();
493 if ( TreeR() && cTC) {
494 if (IsRawClusterBranchesInTree()) {
495 // Branch per branch filling
496 sprintf(branchname,"%sLocalTrigger",GetName());
497 branch = TreeR()->GetBranch(branchname);
499 sprintf(branchname,"%sGlobalTrigger",GetName());
500 branch = TreeR()->GetBranch(branchname);
503 else TreeR()->Fill();
507 if ( TreeT() && cRT ) {
508 if (IsTriggerTrackBranchesInTree()) {
509 sprintf(branchname,"%sTrack",GetName());
510 branch = TreeT()->GetBranch(branchname);
513 else TreeT()->Fill();
515 // filling trigger tracks
516 if ( TreeT() && cRL ) {
517 if (IsTrackBranchesInTree()) {
518 sprintf(branchname,"%sTriggerTrack",GetName());
519 branch = TreeT()->GetBranch(branchname);
522 else TreeT()->Fill();
524 // if ( TreeT() && cRL ) {
525 // sprintf(branchname,"%sTrackTrig",GetName());
529 //_____________________________________________________________________________
530 void AliMUONData::MakeBranch(Option_t* option)
533 // Create Tree branches for the MUON.
535 const Int_t kBufferSize = 4000;
539 const char *cH = strstr(option,"H");
540 const char *cD = strstr(option,"D"); // Digits branches in TreeD
541 const char *cS = strstr(option,"S"); // Digits branches in TreeS
542 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
543 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
544 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
545 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
546 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
547 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
549 TBranch * branch = 0x0;
551 // Creating Branches for Hits
555 fHits = new TClonesArray("AliMUONHit",1000);
556 // if (gAlice->GetMCApp())
557 // gAlice->GetMCApp()->AddHitList (fHits);
561 sprintf(branchname,"%sHits",GetName());
562 branch = TreeH()->GetBranch(branchname);
564 Info("MakeBranch","Branch %s is already in tree.",GetName());
567 branch = TreeH()->Branch(branchname,&fHits,kBufferSize);
568 //Info("MakeBranch","Making Branch %s for hits \n",branchname);
571 //Creating Branches for Digits
572 if (TreeD() && cD ) {
573 // one branch for digits per chamber
574 if (fDigits == 0x0) {
575 fDigits = new TObjArray(AliMUONConstants::NCh());
576 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
577 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
579 fDigits->AddAt(tca,iDetectionPlane);
582 if (fNdigits == 0x0) {
583 fNdigits = new Int_t[AliMUONConstants::NCh()];
584 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
585 fNdigits[iDetectionPlane]=0;
588 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
589 sprintf(branchname,"%sDigits%d",GetName(),iDetectionPlane+1);
591 branch = TreeD()->GetBranch(branchname);
593 Info("MakeBranch","Branch %s is already in tree.",GetName());
596 TClonesArray * digits = Digits(iDetectionPlane);
597 branch = TreeD()->Branch(branchname, &digits, kBufferSize,1);
598 //Info("MakeBranch","Making Branch %s for digits in detection plane %d\n",branchname,iDetectionPlane+1);
602 if (TreeD() && cGLT ) {
604 // one branch for global trigger
606 sprintf(branchname,"%sGlobalTrigger",GetName());
609 if (fGlobalTrigger == 0x0) {
610 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger");
613 branch = TreeD()->GetBranch(branchname);
615 Info("MakeBranch","Branch GlobalTrigger is already in treeD.");
618 branch = TreeD()->Branch(branchname, &fGlobalTrigger, kBufferSize);
619 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
622 // one branch for local trigger
624 sprintf(branchname,"%sLocalTrigger",GetName());
627 if (fLocalTrigger == 0x0) {
628 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
631 branch = TreeD()->GetBranch(branchname);
633 Info("MakeBranch","Branch LocalTrigger is already in treeD.");
636 branch = TreeD()->Branch(branchname, &fLocalTrigger, kBufferSize);
637 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
641 //Creating Branches for SDigits
642 if (TreeS() && cS ) {
643 // one branch for Sdigits per chamber
644 if (fSDigits == 0x0) {
645 fSDigits = new TObjArray(AliMUONConstants::NCh());
646 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
647 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
649 fSDigits->AddAt(tca,iDetectionPlane);
652 if (fNSdigits == 0x0) {
653 fNSdigits = new Int_t[AliMUONConstants::NCh()];
654 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
655 fNSdigits[iDetectionPlane]=0;
658 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
659 sprintf(branchname,"%sSDigits%d",GetName(),iDetectionPlane+1);
661 branch = TreeS()->GetBranch(branchname);
663 Info("MakeBranch","Branch %s is already in tree.",GetName());
666 TClonesArray * sdigits = SDigits(iDetectionPlane);
667 branch = TreeS()->Branch(branchname, &sdigits, kBufferSize,1);
668 //Info("MakeBranch","Making Branch %s for sdigits in detection plane %d\n",branchname,iDetectionPlane+1);
672 if (TreeR() && cRC ) {
673 // one branch for raw clusters per tracking detection plane
676 if (fRawClusters == 0x0) {
677 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
678 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
679 TClonesArray * tca = new TClonesArray("AliMUONRawCluster",1000);
681 fRawClusters->AddAt(tca,i);
685 if (fNrawclusters == 0x0) {
686 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
687 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
692 for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) {
693 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
695 branch = TreeR()->GetBranch(branchname);
697 Info("MakeBranch","Branch %s is already in tree.",GetName());
700 branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize);
701 //Info("MakeBranch","Making Branch %s for rawcluster in detection plane %d\n",branchname,i+1);
705 if (TreeR() && cTC ) {
707 // one branch for global trigger
709 sprintf(branchname,"%sGlobalTrigger",GetName());
712 if (fGlobalTrigger == 0x0) {
713 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger");
716 branch = TreeR()->GetBranch(branchname);
718 Info("MakeBranch","Branch GlobalTrigger is already in treeR.");
721 branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize);
722 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
725 // one branch for local trigger
727 sprintf(branchname,"%sLocalTrigger",GetName());
730 if (fLocalTrigger == 0x0) {
731 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
734 branch = TreeR()->GetBranch(branchname);
736 Info("MakeBranch","Branch LocalTrigger is already in treeR.");
739 branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize);
740 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
743 if (TreeT() && cRT ) {
744 if (fRecTracks == 0x0) fRecTracks = new TClonesArray("AliMUONTrack",100);
746 sprintf(branchname,"%sTrack",GetName());
747 branch = TreeT()->GetBranch(branchname);
749 Info("MakeBranch","Branch %s is already in tree.",GetName());
752 branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize);
753 //Info("MakeBranch","Making Branch %s for tracks \n",branchname);
756 if (TreeT() && cRL ) {
757 if (fRecTriggerTracks == 0x0) fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
758 fNrectriggertracks = 0;
759 sprintf(branchname,"%sTriggerTrack",GetName());
760 branch = TreeT()->GetBranch(branchname);
762 Info("MakeBranch","Branch %s is already in tree.",GetName());
765 branch = TreeT()->Branch(branchname,&fRecTriggerTracks,kBufferSize);
766 //Info("MakeBranch","Making Branch %s for trigger tracks \n",branchname);
769 //____________________________________________________________________________
770 TClonesArray* AliMUONData::RawClusters(Int_t DetectionPlane)
772 // Getting Raw Clusters
774 return ( (TClonesArray*) fRawClusters->At(DetectionPlane) );
778 //____________________________________________________________________________
779 TClonesArray* AliMUONData::LocalTrigger()
781 // Getting Local Trigger
783 return ( (TClonesArray*) fLocalTrigger );
787 //____________________________________________________________________________
788 TClonesArray* AliMUONData::GlobalTrigger()
790 // Getting Global Trigger
792 return ( (TClonesArray*) fGlobalTrigger );
796 //____________________________________________________________________________
797 void AliMUONData::ResetDigits()
800 // Reset number of digits and the digits array for this detector
802 if (fDigits == 0x0) return;
803 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
804 if ((*fDigits)[i]) ((TClonesArray*)fDigits->At(i))->Clear();
805 if (fNdigits) fNdigits[i]=0;
808 //____________________________________________________________________________
809 void AliMUONData::ResetSDigits()
812 // Reset number of Sdigits and the Sdigits array for this detector
814 if (fSDigits == 0x0) return;
815 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
816 if ((*fSDigits)[i]) ((TClonesArray*)fSDigits->At(i))->Clear();
817 if (fNSdigits) fNSdigits[i]=0;
820 //______________________________________________________________________________
821 void AliMUONData::ResetHits()
823 // Reset number of clusters and the cluster array for this detector
825 if (fHits) fHits->Clear();
827 //_______________________________________________________________________________
828 void AliMUONData::ResetRawClusters()
830 // Reset number of raw clusters and the raw clust array for this detector
832 for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) {
833 if ((*fRawClusters)[i]) ((TClonesArray*)fRawClusters->At(i))->Clear();
834 if (fNrawclusters) fNrawclusters[i]=0;
837 //_______________________________________________________________________________
838 void AliMUONData::ResetTrigger()
840 // Reset Local and Global Trigger
842 if (fGlobalTrigger) fGlobalTrigger->Clear();
844 if (fLocalTrigger) fLocalTrigger->Clear();
846 //____________________________________________________________________________
847 void AliMUONData::ResetRecTracks()
849 // Reset tracks information
851 if (fRecTracks) fRecTracks->Clear();
853 //____________________________________________________________________________
854 void AliMUONData::ResetRecTriggerTracks()
856 // Reset tracks information
857 fNrectriggertracks = 0;
858 if (fRecTriggerTracks) fRecTriggerTracks->Clear();
860 //_____________________________________________________________________________
861 void AliMUONData::SetTreeAddress(Option_t* option)
863 //Setting Addresses to the events trees
864 const char *cH = strstr(option,"H");
865 const char *cD = strstr(option,"D"); // Digits branches in TreeD
866 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
867 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
868 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
869 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
870 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
871 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
872 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
874 // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree.
876 TBranch * branch = 0x0;
879 // Branch address for hit tree
880 if ( TreeH() && cH ) {
882 fHits = new TClonesArray("AliMUONHit",1000);
883 // if (gAlice->GetMCApp())
884 // gAlice->GetMCApp()->AddHitList (fHits); Moved to AliMUON
888 if (TreeH() && fHits && cH) {
889 sprintf(branchname,"%sHits",GetName());
890 branch = TreeH()->GetBranch(branchname);
892 // Info("SetTreeAddress","(%s) Setting for Hits",GetName());
893 branch->SetAddress(&fHits);
895 else { //can be invoked before branch creation
896 Warning("SetTreeAddress","(%s) Failed for Hits. Can not find branch in tree.",GetName());
901 // Branch address for digit tree
903 if (fDigits == 0x0 && cD) {
904 fDigits = new TObjArray(AliMUONConstants::NCh());
905 fNdigits= new Int_t[AliMUONConstants::NCh()];
906 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
907 fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i);
911 if (fLocalTrigger == 0x0 && cGLT) {
912 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
914 if (fGlobalTrigger== 0x0 && cGLT) {
915 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
919 if (TreeD() && fDigits && cD) {
920 for (int i=0; i<AliMUONConstants::NCh(); i++) {
921 sprintf(branchname,"%sDigits%d",GetName(),i+1);
923 branch = TreeD()->GetBranch(branchname);
924 TClonesArray * digits = Digits(i);
926 branch->SetAddress( &digits );
928 else Warning("SetTreeAddress","(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i);
932 if ( TreeD() && fLocalTrigger && cGLT) {
933 sprintf(branchname,"%sLocalTrigger",GetName());
934 branch = TreeD()->GetBranch(branchname);
935 if (branch) branch->SetAddress(&fLocalTrigger);
936 else Warning("SetTreeAddress","(%s) Failed for LocalTrigger. Can not find branch in treeD.",GetName());
938 if ( TreeD() && fGlobalTrigger && cGLT) {
939 sprintf(branchname,"%sGlobalTrigger",GetName());
940 branch = TreeD()->GetBranch(branchname);
941 if (branch) branch->SetAddress(&fGlobalTrigger);
942 else Warning("SetTreeAddress","(%s) Failed for GlobalTrigger. Can not find branch in treeD.",GetName());
946 // Branch address for Sdigit tree
947 if ( TreeS() && cS) {
948 if (fSDigits == 0x0) {
949 fSDigits = new TObjArray(AliMUONConstants::NCh());
950 fNSdigits= new Int_t[AliMUONConstants::NCh()];
951 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
952 fSDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i);
958 if (TreeS() && fSDigits && cS) {
959 for (int i=0; i<AliMUONConstants::NCh(); i++) {
960 sprintf(branchname,"%sSDigits%d",GetName(),i+1);
962 branch = TreeS()->GetBranch(branchname);
963 TClonesArray * sdigits = SDigits(i);
964 if (branch) branch->SetAddress( &sdigits );
965 else Warning("SetTreeAddress","(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i);
971 // Branch address for rawclusters, globaltrigger and local trigger tree
973 if (fRawClusters == 0x0 && cRC) {
974 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
975 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
976 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
977 fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i);
981 if (fLocalTrigger == 0x0 && cTC) {
982 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
984 if (fGlobalTrigger== 0x0 && cTC) {
985 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
989 if ( TreeR() && fRawClusters && cRC) {
990 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
991 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
993 branch = TreeR()->GetBranch(branchname);
994 if (branch) branch->SetAddress( &((*fRawClusters)[i]) );
995 else Warning("SetTreeAddress","(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i);
999 if ( TreeR() && fLocalTrigger && cTC) {
1000 sprintf(branchname,"%sLocalTrigger",GetName());
1001 branch = TreeR()->GetBranch(branchname);
1002 if (branch) branch->SetAddress(&fLocalTrigger);
1003 else Warning("SetTreeAddress","(%s) Failed for LocalTrigger. Can not find branch in treeR.",GetName());
1005 if ( TreeR() && fGlobalTrigger && cTC) {
1006 sprintf(branchname,"%sGlobalTrigger",GetName());
1007 branch = TreeR()->GetBranch(branchname);
1008 if (branch) branch->SetAddress(&fGlobalTrigger);
1009 else Warning("SetTreeAddress","(%s) Failed for GlobalTrigger. Can not find branch in treeR.",GetName());
1013 if (fRecTracks == 0x0 && cRT) {
1014 fRecTracks = new TClonesArray("AliMUONTrack",100);
1018 if ( TreeT() && fRecTracks && cRT ) {
1019 sprintf(branchname,"%sTrack",GetName());
1020 branch = TreeT()->GetBranch(branchname);
1021 if (branch) branch->SetAddress(&fRecTracks);
1022 else Warning("SetTreeAddress","(%s) Failed for Tracks. Can not find branch in tree.",GetName());
1026 if (fRecTriggerTracks == 0x0 && cRL) {
1027 fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
1031 if ( TreeT() && fRecTriggerTracks && cRL ) {
1032 sprintf(branchname,"%sTriggerTrack",GetName());
1033 branch = TreeT()->GetBranch(branchname);
1034 if (branch) branch->SetAddress(&fRecTriggerTracks);
1035 else Warning("SetTreeAddress","(%s) Failed for Trigger Tracks. Can not find branch in tree.",GetName());
1040 //_____________________________________________________________________________