CMS 3D CMS Logo

MuonAssociatorByHitsHelper.h
Go to the documentation of this file.
1 #ifndef MuonAssociatorByHitsHelper_h
2 #define MuonAssociatorByHitsHelper_h
3 
21 
22 #include <boost/ptr_container/ptr_vector.hpp>
23 #include <functional>
24 
25 class TrackerTopology;
26 
28 public:
29  typedef std::pair<uint32_t, EncodedEventId> SimHitIdpr;
30  // typedef std::map<unsigned int, std::vector<SimHitIdpr> > MapOfMatchedIds;
31  typedef std::pair<unsigned int, std::vector<SimHitIdpr>> uint_SimHitIdpr_pair;
32  typedef boost::ptr_vector<uint_SimHitIdpr_pair> MapOfMatchedIds;
33  typedef std::vector<std::pair<trackingRecHit_iterator, trackingRecHit_iterator>> TrackHitsCollection;
34 
36 
37  struct Resources {
44  std::function<void(const TrackHitsCollection &, const TrackingParticleCollection &)> diagnostics_;
45  };
46 
47  struct IndexMatch {
48  IndexMatch(size_t index, double global_quality) : idx(index), quality(global_quality) {}
49  size_t idx;
50  double quality;
51  bool operator<(const IndexMatch &other) const { return other.quality < quality; }
52  };
53  typedef std::map<size_t, std::vector<IndexMatch>> IndexAssociation;
54 
55  IndexAssociation associateSimToRecoIndices(const TrackHitsCollection &,
57  Resources const &) const;
58 
59  IndexAssociation associateRecoToSimIndices(const TrackHitsCollection &,
61  Resources const &) const;
62 
63 private:
64  void getMatchedIds(MapOfMatchedIds &tracker_matchedIds_valid,
65  MapOfMatchedIds &muon_matchedIds_valid,
66  MapOfMatchedIds &tracker_matchedIds_INVALID,
67  MapOfMatchedIds &muon_matchedIds_INVALID,
68  int &n_tracker_valid,
69  int &n_dt_valid,
70  int &n_csc_valid,
71  int &n_rpc_valid,
72  int &n_gem_valid,
73  int &n_tracker_matched_valid,
74  int &n_dt_matched_valid,
75  int &n_csc_matched_valid,
76  int &n_rpc_matched_valid,
77  int &n_gem_matched_valid,
78  int &n_tracker_INVALID,
79  int &n_dt_INVALID,
80  int &n_csc_INVALID,
81  int &n_rpc_INVALID,
82  int &n_gem_INVALID,
83  int &n_tracker_matched_INVALID,
84  int &n_dt_matched_INVALID,
85  int &n_csc_matched_INVALID,
86  int &n_rpc_matched_INVALID,
87  int &n_gem_matched_INVALID,
90  const TrackerHitAssociator *trackertruth,
91  const DTHitAssociator &dttruth,
92  const CSCHitAssociator &csctruth,
93  const RPCHitAssociator &rpctruth,
94  const GEMHitAssociator &gemtruth,
95  bool printRts,
96  const TrackerTopology *) const;
97 
98  int getShared(MapOfMatchedIds &matchedIds, TrackingParticleCollection::const_iterator trpart) const;
99 
103  bool UseMuon;
105  unsigned int NHitCut_track;
109  unsigned int NHitCut_muon;
112  const bool UsePixels;
113  const bool UseGrouped;
114  const bool UseSplitting;
116  const bool dumpDT;
117 
118  int LayerFromDetid(const DetId &) const;
120  const TrackingRecHit *getHitPtr(const trackingRecHit_iterator &iter) const { return &**iter; }
121 
122  std::string write_matched_simtracks(const std::vector<SimHitIdpr> &) const;
123 };
124 
125 #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::pair< trackingRecHit_iterator, trackingRecHit_iterator > > TrackHitsCollection
MuonAssociatorByHitsHelper(const edm::ParameterSet &conf)
#define end
Definition: vmac.h:39
const TrackingRecHit * getHitPtr(const trackingRecHit_iterator &iter) const
Definition: DetId.h:18
IndexAssociation associateRecoToSimIndices(const TrackHitsCollection &, const edm::RefVector< TrackingParticleCollection > &, Resources const &) const
#define begin
Definition: vmac.h:32
std::pair< uint32_t, EncodedEventId > SimHitIdpr
boost::ptr_vector< uint_SimHitIdpr_pair > MapOfMatchedIds
const TrackingRecHit * getHitPtr(edm::OwnVector< TrackingRecHit >::const_iterator iter) const
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