CMS 3D CMS Logo

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>
27 
28 //--- for SimHit
31 
36 
37 //--- for RecHit
48 
50 
51 #include <string>
52 #include <vector>
53 
54 typedef std::pair<uint32_t, EncodedEventId> SimHitIdpr;
56 
57  public:
58  struct Config {
59  Config() {}
65  std::vector<edm::EDGetTokenT<CrossingFrame<PSimHit> > > cfTokens_;
66  std::vector<edm::EDGetTokenT<std::vector<PSimHit> > > simHitTokens_;
67  };
68 
69  // The constructor supporting the consumes interface and tokens
71 
72  // Destructor
74 
75  typedef std::pair<unsigned int, unsigned int> simhitAddr, subDetTofBin;
76  typedef unsigned int simHitCollectionID;
77 
78  std::vector<PSimHit> associateHit(const TrackingRecHit & thit) const;
79  //for PU events
80  std::vector<SimHitIdpr> associateHitId(const TrackingRecHit & thit) const;
81  void associateHitId(const TrackingRecHit & thit,std::vector<SimHitIdpr> &simhitid, std::vector<simhitAddr>* simhitCFPos=nullptr) const;
82  template<typename T>
83  void associateSiStripRecHit(const T *simplerechit, std::vector<SimHitIdpr>& simtrackid, std::vector<simhitAddr>* simhitCFPos=nullptr) const;
84 
85  // Method for obtaining simTracks and simHits from a cluster
86  void associateCluster(const SiStripCluster* clust,
87  const DetId& detid,
88  std::vector<SimHitIdpr>& simtrackid, std::vector<PSimHit>& simhit) const;
89 
90  // Obtain simTracks, and optionally simHit addresses, from a cluster
92  const DetId& detid,
93  std::vector<SimHitIdpr>& simtrackid, std::vector<simhitAddr>* simhitCFPos=nullptr) const;
94 
95  std::vector<SimHitIdpr> associateMatchedRecHit(const SiStripMatchedRecHit2D * matchedrechit, std::vector<simhitAddr>* simhitCFPos=nullptr) const;
96  std::vector<SimHitIdpr> associateProjectedRecHit(const ProjectedSiStripRecHit2D * projectedrechit, std::vector<simhitAddr>* simhitCFPos=nullptr) const;
97  void associatePhase2TrackerRecHit(const Phase2TrackerRecHit1D* rechit, std::vector<SimHitIdpr> & simtrackid, std::vector<simhitAddr>* simhitCFPos=nullptr) const;
98  void associatePixelRecHit(const SiPixelRecHit * pixelrechit, std::vector<SimHitIdpr> & simtrackid, std::vector<simhitAddr>* simhitCFPos=nullptr) const;
99  std::vector<SimHitIdpr> associateFastRecHit(const FastTrackerRecHit * rechit) const;
100  std::vector<SimHitIdpr> associateMultiRecHitId(const SiTrackerMultiRecHit * multirechit, std::vector<simhitAddr>* simhitCFPos=nullptr) const;
101  std::vector<PSimHit> associateMultiRecHit(const SiTrackerMultiRecHit * multirechit) const;
102 
103 
104  typedef std::map<unsigned int, std::vector<PSimHit> > simhit_map;
105  simhit_map SimHitMap;
106  typedef std::map<subDetTofBin, unsigned int> simhit_collectionMap;
107  simhit_collectionMap SimHitCollMap;
108 
109  private:
110  typedef std::vector<std::string> vstring;
111 
112  void makeMaps(const edm::Event& theEvent, const Config& config);
113  inline std::string printDetBnchEvtTrk(const DetId& detid, const uint32_t& detID, std::vector<SimHitIdpr>& simtrackid) const;
118 };
119 
120 #endif
std::vector< SimHitIdpr > associateMultiRecHitId(const SiTrackerMultiRecHit *multirechit, std::vector< simhitAddr > *simhitCFPos=0) const
edm::Handle< edm::DetSetVector< StripDigiSimLink > > stripdigisimlink
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_
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
Definition: config.py:1
edm::Handle< edm::DetSetVector< PixelDigiSimLink > > pixeldigisimlink
std::pair< unsigned int, unsigned int > subDetTofBin
void associateSimpleRecHitCluster(const SiStripCluster *clust, const DetId &detid, std::vector< SimHitIdpr > &simtrackid, std::vector< simhitAddr > *simhitCFPos=0) const
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > pixelToken_
void makeMaps(const edm::Event &theEvent, const Config &config)
edm::EDGetTokenT< edm::DetSetVector< StripDigiSimLink > > stripToken_
void associatePixelRecHit(const SiPixelRecHit *pixelrechit, std::vector< SimHitIdpr > &simtrackid, std::vector< simhitAddr > *simhitCFPos=0) const
std::vector< edm::EDGetTokenT< std::vector< PSimHit > > > simHitTokens_
simhit_collectionMap SimHitCollMap
Definition: DetId.h:18
void associateCluster(const SiStripCluster *clust, const DetId &detid, std::vector< SimHitIdpr > &simtrackid, std::vector< PSimHit > &simhit) const
std::pair< uint32_t, EncodedEventId > SimHitIdpr
TrackerHitAssociator(const edm::Event &e, const Config &config)
void associatePhase2TrackerRecHit(const Phase2TrackerRecHit1D *rechit, std::vector< SimHitIdpr > &simtrackid, std::vector< simhitAddr > *simhitCFPos=0) const
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &thit) const
std::vector< SimHitIdpr > associateProjectedRecHit(const ProjectedSiStripRecHit2D *projectedrechit, std::vector< simhitAddr > *simhitCFPos=0) const
Definition: Config.py:1
std::vector< PSimHit > associateHit(const TrackingRecHit &thit) const
std::map< subDetTofBin, unsigned int > simhit_collectionMap
edm::Handle< edm::DetSetVector< PixelDigiSimLink > > ph2trackerdigisimlink
long double T
std::vector< SimHitIdpr > associateMatchedRecHit(const SiStripMatchedRecHit2D *matchedrechit, std::vector< simhitAddr > *simhitCFPos=0) const
void associateSiStripRecHit(const T *simplerechit, std::vector< SimHitIdpr > &simtrackid, std::vector< simhitAddr > *simhitCFPos=0) const
Our base class.
Definition: SiPixelRecHit.h:23