d48cca74 |
1 | #ifndef AliRICHParam_h |
2 | #define AliRICHParam_h |
3 | |
d48cca74 |
4 | #include "AliRICHConst.h" |
c712cb2f |
5 | #include <TObject.h> |
6 | #include <TMath.h> |
7 | #include <TVector3.h> |
8 | #include <TRandom.h> |
9e23b054 |
9 | |
d48cca74 |
10 | class AliRICHParam :public TObject |
11 | { |
12 | public: |
c712cb2f |
13 | AliRICHParam() {;} |
853634d3 |
14 | virtual ~AliRICHParam() {;} |
c712cb2f |
15 | static Int_t NpadsX() {return 144;} |
16 | static Int_t NpadsY() {return 160;} |
17 | static Int_t NpadsXsec() {return NpadsX()/3;} |
18 | static Int_t NpadsYsec() {return NpadsY()/2;} |
19 | static Double_t DeadZone() {return 2.6;} |
20 | static Double_t PadSizeX() {return 0.84;} |
21 | static Double_t PadSizeY() {return 0.8;} |
22 | static Double_t SectorSizeX() {return NpadsX()*PadSizeX()/3;} |
23 | static Double_t SectorSizeY() {return NpadsY()*PadSizeY()/2;} |
24 | static Double_t PcSizeX() {return NpadsX()*PadSizeX()+2*DeadZone();} |
25 | static Double_t PcSizeY() {return NpadsY()*PadSizeY()+DeadZone();} |
26 | static Double_t WirePitch() {return PadSizeX()/2;} |
27 | static Double_t SizeX() {return 132.6;} |
28 | static Double_t SizeY() {return 26;} |
29 | static Double_t SizeZ() {return 136.7;} |
30 | static Double_t Offset() {return 490+1.267;} |
31 | static Double_t AngleYZ() {return 19.5*TMath::DegToRad();} |
32 | static Double_t AngleXY() {return 20*TMath::DegToRad();} |
33 | static Double_t FreonThickness() {return 1.5;} |
34 | static Double_t QuartzThickness() {return 0.5;} |
35 | static Double_t GapThickness() {return 8.0;} |
36 | static Double_t RadiatorToPads() {return FreonThickness()+QuartzThickness()+GapThickness();} |
37 | static Double_t ProximityGapThickness() {return 0.4;} |
38 | static Double_t AnodeCathodeGap() {return 0.2;} |
39 | static Double_t QuartzLength() {return 133;} |
40 | static Double_t QuartzWidth() {return 127.9;} |
41 | static Double_t OuterFreonLength() {return 133;} |
42 | static Double_t OuterFreonWidth() {return 41.3;} |
43 | static Double_t InnerFreonLength() {return 133;} |
44 | static Double_t InnerFreonWidth() {return 41.3;} |
45 | static Double_t IonisationPotential() {return 26.0e-9;} |
46 | static Double_t MathiensonDeltaX() {return 5*0.18;} |
47 | static Double_t MathiensonDeltaY() {return 5*0.18;} |
48 | static Int_t MaxQdc() {return 4095;} |
49 | static Double_t QdcSlope(Int_t sec) {HV(sec);return 27;} |
50 | static Double_t AlphaFeedback(Int_t sec) {HV(sec);return 0.036;} |
853634d3 |
51 | |
c712cb2f |
52 | static Bool_t IsWireSag() {return fgIsWireSag;} |
53 | static Int_t HV(Int_t) {return fgHV;} |
54 | static Double_t AngleRot() {return fgAngleRot*TMath::DegToRad();} |
55 | static void SetWireSag(Bool_t status) {fgIsWireSag=status;} |
56 | static void SetHV(Int_t hv) {fgHV =hv;} |
57 | static void SetAngleRot(Double_t rot) {fgAngleRot =rot;} |
58 | |
59 | inline static Double_t Mathienson(Double_t lx1,Double_t lx2,Double_t ly1,Double_t ly2); |
60 | inline static void Loc2Area(TVector3 hitX3,Int_t &padxMin,Int_t &padyMin,Int_t &padxMax,Int_t &padyMax); |
61 | inline static Int_t PadNeighbours(Int_t iPadX,Int_t iPadY,Int_t aListX[4],Int_t aListY[4]); |
62 | inline static Int_t Loc2Pad(Double_t x,Double_t y,Int_t &padx,Int_t &pady); |
63 | inline static void Pad2Loc(Int_t padx,Int_t pady,Double_t &x,Double_t &y); |
64 | inline static Double_t GainVariation(Double_t y,Int_t sector); |
65 | inline static Int_t Loc2TotQdc(TVector3 locX3,Double_t eloss,Int_t iPid, Int_t §or); |
66 | inline static Double_t Loc2PadFrac(TVector3 locX3,Int_t padx,Int_t pady); |
543d5224 |
67 | |
6a005d35 |
68 | void SigGenInit(Double_t,Double_t){;} |
69 | Bool_t SigGenCond(Double_t,Double_t){return kFALSE;} |
c712cb2f |
70 | inline static Int_t Loc2Sec(Double_t &x,Double_t &y); |
71 | inline static Int_t Pad2Sec(Int_t &padx,Int_t &pady); |
cbaf35fb |
72 | inline static Bool_t IsResolveClusters() {return kTRUE;} |
d48cca74 |
73 | protected: |
c712cb2f |
74 | static Bool_t fgIsWireSag; //is wire sagitta taken into account |
75 | static Int_t fgHV; //HV applied to anod wires |
76 | static Double_t fgAngleRot; //rotation of RICH from up postion (0,0,490)cm |
d48cca74 |
77 | |
c712cb2f |
78 | ClassDef(AliRICHParam,4) //RICH main parameters |
d48cca74 |
79 | }; |
c2c6679b |
80 | //__________________________________________________________________________________________________ |
c712cb2f |
81 | Int_t AliRICHParam::PadNeighbours(Int_t iPadX,Int_t iPadY,Int_t listX[4],Int_t listY[4]) |
82 | { |
83 | Int_t nPads=0; |
84 | if(iPadY<NpadsY()){listX[nPads]=iPadX; listY[nPads]=iPadY+1; nPads++;} |
85 | if(iPadX<NpadsX()){listX[nPads]=iPadX+1; listY[nPads]=iPadY; nPads++;} |
86 | if(iPadY>1) {listX[nPads]=iPadX; listY[nPads]=iPadY-1; nPads++;} |
87 | if(iPadX>1) {listX[nPads]=iPadX-1; listY[nPads]=iPadY; nPads++;} |
88 | return nPads; |
89 | }//Pad2ClosePads() |
90 | //__________________________________________________________________________________________________ |
91 | Int_t AliRICHParam::Loc2Sec(Double_t &x,Double_t &y) |
92 | {//Determines sector for a given hit (x,y) and trasform this point to the local system of that sector. |
93 | Int_t sector=kBad; |
6a005d35 |
94 | Double_t x1=-PcSizeX()/2; Double_t x2=-SectorSizeX()/2-DeadZone(); Double_t x3=-SectorSizeX()/2; |
95 | Double_t x4= SectorSizeX()/2; Double_t x5= SectorSizeX()/2+DeadZone(); Double_t x6= PcSizeX()/2; |
c712cb2f |
96 | |
6a005d35 |
97 | if (x>=x1&&x<=x2) {sector=1;x+=PcSizeX()/2;} |
98 | else if(x>=x3&&x<=x4) {sector=2;x+=SectorSizeX()/2;} |
99 | else if(x>=x5&&x<=x6) {sector=3;x-=SectorSizeX()/2+DeadZone();} |
100 | else {return kBad;} //in dead zone |
c712cb2f |
101 | |
c1863e3c |
102 | if (y>=-PcSizeY()/2 &&y<=-DeadZone()/2) {y+=PcSizeY()/2; return sector;} |
6a005d35 |
103 | else if(y> -DeadZone()/2 &&y< DeadZone()/2) {return kBad;} //in dead zone |
c1863e3c |
104 | else if(y>= DeadZone()/2 &&y<= PcSizeY()/2) {y-=DeadZone()/2; return sector+3;} |
6a005d35 |
105 | else {return kBad;} |
c712cb2f |
106 | }//Loc2Sec(Double_t x, Double_t y) |
c2c6679b |
107 | //__________________________________________________________________________________________________ |
c712cb2f |
108 | Int_t AliRICHParam::Pad2Sec(Int_t &padx, Int_t &pady) |
109 | {//Determines sector for a given pad (padx,pady) and trasform this point to the local system of that sector. |
110 | Int_t sector=kBad; |
111 | if (padx>=1 &&padx<=NpadsXsec()) {sector=1;} |
112 | else if(padx> NpadsXsec() &&padx<=NpadsXsec()*2) {sector=2;padx-=NpadsXsec();} |
113 | else if(padx> NpadsXsec()*2&&padx<=NpadsX()) {sector=3;padx-=NpadsXsec()*2;} |
114 | else {return kBad;} |
115 | |
c1863e3c |
116 | if (pady>=1 &&pady<= NpadsYsec()) {return sector;} |
117 | else if(pady>NpadsYsec()&&pady<= NpadsY()) {pady-=NpadsYsec();return sector+3;} |
c712cb2f |
118 | else {return kBad;} |
119 | }//Pad2Sec() |
120 | //__________________________________________________________________________________________________ |
121 | Int_t AliRICHParam::Loc2Pad(Double_t x, Double_t y, Int_t &padx, Int_t &pady) |
122 | {//returns pad numbers (iPadX,iPadY) for given point in local coordinates (x,y) |
123 | //count starts in lower left corner from 1,1 to 144,180 |
124 | |
125 | padx=pady=kBad; |
126 | Int_t sector=Loc2Sec(x,y); |
127 | if(sector==kBad) return sector; |
128 | |
129 | padx=Int_t(x/PadSizeX())+1; |
130 | if(padx>NpadsXsec()) padx= NpadsXsec(); |
c1863e3c |
131 | if(sector==2||sector==5) padx+=NpadsXsec(); |
132 | else if(sector==3||sector==6) padx+=NpadsXsec()*2; |
c712cb2f |
133 | |
134 | pady=Int_t(y/PadSizeY())+1; |
135 | if(pady>NpadsYsec()) padx= NpadsYsec(); |
136 | if(sector>0) pady+=NpadsYsec(); |
137 | |
138 | return sector; |
139 | }//Loc2Pad() |
140 | //__________________________________________________________________________________________________ |
141 | void AliRICHParam::Pad2Loc(Int_t padx,Int_t pady,Double_t &x,Double_t &y) |
142 | { |
143 | Int_t sector=Pad2Sec(padx,pady); |
c1863e3c |
144 | if(sector>3) |
c712cb2f |
145 | y=0.5*DeadZone()+pady*PadSizeY()-0.5*PadSizeY(); |
146 | else{ |
c712cb2f |
147 | y=-0.5*PcSizeY()+pady*PadSizeY()-0.5*PadSizeY(); |
148 | } |
c1863e3c |
149 | if(sector==1||sector==4) |
c712cb2f |
150 | x=-0.5*PcSizeX()+padx*PadSizeX()-0.5*PadSizeX(); |
c1863e3c |
151 | else if(sector==2||sector==5) |
c712cb2f |
152 | x=-0.5*SectorSizeX()+padx*PadSizeX()-0.5*PadSizeX(); |
c2c6679b |
153 | else |
c712cb2f |
154 | x= 0.5*SectorSizeX()+DeadZone()+padx*PadSizeX()-0.5*PadSizeX(); |
155 | return; |
156 | }//Pad2Loc() |
c60862bf |
157 | //__________________________________________________________________________________________________ |
c712cb2f |
158 | Double_t AliRICHParam::GainVariation(Double_t y,Int_t sector) |
c60862bf |
159 | { |
c712cb2f |
160 | if(IsWireSag()){ |
161 | if(y>0) y-=SectorSizeY()/2; else y+=SectorSizeY()/2; |
162 | switch(HV(sector)){ |
163 | case 2150: |
164 | default: |
165 | return 9e-6*TMath::Power(y,4)+2e-7*TMath::Power(y,3)-0.0316*TMath::Power(y,2)-3e-4*y+25.367;//% |
166 | } |
167 | }else |
168 | return 0; |
169 | } |
170 | //__________________________________________________________________________________________________ |
171 | Int_t AliRICHParam::Loc2TotQdc(TVector3 x3,Double_t eloss,Int_t iPid,Int_t §or) |
172 | {//calculates the total charge produced by the hit given in local refenrence system |
173 | Double_t x=x3.X(),y=x3.Y(); |
174 | |
175 | sector=Loc2Sec(x,y); |
176 | |
177 | Double_t gain=QdcSlope(sector)*(1+GainVariation(x3.Y(),sector)/100); |
178 | |
179 | |
180 | if(iPid>50000){//it's photon => 1 electron |
181 | return Int_t(gain*-TMath::Log(gRandom->Rndm())); |
182 | }else{//it's MIP |
183 | Int_t iNelectrons=Int_t(eloss/IonisationPotential()); |
184 | if(iNelectrons==0) return 0; |
185 | Double_t qdc=0; |
186 | for(Int_t i=1;i<=iNelectrons;i++) qdc+=gain*-TMath::Log(gRandom->Rndm()); |
187 | return Int_t(qdc); |
188 | } |
543d5224 |
189 | } |
c2c6679b |
190 | //__________________________________________________________________________________________________ |
c712cb2f |
191 | Double_t AliRICHParam::Loc2PadFrac(TVector3 hitX3,Int_t padx,Int_t pady) |
192 | {// |
193 | Double_t padXcenter=0,padYcenter=0; Pad2Loc(padx,pady,padXcenter,padYcenter); |
194 | |
195 | //correction to the position of the nearest wire |
196 | |
197 | Double_t normXmin=(hitX3.X()-padXcenter-PadSizeX()/2) /AnodeCathodeGap(); |
198 | Double_t normXmax=(hitX3.X()-padXcenter+PadSizeX()/2) /AnodeCathodeGap(); |
199 | Double_t normYmin=(hitX3.Y()-padYcenter-PadSizeY()/2) /AnodeCathodeGap(); |
200 | Double_t normYmax=(hitX3.Y()-padYcenter+PadSizeY()/2) /AnodeCathodeGap(); |
201 | |
202 | return Mathienson(normXmin,normYmin,normXmax,normYmax); |
203 | }//Loc2PadQdc() |
204 | //__________________________________________________________________________________________________ |
205 | Double_t AliRICHParam::Mathienson(Double_t xMin,Double_t yMin,Double_t xMax,Double_t yMax) |
206 | {//see NIM A370(1988)602-603 |
207 | const Double_t SqrtKx3=0.77459667;const Double_t Kx2=0.962;const Double_t Kx4=0.379; |
208 | const Double_t SqrtKy3=0.77459667;const Double_t Ky2=0.962;const Double_t Ky4=0.379; |
209 | |
210 | Double_t ux1=SqrtKx3*TMath::TanH(Kx2*xMin); |
211 | Double_t ux2=SqrtKx3*TMath::TanH(Kx2*xMax); |
212 | Double_t uy1=SqrtKy3*TMath::TanH(Ky2*yMin); |
213 | Double_t uy2=SqrtKy3*TMath::TanH(Ky2*yMax); |
214 | return 4*Kx4*(TMath::ATan(ux2)-TMath::ATan(ux1))*Ky4*(TMath::ATan(uy2)-TMath::ATan(uy1)); |
215 | } |
216 | //__________________________________________________________________________________________________ |
217 | void AliRICHParam::Loc2Area(TVector3 hitX3,Int_t &iPadXmin,Int_t &iPadYmin,Int_t &iPadXmax,Int_t &iPadYmax) |
218 | {//calculates the area of disintegration for a given hit. Area is a rectangulare set pf pads |
219 | //defined by its left-down and right-up coners |
220 | // hitX3.SetX(Shift2NearestWire(hitX3.X()); |
6a005d35 |
221 | Loc2Pad(hitX3.X()-MathiensonDeltaX(),hitX3.Y()-MathiensonDeltaY(),iPadXmin,iPadYmin); |
222 | Loc2Pad(hitX3.X()+MathiensonDeltaX(),hitX3.Y()+MathiensonDeltaY(),iPadXmax,iPadYmax); |
c712cb2f |
223 | }// |
d48cca74 |
224 | #endif //AliRICHParam_h |