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():TNamed()
43 // Default constructor
45 fHits = 0x0; // One event in treeH per primary track
46 fDigits = 0x0; // One event in treeD per detection plane
47 fSDigits = 0x0; // One event in treeS per detection plane
50 fRawClusters = 0x0; //One event in TreeR/RawclusterBranch per tracking detection plane
51 fGlobalTrigger = 0x0; //! List of Global Trigger 1st event in TreeR/GlobalTriggerBranch
52 fLocalTrigger = 0x0; //! List of Local Trigger, 1st event in TreeR/LocalTriggerBranch
54 fRecTriggerTracks = 0x0;
58 //_____________________________________________________________________________
59 AliMUONData::AliMUONData(AliLoader * loader, const char* name, const char* title):
62 // Constructor for AliMUONData
64 fHits = 0x0; // One event in treeH per primary track
65 fDigits = 0x0; // One event in treeD per detection plane
66 fSDigits = 0x0; // One event in treeS per detection plane
69 fRawClusters = 0x0; //One event in TreeR/RawclusterBranch per tracking detection plane
70 fGlobalTrigger = 0x0; //! List of Global Trigger 1st event in TreeR/GlobalTriggerBranch
71 fLocalTrigger = 0x0; //! List of Local Trigger, 1st event in TreeR/LocalTriggerBranch
73 fRecTriggerTracks = 0x0;
78 fNrectriggertracks = 0;
80 // fHits = new TClonesArray("AliMUONHit",1000);
82 // fDigits = new TObjArray(AliMUONConstants::NCh());
83 // fNdigits = new Int_t[AliMUONConstants::NCh()];
84 // for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
85 // fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),iDetectionPlane);
86 // fNdigits[iDetectionPlane]=0;
88 // fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
89 // fNrawclusters = new Int_t[AliMUONConstants::NTrackingCh()];
90 // for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NTrackingCh();iDetectionPlane++) {
91 // fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),iDetectionPlane);
92 // fNrawclusters[iDetectionPlane]=0;
94 // fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
95 // fNglobaltrigger =0;
96 // fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
97 // fNlocaltrigger = 0;
98 // fRecTracks = new TClonesArray("AliMUONTrack", 100);
99 // fNrectracks = 0; // really needed or GetEntriesFast sufficient ????
102 //default constructor
104 //_____________________________________________________________________________
105 AliMUONData::AliMUONData(const AliMUONData& rMUONData):TNamed(rMUONData)
107 // Dummy copy constructor
110 //_____________________________________________________________________________
111 AliMUONData::~AliMUONData()
113 // Destructor for AliMUONData
127 fRawClusters->Delete();
131 fGlobalTrigger->Delete();
132 delete fGlobalTrigger;
135 fLocalTrigger->Delete();
136 delete fLocalTrigger;
139 fRecTracks->Delete();
142 if (fRecTriggerTracks){
143 fRecTriggerTracks->Delete();
144 delete fRecTriggerTracks;
148 //_____________________________________________________________________________
149 void AliMUONData::AddDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
152 // Add a MUON digit to the list of Digits of the detection plane id
154 TClonesArray &ldigits = * Digits(id) ;
155 new(ldigits[fNdigits[id]++]) AliMUONDigit(tracks,charges,digits);
157 //_____________________________________________________________________________
158 void AliMUONData::AddDigit(Int_t id, const AliMUONDigit& digit)
161 // Add a MUON digit to the list of Digits of the detection plane id
163 TClonesArray &ldigits = * Digits(id) ;
164 new(ldigits[fNdigits[id]++]) AliMUONDigit(digit);
166 //_____________________________________________________________________________
167 void AliMUONData::AddSDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *Sdigits)
170 // Add a MUON Sdigit to the list of SDigits of the detection plane id
172 TClonesArray &lSdigits = * SDigits(id) ;
173 new(lSdigits[fNSdigits[id]++]) AliMUONDigit(tracks,charges,Sdigits);
175 //_____________________________________________________________________________
176 void AliMUONData::AddSDigit(Int_t id, const AliMUONDigit& Sdigit)
179 // Add a MUON Sdigit to the list of SDigits of the detection plane id
181 TClonesArray &lSdigits = * SDigits(id) ;
182 new(lSdigits[fNSdigits[id]++]) AliMUONDigit(Sdigit);
184 //_____________________________________________________________________________
185 void AliMUONData::AddGlobalTrigger(Int_t *singlePlus, Int_t *singleMinus,
187 Int_t *pairUnlike, Int_t *pairLike)
189 // add a MUON Global Trigger to the list (only one GlobalTrigger per event !)
190 TClonesArray &globalTrigger = *fGlobalTrigger;
191 new(globalTrigger[fNglobaltrigger++])
192 AliMUONGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike);
194 //_____________________________________________________________________________
195 void AliMUONData::AddGlobalTrigger(const AliMUONGlobalTrigger& trigger )
197 // add a MUON Global Trigger to the list (only one GlobalTrigger per event !)
198 TClonesArray &globalTrigger = *fGlobalTrigger;
199 new(globalTrigger[fNglobaltrigger++]) AliMUONGlobalTrigger(trigger);
201 //_____________________________________________________________________________
202 void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber,
203 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
204 Float_t tof, Float_t momentum, Float_t theta,
205 Float_t phi, Float_t length, Float_t destep)
207 // Add new hit to the hit list
208 TClonesArray &lhits = *fHits;
209 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber,
211 tof, momentum, theta,
212 phi, length, destep);
214 //____________________________________________________________________________
215 void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber,
216 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
217 Float_t tof, Float_t momentum, Float_t theta,
218 Float_t phi, Float_t length, Float_t destep,
219 Float_t Xref,Float_t Yref,Float_t Zref)
221 // Add new hit to the hit list
222 TClonesArray &lhits = *fHits;
223 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber,
225 tof, momentum, theta,
229 //____________________________________________________________________________
230 void AliMUONData::AddHit(const AliMUONHit& hit)
232 TClonesArray &lhits = *fHits;
233 new(lhits[fNhits++]) AliMUONHit(hit);
235 //____________________________________________________________________________
236 void AliMUONData::AddLocalTrigger(Int_t *localtr)
238 // add a MUON Local Trigger to the list
239 TClonesArray &localTrigger = *fLocalTrigger;
240 new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(localtr);
242 //____________________________________________________________________________
243 void AliMUONData::AddLocalTrigger(const AliMUONLocalTrigger& trigger)
245 // add a MUON Local Trigger to the list
246 TClonesArray &localTrigger = *fLocalTrigger;
247 new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(trigger);
249 //_____________________________________________________________________________
250 void AliMUONData::AddRawCluster(Int_t id, const AliMUONRawCluster& c)
253 // Add a MUON rawcluster to the list in the detection plane id
255 TClonesArray &lrawcl = *((TClonesArray*) fRawClusters->At(id));
256 new(lrawcl[fNrawclusters[id]++]) AliMUONRawCluster(c);
258 //_____________________________________________________________________________
259 void AliMUONData::AddRecTrack(const AliMUONTrack& track)
262 // Add a MUON rectrack
264 TClonesArray &lrectracks = *fRecTracks;
265 new(lrectracks[fNrectracks++]) AliMUONTrack(track);
266 // printf("TTTTTT %d ,\n",((AliMUONTrack*)fRecTracks->At(fNrectracks-1))->GetNTrackHits());
268 //_____________________________________________________________________________
269 void AliMUONData::AddRecTriggerTrack(const AliMUONTriggerTrack& triggertrack)
272 // Add a MUON triggerrectrack
274 TClonesArray &lrectriggertracks = *fRecTriggerTracks;
275 new(lrectriggertracks[fNrectriggertracks++]) AliMUONTriggerTrack(triggertrack);
276 // printf("TTTTTT %d ,\n",((AliMUONTrack*)fRecTracks->At(fNrectracks-1))->GetNTrackHits());
279 //____________________________________________________________________________
280 TClonesArray* AliMUONData::Digits(Int_t DetectionPlane)
282 //Getting List of Digits
284 return ( (TClonesArray*) fDigits->At(DetectionPlane) );
288 //____________________________________________________________________________
289 TClonesArray* AliMUONData::SDigits(Int_t DetectionPlane)
291 //Getting List of SDigits
293 return ( (TClonesArray*) fSDigits->At(DetectionPlane) );
297 //____________________________________________________________________________
298 Bool_t AliMUONData::IsRawClusterBranchesInTree()
300 // Checking if there are RawCluster Branches In TreeR
302 Error("TreeR","No treeR in memory");
307 sprintf(branchname,"%sRawClusters1",GetName());
308 TBranch * branch = 0x0;
309 branch = TreeR()->GetBranch(branchname);
310 if (branch) return kTRUE;
314 //____________________________________________________________________________
315 Bool_t AliMUONData::IsTriggerBranchesInTree()
317 // Checking if there are Trigger Branches In TreeR
319 Error("TreeR","No treeR in memory");
324 sprintf(branchname,"%sLocalTrigger",GetName());
325 TBranch * branch = 0x0;
326 branch = TreeR()->GetBranch(branchname);
327 if (branch) return kTRUE;
331 //____________________________________________________________________________
332 Bool_t AliMUONData::IsTrackBranchesInTree()
334 // Checking if there are Track Branches In TreeT
336 Error("TreeT","No treeT in memory");
341 sprintf(branchname,"%sTrack",GetName());
342 TBranch * branch = 0x0;
343 branch = TreeT()->GetBranch(branchname);
344 if (branch) return kTRUE;
348 //____________________________________________________________________________
349 Bool_t AliMUONData::IsTriggerTrackBranchesInTree()
351 // Checking if there are TriggerTrack Branches In TreeT
353 Error("TreeT","No treeT in memory");
358 sprintf(branchname,"%sTriggerTrack",GetName());
359 TBranch * branch = 0x0;
360 branch = TreeT()->GetBranch(branchname);
361 if (branch) return kTRUE;
365 //____________________________________________________________________________
366 void AliMUONData::Fill(Option_t* option)
368 // Method to fill the trees
369 const char *cH = strstr(option,"H");
370 const char *cD = strstr(option,"D"); // Digits branches in TreeD
371 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
372 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
373 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR
374 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
375 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
377 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
380 TBranch * branch = 0x0;
384 if ( TreeH() && cH ) {
389 if ( TreeD() && cD) {
393 if ( TreeS() && cS) {
398 // filling rawclusters
399 if ( TreeR() && cRC ) {
400 if ( IsTriggerBranchesInTree() ) {
401 // Branch per branch filling
402 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
403 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
404 branch = TreeR()->GetBranch(branchname);
408 else TreeR()->Fill();
413 if ( TreeR() && cGLT) {
414 if (IsRawClusterBranchesInTree()) {
415 // Branch per branch filling
416 sprintf(branchname,"%sLocalTrigger",GetName());
417 branch = TreeR()->GetBranch(branchname);
419 sprintf(branchname,"%sGlobalTrigger",GetName());
420 branch = TreeR()->GetBranch(branchname);
423 else TreeR()->Fill();
427 if ( TreeT() && cRT ) {
428 if (IsTriggerTrackBranchesInTree()) {
429 sprintf(branchname,"%sTrack",GetName());
430 branch = TreeT()->GetBranch(branchname);
433 else TreeT()->Fill();
435 // filling trigger tracks
436 if ( TreeT() && cRL ) {
437 if (IsTrackBranchesInTree()) {
438 sprintf(branchname,"%sTriggerTrack",GetName());
439 branch = TreeT()->GetBranch(branchname);
442 else TreeT()->Fill();
444 // if ( TreeT() && cRL ) {
445 // sprintf(branchname,"%sTrackTrig",GetName());
449 //_____________________________________________________________________________
450 void AliMUONData::MakeBranch(Option_t* option)
453 // Create Tree branches for the MUON.
455 const Int_t kBufferSize = 4000;
459 const char *cH = strstr(option,"H");
460 const char *cD = strstr(option,"D"); // Digits branches in TreeD
461 const char *cS = strstr(option,"S"); // Digits branches in TreeS
462 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
463 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR
464 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
465 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
466 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
468 TBranch * branch = 0x0;
470 // Creating Branches for Hits
474 fHits = new TClonesArray("AliMUONHit",1000);
475 // if (gAlice->GetMCApp())
476 // gAlice->GetMCApp()->AddHitList (fHits);
480 sprintf(branchname,"%sHits",GetName());
481 branch = TreeH()->GetBranch(branchname);
483 Info("MakeBranch","Branch %s is already in tree.",GetName());
486 branch = TreeH()->Branch(branchname,&fHits,kBufferSize);
487 //Info("MakeBranch","Making Branch %s for hits \n",branchname);
490 //Creating Branches for Digits
491 if (TreeD() && cD ) {
492 // one branch for digits per chamber
493 if (fDigits == 0x0) {
494 fDigits = new TObjArray(AliMUONConstants::NCh());
495 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
496 fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),iDetectionPlane);
499 if (fNdigits == 0x0) {
500 fNdigits = new Int_t[AliMUONConstants::NCh()];
501 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
502 fNdigits[iDetectionPlane]=0;
505 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
506 sprintf(branchname,"%sDigits%d",GetName(),iDetectionPlane+1);
508 branch = TreeD()->GetBranch(branchname);
510 Info("MakeBranch","Branch %s is already in tree.",GetName());
513 TClonesArray * digits = Digits(iDetectionPlane);
514 branch = TreeD()->Branch(branchname, &digits, kBufferSize,1);
515 //Info("MakeBranch","Making Branch %s for digits in detection plane %d\n",branchname,iDetectionPlane+1);
519 //Creating Branches for SDigits
520 if (TreeS() && cS ) {
521 // one branch for Sdigits per chamber
522 if (fSDigits == 0x0) {
523 fSDigits = new TObjArray(AliMUONConstants::NCh());
524 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
525 fSDigits->AddAt(new TClonesArray("AliMUONDigit",10000),iDetectionPlane);
528 if (fNSdigits == 0x0) {
529 fNSdigits = new Int_t[AliMUONConstants::NCh()];
530 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
531 fNSdigits[iDetectionPlane]=0;
534 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
535 sprintf(branchname,"%sSDigits%d",GetName(),iDetectionPlane+1);
537 branch = TreeS()->GetBranch(branchname);
539 Info("MakeBranch","Branch %s is already in tree.",GetName());
542 TClonesArray * Sdigits = SDigits(iDetectionPlane);
543 branch = TreeS()->Branch(branchname, &Sdigits, kBufferSize,1);
544 //Info("MakeBranch","Making Branch %s for Sdigits in detection plane %d\n",branchname,iDetectionPlane+1);
548 if (TreeR() && cRC ) {
549 // one branch for raw clusters per tracking detection plane
552 if (fRawClusters == 0x0) {
553 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
554 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
555 fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",1000),i);
559 if (fNrawclusters == 0x0) {
560 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
561 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
566 for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) {
567 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
569 branch = TreeR()->GetBranch(branchname);
571 Info("MakeBranch","Branch %s is already in tree.",GetName());
574 branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize);
575 //Info("MakeBranch","Making Branch %s for rawcluster in detection plane %d\n",branchname,i+1);
579 if (TreeR() && cGLT ) {
581 // one branch for global trigger
583 sprintf(branchname,"%sGlobalTrigger",GetName());
586 if (fGlobalTrigger == 0x0) {
587 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger");
590 branch = TreeR()->GetBranch(branchname);
592 Info("MakeBranch","Branch %s is already in tree.",GetName());
595 branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize);
596 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
599 // one branch for local trigger
601 sprintf(branchname,"%sLocalTrigger",GetName());
604 if (fLocalTrigger == 0x0) {
605 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
608 branch = TreeR()->GetBranch(branchname);
610 Info("MakeBranch","Branch %s is already in tree.",GetName());
613 branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize);
614 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
617 if (TreeT() && cRT ) {
618 if (fRecTracks == 0x0) fRecTracks = new TClonesArray("AliMUONTrack",100);
620 sprintf(branchname,"%sTrack",GetName());
621 branch = TreeT()->GetBranch(branchname);
623 Info("MakeBranch","Branch %s is already in tree.",GetName());
626 branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize);
627 //Info("MakeBranch","Making Branch %s for tracks \n",branchname);
630 if (TreeT() && cRL ) {
631 if (fRecTriggerTracks == 0x0) fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
632 fNrectriggertracks = 0;
633 sprintf(branchname,"%sTriggerTrack",GetName());
634 branch = TreeT()->GetBranch(branchname);
636 Info("MakeBranch","Branch %s is already in tree.",GetName());
639 branch = TreeT()->Branch(branchname,&fRecTriggerTracks,kBufferSize);
640 //Info("MakeBranch","Making Branch %s for trigger tracks \n",branchname);
643 //____________________________________________________________________________
644 TClonesArray* AliMUONData::RawClusters(Int_t DetectionPlane)
646 // Getting Raw Clusters
648 return ( (TClonesArray*) fRawClusters->At(DetectionPlane) );
652 //____________________________________________________________________________
653 TClonesArray* AliMUONData::LocalTrigger()
655 // Getting Local Trigger
657 return ( (TClonesArray*) fLocalTrigger );
661 //____________________________________________________________________________
662 TClonesArray* AliMUONData::GlobalTrigger()
664 // Getting Global Trigger
666 return ( (TClonesArray*) fGlobalTrigger );
670 //____________________________________________________________________________
671 void AliMUONData::ResetDigits()
674 // Reset number of digits and the digits array for this detector
676 if (fDigits == 0x0) return;
677 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
678 if ((*fDigits)[i]) ((TClonesArray*)fDigits->At(i))->Clear();
679 if (fNdigits) fNdigits[i]=0;
682 //____________________________________________________________________________
683 void AliMUONData::ResetSDigits()
686 // Reset number of Sdigits and the Sdigits array for this detector
688 if (fSDigits == 0x0) return;
689 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
690 if ((*fSDigits)[i]) ((TClonesArray*)fSDigits->At(i))->Clear();
691 if (fNSdigits) fNSdigits[i]=0;
694 //______________________________________________________________________________
695 void AliMUONData::ResetHits()
697 // Reset number of clusters and the cluster array for this detector
699 if (fHits) fHits->Clear();
701 //_______________________________________________________________________________
702 void AliMUONData::ResetRawClusters()
704 // Reset number of raw clusters and the raw clust array for this detector
706 for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) {
707 if ((*fRawClusters)[i]) ((TClonesArray*)fRawClusters->At(i))->Clear();
708 if (fNrawclusters) fNrawclusters[i]=0;
711 //_______________________________________________________________________________
712 void AliMUONData::ResetTrigger()
714 // Reset Local and Global Trigger
716 if (fGlobalTrigger) fGlobalTrigger->Clear();
718 if (fLocalTrigger) fLocalTrigger->Clear();
720 //____________________________________________________________________________
721 void AliMUONData::ResetRecTracks()
723 // Reset tracks information
725 if (fRecTracks) fRecTracks->Clear();
727 //____________________________________________________________________________
728 void AliMUONData::ResetRecTriggerTracks()
730 // Reset tracks information
731 fNrectriggertracks = 0;
732 if (fRecTriggerTracks) fRecTriggerTracks->Clear();
734 //_____________________________________________________________________________
735 void AliMUONData::SetTreeAddress(Option_t* option)
737 //Setting Addresses to the events trees
738 const char *cH = strstr(option,"H");
739 const char *cD = strstr(option,"D"); // Digits branches in TreeD
740 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
741 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
742 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR
743 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
744 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
745 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
747 // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree.
749 TBranch * branch = 0x0;
752 // Branch address for hit tree
753 if ( TreeH() && cH ) {
755 fHits = new TClonesArray("AliMUONHit",1000);
756 // if (gAlice->GetMCApp())
757 // gAlice->GetMCApp()->AddHitList (fHits); Moved to AliMUON
761 if (TreeH() && fHits && cH) {
762 sprintf(branchname,"%sHits",GetName());
763 branch = TreeH()->GetBranch(branchname);
765 // Info("SetTreeAddress","(%s) Setting for Hits",GetName());
766 branch->SetAddress(&fHits);
768 else { //can be invoked before branch creation
769 Warning("SetTreeAddress","(%s) Failed for Hits. Can not find branch in tree.",GetName());
774 // Branch address for digit tree
775 if ( TreeD() && cD) {
776 if (fDigits == 0x0) {
777 fDigits = new TObjArray(AliMUONConstants::NCh());
778 fNdigits= new Int_t[AliMUONConstants::NCh()];
779 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
780 fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i);
786 if (TreeD() && fDigits && cD) {
787 for (int i=0; i<AliMUONConstants::NCh(); i++) {
788 sprintf(branchname,"%sDigits%d",GetName(),i+1);
790 branch = TreeD()->GetBranch(branchname);
791 TClonesArray * digits = Digits(i);
793 branch->SetAddress( &digits );
795 else Warning("SetTreeAddress","(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i);
800 // Branch address for Sdigit tree
801 if ( TreeS() && cS) {
802 if (fSDigits == 0x0) {
803 fSDigits = new TObjArray(AliMUONConstants::NCh());
804 fNSdigits= new Int_t[AliMUONConstants::NCh()];
805 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
806 fSDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i);
812 if (TreeS() && fSDigits && cS) {
813 for (int i=0; i<AliMUONConstants::NCh(); i++) {
814 sprintf(branchname,"%sSDigits%d",GetName(),i+1);
816 branch = TreeS()->GetBranch(branchname);
817 TClonesArray * Sdigits = SDigits(i);
818 if (branch) branch->SetAddress( &Sdigits );
819 else Warning("SetTreeAddress","(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i);
825 // Branch address for rawclusters, globaltrigger and local trigger tree
827 if (fRawClusters == 0x0 && cRC) {
828 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
829 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
830 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
831 fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i);
835 if (fLocalTrigger == 0x0 && cGLT) {
836 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
838 if (fGlobalTrigger== 0x0 && cGLT) {
839 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
843 if ( TreeR() && fRawClusters && cRC) {
844 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
845 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
847 branch = TreeR()->GetBranch(branchname);
848 if (branch) branch->SetAddress( &((*fRawClusters)[i]) );
849 else Warning("SetTreeAddress","(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i);
853 if ( TreeR() && fLocalTrigger && cGLT) {
854 sprintf(branchname,"%sLocalTrigger",GetName());
855 branch = TreeR()->GetBranch(branchname);
856 if (branch) branch->SetAddress(&fLocalTrigger);
857 else Warning("SetTreeAddress","(%s) Failed for LocalTrigger. Can not find branch in tree.",GetName());
859 if ( TreeR() && fGlobalTrigger && cGLT) {
860 sprintf(branchname,"%sGlobalTrigger",GetName());
861 branch = TreeR()->GetBranch(branchname);
862 if (branch) branch->SetAddress(&fGlobalTrigger);
863 else Warning("SetTreeAddress","(%s) Failed for LocalTrigger. Can not find branch in tree.",GetName());
867 if (fRecTracks == 0x0 && cRT) {
868 fRecTracks = new TClonesArray("AliMUONTrack",100);
872 if ( TreeT() && fRecTracks && cRT ) {
873 sprintf(branchname,"%sTrack",GetName());
874 branch = TreeT()->GetBranch(branchname);
875 if (branch) branch->SetAddress(&fRecTracks);
876 else Warning("SetTreeAddress","(%s) Failed for Tracks. Can not find branch in tree.",GetName());
880 if (fRecTriggerTracks == 0x0 && cRL) {
881 fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
885 if ( TreeT() && fRecTriggerTracks && cRL ) {
886 sprintf(branchname,"%sTriggerTrack",GetName());
887 branch = TreeT()->GetBranch(branchname);
888 if (branch) branch->SetAddress(&fRecTriggerTracks);
889 else Warning("SetTreeAddress","(%s) Failed for Trigger Tracks. Can not find branch in tree.",GetName());
894 //_____________________________________________________________________________