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],
93 const Int_t nMinPhotAcc = 3; // Minimum number of photons required to perform the pattern recognition
95 Int_t nClusTot = pCluLst->GetEntries();
96 if(nClusTot>fParam->MultCut()) fIsWEIGHT = kTRUE; // offset to take into account bkg in reconstruction
97 else fIsWEIGHT = kFALSE;
101 Float_t xPc,yPc,th,ph;
102 pTrk->GetHMPIDtrk(xPc,yPc,th,ph); //initialize this track: th and ph angles at middle of RAD
103 SetTrack(xRa,yRa,th,ph);
105 fParam->SetRefIdx(nmean);
107 Float_t mipX=-1,mipY=-1;
108 Int_t chId=-1,mipQ=-1,sizeClu = -1;
112 for (Int_t iClu=0; iClu<pCluLst->GetEntriesFast();iClu++){//clusters loop
113 AliHMPIDCluster *pClu=(AliHMPIDCluster*)pCluLst->UncheckedAt(iClu); //get pointer to current cluster
114 if(iClu == index) { // this is the MIP! not a photon candidate: just store mip info
117 mipQ=(Int_t)pClu->Q();
118 sizeClu=pClu->Size();
122 if(pClu->Q()>2*fParam->QCut()) continue;
123 Double_t thetaCer,phiCer;
124 if(FindPhotCkov(pClu->X(),pClu->Y(),thetaCer,phiCer)){ //find ckov angle for this photon candidate
125 fPhotCkov[fPhotCnt]=thetaCer; //actual theta Cerenkov (in TRS)
126 fPhotPhi [fPhotCnt]=phiCer;
127 fPhotClusIndex[fPhotCnt]=iClu; //actual phi Cerenkov (in TRS): -pi to come back to "unusual" ref system (X,Y,-Z)
128 fPhotCnt++; //increment counter of photon candidates
132 pTrk->SetHMPIDmip(mipX,mipY,mipQ,fPhotCnt); //store mip info in any case
133 pTrk->SetHMPIDcluIdx(chId,index+1000*sizeClu); //set index of cluster
135 if(fPhotCnt<=nMinPhotAcc) { //no reconstruction with <=3 photon candidates
136 pTrk->SetHMPIDsignal(kNoPhotAccept); //set the appropriate flag
140 fMipPos.Set(mipX,mipY);
142 //PATTERN RECOGNITION STARTED:
144 Int_t iNrec=FlagPhot(HoughResponse(),pCluLst,pTrk); //flag photons according to individual theta ckov with respect to most probable
146 pTrk->SetHMPIDmip(mipX,mipY,mipQ,iNrec); //store mip info
149 pTrk->SetHMPIDsignal(kNoPhotAccept); //no photon candidates are accepted
153 Double_t thetaC = FindRingCkov(pCluLst->GetEntries()); //find the best reconstructed theta Cherenkov
154 // FindRingGeom(thetaC,2);
155 pTrk->SetHMPIDsignal(thetaC); //store theta Cherenkov
156 pTrk->SetHMPIDchi2(fCkovSigma2); //store errors squared
160 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
161 Bool_t AliHMPIDRecon::FindPhotCkov(Double_t cluX,Double_t cluY,Double_t &thetaCer,Double_t &phiCer)
163 // Finds Cerenkov angle for this photon candidate
164 // Arguments: cluX,cluY - position of cadidate's cluster
165 // Returns: Cerenkov angle
169 Double_t zRad= -0.5*fParam->RadThick()-0.5*fParam->WinThick(); //z position of middle of RAD
170 TVector3 rad(fTrkPos.X(),fTrkPos.Y(),zRad); //impact point at middle of RAD
171 TVector3 pc(cluX,cluY,0.5*fParam->WinThick()+fParam->GapIdx()); //mip at PC
172 Double_t cluR = TMath::Sqrt((cluX-fTrkPos.X())*(cluX-fTrkPos.X())+
173 (cluY-fTrkPos.Y())*(cluY-fTrkPos.Y()));//ref. distance impact RAD-CLUSTER
174 Double_t phi=(pc-rad).Phi(); //phi of photon
177 Double_t ckov2=0.75+fTrkDir.Theta(); //start to find theta cerenkov in DRS
178 const Double_t kTol=0.01;
181 if(iIterCnt>=50) return kFALSE;
182 Double_t ckov=0.5*(ckov1+ckov2);
183 dirCkov.SetMagThetaPhi(1,ckov,phi);
184 TVector2 posC=TraceForward(dirCkov); //trace photon with actual angles
185 Double_t dist=cluR-(posC-fTrkPos).Mod(); //get distance between trial point and cluster position
186 if(posC.X()==-999) dist = - 999; //total reflection problem
187 iIterCnt++; //counter step
188 if (dist> kTol) ckov1=ckov; //cluster @ larger ckov
189 else if(dist<-kTol) ckov2=ckov; //cluster @ smaller ckov
190 else{ //precision achived: ckov in DRS found
191 dirCkov.SetMagThetaPhi(1,ckov,phi); //
192 Lors2Trs(dirCkov,thetaCer,phiCer); //find ckov (in TRS:the effective Cherenkov angle!)
197 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
198 TVector2 AliHMPIDRecon::TraceForward(TVector3 dirCkov)const
200 //Trace forward a photon from (x,y) up to PC
201 // Arguments: dirCkov photon vector in LORS
202 // Returns: pos of traced photon at PC
204 TVector2 pos(-999,-999);
205 Double_t thetaCer = dirCkov.Theta();
206 if(thetaCer > TMath::ASin(1./fParam->GetRefIdx())) return pos; //total refraction on WIN-GAP boundary
207 Double_t zRad= -0.5*fParam->RadThick()-0.5*fParam->WinThick(); //z position of middle of RAD
208 TVector3 posCkov(fTrkPos.X(),fTrkPos.Y(),zRad); //RAD: photon position is track position @ middle of RAD
209 Propagate(dirCkov,posCkov, -0.5*fParam->WinThick()); //go to RAD-WIN boundary
210 Refract (dirCkov, fParam->GetRefIdx(),fParam->WinIdx()); //RAD-WIN refraction
211 Propagate(dirCkov,posCkov, 0.5*fParam->WinThick()); //go to WIN-GAP boundary
212 Refract (dirCkov, fParam->WinIdx(),fParam->GapIdx()); //WIN-GAP refraction
213 Propagate(dirCkov,posCkov,0.5*fParam->WinThick()+fParam->GapThick()); //go to PC
214 pos.Set(posCkov.X(),posCkov.Y());
217 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
218 void AliHMPIDRecon::Lors2Trs(TVector3 dirCkov,Double_t &thetaCer,Double_t &phiCer)const
220 //Theta Cerenkov reconstruction
221 // Arguments: dirCkov photon vector in LORS
222 // Returns: thetaCer of photon in TRS
223 // phiCer of photon in TRS
225 // dirTrk.SetMagThetaPhi(1,fTrkDir.Theta(),fTrkDir.Phi());
226 // Double_t thetaCer = TMath::ACos(dirCkov*dirTrk);
227 TRotation mtheta; mtheta.RotateY(-fTrkDir.Theta());
228 TRotation mphi; mphi.RotateZ(-fTrkDir.Phi());
229 TRotation mrot=mtheta*mphi;
231 dirCkovTRS=mrot*dirCkov;
232 phiCer = dirCkovTRS.Phi(); //actual value of the phi of the photon
233 thetaCer= dirCkovTRS.Theta(); //actual value of thetaCerenkov of the photon
235 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
236 void AliHMPIDRecon::Trs2Lors(TVector3 dirCkov,Double_t &thetaCer,Double_t &phiCer)const
238 //Theta Cerenkov reconstruction
239 // Arguments: dirCkov photon vector in TRS
240 // Returns: thetaCer of photon in LORS
241 // phiCer of photon in LORS
242 TRotation mtheta; mtheta.RotateY(fTrkDir.Theta());
243 TRotation mphi; mphi.RotateZ(fTrkDir.Phi());
244 TRotation mrot=mphi*mtheta;
245 TVector3 dirCkovLORS;
246 dirCkovLORS=mrot*dirCkov;
247 phiCer = dirCkovLORS.Phi(); //actual value of the phi of the photon
248 thetaCer= dirCkovLORS.Theta(); //actual value of thetaCerenkov of the photon
250 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
251 void AliHMPIDRecon::FindRingGeom(Double_t ckovAng,Int_t level)
253 // Find area covered in the PC acceptance
254 // Arguments: ckovAng - cerenkov angle
255 // level - precision in finding area and portion of ring accepted (multiple of 50)
256 // Returns: area of the ring in cm^2 for given theta ckov
265 for(Int_t i=0;i<kN;i++){
267 pos1=TracePhot(ckovAng,Double_t(TMath::TwoPi()*(i+1)/kN)); //find a good trace for the first photon
268 if(pos1.X()==-999) continue; //no area: open ring
269 if(!fParam->IsInside(pos1.X(),pos1.Y(),0)) {
270 pos1 = IntWithEdge(fMipPos,pos1); // find the very first intersection...
272 if(!AliHMPIDParam::IsInDead(pos1.X(),pos1.Y())) nPoints++; //photon is accepted if not in dead zone
277 TVector2 pos2=TracePhot(ckovAng,Double_t(TMath::TwoPi()*(i+1)/kN)); //trace the next photon
278 if(pos2.X()==-999) continue; //no area: open ring
279 if(!fParam->IsInside(pos2.X(),pos2.Y(),0)) {
280 pos2 = IntWithEdge(fMipPos,pos2);
282 if(!AliHMPIDParam::IsInDead(pos2.X(),pos2.Y())) nPoints++; //photon is accepted if not in dead zone
284 area+=TMath::Abs((pos1-fMipPos).X()*(pos2-fMipPos).Y()-(pos1-fMipPos).Y()*(pos2-fMipPos).X()); //add area of the triangle...
287 //--- find area and length of the ring;
288 fRingAcc = (Double_t)nPoints/(Double_t)kN;
292 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
293 TVector2 AliHMPIDRecon::IntWithEdge(TVector2 p1,TVector2 p2)const
295 // It finds the intersection of the line for 2 points traced as photons
296 // and the edge of a given PC
297 // Arguments: 2 points obtained tracing the photons
298 // Returns: intersection point with detector (PC) edges
300 Double_t xmin = (p1.X()<p2.X())? p1.X():p2.X();
301 Double_t xmax = (p1.X()<p2.X())? p2.X():p1.X();
302 Double_t ymin = (p1.Y()<p2.Y())? p1.Y():p2.Y();
303 Double_t ymax = (p1.Y()<p2.Y())? p2.Y():p1.Y();
305 Double_t m = TMath::Tan((p2-p1).Phi());
307 //intersection with low X
308 pint.Set((Double_t)(p1.X() + (0-p1.Y())/m),0.);
309 if(pint.X()>=0 && pint.X()<=fParam->SizeAllX() &&
310 pint.X()>=xmin && pint.X()<=xmax &&
311 pint.Y()>=ymin && pint.Y()<=ymax) return pint;
312 //intersection with high X
313 pint.Set((Double_t)(p1.X() + (fParam->SizeAllY()-p1.Y())/m),(Double_t)(fParam->SizeAllY()));
314 if(pint.X()>=0 && pint.X()<=fParam->SizeAllX() &&
315 pint.X()>=xmin && pint.X()<=xmax &&
316 pint.Y()>=ymin && pint.Y()<=ymax) return pint;
317 //intersection with left Y
318 pint.Set(0.,(Double_t)(p1.Y() + m*(0-p1.X())));
319 if(pint.Y()>=0 && pint.Y()<=fParam->SizeAllY() &&
320 pint.Y()>=ymin && pint.Y()<=ymax &&
321 pint.X()>=xmin && pint.X()<=xmax) return pint;
322 //intersection with righ Y
323 pint.Set((Double_t)(fParam->SizeAllX()),(Double_t)(p1.Y() + m*(fParam->SizeAllX()-p1.X())));
324 if(pint.Y()>=0 && pint.Y()<=fParam->SizeAllY() &&
325 pint.Y()>=ymin && pint.Y()<=ymax &&
326 pint.X()>=xmin && pint.X()<=xmax) return pint;
329 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
330 Double_t AliHMPIDRecon::FindRingCkov(Int_t)
332 // 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
333 // collecting errors for all single Ckov candidates thetas. (Assuming they are independent)
334 // Arguments: iNclus- total number of clusters in chamber for background estimation
335 // Return: best estimation of track Theta ckov
338 Double_t weightThetaCerenkov = 0.;
340 Double_t ckovMin=9999.,ckovMax=0.;
341 Double_t sigma2 = 0; //to collect error squared for this ring
343 for(Int_t i=0;i<fPhotCnt;i++){//candidates loop
344 if(fPhotFlag[i] == 2){
345 if(fPhotCkov[i]<ckovMin) ckovMin=fPhotCkov[i]; //find max and min Theta ckov from all candidates within probable window
346 if(fPhotCkov[i]>ckovMax) ckovMax=fPhotCkov[i];
347 weightThetaCerenkov += fPhotCkov[i]*fPhotWei[i];
348 wei += fPhotWei[i]; //collect weight as sum of all candidate weghts
350 sigma2 += 1./fParam->Sigma2(fTrkDir.Theta(),fTrkDir.Phi(),fPhotCkov[i],fPhotPhi[i]);
354 if(sigma2>0) fCkovSigma2=1./sigma2;
355 else fCkovSigma2=1e10;
357 if(wei != 0.) weightThetaCerenkov /= wei; else weightThetaCerenkov = 0.;
358 return weightThetaCerenkov;
360 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
361 Int_t AliHMPIDRecon::FlagPhot(Double_t ckov,TClonesArray *pCluLst, AliESDtrack *pTrk)
363 // Flag photon candidates if their individual ckov angle is inside the window around ckov angle returned by HoughResponse()
364 // Arguments: ckov- value of most probable ckov angle for track as returned by HoughResponse()
365 // Returns: number of photon candidates happened to be inside the window
367 // Photon Flag: Flag = 0 initial set;
368 // Flag = 1 good candidate (charge compatible with photon);
369 // Flag = 2 photon used for the ring;
371 Int_t steps = (Int_t)((ckov )/ fDTheta); //how many times we need to have fDTheta to fill the distance between 0 and thetaCkovHough
373 Double_t tmin = (Double_t)(steps - 1)*fDTheta;
374 Double_t tmax = (Double_t)(steps)*fDTheta;
375 Double_t tavg = 0.5*(tmin+tmax);
377 tmin = tavg - 0.5*fWindowWidth; tmax = tavg + 0.5*fWindowWidth;
379 Int_t iInsideCnt = 0; //count photons which Theta ckov inside the window
380 for(Int_t i=0;i<fPhotCnt;i++){//photon candidates loop
382 if(fPhotCkov[i] >= tmin && fPhotCkov[i] <= tmax) {
384 AddObjectToFriends(pCluLst,i,pTrk);
392 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
393 void AliHMPIDRecon::AddObjectToFriends(TClonesArray *pCluLst, Int_t photonIndex, AliESDtrack *pTrk)
395 // Add AliHMPIDcluster object to ESD friends
397 AliHMPIDCluster *pClu=(AliHMPIDCluster*)pCluLst->UncheckedAt(fPhotClusIndex[photonIndex]);
398 AliHMPIDCluster *pClus = new AliHMPIDCluster(*pClu);
399 pClus->SetChi2(fPhotCkov[photonIndex]);
400 pTrk->AddCalibObject(pClus);
402 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
403 TVector2 AliHMPIDRecon::TracePhot(Double_t ckovThe,Double_t ckovPhi)const
405 // Trace a single Ckov photon from emission point somewhere in radiator up to photocathode taking into account ref indexes of materials it travereses
406 // Arguments: ckovThe,ckovPhi- photon ckov angles in TRS, [rad]
407 // Returns: distance between photon point on PC and track projection
410 TVector3 dirTRS,dirLORS;
411 dirTRS.SetMagThetaPhi(1,ckovThe,ckovPhi); //photon in TRS
412 Trs2Lors(dirTRS,theta,phi);
413 dirLORS.SetMagThetaPhi(1,theta,phi); //photon in LORS
414 return TraceForward(dirLORS); //now foward tracing
416 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
417 void AliHMPIDRecon::Propagate(const TVector3 dir,TVector3 &pos,Double_t z)const
419 // Finds an intersection point between a line and XY plane shifted along Z.
420 // Arguments: dir,pos - vector along the line and any point of the line
421 // z - z coordinate of plain
423 // On exit: pos is the position if this intesection if any
424 static TVector3 nrm(0,0,1);
427 TVector3 diff=pnt-pos;
428 Double_t sint=(nrm*diff)/(nrm*dir);
431 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
432 void AliHMPIDRecon::Refract(TVector3 &dir,Double_t n1,Double_t n2)const
434 // Refract direction vector according to Snell law
436 // n1 - ref idx of first substance
437 // n2 - ref idx of second substance
439 // On exit: dir is new direction
440 Double_t sinref=(n1/n2)*TMath::Sin(dir.Theta());
441 if(TMath::Abs(sinref)>1.) dir.SetXYZ(-999,-999,-999);
442 else dir.SetTheta(TMath::ASin(sinref));
444 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
445 Double_t AliHMPIDRecon::HoughResponse()
451 Double_t kThetaMax=0.75;
452 Int_t nChannels = (Int_t)(kThetaMax/fDTheta+0.5);
453 TH1D *phots = new TH1D("Rphot" ,"phots" ,nChannels,0,kThetaMax);
454 TH1D *photsw = new TH1D("RphotWeighted" ,"photsw" ,nChannels,0,kThetaMax);
455 TH1D *resultw = new TH1D("resultw","resultw" ,nChannels,0,kThetaMax);
456 Int_t nBin = (Int_t)(kThetaMax/fDTheta);
457 Int_t nCorrBand = (Int_t)(fWindowWidth/(2*fDTheta));
459 for (Int_t i=0; i< fPhotCnt; i++){//photon cadidates loop
460 Double_t angle = fPhotCkov[i]; if(angle<0||angle>kThetaMax) continue;
462 Int_t bin = (Int_t)(0.5+angle/(fDTheta));
465 Double_t lowerlimit = ((Double_t)bin)*fDTheta - 0.5*fDTheta; Double_t upperlimit = ((Double_t)bin)*fDTheta + 0.5*fDTheta;
466 FindRingGeom(lowerlimit);
467 Double_t areaLow = GetRingArea();
468 FindRingGeom(upperlimit);
469 Double_t areaHigh = GetRingArea();
470 Double_t diffArea = areaHigh - areaLow;
471 if(diffArea>0) weight = 1./diffArea;
473 photsw->Fill(angle,weight);
475 }//photon candidates loop
477 for (Int_t i=1; i<=nBin;i++){
478 Int_t bin1= i-nCorrBand;
479 Int_t bin2= i+nCorrBand;
481 if(bin2>nBin)bin2=nBin;
482 Double_t sumPhots=phots->Integral(bin1,bin2);
483 if(sumPhots<3) continue; // if less then 3 photons don't trust to this ring
484 Double_t sumPhotsw=photsw->Integral(bin1,bin2);
485 if((Double_t)((i+0.5)*fDTheta)>0.7) continue;
486 resultw->Fill((Double_t)((i+0.5)*fDTheta),sumPhotsw);
488 // evaluate the "BEST" theta ckov as the maximum value of histogramm
489 Double_t *pVec = resultw->GetArray();
490 Int_t locMax = TMath::LocMax(nBin,pVec);
491 delete phots;delete photsw;delete resultw; // Reset and delete objects
493 return (Double_t)(locMax*fDTheta+0.5*fDTheta); //final most probable track theta ckov
495 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
496 Double_t AliHMPIDRecon::FindRingExt(Double_t ckov,Int_t ch,Double_t xPc,Double_t yPc,Double_t thRa,Double_t phRa)
498 // To find the acceptance of the ring even from external inputs.
501 Double_t xRa = xPc - (fParam->RadThick()+fParam->WinThick()+fParam->GapThick())*TMath::Cos(phRa)*TMath::Tan(thRa); //just linear extrapolation back to RAD
502 Double_t yRa = yPc - (fParam->RadThick()+fParam->WinThick()+fParam->GapThick())*TMath::Sin(phRa)*TMath::Tan(thRa);
507 Int_t ipc,ipadx,ipady;
510 SetTrack(xRa,yRa,thRa,phRa);
511 for(Int_t j=0;j<nStep;j++){
512 TVector2 pos; pos=TracePhot(ckov,j*TMath::TwoPi()/(Double_t)(nStep-1));
513 if(fParam->IsInDead(pos.X(),pos.Y())) continue;
514 fParam->Lors2Pad(pos.X(),pos.Y(),ipc,ipadx,ipady);
515 ipadx+=(ipc%2)*fParam->kPadPcX;
516 ipady+=(ipc/2)*fParam->kPadPcY;
517 if(fParam->IsDeadPad(ipadx,ipady,ch)) continue;
520 return ((Double_t)nPhi/(Double_t)nStep);