]>
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: | |
e42a7b46 | 21 | AliRICHhit():AliHit(),fChamber(kBad),fEloss(kBad) {fInX3.SetXYZ(0,0,0);fOutX3.SetXYZ(0,0,0);} |
d4c94996 | 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: | |
e42a7b46 | 45 | AliRICHdigit():AliDigit(),fCFM(0),fChamber(0),fPadX(0),fPadY(0),fQdc(kBad){fTracks[0]=fTracks[1]=fTracks[2]=kBad;} |
46 | AliRICHdigit(Int_t c,TVector pad,Double_t q,Int_t cfm,Int_t tid0,Int_t tid1,Int_t tid2) | |
47 | {fPadX=(Int_t)pad[0];fPadY=(Int_t)pad[1];fQdc=q;fChamber=10*c+AliRICHParam::Pad2Sec(pad);fCFM=cfm;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 | |
e42a7b46 | 51 | virtual Bool_t IsSortable() const{return kTRUE;} //sort interface |
52 | virtual void Print(Option_t *option="") const; //virtual | |
53 | Int_t ChFbMi() const{return fCFM;} //particle mixture for this digit | |
d4c94996 | 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 | |
e42a7b46 | 58 | TVector Pad() const{Float_t v[2]={fPadX,fPadY}; return TVector(2,v);} |
d4c94996 | 59 | Int_t Id() const{return fChamber*10000000+fPadX*1000+fPadY;} //absolute id of this pad |
60 | Double_t Q() const{return fQdc;} //charge in terms of ADC channels | |
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: |
e42a7b46 | 64 | Int_t fCFM; //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: | |
e42a7b46 | 76 | enum ClusterStatus {kEdge,kShape,kSize,kRaw,kResolved,kEmpty=kBad}; |
77 | AliRICHcluster():TObject(),fCFM(0),fSize(0),fShape(0),fQdc(0),fChamber(0),fX(0),fY(0),fStatus(kEmpty),fDigits(0) {} | |
78 | virtual ~AliRICHcluster() {Reset();} | |
79 | void Reset() {DeleteDigits();fCFM=fSize=fShape=fQdc=fChamber=0;fX=fY=0;fStatus=kEmpty;} //cleans the cluster | |
80 | void DeleteDigits() {if(fDigits) delete fDigits; fDigits=0;} //deletes the list of digits | |
81 | AliRICHcluster& operator=(const AliRICHcluster&) {return *this;} | |
82 | Int_t Nlocals() const{return fSize-10000*(fSize/10000);} //number of local maximums | |
83 | Int_t Size() const{return fSize/10000;} //number of digits in cluster | |
84 | Int_t Fsize() const{return fSize;} // | |
85 | Int_t Shape() const{return fShape;} //cluster shape rectangulare | |
86 | Int_t C() const{return fChamber/10;} //chamber number | |
87 | Int_t S() const{return fChamber-(fChamber/10)*10;} //sector number | |
88 | Int_t Fchamber() const{return fChamber;} // | |
89 | Int_t Q() const{return fQdc;} //cluster charge in QDC channels | |
90 | Double_t X() const{return fX;} //cluster x position in LRS | |
91 | Double_t Y() const{return fY;} //cluster y position in LRS | |
92 | Int_t Status() const{return fStatus;} // | |
93 | void SetStatus(Int_t status) {fStatus=status;} // | |
94 | Int_t Nmips() const{return fCFM-1000000*Ncerenkovs()-1000*Nfeedbacks();} // | |
95 | Int_t Ncerenkovs() const{return fCFM/1000000;} // | |
96 | Int_t Nfeedbacks() const{return (fCFM-1000000*Ncerenkovs())/1000;} // | |
97 | Bool_t IsPureMip() const{return fCFM<1000;} // | |
98 | Bool_t IsPureCerenkov() const{return Nmips()==0&&Nfeedbacks()==0;} // | |
99 | Bool_t IsPureFeedback() const{return Nmips()==0&&Ncerenkovs()==0;} // | |
100 | Bool_t IsSingleMip() const{return Nmips()==1&&Ncerenkovs()==0&&Nfeedbacks()==0;} // | |
101 | Bool_t IsSingleCerenkov() const{return Nmips()==0&&Ncerenkovs()==1&&Nfeedbacks()==0;} // | |
102 | Bool_t IsSingleFeedback() const{return Nmips()==0&&Ncerenkovs()==0&&Nfeedbacks()==1;} // | |
103 | Bool_t IsMip() const{return Nmips()!=0;} // | |
104 | Bool_t IsCerenkov() const{return Ncerenkovs()!=0;} // | |
105 | Bool_t IsFeedback() const{return Nfeedbacks()!=0;} // | |
106 | Int_t CombiPid() const{return fCFM;} // | |
107 | void CFM(Int_t c,Int_t f,Int_t m) {fCFM=1000000*c+1000*f+m;} //cluster contributors | |
108 | TObjArray* Digits() const{return fDigits;} // | |
109 | virtual void Print(Option_t *option="")const; // | |
110 | inline void AddDigit(AliRICHdigit *pDig); // | |
111 | inline void CoG(Int_t nLocals); //calculates center of gravity | |
112 | void Fill(AliRICHcluster *pRaw,Double_t x,Double_t y,Double_t q,Int_t cfm) //form new resolved cluster from raw one | |
113 | {fCFM=cfm;fChamber=pRaw->Fchamber();fSize=pRaw->Fsize();fQdc=(Int_t)(q*pRaw->Q());fX=x;fY=y;fStatus=kResolved;} // | |
c1863e3c | 114 | protected: |
e42a7b46 | 115 | Int_t fCFM; //1000000*Ncerenkovs+1000*Nfeedbacks+Nmips |
6865fb8d | 116 | Int_t fSize; //10000*(how many digits belong to this cluster) + nLocalMaxima |
e42a7b46 | 117 | Int_t fShape; //100*xdim+ydim box containing the cluster |
c1863e3c | 118 | Int_t fQdc; //QDC value |
119 | Int_t fChamber; //10*module number+sector number | |
120 | Double_t fX; //local x postion | |
121 | Double_t fY; //local y postion | |
122 | Int_t fStatus; //flag to mark the quality of the cluster | |
123 | TObjArray *fDigits; //! list of digits forming this cluster | |
ed3ceb24 | 124 | ClassDef(AliRICHcluster,2) //RICH cluster class |
c1863e3c | 125 | };//class AliRICHcluster |
126 | //__________________________________________________________________________________________________ | |
127 | void AliRICHcluster::AddDigit(AliRICHdigit *pDig) | |
e42a7b46 | 128 | { |
129 | // Adds a given digit to the list of digits belonging to this cluster | |
130 | if(!fDigits) {fQdc=fSize=fCFM=0;fDigits = new TObjArray;} | |
cbaf35fb | 131 | fQdc+=(Int_t)pDig->Q(); fDigits->Add(pDig); |
cb8189e7 | 132 | fChamber=10*pDig->C()+pDig->S(); |
6865fb8d | 133 | fSize+=10000; |
e42a7b46 | 134 | fStatus=kRaw; |
cbaf35fb | 135 | } |
136 | //__________________________________________________________________________________________________ | |
6865fb8d | 137 | void AliRICHcluster::CoG(Int_t nLocals) |
e42a7b46 | 138 | { |
139 | // Calculates naive cluster position as a center of gravity of its digits. | |
140 | Float_t xmin=999,ymin=999,xmax=0,ymax=0; | |
cb8189e7 | 141 | fX=fY=0; |
142 | for(Int_t iDig=0;iDig<Size();iDig++) { | |
143 | AliRICHdigit *pDig=(AliRICHdigit*)fDigits->At(iDig); | |
e42a7b46 | 144 | TVector pad=pDig->Pad(); Double_t q=pDig->Q(); |
145 | TVector2 x2=AliRICHParam::Pad2Loc(pad); | |
3582c1f9 | 146 | fX += x2.X()*q;fY +=x2.Y()*q; |
e42a7b46 | 147 | if(pad[0]<xmin)xmin=pad[0];if(pad[0]>xmax)xmax=pad[0];if(pad[1]<ymin)ymin=pad[1];if(pad[1]>ymax)ymax=pad[1]; |
cbaf35fb | 148 | } |
cb8189e7 | 149 | fX/=fQdc;fY/=fQdc;//Center of Gravity |
e42a7b46 | 150 | fShape=Int_t(100*(xmax-xmin+1)+ymax-ymin+1);//find box containing cluster |
6865fb8d | 151 | fSize+=nLocals; |
cb8189e7 | 152 | fStatus=kRaw; |
153 | }//CoG() | |
d4c94996 | 154 | |
c021cb15 | 155 | //__________________AliRICH_________________________________________________________________________ |
e42a7b46 | 156 | class AliESD; |
3ea9cb08 | 157 | |
2f614988 | 158 | class AliRICH : public AliDetector |
159 | { | |
2f614988 | 160 | public: |
853634d3 | 161 | AliRICH(); |
af3d25a6 | 162 | AliRICH(const char *name, const char *title); |
d4c94996 | 163 | AliRICH(const AliRICH& RICH):AliDetector(RICH) {;} //copy ctor |
853634d3 | 164 | virtual ~AliRICH(); |
dfb4e77d | 165 | |
942194a4 | 166 | AliRICH& operator=(const AliRICH&) {return *this;} |
d4c94996 | 167 | //framework part |
e42a7b46 | 168 | virtual Int_t IsVersion() const =0; //interface from |
169 | virtual void StepManager() =0; //interface from AliMC | |
170 | virtual void Hits2SDigits(); //interface from AliSimulation | |
171 | virtual AliDigitizer* CreateDigitizer(AliRunDigitizer* man) const {return new AliRICHDigitizer(man);} //interface from AliSimulation | |
172 | virtual void Reconstruct() const; //interface from AliReconstruction | |
173 | virtual void FillESD(AliESD *pESD) const; //interface from AliReconstruction | |
174 | virtual void Print(Option_t *option) const; //prints current RICH status | |
175 | virtual void SetTreeAddress(); //interface from AliLoader | |
176 | virtual void MakeBranch(Option_t *opt=" "); //interface from AliLoader | |
177 | virtual void CreateMaterials(); //interface from AliMC | |
178 | virtual void CreateGeometry(); //interface from AliMC | |
179 | virtual void BuildGeometry(); //interface | |
d4c94996 | 180 | //private part |
181 | Float_t AbsoCH4(Float_t x)const; //calculates absorption length for methane | |
182 | Float_t Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)const; //deals with Fresnel absorption | |
d4c94996 | 183 | inline void CreateHits(); //create hits container as a simple list |
184 | inline void CreateSDigits(); //create sdigits container as a simple list | |
185 | inline void CreateDigits(); //create digits container as 7 lists, one per chamber | |
186 | inline void CreateClusters(); //create clusters container as 7 lists, one per chamber | |
d4c94996 | 187 | // void ResetHits() {AliDetector::ResetHits();} //virtual |
188 | void ResetSDigits() {fNsdigits=0; if(fSdigits) fSdigits ->Clear();} | |
e42a7b46 | 189 | void ResetDigits() {if(fDigitsNew)for(int i=0;i<kNchambers;i++){fDigitsNew->At(i)->Clear();fNdigitsNew[i]=0;}} //virtual |
190 | void ResetClusters() {if(fClusters) for(int i=0;i<kNchambers;i++){fClusters ->At(i)->Clear();fNclusters[i]=0;}} | |
c1863e3c | 191 | TClonesArray* SDigits() const{return fSdigits;} |
543d5224 | 192 | TClonesArray* Digits(Int_t iC) const{if(fDigitsNew) return (TClonesArray *)fDigitsNew->At(iC-1);else return 0;} |
c60862bf | 193 | TClonesArray* Clusters(Int_t iC) const{if(fClusters) return (TClonesArray *)fClusters->At(iC-1);else return 0;} |
e42a7b46 | 194 | AliRICHChamber* C(Int_t iC) const{return fpParam->C(iC);} //provides pointer to a given chamber |
195 | AliRICHParam* P() const{return fpParam;} //provides pointer to a RICH params | |
196 | AliRICH* R() {return this;} //provides pointer to RICH main object | |
197 | TVector Counters() const{return fCounters;} //provides a set of counters | |
198 | void ControlPlots(); //utility | |
199 | void PrintHits (Int_t iEvent=0); //utility | |
200 | void PrintSDigits (Int_t iEvent=0); //utility | |
201 | void PrintDigits (Int_t iEvent=0); //utility | |
202 | void PrintClusters(Int_t iEvent=0); //utility | |
c60862bf | 203 | |
e42a7b46 | 204 | void AddHit(Int_t c,Int_t tid,TVector3 i3,TVector3 o3,Double_t eloss=0){TClonesArray &tmp=*fHits;new(tmp[fNhits++])AliRICHhit(c,tid,i3,o3,eloss);} |
205 | inline void AddSDigit(Int_t c,TVector pad,Double_t q,Int_t pid,Int_t tid); | |
206 | void AddDigit(int c,TVector pad,int q,int cfm,int *tid)//Add simulated digit | |
207 | {TClonesArray &tmp=*((TClonesArray*)fDigitsNew->At(c-1));new(tmp[fNdigitsNew[c-1]++])AliRICHdigit(c,pad,q,cfm,tid[0],tid[1],tid[2]);} | |
208 | void AddDigit(Int_t c,TVector pad,Int_t q)//for real data digits | |
209 | {TClonesArray &tmp=*((TClonesArray*)fDigitsNew->At(0));new(tmp[fNdigitsNew[0]++])AliRICHdigit(c,pad,q,0,-1,-1,-1);} | |
d4c94996 | 210 | void AddCluster(AliRICHcluster &cl) |
e42a7b46 | 211 | {Int_t c=cl.C()-1;TClonesArray &tmp=*((TClonesArray*)fClusters->At(c));new(tmp[fNclusters[c]++])AliRICHcluster(cl);} |
212 | AliRICHhit* Hit(Int_t tid); //returns pointer ot RICH hit for a given tid | |
c60862bf | 213 | protected: |
e42a7b46 | 214 | enum {kAir=1,kCSI=6,kGAP=9,kAl=10,kCH4=5,kSteel=15,kPerpex=16,kSr90=17}; |
c021cb15 | 215 | AliRICHParam *fpParam; //main RICH parametrization |
d4c94996 | 216 | //fHits and fDigits belong to AliDetector |
e42a7b46 | 217 | TClonesArray *fSdigits; //! list of sdigits |
218 | Int_t fNsdigits; //! current number of sdigits | |
84365c70 | 219 | |
e42a7b46 | 220 | TObjArray *fDigitsNew; //! each chamber holds it's one lists of digits |
221 | Int_t fNdigitsNew[kNchambers]; //! array of current numbers of digits | |
84365c70 | 222 | |
e42a7b46 | 223 | TObjArray *fClusters; //! each chamber holds it's one lists of clusters |
224 | Int_t fNclusters[kNchambers]; //! array of current numbers of raw clusters | |
84365c70 | 225 | |
e42a7b46 | 226 | TVector fCounters; //Photon history conters, explanation in StepManager() |
227 | ClassDef(AliRICH,7) //Main RICH class | |
c60862bf | 228 | };//class AliRICH |
ed3ceb24 | 229 | |
c1863e3c | 230 | //__________________________________________________________________________________________________ |
c60862bf | 231 | void AliRICH::CreateHits() |
232 | { | |
233 | if(fHits) return; | |
234 | if(GetDebug())Info("CreateHits","creating hits container."); | |
235 | fHits=new TClonesArray("AliRICHhit",10000); fNhits=0; | |
543d5224 | 236 | } |
c60862bf | 237 | //__________________________________________________________________________________________________ |
c1863e3c | 238 | void AliRICH::CreateSDigits() |
c60862bf | 239 | { |
240 | if(fSdigits) return; | |
c1863e3c | 241 | if(GetDebug())Info("CreateSDigits","creating sdigits container."); |
c60862bf | 242 | fSdigits=new TClonesArray("AliRICHdigit",10000); fNsdigits=0; |
543d5224 | 243 | } |
c60862bf | 244 | //__________________________________________________________________________________________________ |
245 | void AliRICH::CreateDigits() | |
246 | { | |
247 | if(fDigitsNew) return; | |
248 | if(GetDebug())Info("CreateDigits","creating digits containers."); | |
e42a7b46 | 249 | fDigitsNew = new TObjArray(kNchambers); |
250 | for(Int_t i=0;i<kNchambers;i++) {fDigitsNew->AddAt(new TClonesArray("AliRICHdigit",10000), i); fNdigitsNew[i]=0;} | |
543d5224 | 251 | } |
c60862bf | 252 | //__________________________________________________________________________________________________ |
253 | void AliRICH::CreateClusters() | |
254 | { | |
255 | if(fClusters) return; | |
256 | if(GetDebug())Info("CreateClusters","creating clusters containers."); | |
e42a7b46 | 257 | fClusters = new TObjArray(kNchambers); |
258 | for(Int_t i=0;i<kNchambers;i++) {fClusters->AddAt(new TClonesArray("AliRICHcluster",10000), i); fNclusters[i]=0;} | |
543d5224 | 259 | } |
ed3ceb24 | 260 | //__________________________________________________________________________________________________ |
e42a7b46 | 261 | void AliRICH::AddSDigit(Int_t c,TVector pad,Double_t q,Int_t pid,Int_t tid) |
262 | { | |
263 | Int_t cfm; | |
ed3ceb24 | 264 | switch(pid){ |
e42a7b46 | 265 | case 50000050: cfm=1000000;break;//cerenkov |
266 | case 50000051: cfm=1000; break;//feedback | |
267 | default: cfm=1; break;//mip | |
ed3ceb24 | 268 | } |
e42a7b46 | 269 | TClonesArray &tmp=*fSdigits; new(tmp[fNsdigits++])AliRICHdigit(c,pad,q,cfm,tid,kBad,kBad); |
270 | } | |
d4c94996 | 271 | //__________________________________________________________________________________________________ |
c60862bf | 272 | #endif//#ifndef AliRICH_h |