]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICH.cxx
Adding the binaliengui.pkg that will be used to build the aliengui executable.
[u/mrichter/AliRoot.git] / RICH / AliRICH.cxx
CommitLineData
53fd478b 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// **************************************************************************
4c039060 15
53fd478b 16#include "AliRICH.h"
e30ca504 17#include "AliRICHHit.h" //OccupancyPrint(), HitQa()
18#include "AliRICHDigit.h" //OccupancyPrint()
19#include <TParticle.h> //SummaryOfEvent(), HitQa()
20#include <TBenchmark.h> //HitQA()
21#include <TPDGCode.h> //HitQA()
22#include <AliStack.h> //OccupancyPrint(), SummaryOfEvent(), HitQa()
23#include <AliRun.h> //HitQa()
db910db9 24#include <AliMC.h> //ctor
e53ffca5 25#include <AliHeader.h>
26#include <AliGenEventHeader.h>
27#include <AliGenHijingEventHeader.h>
db910db9 28#include <TH1F.h> //HitQA()
e30ca504 29#include <AliLog.h> //in many methods to print AliInfo
c60862bf 30ClassImp(AliRICH)
e30ca504 31//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
32AliRICH::AliRICH(const char *name, const char *title):AliDetector(name,title),fSdi(0),fDig(0),fClu(0)
53fd478b 33{
34//Named ctor
998b831f 35 AliDebug(1,"Start.");
543d5224 36//AliDetector ctor deals with Hits and Digits (reset them to 0, does not create them)
db910db9 37 HitCreate(); gAlice->GetMCApp()->AddHitList(fHits);
998b831f 38 AliDebug(1,"Stop.");
dfb4e77d 39}//AliRICH::AliRICH(const char *name, const char *title)
e30ca504 40//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
fe4da5cc 41AliRICH::~AliRICH()
53fd478b 42{
43//dtor
998b831f 44 AliDebug(1,"Start.");
237c933d 45
c60862bf 46
47 if(fHits) delete fHits;
c60862bf 48 if(fDigits) delete fDigits;
e30ca504 49 if(fSdi) delete fSdi;
db910db9 50 if(fDig) {fDig->Delete(); delete fDig;}
51 if(fClu) {fClu->Delete(); delete fClu;}
998b831f 52 AliDebug(1,"Stop.");
dfb4e77d 53}//AliRICH::~AliRICH()
e30ca504 54//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
dfb4e77d 55void AliRICH::MakeBranch(Option_t* option)
53fd478b 56{
57//Create Tree branches for the RICH.
998b831f 58 AliDebug(1,Form("Start with option= %s.",option));
dfb4e77d 59
e30ca504 60 const Int_t kBufSize = 4000;
dfb4e77d 61
dfb4e77d 62 const char *cH = strstr(option,"H");
63 const char *cD = strstr(option,"D");
64 const char *cR = strstr(option,"R");
65 const char *cS = strstr(option,"S");
66
e30ca504 67 if(cH&& TreeH()){HitCreate(); MakeBranchInTree( TreeH(), "RICH" ,&fHits ,kBufSize,0);}
68 if(cS&&fLoader->TreeS()){SdiCreate(); MakeBranchInTree(fLoader->TreeS(), "RICH" ,&fSdi ,kBufSize,0);}
69 if(cD&&fLoader->TreeD()){DigCreate();for(Int_t i=0;i<7;i++) MakeBranchInTree(fLoader->TreeD(),Form("RICH%d",i),&((*fDig)[i]),kBufSize,0);}
70 if(cR&&fLoader->TreeR()){CluCreate();for(Int_t i=0;i<7;i++) MakeBranchInTree(fLoader->TreeR(),Form("RICH%d",i),&((*fClu)[i]),kBufSize,0);}
c60862bf 71
998b831f 72 AliDebug(1,"Stop.");
c021cb15 73}//void AliRICH::MakeBranch(Option_t* option)
e30ca504 74//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
dfb4e77d 75void AliRICH::SetTreeAddress()
53fd478b 76{
77//Set branch address for the Hits and Digits Tree.
998b831f 78 AliDebug(1,"Start.");
e30ca504 79 if(fLoader->TreeH() && fLoader->TreeH()->GetBranch("RICH" )){HitCreate(); fLoader->TreeH()->SetBranchAddress( "RICH" ,&fHits );}
80 if(fLoader->TreeS() && fLoader->TreeS()->GetBranch("RICH" )){SdiCreate(); fLoader->TreeS()->SetBranchAddress( "RICH" ,&fSdi );}
81 if(fLoader->TreeD() && fLoader->TreeD()->GetBranch("RICH0")){DigCreate(); for(int i=0;i<7;i++) fLoader->TreeD()->SetBranchAddress(Form("RICH%d",i),&((*fDig)[i]));}
82 if(fLoader->TreeR() && fLoader->TreeR()->GetBranch("RICH0")){CluCreate(); for(int i=0;i<7;i++) fLoader->TreeR()->SetBranchAddress(Form("RICH%d",i),&((*fClu)[i]));}
998b831f 83 AliDebug(1,"Stop.");
dfb4e77d 84}//void AliRICH::SetTreeAddress()
c021cb15 85//__________________________________________________________________________________________________
db910db9 86// AliRICHHit* AliRICH::Hit(Int_t tid)const
87// {
88// // Search for the first RICH hit belonging to the given tid
89// GetLoader()->LoadHits();
90// for(Int_t iPrimN=0;iPrimN<GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop
91// GetLoader()->TreeH()->GetEntry(iPrimN);
92// for(Int_t iHitN=0;iHitN<Hits()->GetEntries();iHitN++){
93// AliRICHHit *pHit=(AliRICHHit*)Hits()->At(iHitN);
94// if(tid==pHit->Track()) {GetLoader()->UnloadHits();return pHit;}
95// }//hits
96// }//prims loop
97// GetLoader()->UnloadHits();
98// return 0;
99// }
100//__________________________________________________________________________________________________
101void AliRICH::HitPrint(Int_t iEvtN)const
e42a7b46 102{
103//Prints a list of RICH hits for a given event. Default is event number 0.
d3eb6079 104 if(GetLoader()->GetRunLoader()->GetEvent(iEvtN)) return;
998b831f 105 AliInfo(Form("List of RICH hits for event %i",iEvtN));
a25b3368 106 if(GetLoader()->LoadHits()) return;
e42a7b46 107
108 Int_t iTotalHits=0;
a25b3368 109 for(Int_t iPrimN=0;iPrimN<GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop
110 GetLoader()->TreeH()->GetEntry(iPrimN);
111 Hits()->Print();
112 iTotalHits+=Hits()->GetEntries();
e42a7b46 113 }
a25b3368 114 GetLoader()->UnloadHits();
998b831f 115 AliInfo(Form("totally %i hits",iTotalHits));
e42a7b46 116}
e30ca504 117//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
118void AliRICH::SdiPrint(Int_t iEvt)const
e42a7b46 119{
120//prints a list of RICH sdigits for a given event
e30ca504 121 if(GetLoader()->GetRunLoader()->GetEvent(iEvt)) return;
122 Info("PrintSDigits","List of RICH sdigits for event %i",iEvt);
a25b3368 123 if(GetLoader()->LoadSDigits()) return;
e42a7b46 124
a25b3368 125 GetLoader()->TreeS()->GetEntry(0);
e30ca504 126 SdiLst()->Print();
a25b3368 127 GetLoader()->UnloadSDigits();
e30ca504 128 Printf("totally %i sdigits",SdiLst()->GetEntries());
e42a7b46 129}
e30ca504 130//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
131void AliRICH::DigPrint(Int_t iEvt)const
e42a7b46 132{
133//prints a list of RICH digits for a given event
e30ca504 134 if(GetLoader()->GetRunLoader()->GetEvent(iEvt)) return;
135 Printf("List of RICH digits for event %i",iEvt);
a25b3368 136 if(GetLoader()->LoadDigits()) return;
e42a7b46 137
a25b3368 138 GetLoader()->TreeD()->GetEntry(0);
e30ca504 139 DigLst()->Print();
a25b3368 140 GetLoader()->UnloadDigits();
e30ca504 141 Printf("totally %i Digits",DigLst()->GetEntries());
e42a7b46 142}
e30ca504 143//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
144void AliRICH::OccupancyPrint(Int_t iEvtNreq)
c23b3bc0 145{
146//prints occupancy for each chamber in a given event
e53ffca5 147 Int_t iEvtNmin,iEvtNmax;
148 if(iEvtNreq==-1){
149 iEvtNmin=0;
150 iEvtNmax=gAlice->GetEventsPerRun();
151 } else {
152 iEvtNmin=iEvtNreq;iEvtNmax=iEvtNreq+1;
153 }
154
155 if(GetLoader()->GetRunLoader()->LoadHeader()) return;
156 if(GetLoader()->GetRunLoader()->LoadKinematics()) return;
157
158// Info("Occupancy","for event %i",iEvtN);
159 if(GetLoader()->LoadHits()) return;
c23b3bc0 160 if(GetLoader()->LoadDigits()) return;
161
e53ffca5 162
910735ae 163 for(Int_t iEvtN=iEvtNmin;iEvtN<iEvtNmax;iEvtN++){
e30ca504 164 Int_t nDigCh[7]={0,0,0,0,0,0,0};
165 Int_t iChHits[7]={0,0,0,0,0,0,0};
166 Int_t nPrim[7]={0,0,0,0,0,0,0};
167 Int_t nSec[7]={0,0,0,0,0,0,0};
910735ae 168 AliInfo(Form("events processed %i",iEvtN));
e53ffca5 169 if(GetLoader()->GetRunLoader()->GetEvent(iEvtN)) return;
170 AliStack *pStack = GetLoader()->GetRunLoader()->Stack();
171 for(Int_t iPrimN=0;iPrimN<GetLoader()->TreeH()->GetEntries();iPrimN++){//prims loop
172 GetLoader()->TreeH()->GetEntry(iPrimN);
173 for(Int_t iHitN=0;iHitN<Hits()->GetEntries();iHitN++){
e30ca504 174 AliRICHHit *pHit = (AliRICHHit*)Hits()->At(iHitN);
175 if(pHit->E()>0){
176 iChHits[pHit->Ch()]++;
177 if(pStack->Particle(pHit->GetTrack())->Rho()<0.01) nPrim[pHit->Ch()]++;else nSec[pHit->Ch()]++;
e53ffca5 178 }
179 }
180 }
e30ca504 181
e53ffca5 182 GetLoader()->TreeD()->GetEntry(0);
e30ca504 183 for(Int_t iCh=0;iCh<7;iCh++){
184 for(Int_t iDig=0;iDig<DigLst(iCh)->GetEntries();iDig++){
185 AliRICHDigit *pDig=(AliRICHDigit*)DigLst(iCh)->At(iDig);
186 nDigCh[pDig->Ch()]++;
187 }
188 Printf("Occupancy for chamber %i = %4.2f %% and charged prim tracks %i and sec. tracks %i with total %i",
189 iCh,Float_t(nDigCh[iCh])*100/AliRICHDigit::kPadAll,nPrim[iCh],nSec[iCh],iChHits[iCh]);
190 }
191
192
193 }//events loop
e53ffca5 194 GetLoader()->UnloadHits();
c23b3bc0 195 GetLoader()->UnloadDigits();
e53ffca5 196 GetLoader()->GetRunLoader()->UnloadHeader();
197 GetLoader()->GetRunLoader()->UnloadKinematics();
c23b3bc0 198}
e30ca504 199//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
db910db9 200void AliRICH::CluPrint(Int_t iEvtN)const
e42a7b46 201{
202//prints a list of RICH clusters for a given event
db910db9 203 Printf("List of RICH clusters for event %i",iEvtN);
a25b3368 204 GetLoader()->GetRunLoader()->GetEvent(iEvtN);
205 if(GetLoader()->LoadRecPoints()) return;
e42a7b46 206
db910db9 207 Int_t iCluCnt=0;
a25b3368 208 GetLoader()->TreeR()->GetEntry(0);
e30ca504 209 for(Int_t iCh=0;iCh<7;iCh++){
210 TClonesArray *pCluLst=(TClonesArray*)fClu->At(iCh); iCluCnt+=pCluLst->GetEntries(); pCluLst->Print();
e42a7b46 211 }
a25b3368 212 GetLoader()->UnloadRecPoints();
db910db9 213 Printf("totally %i clusters for event %i",iCluCnt,iEvtN);
e42a7b46 214}
db910db9 215//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
e53ffca5 216void AliRICH::SummaryOfEvent(Int_t iEvtN) const
217{
218//prints a summary for a given event
219 AliInfo(Form("Summary of event %i",iEvtN));
220 GetLoader()->GetRunLoader()->GetEvent(iEvtN);
221 if(GetLoader()->GetRunLoader()->LoadHeader()) return;
222 if(GetLoader()->GetRunLoader()->LoadKinematics()) return;
223 AliStack *pStack=GetLoader()->GetRunLoader()->Stack();
224
225 AliGenEventHeader* pGenHeader = gAlice->GetHeader()->GenEventHeader();
226 if(pGenHeader->InheritsFrom("AliGenHijingEventHeader")) {
227 AliInfo(Form(" Hijing event with impact parameter b = %.2f (fm)",((AliGenHijingEventHeader*) pGenHeader)->ImpactParameter()));
228 }
229 Int_t nChargedPrimaries=0;
230 for(Int_t i=0;i<pStack->GetNtrack();i++) {
231 TParticle *pParticle = pStack->Particle(i);
232 if(pParticle->IsPrimary()&&pParticle->GetPDG()->Charge()!=0) nChargedPrimaries++;
233 }
234 AliInfo(Form("Total number of primaries %i",pStack->GetNprimary()));
235 AliInfo(Form("Total number of charged primaries %i",nChargedPrimaries));
236 AliInfo(Form("Total n. of tracks in stack(+sec) %i",pStack->GetNtrack()));
237 GetLoader()->GetRunLoader()->UnloadHeader();
238 GetLoader()->GetRunLoader()->UnloadKinematics();
239}
e30ca504 240//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++