]>
Commit | Line | Data |
---|---|---|
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> |
d4c94996 | 9 | #include <TVector3.h> |
10 | #include <Riostream.h> | |
c11ee6f0 | 11 | #include <AliDetector.h> |
853634d3 | 12 | #include <AliHit.h> |
13 | #include <AliDigit.h> | |
3582c1f9 | 14 | #include "AliRICHDigitizer.h" |
cb8189e7 | 15 | #include "AliRICHParam.h" |
16 | ||
c021cb15 | 17 | //__________________AliRICHhit______________________________________________________________________ |
853634d3 | 18 | class AliRICHhit : public AliHit |
19 | { | |
20 | public: | |
d4c94996 | 21 | AliRICHhit():AliHit() {fChamber=kBad; fEloss=kBad; fInX3.SetXYZ(0,0,0);fOutX3.SetXYZ(0,0,0);} |
22 | AliRICHhit(Int_t c,Int_t tid,TVector3 in,TVector3 out,Double_t e):AliHit(0,tid) | |
23 | {fChamber=c;fInX3=in; fOutX3=out;fEloss=e; fX=out.X();fY=out.Y();fZ=out.Z();} | |
24 | virtual ~AliRICHhit() {;} | |
af3d25a6 | 25 | |
d4c94996 | 26 | Int_t C() const{return fChamber;} //chamber number |
27 | Int_t Chamber() const{return fChamber;} //chamber number | |
28 | Float_t Eloss() const{return fEloss;} //energy lost by track inside amplification gap | |
29 | TVector3 InX3() const{return fInX3;} //track position at the faceplane of the gap | |
30 | TVector3 OutX3() const{return fOutX3;} //track position at the backplane of the gap | |
31 | Double_t Length() const{return (fOutX3-fInX3).Mag();} //track length inside the amplification gap | |
32 | void Print(Option_t *option="")const; //virtual | |
853634d3 | 33 | protected: |
c021cb15 | 34 | Int_t fChamber; //chamber number |
d4c94996 | 35 | Double_t fEloss; //ionisation energy lost in GAP |
3582c1f9 | 36 | TVector3 fInX3; //position at the entrance of the GAP |
d4c94996 | 37 | TVector3 fOutX3; //position at the exit of the GAP |
ed3ceb24 | 38 | ClassDef(AliRICHhit,2) //RICH hit class |
853634d3 | 39 | };//class AliRICHhit |
c021cb15 | 40 | |
c021cb15 | 41 | //__________________AliRICHdigit____________________________________________________________________ |
853634d3 | 42 | class AliRICHdigit :public AliDigit |
43 | { | |
44 | public: | |
d4c94996 | 45 | AliRICHdigit() {fChFbMip=fChamber=fPadX=fPadY=fTracks[0]=fTracks[1]=fTracks[2]=kBad;fQdc=kBad;} |
46 | 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) | |
47 | {fPadX=x;fPadY=y;fQdc=q;fChamber=10*c+AliRICHParam::Sector(x,y);fChFbMip=cpid;fTracks[0]=tid0;fTracks[1]=tid1;fTracks[2]=tid2;} | |
853634d3 | 48 | virtual ~AliRICHdigit() {;} |
d4c94996 | 49 | Int_t Compare(const TObject *pObj) const |
50 | {if(Id()==((AliRICHdigit*)pObj)->Id())return 0;else if(Id()>((AliRICHdigit*)pObj)->Id())return 1;else return -1;} //virtual | |
51 | Bool_t IsSortable() const{return kTRUE;} //virtual | |
52 | void Print(Option_t *option="") const; //virtual | |
53 | Int_t ChFbMi() const{return fChFbMip;} //particle mixture for this digit | |
54 | Int_t C() const{return fChamber/10;} //chamber number | |
55 | Int_t S() const{return fChamber-(fChamber/10)*10;} //sector number | |
56 | Int_t X() const{return fPadX;} //x position of the pad | |
57 | Int_t Y() const{return fPadY;} //y postion of the pad | |
58 | Int_t Id() const{return fChamber*10000000+fPadX*1000+fPadY;} //absolute id of this pad | |
59 | Double_t Q() const{return fQdc;} //charge in terms of ADC channels | |
60 | Int_t Tid(Int_t i) const{return fTracks[i];} //track reference produced this digit | |
89924db8 | 61 | void AddTidOffset(Int_t offset) |
62 | {for (Int_t i=0; i<3; i++) if (fTracks[i]>0) fTracks[i]+=offset;}; | |
853634d3 | 63 | protected: |
d4c94996 | 64 | Int_t fChFbMip; //1000000*Ncerenkovs+1000*Nfeedbacks+Nmips |
ed3ceb24 | 65 | Int_t fChamber; //10*chamber number+ sector number |
c1863e3c | 66 | Int_t fPadX; //pad number along X |
67 | Int_t fPadY; //pad number along Y | |
ed3ceb24 | 68 | Double_t fQdc; //QDC value, fractions are permitted for summable procedure |
d4c94996 | 69 | ClassDef(AliRICHdigit,3) //RICH digit class |
853634d3 | 70 | };//class AliRICHdigit |
cbaf35fb | 71 | |
ed3ceb24 | 72 | //__________________AliRICHcluster__________________________________________________________________ |
c1863e3c | 73 | class AliRICHcluster :public TObject |
74 | { | |
75 | public: | |
6865fb8d | 76 | enum ClusterStatus {kEdge,kShape,kSize,kRaw,kResolved}; |
77 | AliRICHcluster() {fSize=fQdc=fStatus=fChamber=fDimXY=0;fX=fY=kBad;fDigits=0;} | |
53fd478b | 78 | virtual ~AliRICHcluster() {delete fDigits;} |
79 | AliRICHcluster& operator=(const AliRICHcluster&) {return *this;} | |
6865fb8d | 80 | Int_t Nlocals() const{return fSize - 10000*(fSize/10000);} // |
81 | Int_t Size() const{return fSize/10000;} // | |
82 | Int_t Fsize() const{return fSize;} // | |
cb8189e7 | 83 | Int_t DimXY() const{return fDimXY;} // |
84 | Int_t C() const{return fChamber/10;} // | |
85 | Int_t S() const{return fChamber-(fChamber/10)*10;} // | |
6865fb8d | 86 | Int_t Fchamber() const{return fChamber;} // |
cb8189e7 | 87 | Int_t Q() const{return fQdc;} // |
88 | Double_t X() const{return fX;} // | |
89 | Double_t Y() const{return fY;} // | |
90 | Int_t Status() const{return fStatus;} // | |
91 | void SetStatus(Int_t status) {fStatus=status;} // | |
ed3ceb24 | 92 | Int_t Nmips() const{return fCombiPid-1000000*Ncerenkovs()-1000*Nfeedbacks();} // |
93 | Int_t Ncerenkovs() const{return fCombiPid/1000000;} // | |
94 | Int_t Nfeedbacks() const{return (fCombiPid-1000000*Ncerenkovs())/1000;} // | |
95 | Bool_t IsPureMip() const{return fCombiPid<1000;} | |
96 | Bool_t IsPureCerenkov() const{return Nmips()==0&&Nfeedbacks()==0;} // | |
97 | Bool_t IsPureFeedback() const{return Nmips()==0&&Ncerenkovs()==0;} // | |
6865fb8d | 98 | Int_t CombiPid() const{return fCombiPid;} // |
ed3ceb24 | 99 | void SetCombiPid(Int_t ckov,Int_t feeds,Int_t mips) {fCombiPid=1000000*ckov+1000*feeds+mips;} // |
6865fb8d | 100 | void Fill(AliRICHcluster *pRaw,Double_t x,Double_t y, Double_t q, Int_t combipid) |
101 | {fCombiPid=combipid;fChamber=pRaw->Fchamber();fSize=pRaw->Fsize(); | |
102 | fQdc=(Int_t)(q*pRaw->Q());fX=x;fY=y;fStatus=kResolved;} // | |
cb8189e7 | 103 | TObjArray* Digits() const{return fDigits;} // |
104 | void Print(Option_t *option="")const; //virtual | |
105 | inline void AddDigit(AliRICHdigit *pDig); // | |
6865fb8d | 106 | inline void CoG(Int_t nLocals); // |
ed3ceb24 | 107 | void Reset() {fSize=fQdc=fStatus=fChamber=fDimXY=kBad;fX=fY=kBad;delete fDigits;fDigits=0;} // |
c1863e3c | 108 | protected: |
ed3ceb24 | 109 | Int_t fCombiPid; //1000000*Ncerenkovs+1000*Nfeedbacks+Nmips |
6865fb8d | 110 | Int_t fSize; //10000*(how many digits belong to this cluster) + nLocalMaxima |
c1863e3c | 111 | Int_t fDimXY; //100*xdim+ydim box containing the cluster |
112 | Int_t fQdc; //QDC value | |
113 | Int_t fChamber; //10*module number+sector number | |
114 | Double_t fX; //local x postion | |
115 | Double_t fY; //local y postion | |
116 | Int_t fStatus; //flag to mark the quality of the cluster | |
117 | TObjArray *fDigits; //! list of digits forming this cluster | |
ed3ceb24 | 118 | ClassDef(AliRICHcluster,2) //RICH cluster class |
c1863e3c | 119 | };//class AliRICHcluster |
120 | //__________________________________________________________________________________________________ | |
121 | void AliRICHcluster::AddDigit(AliRICHdigit *pDig) | |
cb8189e7 | 122 | {// |
ed3ceb24 | 123 | if(!fDigits) {fQdc=fSize=fCombiPid=0;fDigits = new TObjArray;} |
cbaf35fb | 124 | fQdc+=(Int_t)pDig->Q(); fDigits->Add(pDig); |
cb8189e7 | 125 | fChamber=10*pDig->C()+pDig->S(); |
6865fb8d | 126 | fSize+=10000; |
cbaf35fb | 127 | } |
128 | //__________________________________________________________________________________________________ | |
6865fb8d | 129 | void AliRICHcluster::CoG(Int_t nLocals) |
cb8189e7 | 130 | {// |
131 | Int_t xmin=999,ymin=999,xmax=0,ymax=0; | |
cb8189e7 | 132 | fX=fY=0; |
133 | for(Int_t iDig=0;iDig<Size();iDig++) { | |
134 | AliRICHdigit *pDig=(AliRICHdigit*)fDigits->At(iDig); | |
135 | Int_t padX = pDig->X();Int_t padY = pDig->Y();Double_t q=pDig->Q(); | |
3582c1f9 | 136 | TVector2 x2=AliRICHParam::Pad2Loc(padX,padY); |
137 | fX += x2.X()*q;fY +=x2.Y()*q; | |
cb8189e7 | 138 | if(padX<xmin)xmin=padX;if(padX>xmax)xmax=padX;if(padY<ymin)ymin=padY;if(padY>ymax)ymax=padY; |
cbaf35fb | 139 | } |
cb8189e7 | 140 | fX/=fQdc;fY/=fQdc;//Center of Gravity |
141 | fDimXY = 100*(xmax-xmin+1)+ymax-ymin+1;//find box containing cluster | |
6865fb8d | 142 | fSize+=nLocals; |
cb8189e7 | 143 | fStatus=kRaw; |
144 | }//CoG() | |
d4c94996 | 145 | |
146 | ||
af3d25a6 | 147 | class AliRICHreco: public TObject |
148 | { | |
149 | public: | |
150 | AliRICHreco() {fTid=fNphotons=kBad; fThetaCherenkov=kBad;} | |
151 | AliRICHreco(Int_t tid,Double_t thetaCherenkov,Int_t nPhotons) {fTid=tid;fThetaCherenkov=thetaCherenkov;fNphotons=nPhotons;} | |
ed3ceb24 | 152 | |
af3d25a6 | 153 | virtual ~AliRICHreco() {;} |
154 | ||
155 | void Print(Option_t *option="")const; //virtual print | |
156 | ||
157 | protected: | |
158 | Int_t fTid; // track Id reference | |
159 | Int_t fNphotons; // number of photons contributed to the recontruction | |
160 | Double_t fThetaCherenkov; // reconstructed Theta Cerenkov for a given charged track | |
161 | ||
162 | ClassDef(AliRICHreco,1) //RICH reco class | |
163 | ||
164 | };//class AliRICHreco | |
d4c94996 | 165 | |
c021cb15 | 166 | //__________________AliRICH_________________________________________________________________________ |
3ea9cb08 | 167 | class AliRICHParam; |
ed3ceb24 | 168 | class AliRICHChamber; |
3ea9cb08 | 169 | |
2f614988 | 170 | class AliRICH : public AliDetector |
171 | { | |
2f614988 | 172 | public: |
853634d3 | 173 | AliRICH(); |
af3d25a6 | 174 | AliRICH(const char *name, const char *title); |
d4c94996 | 175 | AliRICH(const AliRICH& RICH):AliDetector(RICH) {;} //copy ctor |
853634d3 | 176 | virtual ~AliRICH(); |
dfb4e77d | 177 | |
942194a4 | 178 | AliRICH& operator=(const AliRICH&) {return *this;} |
d4c94996 | 179 | //framework part |
180 | virtual Int_t IsVersion() const =0; //virtual | |
181 | virtual void StepManager() =0; //virtual | |
c60862bf | 182 | void Hits2SDigits(); //virtual |
3582c1f9 | 183 | AliDigitizer* CreateDigitizer(AliRunDigitizer* man) const {return new AliRICHDigitizer(man);} //virtual |
d4c94996 | 184 | void Print(Option_t *option)const; //virtual |
185 | void SetTreeAddress(); //virtual | |
186 | void MakeBranch(Option_t *opt=" "); //virtual | |
187 | void CreateMaterials(); //virtual | |
188 | virtual void BuildGeometry(); //virtual | |
189 | virtual void CreateGeometry(); //virtual | |
190 | //private part | |
191 | Float_t AbsoCH4(Float_t x)const; //calculates absorption length for methane | |
192 | Float_t Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)const; //deals with Fresnel absorption | |
193 | void GenerateFeedbacks(Int_t iChamber,Float_t eloss=0); //generates feedback photons; eloss=0 for photon | |
194 | void CreateChambers(); //creates set of chambers | |
195 | inline void CreateHits(); //create hits container as a simple list | |
196 | inline void CreateSDigits(); //create sdigits container as a simple list | |
197 | inline void CreateDigits(); //create digits container as 7 lists, one per chamber | |
198 | inline void CreateClusters(); //create clusters container as 7 lists, one per chamber | |
199 | inline void CreateRecos(); //create recos container | |
200 | // void ResetHits() {AliDetector::ResetHits();} //virtual | |
201 | void ResetSDigits() {fNsdigits=0; if(fSdigits) fSdigits ->Clear();} | |
202 | void ResetDigits() {if(fDigitsNew)for(int i=0;i<kNCH;i++){fDigitsNew->At(i)->Clear();fNdigitsNew[i]=0;}} //virtual | |
203 | void ResetClusters() {if(fClusters) for(int i=0;i<kNCH;i++){fClusters ->At(i)->Clear();fNclusters[i]=0;}} | |
204 | void ResetRecos() {if(fRecos) fRecos->Clear();fNrecos=0;} | |
c1863e3c | 205 | TClonesArray* SDigits() const{return fSdigits;} |
543d5224 | 206 | TClonesArray* Digits(Int_t iC) const{if(fDigitsNew) return (TClonesArray *)fDigitsNew->At(iC-1);else return 0;} |
c60862bf | 207 | TClonesArray* Clusters(Int_t iC) const{if(fClusters) return (TClonesArray *)fClusters->At(iC-1);else return 0;} |
af3d25a6 | 208 | TClonesArray* Recos() const{return fRecos;} |
c60862bf | 209 | AliRICHChamber* C(Int_t iC) const{return (AliRICHChamber*)fChambers->At(iC-1);} |
ed3ceb24 | 210 | AliRICHParam* P() const{return fpParam;} |
d4c94996 | 211 | void PrintDigits() const{for(Int_t i=0;i<kNCH;i++) fDigitsNew->At(i)->Print();} |
212 | void PrintClusters() const{for(Int_t i=0;i<kNCH;i++) fClusters->At(i)->Print();} | |
c60862bf | 213 | |
d4c94996 | 214 | void AddHit(Int_t chamber,Int_t tid,TVector3 iX3,TVector3 oX3,Double_t eloss=0) |
215 | {TClonesArray &tmp=*fHits;new(tmp[fNhits++])AliRICHhit(chamber,tid,iX3,oX3,eloss);} | |
216 | inline void AddSDigit(Int_t c,Int_t x,Int_t y,Double_t q,Int_t pid,Int_t tid); | |
217 | void AddDigit(int c,int x,int y,int q,int cfm,int *tid) | |
218 | {TClonesArray &tmp=*((TClonesArray*)fDigitsNew->At(c-1));new(tmp[fNdigitsNew[c-1]++])AliRICHdigit(c,x,y,q,cfm,tid[0],tid[1],tid[2]);} | |
219 | void AddCluster(AliRICHcluster &cl) | |
89924db8 | 220 | {Int_t c=cl.C()-1;/*cout<<c<<endl*/;TClonesArray &tmp=*((TClonesArray*)fClusters->At(c));new(tmp[fNclusters[c]++])AliRICHcluster(cl);} |
d4c94996 | 221 | void AddReco(Int_t tid,Double_t thetaCherenkov,Int_t nPhotons) |
222 | {TClonesArray &tmp=*(TClonesArray*)fRecos;new(tmp[fNrecos++])AliRICHreco(tid,thetaCherenkov,nPhotons);} | |
223 | ||
c60862bf | 224 | protected: |
d4c94996 | 225 | enum {kCSI=6,kGAP=9}; |
c021cb15 | 226 | AliRICHParam *fpParam; //main RICH parametrization |
227 | TObjArray *fChambers; //list of RICH chambers | |
d4c94996 | 228 | |
229 | //fHits and fDigits belong to AliDetector | |
c60862bf | 230 | TClonesArray *fSdigits; //! List of sdigits |
aed240d4 | 231 | Int_t fNsdigits; //! Current number of sdigits |
84365c70 | 232 | |
c60862bf | 233 | TObjArray *fDigitsNew; //! Each chamber holds it's one lists of digits |
aed240d4 | 234 | Int_t fNdigitsNew[kNCH]; //! Array of current numbers of digits |
84365c70 | 235 | |
c60862bf | 236 | TObjArray *fClusters; //! Each chamber holds it's one lists of clusters |
aed240d4 | 237 | Int_t fNclusters[kNCH]; //! Array of current numbers of raw clusters |
84365c70 | 238 | |
af3d25a6 | 239 | TClonesArray *fRecos; //! pointer to the list of recos |
240 | Int_t fNrecos; //! number of recos | |
c60862bf | 241 | |
84365c70 | 242 | ClassDef(AliRICH,5) //Main RICH class |
c60862bf | 243 | };//class AliRICH |
ed3ceb24 | 244 | |
c1863e3c | 245 | //__________________________________________________________________________________________________ |
c60862bf | 246 | void AliRICH::CreateHits() |
247 | { | |
248 | if(fHits) return; | |
249 | if(GetDebug())Info("CreateHits","creating hits container."); | |
250 | fHits=new TClonesArray("AliRICHhit",10000); fNhits=0; | |
543d5224 | 251 | } |
c60862bf | 252 | //__________________________________________________________________________________________________ |
c1863e3c | 253 | void AliRICH::CreateSDigits() |
c60862bf | 254 | { |
255 | if(fSdigits) return; | |
c1863e3c | 256 | if(GetDebug())Info("CreateSDigits","creating sdigits container."); |
c60862bf | 257 | fSdigits=new TClonesArray("AliRICHdigit",10000); fNsdigits=0; |
543d5224 | 258 | } |
c60862bf | 259 | //__________________________________________________________________________________________________ |
260 | void AliRICH::CreateDigits() | |
261 | { | |
262 | if(fDigitsNew) return; | |
263 | if(GetDebug())Info("CreateDigits","creating digits containers."); | |
264 | fDigitsNew = new TObjArray(kNCH); | |
265 | for(Int_t i=0;i<kNCH;i++) {fDigitsNew->AddAt(new TClonesArray("AliRICHdigit",10000), i); fNdigitsNew[i]=0;} | |
543d5224 | 266 | } |
c60862bf | 267 | //__________________________________________________________________________________________________ |
268 | void AliRICH::CreateClusters() | |
269 | { | |
270 | if(fClusters) return; | |
271 | if(GetDebug())Info("CreateClusters","creating clusters containers."); | |
272 | fClusters = new TObjArray(kNCH); | |
273 | for(Int_t i=0;i<kNCH;i++) {fClusters->AddAt(new TClonesArray("AliRICHcluster",10000), i); fNclusters[i]=0;} | |
543d5224 | 274 | } |
ed3ceb24 | 275 | //__________________________________________________________________________________________________ |
af3d25a6 | 276 | void AliRICH::CreateRecos() |
277 | { | |
278 | if(fRecos) return; | |
279 | if(GetDebug())Info("CreateRecos","creating recos containers."); | |
280 | fRecos = new TClonesArray("AliRICHreco",1000);fNrecos=0; | |
281 | } | |
282 | //__________________________________________________________________________________________________ | |
3582c1f9 | 283 | void AliRICH::AddSDigit(Int_t c,Int_t x,Int_t y,Double_t q,Int_t pid,Int_t tid) |
ed3ceb24 | 284 | { |
285 | switch(pid){ | |
3582c1f9 | 286 | case 50000050: pid=1000000;break;//cerenkov |
287 | case 50000051: pid=1000; break;//feedback | |
288 | default: pid=1; break;//mip | |
ed3ceb24 | 289 | } |
290 | TClonesArray &tmp=*fSdigits; | |
291 | new(tmp[fNsdigits++])AliRICHdigit(c,x,y,q,pid,tid,kBad,kBad); | |
292 | }//AddSDigit() | |
d4c94996 | 293 | //__________________________________________________________________________________________________ |
c60862bf | 294 | #endif//#ifndef AliRICH_h |