CMS 3D CMS Logo

TrackingRecHitProduct.h
Go to the documentation of this file.
1 #ifndef FastSimulation_TrackingRecHitProducer_TrackingRecHitProduct_H
2 #define FastSimulation_TrackingRecHitProducer_TrackingRecHitProduct_H
3 
5 
8 
9 #include <memory>
10 #include <vector>
11 #include <unordered_map>
12 
14 public:
15  typedef std::pair<unsigned int, const PSimHit*> SimHitIdPair;
16  typedef std::pair<FastSingleTrackerRecHit, std::vector<SimHitIdPair>> RecHitToSimHitIdPairs;
17 
18 protected:
19  const DetId& _detId;
20 
21  std::vector<SimHitIdPair> _simHitsIdPairList;
22 
23  std::vector<RecHitToSimHitIdPairs> _recHits;
24 
25 public:
26  TrackingRecHitProduct(const DetId& detId, std::vector<SimHitIdPair>& simHitsIdPairList)
27  : _detId(detId), _simHitsIdPairList(simHitsIdPairList) {}
28 
29  inline const DetId& getDetId() const { return _detId; }
30 
31  virtual std::vector<SimHitIdPair>& getSimHitIdPairs() { return _simHitsIdPairList; }
32 
33  virtual void addRecHit(const FastSingleTrackerRecHit& recHit, std::vector<SimHitIdPair> simHitIdPairs = {}) {
34  _recHits.push_back(std::make_pair(recHit, simHitIdPairs));
35  for (unsigned int isimhit = 0; isimhit < simHitIdPairs.size(); ++isimhit) {
36  _recHits.back().first.addSimTrackId(simHitIdPairs[isimhit].second->trackId());
37  }
38  }
39 
40  virtual const std::vector<RecHitToSimHitIdPairs>& getRecHitToSimHitIdPairs() const { return _recHits; }
41 
42  virtual unsigned int numberOfRecHits() const { return _recHits.size(); }
43 
45 };
46 
47 typedef std::shared_ptr<TrackingRecHitProduct> TrackingRecHitProductPtr;
48 
49 #endif
std::pair< unsigned int, const PSimHit * > SimHitIdPair
virtual void addRecHit(const FastSingleTrackerRecHit &recHit, std::vector< SimHitIdPair > simHitIdPairs={})
virtual std::vector< SimHitIdPair > & getSimHitIdPairs()
std::vector< SimHitIdPair > _simHitsIdPairList
U second(std::pair< T, U > const &p)
std::pair< FastSingleTrackerRecHit, std::vector< SimHitIdPair > > RecHitToSimHitIdPairs
std::shared_ptr< TrackingRecHitProduct > TrackingRecHitProductPtr
const DetId & getDetId() const
Definition: DetId.h:17
virtual const std::vector< RecHitToSimHitIdPairs > & getRecHitToSimHitIdPairs() const
std::vector< RecHitToSimHitIdPairs > _recHits
TrackingRecHitProduct(const DetId &detId, std::vector< SimHitIdPair > &simHitsIdPairList)
virtual unsigned int numberOfRecHits() const