CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TrackerHitAssociator.h
Go to the documentation of this file.
1 #ifndef TrackerHitAssociator_h
2 #define TrackerHitAssociator_h
3 
4 /* \class TrackerHitAssociator
5  *
6  ** Associates SimHits and RecHits based on information produced during
7  * digitisation (StripDigiSimLinks).
8  * The association works in both ways: from a SimHit to RecHits and
9  * from a RecHit to SimHits.
10  *
11  * \author Patrizia Azzi (INFN PD), Vincenzo Chiochia (Uni Zuerich)
12  *
13  * \version 1st version: April 2006. Add configurable switch: August 2006
14  *
15  *
16  ************************************************************/
17 
18 //#include <vector>
25 
26 //--- for SimHit
29 
34 
35 //--- for RecHit
46 
48 
49 #include <string>
50 #include <vector>
51 
52 typedef std::pair<uint32_t, EncodedEventId> SimHitIdpr;
54 public:
55  struct Config {
56  Config() {}
62  std::vector<edm::EDGetTokenT<CrossingFrame<PSimHit> > > cfTokens_;
63  std::vector<edm::EDGetTokenT<std::vector<PSimHit> > > simHitTokens_;
64  };
65 
66  // The constructor supporting the consumes interface and tokens
68 
69  // Destructor
70  virtual ~TrackerHitAssociator() {}
71 
72  typedef std::pair<unsigned int, unsigned int> simhitAddr, subDetTofBin;
73  typedef unsigned int simHitCollectionID;
74 
75  std::vector<PSimHit> associateHit(const TrackingRecHit& thit) const;
76  //for PU events
77  std::vector<SimHitIdpr> associateHitId(const TrackingRecHit& thit) const;
78  void associateHitId(const TrackingRecHit& thit,
79  std::vector<SimHitIdpr>& simhitid,
80  std::vector<simhitAddr>* simhitCFPos = nullptr) const;
81  template <typename T>
82  void associateSiStripRecHit(const T* simplerechit,
83  std::vector<SimHitIdpr>& simtrackid,
84  std::vector<simhitAddr>* simhitCFPos = nullptr) const;
85 
86  // Method for obtaining simTracks and simHits from a cluster
87  void associateCluster(const SiStripCluster* clust,
88  const DetId& detid,
89  std::vector<SimHitIdpr>& simtrackid,
90  std::vector<PSimHit>& simhit) const;
91 
92  // Obtain simTracks, and optionally simHit addresses, from a cluster
94  const DetId& detid,
95  std::vector<SimHitIdpr>& simtrackid,
96  std::vector<simhitAddr>* simhitCFPos = nullptr) const;
97 
98  std::vector<SimHitIdpr> associateMatchedRecHit(const SiStripMatchedRecHit2D* matchedrechit,
99  std::vector<simhitAddr>* simhitCFPos = nullptr) const;
100  std::vector<SimHitIdpr> associateProjectedRecHit(const ProjectedSiStripRecHit2D* projectedrechit,
101  std::vector<simhitAddr>* simhitCFPos = nullptr) const;
103  std::vector<SimHitIdpr>& simtrackid,
104  std::vector<simhitAddr>* simhitCFPos = nullptr) const;
105  void associatePixelRecHit(const SiPixelRecHit* pixelrechit,
106  std::vector<SimHitIdpr>& simtrackid,
107  std::vector<simhitAddr>* simhitCFPos = nullptr) const;
108  std::vector<SimHitIdpr> associateFastRecHit(const FastTrackerRecHit* rechit) const;
109  std::vector<SimHitIdpr> associateMultiRecHitId(const SiTrackerMultiRecHit* multirechit,
110  std::vector<simhitAddr>* simhitCFPos = nullptr) const;
111  std::vector<PSimHit> associateMultiRecHit(const SiTrackerMultiRecHit* multirechit) const;
112 
113  typedef std::map<unsigned int, std::vector<PSimHit> > simhit_map;
115  typedef std::map<subDetTofBin, unsigned int> simhit_collectionMap;
117 
118 private:
119  typedef std::vector<std::string> vstring;
120 
121  void makeMaps(const edm::Event& theEvent, const Config& config);
122  inline std::string printDetBnchEvtTrk(const DetId& detid,
123  const uint32_t& detID,
124  std::vector<SimHitIdpr>& simtrackid) const;
129 };
130 
131 #endif
edm::Handle< edm::DetSetVector< PixelDigiSimLink > > pixeldigisimlink
std::vector< PSimHit > associateMultiRecHit(const SiTrackerMultiRecHit *multirechit) const
std::string printDetBnchEvtTrk(const DetId &detid, const uint32_t &detID, std::vector< SimHitIdpr > &simtrackid) const
std::vector< edm::EDGetTokenT< CrossingFrame< PSimHit > > > cfTokens_
edm::Handle< edm::DetSetVector< StripDigiSimLink > > stripdigisimlink
std::pair< unsigned int, unsigned int > simhitAddr
std::vector< std::string > vstring
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > ph2OTrToken_
std::vector< SimHitIdpr > associateFastRecHit(const FastTrackerRecHit *rechit) const
std::map< unsigned int, std::vector< PSimHit > > simhit_map
void associatePhase2TrackerRecHit(const Phase2TrackerRecHit1D *rechit, std::vector< SimHitIdpr > &simtrackid, std::vector< simhitAddr > *simhitCFPos=nullptr) const
std::pair< unsigned int, unsigned int > subDetTofBin
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > pixelToken_
void makeMaps(const edm::Event &theEvent, const Config &config)
void associateSiStripRecHit(const T *simplerechit, std::vector< SimHitIdpr > &simtrackid, std::vector< simhitAddr > *simhitCFPos=nullptr) const
edm::Handle< edm::DetSetVector< PixelDigiSimLink > > ph2trackerdigisimlink
edm::EDGetTokenT< edm::DetSetVector< StripDigiSimLink > > stripToken_
std::vector< edm::EDGetTokenT< std::vector< PSimHit > > > simHitTokens_
simhit_collectionMap SimHitCollMap
void associatePixelRecHit(const SiPixelRecHit *pixelrechit, std::vector< SimHitIdpr > &simtrackid, std::vector< simhitAddr > *simhitCFPos=nullptr) const
Definition: DetId.h:17
void associateCluster(const SiStripCluster *clust, const DetId &detid, std::vector< SimHitIdpr > &simtrackid, std::vector< PSimHit > &simhit) const
std::pair< uint32_t, EncodedEventId > SimHitIdpr
std::vector< SimHitIdpr > associateMultiRecHitId(const SiTrackerMultiRecHit *multirechit, std::vector< simhitAddr > *simhitCFPos=nullptr) const
TrackerHitAssociator(const edm::Event &e, const Config &config)
std::vector< SimHitIdpr > associateProjectedRecHit(const ProjectedSiStripRecHit2D *projectedrechit, std::vector< simhitAddr > *simhitCFPos=nullptr) const
void associateSimpleRecHitCluster(const SiStripCluster *clust, const DetId &detid, std::vector< SimHitIdpr > &simtrackid, std::vector< simhitAddr > *simhitCFPos=nullptr) const
tuple config
parse the configuration file
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &thit) const
std::vector< PSimHit > associateHit(const TrackingRecHit &thit) const
std::map< subDetTofBin, unsigned int > simhit_collectionMap
long double T
std::vector< SimHitIdpr > associateMatchedRecHit(const SiStripMatchedRecHit2D *matchedrechit, std::vector< simhitAddr > *simhitCFPos=nullptr) const
Our base class.
Definition: SiPixelRecHit.h:23