CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/TrackingTools/GsfTracking/src/GsfCombinedMaterialEffectsUpdator.cc

Go to the documentation of this file.
00001 #include "TrackingTools/GsfTracking/interface/GsfCombinedMaterialEffectsUpdator.h"
00002 #include "TrackingTools/GsfTracking/interface/GsfMaterialEffectsAdapter.h"
00003 // #include "CommonReco/MaterialEffects/interface/MultipleScatteringUpdator.h"
00004 // #include "CommonReco/MaterialEffects/interface/EnergyLossUpdator.h"
00005 #include "TrackingTools/GsfTracking/interface/GsfBetheHeitlerUpdator.h"
00006 
00007 // GsfCombinedMaterialEffectsUpdator::GsfCombinedMaterialEffectsUpdator () :
00008 //   GsfMaterialEffectsUpdator()
00009 // {
00010 //   createUpdators(mass());
00011 // }
00012 
00013 // GsfCombinedMaterialEffectsUpdator::GsfCombinedMaterialEffectsUpdator (float mass) :
00014 //   GsfMaterialEffectsUpdator(mass)
00015 // {
00016 //   createUpdators(mass);
00017 // }
00018 
00019 GsfCombinedMaterialEffectsUpdator::GsfCombinedMaterialEffectsUpdator  
00020 (GsfMaterialEffectsUpdator& msUpdator,
00021  GsfMaterialEffectsUpdator& elUpdator) :
00022   GsfMaterialEffectsUpdator(msUpdator.mass()),
00023   theMSUpdator(msUpdator.clone()), 
00024   theELUpdator(elUpdator.clone()) {}
00025 
00026 // void
00027 // GsfCombinedMaterialEffectsUpdator::createUpdators (const float mass)
00028 // {
00029 //   //
00030 //   // multiple scattering
00031 //   //
00032 //   theMSUpdator = new GsfMaterialEffectsAdapter(MultipleScatteringUpdator(mass));
00033 //   //
00034 //   // energy loss: two different objects for electrons / others
00035 //   //
00036 //   if ( mass>0.001 ) 
00037 //     theELUpdator = new GsfMaterialEffectsAdapter(EnergyLossUpdator(mass));
00038 //   else
00039 //     theELUpdator = new GsfBetheHeitlerUpdator();
00040 // }
00041 
00042 //
00043 // Computation: combine updates on momentum and cov. matrix from the multiple
00044 // scattering and energy loss updators and store them in private data members
00045 //
00046 void GsfCombinedMaterialEffectsUpdator::compute (const TrajectoryStateOnSurface& TSoS,
00047                                                  const PropagationDirection propDir) const
00048 {
00049   //
00050   // reset components
00051   //
00052   theWeights.clear();
00053   theDeltaPs.clear();
00054   theDeltaCovs.clear();
00055   //
00056   // get components from multiple scattering
00057   //
00058   std::vector<double> msWeights = theMSUpdator->weights(TSoS,propDir);
00059   std::vector<double> msDeltaPs = theMSUpdator->deltaPs(TSoS,propDir);
00060   std::vector<AlgebraicSymMatrix55> msDeltaCovs = theMSUpdator->deltaLocalErrors(TSoS,propDir);
00061   if ( msWeights.empty() ) {
00062     //
00063     // create one dummy component
00064     //
00065     msWeights.push_back(1.);
00066     msDeltaPs.push_back(0.);
00067     msDeltaCovs.push_back(AlgebraicSymMatrix55());
00068   }
00069   //
00070   // get components from energy loss
00071   //
00072   std::vector<double> elWeights = theELUpdator->weights(TSoS,propDir);
00073   std::vector<double> elDeltaPs = theELUpdator->deltaPs(TSoS,propDir);
00074   std::vector<AlgebraicSymMatrix55> elDeltaCovs = theELUpdator->deltaLocalErrors(TSoS,propDir);
00075   if ( elWeights.empty() ) {
00076     //
00077     // create one dummy component
00078     //
00079     elWeights.push_back(1.);
00080     elDeltaPs.push_back(0.);
00081     elDeltaCovs.push_back(AlgebraicSymMatrix55());
00082   }
00083   //
00084   // combine the two multi-updates
00085   //
00086   std::vector<double>::const_iterator iMsWgt(msWeights.begin());
00087   std::vector<double>::const_iterator iMsDp(msDeltaPs.begin());
00088   std::vector<AlgebraicSymMatrix55>::const_iterator iMsDc(msDeltaCovs.begin());
00089   for ( ; iMsWgt<msWeights.end(); iMsWgt++,iMsDp++,iMsDc++ ) {
00090 
00091     std::vector<double>::const_iterator iElWgt(elWeights.begin());
00092     std::vector<double>::const_iterator iElDp(elDeltaPs.begin());
00093     std::vector<AlgebraicSymMatrix55>::const_iterator iElDc(elDeltaCovs.begin());
00094     for ( ; iElWgt<elWeights.end(); iElWgt++,iElDp++,iElDc++ ) {
00095       theWeights.push_back((*iMsWgt)*(*iElWgt));
00096       theDeltaPs.push_back((*iMsDp)+(*iElDp));
00097       theDeltaCovs.push_back((*iMsDc)+(*iElDc));
00098     }
00099   }
00100 
00101 }
00102