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