CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/RecoTracker/ConversionSeedGenerators/interface/Conv4HitsReco.h

Go to the documentation of this file.
00001 #ifndef Conv4HitsReco_h
00002 #define Conv4HitsReco_h
00003 
00004 #include <iostream>
00005 #include <iomanip>
00006 #include <math.h>
00007 
00008 #include <TVector3.h>
00009 
00010 class Conv4HitsReco {
00011 public :
00012 
00013   //Needed for construction
00014   TVector3 vV;
00015   TVector3 hit4;
00016   TVector3 hit3;
00017   TVector3 hit2;
00018   TVector3 hit1;
00019 
00020   //Important quantities
00021   TVector3 v3minus4;
00022   TVector3 v1minus2;
00023   TVector3 vN;
00024   TVector3 vP;
00025   TVector3 vPminusN;
00026   TVector3 vPminusV;
00027   TVector3 vNminusV;
00028   TVector3 unitVn;
00029   TVector3 unitVp;
00030   double pn;
00031   double pPN;
00032   double nPN;
00033   double PN;
00034   double PN2;
00035   double pNV;
00036   double nNV;
00037   double _eta;
00038   double _pi;
00039   double _eta2;
00040   double _pi2;
00041   TVector3 vMMaxLimit;
00042   TVector3 vQMaxLimit;
00043   double qMaxLimit;
00044   double mMaxLimit;
00045   double qMinLimit;
00046   double mMinLimit;
00047   TVector3 plusCenter;
00048   TVector3 minusCenter;
00049   TVector3 convVtx;
00050   double plusRadius;
00051   double minusRadius;
00052 
00053   double iterationStopRelThreshold;
00054   int maxNumberOfIterations;
00055   double maxVtxDistance;
00056   double ptLegMinCut;
00057   double ptLegMaxCut;
00058   double ptPhotMaxCut;
00059 
00060   std::string qFromM_print(double m);
00061   double qFromM(double); //For debugging purposes
00062 
00063   //Elements of the linearized system matrix
00064   double Tq, Tm, T0;
00065   double Oq, Om, O0;
00066   int ComputeMaxLimits();
00067   int ComputeMinLimits();
00068   int GuessStartingValues(double&, double&);
00069   int mqFindByIteration(double&, double&);
00070   TVector3 GetIntersection(TVector3&, TVector3&, TVector3&, TVector3&);
00071   TVector3 GetPlusCenter(double &);
00072   TVector3 GetMinusCenter(double &);
00073   void SetPtLegMinCut(double val){ptLegMinCut = val;};
00074   void SetPtLegMaxCut(double val){ptLegMaxCut = val;};
00075   void SetPtPhotMaxCut(double val){ptPhotMaxCut = val;};
00076   void SetLinSystCoeff(double, double);
00077   void Set(double);
00078   void SetIterationStopRelThreshold(double val){iterationStopRelThreshold = val;};
00079   void SetMaxNumberOfIterations(int val){maxNumberOfIterations = val;};
00080   void SetMaxVtxDistance(int val){maxVtxDistance = val;};
00081   double GetDq();
00082   double GetDm();
00083   double GetPtFromParamAndHitPair(double &, double &);
00084   double GetPtPlusFromParam(double &);
00085   double GetPtMinusFromParam(double &);
00086   TVector3 GetConvVertexFromParams(double &, double &);
00087   int IsNotValidForPtLimit(double, double, double, double);
00088   int IsNotValidForVtxPosition(double&);
00089 
00090   int ConversionCandidate(TVector3&, double&, double&);
00091   void Dump();
00092 
00093   Conv4HitsReco(TVector3 &, TVector3 &, TVector3 &, TVector3 &, TVector3 &);
00094   ~Conv4HitsReco();
00095 
00096 };
00097 
00098 #endif
00099 
00100 #ifdef Conv4HitsReco_cxx
00101 Conv4HitsReco::Conv4HitsReco(TVector3 & vPhotVertex, TVector3 & h1, TVector3 & h2, TVector3 & h3, TVector3 & h4)
00102 {
00103 
00104   vV = vPhotVertex;
00105   hit4 = h4;
00106   hit3 = h3;
00107   hit2 = h2;
00108   hit1 = h1;
00109 
00110   //Let's stay in the transverse plane...
00111   vV.SetZ(0.);
00112   hit4.SetZ(0.);
00113   hit3.SetZ(0.);
00114   hit2.SetZ(0.);
00115   hit1.SetZ(0.);
00116 
00117   //Filling important quantities
00118   vN.SetXYZ(0.5*hit4.X()+0.5*hit3.X(),0.5*hit4.Y()+0.5*hit3.Y(),0.5*hit4.Z()+0.5*hit3.Z());
00119   vP.SetXYZ(0.5*hit2.X()+0.5*hit1.X(),0.5*hit2.Y()+0.5*hit1.Y(),0.5*hit2.Z()+0.5*hit1.Z());
00120   vPminusN=vP-vN;
00121   vPminusV=vP-vV;
00122   vNminusV=vN-vV;
00123   v3minus4=hit3-hit4;
00124   v1minus2=hit1-hit2;
00125   unitVn=v3minus4.Orthogonal().Unit();
00126   unitVp=v1minus2.Orthogonal().Unit();
00127   pPN = unitVp*vPminusN;
00128   nPN = unitVn*vPminusN;
00129   pNV = unitVp*vNminusV;
00130   nNV = unitVn*vNminusV;
00131   pn = unitVp*unitVn;
00132   PN = vPminusN.Mag();
00133   PN2 = vPminusN.Mag2();
00134 
00135   _eta=0.5*(hit3-hit4).Mag();
00136   _pi=0.5*(hit1-hit2).Mag();
00137   _eta2=_eta*_eta;
00138   _pi2=_pi*_pi;
00139 
00140   //Default values for parameters
00141   SetIterationStopRelThreshold(0.0005);
00142   SetMaxNumberOfIterations(10);
00143   SetPtLegMinCut(0.2);
00144   SetPtLegMaxCut(20.);
00145   SetPtPhotMaxCut(30.);
00146   SetMaxVtxDistance(20.);
00147 
00148 }
00149 
00150 Conv4HitsReco::~Conv4HitsReco(){
00151   
00152   //  std::cout << " Bye..." << std::endl;
00153 
00154 }
00155 
00156 #endif // #ifdef Conv4HitsReco_h