10 static const int kNCH=7; //number of RICH chambers
11 static const int kNpadsX = 144; //number of pads along X in single chamber
12 static const int kNpadsY = 160; //number of pads along Y in single chamber
13 static const int kBad=-101; //useful static const to mark initial (uninitalised) values
16 static const int kadc_satm = 4096; //dynamic range (10 bits)
17 static const int kCerenkov=50000050; //??? go to something more general like TPDGCode
18 static const int kFeedback=50000051; //??? go to something more general like TPDGCode
21 class AliRICHParam :public TObject
25 virtual ~AliRICHParam() {;}
26 static const Int_t NpadsX() {return kNpadsX;}
27 static const Int_t NpadsY() {return kNpadsY;}
28 static Int_t NpadsXsec() {return NpadsX()/3;}
29 static Int_t NpadsYsec() {return NpadsY()/2;}
30 static Double_t DeadZone() {return 2.6;}
31 static Double_t PadSizeX() {return 0.84;}
32 static Double_t PadSizeY() {return 0.8;}
33 static Double_t SectorSizeX() {return NpadsX()*PadSizeX()/3;}
34 static Double_t SectorSizeY() {return NpadsY()*PadSizeY()/2;}
35 static Double_t PcSizeX() {return NpadsX()*PadSizeX()+2*DeadZone();}
36 static Double_t PcSizeY() {return NpadsY()*PadSizeY()+DeadZone();}
37 static Double_t WirePitch() {return PadSizeX()/2;}
38 static Double_t SizeX() {return 132.6;}
39 static Double_t SizeY() {return 26;}
40 static Double_t SizeZ() {return 136.7;}
41 static Double_t Offset() {return 490+1.267;}
42 static Double_t AngleYZ() {return 19.5*TMath::DegToRad();}
43 static Double_t AngleXY() {return 20*TMath::DegToRad();}
44 static Double_t FreonThickness() {return 1.5;}
45 static Double_t QuartzThickness() {return 0.5;}
46 static Double_t GapThickness() {return 8.0;}
47 static Double_t RadiatorToPads() {return FreonThickness()+QuartzThickness()+GapThickness();}
48 static Double_t ProximityGapThickness() {return 0.4;}
49 static Double_t AnodeCathodeGap() {return 0.2;}
50 static Double_t QuartzLength() {return 133;}
51 static Double_t QuartzWidth() {return 127.9;}
52 static Double_t OuterFreonLength() {return 133;}
53 static Double_t OuterFreonWidth() {return 41.3;}
54 static Double_t InnerFreonLength() {return 133;}
55 static Double_t InnerFreonWidth() {return 41.3;}
56 static Double_t IonisationPotential() {return 26.0e-9;}
57 static Double_t MathiesonDeltaX() {return 5*0.18;}
58 static Double_t MathiesonDeltaY() {return 5*0.18;}
59 static Int_t MaxQdc() {return 4095;}
60 static Double_t QdcSlope(Int_t sec) {HV(sec);return 27;}
61 static Double_t AlphaFeedback(Int_t sec) {HV(sec);return 0.036;}
63 static Bool_t IsResolveClusters() {return fgIsResolveClusters;}
64 static Bool_t IsWireSag() {return fgIsWireSag;}
65 static Int_t HV(Int_t) {return fgHV;}
66 static Double_t AngleRot() {return fgAngleRot*TMath::DegToRad();}
67 static void SetResolveClusters(Bool_t a){fgIsResolveClusters=a;}
68 static void SetWireSag(Bool_t status) {fgIsWireSag=status;}
69 static void SetHV(Int_t hv) {fgHV =hv;}
70 static void SetAngleRot(Double_t rot) {fgAngleRot =rot;}
72 inline static Double_t Mathieson(Double_t lx1,Double_t lx2,Double_t ly1,Double_t ly2);
73 inline static void Loc2Area(TVector3 hitX3,Int_t &padxMin,Int_t &padyMin,Int_t &padxMax,Int_t &padyMax);
74 inline static Int_t PadNeighbours(Int_t iPadX,Int_t iPadY,Int_t aListX[4],Int_t aListY[4]);
75 inline static Int_t Loc2Pad(Double_t x,Double_t y,Int_t &padx,Int_t &pady);
76 inline static void Pad2Loc(Int_t padx,Int_t pady,Double_t &x,Double_t &y);
77 inline static Double_t GainVariation(Double_t y,Int_t sector);
78 inline static Int_t Loc2TotQdc(TVector3 locX3,Double_t eloss,Int_t iPid, Int_t §or);
79 inline static Double_t Loc2PadFrac(TVector3 locX3,Int_t padx,Int_t pady);
81 inline static Int_t Loc2Sec(Double_t &x,Double_t &y);
82 inline static Int_t Pad2Sec(Int_t &padx,Int_t &pady);
83 static Int_t Sector(Int_t padx,Int_t pady) {return Pad2Sec(padx,pady);}
84 inline Bool_t IsOverTh(Int_t iChamber, Int_t x, Int_t y, Double_t q);
85 static Int_t NsigmaTh() {return fgNsigmaTh;}
86 static Float_t SigmaThMean() {return fgSigmaThMean;}
87 static Float_t SigmaThSpread() {return fgSigmaThSpread;}
90 static Bool_t fgIsWireSag; //is wire sagitta taken into account
91 static Bool_t fgIsResolveClusters; //performs declustering or not
92 static Int_t fgHV; //HV applied to anod wires
93 static Double_t fgAngleRot; //rotation of RICH from up postion (0,0,490)cm
94 static Float_t fSigmaThMap[kNCH][kNpadsX][kNpadsY]; // sigma of the pedestal distributions for all pads
95 static Int_t fgNsigmaTh; // n. of sigmas to cut for zero suppression
96 static Float_t fgSigmaThMean; // sigma threshold value
97 static Float_t fgSigmaThSpread; // spread of sigma
98 ClassDef(AliRICHParam,4) //RICH main parameters
100 //__________________________________________________________________________________________________
101 Int_t AliRICHParam::PadNeighbours(Int_t iPadX,Int_t iPadY,Int_t listX[4],Int_t listY[4])
104 if(iPadY!=NpadsY()&&iPadY!=NpadsYsec()) {listX[nPads]=iPadX; listY[nPads]=iPadY+1; nPads++;}
105 if(iPadX!=NpadsXsec()&&iPadX!=2*NpadsXsec()&&iPadX!=NpadsX()){listX[nPads]=iPadX+1; listY[nPads]=iPadY; nPads++;}
106 if(iPadY!=1&&iPadY!=NpadsYsec()+1) {listX[nPads]=iPadX; listY[nPads]=iPadY-1; nPads++;}
107 if(iPadX!=1&&iPadX!=NpadsXsec()+1&&iPadX!=2*NpadsXsec()+1) {listX[nPads]=iPadX-1; listY[nPads]=iPadY; nPads++;}
111 //__________________________________________________________________________________________________
112 Int_t AliRICHParam::Loc2Sec(Double_t &x,Double_t &y)
113 {//Determines sector for a given hit (x,y) and trasform this point to the local system of that sector.
115 Double_t x1=-PcSizeX()/2; Double_t x2=-SectorSizeX()/2-DeadZone(); Double_t x3=-SectorSizeX()/2;
116 Double_t x4= SectorSizeX()/2; Double_t x5= SectorSizeX()/2+DeadZone(); Double_t x6= PcSizeX()/2;
118 if (x>=x1&&x<=x2) {sector=1;x+=PcSizeX()/2;}
119 else if(x>=x3&&x<=x4) {sector=2;x+=SectorSizeX()/2;}
120 else if(x>=x5&&x<=x6) {sector=3;x-=SectorSizeX()/2+DeadZone();}
121 else {return kBad;} //in dead zone
123 if (y>=-PcSizeY()/2 &&y<=-DeadZone()/2) {y+=PcSizeY()/2; return sector;}
124 else if(y> -DeadZone()/2 &&y< DeadZone()/2) {return kBad;} //in dead zone
125 else if(y>= DeadZone()/2 &&y<= PcSizeY()/2) {y-=DeadZone()/2; return sector+3;}
127 }//Loc2Sec(Double_t x, Double_t y)
128 //__________________________________________________________________________________________________
129 Int_t AliRICHParam::Pad2Sec(Int_t &padx, Int_t &pady)
130 {//Determines sector for a given pad (padx,pady) and trasform this point to the local system of that sector.
132 if (padx>=1 &&padx<=NpadsXsec()) {sector=1;}
133 else if(padx> NpadsXsec() &&padx<=NpadsXsec()*2) {sector=2;padx-=NpadsXsec();}
134 else if(padx> NpadsXsec()*2&&padx<=NpadsX()) {sector=3;padx-=NpadsXsec()*2;}
137 if (pady>=1 &&pady<= NpadsYsec()) {return sector;}
138 else if(pady>NpadsYsec()&&pady<= NpadsY()) {pady-=NpadsYsec();return sector+3;}
141 //__________________________________________________________________________________________________
142 Int_t AliRICHParam::Loc2Pad(Double_t x, Double_t y, Int_t &padx, Int_t &pady)
143 {//returns pad numbers (iPadX,iPadY) for given point in local coordinates (x,y)
144 //count starts in lower left corner from 1,1 to 144,180
147 Int_t sector=Loc2Sec(x,y);
148 if(sector==kBad) return sector;
150 padx=Int_t(x/PadSizeX())+1;
151 if(padx>NpadsXsec()) padx= NpadsXsec();
152 if(sector==2||sector==5) padx+=NpadsXsec();
153 else if(sector==3||sector==6) padx+=NpadsXsec()*2;
155 pady=Int_t(y/PadSizeY())+1;
156 if(pady>NpadsYsec()) padx= NpadsYsec();
157 if(sector>0) pady+=NpadsYsec();
161 //__________________________________________________________________________________________________
162 void AliRICHParam::Pad2Loc(Int_t padx,Int_t pady,Double_t &x,Double_t &y)
164 Int_t sector=Pad2Sec(padx,pady);
166 y=0.5*DeadZone()+pady*PadSizeY()-0.5*PadSizeY();
168 y=-0.5*PcSizeY()+pady*PadSizeY()-0.5*PadSizeY();
170 if(sector==1||sector==4)
171 x=-0.5*PcSizeX()+padx*PadSizeX()-0.5*PadSizeX();
172 else if(sector==2||sector==5)
173 x=-0.5*SectorSizeX()+padx*PadSizeX()-0.5*PadSizeX();
175 x= 0.5*SectorSizeX()+DeadZone()+padx*PadSizeX()-0.5*PadSizeX();
178 //__________________________________________________________________________________________________
179 Double_t AliRICHParam::GainVariation(Double_t y,Int_t sector)
181 //returns % of gain degradation due to wire sagita
183 if(y>0) y-=SectorSizeY()/2; else y+=SectorSizeY()/2;
185 case 2150: return 9e-6*TMath::Power(y,4)+2e-7*TMath::Power(y,3)-0.0316*TMath::Power(y,2)-3e-4*y+25.367;//%
186 case 2100: return 8e-6*TMath::Power(y,4)+2e-7*TMath::Power(y,3)-0.0283*TMath::Power(y,2)-2e-4*y+23.015;
187 case 2050: return 7e-6*TMath::Power(y,4)+1e-7*TMath::Power(y,3)-0.0254*TMath::Power(y,2)-2e-4*y+20.888;
188 case 2000: return 6e-6*TMath::Power(y,4)+8e-8*TMath::Power(y,3)-0.0227*TMath::Power(y,2)-1e-4*y+18.961;
194 //__________________________________________________________________________________________________
195 Int_t AliRICHParam::Loc2TotQdc(TVector3 x3,Double_t eloss,Int_t iPid,Int_t §or)
196 {//calculates the total charge produced by the hit given in local refenrence system
197 Double_t x=x3.X(),y=x3.Y();
201 Double_t gain=QdcSlope(sector)*(1+GainVariation(x3.Y(),sector)/100);
204 if(iPid>50000){//it's photon => 1 electron
205 return Int_t(gain*-TMath::Log(gRandom->Rndm()));
207 Int_t iNelectrons=Int_t(eloss/IonisationPotential());
208 if(iNelectrons==0) return 0;
210 for(Int_t i=1;i<=iNelectrons;i++) qdc+=gain*-TMath::Log(gRandom->Rndm());
214 //__________________________________________________________________________________________________
215 Double_t AliRICHParam::Loc2PadFrac(TVector3 hitX3,Int_t padx,Int_t pady)
217 Double_t padXcenter=0,padYcenter=0; Pad2Loc(padx,pady,padXcenter,padYcenter);
219 //correction to the position of the nearest wire
221 Double_t normXmin=(hitX3.X()-padXcenter-PadSizeX()/2) /AnodeCathodeGap();
222 Double_t normXmax=(hitX3.X()-padXcenter+PadSizeX()/2) /AnodeCathodeGap();
223 Double_t normYmin=(hitX3.Y()-padYcenter-PadSizeY()/2) /AnodeCathodeGap();
224 Double_t normYmax=(hitX3.Y()-padYcenter+PadSizeY()/2) /AnodeCathodeGap();
226 return Mathieson(normXmin,normYmin,normXmax,normYmax);
228 //__________________________________________________________________________________________________
229 Double_t AliRICHParam::Mathieson(Double_t xMin,Double_t yMin,Double_t xMax,Double_t yMax)
230 {//see NIM A370(1988)602-603
231 const Double_t kSqrtKx3=0.77459667;const Double_t kX2=0.962;const Double_t kX4=0.379;
232 const Double_t kSqrtKy3=0.77459667;const Double_t kY2=0.962;const Double_t kY4=0.379;
234 Double_t ux1=kSqrtKx3*TMath::TanH(kX2*xMin);
235 Double_t ux2=kSqrtKx3*TMath::TanH(kX2*xMax);
236 Double_t uy1=kSqrtKy3*TMath::TanH(kY2*yMin);
237 Double_t uy2=kSqrtKy3*TMath::TanH(kY2*yMax);
238 return 4*kX4*(TMath::ATan(ux2)-TMath::ATan(ux1))*kY4*(TMath::ATan(uy2)-TMath::ATan(uy1));
240 //__________________________________________________________________________________________________
241 void AliRICHParam::Loc2Area(TVector3 hitX3,Int_t &iPadXmin,Int_t &iPadYmin,Int_t &iPadXmax,Int_t &iPadYmax)
242 {//calculates the area of disintegration for a given hit. Area is a rectangulare set pf pads
243 //defined by its left-down and right-up coners
244 // hitX3.SetX(Shift2NearestWire(hitX3.X());
245 Loc2Pad(hitX3.X()-MathiesonDeltaX(),hitX3.Y()-MathiesonDeltaY(),iPadXmin,iPadYmin);
246 Loc2Pad(hitX3.X()+MathiesonDeltaX(),hitX3.Y()+MathiesonDeltaY(),iPadXmax,iPadYmax);
248 //__________________________________________________________________________________________________
249 Bool_t AliRICHParam::IsOverTh(Int_t iChamber, Int_t x, Int_t y, Double_t q)
250 {// Calculate the new charge subtracting pedestal and if the current digit is over threshold
251 if(q>NsigmaTh()*fSigmaThMap[iChamber-1][x-1][y-1]) return kTRUE; else return kFALSE;
253 #endif //AliRICHParam_h