#include <RecoEgamma/EgammaPhotonAlgos/interface/ConversionFastHelix.h>
Public Member Functions | |
ConversionFastHelix (const GlobalPoint &outerHit, const GlobalPoint &middleHit, const GlobalPoint &aVertex, const MagneticField *field) | |
FTS | helixStateAtVertex () |
bool | isValid () |
void | makeHelix () |
FTS | stateAtVertex () |
FTS | straightLineStateAtVertex () |
~ConversionFastHelix () | |
Private Types | |
typedef FreeTrajectoryState | FTS |
Private Attributes | |
const MagneticField * | mField |
FastCircle | theCircle |
FTS | theHelix_ |
GlobalPoint | theMiddleHit |
GlobalPoint | theOuterHit |
GlobalPoint | theVertex |
bool | validStateAtVertex |
Definition at line 16 of file ConversionFastHelix.h.
typedef FreeTrajectoryState ConversionFastHelix::FTS [private] |
Definition at line 20 of file ConversionFastHelix.h.
ConversionFastHelix::ConversionFastHelix | ( | const GlobalPoint & | outerHit, | |
const GlobalPoint & | middleHit, | |||
const GlobalPoint & | aVertex, | |||
const MagneticField * | field | |||
) |
Definition at line 11 of file ConversionFastHelix.cc.
References makeHelix(), and validStateAtVertex.
00014 : 00015 theOuterHit(outerHit), 00016 theMiddleHit(middleHit), 00017 theVertex(aVertex), 00018 theCircle(outerHit, 00019 middleHit, 00020 aVertex), 00021 mField(field) { 00022 00023 validStateAtVertex=false; 00024 00025 00026 makeHelix(); 00027 00028 00029 }
ConversionFastHelix::~ConversionFastHelix | ( | ) | [inline] |
FreeTrajectoryState ConversionFastHelix::helixStateAtVertex | ( | ) |
Definition at line 52 of file ConversionFastHelix.cc.
References arg, funct::C, MagneticField::inTesla(), edm::isnan(), mField, FastCircle::rho(), rho, pydbsAccessor::root, funct::sqrt(), theCircle, theMiddleHit, theOuterHit, theVertex, FreeTrajectoryState::transverseCurvature(), v, validStateAtVertex, PV3DBase< T, PVType, FrameType >::x(), FastCircle::x0(), PV3DBase< T, PVType, FrameType >::y(), FastCircle::y0(), and PV3DBase< T, PVType, FrameType >::z().
Referenced by makeHelix().
00052 { 00053 00054 00055 00056 GlobalPoint pMid(theMiddleHit); 00057 GlobalPoint v(theVertex); 00058 FTS atVertex; 00059 00060 double dydx = 0.; 00061 double pt = 0., px = 0., py = 0.; 00062 00063 //remember (radius rho in cm): 00064 //rho = 00065 //100. * pt * 00066 //(10./(3.*MagneticField::inTesla(GlobalPoint(0., 0., 0.)).z())); 00067 00068 double rho = theCircle.rho(); 00069 pt = 0.01 * rho * (0.3*mField->inTesla(GlobalPoint(0,0,0)).z()); 00070 00071 // (py/px)|x=v.x() = (dy/dx)|x=v.x() 00072 //remember: 00073 //y(x) = +-sqrt(rho^2 - (x-x0)^2) + y0 00074 //y(x) = sqrt(rho^2 - (x-x0)^2) + y0 if y(x) >= y0 00075 //y(x) = -sqrt(rho^2 - (x-x0)^2) + y0 if y(x) < y0 00076 //=> (dy/dx) = -(x-x0)/sqrt(Q) if y(x) >= y0 00077 // (dy/dx) = (x-x0)/sqrt(Q) if y(x) < y0 00078 //with Q = rho^2 - (x-x0)^2 00079 00080 00081 double arg=rho*rho - ( (v.x()-theCircle.x0())*(v.x()-theCircle.x0()) ); 00082 00083 if ( arg >= 0 ) { 00084 00085 00086 // double root = sqrt( rho*rho - ( (v.x()-theCircle.x0())*(v.x()-theCircle.x0()) ) ); 00087 double root = sqrt( arg ); 00088 00089 if((v.y() - theCircle.y0()) > 0.) 00090 dydx = -(v.x() - theCircle.x0()) / root; 00091 else 00092 dydx = (v.x() - theCircle.x0()) / root; 00093 00094 px = pt/sqrt(1. + dydx*dydx); 00095 py = px*dydx; 00096 // check sign with scalar product 00097 if(px*(pMid.x() - v.x()) + py*(pMid.y() - v.y()) < 0.) { 00098 px *= -1.; 00099 py *= -1.; 00100 } 00101 00102 //std::cout << " ConversionFastHelix:helixStateAtVertex rho " << rho << " pt " << pt << " v " << v << " theCircle.x0() " <<theCircle.x0() << " theCircle.y0() " << theCircle.y0() << " v.x()-theCircle.x0() " << v.x()-theCircle.x0() << " rho^2 " << rho*rho << " v.x()-theCircle.x0()^2 " << (v.x()-theCircle.x0())*(v.x()-theCircle.x0()) << " root " << root << " arg " << arg << " dydx " << dydx << std::endl; 00103 //calculate z0, pz 00104 //(z, R*phi) linear relation in a helix 00105 //with R, phi defined as radius and angle w.r.t. centre of circle 00106 //in transverse plane 00107 //pz = pT*(dz/d(R*phi))) 00108 00109 FastLine flfit(theOuterHit, theMiddleHit, theCircle.rho()); 00110 00111 00112 00113 double z_0 = 0; 00114 00115 //std::cout << " ConversionFastHelix:helixStateAtVertex flfit.n2() " << flfit.n2() << " flfit.c() " << flfit.c() << " flfit.n2() " << flfit.n2() << std::endl; 00116 if ( flfit.n2() !=0 && !isnan( flfit.c()) && !isnan(flfit.n2()) ) { 00117 // std::cout << " Accepted " << std::endl; 00118 z_0 = -flfit.c()/flfit.n2(); 00119 double dzdrphi = -flfit.n1()/flfit.n2(); 00120 double pz = pt*dzdrphi; 00121 00122 //get sign of particle 00123 00124 GlobalVector magvtx=mField->inTesla(v); 00125 TrackCharge q = 00126 ((theCircle.x0()*py - theCircle.y0()*px) / 00127 (magvtx.z()) < 0.) ? 00128 -1 : 1; 00129 00130 00131 AlgebraicSymMatrix55 C = AlgebraicMatrixID(); 00132 //MP 00133 00134 atVertex = FTS(GlobalTrajectoryParameters(GlobalPoint(v.x(), v.y(), z_0), 00135 GlobalVector(px, py, pz), 00136 q, 00137 mField), 00138 CurvilinearTrajectoryError(C)); 00139 00140 //std::cout << " ConversionFastHelix:helixStateAtVertex globalPoint " << GlobalPoint(v.x(), v.y(), z_0) << " GlobalVector " << GlobalVector(px, py, pz) << " q " << q << " MField " << mField->inTesla(v) << std::endl; 00141 //std::cout << " ConversionFastHelix:helixStateAtVertex atVertex.transverseCurvature() " << atVertex.transverseCurvature() << std::endl; 00142 if( atVertex.transverseCurvature() !=0 ) { 00143 00144 validStateAtVertex=true; 00145 00146 //std::cout << " ConversionFastHelix:helixStateAtVertex validHelixStateAtVertex status " << validStateAtVertex << std::endl; 00147 return atVertex; 00148 }else 00149 return atVertex; 00150 } else { 00151 //std::cout << " ConversionFastHelix:helixStateAtVertex not accepted validHelixStateAtVertex status " << validStateAtVertex << std::endl; 00152 return atVertex; 00153 } 00154 00155 00156 00157 } else { 00158 00159 //std::cout << " ConversionFastHelix:helixStateAtVertex not accepted because arg <0 validHelixStateAtVertex status " << validStateAtVertex << std::endl; 00160 return atVertex; 00161 } 00162 00163 00164 00165 00166 00167 }
Definition at line 35 of file ConversionFastHelix.h.
References validStateAtVertex.
00035 {return validStateAtVertex; }
void ConversionFastHelix::makeHelix | ( | ) |
Definition at line 32 of file ConversionFastHelix.cc.
References helixStateAtVertex(), FastCircle::isValid(), straightLineStateAtVertex(), theCircle, and theHelix_.
Referenced by ConversionFastHelix().
00032 { 00033 00034 00035 if( theCircle.isValid()) { 00036 theHelix_=helixStateAtVertex(); 00037 } else { 00038 theHelix_= straightLineStateAtVertex(); 00039 } 00040 00041 00042 }
FreeTrajectoryState ConversionFastHelix::stateAtVertex | ( | ) |
Definition at line 45 of file ConversionFastHelix.cc.
References theHelix_.
00045 { 00046 00047 return theHelix_; 00048 00049 }
FreeTrajectoryState ConversionFastHelix::straightLineStateAtVertex | ( | ) |
Definition at line 169 of file ConversionFastHelix.cc.
References funct::C, FastLine::c(), edm::isnan(), mField, FastLine::n1(), FastCircle::n1(), FastLine::n2(), FastCircle::n2(), funct::sqrt(), theCircle, theMiddleHit, theOuterHit, theVertex, v, validStateAtVertex, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().
Referenced by makeHelix().
00169 { 00170 00171 00172 //calculate FTS assuming straight line... 00173 00174 GlobalPoint pMid(theMiddleHit); 00175 GlobalPoint v(theVertex); 00176 00177 double dydx = 0.; 00178 double pt = 0., px = 0., py = 0.; 00179 00180 if(fabs(theCircle.n1()) > 0. || fabs(theCircle.n2()) > 0.) 00181 pt = 1.e+4;// 10 TeV //else no pt 00182 if(fabs(theCircle.n2()) > 0.) { 00183 dydx = -theCircle.n1()/theCircle.n2(); //else px = 0 00184 } 00185 px = pt/sqrt(1. + dydx*dydx); 00186 py = px*dydx; 00187 // check sign with scalar product 00188 if (px*(pMid.x() - v.x()) + py*(pMid.y() - v.y()) < 0.) { 00189 px *= -1.; 00190 py *= -1.; 00191 } 00192 00193 //calculate z_0 and pz at vertex using weighted mean 00194 //z = z(r) = z0 + (dz/dr)*r 00195 //tan(theta) = dr/dz = (dz/dr)^-1 00196 //theta = atan(1./dzdr) 00197 //p = pt/sin(theta) 00198 //pz = p*cos(theta) = pt/tan(theta) 00199 00200 FastLine flfit(theOuterHit, theMiddleHit); 00201 FTS atVertex; 00202 00203 double z_0 = 0; 00204 if (flfit.n2() !=0 && !isnan( flfit.c()) && !isnan(flfit.n2()) ) { 00205 z_0 = -flfit.c()/flfit.n2(); 00206 00207 double dzdr = -flfit.n1()/flfit.n2(); 00208 double pz = pt*dzdr; 00209 00210 TrackCharge q = 1; 00211 00212 AlgebraicSymMatrix66 C = AlgebraicMatrixID(); 00213 //MP 00214 FTS atVertex = FTS(GlobalTrajectoryParameters(GlobalPoint(v.x(), v.y(), z_0), 00215 GlobalVector(px, py, pz), 00216 q, 00217 mField), 00218 CartesianTrajectoryError(C)); 00219 00220 validStateAtVertex=true; 00221 00222 // std::cout << " ConversionFastHelix:strighLIneStateAtVertex validStraightLineStateAtVertex status " <<validStateAtVertex << std::endl; 00223 return atVertex; 00224 00225 } else { 00226 00227 return atVertex; 00228 00229 } 00230 00231 }
const MagneticField* ConversionFastHelix::mField [private] |
Definition at line 51 of file ConversionFastHelix.h.
Referenced by helixStateAtVertex(), and straightLineStateAtVertex().
FastCircle ConversionFastHelix::theCircle [private] |
Definition at line 50 of file ConversionFastHelix.h.
Referenced by helixStateAtVertex(), makeHelix(), and straightLineStateAtVertex().
FTS ConversionFastHelix::theHelix_ [private] |
Definition at line 45 of file ConversionFastHelix.h.
Referenced by makeHelix(), and stateAtVertex().
GlobalPoint ConversionFastHelix::theMiddleHit [private] |
Definition at line 48 of file ConversionFastHelix.h.
Referenced by helixStateAtVertex(), and straightLineStateAtVertex().
GlobalPoint ConversionFastHelix::theOuterHit [private] |
Definition at line 47 of file ConversionFastHelix.h.
Referenced by helixStateAtVertex(), and straightLineStateAtVertex().
GlobalPoint ConversionFastHelix::theVertex [private] |
Definition at line 49 of file ConversionFastHelix.h.
Referenced by helixStateAtVertex(), and straightLineStateAtVertex().
bool ConversionFastHelix::validStateAtVertex [private] |
Definition at line 46 of file ConversionFastHelix.h.
Referenced by ConversionFastHelix(), helixStateAtVertex(), isValid(), and straightLineStateAtVertex().