]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICH.h
Access to the stack using AliRunLoader (Yu.Belikov)
[u/mrichter/AliRoot.git] / RICH / AliRICH.h
CommitLineData
2f614988 1#ifndef AliRICH_h
2#define AliRICH_h
2e5f0f7b 3
3da30618 4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
c11ee6f0 7#include <TObjArray.h>
853634d3 8#include <TClonesArray.h>
c021cb15 9#include <TLorentzVector.h>
c11ee6f0 10#include <AliDetector.h>
853634d3 11#include <AliHit.h>
12#include <AliDigit.h>
543d5224 13
cb8189e7 14#include "AliRICHParam.h"
15
c60862bf 16#include "AliRICHSDigit.h"
853634d3 17
c021cb15 18//__________________AliRICHhit______________________________________________________________________
853634d3 19class AliRICHhit : public AliHit
20{
21public:
22 inline AliRICHhit();
23 inline AliRICHhit(Int_t fIshunt, Int_t track, Int_t *vol, Float_t *hits);
ed3ceb24 24 inline AliRICHhit(Int_t tid,TVector3 x3,Double_t eloss);
853634d3 25 virtual ~AliRICHhit() {;}
26
53fd478b 27 Int_t C() const{return fChamber;}
28 Int_t Chamber() const{return fChamber;}
29 Int_t Pid() const{return fPid;}
30 Int_t Particle() const{return fPid;}
53fd478b 31 Float_t Eloss() const{return fEloss;}
53fd478b 32 Float_t MomX() const{return fMomX;}
33 Float_t MomY() const{return fMomY;}
34 Float_t MomZ() const{return fMomZ;}
35 Float_t CerenkovAngle() const{return fCerenkovAngle;}
36 Float_t MomFreoX() const{return fMomFreoX;}
37 Float_t MomFreoY() const{return fMomFreoY;}
38 Float_t MomFreoZ() const{return fMomFreoZ;}
543d5224 39 void Print(Option_t *option="")const; //virtual
853634d3 40protected:
c021cb15 41 Int_t fChamber; //chamber number
c60862bf 42 Int_t fPid; //particle code
ed3ceb24 43 Double_t fEloss; //ionisation energy loss in gas
c021cb15 44 Float_t fMomX,fMomY,fMomZ; //momentum at photochatode entry point
45 Float_t fNPads; // Pads hit
46 Float_t fCerenkovAngle; // Dummy cerenkov angle
47 Float_t fMomFreoX,fMomFreoY,fMomFreoZ; //momentum at freon entry point
ed3ceb24 48 ClassDef(AliRICHhit,2) //RICH hit class
853634d3 49};//class AliRICHhit
c021cb15 50
51 //__________________________________________________________________________________________________
853634d3 52AliRICHhit::AliRICHhit()
53 :AliHit()
54{//default ctor
c60862bf 55 fChamber=fPid=kBad;
ed3ceb24 56 fEloss=kBad;
c021cb15 57 fMomX=fMomY=fMomZ=fNPads=fCerenkovAngle=fMomFreoX=fMomFreoY=fMomFreoZ=kBad;
543d5224 58}
c021cb15 59//__________________________________________________________________________________________________
ed3ceb24 60AliRICHhit::AliRICHhit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hit)
61 :AliHit(shunt, track)
853634d3 62{//ctor
63 fChamber=vol[0];
c60862bf 64 fPid=(Int_t)hit[0];
c021cb15 65 fX=hit[1];fY=hit[2];fZ=hit[3];
c021cb15 66 fEloss=hit[7];
c021cb15 67 fMomX=hit[14];fMomY=hit[15];fMomZ=hit[16];
c021cb15 68 fCerenkovAngle=hit[18];
69 fMomFreoX=hit[19];fMomFreoY=hit[20];fMomFreoZ=hit[21];
543d5224 70}
c021cb15 71//__________________________________________________________________________________________________
ed3ceb24 72AliRICHhit::AliRICHhit(Int_t tid,TVector3 x3,Double_t eloss)
73 :AliHit(0,tid)
c021cb15 74{//ctor
ed3ceb24 75 fX=x3.X();fY=x3.Y();fZ=x3.Z();
c021cb15 76 fEloss=eloss;
543d5224 77}
c021cb15 78
79//__________________AliRICHCerenkov_________________________________________________________________
853634d3 80class AliRICHCerenkov: public AliHit
81{
82public:
83 inline AliRICHCerenkov();
84 inline AliRICHCerenkov(Int_t fIshunt, Int_t track, Int_t *vol, Float_t *Cerenkovs);
85 virtual ~AliRICHCerenkov() {;}
53fd478b 86protected:
c021cb15 87 Int_t fChamber; //chamber number
88 Float_t fTheta,fPhi; //incident theta phi angles in degrees
89 Float_t fTlength; //track length inside the chamber
90 Float_t fEloss; //ionisation energy loss in gas
91 Int_t fPHfirst; //first padhit
92 Int_t fPHlast; //last padhit
93 Int_t fCMother; //index of mother particle
94 Float_t fLoss; //nature of particle loss
95 Float_t fIndex; //index of photon
96 Float_t fProduction; //point of production
97 Float_t fMomX,fMomY,fMomZ; //local Momentum
853634d3 98 Float_t fNPads; // Pads hit
99 Float_t fCerenkovAngle; // Cerenkov Angle
100
101 ClassDef(AliRICHCerenkov,1) //RICH cerenkov class
102};//class AliRICHCerenkov
c021cb15 103
104//__________________________________________________________________________________________________
853634d3 105AliRICHCerenkov::AliRICHCerenkov()
106{//ctor
c021cb15 107 fChamber=kBad;
108 fX=fY=fZ=fTheta=fPhi=fTlength=fEloss=kBad;
109 fPHfirst=fPHlast=fCMother=kBad;
110 fLoss=fIndex=fProduction=fMomX=fMomY=fMomZ=fNPads=fCerenkovAngle=kBad;
543d5224 111}
c021cb15 112//__________________________________________________________________________________________________
853634d3 113AliRICHCerenkov::AliRICHCerenkov(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits)
114 :AliHit(shunt, track)
115{//ctor
116 fChamber=vol[0];
c021cb15 117 fX=hits[1];fY=hits[2];fZ=hits[3];
118 fTheta=hits[4];fPhi=hits[5];
853634d3 119 fTlength=hits[6];
120 fEloss=hits[7];
c021cb15 121 fPHfirst=(Int_t)hits[8];fPHlast=(Int_t)hits[9];
853634d3 122 fCMother=Int_t(hits[10]);
123 fIndex = hits[11];
124 fProduction = hits[12];
125 fLoss=hits[13];
c021cb15 126 fMomX=hits[14];fMomY=hits[15];fMomZ=hits[16];
853634d3 127 fNPads=hits[17];
128 fCerenkovAngle=hits[18];
543d5224 129}
c021cb15 130
131//__________________AliRICHdigit____________________________________________________________________
853634d3 132class AliRICHdigit :public AliDigit
133{
134public:
ed3ceb24 135 AliRICHdigit() {fCombiPid=fChamber=fPadX=fPadY=fTracks[0]=fTracks[1]=fTracks[2]=kBad;fQdc=kBad;}
136 AliRICHdigit(Int_t c,Int_t x,Int_t y,Double_t q,Int_t cpid,Int_t tid0,Int_t tid1,Int_t tid2)
137 {fPadX=x;fPadY=y;fQdc=q;fChamber=10*c+AliRICHParam::Pad2Sec(x,y);fCombiPid=cpid;fTracks[0]=tid0;fTracks[1]=tid1;fTracks[2]=tid2;}
853634d3 138 virtual ~AliRICHdigit() {;}
ed3ceb24 139 Int_t Compare(const TObject *pObj) const //virtual
140 {if(Id()==((AliRICHdigit*)pObj)->Id()) return 0; else if(Id()>((AliRICHdigit*)pObj)->Id()) return 1; else return -1;}
141
c1863e3c 142 Bool_t IsSortable() const{return kTRUE;}//virtual
ed3ceb24 143 Int_t CombiPid() const{return fCombiPid;}
cb8189e7 144 Int_t C() const{return fChamber/10;}
145 Int_t S() const{return fChamber-(fChamber/10)*10;}
146 Int_t Chamber() const{return C();}
147 Int_t Sector() const{return S();}
c1863e3c 148 Int_t X() const{return fPadX;}
149 Int_t Y() const{return fPadY;}
cb8189e7 150 Int_t Id() const{return fChamber*10000000+fPadX*1000+fPadY;}
c1863e3c 151 Double_t Q() const{return fQdc;}
ed3ceb24 152 Int_t Tid(Int_t i) const{return fTracks[i];}
cb8189e7 153 void Print(Option_t *option="")const; //virtual
853634d3 154protected:
ed3ceb24 155 Int_t fCombiPid; //1000000*Ncerenkovs+1000*Nfeedbacks+Nmips
156 Int_t fChamber; //10*chamber number+ sector number
c1863e3c 157 Int_t fPadX; //pad number along X
158 Int_t fPadY; //pad number along Y
ed3ceb24 159 Double_t fQdc; //QDC value, fractions are permitted for summable procedure
160 ClassDef(AliRICHdigit,2) //RICH digit class
853634d3 161};//class AliRICHdigit
cbaf35fb 162
ed3ceb24 163//__________________AliRICHcluster__________________________________________________________________
c1863e3c 164class AliRICHcluster :public TObject
165{
166public:
ed3ceb24 167 enum ClusterStatus {kOK,kEdge,kShape,kSize,kRaw};
53fd478b 168 AliRICHcluster() {fSize=fQdc=fStatus=fChamber=fDimXY=kBad;fX=fY=kBad;fDigits=0;}
169 virtual ~AliRICHcluster() {delete fDigits;}
170 AliRICHcluster& operator=(const AliRICHcluster&) {return *this;}
cb8189e7 171 Int_t Size() const{return fSize;} //
172 Int_t DimXY() const{return fDimXY;} //
173 Int_t C() const{return fChamber/10;} //
174 Int_t S() const{return fChamber-(fChamber/10)*10;} //
175 Int_t Chamber() const{return C();} //
176 Int_t Sector() const{return S();} //
177 Int_t Q() const{return fQdc;} //
178 Double_t X() const{return fX;} //
179 Double_t Y() const{return fY;} //
180 Int_t Status() const{return fStatus;} //
181 void SetStatus(Int_t status) {fStatus=status;} //
ed3ceb24 182 Int_t Nmips() const{return fCombiPid-1000000*Ncerenkovs()-1000*Nfeedbacks();} //
183 Int_t Ncerenkovs() const{return fCombiPid/1000000;} //
184 Int_t Nfeedbacks() const{return (fCombiPid-1000000*Ncerenkovs())/1000;} //
185 Bool_t IsPureMip() const{return fCombiPid<1000;}
186 Bool_t IsPureCerenkov() const{return Nmips()==0&&Nfeedbacks()==0;} //
187 Bool_t IsPureFeedback() const{return Nmips()==0&&Ncerenkovs()==0;} //
188 void SetCombiPid(Int_t ckov,Int_t feeds,Int_t mips) {fCombiPid=1000000*ckov+1000*feeds+mips;} //
cb8189e7 189 TObjArray* Digits() const{return fDigits;} //
190 void Print(Option_t *option="")const; //virtual
191 inline void AddDigit(AliRICHdigit *pDig); //
192 inline void CoG(); //
ed3ceb24 193 void Reset() {fSize=fQdc=fStatus=fChamber=fDimXY=kBad;fX=fY=kBad;delete fDigits;fDigits=0;} //
c1863e3c 194protected:
ed3ceb24 195 Int_t fCombiPid; //1000000*Ncerenkovs+1000*Nfeedbacks+Nmips
c1863e3c 196 Int_t fSize; //how many digits belong to this cluster
197 Int_t fDimXY; //100*xdim+ydim box containing the cluster
198 Int_t fQdc; //QDC value
199 Int_t fChamber; //10*module number+sector number
200 Double_t fX; //local x postion
201 Double_t fY; //local y postion
202 Int_t fStatus; //flag to mark the quality of the cluster
203 TObjArray *fDigits; //! list of digits forming this cluster
ed3ceb24 204 ClassDef(AliRICHcluster,2) //RICH cluster class
c1863e3c 205};//class AliRICHcluster
206//__________________________________________________________________________________________________
207void AliRICHcluster::AddDigit(AliRICHdigit *pDig)
cb8189e7 208{//
ed3ceb24 209 if(!fDigits) {fQdc=fSize=fCombiPid=0;fDigits = new TObjArray;}
cbaf35fb 210 fQdc+=(Int_t)pDig->Q(); fDigits->Add(pDig);
cb8189e7 211 fChamber=10*pDig->C()+pDig->S();
cbaf35fb 212 fSize++;
213}
214//__________________________________________________________________________________________________
215void AliRICHcluster::CoG()
cb8189e7 216{//
217 Int_t xmin=999,ymin=999,xmax=0,ymax=0;
218 Double_t x,y;
219 fX=fY=0;
220 for(Int_t iDig=0;iDig<Size();iDig++) {
221 AliRICHdigit *pDig=(AliRICHdigit*)fDigits->At(iDig);
222 Int_t padX = pDig->X();Int_t padY = pDig->Y();Double_t q=pDig->Q();
223 AliRICHParam::Pad2Loc(padX,padY,x,y);
224 fX += x*q;fY +=y*q;
225 if(padX<xmin)xmin=padX;if(padX>xmax)xmax=padX;if(padY<ymin)ymin=padY;if(padY>ymax)ymax=padY;
cbaf35fb 226 }
cb8189e7 227 fX/=fQdc;fY/=fQdc;//Center of Gravity
228 fDimXY = 100*(xmax-xmin+1)+ymax-ymin+1;//find box containing cluster
229 fStatus=kRaw;
230}//CoG()
ed3ceb24 231
c021cb15 232//__________________AliRICH_________________________________________________________________________
3ea9cb08 233class AliRICHParam;
ed3ceb24 234class AliRICHChamber;
3ea9cb08 235class AliRICHSDigit;
236
2f614988 237class AliRICH : public AliDetector
238{
2f614988 239public:
853634d3 240 AliRICH();
241 AliRICH(const char *name, const char *title);
942194a4 242 AliRICH(const AliRICH& RICH):AliDetector(RICH) {;}
853634d3 243 virtual ~AliRICH();
dfb4e77d 244
942194a4 245 AliRICH& operator=(const AliRICH&) {return *this;}
c60862bf 246 virtual Int_t IsVersion() const =0;
247 void Hits2SDigits(); //virtual
248 void SDigits2Digits(); //virtual
c021cb15 249
c60862bf 250 inline void CreateHits();
c1863e3c 251 inline void CreateSDigits();
c60862bf 252 inline void CreateDigits();
253 inline void CreateClusters();
ed3ceb24 254 void AddHit(Int_t track, Int_t *vol, Float_t *hits) {TClonesArray &tmp=*fHits; new(tmp[fNhits++])AliRICHhit(fIshunt,track,vol,hits);}//virtual
255 void AddHit(Int_t tid,TVector3 x3,Double_t eloss=0) {TClonesArray &tmp=*fHits;new(tmp[fNhits++])AliRICHhit(tid,x3,eloss);}
256 inline void AddSDigit(int c,int x,int y,int q,int pid,int tid);
257 void AddDigit(int c,int x,int y,int q,int cpid,int *tid){TClonesArray &tmp=*((TClonesArray*)fDigitsNew->At(c-1));new(tmp[fNdigitsNew[c-1]++])AliRICHdigit(c,x,y,q,cpid,tid[0],tid[1],tid[2]);}
258 void AddCluster(AliRICHcluster &cl) {TClonesArray &tmp=*((TClonesArray*)fClusters->At(cl.C()-1));new(tmp[fNclusters[cl.C()-1]++])AliRICHcluster(cl);}
259
260 void ResetHits() {AliDetector::ResetHits();fNcerenkovs=0;if(fCerenkovs)fCerenkovs->Clear();fNspecials=0;if(fSpecials)fSpecials->Clear();} //virtual
261 void ResetSDigits() {fNsdigits=0; if(fSdigits) fSdigits ->Clear();}
262 void ResetDigits() {if(fDigitsNew)for(int i=0;i<kNCH;i++){fDigitsNew->At(i)->Clear();fNdigitsNew[i]=0;}}
263 void ResetClusters() {if(fClusters) for(int i=0;i<kNCH;i++){fClusters ->At(i)->Clear();fNclusters[i]=0;}}
c60862bf 264 //Hits provided by AliDetector
c1863e3c 265 TClonesArray* SDigits() const{return fSdigits;}
543d5224 266 TClonesArray* Digits(Int_t iC) const{if(fDigitsNew) return (TClonesArray *)fDigitsNew->At(iC-1);else return 0;}
c60862bf 267 TClonesArray* Clusters(Int_t iC) const{if(fClusters) return (TClonesArray *)fClusters->At(iC-1);else return 0;}
268
269 AliRICHChamber* C(Int_t iC) const{return (AliRICHChamber*)fChambers->At(iC-1);}
270 AliRICHParam* Param() const{return fpParam;}
ed3ceb24 271 AliRICHParam* P() const{return fpParam;}
3ea9cb08 272 void CreateChambers();
c60862bf 273 void CreateMaterials(); //virtual
274 virtual void BuildGeometry(); //virtual
275 virtual void CreateGeometry(); //virtual
53fd478b 276 Float_t AbsoCH4(Float_t x)const;
277 Float_t Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)const;
3ea9cb08 278
c021cb15 279 virtual void StepManager()=0;
c60862bf 280 void GenerateFeedbacks(Int_t iChamber,Float_t eloss);
281 void Print(Option_t *option)const;//virtual
282 void MakeBranch(Option_t *opt=" ");
283 void SetTreeAddress();//virtual
543d5224 284// OLD staff OLD staff
285 inline void AddCerenkov(Int_t track, Int_t *vol, Float_t *cerenkovs);
53fd478b 286 inline void AddSpecialOld(Int_t *array);
543d5224 287
288 inline void CreateCerenkovsOld();
289 inline void CreateSpecialsOld();
543d5224 290 void ResetSpecialsOld(){fNspecials=0; if(fSpecials) fSpecials->Clear();}
543d5224 291 TClonesArray* Specials() const{return fSpecials;}
292 TClonesArray* Cerenkovs() const{return fCerenkovs;}
c60862bf 293
3ea9cb08 294
c60862bf 295
296 AliRICHChamber& Chamber(Int_t id) {return *((AliRICHChamber *) (*fChambers)[id]);}
c60862bf 297// Int_t DistancetoPrimitive(Int_t /*px*/, Int_t /*py*/) {return 9999;}
2f614988 298
c60862bf 299protected:
53fd478b 300 enum {kCSI=6,kGAP=9};
c021cb15 301 AliRICHParam *fpParam; //main RICH parametrization
302 TObjArray *fChambers; //list of RICH chambers
c60862bf 303 //fHits and fDigits belong to AliDetector
304 TClonesArray *fSdigits; //! List of sdigits
aed240d4 305 Int_t fNsdigits; //! Current number of sdigits
c60862bf 306 TObjArray *fDigitsNew; //! Each chamber holds it's one lists of digits
aed240d4 307 Int_t fNdigitsNew[kNCH]; //! Array of current numbers of digits
c60862bf 308 TObjArray *fClusters; //! Each chamber holds it's one lists of clusters
aed240d4 309 Int_t fNclusters[kNCH]; //! Array of current numbers of raw clusters
c60862bf 310
311 TClonesArray *fCerenkovs; //! ??? List of cerenkovs
aed240d4 312 Int_t fNcerenkovs; //! ??? Current number of cerenkovs
c60862bf 313 TClonesArray *fSpecials; //! ??? List of specials
aed240d4 314 Int_t fNspecials; //! ??? Current number of specials
dfb4e77d 315 Int_t fCkovNumber; // Number of Cerenkov photons
dfb4e77d 316 Int_t fFreonProd; // Cerenkovs produced in freon
dfb4e77d 317 Int_t fFeedbacks; // Number of feedback photons
ddae0931 318
aed240d4 319 ClassDef(AliRICH,4) //Main RICH class
c60862bf 320};//class AliRICH
ed3ceb24 321
c1863e3c 322//__________________________________________________________________________________________________
c60862bf 323void AliRICH::CreateHits()
324{
325 if(fHits) return;
326 if(GetDebug())Info("CreateHits","creating hits container.");
327 fHits=new TClonesArray("AliRICHhit",10000); fNhits=0;
543d5224 328}
c60862bf 329//__________________________________________________________________________________________________
c1863e3c 330void AliRICH::CreateSDigits()
c60862bf 331{
332 if(fSdigits) return;
c1863e3c 333 if(GetDebug())Info("CreateSDigits","creating sdigits container.");
c60862bf 334 fSdigits=new TClonesArray("AliRICHdigit",10000); fNsdigits=0;
543d5224 335}
c60862bf 336//__________________________________________________________________________________________________
337void AliRICH::CreateDigits()
338{
339 if(fDigitsNew) return;
340 if(GetDebug())Info("CreateDigits","creating digits containers.");
341 fDigitsNew = new TObjArray(kNCH);
342 for(Int_t i=0;i<kNCH;i++) {fDigitsNew->AddAt(new TClonesArray("AliRICHdigit",10000), i); fNdigitsNew[i]=0;}
543d5224 343}
c60862bf 344//__________________________________________________________________________________________________
345void AliRICH::CreateClusters()
346{
347 if(fClusters) return;
348 if(GetDebug())Info("CreateClusters","creating clusters containers.");
349 fClusters = new TObjArray(kNCH);
350 for(Int_t i=0;i<kNCH;i++) {fClusters->AddAt(new TClonesArray("AliRICHcluster",10000), i); fNclusters[i]=0;}
543d5224 351}
ed3ceb24 352//__________________________________________________________________________________________________
353void AliRICH::AddSDigit(int c,int x,int y,int q,int pid,int tid)
354{
355 switch(pid){
356 case 50000048: pid=1000000;break;
357 case 50000052: pid=1000; break;
358 default: pid=1; break;
359 }
360 TClonesArray &tmp=*fSdigits;
361 new(tmp[fNsdigits++])AliRICHdigit(c,x,y,q,pid,tid,kBad,kBad);
362}//AddSDigit()
c60862bf 363
364
ed3ceb24 365//______OLD OLD OLD OLD_____________________________________________________________________________
c60862bf 366void AliRICH::CreateCerenkovsOld()
367{
368 if(fCerenkovs) return;
369 if(GetDebug())Info("CreateCerenkovs","creating cerenkovs container.");
370 fCerenkovs=new TClonesArray("AliRICHCerenkov",10000); fNcerenkovs=0;
543d5224 371}
c60862bf 372//__________________________________________________________________________________________________
373void AliRICH::CreateSpecialsOld()
374{
375 if(fSpecials) return;
376 if(GetDebug())Info("CreateSpecialsOld","creating SDigits special container.");
377 fSpecials=new TClonesArray("AliRICHSDigit",100000); fNspecials=0;
543d5224 378}
c60862bf 379//__________________________________________________________________________________________________
853634d3 380void AliRICH::AddCerenkov(Int_t track, Int_t *vol, Float_t *cerenkovs)
381{//Adds the current RICH cerenkov hit to the Cerenkovs list
382 TClonesArray &tmp=*fCerenkovs;
383 new(tmp[fNcerenkovs++]) AliRICHCerenkov(fIshunt,track,vol,cerenkovs);
384}
c021cb15 385//__________________________________________________________________________________________________
543d5224 386void AliRICH::AddSpecialOld(Int_t *aiSDigit)
c60862bf 387{// Adds the current Sdigit to the RICH list of Specials
388 TClonesArray &lSDigits = *fSpecials;
543d5224 389 new(lSDigits[fNspecials++]) AliRICHSDigit(aiSDigit);
390}
c60862bf 391#endif//#ifndef AliRICH_h