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