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 
27 
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 
36 
37  // Get base methods from base class
40 
41  /* Associate SimTracks to RecoTracks By Hits */
45  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const;
46 
50  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const ;
51 
52 
53  void getMatchedIds
54  (MapOfMatchedIds & tracker_matchedIds_valid, MapOfMatchedIds & muon_matchedIds_valid,
55  MapOfMatchedIds & tracker_matchedIds_INVALID, MapOfMatchedIds & muon_matchedIds_INVALID,
56  int& n_tracker_valid, int& n_dt_valid, int& n_csc_valid, int& n_rpc_valid,
57  int& n_tracker_matched_valid, int& n_dt_matched_valid, int& n_csc_matched_valid, int& n_rpc_matched_valid,
58  int& n_tracker_INVALID, int& n_dt_INVALID, int& n_csc_INVALID, int& n_rpc_INVALID,
59  int& n_tracker_matched_INVALID, int& n_dt_matched_INVALID, int& n_csc_matched_INVALID, int& n_rpc_matched_INVALID,
61  TrackerHitAssociator* trackertruth, DTHitAssociator& dttruth, MuonTruth& csctruth, RPCHitAssociator& rpctruth,
62  bool printRts) const;
63 
64  int getShared(MapOfMatchedIds & matchedIds, TrackingParticleCollection::const_iterator trpart) const;
65 
66 
68  struct RefToBaseSort {
69  template<typename T> bool operator()(const edm::RefToBase<T> &r1, const edm::RefToBase<T> &r2) const {
70  return (r1.id() == r2.id() ? r1.key() < r2.key() : r1.id() < r2.id());
71  }
72  };
73  typedef std::map<edm::RefToBase<reco::Muon>, std::vector<std::pair<TrackingParticleRef, double> >, RefToBaseSort> MuonToSimCollection;
74  typedef std::map<TrackingParticleRef, std::vector<std::pair<edm::RefToBase<reco::Muon>, double> > > SimToMuonCollection;
75 
76 
77  void associateMuons(MuonToSimCollection & recoToSim, SimToMuonCollection & simToReco,
80  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const ;
81 
82  void associateMuons(MuonToSimCollection & recoToSim, SimToMuonCollection & simToReco,
85  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const ;
86 
87  private:
88  const bool includeZeroHitMuons;
90  bool UseTracker;
91  bool UseMuon;
93  unsigned int NHitCut_track;
97  unsigned int NHitCut_muon;
100  const bool UsePixels;
101  const bool UseGrouped;
102  const bool UseSplitting;
104  const bool dumpDT;
106  const bool crossingframe;
110 
111  int LayerFromDetid(const DetId&) const;
113  const TrackingRecHit* getHitPtr(trackingRecHit_iterator iter) const {return &**iter;}
114 
115  std::string write_matched_simtracks(const std::vector<SimHitIdpr>&) const;
116 
117  /* ==== ALL BELOW THIS IS FOR EXPERTS OR INTERNAL USE ONLY ==== */
118  typedef std::vector<std::pair<trackingRecHit_iterator, trackingRecHit_iterator> > TrackHitsCollection;
119  struct IndexMatch {
120  IndexMatch(size_t index, double global_quality) : idx(index), quality(global_quality) {}
121  size_t idx; double quality;
122  bool operator<(const IndexMatch &other) const { return other.quality < quality; }
123  };
124  typedef std::map<size_t, std::vector<IndexMatch> > IndexAssociation;
125 
128  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const ;
131  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const ;
132 
133 
134 
135 };
136 
137 #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
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
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
#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