Error in phi in Mars2Lors
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDRecon.cxx
CommitLineData
d3da6dc4 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//////////////////////////////////////////////////////////////////////////
17// //
18// AliHMPIDRecon //
19// //
20// HMPID class to perfom pattern recognition based on Hough transfrom //
21// for single chamber //
22//////////////////////////////////////////////////////////////////////////
23
a591e55f 24#include "AliHMPIDRecon.h" //class header
25#include "AliHMPIDParam.h" //CkovAngle()
d3da6dc4 26#include "AliHMPIDCluster.h" //CkovAngle()
a591e55f 27#include <TRotation.h> //TracePhot()
28#include <TH1D.h> //HoughResponse()
29#include <TClonesArray.h> //CkovAngle()
30#include <AliESDtrack.h> //CkovAngle()
d3da6dc4 31
32const Double_t AliHMPIDRecon::fgkRadThick=1.5;
33const Double_t AliHMPIDRecon::fgkWinThick=0.5;
34const Double_t AliHMPIDRecon::fgkGapThick=8.0;
d3da6dc4 35const Double_t AliHMPIDRecon::fgkWinIdx =1.5787;
36const Double_t AliHMPIDRecon::fgkGapIdx =1.0005;
37
d3da6dc4 38//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
39AliHMPIDRecon::AliHMPIDRecon():TTask("RichRec","RichPat"),
abb5f786 40 fRadNmean(1.292),
d3da6dc4 41 fPhotCnt(-1),
42 fCkovSigma2(0),
43 fIsWEIGHT(kFALSE),
44 fDTheta(0.001),
45 fWindowWidth(0.045),
46 fTrkDir(TVector3(0,0,1)),fTrkPos(TVector2(30,40))
47{
48// main ctor
49 for (Int_t i=0; i<3000; i++) {
50 fPhotFlag[i] = 0;
51 fPhotCkov[i] = -1;
52 fPhotPhi [i] = -1;
53 fPhotWei [i] = 0;
54 }
55}
56//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
a591e55f 57void AliHMPIDRecon::CkovAngle(AliESDtrack *pTrk,TClonesArray *pCluLst,Double_t nmean)
d3da6dc4 58{
59// Pattern recognition method based on Hough transform
59280a5a 60// Arguments: pTrk - track for which Ckov angle is to be found
61// pCluLst - list of clusters for this chamber
62// Returns: - track ckov angle, [rad],
a591e55f 63
64 AliHMPIDParam *pParam=AliHMPIDParam::Instance();
d3da6dc4 65
a591e55f 66 if(pCluLst->GetEntries()>pParam->MultCut()) fIsWEIGHT = kTRUE; // offset to take into account bkg in reconstruction
67 else fIsWEIGHT = kFALSE;
d3da6dc4 68
a591e55f 69 Float_t xRa,yRa,th,ph;
70 pTrk->GetHMPIDtrk(xRa,yRa,th,ph); //initialize this track: th and ph angles at middle of RAD
71
b4ad85e9 72 th=TMath::Pi()- th; // right XYZ local orientation
a591e55f 73 SetTrack(xRa,yRa,th,ph);
74
abb5f786 75 fRadNmean=nmean;
d3da6dc4 76
59280a5a 77 Float_t dMin=999,mipX=-1,mipY=-1;Int_t chId=-1,mipId=-1,mipQ=-1;
d3da6dc4 78 fPhotCnt=0;
79 for (Int_t iClu=0; iClu<pCluLst->GetEntriesFast();iClu++){//clusters loop
80 AliHMPIDCluster *pClu=(AliHMPIDCluster*)pCluLst->UncheckedAt(iClu); //get pointer to current cluster
59280a5a 81 chId=pClu->Ch();
a591e55f 82 if(pClu->Q()>pParam->QCut()){ //charge compartible with MIP clusters
83 Float_t dX=fPc.X()-pClu->X(),dY=fPc.Y()-pClu->Y(),d =TMath::Sqrt(dX*dX+dY*dY); //distance between current cluster and intersection point
84 if( d < dMin) {mipId=iClu; dMin=d;mipX=pClu->X();mipY=pClu->Y();mipQ=(Int_t)pClu->Q();} //current cluster is closer, overwrite data for min cluster
85 }else{ //charge compatible with photon cluster
86 Double_t thetaCer,phiCer;
87 if(FindPhotCkov(pClu->X(),pClu->Y(),thetaCer,phiCer)){ //find ckov angle for this photon candidate
88 fPhotCkov[fPhotCnt]=thetaCer; //actual theta Cerenkov (in TRS)
b4ad85e9 89 fPhotPhi [fPhotCnt]=phiCer; //actual phi Cerenkov (in TRS): -pi to come back to "unusual" ref system (X,Y,-Z)
a591e55f 90 fPhotCnt++; //increment counter of photon candidates
91 }
59280a5a 92 }
d3da6dc4 93 }//clusters loop
a591e55f 94 Int_t iNacc=FlagPhot(HoughResponse()); //flag photons according to individual theta ckov with respect to most probable
95 pTrk->SetHMPIDmip(mipX,mipY,mipQ,iNacc); //store mip info
59280a5a 96
a591e55f 97 if(mipId==-1) {pTrk->SetHMPIDsignal(kMipQdcCut); return;} //no clusters with QDC more the threshold at all
98 if(dMin>pParam->DistCut()) {pTrk->SetHMPIDsignal(kMipDistCut); return;} //closest cluster with enough charge is still too far from intersection
99 pTrk->SetHMPIDcluIdx(chId,mipId); //set index of cluster
100 if(iNacc<1) pTrk->SetHMPIDsignal(kNoPhotAccept); //no photon candidates is accepted
101 else pTrk->SetHMPIDsignal(FindRingCkov(pCluLst->GetEntries())); //find best Theta ckov for ring i.e. track
59280a5a 102
a591e55f 103 pTrk->SetHMPIDchi2(fCkovSigma2); //errors squared
d3da6dc4 104
d3da6dc4 105}//ThetaCerenkov()
106//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
a591e55f 107Bool_t AliHMPIDRecon::FindPhotCkov(Double_t cluX,Double_t cluY,Double_t &thetaCer,Double_t &phiCer)
d3da6dc4 108{
109// Finds Cerenkov angle for this photon candidate
110// Arguments: cluX,cluY - position of cadidate's cluster
a591e55f 111// Returns: Cerenkov angle
d3da6dc4 112
a591e55f 113 TVector3 dirCkov;
114
b4ad85e9 115 Double_t zRad= 0.5*AliHMPIDRecon::fgkRadThick
116 +AliHMPIDRecon::fgkWinThick
117 +AliHMPIDRecon::fgkGapThick; //z position of middle of RAD
a591e55f 118
119 TVector3 rad(fTrkPos.X(),fTrkPos.Y(),zRad); //impact point at middle of RAD
120 TVector3 pc(cluX,cluY,0); //mip at PC: z=0 @ PC
121 Double_t cluR = TMath::Sqrt((cluX-fTrkPos.X())*(cluX-fTrkPos.X())+
122 (cluY-fTrkPos.Y())*(cluY-fTrkPos.Y()));//ref. distance impact RAD-CLUSTER
123 Double_t phi=(pc-rad).Phi(); //phi of photon
124
b4ad85e9 125 Double_t ckov1=0;
126 Double_t ckov2=TMath::Pi()-fTrkDir.Theta()+0.75; //start to find theta cerenkov in DRS
127 const Double_t kTol=0.01;
d3da6dc4 128 Int_t iIterCnt = 0;
129 while(1){
a591e55f 130 if(iIterCnt>=50) return kFALSE;
d3da6dc4 131 Double_t ckov=0.5*(ckov1+ckov2);
b4ad85e9 132 dirCkov.SetMagThetaPhi(1,TMath::Pi()-ckov,phi);
a591e55f 133 TVector2 posC=TraceForward(dirCkov); //trace photon with actual angles
134 Double_t dist=cluR-(posC-fTrkPos).Mod(); //get distance between trial point and cluster position
135 if(posC.X()==-999) dist = - 999; //total reflection problem
136 iIterCnt++; //counter step
b4ad85e9 137 if (dist> kTol) ckov1=ckov; //cluster @ larger ckov
d3da6dc4 138 else if(dist<-kTol) ckov2=ckov; //cluster @ smaller ckov
a591e55f 139 else{ //precision achived: ckov in DRS found
140 dirCkov.SetMagThetaPhi(1,ckov,phi); //
141 RecPhot(dirCkov,thetaCer,phiCer); //find ckov (in TRS:the effective Cherenkov angle!)
b4ad85e9 142 thetaCer = TMath::Pi() - thetaCer;
a591e55f 143 return kTRUE;
144 }
d3da6dc4 145 }
146}//FindPhotTheta()
147//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
a591e55f 148TVector2 AliHMPIDRecon::TraceForward(TVector3 dirCkov)const
d3da6dc4 149{
a591e55f 150 //Trace forward a photon from (x,y) up to PC
151 // Arguments: dirCkov photon vector in LORS
152 // Returns: pos of traced photon at PC
153 TVector2 pos(-999,-999);
b4ad85e9 154 Double_t thetaCer = TMath::Pi()-dirCkov.Theta();
155 if(thetaCer > TMath::ASin(1./fRadNmean)) return pos; //total refraction on WIN-GAP boundary
156 Double_t zRad= 0.5*AliHMPIDRecon::fgkRadThick
157 +AliHMPIDRecon::fgkWinThick
158 +AliHMPIDRecon::fgkGapThick; //z position of middle of RAD
159 TVector3 posCkov(fTrkPos.X(),fTrkPos.Y(),zRad); //RAD: photon position is track position @ middle of RAD
160 Propagate(dirCkov,posCkov,fgkWinThick+fgkGapThick); //go to RAD-WIN boundary
161 Refract (dirCkov, fRadNmean,fgkWinIdx ); //RAD-WIN refraction
162 Propagate(dirCkov,posCkov, fgkGapThick); //go to WIN-GAP boundary
163 Refract (dirCkov, fgkWinIdx,fgkGapIdx ); //WIN-GAP refraction
164 Propagate(dirCkov,posCkov, 0); //go to PC
a591e55f 165 pos.Set(posCkov.X(),posCkov.Y());
166 return pos;
167}//TraceForward()
168//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
169void AliHMPIDRecon::RecPhot(TVector3 dirCkov,Double_t &thetaCer,Double_t &phiCer)
170{
171 //Theta Cerenkov reconstruction
172 // Arguments: (x,y) of initial point in LORS, dirCkov photon vector in LORS
173 // Returns: thetaCer theta cerenkov reconstructed
174// TVector3 dirTrk;
175// dirTrk.SetMagThetaPhi(1,fTrkDir.Theta(),fTrkDir.Phi());
176// Double_t thetaCer = TMath::ACos(dirCkov*dirTrk);
177 TRotation mtheta; mtheta.RotateY(- fTrkDir.Theta());
178 TRotation mphi; mphi.RotateZ(- fTrkDir.Phi());
179 TRotation mrot=mtheta*mphi;
180 TVector3 dirCkovTRS;
181 dirCkovTRS=mrot*dirCkov;
182 phiCer = dirCkovTRS.Phi(); //actual value of the phi of the photon
183 thetaCer= dirCkovTRS.Theta(); //actual value of thetaCerenkov of the photon
d3da6dc4 184}
185//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
186Double_t AliHMPIDRecon::FindRingArea(Double_t ckovAng)const
187{
188// Find area inside the cerenkov ring which lays inside PCs
a591e55f 189// Arguments: ckovAng - cerenkov angle
d3da6dc4 190// Returns: area of the ring in cm^2 for given theta ckov
191
d3da6dc4 192 const Int_t kN=100;
193 Double_t area=0;
194 for(Int_t i=0;i<kN;i++){
a591e55f 195 TVector2 pos1=TracePhot(ckovAng,Double_t(TMath::TwoPi()*i /kN));//trace this photon
196 TVector2 pos2=TracePhot(ckovAng,Double_t(TMath::TwoPi()*(i+1)/kN));//trace the next photon
197 area+=(pos1-fTrkPos)*(pos2-fTrkPos); //add area of the triangle...
d3da6dc4 198 }
199 return area;
200}//FindRingArea()
201//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
202Double_t AliHMPIDRecon::FindRingCkov(Int_t)
203{
204// Loops on all Ckov candidates and estimates the best Theta Ckov for a ring formed by those candidates. Also estimates an error for that Theat Ckov
205// collecting errors for all single Ckov candidates thetas. (Assuming they are independent)
206// Arguments: iNclus- total number of clusters in chamber for background estimation
207// Return: best estimation of track Theta ckov
208
209 Double_t wei = 0.;
210 Double_t weightThetaCerenkov = 0.;
211
212 Double_t ckovMin=9999.,ckovMax=0.;
213 Double_t sigma2 = 0; //to collect error squared for this ring
214
215 for(Int_t i=0;i<fPhotCnt;i++){//candidates loop
216 if(fPhotFlag[i] == 2){
a591e55f 217 if(fPhotCkov[i]<ckovMin) ckovMin=fPhotCkov[i]; //find max and min Theta ckov from all candidates within probable window
d3da6dc4 218 if(fPhotCkov[i]>ckovMax) ckovMax=fPhotCkov[i];
a591e55f 219 weightThetaCerenkov += fPhotCkov[i]*fPhotWei[i];
220 wei += fPhotWei[i]; //collect weight as sum of all candidate weghts
d3da6dc4 221
d3da6dc4 222 sigma2 += 1./Sigma2(fPhotCkov[i],fPhotPhi[i]);
223 }
224 }//candidates loop
225
226 if(sigma2>0) fCkovSigma2=1./sigma2;
227 else fCkovSigma2=1e10;
228
b4ad85e9 229 if(wei != 0.) weightThetaCerenkov /= wei; else weightThetaCerenkov = 0.;
d3da6dc4 230 return weightThetaCerenkov;
231}//FindCkovRing()
232//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
233Int_t AliHMPIDRecon::FlagPhot(Double_t ckov)
234{
235// Flag photon candidates if their individual ckov angle is inside the window around ckov angle returned by HoughResponse()
236// Arguments: ckov- value of most probable ckov angle for track as returned by HoughResponse()
237// Returns: number of photon candidates happened to be inside the window
238
a591e55f 239// Photon Flag: Flag = 0 initial set;
240// Flag = 1 good candidate (charge compatible with photon);
241// Flag = 2 photon used for the ring;
d3da6dc4 242
243 Int_t steps = (Int_t)((ckov )/ fDTheta); //how many times we need to have fDTheta to fill the distance between 0 and thetaCkovHough
244
245 Double_t tmin = (Double_t)(steps - 1)*fDTheta;
246 Double_t tmax = (Double_t)(steps)*fDTheta;
247 Double_t tavg = 0.5*(tmin+tmax);
248
249 tmin = tavg - 0.5*fWindowWidth; tmax = tavg + 0.5*fWindowWidth;
250
251 Int_t iInsideCnt = 0; //count photons which Theta ckov inside the window
252 for(Int_t i=0;i<fPhotCnt;i++){//photon candidates loop
253 if(fPhotCkov[i] >= tmin && fPhotCkov[i] <= tmax) {
254 fPhotFlag[i]=2;
255 iInsideCnt++;
256 }
257 }
258 return iInsideCnt;
259}//FlagPhot()
260//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
a591e55f 261TVector2 AliHMPIDRecon::TracePhot(Double_t ckovThe,Double_t ckovPhi)const
d3da6dc4 262{
263// Trace a single Ckov photon from emission point somewhere in radiator up to photocathode taking into account ref indexes of materials it travereses
a591e55f 264// Arguments: ckovThe,ckovPhi- photon ckov angles in DRS, [rad]
d3da6dc4 265// Returns: distance between photon point on PC and track projection
266 TRotation mtheta; mtheta.RotateY(fTrkDir.Theta());
267 TRotation mphi; mphi.RotateZ(fTrkDir.Phi());
268 TRotation mrot=mphi*mtheta;
a591e55f 269 TVector3 dirCkov,dirCkovTors;
270
b4ad85e9 271 ckovThe = TMath::Pi()-ckovThe;
272
a591e55f 273 dirCkovTors.SetMagThetaPhi(1,ckovThe,ckovPhi); //initially photon is directed according to requested ckov angle
274 dirCkov=mrot*dirCkovTors; //now we know photon direction in LORS
275 return TraceForward(dirCkov);
276}//TracePhot()
d3da6dc4 277//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
a591e55f 278void AliHMPIDRecon::Propagate(const TVector3 dir,TVector3 &pos,Double_t z)const
d3da6dc4 279{
280// Finds an intersection point between a line and XY plane shifted along Z.
281// Arguments: dir,pos - vector along the line and any point of the line
282// z - z coordinate of plain
283// Returns: none
284// On exit: pos is the position if this intesection if any
285 static TVector3 nrm(0,0,1);
286 TVector3 pnt(0,0,z);
287
288 TVector3 diff=pnt-pos;
289 Double_t sint=(nrm*diff)/(nrm*dir);
290 pos+=sint*dir;
291}//Propagate()
292//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
293void AliHMPIDRecon::Refract(TVector3 &dir,Double_t n1,Double_t n2)const
294{
295// Refract direction vector according to Snell law
296// Arguments:
297// n1 - ref idx of first substance
298// n2 - ref idx of second substance
299// Returns: none
300// On exit: dir is new direction
b4ad85e9 301 Double_t sinref=(n1/n2)*TMath::Sin(TMath::Pi()-dir.Theta());
d3da6dc4 302 if(sinref>1.) dir.SetXYZ(-999,-999,-999);
b4ad85e9 303 else dir.SetTheta(TMath::Pi()-TMath::ASin(sinref));
d3da6dc4 304}//Refract()
305//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
306Double_t AliHMPIDRecon::HoughResponse()
307{
308//
309//
310//
311 Double_t kThetaMax=0.75;
312 Int_t nChannels = (Int_t)(kThetaMax/fDTheta+0.5);
313 TH1D *phots = new TH1D("Rphot" ,"phots" ,nChannels,0,kThetaMax);
314 TH1D *photsw = new TH1D("RphotWeighted" ,"photsw" ,nChannels,0,kThetaMax);
315 TH1D *resultw = new TH1D("resultw","resultw" ,nChannels,0,kThetaMax);
316 Int_t nBin = (Int_t)(kThetaMax/fDTheta);
317 Int_t nCorrBand = (Int_t)(fWindowWidth/(2*fDTheta));
318
319 for (Int_t i=0; i< fPhotCnt; i++){//photon cadidates loop
320 Double_t angle = fPhotCkov[i]; if(angle<0||angle>kThetaMax) continue;
321 phots->Fill(angle);
322 Int_t bin = (Int_t)(0.5+angle/(fDTheta));
323 Double_t weight=1.;
324 if(fIsWEIGHT){
325 Double_t lowerlimit = ((Double_t)bin)*fDTheta - 0.5*fDTheta; Double_t upperlimit = ((Double_t)bin)*fDTheta + 0.5*fDTheta;
326 Double_t diffArea = FindRingArea(upperlimit)-FindRingArea(lowerlimit);
327 if(diffArea>0) weight = 1./diffArea;
328 }
329 photsw->Fill(angle,weight);
330 fPhotWei[i]=weight;
331 }//photon candidates loop
332
333 for (Int_t i=1; i<=nBin;i++){
334 Int_t bin1= i-nCorrBand;
335 Int_t bin2= i+nCorrBand;
336 if(bin1<1) bin1=1;
337 if(bin2>nBin)bin2=nBin;
338 Double_t sumPhots=phots->Integral(bin1,bin2);
339 if(sumPhots<3) continue; // if less then 3 photons don't trust to this ring
340 Double_t sumPhotsw=photsw->Integral(bin1,bin2);
341 resultw->Fill((Double_t)((i+0.5)*fDTheta),sumPhotsw);
342 }
343// evaluate the "BEST" theta ckov as the maximum value of histogramm
344 Double_t *pVec = resultw->GetArray();
345 Int_t locMax = TMath::LocMax(nBin,pVec);
346 phots->Delete();photsw->Delete();resultw->Delete(); // Reset and delete objects
347
348 return (Double_t)(locMax*fDTheta+0.5*fDTheta); //final most probable track theta ckov
349}//HoughResponse()
350//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
351Double_t AliHMPIDRecon::Sigma2(Double_t ckovTh, Double_t ckovPh)const
352{
353// Analithical calculation of total error (as a sum of localization, geometrical and chromatic errors) on Cerenkov angle for a given Cerenkov photon
354// created by a given MIP. Fromulae according to CERN-EP-2000-058
355// Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians]
356// dip and azimuthal angles for MIP taken at the entrance to radiator, [radians]
357// MIP beta
358// Returns: absolute error on Cerenkov angle, [radians]
359
360 TVector3 v(-999,-999,-999);
abb5f786 361 Double_t trkBeta = 1./(TMath::Cos(ckovTh)*fRadNmean);
d3da6dc4 362
363 v.SetX(SigLoc (ckovTh,ckovPh,trkBeta));
364 v.SetY(SigGeom(ckovTh,ckovPh,trkBeta));
365 v.SetZ(SigCrom(ckovTh,ckovPh,trkBeta));
366
367 return v.Mag2();
368}
369//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
370Double_t AliHMPIDRecon::SigLoc(Double_t thetaC, Double_t phiC,Double_t betaM)const
371{
372// Analithical calculation of localization error (due to finite segmentation of PC) on Cerenkov angle for a given Cerenkov photon
373// created by a given MIP. Fromulae according to CERN-EP-2000-058
374// Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians]
375// dip and azimuthal angles for MIP taken at the entrance to radiator, [radians]
376// MIP beta
377// Returns: absolute error on Cerenkov angle, [radians]
378 Double_t phiDelta = phiC - fTrkDir.Phi();
379
380 Double_t alpha =TMath::Cos(fTrkDir.Theta())-TMath::Tan(thetaC)*TMath::Cos(phiDelta)*TMath::Sin(fTrkDir.Theta());
abb5f786 381 Double_t k = 1.-fRadNmean*fRadNmean+alpha*alpha/(betaM*betaM);
d3da6dc4 382 if (k<0) return 1e10;
383
384 Double_t mu =TMath::Sin(fTrkDir.Theta())*TMath::Sin(fTrkDir.Phi())+TMath::Tan(thetaC)*(TMath::Cos(fTrkDir.Theta())*TMath::Cos(phiDelta)*TMath::Sin(fTrkDir.Phi())+TMath::Sin(phiDelta)*TMath::Cos(fTrkDir.Phi()));
385 Double_t e =TMath::Sin(fTrkDir.Theta())*TMath::Cos(fTrkDir.Phi())+TMath::Tan(thetaC)*(TMath::Cos(fTrkDir.Theta())*TMath::Cos(phiDelta)*TMath::Cos(fTrkDir.Phi())-TMath::Sin(phiDelta)*TMath::Sin(fTrkDir.Phi()));
386
387 Double_t kk = betaM*TMath::Sqrt(k)/(8*alpha);
388 Double_t dtdxc = kk*(k*(TMath::Cos(phiDelta)*TMath::Cos(fTrkDir.Phi())-TMath::Cos(fTrkDir.Theta())*TMath::Sin(phiDelta)*TMath::Sin(fTrkDir.Phi()))-(alpha*mu/(betaM*betaM))*TMath::Sin(fTrkDir.Theta())*TMath::Sin(phiDelta));
389 Double_t dtdyc = kk*(k*(TMath::Cos(phiDelta)*TMath::Sin(fTrkDir.Phi())+TMath::Cos(fTrkDir.Theta())*TMath::Sin(phiDelta)*TMath::Cos(fTrkDir.Phi()))+(alpha* e/(betaM*betaM))*TMath::Sin(fTrkDir.Theta())*TMath::Sin(phiDelta));
390
391 return TMath::Sqrt(0.2*0.2*dtdxc*dtdxc + 0.25*0.25*dtdyc*dtdyc);
392}
393//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
394Double_t AliHMPIDRecon::SigCrom(Double_t thetaC, Double_t phiC,Double_t betaM)const
395{
396// Analithical calculation of chromatic error (due to lack of knowledge of Cerenkov photon energy) on Cerenkov angle for a given Cerenkov photon
397// created by a given MIP. Fromulae according to CERN-EP-2000-058
398// Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians]
399// dip and azimuthal angles for MIP taken at the entrance to radiator, [radians]
400// MIP beta
401// Returns: absolute error on Cerenkov angle, [radians]
402 Double_t phiDelta = phiC - fTrkDir.Phi();
403 Double_t alpha =TMath::Cos(fTrkDir.Theta())-TMath::Tan(thetaC)*TMath::Cos(phiDelta)*TMath::Sin(fTrkDir.Theta());
404
abb5f786 405 Double_t dtdn = TMath::Cos(fTrkDir.Theta())*fRadNmean*betaM*betaM/(alpha*TMath::Tan(thetaC));
d3da6dc4 406
407 Double_t f = 0.00928*(7.75-5.635)/TMath::Sqrt(12.);
408
409 return f*dtdn;
410}//SigCrom()
411//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
412Double_t AliHMPIDRecon::SigGeom(Double_t thetaC, Double_t phiC,Double_t betaM)const
413{
414// Analithical calculation of geometric error (due to lack of knowledge of creation point in radiator) on Cerenkov angle for a given Cerenkov photon
415// created by a given MIP. Formulae according to CERN-EP-2000-058
416// Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians]
417// dip and azimuthal angles for MIP taken at the entrance to radiator, [radians]
418// MIP beta
419// Returns: absolute error on Cerenkov angle, [radians]
420
421 Double_t phiDelta = phiC - fTrkDir.Phi();
422 Double_t alpha =TMath::Cos(fTrkDir.Theta())-TMath::Tan(thetaC)*TMath::Cos(phiDelta)*TMath::Sin(fTrkDir.Theta());
423
abb5f786 424 Double_t k = 1.-fRadNmean*fRadNmean+alpha*alpha/(betaM*betaM);
d3da6dc4 425 if (k<0) return 1e10;
426
427 Double_t eTr = 0.5*1.5*betaM*TMath::Sqrt(k)/(8*alpha);
428 Double_t lambda = 1.-TMath::Sin(fTrkDir.Theta())*TMath::Sin(fTrkDir.Theta())*TMath::Sin(phiC)*TMath::Sin(phiC);
429
430 Double_t c = 1./(1.+ eTr*k/(alpha*alpha*TMath::Cos(thetaC)*TMath::Cos(thetaC)));
431 Double_t i = betaM*TMath::Tan(thetaC)*lambda*TMath::Power(k,1.5);
432 Double_t ii = 1.+eTr*betaM*i;
433
434 Double_t err = c * (i/(alpha*alpha*8) + ii*(1.-lambda) / ( alpha*alpha*8*betaM*(1.+eTr)) );
435 Double_t trErr = 1.5/(TMath::Sqrt(12.)*TMath::Cos(fTrkDir.Theta()));
436
437 return trErr*err;
438}//SigGeom()
439//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++