40 fPhotFlag = std::unique_ptr<int[]>(
new int[
n]);
43 fPhotCkov = std::unique_ptr<double[]>(
new double[
n]);
44 fPhotPhi = std::unique_ptr<double[]>(
new double[
n]);
45 fPhotWei = std::unique_ptr<double[]>(
new double[
n]);
56 const int nMinPhotAcc = 3;
62 float xPc, yPc, th, ph;
64 match->getHMPIDtrk(xPc, yPc, th, ph);
70 float mipQ = -1, mipX = -1, mipY = -1;
71 int chId = -1, sizeClu = -1;
77 for (
int iClu = 0; iClu <
clusters.size(); iClu++) {
80 nPads += cluster.
size();
85 sizeClu = cluster.
size();
93 double thetaCer, phiCer;
103 match->setIdxHMPClus(chId,
index + 1000 * sizeClu);
104 match->setMipClusSize(sizeClu);
121 float photCharge[10] = {0x0};
126 match->setPhotCharge(photCharge);
127 match->setHMPIDmip(mipX, mipY, mipQ, iNrec);
129 if (iNrec < nMinPhotAcc) {
134 int occupancy = (
int)(1000 * (nPads / (6. * 80. * 48.)));
139 match->setHMPsignal(thetaC + occupancy);
156 double cluR = TMath::Sqrt((cluX -
fPc.X()) * (cluX -
fPc.X()) +
157 (cluY -
fPc.Y()) * (cluY -
fPc.Y()));
158 double phi = (pc - rad).Phi();
161 double ckov2 = 0.75 +
fTrkDir.Theta();
162 const double kTol = 0.01;
165 if (iIterCnt >= 50) {
168 double ckov = 0.5 * (ckov1 + ckov2);
169 dirCkov.SetMagThetaPhi(1, ckov, phi);
171 double dist = cluR - (posC -
fPc).Mod();
172 if (posC.X() == -999) {
179 else if (dist < -kTol) {
183 dirCkov.SetMagThetaPhi(1, ckov, phi);
184 lors2Trs(dirCkov, thetaCer, phiCer);
204 TVector3 photonHitV, apparentV, surfaceV;
206 apparentV = photonHitV - emissionV;
207 surfaceV = emissionV;
212 Double_t apparentTheta = apparentV.Theta();
213 Double_t correctedTheta = asin(n2 / n1 * sin(apparentTheta));
214 Double_t deltaTheta = apparentTheta - correctedTheta;
216 TVector3 perpV = apparentV.Cross(surfaceV);
217 TVector3 cherenkovV = apparentV;
220 lors2Trs(cherenkovV, thetaCer, phiCer);
234 TVector2
pos(-999, -999);
235 double thetaCer = dirCkov.Theta();
246 pos.Set(posCkov.X(), posCkov.Y());
263 mtheta.RotateY(-
fTrkDir.Theta());
268 TRotation mrot = mtheta * mphi;
271 dirCkovTRS = mrot * dirCkov;
272 phiCer = dirCkovTRS.Phi();
273 thetaCer = dirCkovTRS.Theta();
287 mtheta.RotateY(
fTrkDir.Theta());
292 TRotation mrot = mphi * mtheta;
294 TVector3 dirCkovLORS;
295 dirCkovLORS = mrot * dirCkov;
297 phiCer = dirCkovLORS.Phi();
298 thetaCer = dirCkovLORS.Theta();
308 Int_t kN = 50 *
level;
312 Bool_t
first = kFALSE;
315 for (Int_t
i = 0;
i < kN;
i++) {
317 pos1 =
tracePhot(ckovAng, Double_t(TMath::TwoPi() * (
i + 1) / kN));
318 if (pos1.X() == -999) {
331 TVector2 pos2 =
tracePhot(ckovAng, Double_t(TMath::TwoPi() * (
i + 1) / kN));
332 if (pos2.X() == -999) {
348 fRingAcc = (Double_t)nPoints / (Double_t)kN;
361 double xmin = (
p1.X() <
p2.X()) ?
p1.X() :
p2.X();
362 double xmax = (
p1.X() <
p2.X()) ?
p2.X() :
p1.X();
363 double ymin = (
p1.Y() <
p2.Y()) ?
p1.Y() :
p2.Y();
364 double ymax = (
p1.Y() <
p2.Y()) ?
p2.Y() :
p1.Y();
366 double m = TMath::Tan((
p2 -
p1).Phi());
369 pint.Set((
double)(
p1.X() + (0 -
p1.Y()) /
m), 0.);
371 pint.X() >= xmin && pint.X() <= xmax &&
372 pint.Y() >= ymin && pint.Y() <= ymax) {
378 pint.X() >= xmin && pint.X() <= xmax &&
379 pint.Y() >= ymin && pint.Y() <= ymax) {
383 pint.Set(0., (
double)(
p1.Y() +
m * (0 -
p1.X())));
385 pint.Y() >= ymin && pint.Y() <= ymax &&
386 pint.X() >= xmin && pint.X() <= xmax) {
392 pint.Y() >= ymin && pint.Y() <= ymax &&
393 pint.X() >= xmin && pint.X() <= xmax) {
407 Double_t weightThetaCerenkov = 0.;
409 Double_t ckovMin = 9999., ckovMax = 0.;
434 weightThetaCerenkov /= wei;
436 weightThetaCerenkov = 0.;
438 return weightThetaCerenkov;
453 Int_t steps = (Int_t)((ckov) /
fDTheta);
455 Double_t tmin = (Double_t)(steps - 1) *
fDTheta;
456 Double_t tmax = (Double_t)(steps)*
fDTheta;
457 Double_t tavg = 0.5 * (tmin + tmax);
462 Int_t iInsideCnt = 0;
469 if (iInsideCnt < 10) {
470 photChargeVec[iInsideCnt] =
charge;
487 TVector3 dirTRS, dirLORS;
488 dirTRS.SetMagThetaPhi(1, ckovThe, ckovPhi);
490 dirLORS.SetMagThetaPhi(1, theta, phi);
502 static TVector3 nrm(0, 0, 1);
503 TVector3 pnt(0, 0,
z);
505 TVector3 diff = pnt -
pos;
506 double sint = (nrm * diff) / (nrm * dir);
519 double sinref = (n1 / n2) * TMath::Sin(dir.Theta());
520 if (TMath::Abs(sinref) > 1.) {
521 dir.SetXYZ(-999, -999, -999);
523 dir.SetTheta(TMath::ASin(sinref));
531 Double_t kThetaMax = 0.75;
533 TH1D* phots =
new TH1D(
"Rphot",
"phots",
nChannels, 0, kThetaMax);
534 TH1D* photsw =
new TH1D(
"RphotWeighted",
"photsw",
nChannels, 0, kThetaMax);
535 TH1D* resultw =
new TH1D(
"resultw",
"resultw",
nChannels, 0, kThetaMax);
536 Int_t nBin = (Int_t)(kThetaMax /
fDTheta);
541 if (angle < 0 || angle > kThetaMax) {
554 Double_t diffArea = areaHigh - areaLow;
563 for (Int_t
i = 1;
i <= nBin;
i++) {
564 Int_t bin1 =
i - nCorrBand;
565 Int_t bin2 =
i + nCorrBand;
572 Double_t sumPhots = phots->Integral(bin1, bin2);
576 Double_t sumPhotsw = photsw->Integral(bin1, bin2);
577 if ((Double_t)((
i + 0.5) *
fDTheta) > 0.7) {
580 resultw->Fill((Double_t)((
i + 0.5) *
fDTheta), sumPhotsw);
583 Double_t* pVec = resultw->GetArray();
584 Int_t locMax = TMath::LocMax(nBin, pVec);
604 Int_t ipc, ipadx, ipady;
608 for (
int j = 0;
j < nStep;
j++) {
610 pos =
tracePhot(ckov,
j * TMath::TwoPi() / (
double)(nStep - 1));
617 if (ipadx < 0 || ipady > 160 || ipady < 0 || ipady > 144 || ch < 0 || ch > 6) {
625 return ((
double)nPhi / (
double)nStep);
constexpr int p1()
constexpr to accelerate the coordinates changing
Class to store the output of the matching to HMPID.
ClassImp(o2::hmpid::Recon)
HMPID cluster implementation.
static bool isDeadPad(Int_t padx, Int_t pady, Int_t ch)
static bool isInDead(float x, float y)
void setRefIdx(double refRadIdx)
static void lors2Pad(float x, float y, Int_t &pc, Int_t &px, Int_t &py)
static bool isInside(float x, float y, float d=0)
double sigma2(double trkTheta, double trkPhi, double ckovTh, double ckovPh)
void ckovAngle(o2::dataformats::MatchInfoHMP *match, const std::vector< o2::hmpid::Cluster > clusters, int index, double nmean, float xRa, float yRa)
o2::hmpid::Param * fParam
std::unique_ptr< int[]> fPhotClusIndex
void setTrack(double xRad, double yRad, double theta, double phi)
std::unique_ptr< double[]> fPhotPhi
bool findPhotCkov2(double cluX, double cluY, double &thetaCer, double &phiCer)
TVector2 traceForward(TVector3 dirCkov) const
bool findPhotCkov(double cluX, double cluY, double &thetaCer, double &phiCer)
double getRingArea() const
double findRingCkov(int iNclus)
double findRingExt(double ckov, int ch, double xPc, double yPc, double thRa, double phRa)
std::unique_ptr< double[]> fPhotWei
void lors2Trs(TVector3 dirCkov, double &thetaCer, double &phiCer) const
std::unique_ptr< int[]> fPhotFlag
std::unique_ptr< double[]> fPhotCkov
void refract(TVector3 &dir, double n1, double n2) const
void propagate(const TVector3 dir, TVector3 &pos, double z) const
TVector2 tracePhot(double ckovTh, double ckovPh) const
void trs2Lors(TVector3 dirCkov, double &thetaCer, double &phiCer) const
const TVector2 intWithEdge(TVector2 p1, TVector2 p2)
int flagPhot(double ckov, const std::vector< o2::hmpid::Cluster > clusters, float *photChargeVec)
void findRingGeom(double ckovAng, int level=1)
bool match(const std::vector< std::string > &queries, const char *pattern)
GLuint GLuint GLfloat weight
GLdouble GLdouble GLdouble z
constexpr size_t nChannels
std::vector< Cluster > clusters