d48cca74 |
1 | #include "AliRICHParam.h" |
c2c6679b |
2 | #include <TMath.h> |
3 | #include <TRandom.h> |
d48cca74 |
4 | |
5 | ClassImp(AliRICHParam) |
6 | |
d48cca74 |
7 | // RICH main parameters manipulator |
c2c6679b |
8 | //__________________________________________________________________________________________________ |
a277aaca |
9 | AliRICHParam::AliRICHParam(): |
a277aaca |
10 | fDeadZone(0), |
c60862bf |
11 | fPadSizeX(0),fPadSizeY(0), |
c60862bf |
12 | fCurrentPadX(0),fCurrentPadY(0),fCurrentWire(0), |
a277aaca |
13 | fSizeZ(0), |
c60862bf |
14 | fAngleRot(0),fAngleYZ(0),fAngleXY(0), |
a277aaca |
15 | fOffset(0), |
16 | fGapThickness(0), |
17 | fProximityGapThickness(0), |
18 | fQuartzLength(0), |
19 | fQuartzWidth(0), |
20 | fQuartzThickness(0), |
21 | fOuterFreonLength(0), |
22 | fOuterFreonWidth(0), |
23 | fInnerFreonLength(0), |
24 | fInnerFreonWidth(0), |
25 | fFreonThickness(0), |
26 | fRadiatorToPads(0), |
a277aaca |
27 | fChargeSlope(0), |
28 | fChargeSpreadX(0), |
29 | fChargeSpreadY(0), |
30 | fSigmaIntegration(0), |
31 | fAlphaFeedback(0), |
32 | fEIonisation(0), |
33 | fMaxAdc(0), |
34 | fSqrtKx3(0), |
35 | fKx2(0), |
36 | fKx4(0), |
37 | fSqrtKy3(0), |
38 | fKy2(0), |
39 | fKy4(0), |
40 | fPitch(0), |
41 | fWireSag(0), |
42 | fVoltage(0) |
d48cca74 |
43 | {//defines the default parameters |
543d5224 |
44 | DeadZone (3); //spacer between PC planes |
45 | PadSize (0.84,0.80); |
46 | |
a277aaca |
47 | Size (132.6*kcm,26*kcm,136.7*kcm); //full length, not GEANT half notation |
e62e4625 |
48 | AngleRot (-60); //rotation of the whole RICH around Z, deg |
49 | Angles (20,19.5); //XY angle, YZ angle deg |
50 | Offset (490*kcm+1.267*kcm); //1.267???????cm distance from IP to the center of module |
a277aaca |
51 | GapThickness (8*kcm); |
52 | ProximityGapThickness(0.4*kcm); |
53 | QuartzLength (133*kcm); |
54 | QuartzWidth (127.9*kcm); |
55 | QuartzThickness (0.5*kcm); |
56 | OuterFreonLength (133*kcm); |
57 | OuterFreonWidth (41.3*kcm); |
58 | InnerFreonLength (133*kcm); |
59 | InnerFreonWidth (41.3*kcm); |
60 | FreonThickness (1.5*kcm); |
61 | RadiatorToPads (80*kmm); |
d48cca74 |
62 | |
d48cca74 |
63 | ChargeSlope(27.); |
64 | ChargeSpreadX(0.18);ChargeSpreadY(0.18); |
853634d3 |
65 | SigmaIntegration(5.); |
d48cca74 |
66 | MaxAdc(4096); |
67 | AlphaFeedback(0.036); |
68 | EIonisation(26.e-9); |
69 | SqrtKx3(0.77459667); |
70 | Kx2(0.962); |
71 | Kx4(0.379); |
72 | SqrtKy3(0.77459667); |
73 | Ky2(0.962); |
74 | Ky4(0.379); |
75 | Pitch(0.25); |
76 | WireSag(1); // 1->On, 0->Off |
77 | Voltage(2150); // Should only be 2000, 2050, 2100 or 2150 |
d48cca74 |
78 | }//AliRICHParam::named ctor |
c2c6679b |
79 | //__________________________________________________________________________________________________ |
543d5224 |
80 | Int_t AliRICHParam::Local2Sector(Float_t &x, Float_t &y)const |
c60862bf |
81 | {//Determines sector for a given hit (x,y) and trasform this point to the local system of that sector. |
c2c6679b |
82 | Int_t sector=kBad; |
543d5224 |
83 | Float_t x1=-0.5*PcSizeX(); Float_t x2=-0.5*SectorSizeX()-DeadZone(); Float_t x3=-0.5*SectorSizeX(); |
84 | Float_t x4= 0.5*SectorSizeX(); Float_t x5= 0.5*SectorSizeX()+DeadZone(); Float_t x6= 0.5*PcSizeX(); |
85 | |
86 | if (x>=x1&&x<=x2) {sector=1;x+=0.5*PcSizeX();} |
87 | else if(x>=x3&&x<=x4) {sector=2;x+=0.5*SectorSizeX();} |
88 | else if(x>=x5&&x<=x6) {sector=3;x-=0.5*SectorSizeX()+DeadZone();} |
89 | else if(x< x1||x> x6) {Error("Sector","given x position is out of PC area");return kBad;} |
90 | else {return kBad;} //in dead zone |
c60862bf |
91 | |
543d5224 |
92 | if (y>=-0.5*PcSizeY() &&y<=-0.5*DeadZone()) {y+=0.5*PcSizeY(); return -sector;} |
93 | else if(y> -0.5*DeadZone() &&y< 0.5*DeadZone()) {return kBad;} //in dead zone |
94 | else if(y>= 0.5*DeadZone() &&y<= 0.5*PcSizeY()) {y-=0.5*DeadZone(); return sector;} |
95 | else {Error("Sector","given y position is out of PC area");return kBad;} |
96 | }//Int_t AliRICHParam::Local2Sector(Float_t x, Float_t y) |
c2c6679b |
97 | //__________________________________________________________________________________________________ |
543d5224 |
98 | Int_t AliRICHParam::Pad2Sector(Int_t &padx, Int_t &pady)const |
99 | {//Determines sector for a given pad (padx,pady) and trasform this point to the local system of that sector. |
100 | Int_t sector=kBad; |
101 | if (padx>=1 &&padx<=NpadsXsec()) {sector=1;} |
102 | else if(padx> NpadsXsec() &&padx<=NpadsXsec()*2) {sector=2;padx-=NpadsXsec();} |
103 | else if(padx> NpadsXsec()*2&&padx<=NpadsX()) {sector=3;padx-=NpadsXsec()*2;} |
104 | else {Error("Sector","given padx position is out of PC area");return kBad;} |
105 | |
106 | if (pady>=1 &&pady<= NpadsYsec()) {return -sector;} |
107 | else if(pady>NpadsYsec()&&pady<= NpadsY()) {pady-=NpadsYsec();return sector;} |
108 | else {Error("Sector","given y position is out of PC area");return kBad;} |
109 | }//Local2Sector() |
110 | //__________________________________________________________________________________________________ |
111 | Int_t AliRICHParam::Local2Pad(Float_t x, Float_t y, Int_t &padx, Int_t &pady)const |
c60862bf |
112 | {//returns pad numbers (iPadX,iPadY) for given point in local coordinates (x,y) |
113 | //count starts in lower left corner from 1,1 to 144,180 |
114 | |
115 | padx=pady=kBad; |
543d5224 |
116 | Int_t sector=Local2Sector(x,y); |
c60862bf |
117 | if(sector==kBad) return sector; |
118 | |
543d5224 |
119 | padx=Int_t(x/PadSizeX())+1; |
120 | if(padx>NpadsXsec()) padx= NpadsXsec(); |
121 | if(sector==2||sector==-2) padx+=NpadsXsec(); |
122 | else if(sector==3||sector==-3) padx+=NpadsXsec()*2; |
c60862bf |
123 | |
543d5224 |
124 | pady=Int_t(y/PadSizeY())+1; |
125 | if(pady>NpadsYsec()) padx= NpadsYsec(); |
126 | if(sector>0) pady+=NpadsYsec(); |
c2c6679b |
127 | |
c2c6679b |
128 | return sector; |
543d5224 |
129 | }//Local2Pad() |
130 | //__________________________________________________________________________________________________ |
131 | void AliRICHParam::Pad2Local(Int_t padx,Int_t pady,Float_t &x,Float_t &y) |
132 | { |
133 | Int_t sector=Pad2Sector(padx,pady); |
134 | if(sector>0) |
135 | y=0.5*DeadZone()+pady*PadSizeY()-0.5*PadSizeY(); |
136 | else{ |
137 | sector=-sector; |
138 | y=-0.5*PcSizeY()+pady*PadSizeY()-0.5*PadSizeY(); |
139 | } |
140 | if(sector==1) |
141 | x=-0.5*PcSizeX()+padx*PadSizeX()-0.5*PadSizeX(); |
142 | else if(sector==2) |
143 | x=-0.5*SectorSizeX()+padx*PadSizeX()-0.5*PadSizeX(); |
144 | else |
145 | x= 0.5*SectorSizeX()+DeadZone()+padx*PadSizeX()-0.5*PadSizeX(); |
146 | return; |
147 | }//Pad2Local() |
c2c6679b |
148 | //__________________________________________________________________________________________________ |
149 | Float_t AliRICHParam::Gain(Float_t y) |
150 | {//Calculates the gain |
151 | if(fWireSag){ |
152 | Float_t gainK=9e-6*TMath::Power(y,4)+2e-7*TMath::Power(y,3)-0.0316*TMath::Power(y,2)-3e-4*y+25.367; |
153 | Float_t gain = (ChargeSlope()+ChargeSlope()*gainK/100)*0.9; |
154 | return -gain*TMath::Log(gRandom->Rndm()); |
155 | }else |
156 | return -ChargeSlope()*TMath::Log(gRandom->Rndm()); |
157 | }//Float_t AliRICHParam::IntPH(Float_t yhit) |
158 | //__________________________________________________________________________________________________ |
159 | Float_t AliRICHParam::TotalCharge(Int_t iPID,Float_t eloss,Float_t y) |
160 | {//Get number of electrons and return charge |
161 | |
c60862bf |
162 | if(iPID>50000)//it's photon no more then 1 electron after photoelectron conversion |
c2c6679b |
163 | return Gain(y); |
164 | else{ |
165 | Int_t iNelectrons=Int_t(eloss/fEIonisation);if(iNelectrons==0) iNelectrons=1; |
166 | Float_t charge=0; |
167 | for(Int_t i=1;i<=iNelectrons;i++) |
c60862bf |
168 | charge+=Gain(y); |
c2c6679b |
169 | return charge; |
170 | } |
171 | }//Float_t AliRICHParam::TotalCharge(Int_t iPID,Float_t eloss, Float_t y) |
172 | //__________________________________________________________________________________________________ |
c60862bf |
173 | void AliRICHParam::FirstPad(Float_t x,Float_t y) |
174 | { |
175 | Int_t padx,pady; |
543d5224 |
176 | Local2Pad(x,y,padx,pady); |
c60862bf |
177 | }//void AliRICHParam::FirstPad(Float_t x,Float_t y) |