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  template <class T>
92  std::set<unsigned int> selectDetIds(const T& digis, int csc_type) const;
93 
97 
101 
102  std::shared_ptr<CSCSimHitMatcher> muonSimHitMatcher_;
103 
107 
111 
115 
116  std::map<unsigned int, CSCComparatorDigiContainer> detid_to_comparators_;
117  std::map<unsigned int, CSCComparatorDigiContainer> chamber_to_comparators_;
118 
119  std::map<unsigned int, CSCStripDigiContainer> detid_to_strips_;
120  std::map<unsigned int, CSCStripDigiContainer> chamber_to_strips_;
121 
122  std::map<unsigned int, CSCWireDigiContainer> detid_to_wires_;
123  std::map<unsigned int, CSCWireDigiContainer> chamber_to_wires_;
124 
128 };
129 
130 template <class T>
131 std::set<unsigned int> CSCDigiMatcher::selectDetIds(const T& digis, int csc_type) const {
132  std::set<unsigned int> result;
133  for (const auto& p : digis) {
134  const auto& id = p.first;
135  if (csc_type > 0) {
136  CSCDetId detId(id);
137  if (MuonHitHelper::toCSCType(detId.station(), detId.ring()) != csc_type)
138  continue;
139  }
140  result.insert(p.first);
141  }
142  return result;
143 }
144 
145 #endif
CSCDigiMatcher::detid_to_strips_
std::map< unsigned int, CSCStripDigiContainer > detid_to_strips_
Definition: CSCDigiMatcher.h:119
CSCDigiMatcher::maxBXComparator_
int maxBXComparator_
Definition: CSCDigiMatcher.h:104
CSCDigiMatcher::nCoincidenceStripChambers
int nCoincidenceStripChambers(int min_n_layers=4) const
Definition: CSCDigiMatcher.cc:278
CSCDigiMatcher::detid_to_comparators_
std::map< unsigned int, CSCComparatorDigiContainer > detid_to_comparators_
Definition: CSCDigiMatcher.h:116
CSCDigiMatcher::verboseStrip_
int verboseStrip_
Definition: CSCDigiMatcher.h:113
CSCDigiMatcher::wireDigisInChamber
const CSCWireDigiContainer & wireDigisInChamber(unsigned int) const
Definition: CSCDigiMatcher.cc:226
SimVertex
Definition: SimVertex.h:5
edm::EDGetTokenT< CSCComparatorDigiCollection >
CSCDigiMatcher::chamber_to_strips_
std::map< unsigned int, CSCStripDigiContainer > chamber_to_strips_
Definition: CSCDigiMatcher.h:120
CSCDetId::ring
int ring() const
Definition: CSCDetId.h:68
CSCDigiMatcher::no_comparators_
CSCComparatorDigiContainer no_comparators_
Definition: CSCDigiMatcher.h:125
DigiDM_cff.wires
wires
Definition: DigiDM_cff.py:33
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CSCStripDigiCollection
CSCDigiMatcher::minBXStrip_
int minBXStrip_
Definition: CSCDigiMatcher.h:105
CSCDigiMatcher::muonSimHitMatcher
std::shared_ptr< CSCSimHitMatcher > muonSimHitMatcher() const
Definition: CSCDigiMatcher.h:83
CSCDigiMatcher::matchComparatorsToSimTrack
void matchComparatorsToSimTrack(const CSCComparatorDigiCollection &comparators)
Definition: CSCDigiMatcher.cc:57
CSCDigiMatcher::stripDigiInput_
edm::EDGetTokenT< CSCStripDigiCollection > stripDigiInput_
Definition: CSCDigiMatcher.h:95
CSCDigiMatcher::muonSimHitMatcher_
std::shared_ptr< CSCSimHitMatcher > muonSimHitMatcher_
Definition: CSCDigiMatcher.h:102
MuonHitHelper::CSC_ALL
Definition: MuonHitHelper.h:15
CSCDigiMatcher::detid_to_wires_
std::map< unsigned int, CSCWireDigiContainer > detid_to_wires_
Definition: CSCDigiMatcher.h:122
CSCDigiMatcher::minBXWire_
int minBXWire_
Definition: CSCDigiMatcher.h:106
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:325
CSCDigiMatcher::stripDigisH_
edm::Handle< CSCStripDigiCollection > stripDigisH_
Definition: CSCDigiMatcher.h:99
CSCDigiMatcher::wireDigisInDetId
const CSCWireDigiContainer & wireDigisInDetId(unsigned int) const
Definition: CSCDigiMatcher.cc:220
CSCDigiMatcher::maxBXStrip_
int maxBXStrip_
Definition: CSCDigiMatcher.h:105
CSCDigiMatcher::chamberIdsStrip
std::set< unsigned int > chamberIdsStrip(int csc_type=MuonHitHelper::CSC_ALL) const
Definition: CSCDigiMatcher.cc:188
CSCDigiMatcher::matchDeltaWG_
int matchDeltaWG_
Definition: CSCDigiMatcher.h:110
CSCDigiMatcher::chamberIdsWire
std::set< unsigned int > chamberIdsWire(int csc_type=MuonHitHelper::CSC_ALL) const
Definition: CSCDigiMatcher.cc:192
CSCDigiMatcher::nLayersWithStripInChamber
int nLayersWithStripInChamber(unsigned int) const
Definition: CSCDigiMatcher.cc:244
CSCDigiMatcher::verboseComparator_
int verboseComparator_
Definition: CSCDigiMatcher.h:112
CSCDigiMatcher::nLayersWithWireInChamber
int nLayersWithWireInChamber(unsigned int) const
Definition: CSCDigiMatcher.cc:256
CSCDigiMatcher::comparatorDigisH_
edm::Handle< CSCComparatorDigiCollection > comparatorDigisH_
Definition: CSCDigiMatcher.h:98
CSCDigiMatcher::chamber_to_wires_
std::map< unsigned int, CSCWireDigiContainer > chamber_to_wires_
Definition: CSCDigiMatcher.h:123
CSCDigiMatcher::verboseWG_
int verboseWG_
Definition: CSCDigiMatcher.h:114
CSCDigiMatcher::stripDigisInDetId
const CSCStripDigiContainer & stripDigisInDetId(unsigned int) const
Definition: CSCDigiMatcher.cc:208
CSCDigiMatcher::stripsInChamber
std::set< int > stripsInChamber(unsigned int, int max_gap_to_fill=0) const
Definition: CSCDigiMatcher.cc:349
CSCDigiMatcher::chamber_to_comparators_
std::map< unsigned int, CSCComparatorDigiContainer > chamber_to_comparators_
Definition: CSCDigiMatcher.h:117
CSCDigiMatcher::nCoincidenceWireChambers
int nCoincidenceWireChambers(int min_n_layers=4) const
Definition: CSCDigiMatcher.cc:288
OrderedSet.t
t
Definition: OrderedSet.py:90
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:131
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:214
CSCStripDigiContainer
std::vector< CSCStripDigi > CSCStripDigiContainer
Definition: CSCDigiMatcher.h:18
edm::ParameterSet
Definition: ParameterSet.h:36
CSCDigiMatcher::minBXComparator_
int minBXComparator_
Definition: CSCDigiMatcher.h:104
CSCDigiMatcher::nCoincidenceComparatorChambers
int nCoincidenceComparatorChambers(int min_n_layers=4) const
Definition: CSCDigiMatcher.cc:268
CSCDigiMatcher::matchWiresToSimTrack
void matchWiresToSimTrack(const CSCWireDigiCollection &wires)
Definition: CSCDigiMatcher.cc:141
CSCDetId
Definition: CSCDetId.h:26
CSCDigiMatcher::comparatorsInDetId
std::set< int > comparatorsInDetId(unsigned int) const
Definition: CSCDigiMatcher.cc:298
CSCDigiMatcher::wireDigiInput_
edm::EDGetTokenT< CSCWireDigiCollection > wireDigiInput_
Definition: CSCDigiMatcher.h:96
CSCDigiMatcher::wireDigisH_
edm::Handle< CSCWireDigiCollection > wireDigisH_
Definition: CSCDigiMatcher.h:100
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:196
CSCDigiMatcher::comparatorDigiInput_
edm::EDGetTokenT< CSCComparatorDigiCollection > comparatorDigiInput_
Definition: CSCDigiMatcher.h:94
CSCDigiMatcher::stripsInDetId
std::set< int > stripsInDetId(unsigned int) const
Definition: CSCDigiMatcher.cc:307
CSCStripDigiCollection.h
CSCComparatorDigiCollection
edm::EventSetup
Definition: EventSetup.h:57
CSCSimHitMatcher.h
CSCDigiMatcher::comparatorDigisInChamber
const CSCComparatorDigiContainer & comparatorDigisInChamber(unsigned int) const
Definition: CSCDigiMatcher.cc:202
CSCDigiMatcher::wiregroupsInChamber
std::set< int > wiregroupsInChamber(unsigned int, int max_gap_to_fill=0) const
Definition: CSCDigiMatcher.cc:373
CSCDigiMatcher::detIdsWire
std::set< unsigned int > detIdsWire(int csc_type=MuonHitHelper::CSC_ALL) const
Definition: CSCDigiMatcher.cc:180
CSCWireDigiCollection
CSCDigiMatcher::detIdsComparator
std::set< unsigned int > detIdsComparator(int csc_type=MuonHitHelper::CSC_ALL) const
Definition: CSCDigiMatcher.cc:172
CSCDigiMatcher::detIdsStrip
std::set< unsigned int > detIdsStrip(int csc_type=MuonHitHelper::CSC_ALL) const
Definition: CSCDigiMatcher.cc:176
SimTrack
Definition: SimTrack.h:6
T
long double T
Definition: Basic3DVectorLD.h:48
CSCDigiMatcher::wiregroupsInDetId
std::set< int > wiregroupsInDetId(unsigned int) const
Definition: CSCDigiMatcher.cc:316
CSCComparatorDigiDetIdContainer
std::vector< std::pair< unsigned int, CSCComparatorDigi > > CSCComparatorDigiDetIdContainer
Definition: CSCDigiMatcher.h:21
CSCDigiMatcher::no_wires_
CSCWireDigiContainer no_wires_
Definition: CSCDigiMatcher.h:127
CSCComparatorDigiCollection.h
CSCDigiMatcher::matchStripsToSimTrack
void matchStripsToSimTrack(const CSCStripDigiCollection &strips)
Definition: CSCDigiMatcher.cc:101
CSCDigiMatcher::matchDeltaComparator_
int matchDeltaComparator_
Definition: CSCDigiMatcher.h:108
CSCComparatorDigiContainer
std::vector< CSCComparatorDigi > CSCComparatorDigiContainer
Definition: CSCComparatorDigiFitter.h:35
CSCWireDigiCollection.h
CSCWireDigiDetIdContainer
std::vector< std::pair< unsigned int, CSCWireDigi > > CSCWireDigiDetIdContainer
Definition: CSCDigiMatcher.h:23
mps_fire.result
result
Definition: mps_fire.py:303
CSCDetId::station
int station() const
Definition: CSCDetId.h:79
CSCDigiMatcher::nLayersWithComparatorInChamber
int nLayersWithComparatorInChamber(unsigned int) const
Definition: CSCDigiMatcher.cc:232
CSCDigiMatcher::maxBXWire_
int maxBXWire_
Definition: CSCDigiMatcher.h:106
MuonHitHelper::toCSCType
static int toCSCType(int st, int ri)
Definition: MuonHitHelper.cc:195
edm::Event
Definition: Event.h:73
CSCDigiMatcher::no_strips_
CSCStripDigiContainer no_strips_
Definition: CSCDigiMatcher.h:126
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:39
CSCDigiMatcher::chamberIdsComparator
std::set< unsigned int > chamberIdsComparator(int csc_type=MuonHitHelper::CSC_ALL) const
Definition: CSCDigiMatcher.cc:184
CSCDigiMatcher::matchDeltaStrip_
int matchDeltaStrip_
Definition: CSCDigiMatcher.h:109
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