CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MuonAssociatorByHits.h
Go to the documentation of this file.
1 #ifndef MuonAssociatorByHits_h
2 #define MuonAssociatorByHits_h
3 
22 
23 
24 #include <boost/ptr_container/ptr_vector.hpp>
25 
26 class TrackerTopology;
27 
29 
30  public:
31  typedef std::pair <uint32_t, EncodedEventId> SimHitIdpr;
32  //typedef std::map<unsigned int, std::vector<SimHitIdpr> > MapOfMatchedIds;
33  typedef std::pair<unsigned int,std::vector<SimHitIdpr> > uint_SimHitIdpr_pair;
34  typedef boost::ptr_vector<uint_SimHitIdpr_pair> MapOfMatchedIds;
35 
38 
39  // Get base methods from base class
42 
43  /* Associate SimTracks to RecoTracks By Hits */
47  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const;
48 
52  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const ;
53 
54 
55  void getMatchedIds
56  (MapOfMatchedIds & tracker_matchedIds_valid, MapOfMatchedIds & muon_matchedIds_valid,
57  MapOfMatchedIds & tracker_matchedIds_INVALID, MapOfMatchedIds & muon_matchedIds_INVALID,
58  int& n_tracker_valid, int& n_dt_valid, int& n_csc_valid, int& n_rpc_valid,
59  int& n_tracker_matched_valid, int& n_dt_matched_valid, int& n_csc_matched_valid, int& n_rpc_matched_valid,
60  int& n_tracker_INVALID, int& n_dt_INVALID, int& n_csc_INVALID, int& n_rpc_INVALID,
61  int& n_tracker_matched_INVALID, int& n_dt_matched_INVALID, int& n_csc_matched_INVALID, int& n_rpc_matched_INVALID,
63  TrackerHitAssociator* trackertruth, DTHitAssociator& dttruth, MuonTruth& csctruth, RPCHitAssociator& rpctruth,
64  bool printRts, const TrackerTopology *) const;
65 
66  int getShared(MapOfMatchedIds & matchedIds, TrackingParticleCollection::const_iterator trpart) const;
67 
68 
70  struct RefToBaseSort {
71  template<typename T> bool operator()(const edm::RefToBase<T> &r1, const edm::RefToBase<T> &r2) const {
72  return (r1.id() == r2.id() ? r1.key() < r2.key() : r1.id() < r2.id());
73  }
74  };
75  typedef std::map<edm::RefToBase<reco::Muon>, std::vector<std::pair<TrackingParticleRef, double> >, RefToBaseSort> MuonToSimCollection;
76  typedef std::map<TrackingParticleRef, std::vector<std::pair<edm::RefToBase<reco::Muon>, double> > > SimToMuonCollection;
77 
78 
79  void associateMuons(MuonToSimCollection & recoToSim, SimToMuonCollection & simToReco,
82  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const ;
83 
84  void associateMuons(MuonToSimCollection & recoToSim, SimToMuonCollection & simToReco,
87  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const ;
88 
89  private:
90  const bool includeZeroHitMuons;
92  bool UseTracker;
93  bool UseMuon;
95  unsigned int NHitCut_track;
99  unsigned int NHitCut_muon;
102  const bool UsePixels;
103  const bool UseGrouped;
104  const bool UseSplitting;
106  const bool dumpDT;
108  const bool crossingframe;
112 
113  int LayerFromDetid(const DetId&) const;
115  const TrackingRecHit* getHitPtr(trackingRecHit_iterator iter) const {return &**iter;}
116 
117  std::string write_matched_simtracks(const std::vector<SimHitIdpr>&) const;
118 
119  /* ==== ALL BELOW THIS IS FOR EXPERTS OR INTERNAL USE ONLY ==== */
120  typedef std::vector<std::pair<trackingRecHit_iterator, trackingRecHit_iterator> > TrackHitsCollection;
121  struct IndexMatch {
122  IndexMatch(size_t index, double global_quality) : idx(index), quality(global_quality) {}
123  size_t idx; double quality;
124  bool operator<(const IndexMatch &other) const { return other.quality < quality; }
125  };
126  typedef std::map<size_t, std::vector<IndexMatch> > IndexAssociation;
127 
130  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const ;
133  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const ;
134 
135 
136 
137 };
138 
139 #endif
std::pair< unsigned int, std::vector< SimHitIdpr > > uint_SimHitIdpr_pair
const TrackingRecHit * getHitPtr(edm::OwnVector< TrackingRecHit >::const_iterator iter) const
reco::RecoToSimCollection associateRecoToSim(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
Association Reco To Sim with Collections.
void associateMuons(MuonToSimCollection &recoToSim, SimToMuonCollection &simToReco, const edm::RefToBaseVector< reco::Muon > &, MuonTrackType, const edm::RefVector< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
bool operator<(const IndexMatch &other) const
boost::ptr_vector< uint_SimHitIdpr_pair > MapOfMatchedIds
const edm::ParameterSet & conf_
const TrackingRecHit * getHitPtr(trackingRecHit_iterator iter) const
ProductID id() const
Definition: RefToBase.h:220
int LayerFromDetid(const DetId &) const
std::pair< uint32_t, EncodedEventId > SimHitIdpr
const bool AbsoluteNumberOfHits_muon
std::map< TrackingParticleRef, std::vector< std::pair< edm::RefToBase< reco::Muon >, double > > > SimToMuonCollection
int getShared(MapOfMatchedIds &matchedIds, TrackingParticleCollection::const_iterator trpart) 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_tracker_matched_valid, int &n_dt_matched_valid, int &n_csc_matched_valid, int &n_rpc_matched_valid, int &n_tracker_INVALID, int &n_dt_INVALID, int &n_csc_INVALID, int &n_rpc_INVALID, int &n_tracker_matched_INVALID, int &n_dt_matched_INVALID, int &n_csc_matched_INVALID, int &n_rpc_matched_INVALID, trackingRecHit_iterator begin, trackingRecHit_iterator end, TrackerHitAssociator *trackertruth, DTHitAssociator &dttruth, MuonTruth &csctruth, RPCHitAssociator &rpctruth, bool printRts, const TrackerTopology *) const
#define end
Definition: vmac.h:38
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::string write_matched_simtracks(const std::vector< SimHitIdpr > &) const
size_t key() const
Definition: RefToBase.h:228
bool operator()(const edm::RefToBase< T > &r1, const edm::RefToBase< T > &r2) const
virtual reco::RecoToSimCollection associateRecoToSim(edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event, const edm::EventSetup *setup) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
const bool AbsoluteNumberOfHits_track
virtual reco::SimToRecoCollection associateSimToReco(edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event, const edm::EventSetup *setup) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
std::vector< std::pair< trackingRecHit_iterator, trackingRecHit_iterator > > TrackHitsCollection
Definition: DetId.h:20
IndexAssociation associateRecoToSimIndices(const TrackHitsCollection &, const edm::RefVector< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
#define begin
Definition: vmac.h:31
IndexMatch(size_t index, double global_quality)
reco::SimToRecoCollection associateSimToReco(const edm::RefToBaseVector< reco::Track > &, const edm::RefVector< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
Association Sim To Reco with Collections.
MuonAssociatorByHits(const edm::ParameterSet &)
IndexAssociation associateSimToRecoIndices(const TrackHitsCollection &, const edm::RefVector< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
std::map< edm::RefToBase< reco::Muon >, std::vector< std::pair< TrackingParticleRef, double > >, RefToBaseSort > MuonToSimCollection
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
std::map< size_t, std::vector< IndexMatch > > IndexAssociation