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
28 #include "AliLoader.h"
29 #include "AliMUONConstants.h"
30 #include "AliMUONData.h"
31 #include "AliMUONDigit.h"
32 #include "AliMUONHit.h"
33 #include "AliMUONLocalTrigger.h"
34 #include "AliMUONGlobalTrigger.h"
35 #include "AliMUONRawCluster.h"
36 #include "AliMUONTrack.h"
37 #include "AliMUONTriggerTrack.h"
40 //_____________________________________________________________________________
41 AliMUONData::AliMUONData():
51 fRecTriggerTracks(0x0),
59 fNrectriggertracks(0),
62 // Default constructor
64 //_____________________________________________________________________________
65 AliMUONData::AliMUONData(AliLoader * loader, const char* name, const char* title):
75 fRecTriggerTracks(0x0),
83 fNrectriggertracks(0),
86 // Constructor for AliMUONData
88 // fHits = new TClonesArray("AliMUONHit",1000);
90 // fDigits = new TObjArray(AliMUONConstants::NCh());
91 // fNdigits = new Int_t[AliMUONConstants::NCh()];
92 // for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
93 // fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),iDetectionPlane);
94 // fNdigits[iDetectionPlane]=0;
96 // fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
97 // fNrawclusters = new Int_t[AliMUONConstants::NTrackingCh()];
98 // for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NTrackingCh();iDetectionPlane++) {
99 // fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),iDetectionPlane);
100 // fNrawclusters[iDetectionPlane]=0;
102 // fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
103 // fNglobaltrigger =0;
104 // fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
105 // fNlocaltrigger = 0;
106 // fRecTracks = new TClonesArray("AliMUONTrack", 100);
107 // fNrectracks = 0; // really needed or GetEntriesFast sufficient ????
111 //_____________________________________________________________________________
112 AliMUONData::AliMUONData(const AliMUONData& rMUONData):TNamed(rMUONData)
114 // Dummy copy constructor
117 //_____________________________________________________________________________
118 AliMUONData::~AliMUONData()
120 // Destructor for AliMUONData
134 fRawClusters->Delete();
138 fGlobalTrigger->Delete();
139 delete fGlobalTrigger;
142 fLocalTrigger->Delete();
143 delete fLocalTrigger;
146 fRecTracks->Delete();
149 if (fRecTriggerTracks){
150 fRecTriggerTracks->Delete();
151 delete fRecTriggerTracks;
155 //_____________________________________________________________________________
156 void AliMUONData::AddDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
159 // Add a MUON digit to the list of Digits of the detection plane id
161 TClonesArray &ldigits = * Digits(id) ;
162 new(ldigits[fNdigits[id]++]) AliMUONDigit(tracks,charges,digits);
164 //_____________________________________________________________________________
165 void AliMUONData::AddDigit(Int_t id, const AliMUONDigit& digit)
168 // Add a MUON digit to the list of Digits of the detection plane id
170 TClonesArray &ldigits = * Digits(id) ;
171 new(ldigits[fNdigits[id]++]) AliMUONDigit(digit);
173 //_____________________________________________________________________________
174 void AliMUONData::AddSDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *Sdigits)
177 // Add a MUON Sdigit to the list of SDigits of the detection plane id
179 TClonesArray &lSdigits = * SDigits(id) ;
180 new(lSdigits[fNSdigits[id]++]) AliMUONDigit(tracks,charges,Sdigits);
182 //_____________________________________________________________________________
183 void AliMUONData::AddSDigit(Int_t id, const AliMUONDigit& Sdigit)
186 // Add a MUON Sdigit to the list of SDigits of the detection plane id
188 TClonesArray &lSdigits = * SDigits(id) ;
189 new(lSdigits[fNSdigits[id]++]) AliMUONDigit(Sdigit);
191 //_____________________________________________________________________________
192 void AliMUONData::AddGlobalTrigger(Int_t *singlePlus, Int_t *singleMinus,
194 Int_t *pairUnlike, Int_t *pairLike)
196 // add a MUON Global Trigger to the list (only one GlobalTrigger per event !)
197 TClonesArray &globalTrigger = *fGlobalTrigger;
198 new(globalTrigger[fNglobaltrigger++])
199 AliMUONGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike);
201 //_____________________________________________________________________________
202 void AliMUONData::AddGlobalTrigger(const AliMUONGlobalTrigger& trigger )
204 // add a MUON Global Trigger to the list (only one GlobalTrigger per event !)
205 TClonesArray &globalTrigger = *fGlobalTrigger;
206 new(globalTrigger[fNglobaltrigger++]) AliMUONGlobalTrigger(trigger);
208 //_____________________________________________________________________________
209 void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber,
210 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
211 Float_t tof, Float_t momentum, Float_t theta,
212 Float_t phi, Float_t length, Float_t destep)
214 // Add new hit to the hit list
215 TClonesArray &lhits = *fHits;
216 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber,
218 tof, momentum, theta,
219 phi, length, destep);
221 //____________________________________________________________________________
222 void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber,
223 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
224 Float_t tof, Float_t momentum, Float_t theta,
225 Float_t phi, Float_t length, Float_t destep,
226 Float_t Xref,Float_t Yref,Float_t Zref)
228 // Add new hit to the hit list
229 TClonesArray &lhits = *fHits;
230 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber,
232 tof, momentum, theta,
236 //____________________________________________________________________________
237 void AliMUONData::AddHit(const AliMUONHit& hit)
239 TClonesArray &lhits = *fHits;
240 new(lhits[fNhits++]) AliMUONHit(hit);
242 //____________________________________________________________________________
243 void AliMUONData::AddLocalTrigger(Int_t *localtr)
245 // add a MUON Local Trigger to the list
246 TClonesArray &localTrigger = *fLocalTrigger;
247 new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(localtr);
249 //____________________________________________________________________________
250 void AliMUONData::AddLocalTrigger(const AliMUONLocalTrigger& trigger)
252 // add a MUON Local Trigger to the list
253 TClonesArray &localTrigger = *fLocalTrigger;
254 new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(trigger);
256 //_____________________________________________________________________________
257 void AliMUONData::AddRawCluster(Int_t id, const AliMUONRawCluster& c)
260 // Add a MUON rawcluster to the list in the detection plane id
262 TClonesArray &lrawcl = *((TClonesArray*) fRawClusters->At(id));
263 new(lrawcl[fNrawclusters[id]++]) AliMUONRawCluster(c);
265 //_____________________________________________________________________________
266 void AliMUONData::AddRecTrack(const AliMUONTrack& track)
269 // Add a MUON rectrack
271 TClonesArray &lrectracks = *fRecTracks;
272 new(lrectracks[fNrectracks++]) AliMUONTrack(track);
273 // printf("TTTTTT %d ,\n",((AliMUONTrack*)fRecTracks->At(fNrectracks-1))->GetNTrackHits());
275 //_____________________________________________________________________________
276 void AliMUONData::AddRecTriggerTrack(const AliMUONTriggerTrack& triggertrack)
279 // Add a MUON triggerrectrack
281 TClonesArray &lrectriggertracks = *fRecTriggerTracks;
282 new(lrectriggertracks[fNrectriggertracks++]) AliMUONTriggerTrack(triggertrack);
283 // printf("TTTTTT %d ,\n",((AliMUONTrack*)fRecTracks->At(fNrectracks-1))->GetNTrackHits());
286 //____________________________________________________________________________
287 TClonesArray* AliMUONData::Digits(Int_t DetectionPlane)
289 //Getting List of Digits
291 return ( (TClonesArray*) fDigits->At(DetectionPlane) );
295 //____________________________________________________________________________
296 TClonesArray* AliMUONData::SDigits(Int_t DetectionPlane)
298 //Getting List of SDigits
300 return ( (TClonesArray*) fSDigits->At(DetectionPlane) );
304 //____________________________________________________________________________
305 Bool_t AliMUONData::IsRawClusterBranchesInTree()
307 // Checking if there are RawCluster Branches In TreeR
309 Error("TreeR","No treeR in memory");
314 sprintf(branchname,"%sRawClusters1",GetName());
315 TBranch * branch = 0x0;
316 branch = TreeR()->GetBranch(branchname);
317 if (branch) return kTRUE;
321 //____________________________________________________________________________
322 Bool_t AliMUONData::IsTriggerBranchesInTree()
324 // Checking if there are Trigger Branches In TreeR
326 Error("TreeR","No treeR in memory");
331 sprintf(branchname,"%sLocalTrigger",GetName());
332 TBranch * branch = 0x0;
333 branch = TreeR()->GetBranch(branchname);
334 if (branch) return kTRUE;
338 //____________________________________________________________________________
339 Bool_t AliMUONData::IsTrackBranchesInTree()
341 // Checking if there are Track Branches In TreeT
343 Error("TreeT","No treeT in memory");
348 sprintf(branchname,"%sTrack",GetName());
349 TBranch * branch = 0x0;
350 branch = TreeT()->GetBranch(branchname);
351 if (branch) return kTRUE;
355 //____________________________________________________________________________
356 Bool_t AliMUONData::IsTriggerTrackBranchesInTree()
358 // Checking if there are TriggerTrack Branches In TreeT
360 Error("TreeT","No treeT in memory");
365 sprintf(branchname,"%sTriggerTrack",GetName());
366 TBranch * branch = 0x0;
367 branch = TreeT()->GetBranch(branchname);
368 if (branch) return kTRUE;
372 //____________________________________________________________________________
373 void AliMUONData::Fill(Option_t* option)
375 // Method to fill the trees
376 const char *cH = strstr(option,"H");
377 const char *cD = strstr(option,"D"); // Digits branches in TreeD
378 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
379 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
380 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR
381 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
382 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
384 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
387 TBranch * branch = 0x0;
391 if ( TreeH() && cH ) {
396 if ( TreeD() && cD) {
400 if ( TreeS() && cS) {
405 // filling rawclusters
406 if ( TreeR() && cRC ) {
407 if ( IsTriggerBranchesInTree() ) {
408 // Branch per branch filling
409 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
410 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
411 branch = TreeR()->GetBranch(branchname);
415 else TreeR()->Fill();
420 if ( TreeR() && cGLT) {
421 if (IsRawClusterBranchesInTree()) {
422 // Branch per branch filling
423 sprintf(branchname,"%sLocalTrigger",GetName());
424 branch = TreeR()->GetBranch(branchname);
426 sprintf(branchname,"%sGlobalTrigger",GetName());
427 branch = TreeR()->GetBranch(branchname);
430 else TreeR()->Fill();
434 if ( TreeT() && cRT ) {
435 if (IsTriggerTrackBranchesInTree()) {
436 sprintf(branchname,"%sTrack",GetName());
437 branch = TreeT()->GetBranch(branchname);
440 else TreeT()->Fill();
442 // filling trigger tracks
443 if ( TreeT() && cRL ) {
444 if (IsTrackBranchesInTree()) {
445 sprintf(branchname,"%sTriggerTrack",GetName());
446 branch = TreeT()->GetBranch(branchname);
449 else TreeT()->Fill();
451 // if ( TreeT() && cRL ) {
452 // sprintf(branchname,"%sTrackTrig",GetName());
456 //_____________________________________________________________________________
457 void AliMUONData::MakeBranch(Option_t* option)
460 // Create Tree branches for the MUON.
462 const Int_t kBufferSize = 4000;
466 const char *cH = strstr(option,"H");
467 const char *cD = strstr(option,"D"); // Digits branches in TreeD
468 const char *cS = strstr(option,"S"); // Digits branches in TreeS
469 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
470 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR
471 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
472 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
473 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
475 TBranch * branch = 0x0;
477 // Creating Branches for Hits
481 fHits = new TClonesArray("AliMUONHit",1000);
482 // if (gAlice->GetMCApp())
483 // gAlice->GetMCApp()->AddHitList (fHits);
487 sprintf(branchname,"%sHits",GetName());
488 branch = TreeH()->GetBranch(branchname);
490 Info("MakeBranch","Branch %s is already in tree.",GetName());
493 branch = TreeH()->Branch(branchname,&fHits,kBufferSize);
494 //Info("MakeBranch","Making Branch %s for hits \n",branchname);
497 //Creating Branches for Digits
498 if (TreeD() && cD ) {
499 // one branch for digits per chamber
500 if (fDigits == 0x0) {
501 fDigits = new TObjArray(AliMUONConstants::NCh());
502 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
503 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
505 fDigits->AddAt(tca,iDetectionPlane);
508 if (fNdigits == 0x0) {
509 fNdigits = new Int_t[AliMUONConstants::NCh()];
510 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
511 fNdigits[iDetectionPlane]=0;
514 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
515 sprintf(branchname,"%sDigits%d",GetName(),iDetectionPlane+1);
517 branch = TreeD()->GetBranch(branchname);
519 Info("MakeBranch","Branch %s is already in tree.",GetName());
522 TClonesArray * digits = Digits(iDetectionPlane);
523 branch = TreeD()->Branch(branchname, &digits, kBufferSize,1);
524 //Info("MakeBranch","Making Branch %s for digits in detection plane %d\n",branchname,iDetectionPlane+1);
528 //Creating Branches for SDigits
529 if (TreeS() && cS ) {
530 // one branch for Sdigits per chamber
531 if (fSDigits == 0x0) {
532 fSDigits = new TObjArray(AliMUONConstants::NCh());
533 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
534 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
536 fSDigits->AddAt(tca,iDetectionPlane);
539 if (fNSdigits == 0x0) {
540 fNSdigits = new Int_t[AliMUONConstants::NCh()];
541 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
542 fNSdigits[iDetectionPlane]=0;
545 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
546 sprintf(branchname,"%sSDigits%d",GetName(),iDetectionPlane+1);
548 branch = TreeS()->GetBranch(branchname);
550 Info("MakeBranch","Branch %s is already in tree.",GetName());
553 TClonesArray * Sdigits = SDigits(iDetectionPlane);
554 branch = TreeS()->Branch(branchname, &Sdigits, kBufferSize,1);
555 //Info("MakeBranch","Making Branch %s for Sdigits in detection plane %d\n",branchname,iDetectionPlane+1);
559 if (TreeR() && cRC ) {
560 // one branch for raw clusters per tracking detection plane
563 if (fRawClusters == 0x0) {
564 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
565 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
566 TClonesArray * tca = new TClonesArray("AliMUONRawCluster",1000);
568 fRawClusters->AddAt(tca,i);
572 if (fNrawclusters == 0x0) {
573 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
574 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
579 for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) {
580 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
582 branch = TreeR()->GetBranch(branchname);
584 Info("MakeBranch","Branch %s is already in tree.",GetName());
587 branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize);
588 //Info("MakeBranch","Making Branch %s for rawcluster in detection plane %d\n",branchname,i+1);
592 if (TreeR() && cGLT ) {
594 // one branch for global trigger
596 sprintf(branchname,"%sGlobalTrigger",GetName());
599 if (fGlobalTrigger == 0x0) {
600 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger");
603 branch = TreeR()->GetBranch(branchname);
605 Info("MakeBranch","Branch %s is already in tree.",GetName());
608 branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize);
609 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
612 // one branch for local trigger
614 sprintf(branchname,"%sLocalTrigger",GetName());
617 if (fLocalTrigger == 0x0) {
618 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
621 branch = TreeR()->GetBranch(branchname);
623 Info("MakeBranch","Branch %s is already in tree.",GetName());
626 branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize);
627 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
630 if (TreeT() && cRT ) {
631 if (fRecTracks == 0x0) fRecTracks = new TClonesArray("AliMUONTrack",100);
633 sprintf(branchname,"%sTrack",GetName());
634 branch = TreeT()->GetBranch(branchname);
636 Info("MakeBranch","Branch %s is already in tree.",GetName());
639 branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize);
640 //Info("MakeBranch","Making Branch %s for tracks \n",branchname);
643 if (TreeT() && cRL ) {
644 if (fRecTriggerTracks == 0x0) fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
645 fNrectriggertracks = 0;
646 sprintf(branchname,"%sTriggerTrack",GetName());
647 branch = TreeT()->GetBranch(branchname);
649 Info("MakeBranch","Branch %s is already in tree.",GetName());
652 branch = TreeT()->Branch(branchname,&fRecTriggerTracks,kBufferSize);
653 //Info("MakeBranch","Making Branch %s for trigger tracks \n",branchname);
656 //____________________________________________________________________________
657 TClonesArray* AliMUONData::RawClusters(Int_t DetectionPlane)
659 // Getting Raw Clusters
661 return ( (TClonesArray*) fRawClusters->At(DetectionPlane) );
665 //____________________________________________________________________________
666 TClonesArray* AliMUONData::LocalTrigger()
668 // Getting Local Trigger
670 return ( (TClonesArray*) fLocalTrigger );
674 //____________________________________________________________________________
675 TClonesArray* AliMUONData::GlobalTrigger()
677 // Getting Global Trigger
679 return ( (TClonesArray*) fGlobalTrigger );
683 //____________________________________________________________________________
684 void AliMUONData::ResetDigits()
687 // Reset number of digits and the digits array for this detector
689 if (fDigits == 0x0) return;
690 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
691 if ((*fDigits)[i]) ((TClonesArray*)fDigits->At(i))->Clear();
692 if (fNdigits) fNdigits[i]=0;
695 //____________________________________________________________________________
696 void AliMUONData::ResetSDigits()
699 // Reset number of Sdigits and the Sdigits array for this detector
701 if (fSDigits == 0x0) return;
702 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
703 if ((*fSDigits)[i]) ((TClonesArray*)fSDigits->At(i))->Clear();
704 if (fNSdigits) fNSdigits[i]=0;
707 //______________________________________________________________________________
708 void AliMUONData::ResetHits()
710 // Reset number of clusters and the cluster array for this detector
712 if (fHits) fHits->Clear();
714 //_______________________________________________________________________________
715 void AliMUONData::ResetRawClusters()
717 // Reset number of raw clusters and the raw clust array for this detector
719 for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) {
720 if ((*fRawClusters)[i]) ((TClonesArray*)fRawClusters->At(i))->Clear();
721 if (fNrawclusters) fNrawclusters[i]=0;
724 //_______________________________________________________________________________
725 void AliMUONData::ResetTrigger()
727 // Reset Local and Global Trigger
729 if (fGlobalTrigger) fGlobalTrigger->Clear();
731 if (fLocalTrigger) fLocalTrigger->Clear();
733 //____________________________________________________________________________
734 void AliMUONData::ResetRecTracks()
736 // Reset tracks information
738 if (fRecTracks) fRecTracks->Clear();
740 //____________________________________________________________________________
741 void AliMUONData::ResetRecTriggerTracks()
743 // Reset tracks information
744 fNrectriggertracks = 0;
745 if (fRecTriggerTracks) fRecTriggerTracks->Clear();
747 //_____________________________________________________________________________
748 void AliMUONData::SetTreeAddress(Option_t* option)
750 //Setting Addresses to the events trees
751 const char *cH = strstr(option,"H");
752 const char *cD = strstr(option,"D"); // Digits branches in TreeD
753 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
754 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
755 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR
756 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
757 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
758 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
760 // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree.
762 TBranch * branch = 0x0;
765 // Branch address for hit tree
766 if ( TreeH() && cH ) {
768 fHits = new TClonesArray("AliMUONHit",1000);
769 // if (gAlice->GetMCApp())
770 // gAlice->GetMCApp()->AddHitList (fHits); Moved to AliMUON
774 if (TreeH() && fHits && cH) {
775 sprintf(branchname,"%sHits",GetName());
776 branch = TreeH()->GetBranch(branchname);
778 // Info("SetTreeAddress","(%s) Setting for Hits",GetName());
779 branch->SetAddress(&fHits);
781 else { //can be invoked before branch creation
782 Warning("SetTreeAddress","(%s) Failed for Hits. Can not find branch in tree.",GetName());
787 // Branch address for digit tree
788 if ( TreeD() && cD) {
789 if (fDigits == 0x0) {
790 fDigits = new TObjArray(AliMUONConstants::NCh());
791 fNdigits= new Int_t[AliMUONConstants::NCh()];
792 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
793 fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i);
799 if (TreeD() && fDigits && cD) {
800 for (int i=0; i<AliMUONConstants::NCh(); i++) {
801 sprintf(branchname,"%sDigits%d",GetName(),i+1);
803 branch = TreeD()->GetBranch(branchname);
804 TClonesArray * digits = Digits(i);
806 branch->SetAddress( &digits );
808 else Warning("SetTreeAddress","(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i);
813 // Branch address for Sdigit tree
814 if ( TreeS() && cS) {
815 if (fSDigits == 0x0) {
816 fSDigits = new TObjArray(AliMUONConstants::NCh());
817 fNSdigits= new Int_t[AliMUONConstants::NCh()];
818 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
819 fSDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i);
825 if (TreeS() && fSDigits && cS) {
826 for (int i=0; i<AliMUONConstants::NCh(); i++) {
827 sprintf(branchname,"%sSDigits%d",GetName(),i+1);
829 branch = TreeS()->GetBranch(branchname);
830 TClonesArray * Sdigits = SDigits(i);
831 if (branch) branch->SetAddress( &Sdigits );
832 else Warning("SetTreeAddress","(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i);
838 // Branch address for rawclusters, globaltrigger and local trigger tree
840 if (fRawClusters == 0x0 && cRC) {
841 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
842 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
843 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
844 fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i);
848 if (fLocalTrigger == 0x0 && cGLT) {
849 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
851 if (fGlobalTrigger== 0x0 && cGLT) {
852 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
856 if ( TreeR() && fRawClusters && cRC) {
857 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
858 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
860 branch = TreeR()->GetBranch(branchname);
861 if (branch) branch->SetAddress( &((*fRawClusters)[i]) );
862 else Warning("SetTreeAddress","(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i);
866 if ( TreeR() && fLocalTrigger && cGLT) {
867 sprintf(branchname,"%sLocalTrigger",GetName());
868 branch = TreeR()->GetBranch(branchname);
869 if (branch) branch->SetAddress(&fLocalTrigger);
870 else Warning("SetTreeAddress","(%s) Failed for LocalTrigger. Can not find branch in tree.",GetName());
872 if ( TreeR() && fGlobalTrigger && cGLT) {
873 sprintf(branchname,"%sGlobalTrigger",GetName());
874 branch = TreeR()->GetBranch(branchname);
875 if (branch) branch->SetAddress(&fGlobalTrigger);
876 else Warning("SetTreeAddress","(%s) Failed for LocalTrigger. Can not find branch in tree.",GetName());
880 if (fRecTracks == 0x0 && cRT) {
881 fRecTracks = new TClonesArray("AliMUONTrack",100);
885 if ( TreeT() && fRecTracks && cRT ) {
886 sprintf(branchname,"%sTrack",GetName());
887 branch = TreeT()->GetBranch(branchname);
888 if (branch) branch->SetAddress(&fRecTracks);
889 else Warning("SetTreeAddress","(%s) Failed for Tracks. Can not find branch in tree.",GetName());
893 if (fRecTriggerTracks == 0x0 && cRL) {
894 fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
898 if ( TreeT() && fRecTriggerTracks && cRL ) {
899 sprintf(branchname,"%sTriggerTrack",GetName());
900 branch = TreeT()->GetBranch(branchname);
901 if (branch) branch->SetAddress(&fRecTriggerTracks);
902 else Warning("SetTreeAddress","(%s) Failed for Trigger Tracks. Can not find branch in tree.",GetName());
907 //_____________________________________________________________________________