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 
23 
25 
26  public:
27  typedef std::pair <uint32_t, EncodedEventId> SimHitIdpr;
28  typedef std::map<unsigned int, std::vector<SimHitIdpr> > MapOfMatchedIds;
29 
32 
33  // Get base methods from base class
36 
37  /* Associate SimTracks to RecoTracks By Hits */
41  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const;
42 
46  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const ;
47 
48 
49  void getMatchedIds
50  (MapOfMatchedIds & tracker_matchedIds_valid, MapOfMatchedIds & muon_matchedIds_valid,
51  MapOfMatchedIds & tracker_matchedIds_INVALID, MapOfMatchedIds & muon_matchedIds_INVALID,
52  int& n_tracker_valid, int& n_dt_valid, int& n_csc_valid, int& n_rpc_valid,
53  int& n_tracker_matched_valid, int& n_dt_matched_valid, int& n_csc_matched_valid, int& n_rpc_matched_valid,
54  int& n_tracker_INVALID, int& n_dt_INVALID, int& n_csc_INVALID, int& n_rpc_INVALID,
55  int& n_tracker_matched_INVALID, int& n_dt_matched_INVALID, int& n_csc_matched_INVALID, int& n_rpc_matched_INVALID,
57  TrackerHitAssociator* trackertruth, DTHitAssociator& dttruth, MuonTruth& csctruth, RPCHitAssociator& rpctruth,
58  bool printRts) const;
59 
60  int getShared(MapOfMatchedIds & matchedIds, TrackingParticleCollection::const_iterator trpart) const;
61 
62 
64  struct RefToBaseSort {
65  template<typename T> bool operator()(const edm::RefToBase<T> &r1, const edm::RefToBase<T> &r2) const {
66  return (r1.id() == r2.id() ? r1.key() < r2.key() : r1.id() < r2.id());
67  }
68  };
69  typedef std::map<edm::RefToBase<reco::Muon>, std::vector<std::pair<TrackingParticleRef, double> >, RefToBaseSort> MuonToSimCollection;
70  typedef std::map<TrackingParticleRef, std::vector<std::pair<edm::RefToBase<reco::Muon>, double> > > SimToMuonCollection;
71 
72 
73  void associateMuons(MuonToSimCollection & recoToSim, SimToMuonCollection & simToReco,
76  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const ;
77 
78  void associateMuons(MuonToSimCollection & recoToSim, SimToMuonCollection & simToReco,
81  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const ;
82 
83  private:
84  const bool includeZeroHitMuons;
86  bool UseTracker;
87  bool UseMuon;
89  unsigned int NHitCut_track;
93  unsigned int NHitCut_muon;
96  const bool UsePixels;
97  const bool UseGrouped;
98  const bool UseSplitting;
100  const bool dumpDT;
102  const bool crossingframe;
106 
107  int LayerFromDetid(const DetId&) const;
109  const TrackingRecHit* getHitPtr(trackingRecHit_iterator iter) const {return &**iter;}
110 
111  std::string write_matched_simtracks(const std::vector<SimHitIdpr>&) const;
112 
113  /* ==== ALL BELOW THIS IS FOR EXPERTS OR INTERNAL USE ONLY ==== */
114  typedef std::vector<std::pair<trackingRecHit_iterator, trackingRecHit_iterator> > TrackHitsCollection;
115  struct IndexMatch {
116  IndexMatch(size_t index, double global_quality) : idx(index), quality(global_quality) {}
117  size_t idx; double quality;
118  bool operator<(const IndexMatch &other) const { return other.quality < quality; }
119  };
120  typedef std::map<size_t, std::vector<IndexMatch> > IndexAssociation;
121 
124  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const ;
127  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const ;
128 
129 
130 
131 };
132 
133 #endif
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
virtual reco::SimToRecoCollection associateSimToReco(edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event=0, const edm::EventSetup *setup=0) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
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< unsigned int, std::vector< SimHitIdpr > > MapOfMatchedIds
std::map< TrackingParticleRef, std::vector< std::pair< edm::RefToBase< reco::Muon >, double > > > SimToMuonCollection
int getShared(MapOfMatchedIds &matchedIds, TrackingParticleCollection::const_iterator trpart) 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
const bool AbsoluteNumberOfHits_track
virtual reco::RecoToSimCollection associateRecoToSim(edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event=0, const edm::EventSetup *setup=0) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
std::vector< std::pair< trackingRecHit_iterator, trackingRecHit_iterator > > TrackHitsCollection
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
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