]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHParam.h
Possibility to compute the distance of point from the current line. New constructor...
[u/mrichter/AliRoot.git] / RICH / AliRICHParam.h
CommitLineData
d48cca74 1#ifndef AliRICHParam_h
2#define AliRICHParam_h
3
db910db9 4#include <TNamed.h> //base class
5#include <TMath.h> //QdcTot()
6#include <TVector.h> //old style
3582c1f9 7#include <TVector2.h>
e42a7b46 8#include <TVector3.h>
84093f6f 9#include <Riostream.h> //---------to be deleted-------------
998b831f 10#include <TRandom.h>
db910db9 11#include <TClonesArray.h> //Hit2SDigs()
998b831f 12#include <AliLog.h>
db910db9 13#include <TGeoMatrix.h> //Mars2Lors() Lors2Mars()
14#include <TF1.h> //fields
15#include <TF2.h> //fields
16#include "AliRICHDigit.h" //Hit2Sdigs()
17#include <TGeoManager.h> //Instance()
998b831f 18
e42a7b46 19static const int kNchambers=7; //number of RICH chambers
20static const int kNpadsX = 160; //number of pads along X in single chamber
21static const int kNpadsY = 144; //number of pads along Y in single chamber
e42a7b46 22static const int kNsectors=6; //number of sectors per chamber
ed3ceb24 23
ed3ceb24 24static const int kCerenkov=50000050; //??? go to something more general like TPDGCode
25static const int kFeedback=50000051; //??? go to something more general like TPDGCode
26
ae754cdf 27// Class providing all the needed parametrised information
28// to construct the geometry, to define segmentation and to provide response model
29// In future will also provide all the staff needed for alignment and calibration
30
31
db910db9 32class AliRICHParam :public TNamed
d48cca74 33{
34public:
a25b3368 35//ctor&dtor
db910db9 36 virtual ~AliRICHParam() {delete fIdxC6F14;fgInstance=0;}
a25b3368 37//test methodes
c4a03891 38 void Print(Option_t *opt="") const; //print current parametrization
d3eb6079 39 static void DrawAxis();
db3aa6a3 40 static void DrawSectors(Bool_t isInfo=kFALSE); //draw sectors contour and print on top some info
a25b3368 41//flags staff
db910db9 42 static inline AliRICHParam* Instance(); //pointer to AliRICHParam singleton
db910db9 43 static Int_t Stack(Int_t evt=-1,Int_t tid=-1); //Print stack info for event and tid
44 static Int_t StackCount(Int_t pid,Int_t evt); //Counts stack particles of given sort in given event
45 static inline Double_t ErrLoc (Double_t thetaC,Double_t phiC,Double_t thetaT,Double_t phiT,Double_t beta);
46 static inline Double_t ErrGeom (Double_t thetaC,Double_t phiC,Double_t thetaT,Double_t phiT,Double_t beta);
47 static inline Double_t ErrCrom (Double_t thetaC,Double_t phiC,Double_t thetaT,Double_t phiT,Double_t beta);
cb801d41 48 static inline Double_t SigmaSinglePhotonFormula(Double_t thetaC,Double_t phiC,Double_t thetaT,Double_t phiT,Double_t beta);
a25b3368 49//Geometrical properties
db910db9 50 static Int_t NpadsX () {return kNpadsX;} //number of pads along X in chamber
51 static Int_t NpadsY () {return kNpadsY;} //number of pads along Y in chamber
52 static Int_t NpadsXsec () {return NpadsX()/2;} //number of pads along X in sector
53 static Int_t NpadsYsec () {return NpadsY()/3;} //number of pads along Y in sector
54
55 static Double_t AnodPitch () {return PadSizeY()/2;} //cm between anode wires
56 static Double_t AnodZ () {return 7.806;} //Z positon of anod plane in LORS of the chamber, [cm]
57 static Double_t CathPitch () {return PadSizeY()/4;} //dist between cathode wires [cm]
58 static Double_t CollPitch () {return 0.5;} //dist between collection wires [cm]
59 static Double_t DeadZone () {return 2.6;} //dead zone thickness [cm]
60 static Double_t PadSizeX () {return 0.8;} //pad size x [cm]
61 static Double_t PadSizeY () {return 0.84;} //pad size y [cm]
62 static Double_t PcSizeX () {return NpadsX()*PadSizeX()+DeadZone();} //PC size x [cm]
63 static Double_t PcSizeY () {return NpadsY()*PadSizeY()+2*DeadZone();} //PC size y [cm]
64 static Double_t Pc2Cath () {return 0.445;} //dist between PC entrance plane and cathode wires plane [cm]
65 static Double_t Pc2Win () {return PcZ();} //dist between PC entrance plane and window exit plane [cm]
66 static Double_t PcZ () {return 8.0; } //Z positon of PC entrance plane in LORS of the chamber [cm]
67 static Double_t RadThick () {return 1.5;} //radiator thickness [cm]
68 static Double_t RadZ () {return -2.0; } //Z positon of radiator entrance plane in LORS of the chamber [cm]
69 static Double_t SecSizeX () {return NpadsX()*PadSizeX()/2;} //sector size x [cm]
70 static Double_t SecSizeY () {return NpadsY()*PadSizeY()/3;} //sector size y [cm ]
71 static Double_t WinThick () {return 0.5;} //radiator window thickness [cm]
72
73
0422a446 74//trasformation methodes
db910db9 75 inline TVector3 Lors2Mars (Int_t c,Double_t x,Double_t y,Int_t p=kPc); //LORS->MARS transform of point [cm] for chamber c and plane p
cb801d41 76 inline TVector3 Lors2MarsVec (Int_t c,const TVector3 &p ); //LORS->MARS transform of vector for chamber c
db910db9 77 inline TVector2 Mars2Lors (Int_t c,const TVector3 &x ,Int_t p=kPc); //MARS->LORS transform of point [cm] for chamber c and plane p
cb801d41 78 inline TVector3 Mars2LorsVec (Int_t c,const TVector3 &p ); //MARS->LORS transform of vector for chamber c
db910db9 79
80 static inline TVector3 Lors2MarsOld (Int_t c,Double_t x,Double_t y,Int_t p); //LORS->MARS transform of position (cm) for chamber c and plane p
81 static inline TVector2 Mars2LorsOld (Int_t c,const TVector3 &x,Int_t p ); //MARS->LORS transform of position (cm) for chamber c and plane p
db910db9 82 static inline TVector3 Center (Int_t c,Int_t p ); //Center of plane p of chamber c in MARS (cm)
83 static inline TVector3 Norm (Int_t c ); //Norm vector to the chamber c in MARS (cm)
84 static inline TGeoMatrix*Matrix (Int_t iCh, Int_t iPlane ); //TGeoMatrix for the given chamber plain
85
0422a446 86 static Int_t Pad2Cha (Int_t pad ){return pad/100000000; }//abs pad -> chamber
87 static Int_t Pad2Sec (Int_t pad ){return pad%100000000/1000000; }//abs pad -> sector
88 static Int_t Pad2PadX (Int_t pad ){return pad%1000000/1000; }//abs pad -> pad x
89 static Int_t Pad2PadY (Int_t pad ){return pad%1000000%100; }//abs pad -> pad y
90 static Int_t PadAbs (Int_t c,Int_t s,Int_t x,Int_t y){return 100000000*c+1000000*s+1000*x+y; }//(c,s,x,y) -> abs pad
91 static inline TVector2 Pad2Loc (Int_t pad ); //abs pad ->LORS
92 static inline TVector2 Pad2Loc (TVector pad ); //pad -> LORS returns center of the pad
93 static TVector2 Pad2Loc (Int_t x,Int_t y ){TVector pad(2);pad[0]=x;pad[1]=y;return Pad2Loc(pad);}//return center of the pad (x,y)
94 static inline TVector Loc2Area (const TVector2 &x2 ); //pads area affected by hit x2. area is LeftDown-RightUp pad numbers
95 static inline Int_t Loc2Sec (const TVector2 &x2 ); //LORS -> sector
96 static Int_t Loc2Sec (Double_t x,Double_t y ){return Loc2Sec(TVector2(x,y));} //LORS -> sector
97 static inline TVector Loc2Pad (const TVector2 &x2 ); //LORS -> pad
98 static TVector Loc2Pad (Double_t x,Double_t y ){return Loc2Pad(TVector2(x,y));} //LORS -> pad
99 static inline Int_t Pad2Sec (const TVector &pad ); //pad -> sector
100 static inline Int_t PadNeighbours (Int_t iPadX,Int_t iPadY,Int_t aListX[4],Int_t aListY[4]); //pad -> list of it neighbours
101 static Bool_t IsAccepted (const TVector2 &x2 ){return ( x2.X()>=0 && x2.X()<=PcSizeX() && x2.Y()>=0 && x2.Y()<=PcSizeY() ) ? kTRUE:kFALSE;}
102//optical properties methodes
db910db9 103 static Float_t EckovMean ( ){return 6.766e-9;} //mean Ckov energy according to the total trasmission curve
cb801d41 104 static Float_t EckovMin ( ){return 5.5e-9;} //min photon energy [GeV] defined in optical curves
105 static Float_t EckovMax ( ){return 8.5e-9;} //min photon energy [GeV] defined in optical curves
db910db9 106
107 Float_t IdxC6F14 (Float_t gev ){return fIdxC6F14->Eval(gev,fIdxC6F14->GetUniqueID());} //n=f(Eckov) [GeV] for C6H14 used as radiator
cb801d41 108 static Float_t IdxSiO2 (Float_t gev ){return TMath::Sqrt(1+46.411/(10.666*10.666-gev*gev*1e18)+228.71/(18.125*18.125-gev*gev*1e18));} //n=f(Eckov) [GeV] for SiO2 used as window TDR p.35
109 static Float_t IdxCH4 (Float_t gev ){return 1+0.12489e-6/(2.62e-4 - TMath::Power(1239.84e-9/gev,-2));} //n=f(Eckov) [GeV] for CF4
110 static Float_t AbsCH4 (Float_t gev ); //abs len=f(Eckov) [GeV] for CF4
db910db9 111
112 void CdbRead (Int_t run,Int_t version ); //read all calibration information for requested run
e42a7b46 113
e42a7b46 114 static Double_t IonisationPotential() {return 26.0e-9;} //for CH4 in GeV taken from ????
115 static TVector2 MathiesonDelta() {return TVector2(5*0.18,5*0.18);} //area of 5 sigmas of Mathieson distribution (cm)
116 static Int_t MaxQdc() {return 4095;} //QDC number of channels
fab9e039 117
db910db9 118
fab9e039 119 static Int_t QthMIP() {return 100;}
120 static Double_t DmatchMIP() {return 1.;}
121 static Double_t PmodMax() {return 6.5;}
cb801d41 122 static Int_t HV(Int_t sector) {if (sector>=1 && sector <=6) return 2050; else return -1;} //high voltage for this sector
a25b3368 123//charge response methodes
124 inline static Double_t Mathieson(Double_t x1,Double_t x2,Double_t y1,Double_t y2); //Mathienson integral over given limits
db910db9 125
e42a7b46 126 inline static Double_t GainSag(Double_t x,Int_t sector); //gain variations in %
cb801d41 127 static Double_t Gain(const TVector2 &x2,Bool_t isSag=kTRUE){//gives chamber gain in terms of QDC channels for given point in local ref system
128 if(isSag) return QdcSlope(Loc2Sec(x2))*(1+GainSag(x2.X(),Loc2Sec(x2))/100);
129 else return QdcSlope(Loc2Sec(x2));}
a25b3368 130 inline static Double_t FracQdc(const TVector2 &x2,const TVector &pad); //charge fraction to pad from hit
db910db9 131 inline static Int_t TotQdc(TVector2 x2,Double_t e ); //total charge for Eloss (GeV) 0 for photons
132 static Double_t QdcSlope(Int_t sec){switch(sec){case -1: return 0; default: return 33;}} //weight of electon in QDC channels
133
134 static inline Int_t Lors2Pad (Double_t x,Double_t y ); //LORS (x,y) [cm] -> abs pad number
135 static Double_t IonPot ( ){return 26.0e-9;} //for CH4 in GeV taken from ????
136 static inline Int_t QdcTot (Int_t iPad,Double_t e ); //total QDC generated by Eloss or Etot [GeV]
137 static inline Double_t QdcSag (Int_t iPad ); //mean QDC variation due to sagita [0,1]
cb801d41 138 static Double_t QdcEle (Int_t iPad,Bool_t isSag=kTRUE ){return isSag?33*(1+QdcSag(iPad)):33;} //mean QDC per electron
db910db9 139 static inline Int_t Hit2SDigs (Int_t iPad, Double_t e,TClonesArray* pSDigLst); //hit->sdigits, returns Qtot
140 static inline Int_t Hit2SDigs (TVector2 hit,Double_t e,TClonesArray* pSDigLst); //hit->sdigits, returns Qtot, old style
141 static void TestHit2SDigs (Double_t x,Double_t y,Double_t e,Bool_t isNew=kFALSE); //test hit->sdigits
142
0fe8fa07 143 inline static Bool_t IsOverTh(Int_t c,TVector pad,Double_t q); //is QDC of the pad registered by FEE
cb801d41 144 static Int_t NsigmaTh() {return 4;} //
145 static Float_t SigmaThMean() {return 1.132;} //QDC electronic noise mean
146 static Float_t SigmaThSpread() {return 0.035;} //QDC electronic noise width
e42a7b46 147
ae754cdf 148 static Double_t CogCorr(Double_t x) {return 3.31267e-2*TMath::Sin(2*TMath::Pi()/PadSizeX()*x) //correction of cluster CoG due to sinoidal
ed83829e 149 -2.66575e-3*TMath::Sin(4*TMath::Pi()/PadSizeX()*x)
f770edb5 150 +2.80553e-3*TMath::Sin(6*TMath::Pi()/PadSizeX()*x)+0.0070;}
db910db9 151
152 TVector3 ForwardTracing(TVector3 entranceTrackPoint,TVector3 vectorTrack, Double_t thetaC, Double_t phiC); //it traces foward a photon from Emission Point to PC
153 static TVector3 PlaneIntersect(const TVector3 &lineDir,const TVector3 &linePoint,const TVector3 &planeNorm,const TVector3 &planePoint); //intersection between line and plane
154 static Double_t SnellAngle(Float_t n1, Float_t n2, Float_t theta1); // Snell law
155 static void AnglesInDRS(Double_t trackTheta,Double_t trackPhi,Double_t thetaCerenkov,Double_t phiCerenkov,Double_t &tout,Double_t &pout);//It finds photon angles in
156 static Double_t AlphaFeedback(Int_t c,Int_t s) {c++;s++; return 0.02;} //for sector s of chamber c
157//test part
158 static void Test() {TestSeg();TestTrans();TestResp();} //test all groups of methodes
159 static void TestResp(); //test the response group of methodes
160 static void TestSeg(); //test the segmentation group of methodes
161 static void TestTrans(); //test the transform group of methodes
162
db910db9 163 enum EPlaneId {kCenter,kPc,kRad,kAnod,kNch=7}; //4 planes in chamber and total number of chambers
164protected:
165 AliRICHParam(); //default ctor is protected to enforce it to be singleton
166 static AliRICHParam *fgInstance; //static pointer to instance of AliRICHParam singleton
cb801d41 167 TF2 *fIdxC6F14; //n=f(Ephot,T) [GeV] for radiator freon C6F14
168 TGeoHMatrix *fMatrix[kNchambers]; //poiners to matrices defining RICH chambers rotations-translations
169 ClassDef(AliRICHParam,0) //RICH main parameters class
d48cca74 170};
db910db9 171
172AliRICHParam* AliRICHParam::Instance()
173{
174// Return pointer to the AliRICHParam singleton.
175// Arguments: none
176// Returns: pointer to the instance of AliRICHParam or 0 if no geometry
177 if(!fgInstance&&gGeoManager) new AliRICHParam;
178 else if(!gGeoManager) Printf("No geometry imported");
179 return fgInstance;
180}//Instance()
c2c6679b 181//__________________________________________________________________________________________________
c712cb2f 182Int_t AliRICHParam::PadNeighbours(Int_t iPadX,Int_t iPadY,Int_t listX[4],Int_t listY[4])
183{
a25b3368 184//Determines all the neighbouring pads for the given one (iPadX,iPadY). Returns total number of these pads.
185//Dead zones are taken into account, meaning pads from different sector are not taken.
e42a7b46 186// 1
187// 2 3
188// 4
c712cb2f 189 Int_t nPads=0;
e42a7b46 190 if(iPadY!=NpadsY()&&iPadY!=2*NpadsYsec()&&iPadY!=NpadsYsec()){listX[nPads]=iPadX; listY[nPads]=iPadY+1; nPads++;} //1
191 if(iPadX!=1&&iPadX!=NpadsXsec()+1) {listX[nPads]=iPadX-1; listY[nPads]=iPadY; nPads++;} //2
192 if(iPadX!=NpadsXsec()&&iPadX!=NpadsX()) {listX[nPads]=iPadX+1; listY[nPads]=iPadY; nPads++;} //3
193 if(iPadY!=1&&iPadY!=NpadsYsec()+1&&2*NpadsYsec()+1) {listX[nPads]=iPadX; listY[nPads]=iPadY-1; nPads++;} //4
ed3ceb24 194
c712cb2f 195 return nPads;
196}//Pad2ClosePads()
197//__________________________________________________________________________________________________
a25b3368 198Int_t AliRICHParam::Loc2Sec(const TVector2 &v2)
3582c1f9 199{
db910db9 200// Determines sector containing the given point. y ^ 5 6
201// | 3 4
202// | 1 2
203// -------> x
204// Arguments: v2- LORS position [cm]
205// Returns: sector code
206 Double_t x0=0; Double_t x1=SecSizeX(); Double_t x2=SecSizeX()+DeadZone(); Double_t x3=PcSizeX();
207 Double_t y0=0; Double_t y1=SecSizeY(); Double_t y2=SecSizeY()+DeadZone(); Double_t y3=2*SecSizeY()+DeadZone();
208 Double_t y4=PcSizeY()-SecSizeY(); Double_t y5=PcSizeY();
e42a7b46 209
0fe8fa07 210 Int_t sector=-1;
a25b3368 211 if (v2.X() >= x0 && v2.X() <= x1 ) sector=1;
212 else if(v2.X() >= x2 && v2.X() <= x3 ) sector=2;
0fe8fa07 213 else return -1;
3582c1f9 214
a25b3368 215 if (v2.Y() >= y0 && v2.Y() <= y1 ) ; //sectors 1 or 2
216 else if(v2.Y() >= y2 && v2.Y() <= y3 ) sector+=2; //sectors 3 or 4
217 else if(v2.Y() >= y4 && v2.Y() <= y5 ) sector+=4; //sectors 5 or 6
0fe8fa07 218 else return -1;
3582c1f9 219 return sector;
c712cb2f 220}//Loc2Sec(Double_t x, Double_t y)
c2c6679b 221//__________________________________________________________________________________________________
a25b3368 222TVector AliRICHParam::Loc2Pad(const TVector2 &loc)
3582c1f9 223{
a25b3368 224//Determines pad number TVector(padx,pady) containing the given point x2 defined in the chamber RS.
225//Pad count starts in lower left corner from 1,1 to 144,160 in upper right corner of a chamber.
e42a7b46 226//y ^ 5 6
227// | 3 4
228// | 1 2
229// -------> x
230 TVector pad(2);
a25b3368 231 Int_t sec=Loc2Sec(loc);//trasforms x2 to sector reference system
0fe8fa07 232 if(sec==-1) {pad[0]=pad[1]=-1; return pad;}
a25b3368 233//first we deal with x
234 if(sec==1||sec==3||sec==5) pad[0]= Int_t( loc.X() / PadSizeX() )+1; //sector 1 or 3 or 5
235 else pad[0]=NpadsX() - Int_t( (PcSizeX()-loc.X()) / PadSizeX() ) ; //sector 2 or 4 or 6
236//second deal with y
d3eb6079 237 if(sec==1||sec==2) pad[1]=Int_t( loc.Y() / PadSizeY())+1; //sector 1 or 2
db910db9 238 else if(sec==3||sec==4) pad[1]=Int_t( (loc.Y()-SecSizeY()-DeadZone()) / PadSizeY())+NpadsYsec()+1; //sector 3 or 4
d3eb6079 239 else pad[1]=NpadsY() - Int_t( (PcSizeY()-loc.Y()) / PadSizeY()); //sector 5 or 6
e42a7b46 240 return pad;
3582c1f9 241}
db910db9 242//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
243Int_t AliRICHParam::Lors2Pad(Double_t x,Double_t y)
244{
245// Determines abs pad number containing the given point (x,y) defined in the chamber RS.
246// Pad count starts in lower left corner from 1,1 to 144,160 in upper right corner of a chamber.
247// y ^ 5 6
248// | 3 4
249// | 1 2
250// -------> x
251 Int_t padx,pady;
252 if (x>= 0 && x<= SecSizeX() ) padx= 1 + Int_t( x /PadSizeX() ); //sector 1 or 3 or 5
253 else if(x>=SecSizeX()+DeadZone() && x<= PcSizeX() ) padx= NpadsX() - Int_t( (PcSizeX()-x)/PadSizeX() ); //sector 2 or 4 or 6
254 else return -1; //dead zone or out of chamber
255
256
257 if (y>= 0 && y<= SecSizeY() ) pady= 1 + Int_t( y /PadSizeY() ); //sector 1 or 2
258 else if(y>=SecSizeY()+DeadZone() && y<=2*SecSizeY()+DeadZone() ) pady= 1 + NpadsYsec() + Int_t( (y-SecSizeY()-DeadZone()) / PadSizeY()); //sector 3 or 4
259 else if(y>= PcSizeY()-SecSizeY() && y<= PcSizeY() ) pady= NpadsY() - Int_t( (PcSizeY()-y)/PadSizeY() ); //sector 5 or 6
260 else return -1; //dead zone or out of chamber
261
262 return AliRICHDigit::P2A(0,padx,pady);
263}//Lors2Pad()
264//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
998b831f 265Int_t AliRICHParam::Pad2Sec(const TVector &pad)
3582c1f9 266{
a25b3368 267//Determines sector containing the given pad.
0fe8fa07 268 Int_t sector=-1;
e42a7b46 269 if (pad[0] >= 1 && pad[0] <= NpadsXsec() ) {sector=1;}
270 else if(pad[0] > NpadsXsec() && pad[0] <= NpadsX() ) {sector=2;}
998b831f 271 else AliDebugClass(1,Form("Wrong pad (%3.0f,%3.0f)",pad[0],pad[1]));
e42a7b46 272
273 if (pad[1] >= 1 && pad[1] <= NpadsYsec() ) {}
274 else if(pad[1] > NpadsYsec() && pad[1] <= 2*NpadsYsec() ) {sector+=2;}
275 else if(pad[1] > 2*NpadsYsec() && pad[1] <= NpadsY() ) {sector+=4;}
998b831f 276 else AliDebugClass(1,Form("Wrong pad (%3.0f,%3.0f)",pad[0],pad[1]));
c712cb2f 277
e42a7b46 278 return sector;
c712cb2f 279}//Pad2Sec()
db910db9 280//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
e42a7b46 281TVector2 AliRICHParam::Pad2Loc(TVector pad)
c712cb2f 282{
a25b3368 283//Returns position of the center of the given pad in local system of the chamber (cm)
e42a7b46 284// y ^ 5 6
998b831f 285// | 3 4 sector numbers
e42a7b46 286// | 1 2
287// -------> x
0fe8fa07 288 Double_t x=-1,y=-1;
e42a7b46 289 if(pad[0] > 0 && pad[0] <= NpadsXsec())//it's 1 or 3 or 5
290 x=(pad[0]-0.5)*PadSizeX();
291 else if(pad[0] > NpadsXsec() && pad[0] <= NpadsX())//it's 2 or 4 or 6
292 x=(pad[0]-0.5)*PadSizeX()+DeadZone();
c2c6679b 293 else
998b831f 294 AliDebugClass(1,Form("Wrong pad (%3.0f,%3.0f)",pad[0],pad[1]));
e42a7b46 295
296 if(pad[1] > 0 && pad[1] <= NpadsYsec())//it's 1 or 2
297 y=(pad[1]-0.5)*PadSizeY();
298 else if(pad[1] > NpadsYsec() && pad[1] <= 2*NpadsYsec())//it's 3 or 4
299 y=(pad[1]-0.5)*PadSizeY()+DeadZone();
300 else if(pad[1] > 2*NpadsYsec() && pad[1]<= NpadsY())//it's 5 or 6
301 y=(pad[1]-0.5)*PadSizeY()+2*DeadZone();
302 else
998b831f 303 AliDebugClass(1,Form("Wrong pad (%3.0f,%3.0f)",pad[0],pad[1]));
e42a7b46 304
3582c1f9 305 return TVector2(x,y);
306}
db910db9 307//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
0422a446 308TVector2 AliRICHParam::Pad2Loc(Int_t pad)
309{
db910db9 310// Converts absolute pad number to local position in LORS
311// LORS is a chamber reference system with origin in left-down coner looking from IP
312// Arguments: pad- absolute pad number
313// Returns: pad center position as TVector2 in PCRS
0422a446 314 TVector2 pos;
315 pos.Set((Pad2PadX(pad)-0.5)*PadSizeX() , (Pad2PadY(pad)-0.5)*PadSizeY());//set to sector LORS
316 return pos;
317}
db910db9 318//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
e42a7b46 319Double_t AliRICHParam::GainSag(Double_t x,Int_t sector)
c60862bf 320{
a25b3368 321//Returns % of gain variation due to wire sagita.
322//All curves are parametrized as per sector basis, so x must be apriory transformed to the Sector RS.
323//Here x is a distance along wires.
db910db9 324 x-=SecSizeX()/2;
325 if(x>SecSizeX()) x-=SecSizeX();
3582c1f9 326 switch(HV(sector)){
e42a7b46 327 case 2150: return 9e-6*TMath::Power(x,4)+2e-7*TMath::Power(x,3)-0.0316*TMath::Power(x,2)-3e-4*x+25.367;//%
328 case 2100: return 8e-6*TMath::Power(x,4)+2e-7*TMath::Power(x,3)-0.0283*TMath::Power(x,2)-2e-4*x+23.015;
329 case 2050: return 7e-6*TMath::Power(x,4)+1e-7*TMath::Power(x,3)-0.0254*TMath::Power(x,2)-2e-4*x+20.888;
330 case 2000: return 6e-6*TMath::Power(x,4)+8e-8*TMath::Power(x,3)-0.0227*TMath::Power(x,2)-1e-4*x+18.961;
3582c1f9 331 default: return 0;
332 }
c712cb2f 333}
db910db9 334//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
335Double_t AliRICHParam::QdcSag(Int_t iPad)
336{
337// It was observed at BNL that wires are affected by gravitation field providing a significant sagita leading to the local electric field variation
338// which means that different pads produce different signals.
339// Arguments: iPad- absolute pad number
340// Returns: gain variation due to wire sagita 0 < QdcSag < 1.
341// Curves are parametrised in terms of distance x (cm) along wires having 0 on the left edge of the photocathode
342 Double_t x=AliRICHDigit::P2X(iPad)*PadSizeX()-0.5*PadSizeX(); //center of the padx (count from 1)
343 switch(HV(iPad)){
344 case 2150: return 0.01*(9e-6*TMath::Power(x,4)+2e-7*TMath::Power(x,3)-0.0316*TMath::Power(x,2)-3e-4*x+25.367);//function is a fit in % so multiply by 0.01
345 case 2100: return 0.01*(8e-6*TMath::Power(x,4)+2e-7*TMath::Power(x,3)-0.0283*TMath::Power(x,2)-2e-4*x+23.015);
346 case 2050: return 0.01*(7e-6*TMath::Power(x,4)+1e-7*TMath::Power(x,3)-0.0254*TMath::Power(x,2)-2e-4*x+20.888);
347 case 2000: return 0.01*(6e-6*TMath::Power(x,4)+8e-8*TMath::Power(x,3)-0.0227*TMath::Power(x,2)-1e-4*x+18.961);
348 default: return 0;
349 }
350}//QdcSag()
351//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
352Int_t AliRICHParam::QdcTot(Int_t iPad,Double_t e)
353{
354// Calculates the total charge produced by the hit. Method:
355// 1. number of electrons is calculated as energy lost in amp gas divided by ionisation potential (for photon only one electron as Etot is always less then ionization potential)
356// 2. each electron imposes a charge distributed as Poisson with QdcEle() mean. Different pads produce different means. See QdcEle().
357// Arguments: iPad- absolute pad number contaning the hit;
358// e- Eloss for mip in amplification gas or Etot for photon
359// Returns: charge parametrised in QDC channels.
360 Int_t iNele=Int_t(e/IonPot()); if(iNele==0) iNele=1;//e < ion. pot. means it's photoelectron
361 Double_t dQdc=0;
a3f77ef9 362 for(Int_t i=1;i<=iNele;i++) dQdc+=-QdcEle(iPad)*TMath::Log(gRandom->Rndm()+1e-6);//1e-6 is a protection against 0 from rndm
db910db9 363 return Int_t(dQdc);
364}//QdcTot()
365//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3582c1f9 366Int_t AliRICHParam::TotQdc(TVector2 x2,Double_t eloss)
367{
a25b3368 368//Calculates the total charge produced by the eloss in point x2 (Chamber RS).
369//Returns this change parametrised in QDC channels, or 0 if the hit in the dead zone.
370//eloss=0 means photon which produces 1 electron only eloss > 0 for Mip
0fe8fa07 371 if(Loc2Sec(x2)==-1) return 0; //hit in the dead zone
3582c1f9 372 Int_t iNelectrons=Int_t(eloss/IonisationPotential()); if(iNelectrons==0) iNelectrons=1;
373 Double_t qdc=0;
a3f77ef9 374 for(Int_t i=1;i<=iNelectrons;i++) qdc+=-Gain(x2)*TMath::Log(gRandom->Rndm()+1e-06);//ie-06 is a protection against 0 from rndm
3582c1f9 375 return Int_t(qdc);
376}
db910db9 377//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
a25b3368 378Double_t AliRICHParam::FracQdc(const TVector2 &x2,const TVector &pad)
3582c1f9 379{
a25b3368 380//Calculates the charge fraction induced to given pad by the hit from the given point.
381//Integrated Mathieson distribution is used.
e42a7b46 382 TVector2 center2=Pad2Loc(pad);//gives center of requested pad
998b831f 383 Double_t normXmin=(x2.X()-center2.X()-PadSizeX()/2) /Pc2Cath();//parametrise for Mathienson
384 Double_t normXmax=(x2.X()-center2.X()+PadSizeX()/2) /Pc2Cath();
385 Double_t normYmin=(x2.Y()-center2.Y()-PadSizeY()/2) /Pc2Cath();
386 Double_t normYmax=(x2.Y()-center2.Y()+PadSizeY()/2) /Pc2Cath();
387
388//requested pad might not belong to the sector of the given hit position, hence the check:
389 return (Loc2Sec(x2)!=Pad2Sec(pad)) ? 0:Mathieson(normXmin, normYmin, normXmax, normYmax);
3582c1f9 390}
db910db9 391//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
0422a446 392Double_t AliRICHParam::Mathieson(Double_t x1,Double_t y1,Double_t x2,Double_t y2)
3582c1f9 393{
db910db9 394// This is the answer to electrostatic problem of charge distrubution in MWPC described elsewhere. (NIM A370(1988)602-603)
395// Arguments: x1- diff between center of distribution which is a hit position and left edge of interested pad divided by anod-cathode distance
396// x2- right edge of the pad
397// y1- up edge of the pad
398// y2- bottom edge of the pad
399// Returns: a charge fraction [0-1] imposed into the pad
53fd478b 400 const Double_t kSqrtKx3=0.77459667;const Double_t kX2=0.962;const Double_t kX4=0.379;
401 const Double_t kSqrtKy3=0.77459667;const Double_t kY2=0.962;const Double_t kY4=0.379;
c712cb2f 402
0422a446 403 Double_t ux1=kSqrtKx3*TMath::TanH(kX2*x1);
404 Double_t ux2=kSqrtKx3*TMath::TanH(kX2*x2);
405 Double_t uy1=kSqrtKy3*TMath::TanH(kY2*y1);
406 Double_t uy2=kSqrtKy3*TMath::TanH(kY2*y2);
53fd478b 407 return 4*kX4*(TMath::ATan(ux2)-TMath::ATan(ux1))*kY4*(TMath::ATan(uy2)-TMath::ATan(uy1));
0422a446 408}
db910db9 409//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
a25b3368 410TVector AliRICHParam::Loc2Area(const TVector2 &x2)
3582c1f9 411{
db910db9 412// Calculates the area of disintegration for a given point. It's assumed here that this points lays on anode wire.
413// Area is a rectangulare set of pads defined by its left-down and right-up coners.
e42a7b46 414 TVector area(4);
415 TVector pad=Loc2Pad(x2);
416 area[0]=area[2]=pad[0]; area[1]=area[3]=pad[1];//area is just a pad fired
417 if(pad[0]!=1 && pad[0]!= NpadsXsec()+1 ) area[0]--; //left down coner X
418 if(pad[1]!=1 && pad[1]!= NpadsYsec()+1 && pad[1]!= 2*NpadsYsec()+1) area[1]--; //left down coner Y
419 if(pad[0]!=NpadsXsec() && pad[0]!= NpadsX() ) area[2]++; //right up coner X
420 if(pad[1]!=NpadsYsec() && pad[1]!= 2*NpadsYsec() && pad[1]!= NpadsY() ) area[3]++; //right up coner Y
421 return area;
3582c1f9 422}
db910db9 423//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
424Bool_t AliRICHParam::IsOverTh(Int_t ,TVector ,Double_t qdc)
3582c1f9 425{
db910db9 426// Checks if the current QDC is over threshold and FEE will save this value to data concentrator.
427// This is done on pad by pad level, so the pad pedestal map is to be used. ??????????????
428// Arguments:
429// Returns: true if QDC over treshold
430 return (qdc>NsigmaTh()*(SigmaThMean()+(1.-2*gRandom->Rndm())*SigmaThSpread())); //??????????? to be change to real values
3582c1f9 431}
db910db9 432//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
433TGeoMatrix* AliRICHParam::Matrix(Int_t iChamN,Int_t iPlane)
434{
435 TGeoHMatrix *pMatrix=new TGeoHMatrix;
436
437 const Double_t kAngHor=19.5; // horizontal angle between chambers 19.5 grad
438 const Double_t kAngVer=20; // vertical angle between chambers 20 grad
439 const Double_t kAngCom=30; // common RICH rotation with respect to x axis 30 grad
440
441 pMatrix->RotateY(90); //rotate around y since initial position is in XY plane -> now in YZ plane
442 Double_t trans[3]={490,0,0}; //center of the chamber is on window-gap surface
443
444 switch(iPlane){
445 case kCenter: break;
446 case kPc : trans[0]+=PcZ(); break;
447 case kRad : trans[0]+=RadZ(); break;
448 case kAnod : trans[0]+=AnodZ(); break;
449 default: return 0; break;
450 }
451 pMatrix->SetTranslation(trans); //now plane in YZ is shifted along x
452
453 switch(iChamN){
454 case 1: pMatrix->RotateY(kAngHor); pMatrix->RotateZ(-kAngVer); break; //right and down
455 case 2: pMatrix->RotateZ(-kAngVer); break; //down
456 case 3: pMatrix->RotateY(kAngHor); break; //right
457 case 4: break; //no rotation
458 case 5: pMatrix->RotateY(-kAngHor); break; //left
459 case 6: pMatrix->RotateZ(kAngVer); break; //up
460 case 7: pMatrix->RotateY(-kAngHor); pMatrix->RotateZ(kAngVer); break; //left and up
461 default: return 0; break;
462 }//switch(iChamber)
463 pMatrix->RotateZ(kAngCom); //apply common rotation in XY plane
464 return pMatrix;
465}//Matrix()
466//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
467TVector3 AliRICHParam::Lors2Mars(Int_t iChId,Double_t x,Double_t y,Int_t iPlnId)
468{
469// Trasform from LORS to MARS
470// Arguments: iChId - chamber code 1..7
471// x,y - point in LORS
472// iPlnN - chamber plane code might be kPc kRad kCenter kAnod
473 Double_t z=0;
474 switch(iPlnId){
475 case kPc : z=PcZ() ; break;
476 case kAnod : z=AnodZ(); break;
477 case kCenter: z=0 ; break;
478 case kRad : z=RadZ() ; break;
479 }
480 Double_t lors[3]={x-0.5*PcSizeX(),y-0.5*PcSizeY(),z}, mars[3];
481 fMatrix[iChId-1]->LocalToMaster(lors,mars);
482 return TVector3(mars);
483}
484//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
cb801d41 485TVector3 AliRICHParam::Lors2MarsVec(Int_t iCh,const TVector3 &p)
486{
487 Double_t mars[3], lors[3]; p.GetXYZ(lors);
488 fMatrix[iCh-1]->LocalToMasterVect(lors,mars);
489 return TVector3(mars);
490}
491//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
db910db9 492TVector2 AliRICHParam::Mars2Lors(Int_t iChId,const TVector3 &x,Int_t iPlnId)
493{
494// Trasform from MARS to LORS
495// Arguments: iChId - chamber code 1..7
496// mars - point in MARS
497// iPlnN - chamber plane code might be kPc kRad kCenter kAnod
498 Double_t z=0;
499 switch(iPlnId){
500 case kPc : z=PcZ() ; break;
501 case kAnod : z=AnodZ(); break;
502 case kCenter: z=0 ; break;
503 case kRad : z=RadZ() ; break;
504 }
505 Double_t lors[3],mars[3];
506 x.GetXYZ(mars);
507 fMatrix[iChId-1]->MasterToLocal(mars,lors);
508 return TVector2(lors[0]+0.5*PcSizeX(),lors[1]+0.5*PcSizeY());
509}
510//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
cb801d41 511TVector3 AliRICHParam::Mars2LorsVec(Int_t iCh,const TVector3 &p)
512{
513 Double_t mars[3], lors[3]; p.GetXYZ(mars);
514 fMatrix[iCh-1]->MasterToLocalVect(mars,lors);
515 return TVector3(lors);
516}
517//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
db910db9 518TVector3 AliRICHParam::Lors2MarsOld(Int_t iChId,Double_t x,Double_t y,Int_t iPlnId)
519{
520// Trasform from LORS to MARS
521// Arguments: iChId - chamber code 0..6
522// x,y - point in LORS
523// iPlnN - chamber plane code might be kPc kRad kCenter kAnod
524 TGeoMatrix *pMatrix=Matrix(iChId,iPlnId);
525 Double_t lors[3]={x-0.5*PcSizeX(),y-0.5*PcSizeY(),0}, mars[3]; pMatrix->LocalToMaster(lors,mars); delete pMatrix;
526 return TVector3(mars);
527}
528//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
529TVector2 AliRICHParam::Mars2LorsOld(Int_t iChamN,const TVector3 &x,Int_t iPlaneN)
530{
531 TGeoMatrix *pMatrix=Matrix(iChamN,iPlaneN);
532 Double_t mars[3]={x.X(),x.Y(),x.Z()} , lors[3]; pMatrix->MasterToLocal(mars,lors); delete pMatrix;
533 return TVector2(lors[0]+0.5*PcSizeX(),lors[1]+0.5*PcSizeY());
534}
535//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
db910db9 536TVector3 AliRICHParam::Center(Int_t iChamN,Int_t iPlaneN)
537{
538 TGeoMatrix *pMatrix=Matrix(iChamN,iPlaneN);
539 Double_t mars[3] , lors[3]={0,0,0}; pMatrix->LocalToMaster(lors,mars); delete pMatrix;
540 return TVector3(mars);
541}
542//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
543TVector3 AliRICHParam::Norm(Int_t iChamN)
544{
545 TGeoMatrix *pMatrix=Matrix(iChamN,kPc);
546 Double_t mars[3] , lors[3]={0,0,1}; pMatrix->LocalToMasterVect(lors,mars); delete pMatrix;
547 return TVector3(mars);
548}
549//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
550Int_t AliRICHParam::Hit2SDigs(Int_t iHitPad,Double_t e,TClonesArray *pSDigLst)
551{
552// Determines a number of pads affected by the hit and calculates the charge induced to each pad.
553// Integrated Mathieson distribution is used. Invoked from AliRICHvX::Hits2SDigits()
554// Arguments: iHitPad - hit pad absolute number
555// e - energy (GeV) of this hit (Eloss for mip or Etot for photon)
556// pSDigLst - pointer to clones array to store in calculated sdigits
557// Returns: total QDC for this hit
558 Int_t iQtot=QdcTot(iHitPad,e); //total QDC value collected for this hit
559 Int_t a=1; //analise current pad +- a pads in both directions
560 Int_t iLeftX=0,iBotY=0,iRightX=0,iTopY=0; //area of disintegration for cluster formation, shifts to hit pad, not pad numbers
561 if(AliRICHDigit::P2X(iHitPad) > a) iLeftX =-a;//determine area of disintegration as hit pad +- parametrised number
562 if(AliRICHDigit::P2X(iHitPad) < AliRICHDigit::kPadsSecX-a) iRightX= a;//of pads. this number is determined by5 sigmas of Mathieson shape
563 if(AliRICHDigit::P2Y(iHitPad) > a) iBotY =-a;//see RICH TDR page 29
564 if(AliRICHDigit::P2Y(iHitPad) < AliRICHDigit::kPadsSecY-a) iTopY = a;//also boundary conditions are checked (edge of sector aka PC)
565 Int_t iPadsCnt=0;
566 for(Int_t iShiftX=iLeftX;iShiftX<=iRightX;iShiftX++){//affected pads loop iShiftX is a distance (in pads) between hit pad and pad under analisys
567 for(Int_t iShiftY=iBotY;iShiftY<=iTopY;iShiftY++){//affected pads loop
568 iHitPad+=AliRICHDigit::kPadAbsX*iShiftX+iShiftY;
569 Double_t x1=PadSizeX()/Pc2Cath()*(iShiftX-0.5);//parametrise for Mathienson
570 Double_t x2=PadSizeX()/Pc2Cath()*(iShiftX+0.5);//parametrise for Mathienson
571 Double_t y1=PadSizeY()/Pc2Cath()*(iShiftY-0.5);//parametrise for Mathienson
572 Double_t y2=PadSizeY()/Pc2Cath()*(iShiftY+0.5);//parametrise for Mathienson
573 (*pSDigLst)[iPadsCnt++]= new AliRICHDigit(iHitPad,iQtot*Mathieson(x1,y1,x2,y2));
574 }//Y loop
575 }//X loop
576 return iQtot;
577}//Hit2SDigs() for abs pad
578//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
579Int_t AliRICHParam::Hit2SDigs(TVector2 hitX2,Double_t e,TClonesArray *pSDigLst)
580{
581// Determines a number of pads affected by the hit and calculates the charge induced to each pad.
582// Integrated Mathieson distribution is used. Invoked from AliRICHvX::Hits2SDigits()
583// Arguments: hitX2 - hit position in LORS, cm
584// e - energy (GeV) of this hit (Eloss for mip or Etot for photon)
585// pSDigLst - pointer to clones array to store in calculated sdigits
586// Returns: total QDC for this hit
587 Int_t iQtot=TotQdc(hitX2,e);//total charge produced by hit, 0 if hit in dead zone
588 if(iQtot==0) return 0;
589
590 TVector hitPad=Loc2Pad(hitX2); TVector2 padCenterX2=Pad2Loc(hitPad); //shift the hit position to the nearest anod wire
591 TVector2 anod;
592 if((hitX2.Y()-padCenterX2.Y())>0) anod.Set(hitX2.X(),padCenterX2.Y()+AnodPitch()/2); //upper part of the pad: shift to upper anod wire
593 else anod.Set(hitX2.X(),padCenterX2.Y()-AnodPitch()/2); //lower part of the pad: shift to lower anod wire
594
595 TVector area=Loc2Area(anod);//determine affected pads, dead zones analysed inside
596 TVector pad(2); //current pad
597 Int_t iPadsCnt=0;
598 for(pad[1]=area[1];pad[1]<=area[3];pad[1]++){//affected pads loop
599 for(pad[0]=area[0];pad[0]<=area[2];pad[0]++){
600 Double_t dQpad=iQtot*FracQdc(anod,pad);
601 if(dQpad>0.1) (*pSDigLst)[iPadsCnt++]= new AliRICHDigit(pad,dQpad);//make sdigit if Qpad is large enough, meaning after merging there is a chance to go above threshold
602 }//X loop
603 }//Y loop
604 return iQtot;
605}//Hit2SDigs() for TVector2
606//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
e316c328 607Double_t AliRICHParam::SigmaSinglePhotonFormula(Double_t thetaC, Double_t phiC, Double_t thetaM, Double_t phiM, Double_t betaM)
608{
609// Analithical calculation of total error (as a sum of localization, geometrical and chromatic errors) on Cerenkov angle for a given Cerenkov photon
610// created by a given MIP. Fromulae according to CERN-EP-2000-058
611// Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians]
612// dip and azimuthal angles for MIP taken at the entrance to radiator, [radians]
613// MIP beta
614// Returns: absolute error on Cerenkov angle, [radians]
615
db910db9 616 TVector3 v(-999,-999,-999);
617
e316c328 618 v.SetX(ErrLoc (thetaC,phiC,thetaM,phiM,betaM));
619 v.SetY(ErrGeom(thetaC,phiC,thetaM,phiM,betaM));
620 v.SetZ(ErrCrom(thetaC,phiC,thetaM,phiM,betaM));
db910db9 621
cb801d41 622 return v.Mag2();
db910db9 623}
624//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
e316c328 625Double_t AliRICHParam::ErrLoc(Double_t thetaC, Double_t phiC, Double_t thetaM, Double_t phiM, Double_t betaM)
db910db9 626{
e316c328 627// Analithical calculation of localization error (due to finite segmentation of PC) on Cerenkov angle for a given Cerenkov photon
628// created by a given MIP. Fromulae according to CERN-EP-2000-058
629// Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians]
630// dip and azimuthal angles for MIP taken at the entrance to radiator, [radians]
631// MIP beta
632// Returns: absolute error on Cerenkov angle, [radians]
633 Double_t refC6F14m = 1.29337;
634 Double_t phiDelta = phiC - phiM;
db910db9 635
e316c328 636 Double_t alpha =TMath::Cos(thetaM)-TMath::Tan(thetaC)*TMath::Cos(phiDelta)*TMath::Sin(thetaM);
637 Double_t k = 1.-refC6F14m*refC6F14m+alpha*alpha/(betaM*betaM);
638 if (k<0) return 1e10;
db910db9 639
e316c328 640 Double_t mu =TMath::Sin(thetaM)*TMath::Sin(phiM)+TMath::Tan(thetaC)*(TMath::Cos(thetaM)*TMath::Cos(phiDelta)*TMath::Sin(phiM)+TMath::Sin(phiDelta)*TMath::Cos(phiM));
641 Double_t e =TMath::Sin(thetaM)*TMath::Cos(phiM)+TMath::Tan(thetaC)*(TMath::Cos(thetaM)*TMath::Cos(phiDelta)*TMath::Cos(phiM)-TMath::Sin(phiDelta)*TMath::Sin(phiM));
db910db9 642
e316c328 643 Double_t kk = betaM*TMath::Sqrt(k)/(Pc2Win()*alpha);
644 Double_t dtdxc = kk*(k*(TMath::Cos(phiDelta)*TMath::Cos(phiM)-TMath::Cos(thetaM)*TMath::Sin(phiDelta)*TMath::Sin(phiM))-(alpha*mu/(betaM*betaM))*TMath::Sin(thetaM)*TMath::Sin(phiDelta));
645 Double_t dtdyc = kk*(k*(TMath::Cos(phiDelta)*TMath::Sin(phiM)+TMath::Cos(thetaM)*TMath::Sin(phiDelta)*TMath::Cos(phiM))+(alpha* e/(betaM*betaM))*TMath::Sin(thetaM)*TMath::Sin(phiDelta));
db910db9 646
647 return TMath::Sqrt(0.2*0.2*dtdxc*dtdxc + 0.25*0.25*dtdyc*dtdyc);
648}
cb801d41 649//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
e316c328 650Double_t AliRICHParam::ErrCrom(Double_t thetaC, Double_t phiC, Double_t thetaM, Double_t phiM, Double_t betaM)
651{
652// Analithical calculation of chromatic error (due to lack of knowledge of Cerenkov photon energy) on Cerenkov angle for a given Cerenkov photon
653// created by a given MIP. Fromulae according to CERN-EP-2000-058
654// Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians]
655// dip and azimuthal angles for MIP taken at the entrance to radiator, [radians]
656// MIP beta
657// Returns: absolute error on Cerenkov angle, [radians]
658 Double_t phiDelta = phiC - phiM;
659 Double_t refC6F14m = 1.29337;
660 Double_t alpha =TMath::Cos(thetaM)-TMath::Tan(thetaC)*TMath::Cos(phiDelta)*TMath::Sin(thetaM);
661
84093f6f 662 //cout << "alpha : "<<alpha<<" thetaC : "<<thetaC<<endl;
e316c328 663 Double_t dtdn = TMath::Cos(thetaM)*refC6F14m*betaM*betaM/(alpha*TMath::Tan(thetaC));
db910db9 664
665 Double_t f = 0.00928*(7.75-5.635)/TMath::Sqrt(12.);
666
667 return f*dtdn;
668}
669//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
e316c328 670Double_t AliRICHParam::ErrGeom(Double_t thetaC, Double_t phiC, Double_t thetaM, Double_t phiM, Double_t betaM)
db910db9 671{
e316c328 672// Analithical calculation of geometric error (due to lack of knowledge of creation point in radiator) on Cerenkov angle for a given Cerenkov photon
673// created by a given MIP. Fromulae according to CERN-EP-2000-058
674// Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians]
675// dip and azimuthal angles for MIP taken at the entrance to radiator, [radians]
676// MIP beta
677// Returns: absolute error on Cerenkov angle, [radians]
db910db9 678
e316c328 679 Double_t phiDelta = phiC - phiM;
680 Double_t refC6F14m = 1.29337;
681 Double_t alpha =TMath::Cos(thetaM)-TMath::Tan(thetaC)*TMath::Cos(phiDelta)*TMath::Sin(thetaM);
db910db9 682
e316c328 683 Double_t k = 1.-refC6F14m*refC6F14m+alpha*alpha/(betaM*betaM);
684 if (k<0) return 1e10;
db910db9 685
e316c328 686 Double_t eTr = 0.5*RadThick()*betaM*TMath::Sqrt(k)/(Pc2Win()*alpha);
687 Double_t lambda = 1.-TMath::Sin(thetaM)*TMath::Sin(thetaM)*TMath::Sin(phiC)*TMath::Sin(phiC);
db910db9 688
689 Double_t c = 1./(1.+ eTr*k/(alpha*alpha*TMath::Cos(thetaC)*TMath::Cos(thetaC)));
e316c328 690 Double_t i = betaM*TMath::Tan(thetaC)*lambda*TMath::Power(k,1.5);
691 Double_t ii = 1.+eTr*betaM*i;
db910db9 692
e316c328 693 Double_t err = c * (i/(alpha*alpha*Pc2Win()) + ii*(1.-lambda) / ( alpha*alpha*Pc2Win()*betaM*(1.+eTr)) );
694 Double_t trErr = RadThick()/(TMath::Sqrt(12.)*TMath::Cos(thetaM));
db910db9 695
e316c328 696 return trErr*err;
db910db9 697}//ErrGeom()
698
d48cca74 699#endif //AliRICHParam_h