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