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 
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 boost::ptr_vector<uint_SimHitIdpr_pair> MapOfMatchedIds;
34  typedef std::vector<std::pair<trackingRecHit_iterator, trackingRecHit_iterator> > TrackHitsCollection;
35 
37 
38  struct Resources {
45  std::function<void(const TrackHitsCollection&, const TrackingParticleCollection&)> diagnostics_;
46  };
47 
48 
49  struct IndexMatch {
50  IndexMatch(size_t index, double global_quality) : idx(index), quality(global_quality) {}
51  size_t idx; double quality;
52  bool operator<(const IndexMatch &other) const { return other.quality < quality; }
53  };
54  typedef std::map<size_t, std::vector<IndexMatch> > IndexAssociation;
55 
56  IndexAssociation associateSimToRecoIndices(const TrackHitsCollection &,
58  Resources const&) const;
59 
60  IndexAssociation associateRecoToSimIndices(const TrackHitsCollection &,
62  Resources const&) const;
63 
64 
65 
66  private:
67  void getMatchedIds
68  (MapOfMatchedIds & tracker_matchedIds_valid, MapOfMatchedIds & muon_matchedIds_valid,
69  MapOfMatchedIds & tracker_matchedIds_INVALID, MapOfMatchedIds & muon_matchedIds_INVALID,
70  int& n_tracker_valid, int& n_dt_valid, int& n_csc_valid, int& n_rpc_valid, int& n_gem_valid,
71  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,
72  int& n_tracker_INVALID, int& n_dt_INVALID, int& n_csc_INVALID, int& n_rpc_INVALID, int& n_gem_INVALID,
73  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,
75  const TrackerHitAssociator* trackertruth, const DTHitAssociator& dttruth, const CSCHitAssociator& csctruth, const RPCHitAssociator& rpctruth, const GEMHitAssociator& gemtruth,
76  bool printRts, const TrackerTopology *) const;
77 
78  int getShared(MapOfMatchedIds & matchedIds, TrackingParticleCollection::const_iterator trpart) const;
79 
80  const bool includeZeroHitMuons;
82  bool UseTracker;
83  bool UseMuon;
85  unsigned int NHitCut_track;
89  unsigned int NHitCut_muon;
92  const bool UsePixels;
93  const bool UseGrouped;
94  const bool UseSplitting;
96  const bool dumpDT;
97 
98  int LayerFromDetid(const DetId&) const;
100  const TrackingRecHit* getHitPtr(const trackingRecHit_iterator& iter) const {return &**iter;}
101 
102  std::string write_matched_simtracks(const std::vector<SimHitIdpr>&) const;
103 
104 };
105 
106 #endif
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
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)
std::function< void(const TrackHitsCollection &, const TrackingParticleCollection &)> diagnostics_
#define end
Definition: vmac.h:37
const TrackingRecHit * getHitPtr(const trackingRecHit_iterator &iter) const
Definition: DetId.h:18
std::pair< unsigned int, std::vector< SimHitIdpr > > uint_SimHitIdpr_pair
IndexAssociation associateRecoToSimIndices(const TrackHitsCollection &, const edm::RefVector< TrackingParticleCollection > &, Resources const &) const
#define begin
Definition: vmac.h:30
std::pair< uint32_t, EncodedEventId > SimHitIdpr
boost::ptr_vector< uint_SimHitIdpr_pair > MapOfMatchedIds
const TrackingRecHit * getHitPtr(edm::OwnVector< TrackingRecHit >::const_iterator iter) const
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
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