CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
MuonAssociatorByHitsHelper.h
Go to the documentation of this file.
1 #ifndef MuonAssociatorByHitsHelper_h
2 #define MuonAssociatorByHitsHelper_h
3 
21 
22 #include <vector>
23 #include <memory>
24 #include <functional>
25 
26 class TrackerTopology;
27 
29 public:
30  typedef std::pair<uint32_t, EncodedEventId> SimHitIdpr;
31  // typedef std::map<unsigned int, std::vector<SimHitIdpr> > MapOfMatchedIds;
32  typedef std::pair<unsigned int, std::vector<SimHitIdpr>> uint_SimHitIdpr_pair;
33  typedef std::vector<std::unique_ptr<uint_SimHitIdpr_pair>> MapOfMatchedIds;
34  typedef std::vector<std::pair<trackingRecHit_iterator, trackingRecHit_iterator>> TrackHitsCollection;
35 
37 
38  struct Resources {
39  Resources(TrackerTopology const *tTopo,
40  TrackerHitAssociator const *trackerHitAssoc,
41  CSCHitAssociator const *cscHitAssoc,
42  DTHitAssociator const *dtHitAssoc,
43  RPCHitAssociator const *rpcHitAssoc,
44  GEMHitAssociator const *gemHitAssoc,
45  std::function<void(const TrackHitsCollection &, const TrackingParticleCollection &)> diagnostics)
46  : tTopo_(tTopo),
47  trackerHitAssoc_(trackerHitAssoc),
48  cscHitAssoc_(cscHitAssoc),
49  dtHitAssoc_(dtHitAssoc),
50  rpcHitAssoc_(rpcHitAssoc),
51  gemHitAssoc_(gemHitAssoc),
52  diagnostics_(diagnostics) {}
53 
60  std::function<void(const TrackHitsCollection &, const TrackingParticleCollection &)> diagnostics_;
61  };
62 
63  struct IndexMatch {
64  IndexMatch(size_t index, double global_quality) : idx(index), quality(global_quality) {}
65  size_t idx;
66  double quality;
67  bool operator<(const IndexMatch &other) const { return other.quality < quality; }
68  };
69  typedef std::map<size_t, std::vector<IndexMatch>> IndexAssociation;
70 
73  Resources const &) const;
74 
77  Resources const &) const;
78 
79 private:
80  void getMatchedIds(MapOfMatchedIds &tracker_matchedIds_valid,
81  MapOfMatchedIds &muon_matchedIds_valid,
82  MapOfMatchedIds &tracker_matchedIds_INVALID,
83  MapOfMatchedIds &muon_matchedIds_INVALID,
84  int &n_tracker_valid,
85  int &n_dt_valid,
86  int &n_csc_valid,
87  int &n_rpc_valid,
88  int &n_gem_valid,
89  int &n_tracker_matched_valid,
90  int &n_dt_matched_valid,
91  int &n_csc_matched_valid,
92  int &n_rpc_matched_valid,
93  int &n_gem_matched_valid,
94  int &n_tracker_INVALID,
95  int &n_dt_INVALID,
96  int &n_csc_INVALID,
97  int &n_rpc_INVALID,
98  int &n_gem_INVALID,
99  int &n_tracker_matched_INVALID,
100  int &n_dt_matched_INVALID,
101  int &n_csc_matched_INVALID,
102  int &n_rpc_matched_INVALID,
103  int &n_gem_matched_INVALID,
106  const TrackerHitAssociator *trackertruth,
107  const DTHitAssociator &dttruth,
108  const CSCHitAssociator &csctruth,
109  const RPCHitAssociator &rpctruth,
110  const GEMHitAssociator &gemtruth,
111  bool printRts,
112  const TrackerTopology *) const;
113 
114  int getShared(MapOfMatchedIds &matchedIds, TrackingParticleCollection::const_iterator trpart) const;
115 
118  const bool rejectBadGlobal;
120  bool UseMuon;
122  unsigned int NHitCut_track;
126  unsigned int NHitCut_muon;
129  const bool UsePixels;
130  const bool UseGrouped;
131  const bool UseSplitting;
133  const bool dumpDT;
134 
135  int LayerFromDetid(const DetId &) const;
137  const TrackingRecHit *getHitPtr(const trackingRecHit_iterator &iter) const { return &**iter; }
138 
139  std::string write_matched_simtracks(const std::vector<SimHitIdpr> &) const;
140 };
141 
142 #endif
std::function< void(const TrackHitsCollection &, const TrackingParticleCollection &)> diagnostics_
std::string write_matched_simtracks(const std::vector< SimHitIdpr > &) const
std::map< size_t, std::vector< IndexMatch > > IndexAssociation
int getShared(MapOfMatchedIds &matchedIds, TrackingParticleCollection::const_iterator trpart) const
bool operator<(const IndexMatch &other) const
std::pair< unsigned int, std::vector< SimHitIdpr > > uint_SimHitIdpr_pair
IndexAssociation associateSimToRecoIndices(const TrackHitsCollection &, const edm::RefVector< TrackingParticleCollection > &, Resources const &) const
int LayerFromDetid(const DetId &) const
IndexMatch(size_t index, double global_quality)
std::vector< std::unique_ptr< uint_SimHitIdpr_pair > > MapOfMatchedIds
std::vector< std::pair< trackingRecHit_iterator, trackingRecHit_iterator > > TrackHitsCollection
MuonAssociatorByHitsHelper(const edm::ParameterSet &conf)
string function
Definition: callgraph.py:50
const TrackingRecHit * getHitPtr(const trackingRecHit_iterator &iter) const
Definition: DetId.h:17
IndexAssociation associateRecoToSimIndices(const TrackHitsCollection &, const edm::RefVector< TrackingParticleCollection > &, Resources const &) const
std::pair< uint32_t, EncodedEventId > SimHitIdpr
const TrackingRecHit * getHitPtr(edm::OwnVector< TrackingRecHit >::const_iterator iter) const
string end
Definition: dataset.py:937
std::vector< TrackingParticle > TrackingParticleCollection
Resources(TrackerTopology const *tTopo, TrackerHitAssociator const *trackerHitAssoc, CSCHitAssociator const *cscHitAssoc, DTHitAssociator const *dtHitAssoc, RPCHitAssociator const *rpcHitAssoc, GEMHitAssociator const *gemHitAssoc, std::function< void(const TrackHitsCollection &, const TrackingParticleCollection &)> diagnostics)
void getMatchedIds(MapOfMatchedIds &tracker_matchedIds_valid, MapOfMatchedIds &muon_matchedIds_valid, MapOfMatchedIds &tracker_matchedIds_INVALID, MapOfMatchedIds &muon_matchedIds_INVALID, int &n_tracker_valid, int &n_dt_valid, int &n_csc_valid, int &n_rpc_valid, int &n_gem_valid, int &n_tracker_matched_valid, int &n_dt_matched_valid, int &n_csc_matched_valid, int &n_rpc_matched_valid, int &n_gem_matched_valid, int &n_tracker_INVALID, int &n_dt_INVALID, int &n_csc_INVALID, int &n_rpc_INVALID, int &n_gem_INVALID, int &n_tracker_matched_INVALID, int &n_dt_matched_INVALID, int &n_csc_matched_INVALID, int &n_rpc_matched_INVALID, int &n_gem_matched_INVALID, trackingRecHit_iterator begin, trackingRecHit_iterator end, const TrackerHitAssociator *trackertruth, const DTHitAssociator &dttruth, const CSCHitAssociator &csctruth, const RPCHitAssociator &rpctruth, const GEMHitAssociator &gemtruth, bool printRts, const TrackerTopology *) const