Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:26:50

0001 #ifndef FASTSIMULATION_TRACKING_FASTTRACKERRECHITSPLITTER_H
0002 #define FASTSIMULATION_TRACKING_FASTTRACKERRECHITSPLITTER_H
0003 
0004 #include <vector>
0005 #include "FastSimulation/Tracking/interface/TrajectorySeedHitCandidate.h"
0006 #include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
0007 #include "DataFormats/TrackerRecHit2D/interface/FastTrackerRecHit.h"
0008 #include "DataFormats/TrackerRecHit2D/interface/FastSingleTrackerRecHit.h"
0009 #include "DataFormats/TrackerRecHit2D/interface/FastMatchedTrackerRecHit.h"
0010 #include "DataFormats/TrackerRecHit2D/interface/FastProjectedTrackerRecHit.h"
0011 
0012 class FastTrackerRecHitSplitter {
0013 public:
0014   FastTrackerRecHitSplitter() { ; }
0015   ~FastTrackerRecHitSplitter() { ; }
0016 
0017   inline void split(const FastTrackerRecHit &hitIn, edm::OwnVector<TrackingRecHit> &hitsOut, bool alongMomentum) const {
0018     if (hitIn.dimension() == 1 || hitIn.isPixel()) {
0019       hitsOut.push_back(hitIn.clone());
0020     }
0021 
0022     else if (hitIn.isProjected()) {
0023       hitsOut.push_back(buildSplitStripHit(static_cast<const FastProjectedTrackerRecHit &>(hitIn).originalHit()));
0024     }
0025 
0026     else if (hitIn.isMatched()) {
0027       if (alongMomentum) {
0028         hitsOut.push_back(buildSplitStripHit((static_cast<const FastMatchedTrackerRecHit &>(hitIn)).firstHit()));
0029         hitsOut.push_back(buildSplitStripHit((static_cast<const FastMatchedTrackerRecHit &>(hitIn)).secondHit()));
0030       } else {
0031         hitsOut.push_back(buildSplitStripHit((static_cast<const FastMatchedTrackerRecHit &>(hitIn)).secondHit()));
0032         hitsOut.push_back(buildSplitStripHit((static_cast<const FastMatchedTrackerRecHit &>(hitIn)).firstHit()));
0033       }
0034     }
0035 
0036     else {
0037       hitsOut.push_back(buildSplitStripHit(static_cast<const FastSingleTrackerRecHit &>(hitIn)));
0038     }
0039   }
0040 
0041 private:
0042   inline FastSingleTrackerRecHit *buildSplitStripHit(const FastSingleTrackerRecHit &hit) const {
0043     FastSingleTrackerRecHit *newHit = hit.clone();
0044     newHit->set2D(newHit->detUnit()->type().isEndcap());
0045     return newHit;
0046   }
0047 };
0048 
0049 #endif