CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/TrackingTools/MaterialEffects/src/MultipleScatteringUpdator.cc

Go to the documentation of this file.
00001 #include "TrackingTools/MaterialEffects/interface/MultipleScatteringUpdator.h"
00002 #include "DataFormats/GeometrySurface/interface/MediumProperties.h"
00003 
00004 #include "DataFormats/Math/interface/approx_log.h"
00005 
00006 void oldMUcompute (const TrajectoryStateOnSurface& TSoS, 
00007                    const PropagationDirection propDir, double mass, double ptmin);
00008 
00009 //#define DBG_MSU
00010 
00011 //
00012 // Computation of contribution of multiple scatterning to covariance matrix 
00013 //   of local parameters based on Highland formula for sigma(alpha) in plane.
00014 //
00015 void MultipleScatteringUpdator::compute (const TrajectoryStateOnSurface& TSoS, 
00016                                          const PropagationDirection propDir, Effect & effect) const
00017 {
00018   //
00019   // Get surface
00020   //
00021   const Surface& surface = TSoS.surface();
00022   //
00023   //
00024   // Now get information on medium
00025   //
00026   const MediumProperties& mp = surface.mediumProperties();
00027   if unlikely(mp.radLen()==0) return;
00028 
00029   // Momentum vector
00030   LocalVector d = TSoS.localMomentum();
00031   float p2 = d.mag2();
00032   d *= 1.f/sqrt(p2);
00033   float xf = 1.f/std::abs(d.z());         // increase of path due to angle of incidence
00034   // calculate general physics things
00035   constexpr float amscon = 1.8496e-4;    // (13.6MeV)**2
00036   const float m2 = mass()*mass();            // use mass hypothesis from constructor
00037   float e2     = p2 + m2;
00038   float beta2  = p2/e2;
00039   // calculate the multiple scattering angle
00040   float radLen = mp.radLen()*xf;     // effective rad. length
00041   float sigt2 = 0.;                  // sigma(alpha)**2
00042 
00043   // Calculated rms scattering angle squared.
00044   float fact = 1.f + 0.038f*unsafe_logf<2>(radLen); fact *=fact;
00045   float a = fact/(beta2*p2);
00046   sigt2 = amscon*radLen*a;
00047   
00048   if (thePtMin > 0) {
00049 #ifdef DBG_MSU
00050     std::cout<<"Original rms scattering = "<<sqrt(sigt2);
00051 #endif
00052     // Inflate estimated rms scattering angle, to take into account 
00053     // that 1/p is not known precisely.
00054     AlgebraicSymMatrix55 const & covMatrix = TSoS.localError().matrix();
00055     float error2_QoverP = covMatrix(0,0);
00056     // Formula valid for ultra-relativistic particles.
00057     //      sigt2 *= (1. + p2 * error2_QoverP);
00058     // Exact formula
00059     sigt2 *= 1.f +  error2_QoverP *( p2 + m2*beta2*(5.f + 3.f*p2*error2_QoverP) ) ;
00060 #ifdef DBG_MSU
00061     std::cout<<" new = "<<sqrt(sigt2);
00062 #endif
00063     // Convert Pt constraint to P constraint, neglecting uncertainty in 
00064     // track angle.
00065     float pMin2 = thePtMin*thePtMin*(p2/TSoS.globalMomentum().perp2());       
00066     // Use P constraint to calculate rms maximum scattering angle.
00067     float betaMin2 = pMin2/(pMin2 + m2);
00068     float a_max = fact/(betaMin2 * pMin2);
00069     float sigt2_max = amscon*radLen*a_max;
00070     if (sigt2 > sigt2_max) sigt2 = sigt2_max;
00071 #ifdef DBG_MSU
00072     std::cout<<" after P constraint ("<<pMin<<") = "<<sqrt(sigt2);
00073     std::cout<<" for track with 1/p="<<1/p<<"+-"<<sqrt(error2_QoverP)<<std::endl;
00074 #endif
00075   }
00076   
00077   float isl2 = 1.f/d.perp2();
00078   float cl2 = (d.z()*d.z());
00079   float cf2 = (d.x()*d.x())*isl2;
00080   float sf2 = (d.y()*d.y())*isl2;
00081   // Create update (transformation of independant variations
00082   //   on angle in orthogonal planes to local parameters.
00083   float den = 1.f/(cl2*cl2);
00084   using namespace materialEffect;
00085   effect.deltaCov[msxx] += (den*sigt2)*(sf2*cl2 + cf2);
00086   effect.deltaCov[msxy] += (den*sigt2)*(d.x()*d.y()  );
00087   effect.deltaCov[msyy] += (den*sigt2)*(cf2*cl2 + sf2);
00088   
00089   /*
00090     std::cout << "new " <<  theDeltaCov(1,1) << " " <<  theDeltaCov(1,2)  << " " <<  theDeltaCov(2,2) << std::endl;
00091     oldMUcompute(TSoS,propDir, mass(), thePtMin);
00092   */
00093     
00094 }
00095     
00096     
00097     
00098 
00099 //
00100 // Computation of contribution of multiple scatterning to covariance matrix 
00101 //   of local parameters based on Highland formula for sigma(alpha) in plane.
00102 //
00103 void oldMUcompute (const TrajectoryStateOnSurface& TSoS, 
00104                    const PropagationDirection propDir, float mass, float thePtMin)
00105 {
00106   //
00107   // Get surface
00108   //
00109   const Surface& surface = TSoS.surface();
00110   //
00111   //
00112   // Now get information on medium
00113   //
00114   if (surface.mediumProperties().isValid()) {
00115     // Momentum vector
00116     LocalVector d = TSoS.localMomentum();
00117     float p = d.mag();
00118     d *= 1./p;
00119     // MediumProperties mp(0.02, .5e-4);
00120     const MediumProperties& mp = surface.mediumProperties();
00121     float xf = 1./fabs(d.z());         // increase of path due to angle of incidence
00122     // calculate general physics things
00123     const float amscon = 1.8496e-4;    // (13.6MeV)**2
00124     const float m = mass;            // use mass hypothesis from constructor
00125     float e     = sqrt(p*p + m*m);
00126     float beta  = p/e;
00127     // calculate the multiple scattering angle
00128     float radLen = mp.radLen()*xf;     // effective rad. length
00129     float sigt2 = 0.;                  // sigma(alpha)**2
00130     if (radLen > 0) {
00131       // Calculated rms scattering angle squared.
00132       float a = (1. + 0.038*log(radLen))/(beta*p); a *= a;
00133       sigt2 = amscon*radLen*a;
00134       if (thePtMin > 0) {
00135 #ifdef DBG_MSU
00136         std::cout<<"Original rms scattering = "<<sqrt(sigt2);
00137 #endif
00138         // Inflate estimated rms scattering angle, to take into account 
00139         // that 1/p is not known precisely.
00140         AlgebraicSymMatrix55 covMatrix = TSoS.localError().matrix();
00141         float error2_QoverP = covMatrix(0,0);
00142         // Formula valid for ultra-relativistic particles.
00143 //      sigt2 *= (1. + (p*p) * error2_QoverP);
00144         // Exact formula
00145         sigt2 *= (1. + (p*p) * error2_QoverP *
00146                                (1. + 5*m*m/(e*e) + 3*m*m*beta*beta*error2_QoverP));
00147 #ifdef DBG_MSU
00148         std::cout<<" new = "<<sqrt(sigt2);
00149 #endif
00150         // Convert Pt constraint to P constraint, neglecting uncertainty in 
00151         // track angle.
00152         float pMin = thePtMin*(TSoS.globalMomentum().mag()/TSoS.globalMomentum().perp());       
00153         // Use P constraint to calculate rms maximum scattering angle.
00154         float betaMin = pMin/sqrt(pMin * pMin + m*m);
00155         float a_max = (1. + 0.038*log(radLen))/(betaMin * pMin); a_max *= a_max;
00156         float sigt2_max = amscon*radLen*a_max;
00157         if (sigt2 > sigt2_max) sigt2 = sigt2_max;
00158 #ifdef DBG_MSU
00159         std::cout<<" after P constraint ("<<pMin<<") = "<<sqrt(sigt2);
00160         std::cout<<" for track with 1/p="<<1/p<<"+-"<<sqrt(error2_QoverP)<<std::endl;
00161 #endif
00162       }
00163     }
00164     float sl = d.perp();
00165     float cl = d.z();
00166     float cf = d.x()/sl;
00167     float sf = d.y()/sl;
00168     // Create update (transformation of independant variations
00169     //   on angle in orthogonal planes to local parameters.
00170     std::cout << "old " << sigt2*(sf*sf*cl*cl + cf*cf)/(cl*cl*cl*cl)
00171               << " " << sigt2*(cf*sf*sl*sl        )/(cl*cl*cl*cl) 
00172               << " " << sigt2*(cf*cf*cl*cl + sf*sf)/(cl*cl*cl*cl) << std::endl;
00173   }
00174 }