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 !)
212 TClonesArray &globalTrigger = *fGlobalTrigger;
213 new(globalTrigger[fNglobaltrigger++])
214 AliMUONGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike);
216 //_____________________________________________________________________________
217 void AliMUONData::AddGlobalTrigger(const AliMUONGlobalTrigger& trigger )
219 // add a MUON Global Trigger to the list (only one GlobalTrigger per event !)
220 TClonesArray &globalTrigger = *fGlobalTrigger;
221 new(globalTrigger[fNglobaltrigger++]) AliMUONGlobalTrigger(trigger);
223 //_____________________________________________________________________________
224 void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber,
225 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
226 Float_t tof, Float_t momentum, Float_t theta,
227 Float_t phi, Float_t length, Float_t destep)
229 // Add new hit to the hit list
230 TClonesArray &lhits = *fHits;
231 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber,
233 tof, momentum, theta,
234 phi, length, destep);
236 //____________________________________________________________________________
237 void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber,
238 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
239 Float_t tof, Float_t momentum, Float_t theta,
240 Float_t phi, Float_t length, Float_t destep,
241 Float_t Xref,Float_t Yref,Float_t Zref)
243 // Add new hit to the hit list
244 TClonesArray &lhits = *fHits;
245 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber,
247 tof, momentum, theta,
251 //____________________________________________________________________________
252 void AliMUONData::AddHit(const AliMUONHit& hit)
254 TClonesArray &lhits = *fHits;
255 new(lhits[fNhits++]) AliMUONHit(hit);
257 //____________________________________________________________________________
258 void AliMUONData::AddLocalTrigger(Int_t *localtr)
260 // add a MUON Local Trigger to the list
261 TClonesArray &localTrigger = *fLocalTrigger;
262 new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(localtr);
264 //____________________________________________________________________________
265 void AliMUONData::AddLocalTrigger(const AliMUONLocalTrigger& trigger)
267 // add a MUON Local Trigger to the list
268 TClonesArray &localTrigger = *fLocalTrigger;
269 new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(trigger);
271 //_____________________________________________________________________________
272 void AliMUONData::AddRawCluster(Int_t id, const AliMUONRawCluster& c)
275 // Add a MUON rawcluster to the list in the detection plane id
277 TClonesArray &lrawcl = *((TClonesArray*) fRawClusters->At(id));
278 new(lrawcl[fNrawclusters[id]++]) AliMUONRawCluster(c);
280 //_____________________________________________________________________________
281 void AliMUONData::AddRecTrack(const AliMUONTrack& track)
284 // Add a MUON rectrack
286 TClonesArray &lrectracks = *fRecTracks;
287 new(lrectracks[fNrectracks++]) AliMUONTrack(track);
288 // printf("TTTTTT %d ,\n",((AliMUONTrack*)fRecTracks->At(fNrectracks-1))->GetNTrackHits());
290 //_____________________________________________________________________________
291 void AliMUONData::AddRecTriggerTrack(const AliMUONTriggerTrack& triggertrack)
294 // Add a MUON triggerrectrack
296 TClonesArray &lrectriggertracks = *fRecTriggerTracks;
297 new(lrectriggertracks[fNrectriggertracks++]) AliMUONTriggerTrack(triggertrack);
298 // printf("TTTTTT %d ,\n",((AliMUONTrack*)fRecTracks->At(fNrectracks-1))->GetNTrackHits());
301 //____________________________________________________________________________
302 TClonesArray* AliMUONData::Digits(Int_t DetectionPlane)
304 //Getting List of Digits
306 return ( (TClonesArray*) fDigits->At(DetectionPlane) );
310 //____________________________________________________________________________
311 TClonesArray* AliMUONData::SDigits(Int_t DetectionPlane)
313 //Getting List of SDigits
315 return ( (TClonesArray*) fSDigits->At(DetectionPlane) );
319 //____________________________________________________________________________
320 Bool_t AliMUONData::IsRawClusterBranchesInTree()
322 // Checking if there are RawCluster Branches In TreeR
324 Error("TreeR","No treeR in memory");
329 sprintf(branchname,"%sRawClusters1",GetName());
330 TBranch * branch = 0x0;
331 branch = TreeR()->GetBranch(branchname);
332 if (branch) return kTRUE;
336 //____________________________________________________________________________
337 Bool_t AliMUONData::IsTriggerBranchesInTree()
339 // Checking if there are Trigger Branches In TreeR
341 Error("TreeR","No treeR in memory");
346 sprintf(branchname,"%sLocalTrigger",GetName());
347 TBranch * branch = 0x0;
348 branch = TreeR()->GetBranch(branchname);
349 if (branch) return kTRUE;
353 //____________________________________________________________________________
354 Bool_t AliMUONData::IsTrackBranchesInTree()
356 // Checking if there are Track Branches In TreeT
358 Error("TreeT","No treeT in memory");
363 sprintf(branchname,"%sTrack",GetName());
364 TBranch * branch = 0x0;
365 branch = TreeT()->GetBranch(branchname);
366 if (branch) return kTRUE;
370 //____________________________________________________________________________
371 Bool_t AliMUONData::IsTriggerTrackBranchesInTree()
373 // Checking if there are TriggerTrack Branches In TreeT
375 Error("TreeT","No treeT in memory");
380 sprintf(branchname,"%sTriggerTrack",GetName());
381 TBranch * branch = 0x0;
382 branch = TreeT()->GetBranch(branchname);
383 if (branch) return kTRUE;
387 //____________________________________________________________________________
388 void AliMUONData::Fill(Option_t* option)
390 // Method to fill the trees
391 const char *cH = strstr(option,"H");
392 const char *cD = strstr(option,"D"); // Digits branches in TreeD
393 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
394 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
395 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR
396 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
397 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
399 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
402 TBranch * branch = 0x0;
406 if ( TreeH() && cH ) {
411 if ( TreeD() && cD) {
415 if ( TreeS() && cS) {
420 // filling rawclusters
421 if ( TreeR() && cRC ) {
422 if ( IsTriggerBranchesInTree() ) {
423 // Branch per branch filling
424 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
425 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
426 branch = TreeR()->GetBranch(branchname);
430 else TreeR()->Fill();
435 if ( TreeR() && cGLT) {
436 if (IsRawClusterBranchesInTree()) {
437 // Branch per branch filling
438 sprintf(branchname,"%sLocalTrigger",GetName());
439 branch = TreeR()->GetBranch(branchname);
441 sprintf(branchname,"%sGlobalTrigger",GetName());
442 branch = TreeR()->GetBranch(branchname);
445 else TreeR()->Fill();
449 if ( TreeT() && cRT ) {
450 if (IsTriggerTrackBranchesInTree()) {
451 sprintf(branchname,"%sTrack",GetName());
452 branch = TreeT()->GetBranch(branchname);
455 else TreeT()->Fill();
457 // filling trigger tracks
458 if ( TreeT() && cRL ) {
459 if (IsTrackBranchesInTree()) {
460 sprintf(branchname,"%sTriggerTrack",GetName());
461 branch = TreeT()->GetBranch(branchname);
464 else TreeT()->Fill();
466 // if ( TreeT() && cRL ) {
467 // sprintf(branchname,"%sTrackTrig",GetName());
471 //_____________________________________________________________________________
472 void AliMUONData::MakeBranch(Option_t* option)
475 // Create Tree branches for the MUON.
477 const Int_t kBufferSize = 4000;
481 const char *cH = strstr(option,"H");
482 const char *cD = strstr(option,"D"); // Digits branches in TreeD
483 const char *cS = strstr(option,"S"); // Digits branches in TreeS
484 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
485 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR
486 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
487 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
488 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
490 TBranch * branch = 0x0;
492 // Creating Branches for Hits
496 fHits = new TClonesArray("AliMUONHit",1000);
497 // if (gAlice->GetMCApp())
498 // gAlice->GetMCApp()->AddHitList (fHits);
502 sprintf(branchname,"%sHits",GetName());
503 branch = TreeH()->GetBranch(branchname);
505 Info("MakeBranch","Branch %s is already in tree.",GetName());
508 branch = TreeH()->Branch(branchname,&fHits,kBufferSize);
509 //Info("MakeBranch","Making Branch %s for hits \n",branchname);
512 //Creating Branches for Digits
513 if (TreeD() && cD ) {
514 // one branch for digits per chamber
515 if (fDigits == 0x0) {
516 fDigits = new TObjArray(AliMUONConstants::NCh());
517 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
518 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
520 fDigits->AddAt(tca,iDetectionPlane);
523 if (fNdigits == 0x0) {
524 fNdigits = new Int_t[AliMUONConstants::NCh()];
525 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
526 fNdigits[iDetectionPlane]=0;
529 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
530 sprintf(branchname,"%sDigits%d",GetName(),iDetectionPlane+1);
532 branch = TreeD()->GetBranch(branchname);
534 Info("MakeBranch","Branch %s is already in tree.",GetName());
537 TClonesArray * digits = Digits(iDetectionPlane);
538 branch = TreeD()->Branch(branchname, &digits, kBufferSize,1);
539 //Info("MakeBranch","Making Branch %s for digits in detection plane %d\n",branchname,iDetectionPlane+1);
543 //Creating Branches for SDigits
544 if (TreeS() && cS ) {
545 // one branch for Sdigits per chamber
546 if (fSDigits == 0x0) {
547 fSDigits = new TObjArray(AliMUONConstants::NCh());
548 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
549 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
551 fSDigits->AddAt(tca,iDetectionPlane);
554 if (fNSdigits == 0x0) {
555 fNSdigits = new Int_t[AliMUONConstants::NCh()];
556 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
557 fNSdigits[iDetectionPlane]=0;
560 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
561 sprintf(branchname,"%sSDigits%d",GetName(),iDetectionPlane+1);
563 branch = TreeS()->GetBranch(branchname);
565 Info("MakeBranch","Branch %s is already in tree.",GetName());
568 TClonesArray * sdigits = SDigits(iDetectionPlane);
569 branch = TreeS()->Branch(branchname, &sdigits, kBufferSize,1);
570 //Info("MakeBranch","Making Branch %s for sdigits in detection plane %d\n",branchname,iDetectionPlane+1);
574 if (TreeR() && cRC ) {
575 // one branch for raw clusters per tracking detection plane
578 if (fRawClusters == 0x0) {
579 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
580 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
581 TClonesArray * tca = new TClonesArray("AliMUONRawCluster",1000);
583 fRawClusters->AddAt(tca,i);
587 if (fNrawclusters == 0x0) {
588 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
589 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
594 for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) {
595 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
597 branch = TreeR()->GetBranch(branchname);
599 Info("MakeBranch","Branch %s is already in tree.",GetName());
602 branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize);
603 //Info("MakeBranch","Making Branch %s for rawcluster in detection plane %d\n",branchname,i+1);
607 if (TreeR() && cGLT ) {
609 // one branch for global trigger
611 sprintf(branchname,"%sGlobalTrigger",GetName());
614 if (fGlobalTrigger == 0x0) {
615 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger");
618 branch = TreeR()->GetBranch(branchname);
620 Info("MakeBranch","Branch %s is already in tree.",GetName());
623 branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize);
624 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
627 // one branch for local trigger
629 sprintf(branchname,"%sLocalTrigger",GetName());
632 if (fLocalTrigger == 0x0) {
633 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
636 branch = TreeR()->GetBranch(branchname);
638 Info("MakeBranch","Branch %s is already in tree.",GetName());
641 branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize);
642 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
645 if (TreeT() && cRT ) {
646 if (fRecTracks == 0x0) fRecTracks = new TClonesArray("AliMUONTrack",100);
648 sprintf(branchname,"%sTrack",GetName());
649 branch = TreeT()->GetBranch(branchname);
651 Info("MakeBranch","Branch %s is already in tree.",GetName());
654 branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize);
655 //Info("MakeBranch","Making Branch %s for tracks \n",branchname);
658 if (TreeT() && cRL ) {
659 if (fRecTriggerTracks == 0x0) fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
660 fNrectriggertracks = 0;
661 sprintf(branchname,"%sTriggerTrack",GetName());
662 branch = TreeT()->GetBranch(branchname);
664 Info("MakeBranch","Branch %s is already in tree.",GetName());
667 branch = TreeT()->Branch(branchname,&fRecTriggerTracks,kBufferSize);
668 //Info("MakeBranch","Making Branch %s for trigger tracks \n",branchname);
671 //____________________________________________________________________________
672 TClonesArray* AliMUONData::RawClusters(Int_t DetectionPlane)
674 // Getting Raw Clusters
676 return ( (TClonesArray*) fRawClusters->At(DetectionPlane) );
680 //____________________________________________________________________________
681 TClonesArray* AliMUONData::LocalTrigger()
683 // Getting Local Trigger
685 return ( (TClonesArray*) fLocalTrigger );
689 //____________________________________________________________________________
690 TClonesArray* AliMUONData::GlobalTrigger()
692 // Getting Global Trigger
694 return ( (TClonesArray*) fGlobalTrigger );
698 //____________________________________________________________________________
699 void AliMUONData::ResetDigits()
702 // Reset number of digits and the digits array for this detector
704 if (fDigits == 0x0) return;
705 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
706 if ((*fDigits)[i]) ((TClonesArray*)fDigits->At(i))->Clear();
707 if (fNdigits) fNdigits[i]=0;
710 //____________________________________________________________________________
711 void AliMUONData::ResetSDigits()
714 // Reset number of Sdigits and the Sdigits array for this detector
716 if (fSDigits == 0x0) return;
717 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
718 if ((*fSDigits)[i]) ((TClonesArray*)fSDigits->At(i))->Clear();
719 if (fNSdigits) fNSdigits[i]=0;
722 //______________________________________________________________________________
723 void AliMUONData::ResetHits()
725 // Reset number of clusters and the cluster array for this detector
727 if (fHits) fHits->Clear();
729 //_______________________________________________________________________________
730 void AliMUONData::ResetRawClusters()
732 // Reset number of raw clusters and the raw clust array for this detector
734 for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) {
735 if ((*fRawClusters)[i]) ((TClonesArray*)fRawClusters->At(i))->Clear();
736 if (fNrawclusters) fNrawclusters[i]=0;
739 //_______________________________________________________________________________
740 void AliMUONData::ResetTrigger()
742 // Reset Local and Global Trigger
744 if (fGlobalTrigger) fGlobalTrigger->Clear();
746 if (fLocalTrigger) fLocalTrigger->Clear();
748 //____________________________________________________________________________
749 void AliMUONData::ResetRecTracks()
751 // Reset tracks information
753 if (fRecTracks) fRecTracks->Clear();
755 //____________________________________________________________________________
756 void AliMUONData::ResetRecTriggerTracks()
758 // Reset tracks information
759 fNrectriggertracks = 0;
760 if (fRecTriggerTracks) fRecTriggerTracks->Clear();
762 //_____________________________________________________________________________
763 void AliMUONData::SetTreeAddress(Option_t* option)
765 //Setting Addresses to the events trees
766 const char *cH = strstr(option,"H");
767 const char *cD = strstr(option,"D"); // Digits branches in TreeD
768 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
769 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
770 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR
771 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
772 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
773 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
775 // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree.
777 TBranch * branch = 0x0;
780 // Branch address for hit tree
781 if ( TreeH() && cH ) {
783 fHits = new TClonesArray("AliMUONHit",1000);
784 // if (gAlice->GetMCApp())
785 // gAlice->GetMCApp()->AddHitList (fHits); Moved to AliMUON
789 if (TreeH() && fHits && cH) {
790 sprintf(branchname,"%sHits",GetName());
791 branch = TreeH()->GetBranch(branchname);
793 // Info("SetTreeAddress","(%s) Setting for Hits",GetName());
794 branch->SetAddress(&fHits);
796 else { //can be invoked before branch creation
797 Warning("SetTreeAddress","(%s) Failed for Hits. Can not find branch in tree.",GetName());
802 // Branch address for digit tree
803 if ( TreeD() && cD) {
804 if (fDigits == 0x0) {
805 fDigits = new TObjArray(AliMUONConstants::NCh());
806 fNdigits= new Int_t[AliMUONConstants::NCh()];
807 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
808 fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i);
814 if (TreeD() && fDigits && cD) {
815 for (int i=0; i<AliMUONConstants::NCh(); i++) {
816 sprintf(branchname,"%sDigits%d",GetName(),i+1);
818 branch = TreeD()->GetBranch(branchname);
819 TClonesArray * digits = Digits(i);
821 branch->SetAddress( &digits );
823 else Warning("SetTreeAddress","(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i);
828 // Branch address for Sdigit tree
829 if ( TreeS() && cS) {
830 if (fSDigits == 0x0) {
831 fSDigits = new TObjArray(AliMUONConstants::NCh());
832 fNSdigits= new Int_t[AliMUONConstants::NCh()];
833 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
834 fSDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i);
840 if (TreeS() && fSDigits && cS) {
841 for (int i=0; i<AliMUONConstants::NCh(); i++) {
842 sprintf(branchname,"%sSDigits%d",GetName(),i+1);
844 branch = TreeS()->GetBranch(branchname);
845 TClonesArray * sdigits = SDigits(i);
846 if (branch) branch->SetAddress( &sdigits );
847 else Warning("SetTreeAddress","(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i);
853 // Branch address for rawclusters, globaltrigger and local trigger tree
855 if (fRawClusters == 0x0 && cRC) {
856 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
857 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
858 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
859 fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i);
863 if (fLocalTrigger == 0x0 && cGLT) {
864 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
866 if (fGlobalTrigger== 0x0 && cGLT) {
867 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
871 if ( TreeR() && fRawClusters && cRC) {
872 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
873 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
875 branch = TreeR()->GetBranch(branchname);
876 if (branch) branch->SetAddress( &((*fRawClusters)[i]) );
877 else Warning("SetTreeAddress","(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i);
881 if ( TreeR() && fLocalTrigger && cGLT) {
882 sprintf(branchname,"%sLocalTrigger",GetName());
883 branch = TreeR()->GetBranch(branchname);
884 if (branch) branch->SetAddress(&fLocalTrigger);
885 else Warning("SetTreeAddress","(%s) Failed for LocalTrigger. Can not find branch in tree.",GetName());
887 if ( TreeR() && fGlobalTrigger && cGLT) {
888 sprintf(branchname,"%sGlobalTrigger",GetName());
889 branch = TreeR()->GetBranch(branchname);
890 if (branch) branch->SetAddress(&fGlobalTrigger);
891 else Warning("SetTreeAddress","(%s) Failed for LocalTrigger. Can not find branch in tree.",GetName());
895 if (fRecTracks == 0x0 && cRT) {
896 fRecTracks = new TClonesArray("AliMUONTrack",100);
900 if ( TreeT() && fRecTracks && cRT ) {
901 sprintf(branchname,"%sTrack",GetName());
902 branch = TreeT()->GetBranch(branchname);
903 if (branch) branch->SetAddress(&fRecTracks);
904 else Warning("SetTreeAddress","(%s) Failed for Tracks. Can not find branch in tree.",GetName());
908 if (fRecTriggerTracks == 0x0 && cRL) {
909 fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
913 if ( TreeT() && fRecTriggerTracks && cRL ) {
914 sprintf(branchname,"%sTriggerTrack",GetName());
915 branch = TreeT()->GetBranch(branchname);
916 if (branch) branch->SetAddress(&fRecTriggerTracks);
917 else Warning("SetTreeAddress","(%s) Failed for Trigger Tracks. Can not find branch in tree.",GetName());
922 //_____________________________________________________________________________