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"
39 //_____________________________________________________________________________
40 AliMUONData::AliMUONData():
50 fRecTriggerTracks(0x0),
58 fNrectriggertracks(0),
61 // Default constructor
63 //_____________________________________________________________________________
64 AliMUONData::AliMUONData(AliLoader * loader, const char* name, const char* title):
74 fRecTriggerTracks(0x0),
82 fNrectriggertracks(0),
85 // Constructor for AliMUONData
87 // fHits = new TClonesArray("AliMUONHit",1000);
89 // fDigits = new TObjArray(AliMUONConstants::NCh());
90 // fNdigits = new Int_t[AliMUONConstants::NCh()];
91 // for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
92 // fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),iDetectionPlane);
93 // fNdigits[iDetectionPlane]=0;
95 // fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
96 // fNrawclusters = new Int_t[AliMUONConstants::NTrackingCh()];
97 // for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NTrackingCh();iDetectionPlane++) {
98 // fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),iDetectionPlane);
99 // fNrawclusters[iDetectionPlane]=0;
101 // fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
102 // fNglobaltrigger =0;
103 // fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
104 // fNlocaltrigger = 0;
105 // fRecTracks = new TClonesArray("AliMUONTrack", 100);
106 // fNrectracks = 0; // really needed or GetEntriesFast sufficient ????
111 //_____________________________________________________________________________
112 AliMUONData::AliMUONData(const AliMUONData& rMUONData):TNamed(rMUONData)
114 // Protected copy constructor
116 AliFatal("Not implemented.");
119 //_____________________________________________________________________________
120 AliMUONData::~AliMUONData()
122 // Destructor for AliMUONData
136 fRawClusters->Delete();
140 fGlobalTrigger->Delete();
141 delete fGlobalTrigger;
144 fLocalTrigger->Delete();
145 delete fLocalTrigger;
148 fRecTracks->Delete();
151 if (fRecTriggerTracks){
152 fRecTriggerTracks->Delete();
153 delete fRecTriggerTracks;
158 //_____________________________________________________________________________
159 AliMUONData& AliMUONData::operator=(const AliMUONData& rhs)
161 // Protected assignement operator
163 if (this == &rhs) return *this;
165 AliFatal("Not implemented.");
171 //_____________________________________________________________________________
172 void AliMUONData::AddDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *digits)
175 // Add a MUON digit to the list of Digits of the detection plane id
177 TClonesArray &ldigits = * Digits(id) ;
178 new(ldigits[fNdigits[id]++]) AliMUONDigit(tracks,charges,digits);
180 //_____________________________________________________________________________
181 void AliMUONData::AddDigit(Int_t id, const AliMUONDigit& digit)
184 // Add a MUON digit to the list of Digits of the detection plane id
186 TClonesArray &ldigits = * Digits(id) ;
187 new(ldigits[fNdigits[id]++]) AliMUONDigit(digit);
189 //_____________________________________________________________________________
190 void AliMUONData::AddSDigit(Int_t id, Int_t *tracks, Int_t *charges, Int_t *sdigits)
193 // Add a MUON Sdigit to the list of SDigits of the detection plane id
195 TClonesArray &lSdigits = * SDigits(id) ;
196 new(lSdigits[fNSdigits[id]++]) AliMUONDigit(tracks,charges,sdigits);
198 //_____________________________________________________________________________
199 void AliMUONData::AddSDigit(Int_t id, const AliMUONDigit& Sdigit)
202 // Add a MUON Sdigit to the list of SDigits of the detection plane id
204 TClonesArray &lSdigits = * SDigits(id) ;
205 new(lSdigits[fNSdigits[id]++]) AliMUONDigit(Sdigit);
207 //_____________________________________________________________________________
208 void AliMUONData::AddGlobalTrigger(Int_t *singlePlus, Int_t *singleMinus,
210 Int_t *pairUnlike, Int_t *pairLike)
212 // add a MUON Global Trigger to the list (only one GlobalTrigger per event !)
214 TClonesArray &globalTrigger = *fGlobalTrigger;
215 new(globalTrigger[fNglobaltrigger++])
216 AliMUONGlobalTrigger(singlePlus, singleMinus, singleUndef, pairUnlike, pairLike);
218 //_____________________________________________________________________________
219 void AliMUONData::AddGlobalTrigger(const AliMUONGlobalTrigger& trigger )
221 // add a MUON Global Trigger to the list (only one GlobalTrigger per event !);
222 TClonesArray &globalTrigger = *fGlobalTrigger;
223 new(globalTrigger[fNglobaltrigger++]) AliMUONGlobalTrigger(trigger);
225 //_____________________________________________________________________________
226 void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber,
227 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
228 Float_t tof, Float_t momentum, Float_t theta,
229 Float_t phi, Float_t length, Float_t destep)
231 // Add new hit to the hit list
232 TClonesArray &lhits = *fHits;
233 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber,
235 tof, momentum, theta,
236 phi, length, destep);
238 //____________________________________________________________________________
239 void AliMUONData::AddHit(Int_t fIshunt, Int_t track, Int_t iChamber,
240 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
241 Float_t tof, Float_t momentum, Float_t theta,
242 Float_t phi, Float_t length, Float_t destep,
243 Float_t Xref,Float_t Yref,Float_t Zref)
245 // Add new hit to the hit list
246 TClonesArray &lhits = *fHits;
247 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber,
249 tof, momentum, theta,
253 //____________________________________________________________________________
254 void AliMUONData::AddHit(const AliMUONHit& hit)
256 TClonesArray &lhits = *fHits;
257 new(lhits[fNhits++]) AliMUONHit(hit);
259 //____________________________________________________________________________
260 void AliMUONData::AddLocalTrigger(Int_t *localtr)
262 // add a MUON Local Trigger to the list
263 TClonesArray &localTrigger = *fLocalTrigger;
264 new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(localtr);
266 //____________________________________________________________________________
267 void AliMUONData::AddLocalTrigger(const AliMUONLocalTrigger& trigger)
269 // add a MUON Local Trigger to the list
270 TClonesArray &localTrigger = *fLocalTrigger;
271 new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(trigger);
273 //_____________________________________________________________________________
274 void AliMUONData::AddRawCluster(Int_t id, const AliMUONRawCluster& c)
277 // Add a MUON rawcluster to the list in the detection plane id
279 TClonesArray &lrawcl = *((TClonesArray*) fRawClusters->At(id));
280 new(lrawcl[fNrawclusters[id]++]) AliMUONRawCluster(c);
282 //_____________________________________________________________________________
283 void AliMUONData::AddRecTrack(const AliMUONTrack& track)
286 // Add a MUON rectrack
288 TClonesArray &lrectracks = *fRecTracks;
289 new(lrectracks[fNrectracks++]) AliMUONTrack(track);
290 // printf("TTTTTT %d ,\n",((AliMUONTrack*)fRecTracks->At(fNrectracks-1))->GetNTrackHits());
292 //_____________________________________________________________________________
293 void AliMUONData::AddRecTriggerTrack(const AliMUONTriggerTrack& triggertrack)
296 // Add a MUON triggerrectrack
298 TClonesArray &lrectriggertracks = *fRecTriggerTracks;
299 new(lrectriggertracks[fNrectriggertracks++]) AliMUONTriggerTrack(triggertrack);
300 // printf("TTTTTT %d ,\n",((AliMUONTrack*)fRecTracks->At(fNrectracks-1))->GetNTrackHits());
303 //____________________________________________________________________________
304 TClonesArray* AliMUONData::Digits(Int_t DetectionPlane)
306 //Getting List of Digits
308 return ( (TClonesArray*) fDigits->At(DetectionPlane) );
312 //____________________________________________________________________________
313 TClonesArray* AliMUONData::SDigits(Int_t DetectionPlane)
315 //Getting List of SDigits
317 return ( (TClonesArray*) fSDigits->At(DetectionPlane) );
321 //____________________________________________________________________________
322 Bool_t AliMUONData::IsRawClusterBranchesInTree()
324 // Checking if there are RawCluster Branches In TreeR
326 AliError("No treeR in memory");
331 sprintf(branchname,"%sRawClusters1",GetName());
332 TBranch * branch = 0x0;
333 branch = TreeR()->GetBranch(branchname);
334 if (branch) return kTRUE;
338 //____________________________________________________________________________
339 Bool_t AliMUONData::IsDigitsBranchesInTree()
341 // Checking if there are RawCluster Branches In TreeR
343 AliError("No treeD in memory");
348 sprintf(branchname,"%sDigits1",GetName());
349 TBranch * branch = 0x0;
350 branch = TreeD()->GetBranch(branchname);
351 if (branch) return kTRUE;
355 //____________________________________________________________________________
356 Bool_t AliMUONData::IsTriggerBranchesInTree()
358 // Checking if there are Trigger Branches In TreeR
360 AliError("No treeR in memory");
365 sprintf(branchname,"%sLocalTrigger",GetName());
366 TBranch * branch = 0x0;
367 branch = TreeR()->GetBranch(branchname);
368 if (branch) return kTRUE;
372 //____________________________________________________________________________
373 Bool_t AliMUONData::IsTriggerBranchesInTreeD()
375 // Checking if there are Trigger Branches In TreeR
377 AliError("No treeD in memory");
382 sprintf(branchname,"%sLocalTrigger",GetName());
383 TBranch * branch = 0x0;
384 branch = TreeD()->GetBranch(branchname);
385 if (branch) return kTRUE;
390 //____________________________________________________________________________
391 Bool_t AliMUONData::IsTrackBranchesInTree()
393 // Checking if there are Track Branches In TreeT
395 AliError("No treeT in memory");
400 sprintf(branchname,"%sTrack",GetName());
401 TBranch * branch = 0x0;
402 branch = TreeT()->GetBranch(branchname);
403 if (branch) return kTRUE;
407 //____________________________________________________________________________
408 Bool_t AliMUONData::IsTriggerTrackBranchesInTree()
410 // Checking if there are TriggerTrack Branches In TreeT
412 AliError("No treeT in memory");
417 sprintf(branchname,"%sTriggerTrack",GetName());
418 TBranch * branch = 0x0;
419 branch = TreeT()->GetBranch(branchname);
420 if (branch) return kTRUE;
424 //____________________________________________________________________________
425 void AliMUONData::Fill(Option_t* option)
427 // Method to fill the trees
428 const char *cH = strstr(option,"H");
429 const char *cD = strstr(option,"D"); // Digits branches in TreeD
430 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
431 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
432 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
433 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
434 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
435 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
437 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
440 TBranch * branch = 0x0;
443 if ( TreeH() && cH ) {
449 if ( TreeD() && cD ) {
450 if ( IsTriggerBranchesInTreeD() ) {
451 for (int i=0; i<AliMUONConstants::NCh(); i++) {
452 sprintf(branchname,"%sDigits%d",GetName(),i+1);
453 branch = TreeD()->GetBranch(branchname);
461 if ( TreeD() && cGLT ) {
462 if ( IsDigitsBranchesInTree() ) {
463 sprintf(branchname,"%sLocalTrigger",GetName());
464 branch = TreeD()->GetBranch(branchname);
466 sprintf(branchname,"%sGlobalTrigger",GetName());
467 branch = TreeD()->GetBranch(branchname);
474 if ( TreeS() && cS) {
479 // filling rawclusters
480 if ( TreeR() && cRC ) {
481 if ( IsTriggerBranchesInTree() ) {
482 // Branch per branch filling
483 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
484 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
485 branch = TreeR()->GetBranch(branchname);
489 else TreeR()->Fill();
494 if ( TreeR() && cTC) {
495 if (IsRawClusterBranchesInTree()) {
496 // Branch per branch filling
497 sprintf(branchname,"%sLocalTrigger",GetName());
498 branch = TreeR()->GetBranch(branchname);
500 sprintf(branchname,"%sGlobalTrigger",GetName());
501 branch = TreeR()->GetBranch(branchname);
504 else TreeR()->Fill();
508 if ( TreeT() && cRT ) {
509 if (IsTriggerTrackBranchesInTree()) {
510 sprintf(branchname,"%sTrack",GetName());
511 branch = TreeT()->GetBranch(branchname);
514 else TreeT()->Fill();
516 // filling trigger tracks
517 if ( TreeT() && cRL ) {
518 if (IsTrackBranchesInTree()) {
519 sprintf(branchname,"%sTriggerTrack",GetName());
520 branch = TreeT()->GetBranch(branchname);
523 else TreeT()->Fill();
525 // if ( TreeT() && cRL ) {
526 // sprintf(branchname,"%sTrackTrig",GetName());
530 //_____________________________________________________________________________
531 void AliMUONData::MakeBranch(Option_t* option)
534 // Create Tree branches for the MUON.
536 const Int_t kBufferSize = 4000;
540 const char *cH = strstr(option,"H");
541 const char *cD = strstr(option,"D"); // Digits branches in TreeD
542 const char *cS = strstr(option,"S"); // Digits branches in TreeS
543 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
544 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
545 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
546 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
547 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
548 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
550 TBranch * branch = 0x0;
552 // Creating Branches for Hits
556 fHits = new TClonesArray("AliMUONHit",1000);
557 // if (gAlice->GetMCApp())
558 // gAlice->GetMCApp()->AddHitList (fHits);
562 sprintf(branchname,"%sHits",GetName());
563 branch = TreeH()->GetBranch(branchname);
565 AliInfo(Form("MakeBranch","Branch %s is already in tree.",GetName()));
568 branch = TreeH()->Branch(branchname,&fHits,kBufferSize);
569 //Info("MakeBranch","Making Branch %s for hits \n",branchname);
572 //Creating Branches for Digits
573 if (TreeD() && cD ) {
574 // one branch for digits per chamber
575 if (fDigits == 0x0) {
576 fDigits = new TObjArray(AliMUONConstants::NCh());
577 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
578 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
580 fDigits->AddAt(tca,iDetectionPlane);
583 if (fNdigits == 0x0) {
584 fNdigits = new Int_t[AliMUONConstants::NCh()];
585 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
586 fNdigits[iDetectionPlane]=0;
589 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
590 sprintf(branchname,"%sDigits%d",GetName(),iDetectionPlane+1);
592 branch = TreeD()->GetBranch(branchname);
594 AliInfo(Form("Branch %s is already in tree.",GetName()));
597 TClonesArray * digits = Digits(iDetectionPlane);
598 branch = TreeD()->Branch(branchname, &digits, kBufferSize,1);
599 //Info("MakeBranch","Making Branch %s for digits in detection plane %d\n",branchname,iDetectionPlane+1);
603 if (TreeD() && cGLT ) {
605 // one branch for global trigger
607 sprintf(branchname,"%sGlobalTrigger",GetName());
610 if (fGlobalTrigger == 0x0) {
611 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger");
614 branch = TreeD()->GetBranch(branchname);
616 AliInfo(Form("Branch GlobalTrigger is already in treeD."));
619 branch = TreeD()->Branch(branchname, &fGlobalTrigger, kBufferSize);
620 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
623 // one branch for local trigger
625 sprintf(branchname,"%sLocalTrigger",GetName());
628 if (fLocalTrigger == 0x0) {
629 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
632 branch = TreeD()->GetBranch(branchname);
634 AliInfo(Form("Branch LocalTrigger is already in treeD."));
637 branch = TreeD()->Branch(branchname, &fLocalTrigger, kBufferSize);
638 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
642 //Creating Branches for SDigits
643 if (TreeS() && cS ) {
644 // one branch for Sdigits per chamber
645 if (fSDigits == 0x0) {
646 fSDigits = new TObjArray(AliMUONConstants::NCh());
647 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
648 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
650 fSDigits->AddAt(tca,iDetectionPlane);
653 if (fNSdigits == 0x0) {
654 fNSdigits = new Int_t[AliMUONConstants::NCh()];
655 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
656 fNSdigits[iDetectionPlane]=0;
659 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
660 sprintf(branchname,"%sSDigits%d",GetName(),iDetectionPlane+1);
662 branch = TreeS()->GetBranch(branchname);
664 AliInfo(Form("Branch %s is already in tree.",GetName()));
667 TClonesArray * sdigits = SDigits(iDetectionPlane);
668 branch = TreeS()->Branch(branchname, &sdigits, kBufferSize,1);
669 //Info("MakeBranch","Making Branch %s for sdigits in detection plane %d\n",branchname,iDetectionPlane+1);
673 if (TreeR() && cRC ) {
674 // one branch for raw clusters per tracking detection plane
677 if (fRawClusters == 0x0) {
678 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
679 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
680 TClonesArray * tca = new TClonesArray("AliMUONRawCluster",1000);
682 fRawClusters->AddAt(tca,i);
686 if (fNrawclusters == 0x0) {
687 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
688 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
693 for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) {
694 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
696 branch = TreeR()->GetBranch(branchname);
698 AliInfo(Form("Branch %s is already in tree.",GetName()));
701 branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize);
702 //Info("MakeBranch","Making Branch %s for rawcluster in detection plane %d\n",branchname,i+1);
706 if (TreeR() && cTC ) {
708 // one branch for global trigger
710 sprintf(branchname,"%sGlobalTrigger",GetName());
713 if (fGlobalTrigger == 0x0) {
714 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger");
717 branch = TreeR()->GetBranch(branchname);
719 AliInfo(Form("Branch GlobalTrigger is already in treeR."));
722 branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize);
723 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
726 // one branch for local trigger
728 sprintf(branchname,"%sLocalTrigger",GetName());
731 if (fLocalTrigger == 0x0) {
732 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
735 branch = TreeR()->GetBranch(branchname);
737 AliInfo(Form("Branch LocalTrigger is already in treeR."));
740 branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize);
741 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
744 if (TreeT() && cRT ) {
745 if (fRecTracks == 0x0) fRecTracks = new TClonesArray("AliMUONTrack",100);
747 sprintf(branchname,"%sTrack",GetName());
748 branch = TreeT()->GetBranch(branchname);
750 AliInfo(Form("Branch %s is already in tree.",GetName()));
753 branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize);
754 //Info("MakeBranch","Making Branch %s for tracks \n",branchname);
757 if (TreeT() && cRL ) {
758 if (fRecTriggerTracks == 0x0) fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
759 fNrectriggertracks = 0;
760 sprintf(branchname,"%sTriggerTrack",GetName());
761 branch = TreeT()->GetBranch(branchname);
763 AliInfo(Form("Branch %s is already in tree.",GetName()));
766 branch = TreeT()->Branch(branchname,&fRecTriggerTracks,kBufferSize);
767 //Info("MakeBranch","Making Branch %s for trigger tracks \n",branchname);
770 //____________________________________________________________________________
771 TClonesArray* AliMUONData::RawClusters(Int_t DetectionPlane)
773 // Getting Raw Clusters
775 return ( (TClonesArray*) fRawClusters->At(DetectionPlane) );
779 //____________________________________________________________________________
780 TClonesArray* AliMUONData::LocalTrigger()
782 // Getting Local Trigger
784 return ( (TClonesArray*) fLocalTrigger );
788 //____________________________________________________________________________
789 TClonesArray* AliMUONData::GlobalTrigger()
791 // Getting Global Trigger
793 return ( (TClonesArray*) fGlobalTrigger );
797 //____________________________________________________________________________
798 void AliMUONData::ResetDigits()
801 // Reset number of digits and the digits array for this detector
803 if (fDigits == 0x0) return;
804 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
805 if ((*fDigits)[i]) ((TClonesArray*)fDigits->At(i))->Clear();
806 if (fNdigits) fNdigits[i]=0;
809 //____________________________________________________________________________
810 void AliMUONData::ResetSDigits()
813 // Reset number of Sdigits and the Sdigits array for this detector
815 if (fSDigits == 0x0) return;
816 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
817 if ((*fSDigits)[i]) ((TClonesArray*)fSDigits->At(i))->Clear();
818 if (fNSdigits) fNSdigits[i]=0;
821 //______________________________________________________________________________
822 void AliMUONData::ResetHits()
824 // Reset number of clusters and the cluster array for this detector
826 if (fHits) fHits->Clear();
828 //_______________________________________________________________________________
829 void AliMUONData::ResetRawClusters()
831 // Reset number of raw clusters and the raw clust array for this detector
833 for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) {
834 if ((*fRawClusters)[i]) ((TClonesArray*)fRawClusters->At(i))->Clear();
835 if (fNrawclusters) fNrawclusters[i]=0;
838 //_______________________________________________________________________________
839 void AliMUONData::ResetTrigger()
841 // Reset Local and Global Trigger
843 if (fGlobalTrigger) fGlobalTrigger->Clear();
845 if (fLocalTrigger) fLocalTrigger->Clear();
847 //____________________________________________________________________________
848 void AliMUONData::ResetRecTracks()
850 // Reset tracks information
852 if (fRecTracks) fRecTracks->Clear();
854 //____________________________________________________________________________
855 void AliMUONData::ResetRecTriggerTracks()
857 // Reset tracks information
858 fNrectriggertracks = 0;
859 if (fRecTriggerTracks) fRecTriggerTracks->Clear();
861 //_____________________________________________________________________________
862 void AliMUONData::SetTreeAddress(Option_t* option)
864 //Setting Addresses to the events trees
865 const char *cH = strstr(option,"H");
866 const char *cD = strstr(option,"D"); // Digits branches in TreeD
867 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
868 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
869 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
870 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
871 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
872 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
873 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
875 // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree.
877 TBranch * branch = 0x0;
880 // Branch address for hit tree
881 if ( TreeH() && cH ) {
883 fHits = new TClonesArray("AliMUONHit",1000);
884 // if (gAlice->GetMCApp())
885 // gAlice->GetMCApp()->AddHitList (fHits); Moved to AliMUON
889 if (TreeH() && fHits && cH) {
890 sprintf(branchname,"%sHits",GetName());
891 branch = TreeH()->GetBranch(branchname);
893 // Info("SetTreeAddress","(%s) Setting for Hits",GetName());
894 branch->SetAddress(&fHits);
896 else { //can be invoked before branch creation
897 AliWarning(Form("(%s) Failed for Hits. Can not find branch in tree.",GetName()));
902 // Branch address for digit tree
904 if (fDigits == 0x0 && cD) {
905 fDigits = new TObjArray(AliMUONConstants::NCh());
906 fNdigits= new Int_t[AliMUONConstants::NCh()];
907 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
908 fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i);
912 if (fLocalTrigger == 0x0 && cGLT) {
913 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
915 if (fGlobalTrigger== 0x0 && cGLT) {
916 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
920 if (TreeD() && fDigits && cD) {
921 for (int i=0; i<AliMUONConstants::NCh(); i++) {
922 sprintf(branchname,"%sDigits%d",GetName(),i+1);
924 branch = TreeD()->GetBranch(branchname);
925 TClonesArray * digits = Digits(i);
927 branch->SetAddress( &digits );
929 else AliWarning(Form("(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i));
933 if ( TreeD() && fLocalTrigger && cGLT) {
934 sprintf(branchname,"%sLocalTrigger",GetName());
935 branch = TreeD()->GetBranch(branchname);
936 if (branch) branch->SetAddress(&fLocalTrigger);
937 else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeD.",GetName()));
939 if ( TreeD() && fGlobalTrigger && cGLT) {
940 sprintf(branchname,"%sGlobalTrigger",GetName());
941 branch = TreeD()->GetBranch(branchname);
942 if (branch) branch->SetAddress(&fGlobalTrigger);
943 else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeD.",GetName()));
947 // Branch address for Sdigit tree
948 if ( TreeS() && cS) {
949 if (fSDigits == 0x0) {
950 fSDigits = new TObjArray(AliMUONConstants::NCh());
951 fNSdigits= new Int_t[AliMUONConstants::NCh()];
952 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
953 fSDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i);
959 if (TreeS() && fSDigits && cS) {
960 for (int i=0; i<AliMUONConstants::NCh(); i++) {
961 sprintf(branchname,"%sSDigits%d",GetName(),i+1);
963 branch = TreeS()->GetBranch(branchname);
964 TClonesArray * sdigits = SDigits(i);
965 if (branch) branch->SetAddress( &sdigits );
966 else AliWarning(Form("(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i));
972 // Branch address for rawclusters, globaltrigger and local trigger tree
974 if (fRawClusters == 0x0 && cRC) {
975 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
976 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
977 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
978 fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i);
982 if (fLocalTrigger == 0x0 && cTC) {
983 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
985 if (fGlobalTrigger== 0x0 && cTC) {
986 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
990 if ( TreeR() && fRawClusters && cRC) {
991 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
992 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
994 branch = TreeR()->GetBranch(branchname);
995 if (branch) branch->SetAddress( &((*fRawClusters)[i]) );
996 else AliWarning(Form("(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i));
1000 if ( TreeR() && fLocalTrigger && cTC) {
1001 sprintf(branchname,"%sLocalTrigger",GetName());
1002 branch = TreeR()->GetBranch(branchname);
1003 if (branch) branch->SetAddress(&fLocalTrigger);
1004 else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeR.",GetName()));
1006 if ( TreeR() && fGlobalTrigger && cTC) {
1007 sprintf(branchname,"%sGlobalTrigger",GetName());
1008 branch = TreeR()->GetBranch(branchname);
1009 if (branch) branch->SetAddress(&fGlobalTrigger);
1010 else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeR.",GetName()));
1014 if (fRecTracks == 0x0 && cRT) {
1015 fRecTracks = new TClonesArray("AliMUONTrack",100);
1019 if ( TreeT() && fRecTracks && cRT ) {
1020 sprintf(branchname,"%sTrack",GetName());
1021 branch = TreeT()->GetBranch(branchname);
1022 if (branch) branch->SetAddress(&fRecTracks);
1023 else AliWarning(Form("(%s) Failed for Tracks. Can not find branch in tree.",GetName()));
1027 if (fRecTriggerTracks == 0x0 && cRL) {
1028 fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
1032 if ( TreeT() && fRecTriggerTracks && cRL ) {
1033 sprintf(branchname,"%sTriggerTrack",GetName());
1034 branch = TreeT()->GetBranch(branchname);
1035 if (branch) branch->SetAddress(&fRecTriggerTracks);
1036 else AliWarning(Form("(%s) Failed for Trigger Tracks. Can not find branch in tree.",GetName()));
1041 //_____________________________________________________________________________