]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/STEERBase/AliHMPIDPIDResponse.cxx
h-mu
[u/mrichter/AliRoot.git] / STEER / STEERBase / AliHMPIDPIDResponse.cxx
CommitLineData
567624b5 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// Class AliHMPIDPIDResponse
18//
19// HMPID class to perfom particle identification
20//
21// Author: G. Volpe, giacomo.volpe@cern.ch
22//***********************************************************
23
24
25#include "AliHMPIDPIDResponse.h" //class header
26#include "AliPID.h" //FindPid()
27#include "AliVTrack.h" //FindPid()
28#include "AliLog.h" //general
29#include <TRandom.h> //Resolution()
30#include <TVector2.h> //Resolution()
31#include <TRotation.h>
32#include <TF1.h>
33#include <TGeoManager.h> //Instance()
34#include <TGeoMatrix.h> //Instance()
35#include <TGeoPhysicalNode.h> //ctor
36#include <TGeoBBox.h>
37#include <TObjArray.h>
38
39Float_t AliHMPIDPIDResponse::fgkMinPcX[]={0.,0.,0.,0.,0.,0.};
40Float_t AliHMPIDPIDResponse::fgkMaxPcX[]={0.,0.,0.,0.,0.,0.};
41Float_t AliHMPIDPIDResponse::fgkMinPcY[]={0.,0.,0.,0.,0.,0.};
42Float_t AliHMPIDPIDResponse::fgkMaxPcY[]={0.,0.,0.,0.,0.,0.};
43
44Float_t AliHMPIDPIDResponse::fgCellX=0.;
45Float_t AliHMPIDPIDResponse::fgCellY=0.;
46
47Float_t AliHMPIDPIDResponse::fgPcX=0;
48Float_t AliHMPIDPIDResponse::fgPcY=0;
49
50Float_t AliHMPIDPIDResponse::fgAllX=0;
51Float_t AliHMPIDPIDResponse::fgAllY=0;
52
53//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
54AliHMPIDPIDResponse::AliHMPIDPIDResponse():
55 TNamed("HMPIDPIDResponseRec","HMPIDPIDResponsePid"),
56 fRefIdx(1.28947),
57 fTrkDir(0,0,1),
58 fTrkPos(30,40),
59 fRefIndexArray(0x0)
60{
61 //
62 // ctor
63 //
64
65 Float_t dead=2.6;// cm of the dead zones between PCs-> See 2CRC2099P1
66
67 fgCellX=0.8; fgCellY=0.84;
68
69 fgPcX = 80.*fgCellX; fgPcY = 48.*fgCellY;
70 fgAllX = 2.*fgPcX+dead;
71 fgAllY = 3.*fgPcY+2.*dead;
72
73 fgkMinPcX[1]=fgPcX+dead; fgkMinPcX[3]=fgkMinPcX[1]; fgkMinPcX[5]=fgkMinPcX[3];
74 fgkMaxPcX[0]=fgPcX; fgkMaxPcX[2]=fgkMaxPcX[0]; fgkMaxPcX[4]=fgkMaxPcX[2];
75 fgkMaxPcX[1]=fgAllX; fgkMaxPcX[3]=fgkMaxPcX[1]; fgkMaxPcX[5]=fgkMaxPcX[3];
76
77 fgkMinPcY[2]=fgPcY+dead; fgkMinPcY[3]=fgkMinPcY[2];
78 fgkMinPcY[4]=2.*fgPcY+2.*dead; fgkMinPcY[5]=fgkMinPcY[4];
79 fgkMaxPcY[0]=fgPcY; fgkMaxPcY[1]=fgkMaxPcY[0];
80 fgkMaxPcY[2]=2.*fgPcY+dead; fgkMaxPcY[3]=fgkMaxPcY[2];
81 fgkMaxPcY[4]=fgAllY; fgkMaxPcY[5]=fgkMaxPcY[4];
82
83 for(Int_t i=kMinCh;i<=kMaxCh;i++)
84 if(gGeoManager && gGeoManager->IsClosed()) {
85 TGeoPNEntry* pne = gGeoManager->GetAlignableEntry(Form("/HMPID/Chamber%i",i));
86 if (!pne) {
87 AliErrorClass(Form("The symbolic volume %s does not correspond to any physical entry!",Form("HMPID_%i",i)));
88 fM[i]=new TGeoHMatrix;
89 IdealPosition(i,fM[i]);
90 } else {
91 TGeoPhysicalNode *pnode = pne->GetPhysicalNode();
92 if(pnode) fM[i]=new TGeoHMatrix(*(pnode->GetMatrix()));
93 else {
94 fM[i]=new TGeoHMatrix;
95 IdealPosition(i,fM[i]);
96 }
97 }
98 } else{
99 fM[i]=new TGeoHMatrix;
100 IdealPosition(i,fM[i]);
101 }
102
103}//ctor
104//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
105AliHMPIDPIDResponse::AliHMPIDPIDResponse(const AliHMPIDPIDResponse& c):
106 TNamed(c),
107 fRefIdx(c.fRefIdx),
108 fTrkDir(c.fTrkDir),
109 fTrkPos(c.fTrkPos),
110 fRefIndexArray(c.fRefIndexArray)
111 {
112 //
113 // copy ctor
114 //
115
116 for(Int_t i=0; i<6; i++) {
117
118 fgkMinPcX[i] = c.fgkMinPcX[i];
119 fgkMinPcY[i] = c.fgkMinPcY[i];
120 fgkMaxPcX[i] = c.fgkMaxPcX[i];
121 fgkMaxPcY[i] = c.fgkMaxPcY[i];
122 }
123
124 for(Int_t i=0; i<7; i++) fM[i] = c.fM[i];
125 }
126//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
127AliHMPIDPIDResponse& AliHMPIDPIDResponse::operator=(const AliHMPIDPIDResponse& c) {
128
129 //
130 // assignment operator
131 //
132 if(this!=&c){
133 TNamed::operator=(c);
134 fgCellX = c.fgCellX;
135 fgCellY = c.fgCellY;
136 fgPcX = c.fgPcX;
137 fgPcY = c.fgPcY;
138 fgAllX = c.fgAllX;
139 fgAllY = c.fgAllY;
140 fRefIdx = c.fRefIdx;
141 fTrkDir = c.fTrkDir;
142 fTrkPos = c.fTrkPos;
143 fRefIndexArray = c.fRefIndexArray;
144 for(Int_t i=0; i<6; i++) {
145 fgkMinPcX[i] = c.fgkMinPcX[i];
146 fgkMinPcY[i] = c.fgkMinPcY[i];
147 fgkMaxPcX[i] = c.fgkMaxPcX[i];
148 fgkMaxPcY[i] = c.fgkMaxPcY[i];
149 }
150 for(Int_t i=0; i<7; i++) fM[i] = c.fM[i];
151 }
152
153 return *this;
154}
155//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
156void AliHMPIDPIDResponse::IdealPosition(Int_t iCh, TGeoHMatrix *pMatrix) {
157
158// Construct ideal position matrix for a given chamber
159// Arguments: iCh- chamber ID; pMatrix- pointer to precreated unity matrix where to store the results
160// Returns: none
161
162 const Double_t kAngHor=19.5; // horizontal angle between chambers 19.5 grad
163 const Double_t kAngVer=20; // vertical angle between chambers 20 grad
164 const Double_t kAngCom=30; // common HMPID rotation with respect to x axis 30 grad
165 const Double_t kTrans[3]={490,0,0}; // center of the chamber is on window-gap surface
166 pMatrix->RotateY(90); // rotate around y since initial position is in XY plane -> now in YZ plane
167 pMatrix->SetTranslation(kTrans); // now plane in YZ is shifted along x
168 switch(iCh){
169 case 0: pMatrix->RotateY(kAngHor); pMatrix->RotateZ(-kAngVer); break; //right and down
170 case 1: pMatrix->RotateZ(-kAngVer); break; //down
171 case 2: pMatrix->RotateY(kAngHor); break; //right
172 case 3: break; //no rotation
173 case 4: pMatrix->RotateY(-kAngHor); break; //left
174 case 5: pMatrix->RotateZ(kAngVer); break; //up
175 case 6: pMatrix->RotateY(-kAngHor); pMatrix->RotateZ(kAngVer); break; //left and up
176 }
177 pMatrix->RotateZ(kAngCom); //apply common rotation in XY plane
178
179}
180//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
181Double_t AliHMPIDPIDResponse::GetExpectedSignal(const AliVTrack *vTrk, AliPID::EParticleType specie) const {
182
183 // expected Cherenkov angle calculation
184
185 const Double_t nmean = GetNMean(vTrk);
186 return ExpectedSignal(vTrk,nmean,specie);
187}
188//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
189Double_t AliHMPIDPIDResponse::GetExpectedSigma(const AliVTrack *vTrk, AliPID::EParticleType specie) const {
190
191 // expected resolution calculation
192
193 const Double_t nmean = GetNMean(vTrk);
194 return ExpectedSigma(vTrk,nmean,specie);
195}
196//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
197Double_t AliHMPIDPIDResponse::ExpectedSignal(const AliVTrack *vTrk, Double_t nmean, AliPID::EParticleType specie) const {
198
199 // expected Cherenkov angle calculation
200
201 Double_t thetaTheor = -999.;
202
203 Double_t p[3] = {0}, mom = 0;
204 if(vTrk->GetOuterHmpPxPyPz(p)) mom = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]+p[2]*p[2]); // Momentum of the charged particle
205 else return thetaTheor;
206
207 const Double_t mass = AliPID::ParticleMass(specie);
208 const Double_t cosTheta = TMath::Sqrt(mass*mass+mom*mom)/(nmean*mom);
209
210 if(cosTheta>1) return thetaTheor;
211
212 else thetaTheor = TMath::ACos(cosTheta);
213
214 return thetaTheor; // evaluate the theor. Theta Cherenkov
215}
216//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
217Double_t AliHMPIDPIDResponse::ExpectedSigma(const AliVTrack *vTrk, Double_t nmean, AliPID::EParticleType specie) const {
218
219 // expected resolution calculation
220
221 Float_t x=0., y=0.;
222 Int_t q=0, nph=0;
223 Float_t xPc=0.,yPc=0.,thRa=0.,phRa=0.;
224
225 vTrk->GetHMPIDmip(x,y,q,nph);
226 vTrk->GetHMPIDtrk(xPc,yPc,thRa,phRa);
227
228 const Double_t xRa = xPc - (RadThick()+WinThick()+GapThick())*TMath::Cos(phRa)*TMath::Tan(thRa); //just linear extrapolation back to RAD
229 const Double_t yRa = yPc - (RadThick()+WinThick()+GapThick())*TMath::Sin(phRa)*TMath::Tan(thRa); //just linear extrapolation back to RAD
230
231 const Double_t thetaCerTh = ExpectedSignal(vTrk,nmean,specie);
232 const Double_t occupancy = vTrk->GetHMPIDoccupancy();
233 const Double_t thetaMax = TMath::ACos(1./nmean);
234 const Int_t nPhotsTh = (Int_t)(12.*TMath::Sin(thetaCerTh)*TMath::Sin(thetaCerTh)/(TMath::Sin(thetaMax)*TMath::Sin(thetaMax))+0.01);
235
236 Double_t sigmatot = 0;
237 Int_t nTrks = 20;
238 for(Int_t iTrk=0;iTrk<nTrks;iTrk++) {
239 Double_t invSigma = 0;
240 Int_t nPhotsAcc = 0;
241
242 Int_t nPhots = 0;
243 if(nph<nPhotsTh+TMath::Sqrt(nPhotsTh) && nph>nPhotsTh-TMath::Sqrt(nPhotsTh)) nPhots = nph;
244 else nPhots = gRandom->Poisson(nPhotsTh);
245
246 for(Int_t j=0;j<nPhots;j++){
247 Double_t phi = gRandom->Rndm()*TMath::TwoPi();
248 TVector2 pos; pos = TracePhot(xRa,yRa,thRa,phRa,thetaCerTh,phi);
249 if(!IsInside(pos.X(),pos.Y())) continue;
250 if(IsInDead(pos.X(),pos.Y())) continue;
251 Double_t sigma2 = Sigma2(thRa,thRa,thetaCerTh,phi); //photon candidate sigma^2
252
253 if(sigma2!=0) {
254 invSigma += 1./sigma2;
255 nPhotsAcc++;
256 }
257 }
258 if(invSigma!=0) sigmatot += 1./TMath::Sqrt(invSigma);
259 }
260
261 return (sigmatot/nTrks)*SigmaCorrFact(specie,occupancy);
262}
263//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
264Double_t AliHMPIDPIDResponse::GetNumberOfSigmas(const AliVTrack *vTrk, AliPID::EParticleType specie) const {
265
266 // Number of sigmas calculation
267
268 Double_t nSigmas = -999.;
269
270 if(vTrk->GetHMPIDsignal()<0.) return nSigmas;
271
272 const Double_t nmean = GetNMean(vTrk);
273
274 const Double_t expSigma = ExpectedSigma(vTrk, nmean, specie);
275
276 if(expSigma > 0.) nSigmas = (vTrk->GetHMPIDsignal() - ExpectedSignal(vTrk,nmean,specie))/expSigma;
277
278 return nSigmas;
279
280}
281//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
282void AliHMPIDPIDResponse::GetProbability(const AliVTrack *vTrk,Int_t nSpecies,Double_t *prob) const {
283
284// Calculates probability to be a electron-muon-pion-kaon-proton with the "amplitude" method
285// from the given Cerenkov angle and momentum assuming no initial particle composition
286
287 const Double_t thetaCerExp = vTrk->GetHMPIDsignal();
288
289 const Double_t nmean = GetNMean(vTrk);
290
291 if(thetaCerExp<=0){ // HMPID does not find anything reasonable for this track, assign 0.2 for all species
292 for(Int_t iPart=0;iPart<nSpecies;iPart++) prob[iPart]=1.0/(Float_t)nSpecies;
293 return;
294 }
295
296 Double_t p[3] = {0,0,0};
297
298 if(!(vTrk->GetOuterHmpPxPyPz(p))) for(Int_t iPart=0;iPart<nSpecies;iPart++) prob[iPart]=1.0/(Float_t)nSpecies;
299
300 Double_t hTot=0; // Initialize the total height of the amplitude method
301 Double_t *h = new Double_t [nSpecies]; // number of charged particles to be considered
302
303 Bool_t desert = kTRUE; // Flag to evaluate if ThetaC is far ("desert") from the given Gaussians
304
305 for(Int_t iPart=0;iPart<nSpecies;iPart++){ // for each particle
306
307
308 h[iPart] = 0; // reset the height
309 Double_t thetaCerTh = ExpectedSignal(vTrk,nmean,(AliPID::EParticleType)iPart); // theoretical Theta Cherenkov
310 if(thetaCerTh>900.) continue; // no light emitted, zero height
311 Double_t sigmaRing = ExpectedSigma(vTrk,nmean,(AliPID::EParticleType)iPart);
312
313 if(sigmaRing==0) continue;
314
315 if(TMath::Abs(thetaCerExp-thetaCerTh)<4*sigmaRing) desert = kFALSE;
316 h[iPart] =TMath::Gaus(thetaCerTh,thetaCerExp,sigmaRing,kTRUE);
317 hTot +=h[iPart]; // total height of all theoretical heights for normalization
318
319 }//species loop
320
321 for(Int_t iPart=0;iPart<nSpecies;iPart++) { // species loop to assign probabilities
322
323 if(!desert) prob[iPart]=h[iPart]/hTot;
324 else prob[iPart]=1.0/(Float_t)nSpecies; // all theoretical values are far away from experemental one
325
326 }
327
328 delete [] h;
329}
330//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
331Double_t AliHMPIDPIDResponse::GetSignalDelta(const AliVTrack *vTrk, AliPID::EParticleType specie) const {
332
333 //
334 // calculation of Experimental Cherenkov angle - Theoretical Cherenkov angle
335 //
336 const Double_t delta = vTrk->GetHMPIDsignal() - GetExpectedSignal(vTrk,specie);
337
338 return delta;
339
340}
341//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
342TVector2 AliHMPIDPIDResponse::TracePhot(Double_t xRa, Double_t yRa, Double_t thRa, Double_t phRa, Double_t ckovThe,Double_t ckovPhi) const {
343
344// Trace a single Ckov photon from emission point somewhere in radiator up to photocathode taking into account ref indexes of materials it travereses
345// Returns: distance between photon point on PC and track projection
346
347 Double_t theta=0.,phi=0.;
348 TVector3 dirTRS,dirLORS;
349 dirTRS.SetMagThetaPhi(1,ckovThe,ckovPhi); //photon in TRS
350 Trs2Lors(thRa,phRa,dirTRS,theta,phi);
351 dirLORS.SetMagThetaPhi(1,theta,phi); //photon in LORS
352 return TraceForward(xRa,yRa,dirLORS); //now foward tracing
353}//TracePhot()
354//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
355TVector2 AliHMPIDPIDResponse::TraceForward(Double_t xRa, Double_t yRa, TVector3 dirCkov) const {
356
357// Trace forward a photon from (x,y) up to PC
358// Returns: pos of traced photon at PC
359
360 TVector2 pos(-999,-999);
361 Double_t thetaCer = dirCkov.Theta();
362 if(thetaCer > TMath::ASin(1./GetRefIdx())) return pos; //total refraction on WIN-GAP boundary
363 Double_t zRad= -0.5*RadThick()-0.5*WinThick(); //z position of middle of RAD
364 TVector3 posCkov(xRa,yRa,zRad); //RAD: photon position is track position @ middle of RAD
365 Propagate(dirCkov,posCkov, -0.5*WinThick()); //go to RAD-WIN boundary
366 Refract (dirCkov, GetRefIdx(),WinIdx()); //RAD-WIN refraction
367 Propagate(dirCkov,posCkov, 0.5*WinThick()); //go to WIN-GAP boundary
368 Refract (dirCkov, WinIdx(),GapIdx()); //WIN-GAP refraction
369 Propagate(dirCkov,posCkov,0.5*WinThick()+GapThick()); //go to PC
370 pos.Set(posCkov.X(),posCkov.Y());
371 return pos;
372}//TraceForward()
373//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
374void AliHMPIDPIDResponse::Propagate(const TVector3 dir,TVector3 &pos,Double_t z) const {
375
376// Finds an intersection point between a line and XY plane shifted along Z.
377// Arguments: dir,pos - vector along the line and any point of the line
378// z - z coordinate of plain
379// Returns: none
380// On exit: pos is the position if this intesection if any
381
382 static TVector3 nrm(0,0,1);
383 TVector3 pnt(0,0,z);
384
385 TVector3 diff=pnt-pos;
386 Double_t sint=(nrm*diff)/(nrm*dir);
387 pos+=sint*dir;
388}//Propagate()
389//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
390void AliHMPIDPIDResponse::Refract(TVector3 &dir,Double_t n1,Double_t n2) const {
391
392// Refract direction vector according to Snell law
393// Arguments:
394// n1 - ref idx of first substance
395// n2 - ref idx of second substance
396// Returns: none
397// On exit: dir is new direction
398
399 Double_t sinref=(n1/n2)*TMath::Sin(dir.Theta());
400 if(TMath::Abs(sinref)>1.) dir.SetXYZ(-999,-999,-999);
401 else dir.SetTheta(TMath::ASin(sinref));
402}//Refract()
403//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
404void AliHMPIDPIDResponse::Trs2Lors(Double_t thRa, Double_t phRa, TVector3 dirCkov,Double_t &thetaCer,Double_t &phiCer) const {
405
406 // Theta Cerenkov reconstruction
407 // Returns: thetaCer of photon in LORS
408 // phiCer of photon in LORS
409
410 TRotation mtheta; mtheta.RotateY(thRa);
411 TRotation mphi; mphi.RotateZ(phRa);
412 TRotation mrot=mphi*mtheta;
413 TVector3 dirCkovLORS;
414 dirCkovLORS=mrot*dirCkov;
415 phiCer = dirCkovLORS.Phi(); //actual value of the phi of the photon
416 thetaCer= dirCkovLORS.Theta(); //actual value of thetaCerenkov of the photon
417}
418//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
419Bool_t AliHMPIDPIDResponse::IsInDead(Float_t x,Float_t y) {
420
421// Check is the current point is outside of sensitive area or in dead zones
422// Arguments: x,y -position
423// Returns: 1 if not in sensitive zone
424
425 for(Int_t iPc=0;iPc<6;iPc++)
426 if(x>=fgkMinPcX[iPc] && x<=fgkMaxPcX[iPc] && y>=fgkMinPcY[iPc] && y<=fgkMaxPcY [iPc]) return kFALSE; //in current pc
427
428 return kTRUE;
429}
430//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
431Double_t AliHMPIDPIDResponse::Sigma2(Double_t trkTheta,Double_t trkPhi,Double_t ckovTh, Double_t ckovPh) const {
432
433// Analithical calculation of total error (as a sum of localization, geometrical and chromatic errors) on Cerenkov angle for a given Cerenkov photon
434// created by a given MIP. Formules according to CERN-EP-2000-058
435// Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians]
436// dip and azimuthal angles for MIP taken at the entrance to radiator, [radians]
437// MIP beta
438// Returns: absolute error on Cerenkov angle, [radians]
439
440 TVector3 v(-999,-999,-999);
441 Double_t trkBeta = 1./(TMath::Cos(ckovTh)*GetRefIdx());
442
443 if(trkBeta > 1) trkBeta = 1; //protection against bad measured thetaCer
444 if(trkBeta < 0) trkBeta = 0.0001; //
445
446 v.SetX(SigLoc (trkTheta,trkPhi,ckovTh,ckovPh,trkBeta));
447 v.SetY(SigGeom(trkTheta,trkPhi,ckovTh,ckovPh,trkBeta));
448 v.SetZ(SigCrom(trkTheta,ckovTh,ckovPh,trkBeta));
449
450 return v.Mag2();
451}
452//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
453Double_t AliHMPIDPIDResponse::SigLoc(Double_t trkTheta,Double_t trkPhi,Double_t thetaC, Double_t phiC,Double_t betaM) const {
454
455// Analitical calculation of localization error (due to finite segmentation of PC) on Cerenkov angle for a given Cerenkov photon
456// created by a given MIP. Fromulae according to CERN-EP-2000-058
457// Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians]
458// dip and azimuthal angles for MIP taken at the entrance to radiator, [radians]
459// MIP beta
460// Returns: absolute error on Cerenkov angle, [radians]
461
462 Double_t phiDelta = phiC;
463
464 Double_t sint = TMath::Sin(trkTheta);
465 Double_t cost = TMath::Cos(trkTheta);
466 Double_t sinf = TMath::Sin(trkPhi);
467 Double_t cosf = TMath::Cos(trkPhi);
468 Double_t sinfd = TMath::Sin(phiDelta);
469 Double_t cosfd = TMath::Cos(phiDelta);
470 Double_t tantheta = TMath::Tan(thetaC);
471
472 Double_t alpha =cost-tantheta*cosfd*sint; // formula (11)
473 Double_t k = 1.-GetRefIdx()*GetRefIdx()+alpha*alpha/(betaM*betaM); // formula (after 8 in the text)
474 if (k<0) return 1e10;
475 Double_t mu =sint*sinf+tantheta*(cost*cosfd*sinf+sinfd*cosf); // formula (10)
476 Double_t e =sint*cosf+tantheta*(cost*cosfd*cosf-sinfd*sinf); // formula (9)
477
478 Double_t kk = betaM*TMath::Sqrt(k)/(GapThick()*alpha); // formula (6) and (7)
479 Double_t dtdxc = kk*(k*(cosfd*cosf-cost*sinfd*sinf)-(alpha*mu/(betaM*betaM))*sint*sinfd); // formula (6)
480 Double_t dtdyc = kk*(k*(cosfd*sinf+cost*sinfd*cosf)+(alpha* e/(betaM*betaM))*sint*sinfd); // formula (7) pag.4
481
482 Double_t errX = 0.2,errY=0.25; //end of page 7
483 return TMath::Sqrt(errX*errX*dtdxc*dtdxc + errY*errY*dtdyc*dtdyc);
484}
485//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
486Double_t AliHMPIDPIDResponse::SigCrom(Double_t trkTheta,Double_t thetaC, Double_t phiC,Double_t betaM) const {
487
488// Analitical calculation of chromatic error (due to lack of knowledge of Cerenkov photon energy) on Cerenkov angle for a given Cerenkov photon
489// created by a given MIP. Fromulae according to CERN-EP-2000-058
490// Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians]
491// dip and azimuthal angles for MIP taken at the entrance to radiator, [radians]
492// MIP beta
493// Returns: absolute error on Cerenkov angle, [radians]
494
495 Double_t phiDelta = phiC;
496
497 Double_t sint = TMath::Sin(trkTheta);
498 Double_t cost = TMath::Cos(trkTheta);
499 Double_t cosfd = TMath::Cos(phiDelta);
500 Double_t tantheta = TMath::Tan(thetaC);
501
502 Double_t alpha =cost-tantheta*cosfd*sint; // formula (11)
503 Double_t dtdn = cost*GetRefIdx()*betaM*betaM/(alpha*tantheta); // formula (12)
504
505 Double_t f = 0.0172*(7.75-5.635)/TMath::Sqrt(24.);
506
507 return f*dtdn;
508}//SigCrom()
509//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
510Double_t AliHMPIDPIDResponse::SigGeom(Double_t trkTheta,Double_t trkPhi,Double_t thetaC, Double_t phiC,Double_t betaM) const {
511
512// Analitical calculation of geometric error (due to lack of knowledge of creation point in radiator) on Cerenkov angle for a given Cerenkov photon
513// created by a given MIP. Formulae according to CERN-EP-2000-058
514// Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians]
515// dip and azimuthal angles for MIP taken at the entrance to radiator, [radians]
516// MIP beta
517// Returns: absolute error on Cerenkov angle, [radians]
518
519 Double_t phiDelta = phiC;
520
521 Double_t sint = TMath::Sin(trkTheta);
522 Double_t cost = TMath::Cos(trkTheta);
523 Double_t sinf = TMath::Sin(trkPhi);
524 Double_t cosfd = TMath::Cos(phiDelta);
525 Double_t costheta = TMath::Cos(thetaC);
526 Double_t tantheta = TMath::Tan(thetaC);
527
528 Double_t alpha =cost-tantheta*cosfd*sint; // formula (11)
529
530 Double_t k = 1.-GetRefIdx()*GetRefIdx()+alpha*alpha/(betaM*betaM); // formula (after 8 in the text)
531 if (k<0) return 1e10;
532
533 Double_t eTr = 0.5*RadThick()*betaM*TMath::Sqrt(k)/(GapThick()*alpha); // formula (14)
534 Double_t lambda = (1.-sint*sinf)*(1.+sint*sinf); // formula (15)
535
536 Double_t c1 = 1./(1.+ eTr*k/(alpha*alpha*costheta*costheta)); // formula (13.a)
537 Double_t c2 = betaM*TMath::Power(k,1.5)*tantheta*lambda/(GapThick()*alpha*alpha); // formula (13.b)
538 Double_t c3 = (1.+eTr*k*betaM*betaM)/((1+eTr)*alpha*alpha); // formula (13.c)
539 Double_t c4 = TMath::Sqrt(k)*tantheta*(1-lambda)/(GapThick()*betaM); // formula (13.d)
540 Double_t dtdT = c1 * (c2+c3*c4);
541 Double_t trErr = RadThick()/(TMath::Sqrt(12.)*cost);
542
543 return trErr*dtdT;
544}//SigGeom()
545//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
546Double_t AliHMPIDPIDResponse::GetNMean(const AliVTrack *vTrk) const {
547
548 //
549 // mean refractive index calculation
550 //
551 Double_t nmean = -999.;
552
553 Float_t xPc=0.,yPc=0.,thRa=0.,phRa=0.;
554 vTrk->GetHMPIDtrk(xPc,yPc,thRa,phRa);
555
556 const Int_t ch = vTrk->GetHMPIDcluIdx()/1000000;
557
558 const Double_t yRa = yPc - (RadThick()+WinThick()+GapThick())*TMath::Sin(phRa)*TMath::Tan(thRa); //just linear extrapolation back to RAD
559
560 TF1 *RefIndex=0x0;
561
562 if(GetRefIndexArray()) RefIndex = (TF1*)(GetRefIndexArray()->At(ch));
563 else return nmean;
564
565 if(RefIndex) nmean = RefIndex->Eval(yRa);
566 else return nmean;
567
568 return nmean;
569}
570//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
571Double_t AliHMPIDPIDResponse::SigmaCorrFact (Int_t iPart, Double_t occupancy) {
572
573// calculation of sigma correction factor
574
575 Double_t corr = 1.0;
576
577 switch(iPart) {
578 case 0: corr = 0.115*occupancy + 1.166; break;
579 case 1: corr = 0.115*occupancy + 1.166; break;
580 case 2: corr = 0.115*occupancy + 1.166; break;
581 case 3: corr = 0.065*occupancy + 1.137; break;
582 case 4: corr = 0.048*occupancy + 1.202; break;
583 }
584 return corr;
585}
586