15 #include <TObjArray.h>
20 static const int kNchambers=7; //number of RICH chambers
21 static const int kNpadsX = 160; //number of pads along X in single chamber
22 static const int kNpadsY = 144; //number of pads along Y in single chamber
23 static const int kNsectors=6; //number of sectors per chamber
25 static const int kCerenkov=50000050; //??? go to something more general like TPDGCode
26 static const int kFeedback=50000051; //??? go to something more general like TPDGCode
30 // Class providing all the needed parametrised information
31 // to construct the geometry, to define segmentation and to provide response model
32 // In future will also provide all the staff needed for alignment and calibration
35 class AliRICHParam :public TObject
39 AliRICHParam():TObject(),fpChambers(0) {CreateChambers();}
40 virtual ~AliRICHParam() {delete fpChambers;}
42 void Print(Option_t *opt="") const; //print current parametrization
43 void Test() {TestSeg();TestTrans();TestResp();} //test all groups of methodes
44 void TestResp(); //test the response group of methodes
45 void TestSeg(); //test the segmentation group of methodes
46 void TestTrans(); //test the transform group of methodes
47 static void DrawAxis();
48 static void DrawSectors();
50 static void SetAerogel(Bool_t a) {fgIsAerogel=a;}
51 static Bool_t IsAerogel() {return fgIsAerogel;}
52 static void SetRadioSrc(Bool_t a) {fgIsRadioSrc=a;}
53 static Bool_t IsRadioSrc() {return fgIsRadioSrc;}
54 static void SetTestBeam(Bool_t a) {fgIsTestBeam=a;}
55 static Bool_t IsTestBeam() {return fgIsTestBeam;}
56 static void SetWireSag(Bool_t a) {fgIsWireSag=a;}
57 static Bool_t IsWireSag() {return fgIsWireSag;}
58 static void SetResolveClusters(Bool_t a) {fgIsResolveClusters=a;}
59 static Bool_t IsResolveClusters() {return fgIsResolveClusters;}
60 //Chambers manipulation methodes
61 void CreateChambers(); //form chamber structure
62 AliRICHChamber* C(Int_t i) {return (AliRICHChamber*)fpChambers->UncheckedAt(i-1);} //returns pointer to chamber i
63 Int_t Nchambers() {return fpChambers->GetEntriesFast();} //returns number of chambers
64 //Geometrical properties
65 static Int_t NpadsX() {return kNpadsX;} //pads along X in chamber
66 static Int_t NpadsY() {return kNpadsY;} //pads along Y in chamber
67 static Int_t NpadsXsec() {return NpadsX()/2;} //pads along X in sector
68 static Int_t NpadsYsec() {return NpadsY()/3;} //pads along Y in sector
69 static Double_t DeadZone() {return 2.6;} //dead zone size in cm
70 static Double_t PadSizeX() {return 0.8;} //pad size x, cm
71 static Double_t PadSizeY() {return 0.84;} //pad size y, cm
73 static Double_t SectorSizeX() {return NpadsX()*PadSizeX()/2;} //sector size x, cm
74 static Double_t SectorSizeY() {return NpadsY()*PadSizeY()/3;} //sector size y, cm
75 static Double_t PcSizeX() {return NpadsX()*PadSizeX()+DeadZone();} //PC size x, cm
76 static Double_t PcSizeY() {return NpadsY()*PadSizeY()+2*DeadZone();} //PC size y, cm
78 static Double_t Zfreon() {return 1.5;} //freon thinkness, cm
79 static Double_t Zwin() {return 0.5;} //radiator quartz window, cm
80 static Double_t Pc2Win() {return 8.0;} //cm between CsI PC and radiator quartz window
81 static Double_t Pc2Coll() {return 7.0;} //cm between CsI PC and third wire grid (collection wires)
82 static Double_t Pc2Anod() {return 0.204;} //cm between CsI PC and first wire grid (anod wires)
83 static Double_t Pc2Cath() {return 0.445;} //cm between CsI PC and second wire grid (cathode wires)
84 static Double_t Freon2Pc() {return Zfreon()+Zwin()+Pc2Win();} //cm between CsI PC and entrance to freon
85 static Double_t PitchAnod() {return PadSizeY()/2;} //cm between anode wires
86 static Double_t PitchCath() {return PadSizeY()/4;} //cm between cathode wires
87 static Double_t PitchColl() {return 0.5;} //cm between collection wires
89 static Double_t IonisationPotential() {return 26.0e-9;} //for CH4 in GeV taken from ????
90 static TVector2 MathiesonDelta() {return TVector2(5*0.18,5*0.18);} //area of 5 sigmas of Mathieson distribution (cm)
91 static Int_t MaxQdc() {return 4095;} //QDC number of channels
93 static Int_t HV(Int_t sector) {if (sector>=1 && sector <=6) return fgHV[sector-1]; else return -1;} //high voltage for this sector
94 static void SetHV(Int_t sector,Int_t hv){fgHV[sector-1]=hv;}
95 //optical properties methodes
96 static Double_t MeanCkovEnergy() {return 6.766;} //mean Ckov energy according to the total trasmission curve
97 static Float_t PhotonEnergy(Int_t i) {return 0.1*i+5.5;} //photon energy (eV) for i-th point
98 static Float_t AbsCH4(Float_t ev); //CH4 absorption length (cm) for photon with given energy (eV)
99 static Float_t AbsGel(Float_t) {return 500;} //Aerogel absorption length (cm) for photon with given energy (eV)
100 static Float_t RefIdxC6F14(Float_t eV) {return eV*0.0172+1.177;} //Freon ref index for photon with given energy (eV)
101 static Float_t RefIdxCH4(Float_t) {return 1.000444;} //Methane ref index for photon with given energy (eV)
102 static Float_t RefIdxSiO2(Float_t eV) {Float_t e1=10.666,e2=18.125,f1=46.411,f2= 228.71;
103 return TMath::Sqrt(1.+f1/(e1*e1-eV*eV)+f2/(e2*e2-eV*eV));}//Quartz window ref index from TDR p.35
104 static Float_t RefIdxGel(Float_t) {return 1.05;} //aerogel ref index
105 static Float_t DenGel() {return (RefIdxGel(0)-1)/0.21;} //aerogel density gr/cm^3 parametrization by E.Nappi
106 //trasformation methodes
107 inline static TVector Loc2Area(const TVector2 &x2); //return area affected by hit x2
108 inline static Int_t Loc2Sec(const TVector2 &x2); //return sector containing given position
109 static Int_t Loc2Sec(Double_t x,Double_t y) {return Loc2Sec(TVector2(x,y));} //return sector containing given position
110 inline static TVector Loc2Pad(const TVector2 &x2); //return pad containing given position
111 static TVector Loc2Pad(Double_t x,Double_t y) {return Loc2Pad(TVector2(x,y));} //return pad containing given position
112 inline static TVector2 Pad2Loc(TVector pad); //return center of the pad
113 static TVector2 Pad2Loc(Int_t x,Int_t y) {TVector pad(2);pad[0]=x;pad[1]=y;return Pad2Loc(pad);}//return center of the pad (x,y)
114 inline static Int_t Pad2Sec(const TVector &pad); //return sector of given pad
115 inline static Int_t PadNeighbours(Int_t iPadX,Int_t iPadY,Int_t aListX[4],Int_t aListY[4]); //number of neighbours for this pad
116 static Bool_t IsAccepted(const TVector2 &x2) {return ( x2.X()>=0 && x2.X()<=PcSizeX() && x2.Y()>=0 && x2.Y()<=PcSizeY() ) ? kTRUE:kFALSE;}
117 //charge response methodes
118 inline static Double_t Mathieson(Double_t x1,Double_t x2,Double_t y1,Double_t y2); //Mathienson integral over given limits
119 inline static Double_t GainSag(Double_t x,Int_t sector); //gain variations in %
120 static Double_t QdcSlope(Int_t sec){switch(sec){case -1: return 0; default: return 33;}} //weight of electon in QDC channels
121 static Double_t Gain(const TVector2 &x2){//gives chamber gain in terms of QDC channels for given point in local ref system
122 if(fgIsWireSag) return QdcSlope(Loc2Sec(x2))*(1+GainSag(x2.X(),Loc2Sec(x2))/100);
123 else return QdcSlope(Loc2Sec(x2));}
124 inline static Double_t FracQdc(const TVector2 &x2,const TVector &pad); //charge fraction to pad from hit
125 inline static Int_t TotQdc(TVector2 x2,Double_t eloss); //total charge for hit eloss=0 for photons
126 inline static Bool_t IsOverTh(Int_t c,TVector pad,Double_t q); //is QDC of the pad registered by FEE
127 static Int_t NsigmaTh() {return fgNsigmaTh;} //
128 static Float_t SigmaThMean() {return fgSigmaThMean;} //QDC electronic noise mean
129 static Float_t SigmaThSpread() {return fgSigmaThSpread;} //QDC electronic noise width
131 static Double_t CogCorr(Double_t x) {return 3.31267e-2*TMath::Sin(2*TMath::Pi()/PadSizeX()*x) //correction of cluster CoG due to sinoidal
132 -2.66575e-3*TMath::Sin(4*TMath::Pi()/PadSizeX()*x)
133 +2.80553e-3*TMath::Sin(6*TMath::Pi()/PadSizeX()*x)+0.0070;}
134 static void ReadErrFiles(); //Read Err file parameters
135 static TVector3 SigmaSinglePhoton(Int_t Npart, Double_t mom, Double_t theta, Double_t phi); //Find Sigma for single photon
136 static Double_t Interpolate(Double_t par[4][330],Double_t x, Double_t y, Double_t phi); //Find the error value from interpolation
138 static TVector3 ForwardTracing(TVector3 entranceTrackPoint,TVector3 vectorTrack, Double_t thetaC, Double_t phiC); //it traces foward a photon from Emission Point to PC
139 static TVector3 PlaneIntersect(TVector3 vstart,TVector3 p0,TVector3 n,TVector3 v0); //it finds intersection between straight track and plane
140 static Double_t SnellAngle(Float_t n1, Float_t n2, Float_t theta1); // Snell law
141 static void AnglesInDRS(Double_t trackTheta,Double_t trackPhi,Double_t thetaCerenkov,Double_t phiCerenkov,Double_t &tout,Double_t &pout);//It finds photon angles in
142 //Detector Reference System
144 static Bool_t fgIsAerogel; //aerogel geometry instead of normal RICH flag
146 static Bool_t fgIsRadioSrc; //radioactive source instead of radiators flag
147 static Bool_t fgIsTestBeam; //test beam geometry instead of normal RICH flag
148 static Bool_t fgIsWireSag; //wire sagitta ON/OFF flag
149 static Bool_t fgIsResolveClusters; //declustering ON/OFF flag
150 static Bool_t fgIsFeedback; //generate feedback photon?
152 TObjArray *fpChambers; //list of chambers
153 static Int_t fgHV[6]; //HV applied to anod wires
154 static Int_t fgNsigmaTh; //n. of sigmas to cut for zero suppression
155 static Float_t fgSigmaThMean; //sigma threshold value
156 static Float_t fgSigmaThSpread; //spread of sigma
158 static Double_t fgErrChrom[4][330]; //
159 static Double_t fgErrGeom[4][330]; //
160 static Double_t fgErrLoc[4][330]; //Chromatic, Geometric and Localization array to parametrize SigmaCerenkov
162 ClassDef(AliRICHParam,6) //RICH main parameters class
164 //__________________________________________________________________________________________________
165 Int_t AliRICHParam::PadNeighbours(Int_t iPadX,Int_t iPadY,Int_t listX[4],Int_t listY[4])
167 //Determines all the neighbouring pads for the given one (iPadX,iPadY). Returns total number of these pads.
168 //Dead zones are taken into account, meaning pads from different sector are not taken.
173 if(iPadY!=NpadsY()&&iPadY!=2*NpadsYsec()&&iPadY!=NpadsYsec()){listX[nPads]=iPadX; listY[nPads]=iPadY+1; nPads++;} //1
174 if(iPadX!=1&&iPadX!=NpadsXsec()+1) {listX[nPads]=iPadX-1; listY[nPads]=iPadY; nPads++;} //2
175 if(iPadX!=NpadsXsec()&&iPadX!=NpadsX()) {listX[nPads]=iPadX+1; listY[nPads]=iPadY; nPads++;} //3
176 if(iPadY!=1&&iPadY!=NpadsYsec()+1&&2*NpadsYsec()+1) {listX[nPads]=iPadX; listY[nPads]=iPadY-1; nPads++;} //4
180 //__________________________________________________________________________________________________
181 Int_t AliRICHParam::Loc2Sec(const TVector2 &v2)
183 //Determines sector containing the given point.
184 //Returns sector code:
189 Double_t x0=0; Double_t x1=SectorSizeX(); Double_t x2=SectorSizeX()+DeadZone(); Double_t x3=PcSizeX();
190 Double_t y0=0; Double_t y1=SectorSizeY(); Double_t y2=SectorSizeY()+DeadZone(); Double_t y3=2*SectorSizeY()+DeadZone();
191 Double_t y4=PcSizeY()-SectorSizeY(); Double_t y5=PcSizeY();
194 if (v2.X() >= x0 && v2.X() <= x1 ) sector=1;
195 else if(v2.X() >= x2 && v2.X() <= x3 ) sector=2;
198 if (v2.Y() >= y0 && v2.Y() <= y1 ) ; //sectors 1 or 2
199 else if(v2.Y() >= y2 && v2.Y() <= y3 ) sector+=2; //sectors 3 or 4
200 else if(v2.Y() >= y4 && v2.Y() <= y5 ) sector+=4; //sectors 5 or 6
203 }//Loc2Sec(Double_t x, Double_t y)
204 //__________________________________________________________________________________________________
205 TVector AliRICHParam::Loc2Pad(const TVector2 &loc)
207 //Determines pad number TVector(padx,pady) containing the given point x2 defined in the chamber RS.
208 //Pad count starts in lower left corner from 1,1 to 144,160 in upper right corner of a chamber.
214 Int_t sec=Loc2Sec(loc);//trasforms x2 to sector reference system
215 if(sec==-1) {pad[0]=pad[1]=-1; return pad;}
216 //first we deal with x
217 if(sec==1||sec==3||sec==5) pad[0]= Int_t( loc.X() / PadSizeX() )+1; //sector 1 or 3 or 5
218 else pad[0]=NpadsX() - Int_t( (PcSizeX()-loc.X()) / PadSizeX() ) ; //sector 2 or 4 or 6
220 if(sec==1||sec==2) pad[1]=Int_t( loc.Y() / PadSizeY())+1; //sector 1 or 2
221 else if(sec==3||sec==4) pad[1]=Int_t( (loc.Y()-SectorSizeY()-DeadZone()) / PadSizeY())+NpadsYsec()+1; //sector 3 or 4
222 else pad[1]=NpadsY() - Int_t( (PcSizeY()-loc.Y()) / PadSizeY()); //sector 5 or 6
225 //__________________________________________________________________________________________________
226 Int_t AliRICHParam::Pad2Sec(const TVector &pad)
228 //Determines sector containing the given pad.
230 if (pad[0] >= 1 && pad[0] <= NpadsXsec() ) {sector=1;}
231 else if(pad[0] > NpadsXsec() && pad[0] <= NpadsX() ) {sector=2;}
232 else AliDebugClass(1,Form("Wrong pad (%3.0f,%3.0f)",pad[0],pad[1]));
234 if (pad[1] >= 1 && pad[1] <= NpadsYsec() ) {}
235 else if(pad[1] > NpadsYsec() && pad[1] <= 2*NpadsYsec() ) {sector+=2;}
236 else if(pad[1] > 2*NpadsYsec() && pad[1] <= NpadsY() ) {sector+=4;}
237 else AliDebugClass(1,Form("Wrong pad (%3.0f,%3.0f)",pad[0],pad[1]));
241 //__________________________________________________________________________________________________
242 TVector2 AliRICHParam::Pad2Loc(TVector pad)
244 //Returns position of the center of the given pad in local system of the chamber (cm)
246 // | 3 4 sector numbers
250 if(pad[0] > 0 && pad[0] <= NpadsXsec())//it's 1 or 3 or 5
251 x=(pad[0]-0.5)*PadSizeX();
252 else if(pad[0] > NpadsXsec() && pad[0] <= NpadsX())//it's 2 or 4 or 6
253 x=(pad[0]-0.5)*PadSizeX()+DeadZone();
255 AliDebugClass(1,Form("Wrong pad (%3.0f,%3.0f)",pad[0],pad[1]));
257 if(pad[1] > 0 && pad[1] <= NpadsYsec())//it's 1 or 2
258 y=(pad[1]-0.5)*PadSizeY();
259 else if(pad[1] > NpadsYsec() && pad[1] <= 2*NpadsYsec())//it's 3 or 4
260 y=(pad[1]-0.5)*PadSizeY()+DeadZone();
261 else if(pad[1] > 2*NpadsYsec() && pad[1]<= NpadsY())//it's 5 or 6
262 y=(pad[1]-0.5)*PadSizeY()+2*DeadZone();
264 AliDebugClass(1,Form("Wrong pad (%3.0f,%3.0f)",pad[0],pad[1]));
266 return TVector2(x,y);
268 //__________________________________________________________________________________________________
269 Double_t AliRICHParam::GainSag(Double_t x,Int_t sector)
271 //Returns % of gain variation due to wire sagita.
272 //All curves are parametrized as per sector basis, so x must be apriory transformed to the Sector RS.
273 //Here x is a distance along wires.
275 if(x>SectorSizeX()) x-=SectorSizeX();
277 case 2150: return 9e-6*TMath::Power(x,4)+2e-7*TMath::Power(x,3)-0.0316*TMath::Power(x,2)-3e-4*x+25.367;//%
278 case 2100: return 8e-6*TMath::Power(x,4)+2e-7*TMath::Power(x,3)-0.0283*TMath::Power(x,2)-2e-4*x+23.015;
279 case 2050: return 7e-6*TMath::Power(x,4)+1e-7*TMath::Power(x,3)-0.0254*TMath::Power(x,2)-2e-4*x+20.888;
280 case 2000: return 6e-6*TMath::Power(x,4)+8e-8*TMath::Power(x,3)-0.0227*TMath::Power(x,2)-1e-4*x+18.961;
284 //__________________________________________________________________________________________________
285 Int_t AliRICHParam::TotQdc(TVector2 x2,Double_t eloss)
287 //Calculates the total charge produced by the eloss in point x2 (Chamber RS).
288 //Returns this change parametrised in QDC channels, or 0 if the hit in the dead zone.
289 //eloss=0 means photon which produces 1 electron only eloss > 0 for Mip
290 if(Loc2Sec(x2)==-1) return 0; //hit in the dead zone
291 Int_t iNelectrons=Int_t(eloss/IonisationPotential()); if(iNelectrons==0) iNelectrons=1;
293 for(Int_t i=1;i<=iNelectrons;i++) qdc+=-Gain(x2)*TMath::Log(gRandom->Rndm());
296 //__________________________________________________________________________________________________
297 Double_t AliRICHParam::FracQdc(const TVector2 &x2,const TVector &pad)
299 //Calculates the charge fraction induced to given pad by the hit from the given point.
300 //Integrated Mathieson distribution is used.
301 TVector2 center2=Pad2Loc(pad);//gives center of requested pad
302 Double_t normXmin=(x2.X()-center2.X()-PadSizeX()/2) /Pc2Cath();//parametrise for Mathienson
303 Double_t normXmax=(x2.X()-center2.X()+PadSizeX()/2) /Pc2Cath();
304 Double_t normYmin=(x2.Y()-center2.Y()-PadSizeY()/2) /Pc2Cath();
305 Double_t normYmax=(x2.Y()-center2.Y()+PadSizeY()/2) /Pc2Cath();
307 //requested pad might not belong to the sector of the given hit position, hence the check:
308 return (Loc2Sec(x2)!=Pad2Sec(pad)) ? 0:Mathieson(normXmin, normYmin, normXmax, normYmax);
310 //__________________________________________________________________________________________________
311 Double_t AliRICHParam::Mathieson(Double_t xMin,Double_t yMin,Double_t xMax,Double_t yMax)
313 //All arguments are parametrised according to NIM A370(1988)602-603
314 //Returns a charge fraction.
315 const Double_t kSqrtKx3=0.77459667;const Double_t kX2=0.962;const Double_t kX4=0.379;
316 const Double_t kSqrtKy3=0.77459667;const Double_t kY2=0.962;const Double_t kY4=0.379;
318 Double_t ux1=kSqrtKx3*TMath::TanH(kX2*xMin);
319 Double_t ux2=kSqrtKx3*TMath::TanH(kX2*xMax);
320 Double_t uy1=kSqrtKy3*TMath::TanH(kY2*yMin);
321 Double_t uy2=kSqrtKy3*TMath::TanH(kY2*yMax);
322 return 4*kX4*(TMath::ATan(ux2)-TMath::ATan(ux1))*kY4*(TMath::ATan(uy2)-TMath::ATan(uy1));
324 //__________________________________________________________________________________________________
325 TVector AliRICHParam::Loc2Area(const TVector2 &x2)
327 //Calculates the area of disintegration for a given point. It's assumed here that this points lays on anode wire.
328 //Area is a rectangulare set of pads defined by its left-down and right-up coners.
330 TVector pad=Loc2Pad(x2);
331 area[0]=area[2]=pad[0]; area[1]=area[3]=pad[1];//area is just a pad fired
332 if(pad[0]!=1 && pad[0]!= NpadsXsec()+1 ) area[0]--; //left down coner X
333 if(pad[1]!=1 && pad[1]!= NpadsYsec()+1 && pad[1]!= 2*NpadsYsec()+1) area[1]--; //left down coner Y
334 if(pad[0]!=NpadsXsec() && pad[0]!= NpadsX() ) area[2]++; //right up coner X
335 if(pad[1]!=NpadsYsec() && pad[1]!= 2*NpadsYsec() && pad[1]!= NpadsY() ) area[3]++; //right up coner Y
338 //__________________________________________________________________________________________________
339 Bool_t AliRICHParam::IsOverTh(Int_t ,TVector ,Double_t q)
341 //Checks if the current q is over threshold and FEE will save this value to data concentrator.
342 return (q>NsigmaTh()*(SigmaThMean()+(1.-2*gRandom->Rndm())*SigmaThSpread()));
344 #endif //AliRICHParam_h