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,
230 Float_t Xref,Float_t Yref,Float_t Zref)
232 // Add new hit to the hit list
233 TClonesArray &lhits = *fHits;
234 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, iChamber,
236 tof, momentum, theta,
240 //____________________________________________________________________________
241 void AliMUONData::AddHit2(Int_t fIshunt, Int_t track, Int_t detElemId,
242 Int_t idpart, Float_t X, Float_t Y, Float_t Z,
243 Float_t tof, Float_t momentum, Float_t theta,
244 Float_t phi, Float_t length, Float_t destep,
245 Float_t Xref,Float_t Yref,Float_t Zref)
247 // Add new hit to the hit list
248 TClonesArray &lhits = *fHits;
249 new(lhits[fNhits++]) AliMUONHit(fIshunt, track, detElemId,
251 tof, momentum, theta,
253 Xref,Yref,Zref, true);
255 //____________________________________________________________________________
256 void AliMUONData::AddLocalTrigger(const Int_t *localtr, const TArrayI& digits)
258 // add a MUON Local Trigger to the list
259 TClonesArray &localTrigger = *fLocalTrigger;
260 new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(localtr, digits);
262 //____________________________________________________________________________
263 void AliMUONData::AddLocalTrigger(const AliMUONLocalTrigger& trigger)
265 // add a MUON Local Trigger to the list
266 TClonesArray &localTrigger = *fLocalTrigger;
267 new(localTrigger[fNlocaltrigger++]) AliMUONLocalTrigger(trigger);
269 //_____________________________________________________________________________
270 void AliMUONData::AddRawCluster(Int_t id, const AliMUONRawCluster& c)
273 // Add a MUON rawcluster to the list in the detection plane id
275 TClonesArray &lrawcl = *((TClonesArray*) fRawClusters->At(id));
276 new(lrawcl[fNrawclusters[id]++]) AliMUONRawCluster(c);
278 //_____________________________________________________________________________
279 void AliMUONData::AddRecTrack(const AliMUONTrack& track)
282 // Add a MUON rectrack
284 TClonesArray &lrectracks = *fRecTracks;
285 new(lrectracks[fNrectracks++]) AliMUONTrack(track);
286 // printf("TTTTTT %d ,\n",((AliMUONTrack*)fRecTracks->At(fNrectracks-1))->GetNTrackHits());
288 //_____________________________________________________________________________
289 void AliMUONData::AddRecTriggerTrack(const AliMUONTriggerTrack& triggertrack)
292 // Add a MUON triggerrectrack
294 TClonesArray &lrectriggertracks = *fRecTriggerTracks;
295 new(lrectriggertracks[fNrectriggertracks++]) AliMUONTriggerTrack(triggertrack);
296 // printf("TTTTTT %d ,\n",((AliMUONTrack*)fRecTracks->At(fNrectracks-1))->GetNTrackHits());
299 //____________________________________________________________________________
300 TClonesArray* AliMUONData::Digits(Int_t DetectionPlane)
302 //Getting List of Digits
304 return ( (TClonesArray*) fDigits->At(DetectionPlane) );
308 //____________________________________________________________________________
309 TClonesArray* AliMUONData::SDigits(Int_t DetectionPlane)
311 //Getting List of SDigits
313 return ( (TClonesArray*) fSDigits->At(DetectionPlane) );
317 //____________________________________________________________________________
318 Bool_t AliMUONData::IsRawClusterBranchesInTree()
320 // Checking if there are RawCluster Branches In TreeR
322 AliError("No treeR in memory");
327 sprintf(branchname,"%sRawClusters1",GetName());
328 TBranch * branch = 0x0;
329 branch = TreeR()->GetBranch(branchname);
330 if (branch) return kTRUE;
334 //____________________________________________________________________________
335 Bool_t AliMUONData::IsDigitsBranchesInTree()
337 // Checking if there are RawCluster Branches In TreeR
339 AliError("No treeD in memory");
344 sprintf(branchname,"%sDigits1",GetName());
345 TBranch * branch = 0x0;
346 branch = TreeD()->GetBranch(branchname);
347 if (branch) return kTRUE;
351 //____________________________________________________________________________
352 Bool_t AliMUONData::IsTriggerBranchesInTree()
354 // Checking if there are Trigger Branches In TreeR
356 AliError("No treeR in memory");
361 sprintf(branchname,"%sLocalTrigger",GetName());
362 TBranch * branch = 0x0;
363 branch = TreeR()->GetBranch(branchname);
364 if (branch) return kTRUE;
368 //____________________________________________________________________________
369 Bool_t AliMUONData::IsTriggerBranchesInTreeD()
371 // Checking if there are Trigger Branches In TreeR
373 AliError("No treeD in memory");
378 sprintf(branchname,"%sLocalTrigger",GetName());
379 TBranch * branch = 0x0;
380 branch = TreeD()->GetBranch(branchname);
381 if (branch) return kTRUE;
386 //____________________________________________________________________________
387 Bool_t AliMUONData::IsTrackBranchesInTree()
389 // Checking if there are Track Branches In TreeT
391 AliError("No treeT in memory");
396 sprintf(branchname,"%sTrack",GetName());
397 TBranch * branch = 0x0;
398 branch = TreeT()->GetBranch(branchname);
399 if (branch) return kTRUE;
403 //____________________________________________________________________________
404 Bool_t AliMUONData::IsTriggerTrackBranchesInTree()
406 // Checking if there are TriggerTrack Branches In TreeT
408 AliError("No treeT in memory");
413 sprintf(branchname,"%sTriggerTrack",GetName());
414 TBranch * branch = 0x0;
415 branch = TreeT()->GetBranch(branchname);
416 if (branch) return kTRUE;
420 //____________________________________________________________________________
421 void AliMUONData::Fill(Option_t* option)
423 // Method to fill the trees
424 const char *cH = strstr(option,"H");
425 const char *cD = strstr(option,"D"); // Digits branches in TreeD
426 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
427 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
428 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
429 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
430 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
431 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
433 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
436 TBranch * branch = 0x0;
439 if ( TreeH() && cH ) {
445 if ( TreeD() && cD ) {
446 if ( IsTriggerBranchesInTreeD() ) {
447 for (int i=0; i<AliMUONConstants::NCh(); i++) {
448 sprintf(branchname,"%sDigits%d",GetName(),i+1);
449 branch = TreeD()->GetBranch(branchname);
457 if ( TreeD() && cGLT ) {
458 if ( IsDigitsBranchesInTree() ) {
459 sprintf(branchname,"%sLocalTrigger",GetName());
460 branch = TreeD()->GetBranch(branchname);
462 sprintf(branchname,"%sGlobalTrigger",GetName());
463 branch = TreeD()->GetBranch(branchname);
470 if ( TreeS() && cS) {
475 // filling rawclusters
476 if ( TreeR() && cRC ) {
477 if ( IsTriggerBranchesInTree() ) {
478 // Branch per branch filling
479 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
480 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
481 branch = TreeR()->GetBranch(branchname);
485 else TreeR()->Fill();
490 if ( TreeR() && cTC) {
491 if (IsRawClusterBranchesInTree()) {
492 // Branch per branch filling
493 sprintf(branchname,"%sLocalTrigger",GetName());
494 branch = TreeR()->GetBranch(branchname);
496 sprintf(branchname,"%sGlobalTrigger",GetName());
497 branch = TreeR()->GetBranch(branchname);
500 else TreeR()->Fill();
504 if ( TreeT() && cRT ) {
505 if (IsTriggerTrackBranchesInTree()) {
506 sprintf(branchname,"%sTrack",GetName());
507 branch = TreeT()->GetBranch(branchname);
510 else TreeT()->Fill();
512 // filling trigger tracks
513 if ( TreeT() && cRL ) {
514 if (IsTrackBranchesInTree()) {
515 sprintf(branchname,"%sTriggerTrack",GetName());
516 branch = TreeT()->GetBranch(branchname);
519 else TreeT()->Fill();
521 // if ( TreeT() && cRL ) {
522 // sprintf(branchname,"%sTrackTrig",GetName());
526 //_____________________________________________________________________________
527 void AliMUONData::MakeBranch(Option_t* option)
530 // Create Tree branches for the MUON.
532 const Int_t kBufferSize = 4000;
536 const char *cH = strstr(option,"H");
537 const char *cD = strstr(option,"D"); // Digits branches in TreeD
538 const char *cS = strstr(option,"S"); // Digits branches in TreeS
539 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
540 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
541 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
542 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
543 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
544 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
546 TBranch * branch = 0x0;
548 // Creating Branches for Hits
552 fHits = new TClonesArray("AliMUONHit",1000);
553 // if (gAlice->GetMCApp())
554 // gAlice->GetMCApp()->AddHitList (fHits);
558 sprintf(branchname,"%sHits",GetName());
559 branch = TreeH()->GetBranch(branchname);
561 AliInfo(Form("MakeBranch","Branch %s is already in tree.",GetName()));
564 branch = TreeH()->Branch(branchname,&fHits,kBufferSize);
565 //Info("MakeBranch","Making Branch %s for hits \n",branchname);
568 //Creating Branches for Digits
569 if (TreeD() && cD ) {
570 // one branch for digits per chamber
571 if (fDigits == 0x0) {
572 fDigits = new TObjArray(AliMUONConstants::NCh());
573 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
574 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
576 fDigits->AddAt(tca,iDetectionPlane);
579 if (fNdigits == 0x0) {
580 fNdigits = new Int_t[AliMUONConstants::NCh()];
581 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
582 fNdigits[iDetectionPlane]=0;
585 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
586 sprintf(branchname,"%sDigits%d",GetName(),iDetectionPlane+1);
588 branch = TreeD()->GetBranch(branchname);
590 AliInfo(Form("Branch %s is already in tree.",GetName()));
593 TClonesArray * digits = Digits(iDetectionPlane);
594 branch = TreeD()->Branch(branchname, &digits, kBufferSize,1);
595 //Info("MakeBranch","Making Branch %s for digits in detection plane %d\n",branchname,iDetectionPlane+1);
599 if (TreeD() && cGLT ) {
601 // one branch for global trigger
603 sprintf(branchname,"%sGlobalTrigger",GetName());
606 if (fGlobalTrigger == 0x0) {
607 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger");
610 branch = TreeD()->GetBranch(branchname);
612 AliInfo(Form("Branch GlobalTrigger is already in treeD."));
615 branch = TreeD()->Branch(branchname, &fGlobalTrigger, kBufferSize);
616 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
619 // one branch for local trigger
621 sprintf(branchname,"%sLocalTrigger",GetName());
624 if (fLocalTrigger == 0x0) {
625 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
628 branch = TreeD()->GetBranch(branchname);
630 AliInfo(Form("Branch LocalTrigger is already in treeD."));
633 branch = TreeD()->Branch(branchname, &fLocalTrigger, kBufferSize);
634 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
638 //Creating Branches for SDigits
639 if (TreeS() && cS ) {
640 // one branch for Sdigits per chamber
641 if (fSDigits == 0x0) {
642 fSDigits = new TObjArray(AliMUONConstants::NCh());
643 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
644 TClonesArray * tca = new TClonesArray("AliMUONDigit",10000);
646 fSDigits->AddAt(tca,iDetectionPlane);
649 if (fNSdigits == 0x0) {
650 fNSdigits = new Int_t[AliMUONConstants::NCh()];
651 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
652 fNSdigits[iDetectionPlane]=0;
655 for (Int_t iDetectionPlane=0; iDetectionPlane<AliMUONConstants::NCh() ;iDetectionPlane++) {
656 sprintf(branchname,"%sSDigits%d",GetName(),iDetectionPlane+1);
658 branch = TreeS()->GetBranch(branchname);
660 AliInfo(Form("Branch %s is already in tree.",GetName()));
663 TClonesArray * sdigits = SDigits(iDetectionPlane);
664 branch = TreeS()->Branch(branchname, &sdigits, kBufferSize,1);
665 //Info("MakeBranch","Making Branch %s for sdigits in detection plane %d\n",branchname,iDetectionPlane+1);
669 if (TreeR() && cRC ) {
670 // one branch for raw clusters per tracking detection plane
673 if (fRawClusters == 0x0) {
674 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
675 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
676 TClonesArray * tca = new TClonesArray("AliMUONRawCluster",1000);
678 fRawClusters->AddAt(tca,i);
682 if (fNrawclusters == 0x0) {
683 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
684 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
689 for (i=0; i<AliMUONConstants::NTrackingCh() ;i++) {
690 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
692 branch = TreeR()->GetBranch(branchname);
694 AliInfo(Form("Branch %s is already in tree.",GetName()));
697 branch = TreeR()->Branch(branchname, &((*fRawClusters)[i]),kBufferSize);
698 //Info("MakeBranch","Making Branch %s for rawcluster in detection plane %d\n",branchname,i+1);
702 if (TreeR() && cTC ) {
704 // one branch for global trigger
706 sprintf(branchname,"%sGlobalTrigger",GetName());
709 if (fGlobalTrigger == 0x0) {
710 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger");
713 branch = TreeR()->GetBranch(branchname);
715 AliInfo(Form("Branch GlobalTrigger is already in treeR."));
718 branch = TreeR()->Branch(branchname, &fGlobalTrigger, kBufferSize);
719 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
722 // one branch for local trigger
724 sprintf(branchname,"%sLocalTrigger",GetName());
727 if (fLocalTrigger == 0x0) {
728 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
731 branch = TreeR()->GetBranch(branchname);
733 AliInfo(Form("Branch LocalTrigger is already in treeR."));
736 branch = TreeR()->Branch(branchname, &fLocalTrigger, kBufferSize);
737 //Info("MakeBranch", "Making Branch %s for Global Trigger\n",branchname);
740 if (TreeT() && cRT ) {
741 if (fRecTracks == 0x0) fRecTracks = new TClonesArray("AliMUONTrack",100);
743 sprintf(branchname,"%sTrack",GetName());
744 branch = TreeT()->GetBranch(branchname);
746 AliInfo(Form("Branch %s is already in tree.",GetName()));
749 branch = TreeT()->Branch(branchname,&fRecTracks,kBufferSize);
750 //Info("MakeBranch","Making Branch %s for tracks \n",branchname);
753 if (TreeT() && cRL ) {
754 if (fRecTriggerTracks == 0x0) fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
755 fNrectriggertracks = 0;
756 sprintf(branchname,"%sTriggerTrack",GetName());
757 branch = TreeT()->GetBranch(branchname);
759 AliInfo(Form("Branch %s is already in tree.",GetName()));
762 branch = TreeT()->Branch(branchname,&fRecTriggerTracks,kBufferSize);
763 //Info("MakeBranch","Making Branch %s for trigger tracks \n",branchname);
766 //____________________________________________________________________________
767 TClonesArray* AliMUONData::RawClusters(Int_t DetectionPlane)
769 // Getting Raw Clusters
771 return ( (TClonesArray*) fRawClusters->At(DetectionPlane) );
775 //____________________________________________________________________________
776 TClonesArray* AliMUONData::LocalTrigger()
778 // Getting Local Trigger
780 return ( (TClonesArray*) fLocalTrigger );
784 //____________________________________________________________________________
785 TClonesArray* AliMUONData::GlobalTrigger()
787 // Getting Global Trigger
789 return ( (TClonesArray*) fGlobalTrigger );
793 //____________________________________________________________________________
794 void AliMUONData::ResetDigits()
797 // Reset number of digits and the digits array for this detector
799 if (fDigits == 0x0) return;
800 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
801 if ((*fDigits)[i]) ((TClonesArray*)fDigits->At(i))->Clear();
802 if (fNdigits) fNdigits[i]=0;
805 //____________________________________________________________________________
806 void AliMUONData::ResetSDigits()
809 // Reset number of Sdigits and the Sdigits array for this detector
811 if (fSDigits == 0x0) return;
812 for ( int i=0;i<AliMUONConstants::NCh();i++ ) {
813 if ((*fSDigits)[i]) ((TClonesArray*)fSDigits->At(i))->Clear();
814 if (fNSdigits) fNSdigits[i]=0;
817 //______________________________________________________________________________
818 void AliMUONData::ResetHits()
820 // Reset number of clusters and the cluster array for this detector
822 if (fHits) fHits->Clear();
824 //_______________________________________________________________________________
825 void AliMUONData::ResetRawClusters()
827 // Reset number of raw clusters and the raw clust array for this detector
829 for ( int i=0;i<AliMUONConstants::NTrackingCh();i++ ) {
830 if ((*fRawClusters)[i]) ((TClonesArray*)fRawClusters->At(i))->Clear();
831 if (fNrawclusters) fNrawclusters[i]=0;
834 //_______________________________________________________________________________
835 void AliMUONData::ResetTrigger()
837 // Reset Local and Global Trigger
839 if (fGlobalTrigger) fGlobalTrigger->Clear();
841 if (fLocalTrigger) fLocalTrigger->Clear();
843 //____________________________________________________________________________
844 void AliMUONData::ResetRecTracks()
846 // Reset tracks information
848 if (fRecTracks) fRecTracks->Delete(); // necessary to delete in case of memory allocation
850 //____________________________________________________________________________
851 void AliMUONData::ResetRecTriggerTracks()
853 // Reset tracks information
854 fNrectriggertracks = 0;
855 if (fRecTriggerTracks) fRecTriggerTracks->Delete(); // necessary to delete in case of memory allocation
857 //_____________________________________________________________________________
858 void AliMUONData::SetTreeAddress(Option_t* option)
860 //Setting Addresses to the events trees
861 const char *cH = strstr(option,"H");
862 const char *cD = strstr(option,"D"); // Digits branches in TreeD
863 const char *cS = strstr(option,"S"); // SDigits branches in TreeS
864 const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
865 const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeD
866 const char *cTC = strstr(option,"TC"); // global and local Trigger branches Copy in TreeR
867 const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
868 const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
869 //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
871 // Set branch address for the Hits, Digits, RawClusters, GlobalTrigger and LocalTrigger Tree.
873 TBranch * branch = 0x0;
876 // Branch address for hit tree
877 if ( TreeH() && cH ) {
879 fHits = new TClonesArray("AliMUONHit",1000);
880 // if (gAlice->GetMCApp())
881 // gAlice->GetMCApp()->AddHitList (fHits); Moved to AliMUON
885 if (TreeH() && fHits && cH) {
886 sprintf(branchname,"%sHits",GetName());
887 branch = TreeH()->GetBranch(branchname);
889 // Info("SetTreeAddress","(%s) Setting for Hits",GetName());
890 branch->SetAddress(&fHits);
892 else { //can be invoked before branch creation
893 AliWarning(Form("(%s) Failed for Hits. Can not find branch in tree.",GetName()));
898 // Branch address for digit tree
900 if (fDigits == 0x0 && cD) {
901 fDigits = new TObjArray(AliMUONConstants::NCh());
902 fNdigits= new Int_t[AliMUONConstants::NCh()];
903 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
904 fDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i);
908 if (fLocalTrigger == 0x0 && cGLT) {
909 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
911 if (fGlobalTrigger== 0x0 && cGLT) {
912 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
916 if (TreeD() && fDigits && cD) {
917 for (int i=0; i<AliMUONConstants::NCh(); i++) {
918 sprintf(branchname,"%sDigits%d",GetName(),i+1);
920 branch = TreeD()->GetBranch(branchname);
921 TClonesArray * digits = Digits(i);
923 branch->SetAddress( &digits );
925 else AliWarning(Form("(%s) Failed for Digits Detection plane %d. Can not find branch in tree.",GetName(),i));
929 if ( TreeD() && fLocalTrigger && cGLT) {
930 sprintf(branchname,"%sLocalTrigger",GetName());
931 branch = TreeD()->GetBranch(branchname);
932 if (branch) branch->SetAddress(&fLocalTrigger);
933 else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeD.",GetName()));
935 if ( TreeD() && fGlobalTrigger && cGLT) {
936 sprintf(branchname,"%sGlobalTrigger",GetName());
937 branch = TreeD()->GetBranch(branchname);
938 if (branch) branch->SetAddress(&fGlobalTrigger);
939 else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeD.",GetName()));
943 // Branch address for Sdigit tree
944 if ( TreeS() && cS) {
945 if (fSDigits == 0x0) {
946 fSDigits = new TObjArray(AliMUONConstants::NCh());
947 fNSdigits= new Int_t[AliMUONConstants::NCh()];
948 for (Int_t i=0; i<AliMUONConstants::NCh() ;i++) {
949 fSDigits->AddAt(new TClonesArray("AliMUONDigit",10000),i);
955 if (TreeS() && fSDigits && cS) {
956 for (int i=0; i<AliMUONConstants::NCh(); i++) {
957 sprintf(branchname,"%sSDigits%d",GetName(),i+1);
959 branch = TreeS()->GetBranch(branchname);
960 TClonesArray * sdigits = SDigits(i);
961 if (branch) branch->SetAddress( &sdigits );
962 else AliWarning(Form("(%s) Failed for SDigits Detection plane %d. Can not find branch in tree.",GetName(),i));
968 // Branch address for rawclusters, globaltrigger and local trigger tree
970 if (fRawClusters == 0x0 && cRC) {
971 fRawClusters = new TObjArray(AliMUONConstants::NTrackingCh());
972 fNrawclusters= new Int_t[AliMUONConstants::NTrackingCh()];
973 for (Int_t i=0; i<AliMUONConstants::NTrackingCh();i++) {
974 fRawClusters->AddAt(new TClonesArray("AliMUONRawCluster",10000),i);
978 if (fLocalTrigger == 0x0 && cTC) {
979 fLocalTrigger = new TClonesArray("AliMUONLocalTrigger",234);
981 if (fGlobalTrigger== 0x0 && cTC) {
982 fGlobalTrigger = new TClonesArray("AliMUONGlobalTrigger",1);
986 if ( TreeR() && fRawClusters && cRC && !strstr(cRC,"RCC")) {
987 for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
988 sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
990 branch = TreeR()->GetBranch(branchname);
991 if (branch) branch->SetAddress( &((*fRawClusters)[i]) );
992 else AliWarning(Form("(%s) Failed for RawClusters Detection plane %d. Can not find branch in tree.",GetName(),i));
996 if ( TreeR() && fLocalTrigger && cTC) {
997 sprintf(branchname,"%sLocalTrigger",GetName());
998 branch = TreeR()->GetBranch(branchname);
999 if (branch) branch->SetAddress(&fLocalTrigger);
1000 else AliWarning(Form("(%s) Failed for LocalTrigger. Can not find branch in treeR.",GetName()));
1002 if ( TreeR() && fGlobalTrigger && cTC) {
1003 sprintf(branchname,"%sGlobalTrigger",GetName());
1004 branch = TreeR()->GetBranch(branchname);
1005 if (branch) branch->SetAddress(&fGlobalTrigger);
1006 else AliWarning(Form("(%s) Failed for GlobalTrigger. Can not find branch in treeR.",GetName()));
1010 if (fRecTracks == 0x0 && cRT) {
1011 fRecTracks = new TClonesArray("AliMUONTrack",100);
1015 if ( TreeT() && fRecTracks && cRT ) {
1016 sprintf(branchname,"%sTrack",GetName());
1017 branch = TreeT()->GetBranch(branchname);
1018 if (branch) branch->SetAddress(&fRecTracks);
1019 else AliWarning(Form("(%s) Failed for Tracks. Can not find branch in tree.",GetName()));
1023 if (fRecTriggerTracks == 0x0 && cRL) {
1024 fRecTriggerTracks = new TClonesArray("AliMUONTriggerTrack",100);
1028 if ( TreeT() && fRecTriggerTracks && cRL ) {
1029 sprintf(branchname,"%sTriggerTrack",GetName());
1030 branch = TreeT()->GetBranch(branchname);
1031 if (branch) branch->SetAddress(&fRecTriggerTracks);
1032 else AliWarning(Form("(%s) Failed for Trigger Tracks. Can not find branch in tree.",GetName()));
1037 //_____________________________________________________________________________