]>
Commit | Line | Data |
---|---|---|
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 | ||
24 | #include "AliHMPIDRecon.h" //class header | |
25 | #include "AliHMPIDCluster.h" //CkovAngle() | |
26 | #include <TRotation.h> //TracePhoton() | |
27 | #include <TH1D.h> //HoughResponse() | |
28 | #include <TClonesArray.h> //CkovAngle() | |
29 | ||
30 | #include <TTree.h> //Display() | |
31 | #include <TFile.h> //Display() | |
32 | #include <AliESD.h> //Display() | |
33 | #include <TPolyMarker.h> //Display() | |
34 | #include <TLatex.h> //Display() | |
35 | #include <TCanvas.h> //Display() | |
36 | ||
37 | ||
38 | const Double_t AliHMPIDRecon::fgkRadThick=1.5; | |
39 | const Double_t AliHMPIDRecon::fgkWinThick=0.5; | |
40 | const Double_t AliHMPIDRecon::fgkGapThick=8.0; | |
41 | const Double_t AliHMPIDRecon::fgkRadIdx =1.292; | |
42 | const Double_t AliHMPIDRecon::fgkWinIdx =1.5787; | |
43 | const Double_t AliHMPIDRecon::fgkGapIdx =1.0005; | |
44 | ||
45 | ||
46 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
47 | AliHMPIDRecon::AliHMPIDRecon():TTask("RichRec","RichPat"), | |
48 | fPhotCnt(-1), | |
49 | fCkovSigma2(0), | |
50 | fIsWEIGHT(kFALSE), | |
51 | fDTheta(0.001), | |
52 | fWindowWidth(0.045), | |
53 | fTrkDir(TVector3(0,0,1)),fTrkPos(TVector2(30,40)) | |
54 | { | |
55 | // main ctor | |
56 | for (Int_t i=0; i<3000; i++) { | |
57 | fPhotFlag[i] = 0; | |
58 | fPhotCkov[i] = -1; | |
59 | fPhotPhi [i] = -1; | |
60 | fPhotWei [i] = 0; | |
61 | } | |
62 | } | |
63 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
64 | Double_t AliHMPIDRecon::CkovAngle(TClonesArray *pCluLst,Int_t &iNaccepted) | |
65 | { | |
66 | // Pattern recognition method based on Hough transform | |
67 | // Arguments: pCluLst - list of clusters for this chamber | |
68 | // Returns: - track ckov angle, [rad], | |
69 | ||
70 | if(pCluLst->GetEntries()>200) fIsWEIGHT = kTRUE; // offset to take into account bkg in reconstruction | |
71 | else fIsWEIGHT = kFALSE; | |
72 | ||
73 | // Photon Flag: Flag = 0 initial set; Flag = 1 good candidate (charge compatible with photon); Flag = 2 photon used for the ring; | |
74 | ||
75 | fPhotCnt=0; | |
76 | for (Int_t iClu=0; iClu<pCluLst->GetEntriesFast();iClu++){//clusters loop | |
77 | AliHMPIDCluster *pClu=(AliHMPIDCluster*)pCluLst->UncheckedAt(iClu); //get pointer to current cluster | |
78 | if(pClu->Q()>100) continue; //avoid MIP clusters from bkg | |
79 | ||
80 | fPhotCkov[fPhotCnt]=FindPhotCkov(pClu->X(),pClu->Y()); //find ckov angle for this photon candidate | |
81 | fPhotCnt++; //increment counter of photon candidates | |
82 | }//clusters loop | |
83 | ||
84 | iNaccepted=FlagPhot(HoughResponse()); //flag photons according to individual theta ckov with respect to most probable track theta ckov | |
85 | if(iNaccepted<1) return -11; | |
86 | else return FindRingCkov(pCluLst->GetEntries()); //find best Theta ckov for ring i.e. track | |
87 | }//ThetaCerenkov() | |
88 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
89 | Double_t AliHMPIDRecon::FindPhotCkov(Double_t cluX,Double_t cluY) | |
90 | { | |
91 | // Finds Cerenkov angle for this photon candidate | |
92 | // Arguments: cluX,cluY - position of cadidate's cluster | |
93 | // Returns: Cerenkov angle | |
94 | ||
95 | TVector2 pos(cluX,cluY); Double_t cluR=(pos-fTrkPos).Mod(); Double_t phi=FindPhotPhi(cluX,cluY); | |
d3da6dc4 | 96 | Double_t ckov1=0,ckov2=0.75; |
97 | const Double_t kTol=0.05; | |
98 | Int_t iIterCnt = 0; | |
99 | while(1){ | |
100 | if(iIterCnt>=50) return -1; | |
101 | Double_t ckov=0.5*(ckov1+ckov2); | |
102 | Double_t dist=cluR-TracePhot(ckov,phi,pos); iIterCnt++; //get distance between trial point and cluster position | |
d3da6dc4 | 103 | if (dist> kTol) ckov1=ckov; //cluster @ larger ckov |
104 | else if(dist<-kTol) ckov2=ckov; //cluster @ smaller ckov | |
105 | else return ckov; //precision achived | |
106 | } | |
107 | }//FindPhotTheta() | |
108 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
109 | Double_t AliHMPIDRecon::FindPhotPhi(Double_t cluX,Double_t cluY) | |
110 | { | |
111 | // Finds phi angle og photon candidate by considering the cluster's position of this candudate w.r.t track position | |
112 | ||
113 | Double_t emiss=0; | |
114 | return fPhotPhi[fPhotCnt]=TMath::ATan2(cluY-fTrkPos.Y()-emiss*TMath::Tan(fTrkDir.Theta())*TMath::Sin(fTrkDir.Phi()), | |
115 | cluX-fTrkPos.X()-emiss*TMath::Tan(fTrkDir.Theta())*TMath::Cos(fTrkDir.Phi())); | |
116 | } | |
117 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
118 | Double_t AliHMPIDRecon::FindRingArea(Double_t ckovAng)const | |
119 | { | |
120 | // Find area inside the cerenkov ring which lays inside PCs | |
121 | // Arguments: ckovThe - cernkov | |
122 | // Returns: area of the ring in cm^2 for given theta ckov | |
123 | ||
124 | ||
125 | TVector2 pos1,pos2; | |
126 | ||
127 | const Int_t kN=100; | |
128 | Double_t area=0; | |
129 | for(Int_t i=0;i<kN;i++){ | |
130 | TracePhot(ckovAng,Double_t(TMath::TwoPi()*i /kN),pos1);//trace this photon | |
131 | TracePhot(ckovAng,Double_t(TMath::TwoPi()*(i+1)/kN),pos2);//trace this photon | |
132 | area+=(pos1-fTrkPos)*(pos2-fTrkPos); | |
133 | ||
134 | } | |
135 | return area; | |
136 | }//FindRingArea() | |
137 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
138 | Double_t AliHMPIDRecon::FindRingCkov(Int_t) | |
139 | { | |
140 | // 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 | |
141 | // collecting errors for all single Ckov candidates thetas. (Assuming they are independent) | |
142 | // Arguments: iNclus- total number of clusters in chamber for background estimation | |
143 | // Return: best estimation of track Theta ckov | |
144 | ||
145 | Double_t wei = 0.; | |
146 | Double_t weightThetaCerenkov = 0.; | |
147 | ||
148 | Double_t ckovMin=9999.,ckovMax=0.; | |
149 | Double_t sigma2 = 0; //to collect error squared for this ring | |
150 | ||
151 | for(Int_t i=0;i<fPhotCnt;i++){//candidates loop | |
152 | if(fPhotFlag[i] == 2){ | |
3c6274c1 | 153 | if(fPhotCkov[i]<=0) continue;//?????????????????Flag photos = 2 may imply CkovEta = 0?????????????? |
d3da6dc4 | 154 | if(fPhotCkov[i]<ckovMin) ckovMin=fPhotCkov[i]; //find max and min Theta ckov from all candidates within probable window |
155 | if(fPhotCkov[i]>ckovMax) ckovMax=fPhotCkov[i]; | |
156 | weightThetaCerenkov += fPhotCkov[i]*fPhotWei[i]; wei += fPhotWei[i]; //collect weight as sum of all candidate weghts | |
157 | ||
d3da6dc4 | 158 | sigma2 += 1./Sigma2(fPhotCkov[i],fPhotPhi[i]); |
159 | } | |
160 | }//candidates loop | |
161 | ||
162 | if(sigma2>0) fCkovSigma2=1./sigma2; | |
163 | else fCkovSigma2=1e10; | |
164 | ||
d3da6dc4 | 165 | if(wei != 0.) weightThetaCerenkov /= wei; else weightThetaCerenkov = 0.; |
166 | return weightThetaCerenkov; | |
167 | }//FindCkovRing() | |
168 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
169 | Int_t AliHMPIDRecon::FlagPhot(Double_t ckov) | |
170 | { | |
171 | // Flag photon candidates if their individual ckov angle is inside the window around ckov angle returned by HoughResponse() | |
172 | // Arguments: ckov- value of most probable ckov angle for track as returned by HoughResponse() | |
173 | // Returns: number of photon candidates happened to be inside the window | |
174 | ||
175 | ||
176 | Int_t steps = (Int_t)((ckov )/ fDTheta); //how many times we need to have fDTheta to fill the distance between 0 and thetaCkovHough | |
177 | ||
178 | Double_t tmin = (Double_t)(steps - 1)*fDTheta; | |
179 | Double_t tmax = (Double_t)(steps)*fDTheta; | |
180 | Double_t tavg = 0.5*(tmin+tmax); | |
181 | ||
182 | tmin = tavg - 0.5*fWindowWidth; tmax = tavg + 0.5*fWindowWidth; | |
183 | ||
184 | Int_t iInsideCnt = 0; //count photons which Theta ckov inside the window | |
185 | for(Int_t i=0;i<fPhotCnt;i++){//photon candidates loop | |
186 | if(fPhotCkov[i] >= tmin && fPhotCkov[i] <= tmax) { | |
187 | fPhotFlag[i]=2; | |
188 | iInsideCnt++; | |
189 | } | |
190 | } | |
191 | return iInsideCnt; | |
192 | }//FlagPhot() | |
193 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
194 | Double_t AliHMPIDRecon::TracePhot(Double_t ckovThe,Double_t ckovPhi,TVector2 &pos)const | |
195 | { | |
196 | // Trace a single Ckov photon from emission point somewhere in radiator up to photocathode taking into account ref indexes of materials it travereses | |
197 | // Arguments: ckovThe,ckovPhi- photon ckov angles, [rad] (warning: not photon theta and phi) | |
198 | // Returns: distance between photon point on PC and track projection | |
199 | TRotation mtheta; mtheta.RotateY(fTrkDir.Theta()); | |
200 | TRotation mphi; mphi.RotateZ(fTrkDir.Phi()); | |
201 | TRotation mrot=mphi*mtheta; | |
202 | ||
203 | TVector3 posCkov(fTrkPos.X(),fTrkPos.Y(),-0.5*fgkRadThick-fgkWinThick-fgkGapThick); //RAD: photon position is track position @ middle of RAD | |
204 | TVector3 dirCkov; dirCkov.SetMagThetaPhi(1,ckovThe,ckovPhi); //initially photon is directed according to requested ckov angle | |
205 | dirCkov=mrot*dirCkov; //now we know photon direction in LORS | |
206 | dirCkov.SetPhi(ckovPhi); | |
207 | if(dirCkov.Theta() > TMath::ASin(1./fgkRadIdx)) return -999;//total refraction on WIN-GAP boundary | |
208 | ||
209 | Propagate(dirCkov,posCkov,-fgkWinThick-fgkGapThick); //go to RAD-WIN boundary remeber that z=0 is PC plane | |
210 | Refract (dirCkov, fgkRadIdx,fgkWinIdx ); //RAD-WIN refraction | |
211 | Propagate(dirCkov,posCkov,-fgkGapThick ); //go to WIN-GAP boundary | |
212 | Refract (dirCkov, fgkWinIdx,fgkGapIdx ); //WIN-GAP refraction | |
213 | Propagate(dirCkov,posCkov,0 ); //go to PC | |
214 | ||
215 | pos.Set(posCkov.X(),posCkov.Y()); | |
216 | return (pos-fTrkPos).Mod(); | |
217 | }//TracePhoton() | |
218 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
219 | void AliHMPIDRecon::Propagate(const TVector3 &dir,TVector3 &pos,Double_t z)const | |
220 | { | |
221 | // Finds an intersection point between a line and XY plane shifted along Z. | |
222 | // Arguments: dir,pos - vector along the line and any point of the line | |
223 | // z - z coordinate of plain | |
224 | // Returns: none | |
225 | // On exit: pos is the position if this intesection if any | |
226 | static TVector3 nrm(0,0,1); | |
227 | TVector3 pnt(0,0,z); | |
228 | ||
229 | TVector3 diff=pnt-pos; | |
230 | Double_t sint=(nrm*diff)/(nrm*dir); | |
231 | pos+=sint*dir; | |
232 | }//Propagate() | |
233 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
234 | void AliHMPIDRecon::Refract(TVector3 &dir,Double_t n1,Double_t n2)const | |
235 | { | |
236 | // Refract direction vector according to Snell law | |
237 | // Arguments: | |
238 | // n1 - ref idx of first substance | |
239 | // n2 - ref idx of second substance | |
240 | // Returns: none | |
241 | // On exit: dir is new direction | |
242 | Double_t sinref=(n1/n2)*TMath::Sin(dir.Theta()); | |
243 | if(sinref>1.) dir.SetXYZ(-999,-999,-999); | |
244 | else dir.SetTheta(TMath::ASin(sinref)); | |
245 | }//Refract() | |
246 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
247 | Double_t AliHMPIDRecon::HoughResponse() | |
248 | { | |
249 | // | |
250 | // | |
251 | // | |
252 | Double_t kThetaMax=0.75; | |
253 | Int_t nChannels = (Int_t)(kThetaMax/fDTheta+0.5); | |
254 | TH1D *phots = new TH1D("Rphot" ,"phots" ,nChannels,0,kThetaMax); | |
255 | TH1D *photsw = new TH1D("RphotWeighted" ,"photsw" ,nChannels,0,kThetaMax); | |
256 | TH1D *resultw = new TH1D("resultw","resultw" ,nChannels,0,kThetaMax); | |
257 | Int_t nBin = (Int_t)(kThetaMax/fDTheta); | |
258 | Int_t nCorrBand = (Int_t)(fWindowWidth/(2*fDTheta)); | |
259 | ||
260 | for (Int_t i=0; i< fPhotCnt; i++){//photon cadidates loop | |
261 | Double_t angle = fPhotCkov[i]; if(angle<0||angle>kThetaMax) continue; | |
262 | phots->Fill(angle); | |
263 | Int_t bin = (Int_t)(0.5+angle/(fDTheta)); | |
264 | Double_t weight=1.; | |
265 | if(fIsWEIGHT){ | |
266 | Double_t lowerlimit = ((Double_t)bin)*fDTheta - 0.5*fDTheta; Double_t upperlimit = ((Double_t)bin)*fDTheta + 0.5*fDTheta; | |
267 | Double_t diffArea = FindRingArea(upperlimit)-FindRingArea(lowerlimit); | |
268 | if(diffArea>0) weight = 1./diffArea; | |
269 | } | |
270 | photsw->Fill(angle,weight); | |
271 | fPhotWei[i]=weight; | |
272 | }//photon candidates loop | |
273 | ||
274 | for (Int_t i=1; i<=nBin;i++){ | |
275 | Int_t bin1= i-nCorrBand; | |
276 | Int_t bin2= i+nCorrBand; | |
277 | if(bin1<1) bin1=1; | |
278 | if(bin2>nBin)bin2=nBin; | |
279 | Double_t sumPhots=phots->Integral(bin1,bin2); | |
280 | if(sumPhots<3) continue; // if less then 3 photons don't trust to this ring | |
281 | Double_t sumPhotsw=photsw->Integral(bin1,bin2); | |
282 | resultw->Fill((Double_t)((i+0.5)*fDTheta),sumPhotsw); | |
283 | } | |
284 | // evaluate the "BEST" theta ckov as the maximum value of histogramm | |
285 | Double_t *pVec = resultw->GetArray(); | |
286 | Int_t locMax = TMath::LocMax(nBin,pVec); | |
287 | phots->Delete();photsw->Delete();resultw->Delete(); // Reset and delete objects | |
288 | ||
289 | return (Double_t)(locMax*fDTheta+0.5*fDTheta); //final most probable track theta ckov | |
290 | }//HoughResponse() | |
291 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
292 | Double_t AliHMPIDRecon::Sigma2(Double_t ckovTh, Double_t ckovPh)const | |
293 | { | |
294 | // Analithical calculation of total error (as a sum of localization, geometrical and chromatic errors) on Cerenkov angle for a given Cerenkov photon | |
295 | // created by a given MIP. Fromulae according to CERN-EP-2000-058 | |
296 | // Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians] | |
297 | // dip and azimuthal angles for MIP taken at the entrance to radiator, [radians] | |
298 | // MIP beta | |
299 | // Returns: absolute error on Cerenkov angle, [radians] | |
300 | ||
301 | TVector3 v(-999,-999,-999); | |
302 | Double_t trkBeta = 1./(TMath::Cos(ckovTh)*fgkRadIdx); | |
303 | ||
304 | v.SetX(SigLoc (ckovTh,ckovPh,trkBeta)); | |
305 | v.SetY(SigGeom(ckovTh,ckovPh,trkBeta)); | |
306 | v.SetZ(SigCrom(ckovTh,ckovPh,trkBeta)); | |
307 | ||
308 | return v.Mag2(); | |
309 | } | |
310 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
311 | Double_t AliHMPIDRecon::SigLoc(Double_t thetaC, Double_t phiC,Double_t betaM)const | |
312 | { | |
313 | // Analithical calculation of localization error (due to finite segmentation of PC) on Cerenkov angle for a given Cerenkov photon | |
314 | // created by a given MIP. Fromulae according to CERN-EP-2000-058 | |
315 | // Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians] | |
316 | // dip and azimuthal angles for MIP taken at the entrance to radiator, [radians] | |
317 | // MIP beta | |
318 | // Returns: absolute error on Cerenkov angle, [radians] | |
319 | Double_t phiDelta = phiC - fTrkDir.Phi(); | |
320 | ||
321 | Double_t alpha =TMath::Cos(fTrkDir.Theta())-TMath::Tan(thetaC)*TMath::Cos(phiDelta)*TMath::Sin(fTrkDir.Theta()); | |
322 | Double_t k = 1.-fgkRadIdx*fgkRadIdx+alpha*alpha/(betaM*betaM); | |
323 | if (k<0) return 1e10; | |
324 | ||
325 | 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())); | |
326 | 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())); | |
327 | ||
328 | Double_t kk = betaM*TMath::Sqrt(k)/(8*alpha); | |
329 | 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)); | |
330 | 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)); | |
331 | ||
332 | return TMath::Sqrt(0.2*0.2*dtdxc*dtdxc + 0.25*0.25*dtdyc*dtdyc); | |
333 | } | |
334 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
335 | Double_t AliHMPIDRecon::SigCrom(Double_t thetaC, Double_t phiC,Double_t betaM)const | |
336 | { | |
337 | // Analithical calculation of chromatic error (due to lack of knowledge of Cerenkov photon energy) on Cerenkov angle for a given Cerenkov photon | |
338 | // created by a given MIP. Fromulae according to CERN-EP-2000-058 | |
339 | // Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians] | |
340 | // dip and azimuthal angles for MIP taken at the entrance to radiator, [radians] | |
341 | // MIP beta | |
342 | // Returns: absolute error on Cerenkov angle, [radians] | |
343 | Double_t phiDelta = phiC - fTrkDir.Phi(); | |
344 | Double_t alpha =TMath::Cos(fTrkDir.Theta())-TMath::Tan(thetaC)*TMath::Cos(phiDelta)*TMath::Sin(fTrkDir.Theta()); | |
345 | ||
346 | Double_t dtdn = TMath::Cos(fTrkDir.Theta())*fgkRadIdx*betaM*betaM/(alpha*TMath::Tan(thetaC)); | |
347 | ||
348 | Double_t f = 0.00928*(7.75-5.635)/TMath::Sqrt(12.); | |
349 | ||
350 | return f*dtdn; | |
351 | }//SigCrom() | |
352 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
353 | Double_t AliHMPIDRecon::SigGeom(Double_t thetaC, Double_t phiC,Double_t betaM)const | |
354 | { | |
355 | // Analithical calculation of geometric error (due to lack of knowledge of creation point in radiator) on Cerenkov angle for a given Cerenkov photon | |
356 | // created by a given MIP. Formulae according to CERN-EP-2000-058 | |
357 | // Arguments: Cerenkov and azimuthal angles for Cerenkov photon, [radians] | |
358 | // dip and azimuthal angles for MIP taken at the entrance to radiator, [radians] | |
359 | // MIP beta | |
360 | // Returns: absolute error on Cerenkov angle, [radians] | |
361 | ||
362 | Double_t phiDelta = phiC - fTrkDir.Phi(); | |
363 | Double_t alpha =TMath::Cos(fTrkDir.Theta())-TMath::Tan(thetaC)*TMath::Cos(phiDelta)*TMath::Sin(fTrkDir.Theta()); | |
364 | ||
365 | Double_t k = 1.-fgkRadIdx*fgkRadIdx+alpha*alpha/(betaM*betaM); | |
366 | if (k<0) return 1e10; | |
367 | ||
368 | Double_t eTr = 0.5*1.5*betaM*TMath::Sqrt(k)/(8*alpha); | |
369 | Double_t lambda = 1.-TMath::Sin(fTrkDir.Theta())*TMath::Sin(fTrkDir.Theta())*TMath::Sin(phiC)*TMath::Sin(phiC); | |
370 | ||
371 | Double_t c = 1./(1.+ eTr*k/(alpha*alpha*TMath::Cos(thetaC)*TMath::Cos(thetaC))); | |
372 | Double_t i = betaM*TMath::Tan(thetaC)*lambda*TMath::Power(k,1.5); | |
373 | Double_t ii = 1.+eTr*betaM*i; | |
374 | ||
375 | Double_t err = c * (i/(alpha*alpha*8) + ii*(1.-lambda) / ( alpha*alpha*8*betaM*(1.+eTr)) ); | |
376 | Double_t trErr = 1.5/(TMath::Sqrt(12.)*TMath::Cos(fTrkDir.Theta())); | |
377 | ||
378 | return trErr*err; | |
379 | }//SigGeom() | |
380 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
381 | void AliHMPIDRecon::Display() | |
382 | { | |
383 | // Display digits, reconstructed tracks intersections and HMPID rings if available | |
384 | // Arguments: none | |
385 | // Returns: none | |
386 | TFile *pEsdFl=TFile::Open("AliESDs.root"); if(!pEsdFl || !pEsdFl->IsOpen()) return;//open AliESDs.root | |
387 | TTree *pEsdTr=(TTree*) pEsdFl->Get("esdTree"); if(!pEsdTr) return;//get ESD tree | |
388 | ||
389 | AliESD *pEsd=new AliESD; pEsdTr->SetBranchAddress("ESD", &pEsd); | |
390 | ||
391 | TPolyMarker *pDigMap[7]; //digits map | |
392 | TPolyMarker *pTrkMap[7]; Int_t aTrkCnt[7]; //TRKxPC intersection map | |
393 | ||
394 | for(Int_t i=0;i<7;i++){ | |
395 | pDigMap[i]=new TPolyMarker(); pDigMap[i]->SetMarkerStyle(25); pDigMap[i]->SetMarkerSize(0.5); pDigMap[i]->SetMarkerColor(kGreen); | |
396 | aTrkCnt[i]=0; pTrkMap[i]=new TPolyMarker(); pTrkMap[i]->SetMarkerStyle(4); pTrkMap[i]->SetMarkerSize(0.5); pTrkMap[i]->SetMarkerColor(kRed); | |
397 | } | |
398 | ||
399 | AliHMPIDRecon rec; | |
400 | ||
401 | TLatex t; | |
402 | TCanvas *pC = new TCanvas("HMPIDDisplay","HMPID Display",0,0,1226,900); pC->Divide(3,3); | |
403 | ||
404 | for(Int_t iEvt=0;iEvt<pEsdTr->GetEntries();iEvt++) { //events loop | |
405 | pC->cd(3); t.DrawText(0.2,0.4,Form("Event %i",iEvt)); //print current event number | |
406 | pEsdTr->GetEntry(iEvt); //get ESD for this event | |
407 | for(Int_t iTrk=0;iTrk<pEsd->GetNumberOfTracks();iTrk++){//ESD tracks loop | |
408 | AliESDtrack *pTrk = pEsd->GetTrack(iTrk); // | |
409 | Float_t th,ph,x,y; pTrk->GetHMPIDtrk(x,y,th,ph); if(x<0) continue; | |
cf7e313e | 410 | Int_t ch=pTrk->GetHMPIDcluIdx()/1000000; |
d3da6dc4 | 411 | pTrkMap[ch]->SetPoint(aTrkCnt[ch]++,x,y); |
412 | }//ESD tracks loop | |
413 | ||
414 | // al->GetEvent(iEvt); rl->TreeD()->GetEntry(0); //get digits list | |
415 | for(Int_t iCh=0;iCh<7;iCh++) {//chambers loop | |
416 | // for(Int_t iDig=0;iDig < r->DigLst(iCh)->GetEntries();iDig++) { //digits loop | |
417 | // AliHMPIDDigit *pDig = (AliHMPIDDigit*)r->DigLst(iCh)->At(iDig); | |
418 | // pDigMap[iCh]->SetPoint(iDig,pDig->LorsX(),pDig->LorsY()); | |
419 | // } //digits loop | |
420 | // | |
421 | // | |
422 | if(iCh==6) pC->cd(1); if(iCh==5) pC->cd(2); | |
423 | if(iCh==4) pC->cd(4); if(iCh==3) pC->cd(5); if(iCh==2) pC->cd(6); | |
424 | if(iCh==1) pC->cd(8); if(iCh==0) pC->cd(9); | |
425 | ||
426 | AliHMPIDDigit::DrawPc(); pTrkMap[iCh]->Draw(); pDigMap[iCh]->Draw(); | |
427 | }//chambers loop | |
428 | // pC->Update(); | |
429 | // pC->Modified(); | |
430 | // if(iEvt<iEvtTo) {gPad->WaitPrimitive();pC->Clear();} | |
431 | ||
432 | ||
433 | ||
434 | }//events loop | |
435 | delete pEsd; pEsdFl->Close();//close AliESDs.root | |
436 | // rl->UnloadDigits(); | |
437 | }//Display() |