Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:38

0001 #include "TrackingTools/GsfTracking/interface/GsfCombinedMaterialEffectsUpdator.h"
0002 #include <cassert>
0003 
0004 #include <iostream>
0005 
0006 GsfCombinedMaterialEffectsUpdator::GsfCombinedMaterialEffectsUpdator(GsfMaterialEffectsUpdator& msUpdator,
0007                                                                      GsfMaterialEffectsUpdator& elUpdator)
0008     : GsfMaterialEffectsUpdator(msUpdator.mass(), msUpdator.size() * elUpdator.size()),
0009       theMSUpdator(msUpdator.clone()),
0010       theELUpdator(elUpdator.clone()) {}
0011 
0012 //
0013 // Computation: combine updates on momentum and cov. matrix from the multiple
0014 // scattering and energy loss updators and store them in private data members
0015 //
0016 void GsfCombinedMaterialEffectsUpdator::compute(const TrajectoryStateOnSurface& TSoS,
0017                                                 const PropagationDirection propDir,
0018                                                 Effect effects[]) const {
0019 #if __clang__
0020   std::vector<Effect> msEffects(theMSUpdator->size());
0021   theMSUpdator->compute(TSoS, propDir, msEffects.data());
0022   std::vector<Effect> elEffects(theELUpdator->size());
0023   theELUpdator->compute(TSoS, propDir, elEffects.data());
0024 #else
0025   Effect msEffects[theMSUpdator->size()];
0026   theMSUpdator->compute(TSoS, propDir, msEffects);
0027   Effect elEffects[theELUpdator->size()];
0028   theELUpdator->compute(TSoS, propDir, elEffects);
0029 #endif
0030 
0031   //
0032   // combine the two multi-updates
0033   //
0034   uint32_t k = 0;
0035   for (auto const& mse : msEffects)
0036     for (auto const& ele : elEffects)
0037       effects[k++].combine(mse, ele);
0038   assert(k == size());
0039 }