1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //////////////////////////////////////////////////////////////////////////
20 // HMPID class to perfom pattern recognition based on Hough transfrom //
21 // for single chamber //
22 //////////////////////////////////////////////////////////////////////////
24 #include "AliHMPIDRecon.h" //class header
25 #include "AliHMPIDCluster.h" //CkovAngle()
26 #include <TRotation.h> //TracePhot()
27 #include <TH1D.h> //HoughResponse()
28 #include <TClonesArray.h> //CkovAngle()
29 #include <AliESDtrack.h> //CkovAngle()
30 #include <AliESDfriendTrack.h> //CkovAngle()
32 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
33 AliHMPIDRecon::AliHMPIDRecon():
34 TTask("RichRec","RichPat"),
47 fTrkDir(0,0,1), // Just for test
48 fTrkPos(30,40), // Just for test
51 fParam(AliHMPIDParam::Instance())
54 //init of data members
57 fParam->SetRefIdx(fParam->MeanIdxRad()); // initialization of ref index to a default one
59 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
60 void AliHMPIDRecon::InitVars(Int_t n)
66 fPhotFlag = new Int_t[n];
67 fPhotClusIndex = new Int_t[n];
68 fPhotCkov = new Double_t[n];
69 fPhotPhi = new Double_t[n];
70 fPhotWei = new Double_t[n];
73 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
74 void AliHMPIDRecon::DeleteVars()const
80 delete [] fPhotClusIndex;
85 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
86 void AliHMPIDRecon::CkovAngle(AliESDtrack *pTrk,TClonesArray *pCluLst,Int_t index,Double_t nmean,Float_t xRa,Float_t yRa)
88 // Pattern recognition method based on Hough transform
89 // Arguments: pTrk - track for which Ckov angle is to be found
90 // pCluLst - list of clusters for this chamber
91 // Returns: - track ckov angle, [rad],
94 AliESDfriendTrack *pFriendTrk = (AliESDfriendTrack*)pTrk->GetFriendTrack();
96 const Int_t nMinPhotAcc = 3; // Minimum number of photons required to perform the pattern recognition
98 Int_t nClusTot = pCluLst->GetEntries();
99 if(nClusTot>fParam->MultCut()) fIsWEIGHT = kTRUE; // offset to take into account bkg in reconstruction
100 else fIsWEIGHT = kFALSE;
104 Float_t xPc,yPc,th,ph;
105 pTrk->GetHMPIDtrk(xPc,yPc,th,ph); //initialize this track: th and ph angles at middle of RAD
106 SetTrack(xRa,yRa,th,ph);
108 fParam->SetRefIdx(nmean);
110 Float_t mipX=-1,mipY=-1;
111 Int_t chId=-1,mipQ=-1,sizeClu = -1;
115 for (Int_t iClu=0; iClu<pCluLst->GetEntriesFast();iClu++){//clusters loop
116 AliHMPIDCluster *pClu=(AliHMPIDCluster*)pCluLst->UncheckedAt(iClu); //get pointer to current cluster
117 if(iClu == index) { // this is the MIP! not a photon candidate: just store mip info
120 mipQ=(Int_t)pClu->Q();
121 sizeClu=pClu->Size();
125 Double_t thetaCer,phiCer;
126 if(FindPhotCkov(pClu->X(),pClu->Y(),thetaCer,phiCer)){ //find ckov angle for this photon candidate
127 fPhotCkov[fPhotCnt]=thetaCer; //actual theta Cerenkov (in TRS)
128 fPhotPhi [fPhotCnt]=phiCer;
129 fPhotClusIndex[fPhotCnt]=iClu; //actual phi Cerenkov (in TRS): -pi to come back to "unusual" ref system (X,Y,-Z)
130 fPhotCnt++; //increment counter of photon candidates
134 pTrk->SetHMPIDmip(mipX,mipY,mipQ,fPhotCnt); //store mip info in any case
135 pTrk->SetHMPIDcluIdx(chId,index+1000*sizeClu); //set index of cluster
137 if(fPhotCnt<=nMinPhotAcc) { //no reconstruction with <=3 photon candidates
138 pTrk->SetHMPIDsignal(kNoPhotAccept); //set the appropriate flag
142 fMipPos.Set(mipX,mipY);
144 TClonesArray *pPhotCluLst = pFriendTrk->GetHmpPhotClus();
146 //PATTERN RECOGNITION STARTED:
148 Int_t iNrec=FlagPhot(HoughResponse(),pCluLst,pPhotCluLst); //flag photons according to individual theta ckov with respect to most probable
150 pTrk->SetHMPIDmip(mipX,mipY,mipQ,iNrec); //store mip info
153 pTrk->SetHMPIDsignal(kNoPhotAccept); //no photon candidates are accepted
157 Double_t thetaC = FindRingCkov(pCluLst->GetEntries()); //find the best reconstructed theta Cherenkov
158 // FindRingGeom(thetaC,2);
159 pTrk->SetHMPIDsignal(thetaC); //store theta Cherenkov
160 pTrk->SetHMPIDchi2(fCkovSigma2); //store errors squared
164 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
165 Bool_t AliHMPIDRecon::FindPhotCkov(Double_t cluX,Double_t cluY,Double_t &thetaCer,Double_t &phiCer)
167 // Finds Cerenkov angle for this photon candidate
168 // Arguments: cluX,cluY - position of cadidate's cluster
169 // Returns: Cerenkov angle
173 Double_t zRad= -0.5*fParam->RadThick()-0.5*fParam->WinThick(); //z position of middle of RAD
174 TVector3 rad(fTrkPos.X(),fTrkPos.Y(),zRad); //impact point at middle of RAD
175 TVector3 pc(cluX,cluY,0.5*fParam->WinThick()+fParam->GapIdx()); //mip at PC
176 Double_t cluR = TMath::Sqrt((cluX-fTrkPos.X())*(cluX-fTrkPos.X())+
177 (cluY-fTrkPos.Y())*(cluY-fTrkPos.Y()));//ref. distance impact RAD-CLUSTER
178 Double_t phi=(pc-rad).Phi(); //phi of photon
181 Double_t ckov2=0.75+fTrkDir.Theta(); //start to find theta cerenkov in DRS
182 const Double_t kTol=0.01;
185 if(iIterCnt>=50) return kFALSE;
186 Double_t ckov=0.5*(ckov1+ckov2);
187 dirCkov.SetMagThetaPhi(1,ckov,phi);
188 TVector2 posC=TraceForward(dirCkov); //trace photon with actual angles
189 Double_t dist=cluR-(posC-fTrkPos).Mod(); //get distance between trial point and cluster position
190 if(posC.X()==-999) dist = - 999; //total reflection problem
191 iIterCnt++; //counter step
192 if (dist> kTol) ckov1=ckov; //cluster @ larger ckov
193 else if(dist<-kTol) ckov2=ckov; //cluster @ smaller ckov
194 else{ //precision achived: ckov in DRS found
195 dirCkov.SetMagThetaPhi(1,ckov,phi); //
196 Lors2Trs(dirCkov,thetaCer,phiCer); //find ckov (in TRS:the effective Cherenkov angle!)
201 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
202 TVector2 AliHMPIDRecon::TraceForward(TVector3 dirCkov)const
204 //Trace forward a photon from (x,y) up to PC
205 // Arguments: dirCkov photon vector in LORS
206 // Returns: pos of traced photon at PC
208 TVector2 pos(-999,-999);
209 Double_t thetaCer = dirCkov.Theta();
210 if(thetaCer > TMath::ASin(1./fParam->GetRefIdx())) return pos; //total refraction on WIN-GAP boundary
211 Double_t zRad= -0.5*fParam->RadThick()-0.5*fParam->WinThick(); //z position of middle of RAD
212 TVector3 posCkov(fTrkPos.X(),fTrkPos.Y(),zRad); //RAD: photon position is track position @ middle of RAD
213 Propagate(dirCkov,posCkov, -0.5*fParam->WinThick()); //go to RAD-WIN boundary
214 Refract (dirCkov, fParam->GetRefIdx(),fParam->WinIdx()); //RAD-WIN refraction
215 Propagate(dirCkov,posCkov, 0.5*fParam->WinThick()); //go to WIN-GAP boundary
216 Refract (dirCkov, fParam->WinIdx(),fParam->GapIdx()); //WIN-GAP refraction
217 Propagate(dirCkov,posCkov,0.5*fParam->WinThick()+fParam->GapThick()); //go to PC
218 pos.Set(posCkov.X(),posCkov.Y());
221 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
222 void AliHMPIDRecon::Lors2Trs(TVector3 dirCkov,Double_t &thetaCer,Double_t &phiCer)const
224 //Theta Cerenkov reconstruction
225 // Arguments: dirCkov photon vector in LORS
226 // Returns: thetaCer of photon in TRS
227 // phiCer of photon in TRS
229 // dirTrk.SetMagThetaPhi(1,fTrkDir.Theta(),fTrkDir.Phi());
230 // Double_t thetaCer = TMath::ACos(dirCkov*dirTrk);
231 TRotation mtheta; mtheta.RotateY(-fTrkDir.Theta());
232 TRotation mphi; mphi.RotateZ(-fTrkDir.Phi());
233 TRotation mrot=mtheta*mphi;
235 dirCkovTRS=mrot*dirCkov;
236 phiCer = dirCkovTRS.Phi(); //actual value of the phi of the photon
237 thetaCer= dirCkovTRS.Theta(); //actual value of thetaCerenkov of the photon
239 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
240 void AliHMPIDRecon::Trs2Lors(TVector3 dirCkov,Double_t &thetaCer,Double_t &phiCer)const
242 //Theta Cerenkov reconstruction
243 // Arguments: dirCkov photon vector in TRS
244 // Returns: thetaCer of photon in LORS
245 // phiCer of photon in LORS
246 TRotation mtheta; mtheta.RotateY(fTrkDir.Theta());
247 TRotation mphi; mphi.RotateZ(fTrkDir.Phi());
248 TRotation mrot=mphi*mtheta;
249 TVector3 dirCkovLORS;
250 dirCkovLORS=mrot*dirCkov;
251 phiCer = dirCkovLORS.Phi(); //actual value of the phi of the photon
252 thetaCer= dirCkovLORS.Theta(); //actual value of thetaCerenkov of the photon
254 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
255 void AliHMPIDRecon::FindRingGeom(Double_t ckovAng,Int_t level)
257 // Find area covered in the PC acceptance
258 // Arguments: ckovAng - cerenkov angle
259 // level - precision in finding area and portion of ring accepted (multiple of 50)
260 // Returns: area of the ring in cm^2 for given theta ckov
269 for(Int_t i=0;i<kN;i++){
271 pos1=TracePhot(ckovAng,Double_t(TMath::TwoPi()*(i+1)/kN)); //find a good trace for the first photon
272 if(pos1.X()==-999) continue; //no area: open ring
273 if(!fParam->IsInside(pos1.X(),pos1.Y(),0)) {
274 pos1 = IntWithEdge(fMipPos,pos1); // find the very first intersection...
276 if(!AliHMPIDParam::IsInDead(pos1.X(),pos1.Y())) nPoints++; //photon is accepted if not in dead zone
281 TVector2 pos2=TracePhot(ckovAng,Double_t(TMath::TwoPi()*(i+1)/kN)); //trace the next photon
282 if(pos2.X()==-999) continue; //no area: open ring
283 if(!fParam->IsInside(pos2.X(),pos2.Y(),0)) {
284 pos2 = IntWithEdge(fMipPos,pos2);
286 if(!AliHMPIDParam::IsInDead(pos2.X(),pos2.Y())) nPoints++; //photon is accepted if not in dead zone
288 area+=TMath::Abs((pos1-fMipPos).X()*(pos2-fMipPos).Y()-(pos1-fMipPos).Y()*(pos2-fMipPos).X()); //add area of the triangle...
291 //--- find area and length of the ring;
292 fRingAcc = (Double_t)nPoints/(Double_t)kN;
296 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
297 TVector2 AliHMPIDRecon::IntWithEdge(TVector2 p1,TVector2 p2)const
299 // It finds the intersection of the line for 2 points traced as photons
300 // and the edge of a given PC
301 // Arguments: 2 points obtained tracing the photons
302 // Returns: intersection point with detector (PC) edges
304 Double_t xmin = (p1.X()<p2.X())? p1.X():p2.X();
305 Double_t xmax = (p1.X()<p2.X())? p2.X():p1.X();
306 Double_t ymin = (p1.Y()<p2.Y())? p1.Y():p2.Y();
307 Double_t ymax = (p1.Y()<p2.Y())? p2.Y():p1.Y();
309 Double_t m = TMath::Tan((p2-p1).Phi());
311 //intersection with low X
312 pint.Set((Double_t)(p1.X() + (0-p1.Y())/m),0.);
313 if(pint.X()>=0 && pint.X()<=fParam->SizeAllX() &&
314 pint.X()>=xmin && pint.X()<=xmax &&
315 pint.Y()>=ymin && pint.Y()<=ymax) return pint;
316 //intersection with high X
317 pint.Set((Double_t)(p1.X() + (fParam->SizeAllY()-p1.Y())/m),(Double_t)(fParam->SizeAllY()));
318 if(pint.X()>=0 && pint.X()<=fParam->SizeAllX() &&
319 pint.X()>=xmin && pint.X()<=xmax &&
320 pint.Y()>=ymin && pint.Y()<=ymax) return pint;
321 //intersection with left Y
322 pint.Set(0.,(Double_t)(p1.Y() + m*(0-p1.X())));
323 if(pint.Y()>=0 && pint.Y()<=fParam->SizeAllY() &&
324 pint.Y()>=ymin && pint.Y()<=ymax &&
325 pint.X()>=xmin && pint.X()<=xmax) return pint;
326 //intersection with righ Y
327 pint.Set((Double_t)(fParam->SizeAllX()),(Double_t)(p1.Y() + m*(fParam->SizeAllX()-p1.X())));
328 if(pint.Y()>=0 && pint.Y()<=fParam->SizeAllY() &&
329 pint.Y()>=ymin && pint.Y()<=ymax &&
330 pint.X()>=xmin && pint.X()<=xmax) return pint;
333 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
334 Double_t AliHMPIDRecon::FindRingCkov(Int_t)
336 // 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
337 // collecting errors for all single Ckov candidates thetas. (Assuming they are independent)
338 // Arguments: iNclus- total number of clusters in chamber for background estimation
339 // Return: best estimation of track Theta ckov
342 Double_t weightThetaCerenkov = 0.;
344 Double_t ckovMin=9999.,ckovMax=0.;
345 Double_t sigma2 = 0; //to collect error squared for this ring
347 for(Int_t i=0;i<fPhotCnt;i++){//candidates loop
348 if(fPhotFlag[i] == 2){
349 if(fPhotCkov[i]<ckovMin) ckovMin=fPhotCkov[i]; //find max and min Theta ckov from all candidates within probable window
350 if(fPhotCkov[i]>ckovMax) ckovMax=fPhotCkov[i];
351 weightThetaCerenkov += fPhotCkov[i]*fPhotWei[i];
352 wei += fPhotWei[i]; //collect weight as sum of all candidate weghts
354 sigma2 += 1./fParam->Sigma2(fTrkDir.Theta(),fTrkDir.Phi(),fPhotCkov[i],fPhotPhi[i]);
358 if(sigma2>0) fCkovSigma2=1./sigma2;
359 else fCkovSigma2=1e10;
361 if(wei != 0.) weightThetaCerenkov /= wei; else weightThetaCerenkov = 0.;
362 return weightThetaCerenkov;
364 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
365 Int_t AliHMPIDRecon::FlagPhot(Double_t ckov,TClonesArray *pCluLst, TClonesArray *pPhotCluLst)
367 // Flag photon candidates if their individual ckov angle is inside the window around ckov angle returned by HoughResponse()
368 // Arguments: ckov- value of most probable ckov angle for track as returned by HoughResponse()
369 // Returns: number of photon candidates happened to be inside the window
371 // Photon Flag: Flag = 0 initial set;
372 // Flag = 1 good candidate (charge compatible with photon);
373 // Flag = 2 photon used for the ring;
374 Int_t *PhotIndex = new Int_t[fPhotCnt];
376 Int_t steps = (Int_t)((ckov )/ fDTheta); //how many times we need to have fDTheta to fill the distance between 0 and thetaCkovHough
378 Double_t tmin = (Double_t)(steps - 1)*fDTheta;
379 Double_t tmax = (Double_t)(steps)*fDTheta;
380 Double_t tavg = 0.5*(tmin+tmax);
382 tmin = tavg - 0.5*fWindowWidth; tmax = tavg + 0.5*fWindowWidth;
384 Int_t iInsideCnt = 0; //count photons which Theta ckov inside the window
385 for(Int_t i=0;i<fPhotCnt;i++){//photon candidates loop
387 if(fPhotCkov[i] >= tmin && fPhotCkov[i] <= tmax) {
389 PhotIndex[iInsideCnt]=fPhotClusIndex[i];
396 for (Int_t iClu=0; iClu<pCluLst->GetEntriesFast();iClu++){//clusters loop
397 AliHMPIDCluster *pClu=(AliHMPIDCluster*)pCluLst->UncheckedAt(iClu); //get pointer to current cluster
398 for(Int_t j=0; j<iInsideCnt; j++){
399 if(iClu==PhotIndex[j]) {
400 new ((*pPhotCluLst)[nPhot++]) AliHMPIDCluster(*pClu); //add this raw cluster
410 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
411 TVector2 AliHMPIDRecon::TracePhot(Double_t ckovThe,Double_t ckovPhi)const
413 // Trace a single Ckov photon from emission point somewhere in radiator up to photocathode taking into account ref indexes of materials it travereses
414 // Arguments: ckovThe,ckovPhi- photon ckov angles in TRS, [rad]
415 // Returns: distance between photon point on PC and track projection
418 TVector3 dirTRS,dirLORS;
419 dirTRS.SetMagThetaPhi(1,ckovThe,ckovPhi); //photon in TRS
420 Trs2Lors(dirTRS,theta,phi);
421 dirLORS.SetMagThetaPhi(1,theta,phi); //photon in LORS
422 return TraceForward(dirLORS); //now foward tracing
424 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
425 void AliHMPIDRecon::Propagate(const TVector3 dir,TVector3 &pos,Double_t z)const
427 // Finds an intersection point between a line and XY plane shifted along Z.
428 // Arguments: dir,pos - vector along the line and any point of the line
429 // z - z coordinate of plain
431 // On exit: pos is the position if this intesection if any
432 static TVector3 nrm(0,0,1);
435 TVector3 diff=pnt-pos;
436 Double_t sint=(nrm*diff)/(nrm*dir);
439 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
440 void AliHMPIDRecon::Refract(TVector3 &dir,Double_t n1,Double_t n2)const
442 // Refract direction vector according to Snell law
444 // n1 - ref idx of first substance
445 // n2 - ref idx of second substance
447 // On exit: dir is new direction
448 Double_t sinref=(n1/n2)*TMath::Sin(dir.Theta());
449 if(TMath::Abs(sinref)>1.) dir.SetXYZ(-999,-999,-999);
450 else dir.SetTheta(TMath::ASin(sinref));
452 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
453 Double_t AliHMPIDRecon::HoughResponse()
459 Double_t kThetaMax=0.75;
460 Int_t nChannels = (Int_t)(kThetaMax/fDTheta+0.5);
461 TH1D *phots = new TH1D("Rphot" ,"phots" ,nChannels,0,kThetaMax);
462 TH1D *photsw = new TH1D("RphotWeighted" ,"photsw" ,nChannels,0,kThetaMax);
463 TH1D *resultw = new TH1D("resultw","resultw" ,nChannels,0,kThetaMax);
464 Int_t nBin = (Int_t)(kThetaMax/fDTheta);
465 Int_t nCorrBand = (Int_t)(fWindowWidth/(2*fDTheta));
467 for (Int_t i=0; i< fPhotCnt; i++){//photon cadidates loop
468 Double_t angle = fPhotCkov[i]; if(angle<0||angle>kThetaMax) continue;
470 Int_t bin = (Int_t)(0.5+angle/(fDTheta));
473 Double_t lowerlimit = ((Double_t)bin)*fDTheta - 0.5*fDTheta; Double_t upperlimit = ((Double_t)bin)*fDTheta + 0.5*fDTheta;
474 FindRingGeom(lowerlimit);
475 Double_t areaLow = GetRingArea();
476 FindRingGeom(upperlimit);
477 Double_t areaHigh = GetRingArea();
478 Double_t diffArea = areaHigh - areaLow;
479 if(diffArea>0) weight = 1./diffArea;
481 photsw->Fill(angle,weight);
483 }//photon candidates loop
485 for (Int_t i=1; i<=nBin;i++){
486 Int_t bin1= i-nCorrBand;
487 Int_t bin2= i+nCorrBand;
489 if(bin2>nBin)bin2=nBin;
490 Double_t sumPhots=phots->Integral(bin1,bin2);
491 if(sumPhots<3) continue; // if less then 3 photons don't trust to this ring
492 Double_t sumPhotsw=photsw->Integral(bin1,bin2);
493 resultw->Fill((Double_t)((i+0.5)*fDTheta),sumPhotsw);
495 // evaluate the "BEST" theta ckov as the maximum value of histogramm
496 Double_t *pVec = resultw->GetArray();
497 Int_t locMax = TMath::LocMax(nBin,pVec);
498 delete phots;delete photsw;delete resultw; // Reset and delete objects
500 return (Double_t)(locMax*fDTheta+0.5*fDTheta); //final most probable track theta ckov
502 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
503 Double_t AliHMPIDRecon::FindRingExt(Double_t ckov,Int_t ch,Double_t xPc,Double_t yPc,Double_t thRa,Double_t phRa)
505 // To find the acceptance of the ring even from external inputs.
508 Double_t xRa = xPc - (fParam->RadThick()+fParam->WinThick()+fParam->GapThick())*TMath::Cos(phRa)*TMath::Tan(thRa); //just linear extrapolation back to RAD
509 Double_t yRa = yPc - (fParam->RadThick()+fParam->WinThick()+fParam->GapThick())*TMath::Sin(phRa)*TMath::Tan(thRa);
514 Int_t ipc,ipadx,ipady;
517 SetTrack(xRa,yRa,thRa,phRa);
518 for(Int_t j=0;j<nStep;j++){
519 TVector2 pos; pos=TracePhot(ckov,j*TMath::TwoPi()/(Double_t)(nStep-1));
520 if(fParam->IsInDead(pos.X(),pos.Y())) continue;
521 fParam->Lors2Pad(pos.X(),pos.Y(),ipc,ipadx,ipady);
522 ipadx+=(ipc%2)*fParam->kPadPcX;
523 ipady+=(ipc/2)*fParam->kPadPcY;
524 if(fParam->IsDeadPad(ipadx,ipady,ch)) continue;
527 return ((Double_t)nPhi/(Double_t)nStep);