13 static const int kNCH=7; //number of RICH chambers ???
14 static const int kNchambers=7; //number of RICH chambers
15 static const int kNpadsX = 160; //number of pads along X in single chamber
16 static const int kNpadsY = 144; //number of pads along Y in single chamber
17 static const int kBad=-101; //useful static const to mark initial (uninitalised) values
18 static const int kNsectors=6; //number of sectors per chamber
20 static const int kadc_satm = 4096; //dynamic range (10 bits)
21 static const int kCerenkov=50000050; //??? go to something more general like TPDGCode
22 static const int kFeedback=50000051; //??? go to something more general like TPDGCode
26 class AliRICHParam :public TObject
29 AliRICHParam():TObject(),fpChambers(0) {CreateChambers();}
30 virtual ~AliRICHParam() {delete fpChambers;}
31 void CreateChambers();
32 AliRICHChamber* C(Int_t i) {return (AliRICHChamber*)fpChambers->UncheckedAt(i-1);} //returns pointer to chamber i
33 static Int_t NpadsX() {return kNpadsX;} //pads along X in chamber
34 static Int_t NpadsY() {return kNpadsY;} //pads along Y in chamber
35 static Int_t NpadsXsec() {return NpadsX()/2;} //pads along X in sector
36 static Int_t NpadsYsec() {return NpadsY()/3;} //pads along Y in sector
37 static Double_t DeadZone() {return 2.6;} //dead zone size in cm
38 static Double_t PadSizeX() {return 0.8;} //pad size x in cm
39 static Double_t PadSizeY() {return 0.84;} //pad size y in cm
40 static Double_t SectorSizeX() {return NpadsX()*PadSizeX()/2;} //sector size x in cm
41 static Double_t SectorSizeY() {return NpadsY()*PadSizeY()/3;} //sector size y in cm
42 static Double_t PcSizeX() {return NpadsX()*PadSizeX()+DeadZone();} //photocathode size x in cm
43 static Double_t PcSizeY() {return NpadsY()*PadSizeY()+2*DeadZone();} //photocathode size y in cm
44 static Double_t SizeX() {return 132.6;}
45 static Double_t SizeY() {return 26;}
46 static Double_t SizeZ() {return 136.7;}
47 static Double_t Offset() {return 490+1.267;} //distance from IP to center of chamber in cm
48 static Double_t AngleYZ() {return 19.5*TMath::DegToRad();} //angle between chambers in YZ plane, rad
49 static Double_t AngleXY() {return 20*TMath::DegToRad();} //angle between chambers in XY plane, rad
50 static Double_t AngleRot() {return fgAngleRot*TMath::DegToRad();} //RICH rotation around Z, rad
51 static Double_t FreonThickness() {return 1.5;}
52 static Double_t QuartzThickness() {return 0.5;}
54 static Double_t GapProx() {return 8.0;} //cm between CsI PC and radiator quartz window
55 static Double_t GapColl() {return 7.0;} //cm between CsI PC and third wire grid (collection wires)
56 static Double_t GapAnod() {return 0.204;} //cm between CsI PC and first wire grid (anod wires)
57 static Double_t GapAmp() {return 0.445;} //cm between CsI PC and second wire grid (cathode wires)
58 static Double_t PitchAnod() {return PadSizeY()/2;} //cm between anode wires
59 static Double_t PitchCath() {return PadSizeY()/4;} //cm between cathode wires
60 static Double_t PitchColl() {return 0.5;} //cm between collect wires
62 static Double_t GapThickness() {return 8.0;}
63 static Double_t RadiatorToPads() {return FreonThickness()+QuartzThickness()+GapThickness();}
64 static Double_t AnodeCathodeGap() {return 0.2;} //between CsI PC and first wire grid
65 static Double_t QuartzLength() {return 133;}
66 static Double_t QuartzWidth() {return 127.9;}
67 static Double_t OuterFreonLength() {return 133;}
68 static Double_t OuterFreonWidth() {return 41.3;}
69 static Double_t InnerFreonLength() {return 133;}
70 static Double_t InnerFreonWidth() {return 41.3;}
71 static Double_t IonisationPotential() {return 26.0e-9;} //for CH4 in GeV taken from ????
72 static TVector2 MathiesonDelta() {return TVector2(5*0.18,5*0.18);} //area of 5 sigmas of Mathieson distribution (cm)
73 static Int_t MaxQdc() {return 4095;} //QDC number of channels
74 static Double_t AlphaFeedback(Int_t ) {return 0.030;} //determines number of feedback photons
76 static Bool_t IsResolveClusters() {return fgIsResolveClusters;} //go after resolved clusters?
77 static Bool_t IsWireSag() {return fgIsWireSag;} //take wire sagita in account?
78 static Bool_t IsRadioSrc() {return fgIsRadioSrc;} //add radioactive source inside CH4?
79 static Int_t HV(Int_t sector) {
80 if (sector>=1 && sector <=6)
81 return fgHV[sector-1];
83 ::Error("HV","Wrong sector %d",sector);
86 } //high voltage for this sector
87 static void SetDeclustering(Bool_t a) {fgIsResolveClusters=a;}
88 static void SetRadioSrc(Bool_t a) {fgIsRadioSrc=a;}
89 static void SetWireSag(Bool_t status) {fgIsWireSag=status;}
90 static void SetHV(Int_t sector,Int_t hv){fgHV[sector-1]=hv;}
91 static void SetAngleRot(Double_t rot) {fgAngleRot =rot;}
93 inline static TVector Loc2Area(TVector2 x2); //return area affected by hit x2
94 inline static TVector Loc2Pad(TVector2 x2); //return pad containing given position
95 inline static TVector2 Pad2Loc(TVector pad); //return center of the pad
96 static TVector2 Pad2Loc(Int_t x,Int_t y) {TVector pad(2);pad[0]=x;pad[1]=y;return Pad2Loc(pad);}
97 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
99 inline static Double_t Mathieson(Double_t x1,Double_t x2,Double_t y1,Double_t y2); //Mathienson integral over these limits
100 inline static Double_t GainSag(Double_t x,Int_t sector); //gain variations in %
101 static Double_t QdcSlope(Int_t sec){switch(sec){case kBad: return 0; default: return 33;}} //weight of electon in QDC channels
102 static Double_t Gain(TVector2 x2){if(IsWireSag()) return QdcSlope(Loc2Sec(x2))*(1+GainSag(x2.X(),Loc2Sec(x2))/100);else return QdcSlope(Loc2Sec(x2));}//gain for point in chamber RS
103 inline static Double_t FracQdc(TVector2 x2,TVector pad); //charge fraction to pad from hit
104 inline static Int_t TotQdc(TVector2 x2,Double_t eloss); //total charge for hit eloss=0 for photons
105 inline Bool_t IsOverTh(Int_t c,TVector pad,Double_t q); //is QDC of the pad registered by FEE
106 static Int_t NsigmaTh() {return fgNsigmaTh;} //
107 static Float_t SigmaThMean() {return fgSigmaThMean;} //QDC electronic noise mean
108 static Float_t SigmaThSpread() {return fgSigmaThSpread;} //QDC electronic noise width
109 void Print(const Option_t *opt=""); //virtual
110 inline static void PropogateHelix(TVector3 x0,TVector3 p0,Double_t s,TVector3 *x,TVector3 *p);
112 inline static Int_t Loc2Sec(TVector2 &x2); //return sector, x2->Sector RS
113 inline static Int_t Pad2Sec(TVector pad); //return sector
115 TObjArray *fpChambers; //list of chambers
116 static Bool_t fgIsWireSag; //wire sagitta ON/OFF flag
117 static Bool_t fgIsResolveClusters; //declustering ON/OFF flag
118 static Bool_t fgIsRadioSrc; //radioactive source ON/OFF flag
119 static Int_t fgHV[6]; //HV applied to anod wires
120 static Double_t fgAngleRot; //module rotation from up postion (0,0,490)cm
121 static Int_t fgNsigmaTh; //n. of sigmas to cut for zero suppression
122 static Float_t fgSigmaThMean; //sigma threshold value
123 static Float_t fgSigmaThSpread; //spread of sigma
124 ClassDef(AliRICHParam,5) //RICH main parameters class
126 //__________________________________________________________________________________________________
127 Int_t AliRICHParam::PadNeighbours(Int_t iPadX,Int_t iPadY,Int_t listX[4],Int_t listY[4])
129 // Determines all the neighbouring pads for the given one (iPadX,iPadY). Returns total number of these pads.
130 // Dead zones are taken into account.
135 if(iPadY!=NpadsY()&&iPadY!=2*NpadsYsec()&&iPadY!=NpadsYsec()){listX[nPads]=iPadX; listY[nPads]=iPadY+1; nPads++;} //1
136 if(iPadX!=1&&iPadX!=NpadsXsec()+1) {listX[nPads]=iPadX-1; listY[nPads]=iPadY; nPads++;} //2
137 if(iPadX!=NpadsXsec()&&iPadX!=NpadsX()) {listX[nPads]=iPadX+1; listY[nPads]=iPadY; nPads++;} //3
138 if(iPadY!=1&&iPadY!=NpadsYsec()+1&&2*NpadsYsec()+1) {listX[nPads]=iPadX; listY[nPads]=iPadY-1; nPads++;} //4
142 //__________________________________________________________________________________________________
143 Int_t AliRICHParam::Loc2Sec(TVector2 &v2)
145 // Determines sector containing the given point and trasform this point to the local system of that sector.
146 // Returns sector code:
151 Double_t x0=0; Double_t x1=SectorSizeX(); Double_t x2=SectorSizeX()+DeadZone(); Double_t x3=PcSizeX();
152 Double_t y0=0; Double_t y1=SectorSizeY(); Double_t y2=SectorSizeY()+DeadZone(); Double_t y3=2*SectorSizeY()+DeadZone();
153 Double_t y4=PcSizeY()-SectorSizeY(); Double_t y5=PcSizeY();
156 Double_t x=v2.X(),y=v2.Y();
157 if (v2.X() >= x0 && v2.X() <= x1 ) {sector=1;}
158 else if(v2.X() >= x2 && v2.X() <= x3 ) {sector=2; x=v2.X()-x2;}
159 else {sector=kBad; ::Error("Loc2Sec","Position %6.2f,%6.2f is out of chamber in X",v2.X(),v2.Y());return kBad;}
161 if (v2.Y() >= y0 && v2.Y() <= y1 ) {} //sectors 1 or 2
162 else if(v2.Y() >= y2 && v2.Y() <= y3 ) {sector+=2; y=v2.Y()-y2;} //sectors 3 or 4
163 else if(v2.Y() >= y4 && v2.Y() <= y5 ) {sector+=4; y=v2.Y()-y4;} //sectors 5 or 6
164 else {sector=kBad; ::Error("Loc2Sec","Position %6.2f,%6.2f is out of chamber in Y",v2.X(),v2.Y());return kBad;}
167 }//Loc2Sec(Double_t x, Double_t y)
168 //__________________________________________________________________________________________________
169 TVector AliRICHParam::Loc2Pad(TVector2 x2)
171 // Determines pad number TVector(padx,pady) containing the given point x2 defined the chamber RS.
172 // Pad count starts in lower left corner from 1,1 to 144,160 in upper right corner of a chamber.
173 // Returns sector number of the determined pad.
179 Int_t sector=Loc2Sec(x2);//trasforms x2 to sector reference system
180 if(sector==kBad) {pad[0]=pad[1]=kBad; return pad;}
182 pad[0]=Int_t(x2.X()/PadSizeX())+1; if(pad[0]>NpadsXsec()) pad[0]= NpadsXsec();
183 if(sector==2||sector==4||sector==6) pad[0]+= NpadsXsec();
185 pad[1]=Int_t(x2.Y()/PadSizeY())+1; if(pad[1]>NpadsYsec()) pad[1]= NpadsYsec();
186 if(sector==3||sector==4) pad[1]+=NpadsYsec();
187 if(sector==5||sector==6) pad[1]+=2*NpadsYsec();
190 //__________________________________________________________________________________________________
191 Int_t AliRICHParam::Pad2Sec(TVector pad)
193 // Determines sector containing the given pad.
195 if (pad[0] >= 1 && pad[0] <= NpadsXsec() ) {sector=1;}
196 else if(pad[0] > NpadsXsec() && pad[0] <= NpadsX() ) {sector=2;}
197 else ::Error("Pad2Sec","Wrong pad (%3.0f,%3.0f)",pad[0],pad[1]);
199 if (pad[1] >= 1 && pad[1] <= NpadsYsec() ) {}
200 else if(pad[1] > NpadsYsec() && pad[1] <= 2*NpadsYsec() ) {sector+=2;}
201 else if(pad[1] > 2*NpadsYsec() && pad[1] <= NpadsY() ) {sector+=4;}
202 else ::Error("Pad2Sec","Wrong pad (%3.0f,%3.0f)",pad[0],pad[1]);
206 //__________________________________________________________________________________________________
207 TVector2 AliRICHParam::Pad2Loc(TVector pad)
209 // Returns position of the center of the given pad in local system of the chamber
211 // | 3 4 chamber structure
214 Double_t x=kBad,y=kBad;
215 if(pad[0] > 0 && pad[0] <= NpadsXsec())//it's 1 or 3 or 5
216 x=(pad[0]-0.5)*PadSizeX();
217 else if(pad[0] > NpadsXsec() && pad[0] <= NpadsX())//it's 2 or 4 or 6
218 x=(pad[0]-0.5)*PadSizeX()+DeadZone();
220 ::Error("Pad2Loc","Wrong pad (%3.0f,%3.0f)",pad[0],pad[1]);
222 if(pad[1] > 0 && pad[1] <= NpadsYsec())//it's 1 or 2
223 y=(pad[1]-0.5)*PadSizeY();
224 else if(pad[1] > NpadsYsec() && pad[1] <= 2*NpadsYsec())//it's 3 or 4
225 y=(pad[1]-0.5)*PadSizeY()+DeadZone();
226 else if(pad[1] > 2*NpadsYsec() && pad[1]<= NpadsY())//it's 5 or 6
227 y=(pad[1]-0.5)*PadSizeY()+2*DeadZone();
229 ::Error("Pad2Loc","Wrong pad (%3.0f,%3.0f)",pad[0],pad[1]);
231 return TVector2(x,y);
233 //__________________________________________________________________________________________________
234 Double_t AliRICHParam::GainSag(Double_t x,Int_t sector)
236 // Returns % of gain variation due to wire sagita.
237 // All curves are parametrized as per sector basis, so y must be apriory transformed to the Sector RS.
239 if(x>SectorSizeX()) x-=SectorSizeX();
241 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;//%
242 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;
243 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;
244 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;
248 //__________________________________________________________________________________________________
249 Int_t AliRICHParam::TotQdc(TVector2 x2,Double_t eloss)
251 // Calculates the total charge produced by the eloss in point x2 (Chamber RS).
252 // Returns this change parametrised in QDC channels, or 0 if the hit in the dead zone.
253 // eloss=0 means photons which provided for only 1 electron
255 if(Loc2Sec(x2)==kBad) return 0; //hit in the dead zone
256 Int_t iNelectrons=Int_t(eloss/IonisationPotential()); if(iNelectrons==0) iNelectrons=1;
258 for(Int_t i=1;i<=iNelectrons;i++) qdc+=-Gain(x2)*TMath::Log(gRandom->Rndm());
261 //__________________________________________________________________________________________________
262 Double_t AliRICHParam::FracQdc(TVector2 x2,TVector pad)
264 // Calculates the charge fraction induced to given pad by the hit from the given point.
265 // Integrated Mathieson distribution is used.
266 TVector2 center2=Pad2Loc(pad);//gives center of requested pad
267 Double_t normXmin=(x2.X()-center2.X()-PadSizeX()/2) /AnodeCathodeGap();
268 Double_t normXmax=(x2.X()-center2.X()+PadSizeX()/2) /AnodeCathodeGap();
269 Double_t normYmin=(x2.Y()-center2.Y()-PadSizeY()/2) /AnodeCathodeGap();
270 Double_t normYmax=(x2.Y()-center2.Y()+PadSizeY()/2) /AnodeCathodeGap();
272 if(Loc2Sec(x2)!=Pad2Sec(pad)) return 0;//requested pad does not belong to the sector of the given hit position
273 else return Mathieson(normXmin, normYmin, normXmax, normYmax);
275 //__________________________________________________________________________________________________
276 Double_t AliRICHParam::Mathieson(Double_t xMin,Double_t yMin,Double_t xMax,Double_t yMax)
278 // All arguments are parametrised according to NIM A370(1988)602-603
279 // Returns a charge fraction.
280 const Double_t kSqrtKx3=0.77459667;const Double_t kX2=0.962;const Double_t kX4=0.379;
281 const Double_t kSqrtKy3=0.77459667;const Double_t kY2=0.962;const Double_t kY4=0.379;
283 Double_t ux1=kSqrtKx3*TMath::TanH(kX2*xMin);
284 Double_t ux2=kSqrtKx3*TMath::TanH(kX2*xMax);
285 Double_t uy1=kSqrtKy3*TMath::TanH(kY2*yMin);
286 Double_t uy2=kSqrtKy3*TMath::TanH(kY2*yMax);
287 return 4*kX4*(TMath::ATan(ux2)-TMath::ATan(ux1))*kY4*(TMath::ATan(uy2)-TMath::ATan(uy1));
289 //__________________________________________________________________________________________________
290 TVector AliRICHParam::Loc2Area(TVector2 x2)
292 // Calculates the area of disintegration for a given point. It's assumed here that this points lays on anode wire.
293 // Area is a rectangulare set of pads defined by its left-down and right-up coners.
295 TVector pad=Loc2Pad(x2);
296 area[0]=area[2]=pad[0]; area[1]=area[3]=pad[1];//area is just a pad fired
297 if(pad[0]!=1 && pad[0]!= NpadsXsec()+1 ) area[0]--; //left down coner X
298 if(pad[1]!=1 && pad[1]!= NpadsYsec()+1 && pad[1]!= 2*NpadsYsec()+1) area[1]--; //left down coner Y
299 if(pad[0]!=NpadsXsec() && pad[0]!= NpadsX() ) area[2]++; //right up coner X
300 if(pad[1]!=NpadsYsec() && pad[1]!= 2*NpadsYsec() && pad[1]!= NpadsY() ) area[3]++; //right up coner Y
303 //__________________________________________________________________________________________________
304 Bool_t AliRICHParam::IsOverTh(Int_t ,TVector ,Double_t q)
306 // Checks if the current q is over threshold and FEE will save this value to data concentrator.
307 return (q>NsigmaTh()*(SigmaThMean()+(1.-2*gRandom->Rndm())*SigmaThSpread()));
309 //__________________________________________________________________________________________________
310 void AliRICHParam::PropogateHelix(TVector3 x0,TVector3 p0,Double_t s,TVector3 *x,TVector3 *p)
312 // Propogates the helix given by (x0,p0) in MRS to the position of interest defined by helix length s
313 const Double_t c = 0.00299792458;
314 const Double_t Bz = 0.5; //field in Tesla
315 const Double_t q = 1; //charge in electron units
316 Double_t a = -c*Bz*q;
318 Double_t rho = a/p0.Mag();
319 p->SetX(p0.X()*TMath::Cos(rho*s)-p0.Y()*TMath::Sin(rho*s));
320 p->SetY(p0.Y()*TMath::Cos(rho*s)+p0.X()*TMath::Sin(rho*s));
322 x->SetX(x0.X()+p0.X()*TMath::Sin(rho*s)/a-p0.Y()*(1-TMath::Cos(rho*s))/a);
323 x->SetY(x0.Y()+p0.Y()*TMath::Sin(rho*s)/a+p0.X()*(1-TMath::Cos(rho*s))/a);
324 x->SetZ(x0.Z()+p0.Z()*s/p->Mag());
326 #endif //AliRICHParam_h