]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHParam.cxx
Minor corrections to include
[u/mrichter/AliRoot.git] / RICH / AliRICHParam.cxx
CommitLineData
56148d0e 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16#include <Riostream.h>
c2c6679b 17#include <TMath.h>
18#include <TRandom.h>
56148d0e 19
20#include "AliRICHParam.h"
21
d48cca74 22ClassImp(AliRICHParam)
23
d48cca74 24// RICH main parameters manipulator
c2c6679b 25//__________________________________________________________________________________________________
a277aaca 26AliRICHParam::AliRICHParam():
c60862bf 27fCurrentPadX(0),fCurrentPadY(0),fCurrentWire(0),
a277aaca 28fSizeZ(0),
c60862bf 29fAngleRot(0),fAngleYZ(0),fAngleXY(0),
a277aaca 30fOffset(0),
31fGapThickness(0),
32fProximityGapThickness(0),
33fQuartzLength(0),
34fQuartzWidth(0),
35fQuartzThickness(0),
36fOuterFreonLength(0),
37fOuterFreonWidth(0),
38fInnerFreonLength(0),
39fInnerFreonWidth(0),
40fFreonThickness(0),
41fRadiatorToPads(0),
a277aaca 42fChargeSlope(0),
43fChargeSpreadX(0),
44fChargeSpreadY(0),
45fSigmaIntegration(0),
46fAlphaFeedback(0),
47fEIonisation(0),
48fMaxAdc(0),
a277aaca 49fWireSag(0),
50fVoltage(0)
d48cca74 51{//defines the default parameters
a277aaca 52 Size (132.6*kcm,26*kcm,136.7*kcm); //full length, not GEANT half notation
e62e4625 53 AngleRot (-60); //rotation of the whole RICH around Z, deg
54 Angles (20,19.5); //XY angle, YZ angle deg
55 Offset (490*kcm+1.267*kcm); //1.267???????cm distance from IP to the center of module
a277aaca 56 GapThickness (8*kcm);
57 ProximityGapThickness(0.4*kcm);
58 QuartzLength (133*kcm);
59 QuartzWidth (127.9*kcm);
60 QuartzThickness (0.5*kcm);
61 OuterFreonLength (133*kcm);
62 OuterFreonWidth (41.3*kcm);
63 InnerFreonLength (133*kcm);
64 InnerFreonWidth (41.3*kcm);
65 FreonThickness (1.5*kcm);
66 RadiatorToPads (80*kmm);
d48cca74 67
d48cca74 68 ChargeSlope(27.);
69 ChargeSpreadX(0.18);ChargeSpreadY(0.18);
853634d3 70 SigmaIntegration(5.);
d48cca74 71 MaxAdc(4096);
72 AlphaFeedback(0.036);
73 EIonisation(26.e-9);
d48cca74 74 WireSag(1); // 1->On, 0->Off
75 Voltage(2150); // Should only be 2000, 2050, 2100 or 2150
d48cca74 76}//AliRICHParam::named ctor
c2c6679b 77//__________________________________________________________________________________________________
6ce834b4 78Int_t AliRICHParam::Local2Sector(Float_t &x, Float_t &y)
c60862bf 79{//Determines sector for a given hit (x,y) and trasform this point to the local system of that sector.
c2c6679b 80 Int_t sector=kBad;
543d5224 81 Float_t x1=-0.5*PcSizeX(); Float_t x2=-0.5*SectorSizeX()-DeadZone(); Float_t x3=-0.5*SectorSizeX();
82 Float_t x4= 0.5*SectorSizeX(); Float_t x5= 0.5*SectorSizeX()+DeadZone(); Float_t x6= 0.5*PcSizeX();
83
84 if (x>=x1&&x<=x2) {sector=1;x+=0.5*PcSizeX();}
85 else if(x>=x3&&x<=x4) {sector=2;x+=0.5*SectorSizeX();}
86 else if(x>=x5&&x<=x6) {sector=3;x-=0.5*SectorSizeX()+DeadZone();}
6ce834b4 87 else if(x< x1||x> x6) {return kBad;}
543d5224 88 else {return kBad;} //in dead zone
c60862bf 89
543d5224 90 if (y>=-0.5*PcSizeY() &&y<=-0.5*DeadZone()) {y+=0.5*PcSizeY(); return -sector;}
91 else if(y> -0.5*DeadZone() &&y< 0.5*DeadZone()) {return kBad;} //in dead zone
92 else if(y>= 0.5*DeadZone() &&y<= 0.5*PcSizeY()) {y-=0.5*DeadZone(); return sector;}
6ce834b4 93 else {return kBad;}
543d5224 94}//Int_t AliRICHParam::Local2Sector(Float_t x, Float_t y)
c2c6679b 95//__________________________________________________________________________________________________
6ce834b4 96Int_t AliRICHParam::Pad2Sector(Int_t &padx, Int_t &pady)
543d5224 97{//Determines sector for a given pad (padx,pady) and trasform this point to the local system of that sector.
98 Int_t sector=kBad;
99 if (padx>=1 &&padx<=NpadsXsec()) {sector=1;}
100 else if(padx> NpadsXsec() &&padx<=NpadsXsec()*2) {sector=2;padx-=NpadsXsec();}
101 else if(padx> NpadsXsec()*2&&padx<=NpadsX()) {sector=3;padx-=NpadsXsec()*2;}
6ce834b4 102 else {return kBad;}
543d5224 103
104 if (pady>=1 &&pady<= NpadsYsec()) {return -sector;}
105 else if(pady>NpadsYsec()&&pady<= NpadsY()) {pady-=NpadsYsec();return sector;}
6ce834b4 106 else {return kBad;}
543d5224 107}//Local2Sector()
108//__________________________________________________________________________________________________
6ce834b4 109Int_t AliRICHParam::Local2Pad(Float_t x, Float_t y, Int_t &padx, Int_t &pady)
c60862bf 110{//returns pad numbers (iPadX,iPadY) for given point in local coordinates (x,y)
111 //count starts in lower left corner from 1,1 to 144,180
112
113 padx=pady=kBad;
543d5224 114 Int_t sector=Local2Sector(x,y);
c60862bf 115 if(sector==kBad) return sector;
116
543d5224 117 padx=Int_t(x/PadSizeX())+1;
118 if(padx>NpadsXsec()) padx= NpadsXsec();
119 if(sector==2||sector==-2) padx+=NpadsXsec();
120 else if(sector==3||sector==-3) padx+=NpadsXsec()*2;
c60862bf 121
543d5224 122 pady=Int_t(y/PadSizeY())+1;
123 if(pady>NpadsYsec()) padx= NpadsYsec();
124 if(sector>0) pady+=NpadsYsec();
c2c6679b 125
c2c6679b 126 return sector;
543d5224 127}//Local2Pad()
128//__________________________________________________________________________________________________
129void AliRICHParam::Pad2Local(Int_t padx,Int_t pady,Float_t &x,Float_t &y)
130{
131 Int_t sector=Pad2Sector(padx,pady);
132 if(sector>0)
133 y=0.5*DeadZone()+pady*PadSizeY()-0.5*PadSizeY();
134 else{
135 sector=-sector;
136 y=-0.5*PcSizeY()+pady*PadSizeY()-0.5*PadSizeY();
137 }
138 if(sector==1)
139 x=-0.5*PcSizeX()+padx*PadSizeX()-0.5*PadSizeX();
140 else if(sector==2)
141 x=-0.5*SectorSizeX()+padx*PadSizeX()-0.5*PadSizeX();
142 else
143 x= 0.5*SectorSizeX()+DeadZone()+padx*PadSizeX()-0.5*PadSizeX();
144 return;
145}//Pad2Local()
c2c6679b 146//__________________________________________________________________________________________________
147Float_t AliRICHParam::Gain(Float_t y)
148{//Calculates the gain
149 if(fWireSag){
150 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;
151 Float_t gain = (ChargeSlope()+ChargeSlope()*gainK/100)*0.9;
152 return -gain*TMath::Log(gRandom->Rndm());
153 }else
154 return -ChargeSlope()*TMath::Log(gRandom->Rndm());
155}//Float_t AliRICHParam::IntPH(Float_t yhit)
156//__________________________________________________________________________________________________
157Float_t AliRICHParam::TotalCharge(Int_t iPID,Float_t eloss,Float_t y)
158{//Get number of electrons and return charge
159
c60862bf 160 if(iPID>50000)//it's photon no more then 1 electron after photoelectron conversion
c2c6679b 161 return Gain(y);
162 else{
163 Int_t iNelectrons=Int_t(eloss/fEIonisation);if(iNelectrons==0) iNelectrons=1;
164 Float_t charge=0;
165 for(Int_t i=1;i<=iNelectrons;i++)
c60862bf 166 charge+=Gain(y);
c2c6679b 167 return charge;
168 }
169}//Float_t AliRICHParam::TotalCharge(Int_t iPID,Float_t eloss, Float_t y)
170//__________________________________________________________________________________________________
c60862bf 171void AliRICHParam::FirstPad(Float_t x,Float_t y)
172{
173 Int_t padx,pady;
543d5224 174 Local2Pad(x,y,padx,pady);
c60862bf 175}//void AliRICHParam::FirstPad(Float_t x,Float_t y)
6ce834b4 176//__________________________________________________________________________________________________
177Float_t AliRICHParam::AssignChargeToPad(Float_t hitx,Float_t hity,Int_t padx,Int_t pady)
178{//
179 Float_t padXcenter=0,padYcenter=0;
180 Pad2Local(padx,pady,padXcenter,padYcenter);
181
182 Float_t xi1=hitx-padXcenter-PadSizeX()/2;
183 Float_t xi2=hitx-padXcenter+PadSizeX()/2;
184 Float_t yi1=hity-padYcenter-PadSizeY()/2;
185 Float_t yi2=hity-padYcenter+PadSizeY()/2;
186 xi1/=AnodeCathodeGap();
187 xi2/=AnodeCathodeGap();
188 yi1/=AnodeCathodeGap();
189 yi2/=AnodeCathodeGap();
190// The Mathieson function
191 Double_t ux1=SqrtKx3()*TMath::TanH(Kx2()*xi1);
192 Double_t ux2=SqrtKx3()*TMath::TanH(Kx2()*xi2);
193 Double_t uy1=SqrtKy3()*TMath::TanH(Ky2()*yi1);
194 Double_t uy2=SqrtKy3()*TMath::TanH(Ky2()*yi2);
195 return 4.*Kx4()*(TMath::ATan(ux2)-TMath::ATan(ux1))*Ky4()*(TMath::ATan(uy2)-TMath::ATan(uy1));
196}//AssignChargeToPad()
197//__________________________________________________________________________________________________