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()
31 Int_t fPhotCnt; // counter of photons candidate
32 Int_t *fPhotFlag; // flags of photon candidates
33 Double_t *fPhotCkov; // Ckov angles of photon candidates, [rad]
34 Double_t *fPhotPhi; // phis of photons candidates, [rad]
35 Double_t *fPhotWei; // weigths of photon candidates
36 Double_t fCkovSigma2; // sigma2 of the reconstructed ring
38 Bool_t fIsWEIGHT; // flag to consider weight procedure
39 Float_t fDTheta; // Step for sliding window
40 Float_t fWindowWidth; // Hough width of sliding window
42 Double_t fRingArea; // area of a given ring
43 Double_t fRingAcc; // fraction of the ring accepted by geometry
44 TVector3 fTrkDir; // track direction in LORS at RAD
45 TVector2 fTrkPos; // track positon in LORS at RAD
46 TVector2 fMipPos; // mip positon for a given track
47 TVector2 fPc; // track position at PC
49 AliHMPIDParam *fParam; // Pointer to AliHMPIDParam
52 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
53 AliHMPIDRecon::AliHMPIDRecon():
54 TTask("RichRec","RichPat"),
66 fTrkDir(0,0,1), // Just for test
67 fTrkPos(30,40), // Just for test
70 fParam(AliHMPIDParam::Instance())
73 //init of data members
76 fParam->SetRefIdx(fParam->MeanIdxRad()); // initialization of ref index to a default one
78 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
79 void AliHMPIDRecon::InitVars(Int_t n)
85 fPhotFlag = new Int_t[n];
86 fPhotCkov = new Double_t[n];
87 fPhotPhi = new Double_t[n];
88 fPhotWei = new Double_t[n];
91 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
92 void AliHMPIDRecon::DeleteVars()const
102 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
103 void AliHMPIDRecon::CkovAngle(AliESDtrack *pTrk,TClonesArray *pCluLst,Double_t nmean,Double_t qthre)
105 // Pattern recognition method based on Hough transform
106 // Arguments: pTrk - track for which Ckov angle is to be found
107 // pCluLst - list of clusters for this chamber
108 // Returns: - track ckov angle, [rad],
111 const Int_t nMinPhotAcc = 3; // Minimum number of photons required to perform the pattern recognition
114 Int_t nClusTot = pCluLst->GetEntries();
115 if(nClusTot>fParam->MultCut()) fIsWEIGHT = kTRUE; // offset to take into account bkg in reconstruction
116 else fIsWEIGHT = kFALSE;
120 Float_t xRa,yRa,th,ph;
121 pTrk->GetHMPIDtrk(xRa,yRa,th,ph); //initialize this track: th and ph angles at middle of RAD
122 SetTrack(xRa,yRa,th,ph);
124 fParam->SetRefIdx(nmean);
126 Float_t dMin=999,mipX=-1,mipY=-1;Int_t chId=-1,mipId=-1,mipQ=-1;
128 for (Int_t iClu=0; iClu<pCluLst->GetEntriesFast();iClu++){//clusters loop
129 AliHMPIDCluster *pClu=(AliHMPIDCluster*)pCluLst->UncheckedAt(iClu); //get pointer to current cluster
131 if(pClu->Q()>qthre){ //charge compartible with MIP clusters
132 Float_t dX=fPc.X()-pClu->X(),dY=fPc.Y()-pClu->Y(),d =TMath::Sqrt(dX*dX+dY*dY); //distance between current cluster and intersection point
133 if( d < dMin) {mipId=iClu; dMin=d;mipX=pClu->X();mipY=pClu->Y();mipQ=(Int_t)pClu->Q();} //current cluster is closer, overwrite data for min cluster
134 }else{ //charge compatible with photon cluster
135 Double_t thetaCer,phiCer;
136 if(FindPhotCkov(pClu->X(),pClu->Y(),thetaCer,phiCer)){ //find ckov angle for this photon candidate
137 fPhotCkov[fPhotCnt]=thetaCer; //actual theta Cerenkov (in TRS)
138 fPhotPhi [fPhotCnt]=phiCer; //actual phi Cerenkov (in TRS): -pi to come back to "unusual" ref system (X,Y,-Z)
139 //PH Printf("photon n. %i reconstructed theta = %f",fPhotCnt,fPhotCkov[fPhotCnt]);
140 fPhotCnt++; //increment counter of photon candidates
145 if(fPhotCnt<=nMinPhotAcc) { //no reconstruction with <=3 photon candidates
146 pTrk->SetHMPIDsignal(kNoPhotAccept); //set the appropriate flag
147 pTrk->SetHMPIDmip(mipX,mipY,mipQ,fPhotCnt); //store mip info
148 pTrk->SetHMPIDcluIdx(-1,-1); //set index of cluster
153 pTrk->SetHMPIDcluIdx(chId,9999); //set index of cluster
154 pTrk->SetHMPIDsignal(kMipQdcCut);
156 } //no clusters with QDC more the threshold at all
157 pTrk->SetHMPIDcluIdx(chId,mipId); //set index of cluster
158 if(dMin>fParam->DistCut()) {pTrk->SetHMPIDsignal(kMipDistCut); return;} //closest cluster with enough charge is still too far from intersection
160 fMipPos.Set(mipX,mipY);
163 //PATTERN RECOGNITION STARTED:
165 Int_t iNrec=FlagPhot(HoughResponse()); //flag photons according to individual theta ckov with respect to most probable
166 pTrk->SetHMPIDmip(mipX,mipY,mipQ,iNrec); //store mip info
169 pTrk->SetHMPIDsignal(kNoPhotAccept); //no photon candidates are accepted
172 Double_t thetaC = FindRingCkov(pCluLst->GetEntries()); //find the best reconstructed theta Cherenkov
173 // FindRingGeom(thetaC,2);
174 pTrk->SetHMPIDsignal(thetaC); //store theta Cherenkov
175 pTrk->SetHMPIDchi2(fCkovSigma2); //store errors squared
179 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
180 Bool_t AliHMPIDRecon::FindPhotCkov(Double_t cluX,Double_t cluY,Double_t &thetaCer,Double_t &phiCer)
182 // Finds Cerenkov angle for this photon candidate
183 // Arguments: cluX,cluY - position of cadidate's cluster
184 // Returns: Cerenkov angle
188 Double_t zRad= -0.5*fParam->RadThick()-0.5*fParam->WinThick(); //z position of middle of RAD
189 TVector3 rad(fTrkPos.X(),fTrkPos.Y(),zRad); //impact point at middle of RAD
190 TVector3 pc(cluX,cluY,0.5*fParam->WinThick()+fParam->GapIdx()); //mip at PC
191 Double_t cluR = TMath::Sqrt((cluX-fTrkPos.X())*(cluX-fTrkPos.X())+
192 (cluY-fTrkPos.Y())*(cluY-fTrkPos.Y()));//ref. distance impact RAD-CLUSTER
193 Double_t phi=(pc-rad).Phi(); //phi of photon
196 Double_t ckov2=0.75+fTrkDir.Theta(); //start to find theta cerenkov in DRS
197 const Double_t kTol=0.01;
200 if(iIterCnt>=50) return kFALSE;
201 Double_t ckov=0.5*(ckov1+ckov2);
202 dirCkov.SetMagThetaPhi(1,ckov,phi);
203 TVector2 posC=TraceForward(dirCkov); //trace photon with actual angles
204 Double_t dist=cluR-(posC-fTrkPos).Mod(); //get distance between trial point and cluster position
205 if(posC.X()==-999) dist = - 999; //total reflection problem
206 iIterCnt++; //counter step
207 if (dist> kTol) ckov1=ckov; //cluster @ larger ckov
208 else if(dist<-kTol) ckov2=ckov; //cluster @ smaller ckov
209 else{ //precision achived: ckov in DRS found
210 dirCkov.SetMagThetaPhi(1,ckov,phi); //
211 Lors2Trs(dirCkov,thetaCer,phiCer); //find ckov (in TRS:the effective Cherenkov angle!)
216 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
217 TVector2 AliHMPIDRecon::TraceForward(TVector3 dirCkov)const
219 //Trace forward a photon from (x,y) up to PC
220 // Arguments: dirCkov photon vector in LORS
221 // Returns: pos of traced photon at PC
223 TVector2 pos(-999,-999);
224 Double_t thetaCer = dirCkov.Theta();
225 if(thetaCer > TMath::ASin(1./fParam->GetRefIdx())) return pos; //total refraction on WIN-GAP boundary
226 Double_t zRad= -0.5*fParam->RadThick()-0.5*fParam->WinThick(); //z position of middle of RAD
227 TVector3 posCkov(fTrkPos.X(),fTrkPos.Y(),zRad); //RAD: photon position is track position @ middle of RAD
228 Propagate(dirCkov,posCkov, -0.5*fParam->WinThick()); //go to RAD-WIN boundary
229 Refract (dirCkov, fParam->GetRefIdx(),fParam->WinIdx()); //RAD-WIN refraction
230 Propagate(dirCkov,posCkov, 0.5*fParam->WinThick()); //go to WIN-GAP boundary
231 Refract (dirCkov, fParam->WinIdx(),fParam->GapIdx()); //WIN-GAP refraction
232 Propagate(dirCkov,posCkov,0.5*fParam->WinThick()+fParam->GapThick()); //go to PC
233 pos.Set(posCkov.X(),posCkov.Y());
236 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
237 void AliHMPIDRecon::Lors2Trs(TVector3 dirCkov,Double_t &thetaCer,Double_t &phiCer)const
239 //Theta Cerenkov reconstruction
240 // Arguments: dirCkov photon vector in LORS
241 // Returns: thetaCer of photon in TRS
242 // phiCer of photon in TRS
244 // dirTrk.SetMagThetaPhi(1,fTrkDir.Theta(),fTrkDir.Phi());
245 // Double_t thetaCer = TMath::ACos(dirCkov*dirTrk);
246 TRotation mtheta; mtheta.RotateY(-fTrkDir.Theta());
247 TRotation mphi; mphi.RotateZ(-fTrkDir.Phi());
248 TRotation mrot=mtheta*mphi;
250 dirCkovTRS=mrot*dirCkov;
251 phiCer = dirCkovTRS.Phi(); //actual value of the phi of the photon
252 thetaCer= dirCkovTRS.Theta(); //actual value of thetaCerenkov of the photon
254 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
255 void AliHMPIDRecon::Trs2Lors(TVector3 dirCkov,Double_t &thetaCer,Double_t &phiCer)const
257 //Theta Cerenkov reconstruction
258 // Arguments: dirCkov photon vector in TRS
259 // Returns: thetaCer of photon in LORS
260 // phiCer of photon in LORS
261 TRotation mtheta; mtheta.RotateY(fTrkDir.Theta());
262 TRotation mphi; mphi.RotateZ(fTrkDir.Phi());
263 TRotation mrot=mphi*mtheta;
264 TVector3 dirCkovLORS;
265 dirCkovLORS=mrot*dirCkov;
266 phiCer = dirCkovLORS.Phi(); //actual value of the phi of the photon
267 thetaCer= dirCkovLORS.Theta(); //actual value of thetaCerenkov of the photon
269 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
270 void AliHMPIDRecon::FindRingGeom(Double_t ckovAng,Int_t level)
272 // Find area covered in the PC acceptance
273 // Arguments: ckovAng - cerenkov angle
274 // level - precision in finding area and portion of ring accepted (multiple of 50)
275 // Returns: area of the ring in cm^2 for given theta ckov
284 for(Int_t i=0;i<kN;i++){
286 pos1=TracePhot(ckovAng,Double_t(TMath::TwoPi()*(i+1)/kN)); //find a good trace for the first photon
287 if(pos1.X()==-999) continue; //no area: open ring
288 if(!fParam->IsInside(pos1.X(),pos1.Y(),0)) {
289 pos1 = IntWithEdge(fMipPos,pos1); // find the very first intersection...
291 if(!AliHMPIDParam::IsInDead(pos1.X(),pos1.Y())) nPoints++; //photon is accepted if not in dead zone
296 TVector2 pos2=TracePhot(ckovAng,Double_t(TMath::TwoPi()*(i+1)/kN)); //trace the next photon
297 if(pos2.X()==-999) continue; //no area: open ring
298 if(!fParam->IsInside(pos2.X(),pos2.Y(),0)) {
299 pos2 = IntWithEdge(fMipPos,pos2);
301 if(!AliHMPIDParam::IsInDead(pos2.X(),pos2.Y())) nPoints++; //photon is accepted if not in dead zone
303 area+=TMath::Abs((pos1-fMipPos).X()*(pos2-fMipPos).Y()-(pos1-fMipPos).Y()*(pos2-fMipPos).X()); //add area of the triangle...
306 //--- find area and length of the ring;
307 fRingAcc = (Double_t)nPoints/(Double_t)kN;
311 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
312 TVector2 AliHMPIDRecon::IntWithEdge(TVector2 p1,TVector2 p2)const
314 // It finds the intersection of the line for 2 points traced as photons
315 // and the edge of a given PC
316 // Arguments: 2 points obtained tracing the photons
317 // Returns: intersection point with detector (PC) edges
319 Double_t xmin = (p1.X()<p2.X())? p1.X():p2.X();
320 Double_t xmax = (p1.X()<p2.X())? p2.X():p1.X();
321 Double_t ymin = (p1.Y()<p2.Y())? p1.Y():p2.Y();
322 Double_t ymax = (p1.Y()<p2.Y())? p2.Y():p1.Y();
324 Double_t m = TMath::Tan((p2-p1).Phi());
326 //intersection with low X
327 pint.Set((Double_t)(p1.X() + (0-p1.Y())/m),0.);
328 if(pint.X()>=0 && pint.X()<=fParam->SizeAllX() &&
329 pint.X()>=xmin && pint.X()<=xmax &&
330 pint.Y()>=ymin && pint.Y()<=ymax) return pint;
331 //intersection with high X
332 pint.Set((Double_t)(p1.X() + (fParam->SizeAllY()-p1.Y())/m),(Double_t)(fParam->SizeAllY()));
333 if(pint.X()>=0 && pint.X()<=fParam->SizeAllX() &&
334 pint.X()>=xmin && pint.X()<=xmax &&
335 pint.Y()>=ymin && pint.Y()<=ymax) return pint;
336 //intersection with left Y
337 pint.Set(0.,(Double_t)(p1.Y() + m*(0-p1.X())));
338 if(pint.Y()>=0 && pint.Y()<=fParam->SizeAllY() &&
339 pint.Y()>=ymin && pint.Y()<=ymax &&
340 pint.X()>=xmin && pint.X()<=xmax) return pint;
341 //intersection with righ Y
342 pint.Set((Double_t)(fParam->SizeAllX()),(Double_t)(p1.Y() + m*(fParam->SizeAllX()-p1.X())));
343 if(pint.Y()>=0 && pint.Y()<=fParam->SizeAllY() &&
344 pint.Y()>=ymin && pint.Y()<=ymax &&
345 pint.X()>=xmin && pint.X()<=xmax) return pint;
348 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
349 Double_t AliHMPIDRecon::FindRingCkov(Int_t)
351 // 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
352 // collecting errors for all single Ckov candidates thetas. (Assuming they are independent)
353 // Arguments: iNclus- total number of clusters in chamber for background estimation
354 // Return: best estimation of track Theta ckov
357 Double_t weightThetaCerenkov = 0.;
359 Double_t ckovMin=9999.,ckovMax=0.;
360 Double_t sigma2 = 0; //to collect error squared for this ring
362 for(Int_t i=0;i<fPhotCnt;i++){//candidates loop
363 if(fPhotFlag[i] == 2){
364 if(fPhotCkov[i]<ckovMin) ckovMin=fPhotCkov[i]; //find max and min Theta ckov from all candidates within probable window
365 if(fPhotCkov[i]>ckovMax) ckovMax=fPhotCkov[i];
366 weightThetaCerenkov += fPhotCkov[i]*fPhotWei[i];
367 wei += fPhotWei[i]; //collect weight as sum of all candidate weghts
369 sigma2 += 1./fParam->Sigma2(fTrkDir.Theta(),fTrkDir.Phi(),fPhotCkov[i],fPhotPhi[i]);
373 if(sigma2>0) fCkovSigma2=1./sigma2;
374 else fCkovSigma2=1e10;
376 if(wei != 0.) weightThetaCerenkov /= wei; else weightThetaCerenkov = 0.;
377 return weightThetaCerenkov;
379 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
380 Int_t AliHMPIDRecon::FlagPhot(Double_t ckov)
382 // Flag photon candidates if their individual ckov angle is inside the window around ckov angle returned by HoughResponse()
383 // Arguments: ckov- value of most probable ckov angle for track as returned by HoughResponse()
384 // Returns: number of photon candidates happened to be inside the window
386 // Photon Flag: Flag = 0 initial set;
387 // Flag = 1 good candidate (charge compatible with photon);
388 // Flag = 2 photon used for the ring;
390 Int_t steps = (Int_t)((ckov )/ fDTheta); //how many times we need to have fDTheta to fill the distance between 0 and thetaCkovHough
392 Double_t tmin = (Double_t)(steps - 1)*fDTheta;
393 Double_t tmax = (Double_t)(steps)*fDTheta;
394 Double_t tavg = 0.5*(tmin+tmax);
396 tmin = tavg - 0.5*fWindowWidth; tmax = tavg + 0.5*fWindowWidth;
398 Int_t iInsideCnt = 0; //count photons which Theta ckov inside the window
399 for(Int_t i=0;i<fPhotCnt;i++){//photon candidates loop
401 if(fPhotCkov[i] >= tmin && fPhotCkov[i] <= tmax) {
408 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
409 TVector2 AliHMPIDRecon::TracePhot(Double_t ckovThe,Double_t ckovPhi)const
411 // Trace a single Ckov photon from emission point somewhere in radiator up to photocathode taking into account ref indexes of materials it travereses
412 // Arguments: ckovThe,ckovPhi- photon ckov angles in TRS, [rad]
413 // Returns: distance between photon point on PC and track projection
416 TVector3 dirTRS,dirLORS;
417 dirTRS.SetMagThetaPhi(1,ckovThe,ckovPhi); //photon in TRS
418 Trs2Lors(dirTRS,theta,phi);
419 dirLORS.SetMagThetaPhi(1,theta,phi); //photon in LORS
420 return TraceForward(dirLORS); //now foward tracing
422 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
423 void AliHMPIDRecon::Propagate(const TVector3 dir,TVector3 &pos,Double_t z)const
425 // Finds an intersection point between a line and XY plane shifted along Z.
426 // Arguments: dir,pos - vector along the line and any point of the line
427 // z - z coordinate of plain
429 // On exit: pos is the position if this intesection if any
430 static TVector3 nrm(0,0,1);
433 TVector3 diff=pnt-pos;
434 Double_t sint=(nrm*diff)/(nrm*dir);
437 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
438 void AliHMPIDRecon::Refract(TVector3 &dir,Double_t n1,Double_t n2)const
440 // Refract direction vector according to Snell law
442 // n1 - ref idx of first substance
443 // n2 - ref idx of second substance
445 // On exit: dir is new direction
446 Double_t sinref=(n1/n2)*TMath::Sin(dir.Theta());
447 if(TMath::Abs(sinref)>1.) dir.SetXYZ(-999,-999,-999);
448 else dir.SetTheta(TMath::ASin(sinref));
450 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
451 Double_t AliHMPIDRecon::HoughResponse()
457 Double_t kThetaMax=0.75;
458 Int_t nChannels = (Int_t)(kThetaMax/fDTheta+0.5);
459 TH1D *phots = new TH1D("Rphot" ,"phots" ,nChannels,0,kThetaMax);
460 TH1D *photsw = new TH1D("RphotWeighted" ,"photsw" ,nChannels,0,kThetaMax);
461 TH1D *resultw = new TH1D("resultw","resultw" ,nChannels,0,kThetaMax);
462 Int_t nBin = (Int_t)(kThetaMax/fDTheta);
463 Int_t nCorrBand = (Int_t)(fWindowWidth/(2*fDTheta));
465 for (Int_t i=0; i< fPhotCnt; i++){//photon cadidates loop
466 Double_t angle = fPhotCkov[i]; if(angle<0||angle>kThetaMax) continue;
468 Int_t bin = (Int_t)(0.5+angle/(fDTheta));
471 Double_t lowerlimit = ((Double_t)bin)*fDTheta - 0.5*fDTheta; Double_t upperlimit = ((Double_t)bin)*fDTheta + 0.5*fDTheta;
472 FindRingGeom(lowerlimit);
473 Double_t areaLow = GetRingArea();
474 FindRingGeom(upperlimit);
475 Double_t areaHigh = GetRingArea();
476 Double_t diffArea = areaHigh - areaLow;
477 if(diffArea>0) weight = 1./diffArea;
479 photsw->Fill(angle,weight);
481 }//photon candidates loop
483 for (Int_t i=1; i<=nBin;i++){
484 Int_t bin1= i-nCorrBand;
485 Int_t bin2= i+nCorrBand;
487 if(bin2>nBin)bin2=nBin;
488 Double_t sumPhots=phots->Integral(bin1,bin2);
489 if(sumPhots<3) continue; // if less then 3 photons don't trust to this ring
490 Double_t sumPhotsw=photsw->Integral(bin1,bin2);
491 resultw->Fill((Double_t)((i+0.5)*fDTheta),sumPhotsw);
493 // evaluate the "BEST" theta ckov as the maximum value of histogramm
494 Double_t *pVec = resultw->GetArray();
495 Int_t locMax = TMath::LocMax(nBin,pVec);
496 delete phots;delete photsw;delete resultw; // Reset and delete objects
498 return (Double_t)(locMax*fDTheta+0.5*fDTheta); //final most probable track theta ckov
500 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++