CMS 3D CMS Logo

CSCDigiMatcher.h
Go to the documentation of this file.
1 #ifndef Validation_MuonCSCDigis_CSCDigiMatcher_h
2 #define Validation_MuonCSCDigis_CSCDigiMatcher_h
3 
16 
17 typedef std::vector<CSCComparatorDigi> CSCComparatorDigiContainer;
18 typedef std::vector<CSCStripDigi> CSCStripDigiContainer;
19 typedef std::vector<CSCWireDigi> CSCWireDigiContainer;
20 
21 typedef std::vector<std::pair<unsigned int, CSCComparatorDigi> > CSCComparatorDigiDetIdContainer;
22 typedef std::vector<std::pair<unsigned int, CSCStripDigi> > CSCStripDigiDetIdContainer;
23 typedef std::vector<std::pair<unsigned int, CSCWireDigi> > CSCWireDigiDetIdContainer;
24 
26 public:
27  // constructor
29 
30  // destructor
32 
33  // initialize the event
34  void init(const edm::Event& e, const edm::EventSetup& eventSetup);
35 
36  // do the matching
37  void match(const SimTrack& t, const SimVertex& v);
38 
39  // layer detIds with digis
40  std::set<unsigned int> detIdsComparator(int csc_type = MuonHitHelper::CSC_ALL) const;
41  std::set<unsigned int> detIdsStrip(int csc_type = MuonHitHelper::CSC_ALL) const;
42  std::set<unsigned int> detIdsWire(int csc_type = MuonHitHelper::CSC_ALL) const;
43 
44  // chamber detIds with digis
45  std::set<unsigned int> chamberIdsComparator(int csc_type = MuonHitHelper::CSC_ALL) const;
46  std::set<unsigned int> chamberIdsStrip(int csc_type = MuonHitHelper::CSC_ALL) const;
47  std::set<unsigned int> chamberIdsWire(int csc_type = MuonHitHelper::CSC_ALL) const;
48 
49  // CSC strip digis from a particular layer or chamber
50  const CSCComparatorDigiContainer& comparatorDigisInDetId(unsigned int) const;
51  const CSCComparatorDigiContainer& comparatorDigisInChamber(unsigned int) const;
52 
53  // CSC strip digis from a particular layer or chamber
54  const CSCStripDigiContainer& stripDigisInDetId(unsigned int) const;
55  const CSCStripDigiContainer& stripDigisInChamber(unsigned int) const;
56 
57  // CSC wire digis from a particular layer or chamber
58  const CSCWireDigiContainer& wireDigisInDetId(unsigned int) const;
59  const CSCWireDigiContainer& wireDigisInChamber(unsigned int) const;
60 
61  // #layers with hits
62  int nLayersWithComparatorInChamber(unsigned int) const;
63  int nLayersWithStripInChamber(unsigned int) const;
64  int nLayersWithWireInChamber(unsigned int) const;
65 
66  // How many CSC chambers with minimum number of layer with digis did this simtrack get?
67  int nCoincidenceComparatorChambers(int min_n_layers = 4) const;
68  int nCoincidenceStripChambers(int min_n_layers = 4) const;
69  int nCoincidenceWireChambers(int min_n_layers = 4) const;
70 
71  std::set<int> comparatorsInDetId(unsigned int) const;
72  std::set<int> stripsInDetId(unsigned int) const;
73  std::set<int> wiregroupsInDetId(unsigned int) const;
74 
75  // A non-zero max_gap_to_fill parameter would insert extra half-strips or wiregroups
76  // so that gaps of that size or smaller would be filled.
77  // E.g., if max_gap_to_fill = 1, and there are digis with strips 4 and 6 in a chamber,
78  // the resulting set of digis would be 4,5,6
79  std::set<int> comparatorsInChamber(unsigned int, int max_gap_to_fill = 0) const;
80  std::set<int> stripsInChamber(unsigned int, int max_gap_to_fill = 0) const;
81  std::set<int> wiregroupsInChamber(unsigned int, int max_gap_to_fill = 0) const;
82 
83  std::shared_ptr<CSCSimHitMatcher> muonSimHitMatcher() const { return muonSimHitMatcher_; }
84 
85 private:
86  // match simtracks to digis
90 
91  void clear();
92 
93  template <class T>
94  std::set<unsigned int> selectDetIds(const T& digis, int csc_type) const;
95 
99 
103 
104  std::shared_ptr<CSCSimHitMatcher> muonSimHitMatcher_;
105 
109 
113 
117 
118  std::map<unsigned int, CSCComparatorDigiContainer> detid_to_comparators_;
119  std::map<unsigned int, CSCComparatorDigiContainer> chamber_to_comparators_;
120 
121  std::map<unsigned int, CSCStripDigiContainer> detid_to_strips_;
122  std::map<unsigned int, CSCStripDigiContainer> chamber_to_strips_;
123 
124  std::map<unsigned int, CSCWireDigiContainer> detid_to_wires_;
125  std::map<unsigned int, CSCWireDigiContainer> chamber_to_wires_;
126 
130 };
131 
132 template <class T>
133 std::set<unsigned int> CSCDigiMatcher::selectDetIds(const T& digis, int csc_type) const {
134  std::set<unsigned int> result;
135  for (const auto& p : digis) {
136  const auto& id = p.first;
137  if (csc_type > 0) {
138  CSCDetId detId(id);
139  if (MuonHitHelper::toCSCType(detId.station(), detId.ring()) != csc_type)
140  continue;
141  }
142  result.insert(p.first);
143  }
144  return result;
145 }
146 
147 #endif
CSCDigiMatcher::detid_to_strips_
std::map< unsigned int, CSCStripDigiContainer > detid_to_strips_
Definition: CSCDigiMatcher.h:121
CSCDigiMatcher::maxBXComparator_
int maxBXComparator_
Definition: CSCDigiMatcher.h:106
CSCDigiMatcher::nCoincidenceStripChambers
int nCoincidenceStripChambers(int min_n_layers=4) const
Definition: CSCDigiMatcher.cc:273
CSCDigiMatcher::detid_to_comparators_
std::map< unsigned int, CSCComparatorDigiContainer > detid_to_comparators_
Definition: CSCDigiMatcher.h:118
CSCDigiMatcher::verboseStrip_
int verboseStrip_
Definition: CSCDigiMatcher.h:115
CSCDigiMatcher::wireDigisInChamber
const CSCWireDigiContainer & wireDigisInChamber(unsigned int) const
Definition: CSCDigiMatcher.cc:221
SimVertex
Definition: SimVertex.h:5
edm::EDGetTokenT< CSCComparatorDigiCollection >
CSCDigiMatcher::chamber_to_strips_
std::map< unsigned int, CSCStripDigiContainer > chamber_to_strips_
Definition: CSCDigiMatcher.h:122
CSCDetId::ring
int ring() const
Definition: CSCDetId.h:68
CSCDigiMatcher::no_comparators_
CSCComparatorDigiContainer no_comparators_
Definition: CSCDigiMatcher.h:127
DigiDM_cff.wires
wires
Definition: DigiDM_cff.py:33
CSCDigiMatcher::clear
void clear()
Definition: CSCDigiMatcher.cc:379
CSCStripDigiCollection
CSCDigiMatcher::minBXStrip_
int minBXStrip_
Definition: CSCDigiMatcher.h:107
CSCDigiMatcher::muonSimHitMatcher
std::shared_ptr< CSCSimHitMatcher > muonSimHitMatcher() const
Definition: CSCDigiMatcher.h:83
CSCDigiMatcher::matchComparatorsToSimTrack
void matchComparatorsToSimTrack(const CSCComparatorDigiCollection &comparators)
Definition: CSCDigiMatcher.cc:59
CSCDigiMatcher::stripDigiInput_
edm::EDGetTokenT< CSCStripDigiCollection > stripDigiInput_
Definition: CSCDigiMatcher.h:97
CSCDigiMatcher::muonSimHitMatcher_
std::shared_ptr< CSCSimHitMatcher > muonSimHitMatcher_
Definition: CSCDigiMatcher.h:104
MuonHitHelper::CSC_ALL
Definition: MuonHitHelper.h:15
CSCDigiMatcher::detid_to_wires_
std::map< unsigned int, CSCWireDigiContainer > detid_to_wires_
Definition: CSCDigiMatcher.h:124
CSCDigiMatcher::minBXWire_
int minBXWire_
Definition: CSCDigiMatcher.h:108
findQualityFiles.v
v
Definition: findQualityFiles.py:179
edm::Handle< CSCComparatorDigiCollection >
CSCDigiMatcher::comparatorsInChamber
std::set< int > comparatorsInChamber(unsigned int, int max_gap_to_fill=0) const
Definition: CSCDigiMatcher.cc:320
CSCDigiMatcher::stripDigisH_
edm::Handle< CSCStripDigiCollection > stripDigisH_
Definition: CSCDigiMatcher.h:101
CSCDigiMatcher::wireDigisInDetId
const CSCWireDigiContainer & wireDigisInDetId(unsigned int) const
Definition: CSCDigiMatcher.cc:215
CSCDigiMatcher::maxBXStrip_
int maxBXStrip_
Definition: CSCDigiMatcher.h:107
CSCDigiMatcher::chamberIdsStrip
std::set< unsigned int > chamberIdsStrip(int csc_type=MuonHitHelper::CSC_ALL) const
Definition: CSCDigiMatcher.cc:183
CSCDigiMatcher::matchDeltaWG_
int matchDeltaWG_
Definition: CSCDigiMatcher.h:112
CSCDigiMatcher::chamberIdsWire
std::set< unsigned int > chamberIdsWire(int csc_type=MuonHitHelper::CSC_ALL) const
Definition: CSCDigiMatcher.cc:187
CSCDigiMatcher::nLayersWithStripInChamber
int nLayersWithStripInChamber(unsigned int) const
Definition: CSCDigiMatcher.cc:239
CSCDigiMatcher::verboseComparator_
int verboseComparator_
Definition: CSCDigiMatcher.h:114
CSCDigiMatcher::nLayersWithWireInChamber
int nLayersWithWireInChamber(unsigned int) const
Definition: CSCDigiMatcher.cc:251
CSCDigiMatcher::comparatorDigisH_
edm::Handle< CSCComparatorDigiCollection > comparatorDigisH_
Definition: CSCDigiMatcher.h:100
CSCDigiMatcher::chamber_to_wires_
std::map< unsigned int, CSCWireDigiContainer > chamber_to_wires_
Definition: CSCDigiMatcher.h:125
CSCDigiMatcher::verboseWG_
int verboseWG_
Definition: CSCDigiMatcher.h:116
CSCDigiMatcher::stripDigisInDetId
const CSCStripDigiContainer & stripDigisInDetId(unsigned int) const
Definition: CSCDigiMatcher.cc:203
CSCDigiMatcher::stripsInChamber
std::set< int > stripsInChamber(unsigned int, int max_gap_to_fill=0) const
Definition: CSCDigiMatcher.cc:340
CSCDigiMatcher::chamber_to_comparators_
std::map< unsigned int, CSCComparatorDigiContainer > chamber_to_comparators_
Definition: CSCDigiMatcher.h:119
CSCDigiMatcher::nCoincidenceWireChambers
int nCoincidenceWireChambers(int min_n_layers=4) const
Definition: CSCDigiMatcher.cc:283
CSCDigiMatcher
Definition: CSCDigiMatcher.h:25
CSCComparatorDigiContainer
std::vector< CSCComparatorDigi > CSCComparatorDigiContainer
Definition: CSCDigiMatcher.h:17
CSCDigiMatcher::selectDetIds
std::set< unsigned int > selectDetIds(const T &digis, int csc_type) const
Definition: CSCDigiMatcher.h:133
CSCDigiMatcher::match
void match(const SimTrack &t, const SimVertex &v)
do the matching
Definition: CSCDigiMatcher.cc:42
CSCWireDigiContainer
std::vector< CSCWireDigi > CSCWireDigiContainer
Definition: CSCDigiMatcher.h:19
CSCDigiMatcher::stripDigisInChamber
const CSCStripDigiContainer & stripDigisInChamber(unsigned int) const
Definition: CSCDigiMatcher.cc:209
CSCStripDigiContainer
std::vector< CSCStripDigi > CSCStripDigiContainer
Definition: CSCDigiMatcher.h:18
edm::ParameterSet
Definition: ParameterSet.h:47
CSCDigiMatcher::minBXComparator_
int minBXComparator_
Definition: CSCDigiMatcher.h:106
CSCDigiMatcher::nCoincidenceComparatorChambers
int nCoincidenceComparatorChambers(int min_n_layers=4) const
Definition: CSCDigiMatcher.cc:263
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CSCDigiMatcher::matchWiresToSimTrack
void matchWiresToSimTrack(const CSCWireDigiCollection &wires)
Definition: CSCDigiMatcher.cc:133
CSCDetId
Definition: CSCDetId.h:26
CSCDigiMatcher::comparatorsInDetId
std::set< int > comparatorsInDetId(unsigned int) const
Definition: CSCDigiMatcher.cc:293
CSCDigiMatcher::wireDigiInput_
edm::EDGetTokenT< CSCWireDigiCollection > wireDigiInput_
Definition: CSCDigiMatcher.h:98
CSCDigiMatcher::wireDigisH_
edm::Handle< CSCWireDigiCollection > wireDigisH_
Definition: CSCDigiMatcher.h:102
CSCDigiMatcher::CSCDigiMatcher
CSCDigiMatcher(edm::ParameterSet const &iPS, edm::ConsumesCollector &&iC)
Definition: CSCDigiMatcher.cc:5
CSCDigiMatcher::comparatorDigisInDetId
const CSCComparatorDigiContainer & comparatorDigisInDetId(unsigned int) const
Definition: CSCDigiMatcher.cc:191
CSCDigiMatcher::comparatorDigiInput_
edm::EDGetTokenT< CSCComparatorDigiCollection > comparatorDigiInput_
Definition: CSCDigiMatcher.h:96
CSCDigiMatcher::stripsInDetId
std::set< int > stripsInDetId(unsigned int) const
Definition: CSCDigiMatcher.cc:302
CSCStripDigiCollection.h
CSCComparatorDigiCollection
edm::EventSetup
Definition: EventSetup.h:58
CSCSimHitMatcher.h
CSCDigiMatcher::comparatorDigisInChamber
const CSCComparatorDigiContainer & comparatorDigisInChamber(unsigned int) const
Definition: CSCDigiMatcher.cc:197
CSCDigiMatcher::wiregroupsInChamber
std::set< int > wiregroupsInChamber(unsigned int, int max_gap_to_fill=0) const
Definition: CSCDigiMatcher.cc:360
CSCDigiMatcher::detIdsWire
std::set< unsigned int > detIdsWire(int csc_type=MuonHitHelper::CSC_ALL) const
Definition: CSCDigiMatcher.cc:175
CSCWireDigiCollection
CSCDigiMatcher::detIdsComparator
std::set< unsigned int > detIdsComparator(int csc_type=MuonHitHelper::CSC_ALL) const
Definition: CSCDigiMatcher.cc:167
CSCDigiMatcher::detIdsStrip
std::set< unsigned int > detIdsStrip(int csc_type=MuonHitHelper::CSC_ALL) const
Definition: CSCDigiMatcher.cc:171
SimTrack
Definition: SimTrack.h:9
T
long double T
Definition: Basic3DVectorLD.h:48
CSCDigiMatcher::wiregroupsInDetId
std::set< int > wiregroupsInDetId(unsigned int) const
Definition: CSCDigiMatcher.cc:311
CSCComparatorDigiDetIdContainer
std::vector< std::pair< unsigned int, CSCComparatorDigi > > CSCComparatorDigiDetIdContainer
Definition: CSCDigiMatcher.h:21
CSCDigiMatcher::no_wires_
CSCWireDigiContainer no_wires_
Definition: CSCDigiMatcher.h:129
CSCComparatorDigiCollection.h
CSCDigiMatcher::matchStripsToSimTrack
void matchStripsToSimTrack(const CSCStripDigiCollection &strips)
Definition: CSCDigiMatcher.cc:93
CSCDigiMatcher::matchDeltaComparator_
int matchDeltaComparator_
Definition: CSCDigiMatcher.h:110
CSCWireDigiCollection.h
CSCWireDigiDetIdContainer
std::vector< std::pair< unsigned int, CSCWireDigi > > CSCWireDigiDetIdContainer
Definition: CSCDigiMatcher.h:23
mps_fire.result
result
Definition: mps_fire.py:311
CSCDetId::station
int station() const
Definition: CSCDetId.h:79
CSCDigiMatcher::nLayersWithComparatorInChamber
int nLayersWithComparatorInChamber(unsigned int) const
Definition: CSCDigiMatcher.cc:227
CSCDigiMatcher::maxBXWire_
int maxBXWire_
Definition: CSCDigiMatcher.h:108
MuonHitHelper::toCSCType
static int toCSCType(int st, int ri)
Definition: MuonHitHelper.cc:195
edm::Event
Definition: Event.h:73
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
CSCDigiMatcher::no_strips_
CSCStripDigiContainer no_strips_
Definition: CSCDigiMatcher.h:128
CSCStripDigiDetIdContainer
std::vector< std::pair< unsigned int, CSCStripDigi > > CSCStripDigiDetIdContainer
Definition: CSCDigiMatcher.h:22
DigiDM_cff.strips
strips
#turn off noise in all subdetectors simHcalUnsuppressedDigis.doNoise = False mix.digitizers....
Definition: DigiDM_cff.py:32
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
CSCDigiMatcher::chamberIdsComparator
std::set< unsigned int > chamberIdsComparator(int csc_type=MuonHitHelper::CSC_ALL) const
Definition: CSCDigiMatcher.cc:179
CSCDigiMatcher::matchDeltaStrip_
int matchDeltaStrip_
Definition: CSCDigiMatcher.h:111
CSCGeometry.h
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
CSCDigiMatcher::~CSCDigiMatcher
~CSCDigiMatcher()
Definition: CSCDigiMatcher.h:31
CSCDigiMatcher::init
void init(const edm::Event &e, const edm::EventSetup &eventSetup)
Definition: CSCDigiMatcher.cc:33