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 public:
57  struct Config {
58  Config() {}
64  std::vector<edm::EDGetTokenT<CrossingFrame<PSimHit> > > cfTokens_;
65  std::vector<edm::EDGetTokenT<std::vector<PSimHit> > > simHitTokens_;
66  };
67 
68  // The constructor supporting the consumes interface and tokens
70 
71  // Destructor
72  virtual ~TrackerHitAssociator() {}
73 
74  typedef std::pair<unsigned int, unsigned int> simhitAddr, subDetTofBin;
75  typedef unsigned int simHitCollectionID;
76 
77  std::vector<PSimHit> associateHit(const TrackingRecHit& thit) const;
78  //for PU events
79  std::vector<SimHitIdpr> associateHitId(const TrackingRecHit& thit) const;
80  void associateHitId(const TrackingRecHit& thit,
81  std::vector<SimHitIdpr>& simhitid,
82  std::vector<simhitAddr>* simhitCFPos = nullptr) const;
83  template <typename T>
84  void associateSiStripRecHit(const T* simplerechit,
85  std::vector<SimHitIdpr>& simtrackid,
86  std::vector<simhitAddr>* simhitCFPos = nullptr) const;
87 
88  // Method for obtaining simTracks and simHits from a cluster
89  void associateCluster(const SiStripCluster* clust,
90  const DetId& detid,
91  std::vector<SimHitIdpr>& simtrackid,
92  std::vector<PSimHit>& simhit) const;
93 
94  // Obtain simTracks, and optionally simHit addresses, from a cluster
96  const DetId& detid,
97  std::vector<SimHitIdpr>& simtrackid,
98  std::vector<simhitAddr>* simhitCFPos = nullptr) const;
99 
100  std::vector<SimHitIdpr> associateMatchedRecHit(const SiStripMatchedRecHit2D* matchedrechit,
101  std::vector<simhitAddr>* simhitCFPos = nullptr) const;
102  std::vector<SimHitIdpr> associateProjectedRecHit(const ProjectedSiStripRecHit2D* projectedrechit,
103  std::vector<simhitAddr>* simhitCFPos = nullptr) const;
105  std::vector<SimHitIdpr>& simtrackid,
106  std::vector<simhitAddr>* simhitCFPos = nullptr) const;
107  void associatePixelRecHit(const SiPixelRecHit* pixelrechit,
108  std::vector<SimHitIdpr>& simtrackid,
109  std::vector<simhitAddr>* simhitCFPos = nullptr) const;
110  std::vector<SimHitIdpr> associateFastRecHit(const FastTrackerRecHit* rechit) const;
111  std::vector<SimHitIdpr> associateMultiRecHitId(const SiTrackerMultiRecHit* multirechit,
112  std::vector<simhitAddr>* simhitCFPos = nullptr) const;
113  std::vector<PSimHit> associateMultiRecHit(const SiTrackerMultiRecHit* multirechit) const;
114 
115  typedef std::map<unsigned int, std::vector<PSimHit> > simhit_map;
117  typedef std::map<subDetTofBin, unsigned int> simhit_collectionMap;
119 
120 private:
121  typedef std::vector<std::string> vstring;
122 
123  void makeMaps(const edm::Event& theEvent, const Config& config);
124  inline std::string printDetBnchEvtTrk(const DetId& detid,
125  const uint32_t& detID,
126  std::vector<SimHitIdpr>& simtrackid) const;
131 };
132 
133 #endif
TrackerHitAssociator::Config::doStrip_
bool doStrip_
Definition: TrackerHitAssociator.h:61
TrackerHitAssociator::Config::assocHitbySimTrack_
bool assocHitbySimTrack_
Definition: TrackerHitAssociator.h:61
TrackerHitAssociator::SimHitCollMap
simhit_collectionMap SimHitCollMap
Definition: TrackerHitAssociator.h:118
Handle.h
TrackerHitAssociator::associatePhase2TrackerRecHit
void associatePhase2TrackerRecHit(const Phase2TrackerRecHit1D *rechit, std::vector< SimHitIdpr > &simtrackid, std::vector< simhitAddr > *simhitCFPos=nullptr) const
Definition: TrackerHitAssociator.cc:509
TrackerHitAssociator::Config::ph2OTrToken_
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > ph2OTrToken_
Definition: TrackerHitAssociator.h:63
TrackerHitAssociator::assocHitbySimTrack_
bool assocHitbySimTrack_
Definition: TrackerHitAssociator.h:130
TrackerHitAssociator::associateSimpleRecHitCluster
void associateSimpleRecHitCluster(const SiStripCluster *clust, const DetId &detid, std::vector< SimHitIdpr > &simtrackid, std::vector< simhitAddr > *simhitCFPos=nullptr) const
Definition: TrackerHitAssociator.cc:411
TrackerHitAssociator::associatePixelRecHit
void associatePixelRecHit(const SiPixelRecHit *pixelrechit, std::vector< SimHitIdpr > &simtrackid, std::vector< simhitAddr > *simhitCFPos=nullptr) const
Definition: TrackerHitAssociator.cc:566
ESHandle.h
SimHitIdpr
std::pair< uint32_t, EncodedEventId > SimHitIdpr
Definition: TrackerHitAssociator.h:54
TrackerHitAssociator::ph2trackerdigisimlink
edm::Handle< edm::DetSetVector< PixelDigiSimLink > > ph2trackerdigisimlink
Definition: TrackerHitAssociator.h:129
TrackerHitAssociator::associateMultiRecHit
std::vector< PSimHit > associateMultiRecHit(const SiTrackerMultiRecHit *multirechit) const
Definition: TrackerHitAssociator.cc:627
edm::EDGetTokenT
Definition: EDGetToken.h:33
TrackerHitAssociator::associateProjectedRecHit
std::vector< SimHitIdpr > associateProjectedRecHit(const ProjectedSiStripRecHit2D *projectedrechit, std::vector< simhitAddr > *simhitCFPos=nullptr) const
Definition: TrackerHitAssociator.cc:498
TrackerHitAssociator::stripdigisimlink
edm::Handle< edm::DetSetVector< StripDigiSimLink > > stripdigisimlink
Definition: TrackerHitAssociator.h:127
PSimHitContainer.h
TrackerHitAssociator::associateHit
std::vector< PSimHit > associateHit(const TrackingRecHit &thit) const
Definition: TrackerHitAssociator.cc:212
TrackerHitAssociator::~TrackerHitAssociator
virtual ~TrackerHitAssociator()
Definition: TrackerHitAssociator.h:72
FastTrackerRecHit
Definition: FastTrackerRecHit.h:40
TransientTrackingRecHit.h
EDAnalyzer.h
PixelDigi.h
TrackerHitAssociator::Config::doTrackAssoc_
bool doTrackAssoc_
Definition: TrackerHitAssociator.h:61
TrackerHitAssociator::TrackerHitAssociator
TrackerHitAssociator(const edm::Event &e, const Config &config)
Definition: TrackerHitAssociator.cc:103
edm::Handle
Definition: AssociativeIterator.h:50
ProjectedSiStripRecHit2D
Definition: ProjectedSiStripRecHit2D.h:8
SiPixelRecHit
Our base class.
Definition: SiPixelRecHit.h:23
config
Definition: config.py:1
DetId
Definition: DetId.h:17
MakerMacros.h
TrackingRecHit.h
PSimHit.h
MixCollection.h
SiTrackerMultiRecHit.h
TrackerHitAssociator::simHitCollectionID
unsigned int simHitCollectionID
Definition: TrackerHitAssociator.h:75
SiPixelRecHit.h
EDGetToken.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackerHitAssociator::Config::stripToken_
edm::EDGetTokenT< edm::DetSetVector< StripDigiSimLink > > stripToken_
Definition: TrackerHitAssociator.h:62
TrackerHitAssociator::simhit_collectionMap
std::map< subDetTofBin, unsigned int > simhit_collectionMap
Definition: TrackerHitAssociator.h:117
Phase2TrackerRecHit1D.h
TrackerHitAssociator::simhit_map
std::map< unsigned int, std::vector< PSimHit > > simhit_map
Definition: TrackerHitAssociator.h:115
edm::ParameterSet
Definition: ParameterSet.h:47
TrackerHitAssociator::Config::simHitTokens_
std::vector< edm::EDGetTokenT< std::vector< PSimHit > > > simHitTokens_
Definition: TrackerHitAssociator.h:65
TrackerHitAssociator::vstring
std::vector< std::string > vstring
Definition: TrackerHitAssociator.h:121
Event.h
TrackerHitAssociator::printDetBnchEvtTrk
std::string printDetBnchEvtTrk(const DetId &detid, const uint32_t &detID, std::vector< SimHitIdpr > &simtrackid) const
Definition: TrackerHitAssociator.cc:666
TrackerHitAssociator::doStrip_
bool doStrip_
Definition: TrackerHitAssociator.h:130
TrackerHitAssociator::SimHitMap
simhit_map SimHitMap
Definition: TrackerHitAssociator.h:116
TrackerHitAssociator::pixeldigisimlink
edm::Handle< edm::DetSetVector< PixelDigiSimLink > > pixeldigisimlink
Definition: TrackerHitAssociator.h:128
TrackerHitAssociator::useOTph2_
bool useOTph2_
Definition: TrackerHitAssociator.h:130
TrackerHitAssociator::associateCluster
void associateCluster(const SiStripCluster *clust, const DetId &detid, std::vector< SimHitIdpr > &simtrackid, std::vector< PSimHit > &simhit) const
Definition: TrackerHitAssociator.cc:386
TrackerHitAssociator::Config::pixelToken_
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > pixelToken_
Definition: TrackerHitAssociator.h:63
ProjectedSiStripRecHit2D.h
TrackerHitAssociator::associateMatchedRecHit
std::vector< SimHitIdpr > associateMatchedRecHit(const SiStripMatchedRecHit2D *matchedrechit, std::vector< simhitAddr > *simhitCFPos=nullptr) const
Definition: TrackerHitAssociator.cc:471
DetSetVector.h
TrackerHitAssociator::doTrackAssoc_
bool doTrackAssoc_
Definition: TrackerHitAssociator.h:130
TrackingRecHit
Definition: TrackingRecHit.h:21
SiStripRecHit1D.h
TrackerHitAssociator
Definition: TrackerHitAssociator.h:55
SiStripMatchedRecHit2D
Definition: SiStripMatchedRecHit2D.h:8
TrackerHitAssociator::associateMultiRecHitId
std::vector< SimHitIdpr > associateMultiRecHitId(const SiTrackerMultiRecHit *multirechit, std::vector< simhitAddr > *simhitCFPos=nullptr) const
Definition: TrackerHitAssociator.cc:640
T
long double T
Definition: Basic3DVectorLD.h:48
TrackerHitAssociator::Config::Config
Config()
Definition: TrackerHitAssociator.h:58
EventSetup.h
TrackerHitAssociator::Config::doPixel_
bool doPixel_
Definition: TrackerHitAssociator.h:61
TrackerHitAssociator::Config::cfTokens_
std::vector< edm::EDGetTokenT< CrossingFrame< PSimHit > > > cfTokens_
Definition: TrackerHitAssociator.h:64
FastTrackerRecHit.h
ConsumesCollector.h
SiStripMatchedRecHit2D.h
Config
Definition: Config.py:1
edm::Event
Definition: Event.h:73
SiStripCluster
Definition: SiStripCluster.h:8
SiTrackerMultiRecHit
Definition: SiTrackerMultiRecHit.h:13
SiStripRecHit2D.h
TrackerHitAssociator::associateHitId
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &thit) const
Definition: TrackerHitAssociator.cc:332
TrackerHitAssociator::associateFastRecHit
std::vector< SimHitIdpr > associateFastRecHit(const FastTrackerRecHit *rechit) const
Definition: TrackerHitAssociator.cc:656
TrackerHitAssociator::associateSiStripRecHit
void associateSiStripRecHit(const T *simplerechit, std::vector< SimHitIdpr > &simtrackid, std::vector< simhitAddr > *simhitCFPos=nullptr) const
Definition: TrackerHitAssociator.cc:376
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
TrackerHitAssociator::Config::useOTph2_
bool useOTph2_
Definition: TrackerHitAssociator.h:61
TrackerHitAssociator::makeMaps
void makeMaps(const edm::Event &theEvent, const Config &config)
Definition: TrackerHitAssociator.cc:124
TrackerHitAssociator::doPixel_
bool doPixel_
Definition: TrackerHitAssociator.h:130
TrackerHitAssociator::simhitAddr
std::pair< unsigned int, unsigned int > simhitAddr
Definition: TrackerHitAssociator.h:74
Phase2TrackerRecHit1D
Definition: Phase2TrackerRecHit1D.h:10
TrackerHitAssociator::subDetTofBin
std::pair< unsigned int, unsigned int > subDetTofBin
Definition: TrackerHitAssociator.h:74
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37