No need for libMUOBshuttle
[u/mrichter/AliRoot.git] / HMPID / AliHMPID.cxx
CommitLineData
d3da6dc4 1// **************************************************************************
2// * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3// * *
4// * Author: The ALICE Off-line Project. *
5// * Contributors are mentioned in the code where appropriate. *
6// * *
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// **************************************************************************
15
16#include "AliHMPID.h"
17#include "AliHMPIDHit.h" //OccupancyPrint(), HitQa()
3c6274c1 18#include "AliHMPIDDigit.h" //
d3da6dc4 19#include <TParticle.h> //SummaryOfEvent(), HitQa()
20#include <TBenchmark.h> //HitQA()
21#include <TPDGCode.h> //HitQA()
3c6274c1 22#include <AliStack.h> //SummaryOfEvent(), HitQa()
d3da6dc4 23#include <AliRun.h> //HitQa()
24#include <AliMC.h> //ctor
25#include <AliHeader.h>
d3da6dc4 26#include <TH1F.h> //HitQA()
27#include <AliLog.h> //in many methods to print AliInfo
28ClassImp(AliHMPID)
29//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
30AliHMPID::AliHMPID(const char *name, const char *title):AliDetector(name,title),fSdi(0),fDig(0),fClu(0)
31{
32//Named ctor
33 AliDebug(1,"Start.");
34//AliDetector ctor deals with Hits and Digits (reset them to 0, does not create them)
35 HitCreate(); gAlice->GetMCApp()->AddHitList(fHits);
36 AliDebug(1,"Stop.");
37}//AliHMPID::AliHMPID(const char *name, const char *title)
38//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
39AliHMPID::~AliHMPID()
40{
41//dtor
42 AliDebug(1,"Start.");
43
44
45 if(fHits) delete fHits;
46 if(fDigits) delete fDigits;
47 if(fSdi) delete fSdi;
48 if(fDig) {fDig->Delete(); delete fDig;}
49 if(fClu) {fClu->Delete(); delete fClu;}
50 AliDebug(1,"Stop.");
51}//AliHMPID::~AliHMPID()
52//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
53void AliHMPID::MakeBranch(Option_t* option)
54{
55//Create Tree branches for the HMPID.
56 AliDebug(1,Form("Start with option= %s.",option));
57
58 const Int_t kBufSize = 4000;
59
60 const char *cH = strstr(option,"H");
61 const char *cD = strstr(option,"D");
62 const char *cR = strstr(option,"R");
63 const char *cS = strstr(option,"S");
64
65 if(cH&& TreeH()){HitCreate(); MakeBranchInTree( TreeH(), "HMPID" ,&fHits ,kBufSize,0);}
66 if(cS&&fLoader->TreeS()){SdiCreate(); MakeBranchInTree(fLoader->TreeS(), "HMPID" ,&fSdi ,kBufSize,0);}
67 if(cD&&fLoader->TreeD()){DigCreate();for(Int_t i=0;i<7;i++) MakeBranchInTree(fLoader->TreeD(),Form("HMPID%d",i),&((*fDig)[i]),kBufSize,0);}
68 if(cR&&fLoader->TreeR()){CluCreate();for(Int_t i=0;i<7;i++) MakeBranchInTree(fLoader->TreeR(),Form("HMPID%d",i),&((*fClu)[i]),kBufSize,0);}
69
70 AliDebug(1,"Stop.");
71}//void AliHMPID::MakeBranch(Option_t* option)
72//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
73void AliHMPID::SetTreeAddress()
74{
75//Set branch address for the Hits and Digits Tree.
76 AliDebug(1,"Start.");
77 if(fLoader->TreeH() && fLoader->TreeH()->GetBranch("HMPID" )){HitCreate(); fLoader->TreeH()->SetBranchAddress( "HMPID" ,&fHits );}
78 if(fLoader->TreeS() && fLoader->TreeS()->GetBranch("HMPID" )){SdiCreate(); fLoader->TreeS()->SetBranchAddress( "HMPID" ,&fSdi );}
79 if(fLoader->TreeD() && fLoader->TreeD()->GetBranch("HMPID0")){DigCreate(); for(int i=0;i<7;i++) fLoader->TreeD()->SetBranchAddress(Form("HMPID%d",i),&((*fDig)[i]));}
80 if(fLoader->TreeR() && fLoader->TreeR()->GetBranch("HMPID0")){CluCreate(); for(int i=0;i<7;i++) fLoader->TreeR()->SetBranchAddress(Form("HMPID%d",i),&((*fClu)[i]));}
81 AliDebug(1,"Stop.");
82}//void AliHMPID::SetTreeAddress()
83//__________________________________________________________________________________________________
84// AliHMPIDHit* AliHMPID::Hit(Int_t tid)const
85// {
86// // Search for the first HMPID hit belonging to the given tid
87// GetLoader()->LoadHits();
88// for(Int_t iPrimN=0;iPrimN<GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop
89// GetLoader()->TreeH()->GetEntry(iPrimN);
90// for(Int_t iHitN=0;iHitN<Hits()->GetEntries();iHitN++){
91// AliHMPIDHit *pHit=(AliHMPIDHit*)Hits()->At(iHitN);
92// if(tid==pHit->Track()) {GetLoader()->UnloadHits();return pHit;}
93// }//hits
94// }//prims loop
95// GetLoader()->UnloadHits();
96// return 0;
97// }