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 
25 
26 #include <boost/ptr_container/ptr_vector.hpp>
27 
28 class TrackerTopology;
29 
31 
32  public:
33  typedef std::pair <uint32_t, EncodedEventId> SimHitIdpr;
34  //typedef std::map<unsigned int, std::vector<SimHitIdpr> > MapOfMatchedIds;
35  typedef std::pair<unsigned int,std::vector<SimHitIdpr> > uint_SimHitIdpr_pair;
36  typedef boost::ptr_vector<uint_SimHitIdpr_pair> MapOfMatchedIds;
37 
41 
42  // Get base methods from base class
45 
46  /* Associate SimTracks to RecoTracks By Hits */
50  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const;
51 
55  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const;
56 
57 
58  void getMatchedIds
59  (MapOfMatchedIds & tracker_matchedIds_valid, MapOfMatchedIds & muon_matchedIds_valid,
60  MapOfMatchedIds & tracker_matchedIds_INVALID, MapOfMatchedIds & muon_matchedIds_INVALID,
61  int& n_tracker_valid, int& n_dt_valid, int& n_csc_valid, int& n_rpc_valid,
62  int& n_tracker_matched_valid, int& n_dt_matched_valid, int& n_csc_matched_valid, int& n_rpc_matched_valid,
63  int& n_tracker_INVALID, int& n_dt_INVALID, int& n_csc_INVALID, int& n_rpc_INVALID,
64  int& n_tracker_matched_INVALID, int& n_dt_matched_INVALID, int& n_csc_matched_INVALID, int& n_rpc_matched_INVALID,
66  TrackerHitAssociator* trackertruth, DTHitAssociator& dttruth, MuonTruth& csctruth, RPCHitAssociator& rpctruth,
67  bool printRts, const TrackerTopology *) const;
68 
69  int getShared(MapOfMatchedIds & matchedIds, TrackingParticleCollection::const_iterator trpart) const;
70 
71 
73  struct RefToBaseSort {
74  template<typename T> bool operator()(const edm::RefToBase<T> &r1, const edm::RefToBase<T> &r2) const {
75  return (r1.id() == r2.id() ? r1.key() < r2.key() : r1.id() < r2.id());
76  }
77  };
78  typedef std::map<edm::RefToBase<reco::Muon>, std::vector<std::pair<TrackingParticleRef, double> >, RefToBaseSort> MuonToSimCollection;
79  typedef std::map<TrackingParticleRef, std::vector<std::pair<edm::RefToBase<reco::Muon>, double> > > SimToMuonCollection;
80 
81 
82  void associateMuons(MuonToSimCollection & recoToSim, SimToMuonCollection & simToReco,
85  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const ;
86 
87  void associateMuons(MuonToSimCollection & recoToSim, SimToMuonCollection & simToReco,
90  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const ;
91 
92  private:
93  const bool includeZeroHitMuons;
95  bool UseTracker;
96  bool UseMuon;
98  unsigned int NHitCut_track;
102  unsigned int NHitCut_muon;
105  const bool UsePixels;
106  const bool UseGrouped;
107  const bool UseSplitting;
109  const bool dumpDT;
111  const bool crossingframe;
115 
120 
121  int LayerFromDetid(const DetId&) const;
123  const TrackingRecHit* getHitPtr(const trackingRecHit_iterator& iter) const {return &**iter;}
124 
125  std::string write_matched_simtracks(const std::vector<SimHitIdpr>&) const;
126 
127  /* ==== ALL BELOW THIS IS FOR EXPERTS OR INTERNAL USE ONLY ==== */
128  typedef std::vector<std::pair<trackingRecHit_iterator, trackingRecHit_iterator> > TrackHitsCollection;
129  struct IndexMatch {
130  IndexMatch(size_t index, double global_quality) : idx(index), quality(global_quality) {}
131  size_t idx; double quality;
132  bool operator<(const IndexMatch &other) const { return other.quality < quality; }
133  };
134  typedef std::map<size_t, std::vector<IndexMatch> > IndexAssociation;
135 
138  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const;
141  const edm::Event * event = 0, const edm::EventSetup * setup = 0) const;
142 
143 
144 
145 };
146 
147 #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.
MuonAssociatorByHits(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC)
edm::EDGetTokenT< CrossingFrame< SimVertex > > simvertsXFToken_
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
edm::EDGetTokenT< edm::SimVertexContainer > simvertsToken_
boost::ptr_vector< uint_SimHitIdpr_pair > MapOfMatchedIds
const edm::ParameterSet & conf_
ProductID id() const
Definition: RefToBase.h:220
int LayerFromDetid(const DetId &) const
std::pair< uint32_t, EncodedEventId > SimHitIdpr
std::map< TrackingParticleRef, std::vector< std::pair< edm::RefToBase< reco::Muon >, double > > > SimToMuonCollection
int getShared(MapOfMatchedIds &matchedIds, TrackingParticleCollection::const_iterator trpart) const
const TrackingRecHit * getHitPtr(const trackingRecHit_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_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:37
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
tuple conf
Definition: dbtoconf.py:185
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:18
IndexAssociation associateRecoToSimIndices(const TrackHitsCollection &, const edm::RefVector< TrackingParticleCollection > &, const edm::Event *event=0, const edm::EventSetup *setup=0) const
#define begin
Definition: vmac.h:30
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.
edm::EDGetTokenT< edm::SimTrackContainer > simtracksToken_
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="")
edm::EDGetTokenT< CrossingFrame< SimTrack > > simtracksXFToken_
std::map< size_t, std::vector< IndexMatch > > IndexAssociation