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 // RICH class to perfom pattern recognition based on Hough transfrom //
22 //////////////////////////////////////////////////////////////////////////
24 #include <Riostream.h>
26 #include <TRotation.h>
30 #include "AliRICHParam.h"
31 #include "AliRICHRecon.h"
32 #include "AliRICHHelix.h"
35 #define NPointsOfRing 201
37 //__________________________________________________________________________________________________
38 AliRICHRecon::AliRICHRecon(AliRICHHelix *pHelix,TClonesArray *pClusters,Int_t iMipId)
39 :TTask("RichRec","RichPat")
42 SetFreonScaleFactor(1);
44 fThetaBin=750; fThetaMin = 0.0; fThetaMax = 0.75;
45 fDTheta = 0.001; fWindowWidth = 0.060;
46 fRadiatorWidth = AliRICHParam::Zfreon();
47 fQuartzWidth = AliRICHParam::Zwin();
48 fGapWidth = AliRICHParam::Freon2Pc() - fRadiatorWidth - fQuartzWidth;
49 fXmin = -AliRICHParam::PcSizeX()/2.;
50 fXmax = AliRICHParam::PcSizeX()/2.;
51 fYmin = -AliRICHParam::PcSizeY()/2.;
52 fYmax = AliRICHParam::PcSizeY()/2.;
53 SetTrackTheta(pHelix->Ploc().Theta());
54 SetTrackPhi(pHelix->Ploc().Phi());
56 SetShiftX(pHelix->PosRad().X());
57 SetShiftY(pHelix->PosRad().Y());
58 fpClusters = pClusters;
60 //__________________________________________________________________________________________________
61 Double_t AliRICHRecon::ThetaCerenkov()
63 // Pattern recognition method based on Hough transform
64 // Return theta Cerenkov for a given track and list of clusters which are set in ctor
66 if(fpClusters->GetEntries()==0) return kBad;//no clusters at all for a given track
67 Bool_t kPatRec = kFALSE;
69 AliDebug(1,Form("---Track Parameters--- Theta: %f , Phi: %f ",GetTrackTheta()*TMath::RadToDeg(),GetTrackPhi()*TMath::RadToDeg()));
71 Int_t candidatePhotons = 0;
73 SetThetaCerenkov(999.);
75 SetHoughPhotonsNorm(0);
77 for (Int_t j=0; j < fpClusters->GetEntries(); j++){//clusters loop
82 if (j == GetMipIndex()) continue; // do not consider MIP cluster as a candidate photon
83 Float_t xtoentr = ((AliRICHcluster*)fpClusters->UncheckedAt(j))->X() - GetShiftX();
84 Float_t ytoentr = ((AliRICHcluster*)fpClusters->UncheckedAt(j))->Y() - GetShiftY();
85 SetEntranceX(xtoentr);
86 SetEntranceY(ytoentr);
88 // Int_t photonStatus = PhotonInBand();
89 // if(photonStatus == 0) continue;
91 FindThetaPhotonCerenkov();
92 Float_t thetaPhotonCerenkov = GetThetaPhotonCerenkov();
93 AliDebug(1,Form("THETA CERENKOV ---> %f",thetaPhotonCerenkov));
94 SetPhotonEta(thetaPhotonCerenkov);
98 if(candidatePhotons >= 1) kPatRec = kTRUE;
100 if(!kPatRec) return kBad;
102 SetPhotonsNumber(fpClusters->GetEntries());
109 Int_t nPhotonHough = GetHoughPhotons();
113 SetThetaCerenkov(999.);
114 SetHoughPhotonsNorm(0.);
118 if(fIsWEIGHT) FindWeightThetaCerenkov();
120 Float_t thetaCerenkov = GetThetaCerenkov();
122 AliDebug(1,Form("Number of clusters accepted ---> %i",nPhotonHough));
124 SetThetaOfRing(thetaCerenkov);
125 // FindAreaAndPortionOfRing();
127 // Float_t nPhotonHoughNorm = ((Float_t)nPhotonHough)/GetPortionOfRing();
128 // SetHoughPhotonsNorm(nPhotonHoughNorm);
130 // Calculate the area where the photon are accepted...
132 Float_t thetaInternal = thetaCerenkov - 0.5*fWindowWidth;
133 SetThetaOfRing(thetaInternal);
134 FindAreaAndPortionOfRing();
135 Float_t internalArea = GetAreaOfRing();
137 Float_t thetaExternal = thetaCerenkov + 0.5*fWindowWidth;
138 SetThetaOfRing(thetaExternal);
139 FindAreaAndPortionOfRing();
140 Float_t externalArea = GetAreaOfRing();
142 Float_t houghArea = externalArea - internalArea;
144 SetHoughArea(houghArea);
146 return GetThetaCerenkov();
149 //__________________________________________________________________________________________________
150 void AliRICHRecon::FindEmissionPoint()
152 //estimate the emission point in radiator
154 // Find emission point
156 Float_t absorbtionLenght=7.83*fRadiatorWidth; //absorption length in the freon (cm)
157 // 7.83 = -1/ln(T0) where
158 // T0->Trasmission freon at 180nm = 0.88 (Eph=6.85eV)
159 Float_t photonLenght, photonLenghtMin, photonLenghtMax;
161 photonLenght=exp(-fRadiatorWidth/(absorbtionLenght*cos(fCerenkovAnglePad)));
162 photonLenghtMin=fRadiatorWidth*photonLenght/(1.-photonLenght);
163 photonLenghtMax=absorbtionLenght*cos(fCerenkovAnglePad);
164 Float_t emissionPoint = fRadiatorWidth + photonLenghtMin - photonLenghtMax;
166 SetEmissionPoint(emissionPoint);
167 SetEmissionPoint(fRadiatorWidth/2); // tune the emission point
171 Int_t AliRICHRecon::PhotonInBand()
173 //search band fro photon candidates
175 // Float_t massOfParticle;
180 Float_t xtoentr = GetEntranceX();
181 Float_t ytoentr = GetEntranceY();
186 Float_t phpad = GetPhiPoint();
190 SetPhotonEnergy(5.6);
191 SetEmissionPoint(fRadiatorWidth -0.0001);
192 SetFreonRefractiveIndex();
194 nfreon = GetFreonRefractiveIndex();
197 AliDebug(1,Form("thetacer in photoninband min %f",thetacer));
199 FindThetaAtQuartz(thetacer);
201 if(thetacer == 999. || GetThetaAtQuartz() == 999.)
204 SetXInnerRing(-999.);
205 SetYInnerRing(-999.);
206 SetRadiusInnerRing(-999.);
210 SetThetaPhotonInDRS(GetThetaAtQuartz());
211 SetPhiPhotonInDRS(phpad);
213 innerRadius = FromEmissionToCathode();
214 if(innerRadius == 999.) innerRadius = -999.;
216 SetXInnerRing(GetXPointOnCathode());
217 SetYInnerRing(GetYPointOnCathode());
218 SetRadiusInnerRing(innerRadius);
222 SetPhotonEnergy(7.7);
223 SetEmissionPoint(0.);
224 // SetMassHypotesis(0.139567);
225 SetFreonRefractiveIndex();
227 nfreon = GetFreonRefractiveIndex();
229 thetacer = Cerenkovangle(nfreon,1);
233 AliDebug(1,Form("thetacer in photoninband max %f",thetacer));
235 FindThetaAtQuartz(thetacer);
237 if(thetacer == 999. || GetThetaAtQuartz() == 999.)
242 SetRadiusOuterRing(999.);
246 SetThetaPhotonInDRS(GetThetaAtQuartz());
247 SetPhiPhotonInDRS(phpad);
249 outerRadius = FromEmissionToCathode();
250 // cout << " outerRadius " << outerRadius << endl;
251 SetXOuterRing(GetXPointOnCathode());
252 SetYOuterRing(GetYPointOnCathode());
253 SetRadiusOuterRing(outerRadius);
256 Float_t padradius = sqrt(TMath::Power(xtoentr,2)+TMath::Power(ytoentr,2));
258 AliDebug(1,Form("rmin %f r %f rmax %f",innerRadius,padradius,outerRadius));
260 if(padradius>=innerRadius && padradius<=outerRadius) return 1;
264 void AliRICHRecon::FindThetaAtQuartz(Float_t thetaCerenkov)
266 //find the theta at the quartz plate
268 if(thetaCerenkov == 999.)
270 SetThetaAtQuartz(999.);
274 Float_t thetaAtQuartz = 999.;
276 Float_t trackTheta = GetTrackTheta();
278 if(trackTheta == 0) {
280 thetaAtQuartz = thetaCerenkov;
281 SetThetaAtQuartz(thetaAtQuartz);
285 Float_t trackPhi = GetTrackPhi();
286 Float_t phiPoint = GetPhiPoint();
288 Double_t den = TMath::Sin((Double_t)trackTheta)
289 *TMath::Cos((Double_t)trackPhi)
290 *TMath::Cos((Double_t)phiPoint) +
291 TMath::Sin((Double_t)trackTheta)
292 *TMath::Sin((Double_t)trackPhi)
293 *TMath::Sin((Double_t)phiPoint);
294 Double_t b = TMath::Cos((Double_t)trackTheta)/den;
295 Double_t c = -TMath::Cos((Double_t)thetaCerenkov)/den;
297 Double_t underSqrt = 1 + b*b - c*c;
300 SetThetaAtQuartz(999.);
304 Double_t sol1 = (1+TMath::Sqrt(underSqrt))/(b-c);
305 Double_t sol2 = (1-TMath::Sqrt(underSqrt))/(b-c);
307 Double_t thetaSol1 = 2*TMath::ATan(sol1);
308 Double_t thetaSol2 = 2*TMath::ATan(sol2);
310 if(thetaSol1>0 && thetaSol1 < TMath::Pi()) thetaAtQuartz = (Float_t)thetaSol1;
311 if(thetaSol2>0 && thetaSol2 < TMath::Pi()) thetaAtQuartz = (Float_t)thetaSol2;
313 // AliDebug(1,Form(" Theta @ quartz window %f ",thetaAtQuartz));
315 SetThetaAtQuartz(thetaAtQuartz);
318 void AliRICHRecon::FindThetaPhotonCerenkov()
320 //find theta cerenkov of ring
322 Float_t thetaCerMin = 0.;
323 Float_t thetaCerMax = 0.75;
324 Float_t thetaCerMean;
326 Float_t radiusMin, radiusMax, radiusMean;
327 Int_t nIteration = 0;
329 const Float_t kTollerance = 0.05;
332 Float_t phiPoint = GetPhiPoint();
334 SetPhotonEnergy(6.85);
335 SetEmissionPoint(fRadiatorWidth/2);
337 Float_t xPoint = GetEntranceX();
338 Float_t yPoint = GetEntranceY();
339 Float_t distPoint = TMath::Sqrt(xPoint*xPoint + yPoint*yPoint);
341 AliDebug(1,Form(" DistPoint %f ",distPoint));
343 // Star minimization...
347 FindThetaAtQuartz(thetaCerMin);
349 if(GetThetaAtQuartz() == 999.)
355 SetThetaPhotonInDRS(GetThetaAtQuartz());
356 SetPhiPhotonInDRS(phiPoint);
358 radiusMin = FromEmissionToCathode();
363 FindThetaAtQuartz(thetaCerMax);
364 if(GetThetaAtQuartz() == 999.)
370 SetThetaPhotonInDRS(GetThetaAtQuartz());
371 SetPhiPhotonInDRS(phiPoint);
373 radiusMax = FromEmissionToCathode();
377 thetaCerMean = (thetaCerMax + thetaCerMin)/2;
379 FindThetaAtQuartz(thetaCerMean);
380 if(GetThetaAtQuartz() == 999.)
386 SetThetaPhotonInDRS(GetThetaAtQuartz());
387 SetPhiPhotonInDRS(phiPoint);
389 radiusMean = FromEmissionToCathode();
392 AliDebug(1,Form(" r1 %f rmean %f r2 %f",radiusMin,radiusMean,radiusMax));
394 while (TMath::Abs(radiusMean-distPoint) > kTollerance)
397 if((radiusMin-distPoint)*(radiusMean-distPoint) < 0) thetaCerMax = thetaCerMean;
398 if((radiusMin-distPoint)*(radiusMean-distPoint) > 0) {
400 thetaCerMin = thetaCerMean;
402 FindThetaAtQuartz(thetaCerMin);
403 SetThetaPhotonInDRS(GetThetaAtQuartz());
404 SetPhiPhotonInDRS(phiPoint);
406 radiusMin =FromEmissionToCathode();
409 thetaCerMean = (thetaCerMax + thetaCerMin)/2;
411 FindThetaAtQuartz(thetaCerMean);
412 SetThetaPhotonInDRS(GetThetaAtQuartz());
413 SetPhiPhotonInDRS(phiPoint);
415 radiusMean = FromEmissionToCathode();
419 AliDebug(1,Form(" max iterations in FindPhotonCerenkov ",nIteration));
420 SetThetaPhotonCerenkov(999.);
425 AliDebug(1,Form(" distpoint %f radius %f ",distPoint,radiusMean));
426 SetThetaPhotonCerenkov(thetaCerMean);
430 void AliRICHRecon::FindAreaAndPortionOfRing()
432 //find fraction of the ring accepted by the RICH
434 Float_t xPoint[NPointsOfRing], yPoint[NPointsOfRing];
436 // Float_t xtoentr = GetEntranceX();
437 // Float_t ytoentr = GetEntranceY();
438 Float_t shiftX = GetShiftX();
439 Float_t shiftY = GetShiftY();
441 Float_t xemiss = GetXCoordOfEmission();
442 Float_t yemiss = GetYCoordOfEmission();
444 Float_t x0 = xemiss + shiftX;
445 Float_t y0 = yemiss + shiftY;
448 SetPhotonEnergy(6.85);
449 SetFreonRefractiveIndex();
451 SetEmissionPoint(fRadiatorWidth/2.);
453 Float_t theta = GetThetaOfRing();
456 Int_t nPsiAccepted = 0;
459 for(Int_t i=0;i<NPointsOfRing-1;i++)
462 Float_t psi = 2*TMath::Pi()*i/NPointsOfRing;
464 SetThetaPhotonInTRS(theta);
465 SetPhiPhotonInTRS(psi);
466 FindPhotonAnglesInDRS();
468 Float_t radius = FromEmissionToCathode();
469 if (radius == 999.) continue;
473 Float_t xPointRing = GetXPointOnCathode() + shiftX;
474 Float_t yPointRing = GetYPointOnCathode() + shiftY;
476 SetDetectorWhereX(xPointRing);
477 SetDetectorWhereY(yPointRing);
479 Int_t zone = CheckDetectorAcceptance();
484 FindIntersectionWithDetector();
485 xPoint[nPoints] = GetIntersectionX();
486 yPoint[nPoints] = GetIntersectionY();
490 xPoint[nPoints] = xPointRing;
491 yPoint[nPoints] = yPointRing;
499 xPoint[nPoints] = xPoint[0];
500 yPoint[nPoints] = yPoint[0];
506 for (Int_t i = 0; i < nPoints; i++)
508 area += TMath::Abs((xPoint[i]-x0)*(yPoint[i+1]-y0) - (xPoint[i+1]-x0)*(yPoint[i]-y0));
513 Float_t portionOfRing = ((Float_t)nPsiAccepted)/((Float_t)(nPsiTotal));
517 SetPortionOfRing(portionOfRing);
520 void AliRICHRecon::FindIntersectionWithDetector()
522 // find ring intersection with CsI edges
524 Float_t xIntersect, yIntersect;
525 Float_t x1, x2, y1, y2;
527 Float_t shiftX = GetShiftX();
528 Float_t shiftY = GetShiftY();
530 Float_t xPoint = GetXPointOnCathode() + shiftX;
531 Float_t yPoint = GetYPointOnCathode() + shiftY;
533 Float_t xemiss = GetXCoordOfEmission();
534 Float_t yemiss = GetYCoordOfEmission();
536 Float_t phi = GetPhiPhotonInDRS();
537 Float_t m = tan(phi);
539 Float_t x0 = xemiss + shiftX;
540 Float_t y0 = yemiss + shiftY;
564 yIntersect = m*(xIntersect - x0) + y0;
565 if (yIntersect >= fYmin && yIntersect <= fYmax && xIntersect >= x1 && xIntersect <= x2)
567 SetIntersectionX(xIntersect);
568 SetIntersectionY(yIntersect);
573 yIntersect = m*(xIntersect - x0) + y0;
574 if (yIntersect >= fYmin && yIntersect <= fYmax && xIntersect >= x1 && xIntersect <= x2)
576 SetIntersectionX(xIntersect);
577 SetIntersectionY(yIntersect);
582 xIntersect = (yIntersect - y0)/m + x0;
583 if (xIntersect >= fXmin && xIntersect <= fXmax && yIntersect >= y1 && yIntersect <= y2)
585 SetIntersectionX(xIntersect);
586 SetIntersectionY(yIntersect);
591 xIntersect = (yIntersect - y0)/m + x0;
592 if (xIntersect >= fXmin && xIntersect <= fXmax && yIntersect >= y1 && yIntersect <= y2)
594 SetIntersectionX(xIntersect);
595 SetIntersectionY(yIntersect);
599 cout << " sono fuori!!!!!!" << endl;
602 //__________________________________________________________________________________________________
603 Int_t AliRICHRecon::CheckDetectorAcceptance() const
605 // check for the acceptance
607 // crosses X -2.6 2.6 cm
610 Float_t xcoord = GetDetectorWhereX();
611 Float_t ycoord = GetDetectorWhereY();
615 if(ycoord > fYmax) return 2;
616 if(ycoord > fYmin && ycoord < fYmax) return 3;
617 if(ycoord < fYmin) return 4;
621 if(ycoord > fYmax) return 8;
622 if(ycoord > fYmin && ycoord < fYmax) return 7;
623 if(ycoord < fYmin) return 6;
625 if(xcoord > fXmin && xcoord < fXmax)
627 if(ycoord > fYmax) return 1;
628 if(ycoord > fYmin && ycoord < fYmax) return 0;
629 if(ycoord < fYmin) return 5;
633 //__________________________________________________________________________________________________
634 void AliRICHRecon::FindPhotonAnglesInDRS()
636 // Setup the rotation matrix of the track...
643 Float_t trackTheta = GetTrackTheta();
644 Float_t trackPhi = GetTrackPhi();
646 mtheta.RotateY(trackTheta);
647 mphi.RotateZ(trackPhi);
649 mrot = mphi * mtheta;
650 // minv = mrot.Inverse();
652 TVector3 photonInRadiator(1,1,1);
654 Float_t thetaCerenkov = GetThetaPhotonInTRS();
655 Float_t phiCerenkov = GetPhiPhotonInTRS();
657 photonInRadiator.SetTheta(thetaCerenkov);
658 photonInRadiator.SetPhi(phiCerenkov);
659 photonInRadiator = mrot * photonInRadiator;
660 Float_t theta = photonInRadiator.Theta();
661 Float_t phi = photonInRadiator.Phi();
662 SetThetaPhotonInDRS(theta);
663 SetPhiPhotonInDRS(phi);
667 Float_t AliRICHRecon::FromEmissionToCathode()
669 // trace from emission point to cathode
671 Float_t nfreon, nquartz, ngas;
673 SetFreonRefractiveIndex();
674 SetQuartzRefractiveIndex();
675 SetGasRefractiveIndex();
677 nfreon = GetFreonRefractiveIndex();
678 nquartz = GetQuartzRefractiveIndex();
679 ngas = GetGasRefractiveIndex();
681 Float_t trackTheta = GetTrackTheta();
682 Float_t trackPhi = GetTrackPhi();
683 Float_t lengthOfEmissionPoint = GetEmissionPoint();
685 Float_t theta = GetThetaPhotonInDRS();
686 Float_t phi = GetPhiPhotonInDRS();
688 // cout << " Theta " << Theta << " Phi " << Phi << endl;
690 Float_t xemiss = lengthOfEmissionPoint*tan(trackTheta)*cos(trackPhi);
691 Float_t yemiss = lengthOfEmissionPoint*tan(trackTheta)*sin(trackPhi);
693 SetXCoordOfEmission(xemiss);
694 SetYCoordOfEmission(yemiss);
696 Float_t thetaquar = SnellAngle(nfreon, nquartz, theta);
698 if(thetaquar == 999.)
700 SetXPointOnCathode(999.);
701 SetYPointOnCathode(999.);
705 Float_t thetagap = SnellAngle( nquartz, ngas, thetaquar);
709 SetXPointOnCathode(999.);
710 SetYPointOnCathode(999.);
714 Float_t xw = (fRadiatorWidth - lengthOfEmissionPoint)*cos(phi)*tan(theta);
715 Float_t xq = fQuartzWidth*cos(phi)*tan(thetaquar);
716 Float_t xg = fGapWidth*cos(phi)*tan(thetagap);
717 Float_t yw = (fRadiatorWidth - lengthOfEmissionPoint)*sin(phi)*tan(theta);
718 Float_t yq = fQuartzWidth*sin(phi)*tan(thetaquar);
719 Float_t yg = fGapWidth*sin(phi)*tan(thetagap);
722 Float_t xtot = xemiss + xw + xq + xg;
723 Float_t ytot = yemiss + yw + yq + yg;
725 SetXPointOnCathode(xtot);
726 SetYPointOnCathode(ytot);
729 Float_t distanceFromEntrance = sqrt(TMath::Power(fPhotonLimitX,2)
730 +TMath::Power(fPhotonLimitY,2));
732 return distanceFromEntrance;
737 void AliRICHRecon::FindPhiPoint()
739 //find phi of generated point
741 Float_t xtoentr = GetEntranceX();
742 Float_t ytoentr = GetEntranceY();
744 Float_t trackTheta = GetTrackTheta();
745 Float_t trackPhi = GetTrackPhi();
747 Float_t emissionPoint = GetEmissionPoint();
749 Float_t argY = ytoentr - emissionPoint*tan(trackTheta)*sin(trackPhi);
750 Float_t argX = xtoentr - emissionPoint*tan(trackTheta)*cos(trackPhi);
751 Float_t phi = atan2(argY,argX);
757 Float_t AliRICHRecon::Cerenkovangle(Float_t n, Float_t beta)
759 // cerenkov angle from n and beta
761 // Compute the cerenkov angle
767 // cout << " warning in Cerenkoangle !!!!!! " << endl;
771 thetacer = acos (1./(n*beta));
775 Float_t AliRICHRecon::SnellAngle(Float_t n1, Float_t n2, Float_t theta1)
779 // Compute the Snell angle
781 Float_t sinrefractangle;
782 Float_t refractangle;
784 sinrefractangle = (n1/n2)*sin(theta1);
786 if(sinrefractangle>1.) {
787 // cout << " PROBLEMS IN SNELL ANGLE !!!!! " << endl;
792 refractangle = asin(sinrefractangle);
797 void AliRICHRecon::HoughResponse()
801 // Implement Hough response pat. rec. method
808 int i, j, k, nCorrBand;
809 float hcs[750],hcsw[750];
811 float lowerlimit,upperlimit;
817 float etaPeakPos = -1;
819 Int_t etaPeakCount = -1;
821 Float_t thetaCerenkov = 0.;
823 nBin = (int)(0.5+fThetaMax/(fDTheta));
824 nCorrBand = (int)(0.5+ fWindowWidth/(2 * fDTheta));
826 memset ((void *)hcs, 0, fThetaBin*sizeof(float));
827 memset ((void *)hcsw, 0, fThetaBin*sizeof(float));
829 Int_t nPhotons = GetPhotonsNumber();
831 Int_t weightFlag = 0;
833 for (k=0; k< nPhotons; k++) {
837 angle = GetPhotonEta();
839 if(angle == -999.) continue;
841 if (angle>=fThetaMin && angle<= fThetaMax)
845 bin = (int)(0.5+angle/(fDTheta));
854 lowerlimit = ((Float_t)bin1)*fDTheta + 0.5*fDTheta;
855 SetThetaOfRing(lowerlimit);
856 FindAreaAndPortionOfRing();
857 Float_t area1 = GetAreaOfRing();
859 upperlimit = ((Float_t)bin2)*fDTheta + 0.5*fDTheta;
860 SetThetaOfRing(upperlimit);
861 FindAreaAndPortionOfRing();
862 Float_t area2 = GetAreaOfRing();
864 // cout << "lowerlimit" << lowerlimit << "upperlimit " << upperlimit << endl;
865 Float_t diffarea = area2 - area1;
869 weight = 1./(area2-area1);
877 // cout <<" low "<< lowerlimit << " up " << upperlimit <<
878 // " area1 " << area1 << " area2 " << area2 << " weight " << weight << endl;
886 SetPhotonWeight(weight);
888 // cout << "weight..." << weight << endl;
892 if (bin2>nBin) bin2=nBin;
894 for (j=bin1; j<bin2; j++)
910 // cout << " probems with weight...normal procedure adopted " << endl;
913 HoughFiltering(hCSspace);
915 for (bin=0; bin <nBin; bin++) {
916 angle = (bin+0.5) * (fDTheta);
917 if (hCSspace[bin] && hCSspace[bin] > etaPeakPos) {
919 etaPeakPos = hCSspace[bin];
923 if (hCSspace[bin] == etaPeakPos) {
924 etaPeak[++etaPeakCount] = angle;
929 for (i=0; i<etaPeakCount+1; i++) {
930 thetaCerenkov += etaPeak[i];
932 if (etaPeakCount>=0) {
933 thetaCerenkov /= etaPeakCount+1;
934 fThetaPeakPos = etaPeakPos;
937 SetThetaCerenkov(thetaCerenkov);
941 void AliRICHRecon::HoughFiltering(float hcs[])
948 float k[5] = {0.05, 0.25, 0.4, 0.25, 0.05};
953 nBin = (int)(1+fThetaMax/fDTheta);
954 sizeHCS = fThetaBin*sizeof(float);
956 memset ((void *)hcsFilt, 0, sizeHCS);
958 for (nx = 0; nx < nBin; nx++) {
959 for (i = 0; i < 5; i++) {
961 if (nxDx> -1 && nxDx<nBin)
962 hcsFilt[nx] += hcs[nxDx] * k[i];
966 for (nx = 0; nx < nBin; nx++) {
967 hcs[nx] = hcsFilt[nx];
971 void AliRICHRecon::FindWeightThetaCerenkov()
973 // manage with weight for photons
976 Float_t weightThetaCerenkov = 0.;
978 Int_t nPhotons = GetPhotonsNumber();
979 for(Int_t i=0;i<nPhotons;i++)
983 if(GetPhotonFlag() == 2)
985 Float_t photonEta = GetPhotonEta();
986 Float_t photonWeight = GetPhotonWeight();
987 weightThetaCerenkov += photonEta*photonWeight;
994 weightThetaCerenkov /= wei;
998 weightThetaCerenkov = 0.;
1001 SetThetaCerenkov(weightThetaCerenkov);
1003 cout << " thetac weighted -> " << weightThetaCerenkov << endl;
1007 void AliRICHRecon::FlagPhotons()
1011 Int_t nPhotonHough = 0;
1013 Float_t thetaCerenkov = GetThetaCerenkov();
1014 AliDebug(1,Form(" fThetaCerenkov %f ",thetaCerenkov));
1016 Float_t thetaDist= thetaCerenkov - fThetaMin;
1017 Int_t steps = (Int_t)(thetaDist / fDTheta);
1019 Float_t tmin = fThetaMin + (Float_t)(steps - 1)*fDTheta;
1020 Float_t tmax = fThetaMin + (Float_t)(steps)*fDTheta;
1021 Float_t tavg = 0.5*(tmin+tmax);
1023 tmin = tavg - 0.5*fWindowWidth;
1024 tmax = tavg + 0.5*fWindowWidth;
1026 // Int_t candidatePhotonsNumber = GetCandidatePhotonsNumber();
1028 Int_t nPhotons = GetPhotonsNumber();
1030 // for(Int_t i=0;i<candidatePhotonsNumber;i++)
1032 for(Int_t i=0;i<nPhotons;i++)
1036 Float_t photonEta = GetPhotonEta();
1038 if(photonEta == -999.) continue;
1040 if(photonEta >= tmin && photonEta <= tmax)
1046 SetHoughPhotons(nPhotonHough);