CMS 3D CMS Logo

GEMDigiMatcher.h
Go to the documentation of this file.
1 #ifndef Validation_MuonGEMDigis_GEMDigiMatcher_h
2 #define Validation_MuonGEMDigis_GEMDigiMatcher_h
3 
17 
18 #include <vector>
19 #include <map>
20 #include <set>
21 #include <unordered_set>
22 
23 typedef std::vector<GEMDigi> GEMDigiContainer;
24 typedef std::vector<GEMPadDigi> GEMPadDigiContainer;
25 typedef std::vector<GEMPadDigiCluster> GEMPadDigiClusterContainer;
26 typedef std::vector<GEMCoPadDigi> GEMCoPadDigiContainer;
27 
29 public:
30  // constructor
32 
33  // destructor
35 
36  // initialize the event
37  void init(const edm::Event& e, const edm::EventSetup& eventSetup);
38 
39  // do the matching
40  void match(const SimTrack& t, const SimVertex& v);
41 
42  // partition GEM detIds with digis
43  std::set<unsigned int> detIdsDigi(int gem_type = MuonHitHelper::GEM_ALL) const;
44  std::set<unsigned int> detIdsPad(int gem_type = MuonHitHelper::GEM_ALL) const;
45  std::set<unsigned int> detIdsCluster(int gem_type = MuonHitHelper::GEM_ALL) const;
46 
47  // chamber detIds with digis
48  std::set<unsigned int> chamberIdsDigi(int gem_type = MuonHitHelper::GEM_ALL) const;
49  std::set<unsigned int> chamberIdsPad(int gem_type = MuonHitHelper::GEM_ALL) const;
50  std::set<unsigned int> chamberIdsCluster(int gem_type = MuonHitHelper::GEM_ALL) const;
51 
52  // superchamber detIds with digis
53  std::set<unsigned int> superChamberIdsDigi(int gem_type = MuonHitHelper::GEM_ALL) const;
54  std::set<unsigned int> superChamberIdsPad(int gem_type = MuonHitHelper::GEM_ALL) const;
55  std::set<unsigned int> superChamberIdsCluster(int gem_type = MuonHitHelper::GEM_ALL) const;
56  std::set<unsigned int> superChamberIdsCoPad(int gem_type = MuonHitHelper::GEM_ALL) const;
57 
58  // GEM digis from a particular partition, chamber or superchamber
59  const GEMDigiContainer& digisInDetId(unsigned int) const;
60  const GEMDigiContainer& digisInChamber(unsigned int) const;
61  const GEMDigiContainer& digisInSuperChamber(unsigned int) const;
62 
63  // GEM pads from a particular partition, chamber or superchamber
64  const GEMPadDigiContainer& padsInDetId(unsigned int) const;
65  const GEMPadDigiContainer& padsInChamber(unsigned int) const;
66  const GEMPadDigiContainer& padsInSuperChamber(unsigned int) const;
67 
68  // GEM clusters from a particular partition, chamber or superchamber
69  const GEMPadDigiClusterContainer& clustersInDetId(unsigned int) const;
70  const GEMPadDigiClusterContainer& clustersInChamber(unsigned int) const;
71  const GEMPadDigiClusterContainer& clustersInSuperChamber(unsigned int) const;
72 
73  // GEM co-pads from a particular partition or superchamber
74  const GEMCoPadDigiContainer& coPadsInSuperChamber(unsigned int) const;
75 
76  const std::map<unsigned int, GEMPadDigiContainer> allPads() const { return detid_to_pads_; }
77 
78  // #layers with digis from this simtrack
79  int nLayersWithDigisInSuperChamber(unsigned int) const;
80  int nLayersWithPadsInSuperChamber(unsigned int) const;
81 
83  int nPads() const;
84 
86  int nCoPads() const;
87 
88  std::set<int> stripNumbersInDetId(unsigned int) const;
89  std::set<int> padNumbersInDetId(unsigned int) const;
90 
91  int extrapolateHsfromGEMPad(unsigned int, int) const;
92  int extrapolateHsfromGEMStrip(unsigned int, int) const;
93 
94  // what unique partitions numbers with digis from this simtrack?
95  std::set<int> partitionNumbers() const;
96  std::set<int> partitionNumbersWithCoPads() const;
97 
98  GlobalPoint getGlobalPointDigi(unsigned int rawId, const GEMDigi& d) const;
99  GlobalPoint getGlobalPointPad(unsigned int rawId, const GEMPadDigi& tp) const;
100 
101  // get the GEMSimHitMatcher
102  std::shared_ptr<GEMSimHitMatcher> muonSimHitMatcher() { return muonSimHitMatcher_; }
103 
104 private:
109 
114 
119 
120  std::shared_ptr<GEMSimHitMatcher> muonSimHitMatcher_;
121 
124 
125  template <class T>
126  std::set<unsigned int> selectDetIds(const T&, int) const;
127 
132 
134 
139 
140  std::map<unsigned int, GEMDigiContainer> detid_to_digis_;
141  std::map<unsigned int, GEMDigiContainer> chamber_to_digis_;
142  std::map<unsigned int, GEMDigiContainer> superchamber_to_digis_;
143 
144  std::map<unsigned int, GEMPadDigiContainer> detid_to_pads_;
145  std::map<unsigned int, GEMPadDigiContainer> chamber_to_pads_;
146  std::map<unsigned int, GEMPadDigiContainer> superchamber_to_pads_;
147 
148  std::map<unsigned int, GEMPadDigiClusterContainer> detid_to_clusters_;
149  std::map<unsigned int, GEMPadDigiClusterContainer> chamber_to_clusters_;
150  std::map<unsigned int, GEMPadDigiClusterContainer> superchamber_to_clusters_;
151 
152  std::map<unsigned int, GEMCoPadDigiContainer> superchamber_to_copads_;
153 
158 };
159 
160 template <class T>
161 std::set<unsigned int> GEMDigiMatcher::selectDetIds(const T& digis, int gem_type) const {
162  std::set<unsigned int> result;
163  for (const auto& p : digis) {
164  const auto& id = p.first;
165  if (gem_type > 0) {
166  GEMDetId detId(id);
167  if (MuonHitHelper::toGEMType(detId.station(), detId.ring()) != gem_type)
168  continue;
169  }
170  result.insert(p.first);
171  }
172  return result;
173 }
174 
175 #endif
GEMDigiMatcher::GEMDigiMatcher
GEMDigiMatcher(edm::ParameterSet const &iPS, edm::ConsumesCollector &&iC)
Definition: GEMDigiMatcher.cc:5
GEMDigiMatcher::match
void match(const SimTrack &t, const SimVertex &v)
do the matching
Definition: GEMDigiMatcher.cc:53
GEMDigiMatcher::maxBXDigi_
int maxBXDigi_
Definition: GEMDigiMatcher.h:128
GEMDigiMatcher::gemCoPadsH_
edm::Handle< GEMCoPadDigiCollection > gemCoPadsH_
Definition: GEMDigiMatcher.h:118
SimVertex
Definition: SimVertex.h:5
GEMCoPadDigiCollection
GEMDigiMatcher::gemClustersH_
edm::Handle< GEMPadDigiClusterCollection > gemClustersH_
Definition: GEMDigiMatcher.h:117
GEMDetId::ring
constexpr int ring() const
Definition: GEMDetId.h:170
GEMDigiMatcher::superChamberIdsCoPad
std::set< unsigned int > superChamberIdsCoPad(int gem_type=MuonHitHelper::GEM_ALL) const
Definition: GEMDigiMatcher.cc:250
MuonHitHelper::toGEMType
static int toGEMType(int st, int ri)
Definition: MuonHitHelper.cc:49
GEMDigiMatcher::muonSimHitMatcher
std::shared_ptr< GEMSimHitMatcher > muonSimHitMatcher()
Definition: GEMDigiMatcher.h:102
GEMPadDigi
Definition: GEMPadDigi.h:15
GEMDigiMatcher::chamberIdsDigi
std::set< unsigned int > chamberIdsDigi(int gem_type=MuonHitHelper::GEM_ALL) const
Definition: GEMDigiMatcher.cc:226
GEMDigiMatcher::init
void init(const edm::Event &e, const edm::EventSetup &eventSetup)
Definition: GEMDigiMatcher.cc:36
GEMDigiMatcher::nCoPads
int nCoPads() const
How many coincidence pads in GEM did this simtrack get in total?
Definition: GEMDigiMatcher.cc:353
edm::EDGetTokenT< GEMDigiCollection >
GEMDigiMatcher::extrapolateHsfromGEMPad
int extrapolateHsfromGEMPad(unsigned int, int) const
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
GEMDigiMatcher::gemDigiToken_
edm::EDGetTokenT< GEMDigiCollection > gemDigiToken_
Definition: GEMDigiMatcher.h:110
GEMDigiMatcher::digisInChamber
const GEMDigiContainer & digisInChamber(unsigned int) const
Definition: GEMDigiMatcher.cc:260
GEMDigiMatcher::matchDigisToSimTrack
void matchDigisToSimTrack(const GEMDigiCollection &)
Definition: GEMDigiMatcher.cc:70
GEMDigiMatcher::digisInSuperChamber
const GEMDigiContainer & digisInSuperChamber(unsigned int) const
Definition: GEMDigiMatcher.cc:266
GEMCoPadDigiContainer
std::vector< GEMCoPadDigi > GEMCoPadDigiContainer
Definition: GEMDigiMatcher.h:26
GEMPadDigiClusterContainer
std::vector< GEMPadDigiCluster > GEMPadDigiClusterContainer
Definition: GEMDigiMatcher.h:25
GEMDigiMatcher
Definition: GEMDigiMatcher.h:28
GEMCoPadDigiCollection.h
GEMDigiMatcher::gemGeometry_
const GEMGeometry * gemGeometry_
Definition: GEMDigiMatcher.h:123
GEMDigiMatcher::padsInChamber
const GEMPadDigiContainer & padsInChamber(unsigned int) const
Definition: GEMDigiMatcher.cc:278
GEMDigiMatcher::chamber_to_digis_
std::map< unsigned int, GEMDigiContainer > chamber_to_digis_
Definition: GEMDigiMatcher.h:141
GEMDigiContainer
std::vector< GEMDigi > GEMDigiContainer
Definition: GEMDigiMatcher.h:23
GEMDigiMatcher::chamber_to_clusters_
std::map< unsigned int, GEMPadDigiClusterContainer > chamber_to_clusters_
Definition: GEMDigiMatcher.h:149
GEMDigiMatcher::partitionNumbers
std::set< int > partitionNumbers() const
Definition: GEMDigiMatcher.cc:380
GEMDigiMatcher::verboseDigi_
bool verboseDigi_
Definition: GEMDigiMatcher.h:135
findQualityFiles.v
v
Definition: findQualityFiles.py:179
GEMDigiMatcher::matchCoPadsToSimTrack
void matchCoPadsToSimTrack(const GEMCoPadDigiCollection &)
Definition: GEMDigiMatcher.cc:168
edm::Handle< GEMDigiCollection >
GEMDigiMatcher::matchDeltaStrip_
int matchDeltaStrip_
Definition: GEMDigiMatcher.h:133
GEMDigiMatcher::matchPadsToSimTrack
void matchPadsToSimTrack(const GEMPadDigiCollection &)
Definition: GEMDigiMatcher.cc:104
GEMDigiMatcher::superchamber_to_clusters_
std::map< unsigned int, GEMPadDigiClusterContainer > superchamber_to_clusters_
Definition: GEMDigiMatcher.h:150
GEMSimHitMatcher.h
GEMDigiMatcher::minBXPad_
int minBXPad_
Definition: GEMDigiMatcher.h:129
GEMPadDigiClusterCollection.h
GEMDigiMatcher::maxBXPad_
int maxBXPad_
Definition: GEMDigiMatcher.h:129
GEMDigiMatcher::no_gem_copads_
GEMCoPadDigiContainer no_gem_copads_
Definition: GEMDigiMatcher.h:157
GEMDigiMatcher::superchamber_to_pads_
std::map< unsigned int, GEMPadDigiContainer > superchamber_to_pads_
Definition: GEMDigiMatcher.h:146
GEMDigiMatcher::minBXCluster_
int minBXCluster_
Definition: GEMDigiMatcher.h:130
GEMDigiMatcher::maxBXCoPad_
int maxBXCoPad_
Definition: GEMDigiMatcher.h:131
GEMDigiMatcher::detid_to_clusters_
std::map< unsigned int, GEMPadDigiClusterContainer > detid_to_clusters_
Definition: GEMDigiMatcher.h:148
GEMDigiMatcher::minBXCoPad_
int minBXCoPad_
Definition: GEMDigiMatcher.h:131
GEMDigiMatcher::extrapolateHsfromGEMStrip
int extrapolateHsfromGEMStrip(unsigned int, int) const
GEMDigiMatcher::allPads
const std::map< unsigned int, GEMPadDigiContainer > allPads() const
Definition: GEMDigiMatcher.h:76
GEMDigiMatcher::verboseCoPad_
bool verboseCoPad_
Definition: GEMDigiMatcher.h:138
GEMDigiMatcher::selectDetIds
std::set< unsigned int > selectDetIds(const T &, int) const
Definition: GEMDigiMatcher.h:161
edm::ESHandle< GEMGeometry >
GEMPadDigiCollection
GEMDigiMatcher::clustersInChamber
const GEMPadDigiClusterContainer & clustersInChamber(unsigned int) const
Definition: GEMDigiMatcher.cc:296
GEMDigiMatcher::digisInDetId
const GEMDigiContainer & digisInDetId(unsigned int) const
Definition: GEMDigiMatcher.cc:254
GEMDigiMatcher::no_gem_pads_
GEMPadDigiContainer no_gem_pads_
Definition: GEMDigiMatcher.h:155
GEMDigiMatcher::gemDigisH_
edm::Handle< GEMDigiCollection > gemDigisH_
Definition: GEMDigiMatcher.h:115
Point3DBase< float, GlobalTag >
GEMPadDigiClusterCollection
GEMPadDigiContainer
std::vector< GEMPadDigi > GEMPadDigiContainer
Definition: GEMDigiMatcher.h:24
OrderedSet.t
t
Definition: OrderedSet.py:90
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
GEMDigiMatcher::padNumbersInDetId
std::set< int > padNumbersInDetId(unsigned int) const
Definition: GEMDigiMatcher.cc:371
GEMDigiMatcher::detIdsCluster
std::set< unsigned int > detIdsCluster(int gem_type=MuonHitHelper::GEM_ALL) const
Definition: GEMDigiMatcher.cc:222
GEMDigiMatcher::partitionNumbersWithCoPads
std::set< int > partitionNumbersWithCoPads() const
Definition: GEMDigiMatcher.cc:391
GEMDigiMatcher::matchClustersToSimTrack
void matchClustersToSimTrack(const GEMPadDigiClusterCollection &)
Definition: GEMDigiMatcher.cc:141
GEMDigiMatcher::gemClusterToken_
edm::EDGetTokenT< GEMPadDigiClusterCollection > gemClusterToken_
Definition: GEMDigiMatcher.h:112
GEMDigiMatcher::~GEMDigiMatcher
~GEMDigiMatcher()
Definition: GEMDigiMatcher.h:34
GEMDigiMatcher::verboseCluster_
bool verboseCluster_
Definition: GEMDigiMatcher.h:137
GEMDigiMatcher::gemCoPadToken_
edm::EDGetTokenT< GEMCoPadDigiCollection > gemCoPadToken_
Definition: GEMDigiMatcher.h:113
GEMDigiMatcher::superChamberIdsPad
std::set< unsigned int > superChamberIdsPad(int gem_type=MuonHitHelper::GEM_ALL) const
Definition: GEMDigiMatcher.cc:242
GEMDigiMatcher::gemPadsH_
edm::Handle< GEMPadDigiCollection > gemPadsH_
Definition: GEMDigiMatcher.h:116
edm::ParameterSet
Definition: ParameterSet.h:36
GEMDigiMatcher::minBXDigi_
int minBXDigi_
Definition: GEMDigiMatcher.h:128
GEMDigiMatcher::no_gem_clusters_
GEMPadDigiClusterContainer no_gem_clusters_
Definition: GEMDigiMatcher.h:156
GEMDetId
Definition: GEMDetId.h:17
GEMDigiMatcher::chamberIdsCluster
std::set< unsigned int > chamberIdsCluster(int gem_type=MuonHitHelper::GEM_ALL) const
Definition: GEMDigiMatcher.cc:234
GEMDigiMatcher::nLayersWithDigisInSuperChamber
int nLayersWithDigisInSuperChamber(unsigned int) const
Definition: GEMDigiMatcher.cc:314
GEMDigi
Definition: GEMDigi.h:15
GEMDigiMatcher::detIdsPad
std::set< unsigned int > detIdsPad(int gem_type=MuonHitHelper::GEM_ALL) const
Definition: GEMDigiMatcher.cc:220
edm::EventSetup
Definition: EventSetup.h:57
GEMDigiMatcher::chamber_to_pads_
std::map< unsigned int, GEMPadDigiContainer > chamber_to_pads_
Definition: GEMDigiMatcher.h:145
GEMDigiMatcher::maxBXCluster_
int maxBXCluster_
Definition: GEMDigiMatcher.h:130
GEMDigiMatcher::chamberIdsPad
std::set< unsigned int > chamberIdsPad(int gem_type=MuonHitHelper::GEM_ALL) const
Definition: GEMDigiMatcher.cc:230
GEMDigiMatcher::gem_geom_
edm::ESHandle< GEMGeometry > gem_geom_
Definition: GEMDigiMatcher.h:122
GEMGeometry.h
GEMDigiMatcher::coPadsInSuperChamber
const GEMCoPadDigiContainer & coPadsInSuperChamber(unsigned int) const
Definition: GEMDigiMatcher.cc:308
GEMDigiMatcher::detIdsDigi
std::set< unsigned int > detIdsDigi(int gem_type=MuonHitHelper::GEM_ALL) const
Definition: GEMDigiMatcher.cc:216
SimTrack
Definition: SimTrack.h:6
GEMDigiMatcher::nLayersWithPadsInSuperChamber
int nLayersWithPadsInSuperChamber(unsigned int) const
Definition: GEMDigiMatcher.cc:329
T
long double T
Definition: Basic3DVectorLD.h:48
GEMDigiMatcher::detid_to_digis_
std::map< unsigned int, GEMDigiContainer > detid_to_digis_
Definition: GEMDigiMatcher.h:140
GEMDigiMatcher::clustersInSuperChamber
const GEMPadDigiClusterContainer & clustersInSuperChamber(unsigned int) const
Definition: GEMDigiMatcher.cc:302
GEMDigiCollection
GEMDigiMatcher::detid_to_pads_
std::map< unsigned int, GEMPadDigiContainer > detid_to_pads_
Definition: GEMDigiMatcher.h:144
GEMPadDigiCollection.h
GEMDigiMatcher::stripNumbersInDetId
std::set< int > stripNumbersInDetId(unsigned int) const
Definition: GEMDigiMatcher.cc:362
GEMDigiCollection.h
GEMDigiMatcher::gemPadToken_
edm::EDGetTokenT< GEMPadDigiCollection > gemPadToken_
Definition: GEMDigiMatcher.h:111
GEMDigiMatcher::getGlobalPointPad
GlobalPoint getGlobalPointPad(unsigned int rawId, const GEMPadDigi &tp) const
Definition: GEMDigiMatcher.cc:409
GEMDigiMatcher::muonSimHitMatcher_
std::shared_ptr< GEMSimHitMatcher > muonSimHitMatcher_
Definition: GEMDigiMatcher.h:120
GEMDetId::station
constexpr int station() const
Definition: GEMDetId.h:173
MuonHitHelper::GEM_ALL
Definition: MuonHitHelper.h:30
GEMGeometry
Definition: GEMGeometry.h:24
ztail.d
d
Definition: ztail.py:151
mps_fire.result
result
Definition: mps_fire.py:303
GEMDigiMatcher::getGlobalPointDigi
GlobalPoint getGlobalPointDigi(unsigned int rawId, const GEMDigi &d) const
Definition: GEMDigiMatcher.cc:402
GEMDigiMatcher::nPads
int nPads() const
How many pads in GEM did this simtrack get in total?
Definition: GEMDigiMatcher.cc:344
GEMDigiMatcher::superChamberIdsDigi
std::set< unsigned int > superChamberIdsDigi(int gem_type=MuonHitHelper::GEM_ALL) const
Definition: GEMDigiMatcher.cc:238
edm::Event
Definition: Event.h:73
GEMDigiMatcher::superChamberIdsCluster
std::set< unsigned int > superChamberIdsCluster(int gem_type=MuonHitHelper::GEM_ALL) const
Definition: GEMDigiMatcher.cc:246
GEMDigiMatcher::superchamber_to_copads_
std::map< unsigned int, GEMCoPadDigiContainer > superchamber_to_copads_
Definition: GEMDigiMatcher.h:152
GEMDigiMatcher::padsInSuperChamber
const GEMPadDigiContainer & padsInSuperChamber(unsigned int) const
Definition: GEMDigiMatcher.cc:284
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
GEMDigiMatcher::clustersInDetId
const GEMPadDigiClusterContainer & clustersInDetId(unsigned int) const
Definition: GEMDigiMatcher.cc:290
GEMDigiMatcher::no_gem_digis_
GEMDigiContainer no_gem_digis_
Definition: GEMDigiMatcher.h:154
GEMDigiMatcher::superchamber_to_digis_
std::map< unsigned int, GEMDigiContainer > superchamber_to_digis_
Definition: GEMDigiMatcher.h:142
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
GEMDigiMatcher::verbosePad_
bool verbosePad_
Definition: GEMDigiMatcher.h:136
GEMDigiMatcher::padsInDetId
const GEMPadDigiContainer & padsInDetId(unsigned int) const
Definition: GEMDigiMatcher.cc:272