Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "TrackingTools/PatternTools/interface/Trajectory.h"
0002 #include "TrackingTools/PatternTools/interface/TrajAnnealing.h"
0003 #include "TrackingTools/PatternTools/interface/TrajectoryMeasurement.h"
0004 #include "DataFormats/TrackerRecHit2D/interface/SiTrackerMultiRecHit.h"
0005 
0006 TrajAnnealing::TrajAnnealing(const Trajectory& traj, float ann) {
0007   traj_ = traj;
0008   annealing_ = ann;
0009 
0010   const Trajectory::DataContainer& measurements = traj_.measurements();
0011   if (measurements.size() > 2) {
0012     Trajectory::DataContainer::const_iterator ibegin, iend;
0013     int increment(0);
0014     if (traj.direction() == alongMomentum) {
0015       ibegin = measurements.begin() + 1;
0016       iend = measurements.end() - 1;
0017       increment = 1;
0018     } else {
0019       ibegin = measurements.end() - 2;
0020       iend = measurements.begin();
0021       increment = -1;
0022     }
0023 
0024     for (Trajectory::DataContainer::const_iterator imeas = ibegin; imeas != iend; imeas += increment) {
0025       theHits_.push_back(imeas->recHit());
0026       if (imeas->recHit()->isValid()) {
0027         SiTrackerMultiRecHit const& mHit = dynamic_cast<SiTrackerMultiRecHit const&>(*imeas->recHit());
0028         std::vector<const TrackingRecHit*> components = mHit.recHits();
0029         int iComp = 0;
0030         for (std::vector<const TrackingRecHit*>::const_iterator iter = components.begin(); iter != components.end();
0031              iter++, iComp++) {
0032           theWeights.push_back(mHit.weight(iComp));
0033         }
0034       }
0035     }
0036   }
0037 }
0038 
0039 std::pair<float, std::vector<float> > TrajAnnealing::getAnnealingWeight(const TrackingRecHit& aRecHit) const {
0040   if (!aRecHit.isValid()) {
0041     std::vector<float> dumpyVec = {0.0};
0042     return make_pair(0.0, dumpyVec);
0043   }
0044 
0045   SiTrackerMultiRecHit const& mHit = dynamic_cast<SiTrackerMultiRecHit const&>(aRecHit);
0046   return make_pair(mHit.getAnnealingFactor(), mHit.weights());
0047 }