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 #include "AliHMPIDHit.h" //OccupancyPrint(), HitQa()
18 #include "AliHMPIDDigit.h" //
19 #include <TParticle.h> //SummaryOfEvent(), HitQa()
20 #include <TBenchmark.h> //HitQA()
21 #include <TPDGCode.h> //HitQA()
22 #include <AliStack.h> //SummaryOfEvent(), HitQa()
23 #include <AliRun.h> //HitQa()
24 #include <AliMC.h> //ctor
25 #include <AliHeader.h>
26 #include <TH1F.h> //HitQA()
27 #include <AliLog.h> //in many methods to print AliInfo
30 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
31 AliHMPID::AliHMPID(const char *name, const char *title):AliDetector(name,title),fDoFeed(kTRUE),fSdi(0),fDig(0),fClu(0)
35 //AliDetector ctor deals with Hits and Digits (reset them to 0, does not create them)
36 HitCreate(); gAlice->GetMCApp()->AddHitList(fHits);
39 fDoFeed=!ttl.Contains("NoFeedBack");
41 }//AliHMPID::AliHMPID(const char *name, const char *title)
42 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
49 if(fHits) delete fHits;
50 if(fDigits) delete fDigits;
52 if(fDig) {fDig->Delete(); delete fDig;}
53 if(fClu) {fClu->Delete(); delete fClu;}
55 }//AliHMPID::~AliHMPID()
56 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
57 void AliHMPID::MakeBranch(Option_t* option)
59 //Create Tree branches for the HMPID.
60 AliDebug(1,Form("Start with option= %s.",option));
62 const Int_t kBufSize = 4000;
64 const char *cH = strstr(option,"H");
65 const char *cD = strstr(option,"D");
66 const char *cR = strstr(option,"R");
67 const char *cS = strstr(option,"S");
69 if(cH&&fLoader->TreeH()){HitCreate(); MakeBranchInTree(fLoader->TreeH(), "HMPID" ,&fHits ,kBufSize,0);}
70 if(cS&&fLoader->TreeS()){SdiCreate(); MakeBranchInTree(fLoader->TreeS(), "HMPID" ,&fSdi ,kBufSize,0);}
71 if(cD&&fLoader->TreeD()){DigCreate();for(Int_t i=0;i<7;i++) MakeBranchInTree(fLoader->TreeD(),Form("HMPID%d",i),&((*fDig)[i]),kBufSize,0);}
72 if(cR&&fLoader->TreeR()){CluCreate();for(Int_t i=0;i<7;i++) MakeBranchInTree(fLoader->TreeR(),Form("HMPID%d",i),&((*fClu)[i]),kBufSize,0);}
75 }//void AliHMPID::MakeBranch(Option_t* option)
76 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
77 void AliHMPID::SetTreeAddress()
79 //Set branch address for the Hits and Digits Tree.
81 if(fLoader->TreeH() && fLoader->TreeH()->GetBranch("HMPID" )){HitCreate(); fLoader->TreeH()->SetBranchAddress( "HMPID" ,&fHits );}
82 if(fLoader->TreeS() && fLoader->TreeS()->GetBranch("HMPID" )){SdiCreate(); fLoader->TreeS()->SetBranchAddress( "HMPID" ,&fSdi );}
83 if(fLoader->TreeD() && fLoader->TreeD()->GetBranch("HMPID0")){DigCreate(); for(int i=0;i<7;i++) fLoader->TreeD()->SetBranchAddress(Form("HMPID%d",i),&((*fDig)[i]));}
84 if(fLoader->TreeR() && fLoader->TreeR()->GetBranch("HMPID0")){CluCreate(); for(int i=0;i<7;i++) fLoader->TreeR()->SetBranchAddress(Form("HMPID%d",i),&((*fClu)[i]));}
86 }//void AliHMPID::SetTreeAddress()
87 //__________________________________________________________________________________________________
88 // AliHMPIDHit* AliHMPID::Hit(Int_t tid)const
90 // // Search for the first HMPID hit belonging to the given tid
91 // GetLoader()->LoadHits();
92 // for(Int_t iPrimN=0;iPrimN<GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop
93 // GetLoader()->TreeH()->GetEntry(iPrimN);
94 // for(Int_t iHitN=0;iHitN<Hits()->GetEntries();iHitN++){
95 // AliHMPIDHit *pHit=(AliHMPIDHit*)Hits()->At(iHitN);
96 // if(tid==pHit->Track()) {GetLoader()->UnloadHits();return pHit;}
99 // GetLoader()->UnloadHits();