CMS 3D CMS Logo

SimHitMatcher.h
Go to the documentation of this file.
1 #ifndef GEMValidation_SimHitMatcher_h
2 #define GEMValidation_SimHitMatcher_h
3 
20 
26 #include <vector>
27 #include <map>
28 #include <set>
29 
30 class GEMGeometry;
31 
33 {
34 public:
35 
36  SimHitMatcher(const SimTrack& track, const edm::Event& , const GEMGeometry& geom, const edm::ParameterSet& cfg, edm::EDGetToken& simhitToken, edm::EDGetToken& simtrackToken, edm::EDGetToken& simvertexToken);
37 
39 
41  const edm::PSimHitContainer& simHitsGEM() const {return gem_hits_;}
43  std::set<unsigned int> detIdsGEM() const;
44 
47  std::set<unsigned int> detIdsGEMCoincidences() const;
48 
50  std::set<unsigned int> chamberIdsGEM() const;
51 
53  std::set<unsigned int> superChamberIdsGEM() const;
55  std::set<unsigned int> superChamberIdsGEMCoincidences() const;
56 
58  const edm::PSimHitContainer& hitsInDetId(unsigned int) const;
59  const edm::PSimHitContainer& hitsInChamber(unsigned int) const;
60  const edm::PSimHitContainer& hitsInSuperChamber(unsigned int) const;
61 
64  int nLayersWithHitsInSuperChamber(unsigned int) const;
65 
67  int nPadsWithHits() const;
69  int nCoincidencePadsWithHits() const;
70 
73 
75  float simHitsMeanStrip(const edm::PSimHitContainer& sim_hits) const;
76 
77  std::set<int> hitStripsInDetId(unsigned int, int margin_n_strips = 0) const; // GEM or CSC
78  std::set<int> hitPadsInDetId(unsigned int) const; // GEM
79  std::set<int> hitCoPadsInDetId(unsigned int) const; // GEM coincidence pads with hits
80 
81  // what unique partitions numbers were hit by this simtrack?
82  std::set<int> hitPartitions() const; // GEM
83 
84 private:
85 
86  void init(const edm::Event& );
87  const SimTrack& track_;
88  std::vector<unsigned int> getIdsOfSimTrackShower(unsigned trk_id,
89  const edm::SimTrackContainer& simTracks, const edm::SimVertexContainer& simVertices);
90 
91  void matchSimHitsToSimTrack(std::vector<unsigned int> track_ids, const edm::PSimHitContainer& gem_hits);
92 
95  bool verbose_;
97 
101 
102 
104  std::map<unsigned int, unsigned int> trkid_to_index_;
105 
108  std::map<unsigned int, edm::PSimHitContainer > gem_detid_to_hits_;
109  std::map<unsigned int, edm::PSimHitContainer > gem_chamber_to_hits_;
110  std::map<unsigned int, edm::PSimHitContainer > gem_superchamber_to_hits_;
111 
112  // detids with hits in pads
113  std::map<unsigned int, std::set<int> > gem_detids_to_pads_;
114  // detids with hits in 2-layer pad coincidences
115  std::map<unsigned int, std::set<int> > gem_detids_to_copads_;
116 };
117 
118 #endif
std::set< unsigned int > detIdsGEM() const
GEM partitions&#39; detIds with SimHits.
SimHitMatcher(const SimTrack &track, const edm::Event &, const GEMGeometry &geom, const edm::ParameterSet &cfg, edm::EDGetToken &simhitToken, edm::EDGetToken &simtrackToken, edm::EDGetToken &simvertexToken)
const edm::PSimHitContainer & hitsInDetId(unsigned int) const
simhits from a particular partition (GEM)/layer (CSC), chamber or superchamber
float simHitsMeanStrip(const edm::PSimHitContainer &sim_hits) const
calculate average strip (strip for GEM, half-strip for CSC) number for a provided collection of simhi...
int nPadsWithHits() const
How many pads with simhits in GEM did this simtrack get?
edm::Handle< edm::SimTrackContainer > sim_tracks
Definition: SimHitMatcher.h:99
const edm::PSimHitContainer & hitsInChamber(unsigned int) const
std::set< unsigned int > chamberIdsGEM() const
GEM chamber detIds with SimHits.
std::map< unsigned int, edm::PSimHitContainer > gem_chamber_to_hits_
std::vector< unsigned int > getIdsOfSimTrackShower(unsigned trk_id, const edm::SimTrackContainer &simTracks, const edm::SimVertexContainer &simVertices)
std::set< int > hitPartitions() const
std::set< int > hitStripsInDetId(unsigned int, int margin_n_strips=0) const
const edm::PSimHitContainer & simHitsGEM() const
access to all the GEM SimHits
Definition: SimHitMatcher.h:41
const SimTrack & track_
Definition: SimHitMatcher.h:87
edm::PSimHitContainer gem_hits_
const GEMGeometry & gem_geo_
bool discardEleHitsGEM_
Definition: SimHitMatcher.h:94
GlobalPoint simHitsMeanPosition(const edm::PSimHitContainer &sim_hits) const
calculate Global average position for a provided collection of simhits
int nCoincidencePadsWithHits() const
How many coincidence pads with simhits in GEM did this simtrack get?
std::set< int > hitPadsInDetId(unsigned int) const
std::set< unsigned int > superChamberIdsGEMCoincidences() const
GEM superchamber detIds with SimHits 2 layers of coincidence pads.
edm::PSimHitContainer no_hits_
std::map< unsigned int, edm::PSimHitContainer > gem_detid_to_hits_
std::set< unsigned int > detIdsGEMCoincidences() const
edm::Handle< edm::SimVertexContainer > sim_vertices
std::string simInputLabel_
Definition: SimHitMatcher.h:96
std::map< unsigned int, edm::PSimHitContainer > gem_superchamber_to_hits_
void matchSimHitsToSimTrack(std::vector< unsigned int > track_ids, const edm::PSimHitContainer &gem_hits)
edm::Handle< edm::PSimHitContainer > gem_hits
Definition: SimHitMatcher.h:98
std::vector< SimVertex > SimVertexContainer
void init(const edm::Event &)
const edm::PSimHitContainer & hitsInSuperChamber(unsigned int) const
std::set< unsigned int > superChamberIdsGEM() const
GEM superchamber detIds with SimHits.
std::vector< PSimHit > PSimHitContainer
std::map< unsigned int, unsigned int > trkid_to_index_
std::vector< SimTrack > SimTrackContainer
std::set< int > hitCoPadsInDetId(unsigned int) const
std::map< unsigned int, std::set< int > > gem_detids_to_copads_
std::map< unsigned int, std::set< int > > gem_detids_to_pads_
int nLayersWithHitsInSuperChamber(unsigned int) const