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