#include <Conv4HitsReco2.h>
Definition at line 18 of file Conv4HitsReco2.h.
Conv4HitsReco2::Conv4HitsReco2 | ( | math::XYZVector & | vPhotVertex, |
math::XYZVector & | h1, | ||
math::XYZVector & | h2, | ||
math::XYZVector & | h3, | ||
math::XYZVector & | h4 | ||
) |
Definition at line 16 of file Conv4HitsReco2.cc.
References Refresh().
{ Refresh(vPhotVertex, h1, h2, h3, h4); }
Conv4HitsReco2::Conv4HitsReco2 | ( | ) |
Conv4HitsReco2::~Conv4HitsReco2 | ( | ) |
Definition at line 21 of file Conv4HitsReco2.cc.
{ }
int Conv4HitsReco2::ConversionCandidate | ( | math::XYZVector & | vtx, |
double & | ptplus, | ||
double & | ptminus | ||
) |
Definition at line 90 of file Conv4HitsReco2.cc.
References fBField, fLoop, fRecR1, fRecR2, fRecV, and Reconstruct().
Referenced by SeedForPhotonConversionFromQuadruplets::trajectorySeed().
void Conv4HitsReco2::Dump | ( | void | ) |
Definition at line 244 of file Conv4HitsReco2.cc.
References gather_cfg::cout, fCutSatisfied, fSignSatisfied, and fSolved.
Referenced by SeedForPhotonConversionFromQuadruplets::trajectorySeed().
{ std::cout << std::endl<< "================================================" << std::endl; std::cout << " Nothing happend here."; if (fSolved==1) std::cout << "Solved."; if (fCutSatisfied==1) std::cout << "Cut good."; if (fSignSatisfied==1) std::cout << "Sign good."; }
int Conv4HitsReco2::GetLoop | ( | ) | [inline] |
math::XYZVector Conv4HitsReco2::GetMinusCenter | ( | double & | minusR | ) |
math::XYZVector Conv4HitsReco2::GetPlusCenter | ( | double & | plusR | ) |
double Conv4HitsReco2::GetRecPhi | ( | ) | [inline] |
double Conv4HitsReco2::GetRecR | ( | ) | [inline] |
double Conv4HitsReco2::GetRecR1 | ( | ) | [inline] |
double Conv4HitsReco2::GetRecR2 | ( | ) | [inline] |
void Conv4HitsReco2::LocalTransformation | ( | math::XYZVector | v11, |
math::XYZVector | v12, | ||
math::XYZVector | v21, | ||
math::XYZVector | v22, | ||
math::XYZVector & | V11, | ||
math::XYZVector & | V12, | ||
math::XYZVector & | V21, | ||
math::XYZVector & | V22, | ||
double | Phi | ||
) | [private] |
Definition at line 55 of file Conv4HitsReco2.cc.
References funct::cos(), and funct::sin().
{ double x11,x12,x21,x22,y11,y12,y21,y22; x11 = v11.X(); y11 = v11.Y(); x12 = v12.X(); y12 = v12.Y(); x21 = v21.X(); y21 = v21.Y(); x22 = v22.X(); y22 = v22.Y(); double SINP = std::sin(NextPhi); double COSP = std::cos(NextPhi); double SignCOSP = 1.; if(COSP < 0.) SignCOSP = -1.; double AbsCOSP = std::fabs(COSP); double X11 = -std::fabs(x11*SINP*SignCOSP - y11*AbsCOSP); double Y11 = std::fabs(y11*SINP*SignCOSP + x11*AbsCOSP); double X21 = -std::fabs(x21*SINP*SignCOSP - y21*AbsCOSP); double Y21 = std::fabs(y21*SINP*SignCOSP + x21*AbsCOSP); double X12 = std::fabs(x12*SINP*SignCOSP - y12*AbsCOSP); double Y12 = std::fabs(y12*SINP*SignCOSP + x12*AbsCOSP); double X22 = std::fabs(x22*SINP*SignCOSP - y22*AbsCOSP); double Y22 = std::fabs(y22*SINP*SignCOSP + x22*AbsCOSP); V11.SetXYZ(X11,Y11,0.); V12.SetXYZ(X12,Y12,0.); V21.SetXYZ(X21,Y21,0.); V22.SetXYZ(X22,Y22,0.); }
void Conv4HitsReco2::Reconstruct | ( | ) |
Definition at line 102 of file Conv4HitsReco2.cc.
References funct::cos(), fCutSatisfied, fFixedNumberOfIterations, fHitv11, fHitv12, fHitv21, fHitv22, fLoop, fMaxNumberOfIterations, fPhiE, fPhiECut, fPV, fRadiusE, fRadiusECut, fRE, fRecC1, fRecC2, fRecPhi, fRecR, fRecR1, fRecR2, fRECut, fRecV, fSignSatisfied, fSolved, i, funct::pow(), funct::sin(), and mathSSE::sqrt().
Referenced by ConversionCandidate().
{ double x11,x12,x21,x22,y11,y12,y21,y22; //double X11,X12,X21,X22,Y11,Y12,Y21,Y22; x11 = fHitv11.X(); y11 = fHitv11.Y(); x12 = fHitv12.X(); y12 = fHitv12.Y(); x21 = fHitv21.X(); y21 = fHitv21.Y(); x22 = fHitv22.X(); y22 = fHitv22.Y(); if (fFixedNumberOfIterations==0) fLoop = fMaxNumberOfIterations; else fLoop = fFixedNumberOfIterations; // Setting Phi1, Phi2 initial guess range, and first guess double tempr1 = std::sqrt(y11*y11 + x11*x11); double tempr2 = std::sqrt(y12*y12 + x12*x12); double Phi1 = 2.0 * std::atan(y11 / (x11+tempr1)); double Phi2 = 2.0 * std::atan(y12 / (x12+tempr2)); if (Phi1<Phi2) Phi1 += 2.0 * 3.141592653; // stupid Atan correction fPhiE = std::fabs((Phi1-Phi2)) / std::pow(2.0, fLoop + 1); double NextPhi = ( Phi1 + Phi2 ) / 2.0; // first guess double D1, D2 = 0.0; double prevR1 = 0; double prevR2 = 0; double R1 = 0; double R2 = 0; // Iterations for (int i=0; i<fLoop; i++) { // LOCAL TRANFORMATION & EXTRACTION double SINP = std::sin(NextPhi); double COSP = std::cos(NextPhi); double SignCOSP = 1.; if(COSP < 0.) SignCOSP = -1.; double AbsCOSP = std::fabs(COSP); double X11 = -std::fabs(x11*SINP*SignCOSP - y11*AbsCOSP); double Y11 = std::fabs(y11*SINP*SignCOSP + x11*AbsCOSP); double X21 = -std::fabs(x21*SINP*SignCOSP - y21*AbsCOSP); double Y21 = std::fabs(y21*SINP*SignCOSP + x21*AbsCOSP); double X12 = std::fabs(x12*SINP*SignCOSP - y12*AbsCOSP); double Y12 = std::fabs(y12*SINP*SignCOSP + x12*AbsCOSP); double X22 = std::fabs(x22*SINP*SignCOSP - y22*AbsCOSP); double Y22 = std::fabs(y22*SINP*SignCOSP + x22*AbsCOSP); // I'm not using LocalTransform() function because this direct way turns out to be faster // SOLVING EQUATIONS double d1 = Y21 - Y11; double d2 = Y22 - Y12; if ( ( (X11*X11*d1*d1/(X21-X11)/(X21-X11) + X11*X21 + X11*d1*d1/(X21-X11)) < 0 ) || ( (X12*X12*d2*d2/(X22-X12)/(X22-X12) + X12*X22 + X12*d2*d2/(X22-X12)) < 0 ) ) { fSolved = -1; fLoop = i; return; } // No real root. Break out. else { fSolved = 1; D1 = X11*d1/(X21-X11); D1 = D1 + std::sqrt(X11*X11*d1*d1/(X21-X11)/(X21-X11) + X11*X21 + X11*d1*d1/(X21-X11)); D2 = X12*d2/(X22-X12); D2 = D2 + std::sqrt(X12*X12*d2*d2/(X22-X12)/(X22-X12) + X12*X22 + X12*d2*d2/(X22-X12)); R1 = std::fabs((X11+X21)/2.0+(D1+d1/2.0)*d1/(X21-X11)); R2 = std::fabs((X12+X22)/2.0+(D2+d2/2.0)*d2/(X22-X12)); if ((Y11-D1)>=(Y12-D2)) { // Moving RIGHT Phi1 = NextPhi; Phi2 = Phi2; NextPhi = (Phi1+Phi2)/2.0; } else if ((Y11-D1)<(Y12-D2)) { // Moving LEFT Phi1 = Phi1; Phi2 = NextPhi; NextPhi = (Phi1+Phi2)/2.0; } // CHECK STOP CONDITION double tmpPhiE = std::fabs(Phi1-Phi2); double tmpRE = std::fabs( (Y11 - D1) - (Y12 - D2) ); double tmpRadiusE = ( std::fabs(R1-prevR1) + std::fabs(R2-prevR2) ) / 2.; // A. Cut threshold satisfied - STOP - record if (( tmpPhiE <= fPhiECut ) && ( tmpRE <= fRECut ) && ( tmpRadiusE <= fRadiusECut ) && ( fFixedNumberOfIterations ==0 )) { fSolved = 1; fCutSatisfied = 1; fLoop = i+1; fPhiE = tmpPhiE; fRE = tmpRE; fRadiusE = tmpRadiusE; fRecR1 = R1; fRecR2 = R2; fRecR = ( (Y11 - D1) + (Y12 - D2) ) / 2.0; fRecPhi = NextPhi; fRecV.SetX( fRecR * cos(fRecPhi) ); fRecV.SetY( fRecR * sin(fRecPhi) ); fRecC1.SetXYZ( fRecV.X()-fRecR1*sin(fRecPhi), fRecV.Y()+fRecR1*cos(fRecPhi), 0.); fRecC2.SetXYZ( fRecV.X()+fRecR2*sin(fRecPhi), fRecV.Y()-fRecR2*cos(fRecPhi), 0.); fRecV = fRecV + fPV; fRecC1 = fRecC1 + fPV; fRecC2 = fRecC2 + fPV; fCutSatisfied = 1; if ( (R1>0)&&(R2>0)&&(D1>0)&&(D2>0)&&((Y11-D1)>0)&&((Y12-D2)>0) ) fSignSatisfied = 1; else fSignSatisfied = 0; } else if (i==fLoop-1) { fSolved = 1; fCutSatisfied = 1; fLoop = i+1; fPhiE = tmpPhiE; fRE = tmpRE; fRadiusE = tmpRadiusE; fRecR1 = R1; fRecR2 = R2; fRecR = ( (Y11 - D1) + (Y12 - D2) ) / 2.0; fRecPhi = NextPhi; fRecV.SetX( fRecR * cos(fRecPhi) ); fRecV.SetY( fRecR * sin(fRecPhi) ); fRecC1.SetXYZ( fRecV.X()-fRecR1*sin(fRecPhi), fRecV.Y()+fRecR1*cos(fRecPhi), 0.); fRecC2.SetXYZ( fRecV.X()+fRecR2*sin(fRecPhi), fRecV.Y()-fRecR2*cos(fRecPhi), 0.); fRecV = fRecV + fPV; fRecC1 = fRecC1 + fPV; fRecC2 = fRecC2 + fPV; fCutSatisfied = 0; if ( (R1>0)&&(R2>0)&&(D1>0)&&(D2>0)&&((Y11-D1)>0)&&((Y12-D2)>0) ) fSignSatisfied = 1; else fSignSatisfied = 0; } // B. Cut threshold NOT satisfied - prepare for next loop prevR1 = R1; prevR2 = R2; } } }
void Conv4HitsReco2::Refresh | ( | math::XYZVector & | vPhotVertex, |
math::XYZVector & | h1, | ||
math::XYZVector & | h2, | ||
math::XYZVector & | h3, | ||
math::XYZVector & | h4 | ||
) |
Definition at line 24 of file Conv4HitsReco2.cc.
References fBField, fCutSatisfied, fFixedNumberOfIterations, fHitv11, fHitv12, fHitv21, fHitv22, fMaxNumberOfIterations, fPhiE, fPhiECut, fPV, fRadiusE, fRadiusECut, fRE, fRecPhi, fRecR, fRecR1, fRecR2, fRECut, fSignSatisfied, and fSolved.
Referenced by Conv4HitsReco2().
{ // Fix 2D plane, make primary vertex the original point fPV = vPhotVertex; fPV.SetZ(0.); fHitv11 = h3; fHitv11.SetZ(0.); fHitv11 = fHitv11 - fPV; fHitv21 = h4; fHitv21.SetZ(0.); fHitv21 = fHitv21 - fPV; fHitv12 = h2; fHitv12.SetZ(0.); fHitv12 = fHitv12 - fPV; fHitv22 = h1; fHitv22.SetZ(0.); fHitv22 = fHitv22 - fPV; // DEFAULT setup fMaxNumberOfIterations = 40; fFixedNumberOfIterations = 0; fRadiusECut = 10.0;//cm fPhiECut = 0.03;//rad fRECut = 0.5;//cm fBField = 3.8;//T // TRIVIAL initialization fCutSatisfied = 0; fSignSatisfied = 0; fSolved = 0; fRecPhi = 0.; fRecR = 0.; fRecR1 = 0.; fRecR2 = 0.; fRadiusE = 0.; fRE = 0.; fPhiE = 0.; }
bool Conv4HitsReco2::RegisterBadConverge | ( | ) | [inline] |
Definition at line 53 of file Conv4HitsReco2.h.
References fCutSatisfied.
{ if (fCutSatisfied==1) return true; else return false;};
bool Conv4HitsReco2::RegisterBadConverge | ( | int & | num | ) | [inline] |
Definition at line 52 of file Conv4HitsReco2.h.
References fCutSatisfied.
{ if (fCutSatisfied==1) return true; else {num+=1; return false;}};
bool Conv4HitsReco2::RegisterBadSign | ( | int & | num | ) | [inline] |
Definition at line 50 of file Conv4HitsReco2.h.
References fSignSatisfied.
{ if (fSignSatisfied==1) return true; else {num+=1; return false;}};
bool Conv4HitsReco2::RegisterBadSign | ( | ) | [inline] |
Definition at line 51 of file Conv4HitsReco2.h.
References fSignSatisfied.
{ if (fSignSatisfied==1) return true; else return false; };
bool Conv4HitsReco2::RegisterUnsolvable | ( | int & | num | ) | [inline] |
Definition at line 48 of file Conv4HitsReco2.h.
References fSolved.
bool Conv4HitsReco2::RegisterUnsolvable | ( | ) | [inline] |
Definition at line 49 of file Conv4HitsReco2.h.
References fSolved.
{ if (fSolved==1) return true; else return false; };
void Conv4HitsReco2::SetBField | ( | double | val | ) | [inline] |
void Conv4HitsReco2::SetFixedNumberOfIterations | ( | double | val | ) | [inline] |
Definition at line 39 of file Conv4HitsReco2.h.
References fFixedNumberOfIterations.
{ fFixedNumberOfIterations=val; };
void Conv4HitsReco2::SetMaxNumberOfIterations | ( | int | val | ) | [inline] |
Definition at line 35 of file Conv4HitsReco2.h.
References fMaxNumberOfIterations.
Referenced by SeedForPhotonConversionFromQuadruplets::trajectorySeed().
{ fMaxNumberOfIterations=val; };
void Conv4HitsReco2::SetPhiECut | ( | double | val | ) | [inline] |
void Conv4HitsReco2::SetRadiusECut | ( | double | val | ) | [inline] |
void Conv4HitsReco2::SetRECut | ( | double | val | ) | [inline] |
double Conv4HitsReco2::fBField [private] |
Definition at line 82 of file Conv4HitsReco2.h.
Referenced by ConversionCandidate(), Refresh(), and SetBField().
int Conv4HitsReco2::fCutSatisfied [private] |
Definition at line 68 of file Conv4HitsReco2.h.
Referenced by Dump(), Reconstruct(), Refresh(), and RegisterBadConverge().
int Conv4HitsReco2::fFixedNumberOfIterations [private] |
Definition at line 74 of file Conv4HitsReco2.h.
Referenced by Reconstruct(), Refresh(), and SetFixedNumberOfIterations().
math::XYZVector Conv4HitsReco2::fHitv11 [private] |
Definition at line 59 of file Conv4HitsReco2.h.
Referenced by Reconstruct(), and Refresh().
math::XYZVector Conv4HitsReco2::fHitv12 [private] |
Definition at line 59 of file Conv4HitsReco2.h.
Referenced by Reconstruct(), and Refresh().
math::XYZVector Conv4HitsReco2::fHitv21 [private] |
Definition at line 59 of file Conv4HitsReco2.h.
Referenced by Reconstruct(), and Refresh().
math::XYZVector Conv4HitsReco2::fHitv22 [private] |
Definition at line 59 of file Conv4HitsReco2.h.
Referenced by Reconstruct(), and Refresh().
int Conv4HitsReco2::fLoop [private] |
Definition at line 73 of file Conv4HitsReco2.h.
Referenced by ConversionCandidate(), GetLoop(), and Reconstruct().
int Conv4HitsReco2::fMaxNumberOfIterations [private] |
Definition at line 72 of file Conv4HitsReco2.h.
Referenced by Reconstruct(), Refresh(), and SetMaxNumberOfIterations().
double Conv4HitsReco2::fPhiE [private] |
Definition at line 80 of file Conv4HitsReco2.h.
Referenced by Reconstruct(), and Refresh().
double Conv4HitsReco2::fPhiECut [private] |
Definition at line 76 of file Conv4HitsReco2.h.
Referenced by Reconstruct(), Refresh(), and SetPhiECut().
math::XYZVector Conv4HitsReco2::fPV [private] |
Definition at line 60 of file Conv4HitsReco2.h.
Referenced by Reconstruct(), and Refresh().
double Conv4HitsReco2::fRadiusE [private] |
Definition at line 79 of file Conv4HitsReco2.h.
Referenced by Reconstruct(), and Refresh().
double Conv4HitsReco2::fRadiusECut [private] |
Definition at line 75 of file Conv4HitsReco2.h.
Referenced by Reconstruct(), Refresh(), and SetRadiusECut().
double Conv4HitsReco2::fRE [private] |
Definition at line 81 of file Conv4HitsReco2.h.
Referenced by Reconstruct(), and Refresh().
math::XYZVector Conv4HitsReco2::fRecC1 [private] |
Definition at line 61 of file Conv4HitsReco2.h.
Referenced by GetPlusCenter(), and Reconstruct().
math::XYZVector Conv4HitsReco2::fRecC2 [private] |
Definition at line 61 of file Conv4HitsReco2.h.
Referenced by GetMinusCenter(), and Reconstruct().
double Conv4HitsReco2::fRecPhi [private] |
Definition at line 63 of file Conv4HitsReco2.h.
Referenced by GetRecPhi(), Reconstruct(), and Refresh().
double Conv4HitsReco2::fRecR [private] |
Definition at line 64 of file Conv4HitsReco2.h.
Referenced by GetRecR(), Reconstruct(), and Refresh().
double Conv4HitsReco2::fRecR1 [private] |
Definition at line 65 of file Conv4HitsReco2.h.
Referenced by ConversionCandidate(), GetPlusCenter(), GetRecR1(), Reconstruct(), and Refresh().
double Conv4HitsReco2::fRecR2 [private] |
Definition at line 66 of file Conv4HitsReco2.h.
Referenced by ConversionCandidate(), GetMinusCenter(), GetRecR2(), Reconstruct(), and Refresh().
double Conv4HitsReco2::fRECut [private] |
Definition at line 77 of file Conv4HitsReco2.h.
Referenced by Reconstruct(), Refresh(), and SetRECut().
math::XYZVector Conv4HitsReco2::fRecV [private] |
Definition at line 61 of file Conv4HitsReco2.h.
Referenced by ConversionCandidate(), and Reconstruct().
int Conv4HitsReco2::fSignSatisfied [private] |
Definition at line 69 of file Conv4HitsReco2.h.
Referenced by Dump(), Reconstruct(), Refresh(), and RegisterBadSign().
int Conv4HitsReco2::fSolved [private] |
Definition at line 70 of file Conv4HitsReco2.h.
Referenced by Dump(), Reconstruct(), Refresh(), and RegisterUnsolvable().