File indexing completed on 2024-04-06 12:11:24
0001 #ifndef FastSimulation_TrackingRecHitProducer_TrackingRecHitProduct_H
0002 #define FastSimulation_TrackingRecHitProducer_TrackingRecHitProduct_H
0003
0004 #include "SimDataFormats/TrackingHit/interface/PSimHit.h"
0005
0006 #include "DataFormats/DetId/interface/DetId.h"
0007 #include "DataFormats/TrackerRecHit2D/interface/FastSingleTrackerRecHit.h"
0008
0009 #include <memory>
0010 #include <vector>
0011 #include <unordered_map>
0012
0013 class TrackingRecHitProduct {
0014 public:
0015 typedef std::pair<unsigned int, const PSimHit*> SimHitIdPair;
0016 typedef std::pair<FastSingleTrackerRecHit, std::vector<SimHitIdPair>> RecHitToSimHitIdPairs;
0017
0018 protected:
0019 const DetId& _detId;
0020
0021 std::vector<SimHitIdPair> _simHitsIdPairList;
0022
0023 std::vector<RecHitToSimHitIdPairs> _recHits;
0024
0025 public:
0026 TrackingRecHitProduct(const DetId& detId, std::vector<SimHitIdPair>& simHitsIdPairList)
0027 : _detId(detId), _simHitsIdPairList(simHitsIdPairList) {}
0028
0029 inline const DetId& getDetId() const { return _detId; }
0030
0031 virtual std::vector<SimHitIdPair>& getSimHitIdPairs() { return _simHitsIdPairList; }
0032
0033 virtual void addRecHit(const FastSingleTrackerRecHit& recHit, std::vector<SimHitIdPair> simHitIdPairs = {}) {
0034 _recHits.push_back(std::make_pair(recHit, simHitIdPairs));
0035 for (unsigned int isimhit = 0; isimhit < simHitIdPairs.size(); ++isimhit) {
0036 _recHits.back().first.addSimTrackId(simHitIdPairs[isimhit].second->trackId());
0037 }
0038 }
0039
0040 virtual const std::vector<RecHitToSimHitIdPairs>& getRecHitToSimHitIdPairs() const { return _recHits; }
0041
0042 virtual unsigned int numberOfRecHits() const { return _recHits.size(); }
0043
0044 virtual ~TrackingRecHitProduct() {}
0045 };
0046
0047 typedef std::shared_ptr<TrackingRecHitProduct> TrackingRecHitProductPtr;
0048
0049 #endif