CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
CSCDigiMatcher Class Reference

#include <CSCDigiMatcher.h>

Public Member Functions

std::set< unsigned int > chamberIdsComparator (int csc_type=MuonHitHelper::CSC_ALL) const
 
std::set< unsigned int > chamberIdsStrip (int csc_type=MuonHitHelper::CSC_ALL) const
 
std::set< unsigned int > chamberIdsWire (int csc_type=MuonHitHelper::CSC_ALL) const
 
const CSCComparatorDigiContainercomparatorDigisInChamber (unsigned int) const
 
const CSCComparatorDigiContainercomparatorDigisInDetId (unsigned int) const
 
std::set< int > comparatorsInChamber (unsigned int, int max_gap_to_fill=0) const
 
std::set< int > comparatorsInDetId (unsigned int) const
 
 CSCDigiMatcher (edm::ParameterSet const &iPS, edm::ConsumesCollector &&iC)
 
std::set< unsigned int > detIdsComparator (int csc_type=MuonHitHelper::CSC_ALL) const
 
std::set< unsigned int > detIdsStrip (int csc_type=MuonHitHelper::CSC_ALL) const
 
std::set< unsigned int > detIdsWire (int csc_type=MuonHitHelper::CSC_ALL) const
 
void init (const edm::Event &e, const edm::EventSetup &eventSetup)
 
void match (const SimTrack &t, const SimVertex &v)
 do the matching More...
 
std::shared_ptr< CSCSimHitMatchermuonSimHitMatcher () const
 
int nCoincidenceComparatorChambers (int min_n_layers=4) const
 
int nCoincidenceStripChambers (int min_n_layers=4) const
 
int nCoincidenceWireChambers (int min_n_layers=4) const
 
int nLayersWithComparatorInChamber (unsigned int) const
 
int nLayersWithStripInChamber (unsigned int) const
 
int nLayersWithWireInChamber (unsigned int) const
 
const CSCStripDigiContainerstripDigisInChamber (unsigned int) const
 
const CSCStripDigiContainerstripDigisInDetId (unsigned int) const
 
std::set< int > stripsInChamber (unsigned int, int max_gap_to_fill=0) const
 
std::set< int > stripsInDetId (unsigned int) const
 
int totalComparators (unsigned int) const
 
int totalStrips (unsigned int) const
 
int totalWires (unsigned int) const
 
const CSCWireDigiContainerwireDigisInChamber (unsigned int) const
 
const CSCWireDigiContainerwireDigisInDetId (unsigned int) const
 
std::set< int > wiregroupsInChamber (unsigned int, int max_gap_to_fill=0) const
 
std::set< int > wiregroupsInDetId (unsigned int) const
 
 ~CSCDigiMatcher ()
 

Private Member Functions

void clear ()
 
void matchComparatorsToSimTrack (const CSCComparatorDigiCollection &comparators)
 
void matchStripsToSimTrack (const CSCStripDigiCollection &strips)
 
void matchWiresToSimTrack (const CSCWireDigiCollection &wires)
 
template<class T >
std::set< unsigned int > selectDetIds (const T &digis, int csc_type) const
 

Private Attributes

std::map< unsigned int, CSCComparatorDigiContainerchamber_to_comparators_
 
std::map< unsigned int, CSCStripDigiContainerchamber_to_strips_
 
std::map< unsigned int, CSCWireDigiContainerchamber_to_wires_
 
edm::EDGetTokenT< CSCComparatorDigiCollectioncomparatorDigiInput_
 
edm::Handle< CSCComparatorDigiCollectioncomparatorDigisH_
 
std::map< unsigned int, CSCComparatorDigiContainerdetid_to_comparators_
 
std::map< unsigned int, CSCStripDigiContainerdetid_to_strips_
 
std::map< unsigned int, int > detid_to_totalcomparators_
 
std::map< unsigned int, int > detid_to_totalstrips_
 
std::map< unsigned int, int > detid_to_totalwires_
 
std::map< unsigned int, CSCWireDigiContainerdetid_to_wires_
 
int matchDeltaComparator_
 
int matchDeltaStrip_
 
int matchDeltaWG_
 
int maxBXComparator_
 
int maxBXStrip_
 
int maxBXWire_
 
int minBXComparator_
 
int minBXStrip_
 
int minBXWire_
 
std::shared_ptr< CSCSimHitMatchermuonSimHitMatcher_
 
CSCComparatorDigiContainer no_comparators_
 
CSCStripDigiContainer no_strips_
 
CSCWireDigiContainer no_wires_
 
edm::EDGetTokenT< CSCStripDigiCollectionstripDigiInput_
 
edm::Handle< CSCStripDigiCollectionstripDigisH_
 
int verboseComparator_
 
int verboseStrip_
 
int verboseWG_
 
edm::EDGetTokenT< CSCWireDigiCollectionwireDigiInput_
 
edm::Handle< CSCWireDigiCollectionwireDigisH_
 

Detailed Description

Description: Matching of Digis to SimTrack in CSC

Author: Sven Dildick (TAMU), Tao Huang (TAMU)

Definition at line 25 of file CSCDigiMatcher.h.

Constructor & Destructor Documentation

◆ CSCDigiMatcher()

CSCDigiMatcher::CSCDigiMatcher ( edm::ParameterSet const &  iPS,
edm::ConsumesCollector &&  iC 
)

Definition at line 5 of file CSCDigiMatcher.cc.

References eostools::move(), and muonDTDigis_cfi::pset.

5  {
6  const auto& wireDigi = pset.getParameterSet("cscWireDigi");
7  verboseWG_ = wireDigi.getParameter<int>("verbose");
8  minBXWire_ = wireDigi.getParameter<int>("minBX");
9  maxBXWire_ = wireDigi.getParameter<int>("maxBX");
10  matchDeltaWG_ = wireDigi.getParameter<int>("matchDeltaWG");
11 
12  const auto& comparatorDigi = pset.getParameterSet("cscComparatorDigi");
13  verboseComparator_ = comparatorDigi.getParameter<int>("verbose");
14  minBXComparator_ = comparatorDigi.getParameter<int>("minBX");
15  maxBXComparator_ = comparatorDigi.getParameter<int>("maxBX");
16  matchDeltaComparator_ = comparatorDigi.getParameter<int>("matchDeltaStrip");
17 
18  const auto& stripDigi = pset.getParameterSet("cscStripDigi");
19  verboseStrip_ = stripDigi.getParameter<int>("verbose");
20  minBXStrip_ = stripDigi.getParameter<int>("minBX");
21  maxBXStrip_ = stripDigi.getParameter<int>("maxBX");
22  matchDeltaStrip_ = stripDigi.getParameter<int>("matchDeltaStrip");
23 
24  // make a new simhits matcher
26 
28  iC.consumes<CSCComparatorDigiCollection>(comparatorDigi.getParameter<edm::InputTag>("inputTag"));
29  stripDigiInput_ = iC.consumes<CSCStripDigiCollection>(stripDigi.getParameter<edm::InputTag>("inputTag"));
30  wireDigiInput_ = iC.consumes<CSCWireDigiCollection>(wireDigi.getParameter<edm::InputTag>("inputTag"));
31 }
std::shared_ptr< CSCSimHitMatcher > muonSimHitMatcher_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< CSCWireDigiCollection > wireDigiInput_
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< CSCComparatorDigiCollection > comparatorDigiInput_
edm::EDGetTokenT< CSCStripDigiCollection > stripDigiInput_

◆ ~CSCDigiMatcher()

CSCDigiMatcher::~CSCDigiMatcher ( )
inline

Definition at line 31 of file CSCDigiMatcher.h.

31 {}

Member Function Documentation

◆ chamberIdsComparator()

std::set< unsigned int > CSCDigiMatcher::chamberIdsComparator ( int  csc_type = MuonHitHelper::CSC_ALL) const

Definition at line 195 of file CSCDigiMatcher.cc.

195  {
196  return selectDetIds(chamber_to_comparators_, csc_type);
197 }
std::map< unsigned int, CSCComparatorDigiContainer > chamber_to_comparators_
std::set< unsigned int > selectDetIds(const T &digis, int csc_type) const

◆ chamberIdsStrip()

std::set< unsigned int > CSCDigiMatcher::chamberIdsStrip ( int  csc_type = MuonHitHelper::CSC_ALL) const

Definition at line 199 of file CSCDigiMatcher.cc.

199  {
200  return selectDetIds(chamber_to_strips_, csc_type);
201 }
std::map< unsigned int, CSCStripDigiContainer > chamber_to_strips_
std::set< unsigned int > selectDetIds(const T &digis, int csc_type) const

◆ chamberIdsWire()

std::set< unsigned int > CSCDigiMatcher::chamberIdsWire ( int  csc_type = MuonHitHelper::CSC_ALL) const

Definition at line 203 of file CSCDigiMatcher.cc.

203  {
204  return selectDetIds(chamber_to_wires_, csc_type);
205 }
std::map< unsigned int, CSCWireDigiContainer > chamber_to_wires_
std::set< unsigned int > selectDetIds(const T &digis, int csc_type) const

◆ clear()

void CSCDigiMatcher::clear ( void  )
private

Definition at line 413 of file CSCDigiMatcher.cc.

413  {
414  detid_to_comparators_.clear();
415  chamber_to_comparators_.clear();
416 
417  detid_to_strips_.clear();
418  chamber_to_strips_.clear();
419 
420  detid_to_wires_.clear();
421  chamber_to_wires_.clear();
422 }
std::map< unsigned int, CSCWireDigiContainer > detid_to_wires_
std::map< unsigned int, CSCComparatorDigiContainer > chamber_to_comparators_
std::map< unsigned int, CSCWireDigiContainer > chamber_to_wires_
std::map< unsigned int, CSCComparatorDigiContainer > detid_to_comparators_
std::map< unsigned int, CSCStripDigiContainer > chamber_to_strips_
std::map< unsigned int, CSCStripDigiContainer > detid_to_strips_

◆ comparatorDigisInChamber()

const CSCComparatorDigiContainer & CSCDigiMatcher::comparatorDigisInChamber ( unsigned int  detid) const

Definition at line 213 of file CSCDigiMatcher.cc.

References ALCARECOPPSCalTrackBasedSel_cff::detid.

213  {
215  return no_comparators_;
216  return chamber_to_comparators_.at(detid);
217 }
CSCComparatorDigiContainer no_comparators_
std::map< unsigned int, CSCComparatorDigiContainer > chamber_to_comparators_

◆ comparatorDigisInDetId()

const CSCComparatorDigiContainer & CSCDigiMatcher::comparatorDigisInDetId ( unsigned int  detid) const

Definition at line 207 of file CSCDigiMatcher.cc.

References ALCARECOPPSCalTrackBasedSel_cff::detid.

207  {
209  return no_comparators_;
210  return detid_to_comparators_.at(detid);
211 }
CSCComparatorDigiContainer no_comparators_
std::map< unsigned int, CSCComparatorDigiContainer > detid_to_comparators_

◆ comparatorsInChamber()

std::set< int > CSCDigiMatcher::comparatorsInChamber ( unsigned int  detid,
int  max_gap_to_fill = 0 
) const

Definition at line 336 of file CSCDigiMatcher.cc.

References ztail::d, ALCARECOPPSCalTrackBasedSel_cff::detid, mps_fire::result, and alignCSCRings::s.

336  {
337  set<int> result;
338  const auto& digis = comparatorDigisInChamber(detid);
339  for (const auto& d : digis) {
340  result.insert(d.getStrip());
341  }
342  if (max_gap_to_fill > 0) {
343  int prev = -111;
344  for (const auto& s : result) {
345  if (s - prev > 1 && s - prev - 1 <= max_gap_to_fill) {
346  for (int fill_s = prev + 1; fill_s < s; ++fill_s)
347  result.insert(fill_s);
348  }
349  prev = s;
350  }
351  }
352 
353  return result;
354 }
d
Definition: ztail.py:151
const CSCComparatorDigiContainer & comparatorDigisInChamber(unsigned int) const

◆ comparatorsInDetId()

std::set< int > CSCDigiMatcher::comparatorsInDetId ( unsigned int  detid) const

Definition at line 309 of file CSCDigiMatcher.cc.

References ztail::d, ALCARECOPPSCalTrackBasedSel_cff::detid, and mps_fire::result.

309  {
310  set<int> result;
311  const auto& digis = comparatorDigisInDetId(detid);
312  for (const auto& d : digis) {
313  result.insert(d.getHalfStrip());
314  }
315  return result;
316 }
const CSCComparatorDigiContainer & comparatorDigisInDetId(unsigned int) const
d
Definition: ztail.py:151

◆ detIdsComparator()

std::set< unsigned int > CSCDigiMatcher::detIdsComparator ( int  csc_type = MuonHitHelper::CSC_ALL) const

Definition at line 183 of file CSCDigiMatcher.cc.

183  {
184  return selectDetIds(detid_to_comparators_, csc_type);
185 }
std::map< unsigned int, CSCComparatorDigiContainer > detid_to_comparators_
std::set< unsigned int > selectDetIds(const T &digis, int csc_type) const

◆ detIdsStrip()

std::set< unsigned int > CSCDigiMatcher::detIdsStrip ( int  csc_type = MuonHitHelper::CSC_ALL) const

Definition at line 187 of file CSCDigiMatcher.cc.

187  {
188  return selectDetIds(detid_to_strips_, csc_type);
189 }
std::map< unsigned int, CSCStripDigiContainer > detid_to_strips_
std::set< unsigned int > selectDetIds(const T &digis, int csc_type) const

◆ detIdsWire()

std::set< unsigned int > CSCDigiMatcher::detIdsWire ( int  csc_type = MuonHitHelper::CSC_ALL) const

Definition at line 191 of file CSCDigiMatcher.cc.

191  {
192  return selectDetIds(detid_to_wires_, csc_type);
193 }
std::map< unsigned int, CSCWireDigiContainer > detid_to_wires_
std::set< unsigned int > selectDetIds(const T &digis, int csc_type) const

◆ init()

void CSCDigiMatcher::init ( const edm::Event e,
const edm::EventSetup eventSetup 
)

Definition at line 33 of file CSCDigiMatcher.cc.

References iEvent.

33  {
34  muonSimHitMatcher_->init(iEvent, iSetup);
35 
37  iEvent.getByToken(stripDigiInput_, stripDigisH_);
38  iEvent.getByToken(wireDigiInput_, wireDigisH_);
39 }
std::shared_ptr< CSCSimHitMatcher > muonSimHitMatcher_
edm::Handle< CSCComparatorDigiCollection > comparatorDigisH_
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< CSCWireDigiCollection > wireDigiInput_
edm::Handle< CSCWireDigiCollection > wireDigisH_
edm::Handle< CSCStripDigiCollection > stripDigisH_
edm::EDGetTokenT< CSCComparatorDigiCollection > comparatorDigiInput_
edm::EDGetTokenT< CSCStripDigiCollection > stripDigiInput_

◆ match()

void CSCDigiMatcher::match ( const SimTrack t,
const SimVertex v 
)

do the matching

Definition at line 42 of file CSCDigiMatcher.cc.

References l1ct::clear(), DigiDM_cff::strips, submitPVValidationJobs::t, findQualityFiles::v, and DigiDM_cff::wires.

42  {
43  // match simhits first
44  muonSimHitMatcher_->match(t, v);
45 
46  // get the digi collections
50 
51  clear();
52 
53  // now match the digis
54  matchComparatorsToSimTrack(comparators);
57 }
std::shared_ptr< CSCSimHitMatcher > muonSimHitMatcher_
T const * product() const
Definition: Handle.h:70
edm::Handle< CSCComparatorDigiCollection > comparatorDigisH_
void matchStripsToSimTrack(const CSCStripDigiCollection &strips)
void matchWiresToSimTrack(const CSCWireDigiCollection &wires)
edm::Handle< CSCWireDigiCollection > wireDigisH_
void matchComparatorsToSimTrack(const CSCComparatorDigiCollection &comparators)
edm::Handle< CSCStripDigiCollection > stripDigisH_
strips
#turn off noise in all subdetectors simHcalUnsuppressedDigis.doNoise = False mix.digitizers.hcal.doNoise = False simEcalUnsuppressedDigis.doNoise = False mix.digitizers.ecal.doNoise = False simEcalUnsuppressedDigis.doESNoise = False simSiPixelDigis.AddNoise = False mix.digitizers.pixel.AddNoise = False simSiStripDigis.Noise = False mix.digitizers.strip.AddNoise = False
Definition: DigiDM_cff.py:32

◆ matchComparatorsToSimTrack()

void CSCDigiMatcher::matchComparatorsToSimTrack ( const CSCComparatorDigiCollection comparators)
private

Definition at line 59 of file CSCDigiMatcher.cc.

References DummyCfis::c, CSCDetId::chamberId(), filterCSVwithJSON::copy, gather_cfg::cout, EcalPhiSymFlatTableProducers_cfi::id, and DetId::rawId().

59  {
60  const auto& det_ids = muonSimHitMatcher_->detIds(0);
61  for (const auto& id : det_ids) {
62  CSCDetId layer_id(id);
63 
64  const auto& hit_comparators = muonSimHitMatcher_->hitStripsInDetId(id, matchDeltaStrip_);
65  if (verboseComparator_) {
66  cout << "hit_comparators_fat, CSCid " << layer_id << " ";
67  copy(hit_comparators.begin(), hit_comparators.end(), ostream_iterator<int>(cout, " "));
68  cout << endl;
69  }
70 
71  int ndigis = 0;
72  const auto& comp_digis_in_det = comparators.get(layer_id);
73  for (auto c = comp_digis_in_det.first; c != comp_digis_in_det.second; ++c) {
75  edm::LogInfo("CSCDigiMatcher") << "sdigi " << layer_id << " (comparator, comparator, Tbin ) " << *c;
76 
77  // check that the first BX for this digi wasn't too early or too late
78  if (c->getTimeBin() < minBXComparator_ || c->getTimeBin() > maxBXComparator_)
79  continue;
80 
81  ndigis++;
82 
83  int comparator = c->getStrip(); // comparators are counted from 1
84  // check that it matches a comparator that was hit by SimHits from our track
85  if (hit_comparators.find(comparator) == hit_comparators.end())
86  continue;
87 
89  edm::LogInfo("CSCDigiMatcher") << "Matched comparator " << *c;
90  detid_to_comparators_[id].push_back(*c);
91  chamber_to_comparators_[layer_id.chamberId().rawId()].push_back(*c);
92  }
93  detid_to_totalcomparators_[id] = ndigis; //id to totalcomparators
94  }
95 }
std::shared_ptr< CSCSimHitMatcher > muonSimHitMatcher_
std::map< unsigned int, int > detid_to_totalcomparators_
std::map< unsigned int, CSCComparatorDigiContainer > chamber_to_comparators_
std::map< unsigned int, CSCComparatorDigiContainer > detid_to_comparators_
Log< level::Info, false > LogInfo

◆ matchStripsToSimTrack()

void CSCDigiMatcher::matchStripsToSimTrack ( const CSCStripDigiCollection strips)
private

Definition at line 97 of file CSCDigiMatcher.cc.

References DummyCfis::c, CSCDetId::chamberId(), filterCSVwithJSON::copy, gather_cfg::cout, EcalPhiSymFlatTableProducers_cfi::id, or, isotrackApplyRegressor::range, DetId::rawId(), relativeConstraints::ring, relativeConstraints::station, nano_mu_digi_cff::strip, and DigiDM_cff::strips.

97  {
98  for (auto detUnitIt = strips.begin(); detUnitIt != strips.end(); ++detUnitIt) {
99  const CSCDetId& id = (*detUnitIt).first;
100  const auto& range = (*detUnitIt).second;
101  for (auto digiIt = range.first; digiIt != range.second; ++digiIt) {
102  if (id.station() == 1 and (id.ring() == 1 or id.ring() == 4))
103  if (verboseStrip_)
104  edm::LogInfo("CSCDigiMatcher") << "CSCid " << id << " Strip digi (strip, strip, Tbin ) " << (*digiIt);
105  }
106  }
107 
108  const auto& det_ids = muonSimHitMatcher_->detIds(0);
109  for (const auto& id : det_ids) {
110  CSCDetId layer_id(id);
111 
112  const auto& hit_strips = muonSimHitMatcher_->hitStripsInDetId(id, matchDeltaStrip_);
113  if (verboseStrip_) {
114  cout << "hit_strips_fat, CSCid " << layer_id << " ";
115  copy(hit_strips.begin(), hit_strips.end(), ostream_iterator<int>(cout, " "));
116  cout << endl;
117  }
118 
119  int ndigis = 0;
120 
121  const auto& strip_digis_in_det = strips.get(layer_id);
122  for (auto c = strip_digis_in_det.first; c != strip_digis_in_det.second; ++c) {
123  //next is to remove the strips with pulse at noise level, with ACD info
124  //the detail may be from CSC rechits algorithm
125  if (verboseStrip_)
126  edm::LogInfo("CSCDigiMatcher") << "sdigi " << layer_id << " (strip, ADC ) " << *c;
127 
128  ndigis++;
129 
130  int strip = c->getStrip(); // strips are counted from 1
131  // check that it matches a strip that was hit by SimHits from our track
132  if (hit_strips.find(strip) == hit_strips.end())
133  continue;
134 
135  if (verboseStrip_)
136  edm::LogInfo("CSCDigiMatcher") << "Matched strip " << *c;
137  detid_to_strips_[id].push_back(*c);
138  chamber_to_strips_[layer_id.chamberId().rawId()].push_back(*c);
139  }
140  detid_to_totalstrips_[id] = ndigis;
141  }
142 }
std::shared_ptr< CSCSimHitMatcher > muonSimHitMatcher_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
std::map< unsigned int, CSCStripDigiContainer > chamber_to_strips_
Log< level::Info, false > LogInfo
std::map< unsigned int, int > detid_to_totalstrips_
std::map< unsigned int, CSCStripDigiContainer > detid_to_strips_
strips
#turn off noise in all subdetectors simHcalUnsuppressedDigis.doNoise = False mix.digitizers.hcal.doNoise = False simEcalUnsuppressedDigis.doNoise = False mix.digitizers.ecal.doNoise = False simEcalUnsuppressedDigis.doESNoise = False simSiPixelDigis.AddNoise = False mix.digitizers.pixel.AddNoise = False simSiStripDigis.Noise = False mix.digitizers.strip.AddNoise = False
Definition: DigiDM_cff.py:32

◆ matchWiresToSimTrack()

void CSCDigiMatcher::matchWiresToSimTrack ( const CSCWireDigiCollection wires)
private

Definition at line 144 of file CSCDigiMatcher.cc.

References CSCDetId::chamberId(), filterCSVwithJSON::copy, gather_cfg::cout, EcalPhiSymFlatTableProducers_cfi::id, DetId::rawId(), w(), and DigiDM_cff::wires.

144  {
145  const auto& det_ids = muonSimHitMatcher_->detIds(0);
146  for (const auto& id : det_ids) {
147  CSCDetId layer_id(id);
148 
149  const auto& hit_wires = muonSimHitMatcher_->hitWiregroupsInDetId(id, matchDeltaWG_);
150  if (verboseWG_) {
151  cout << "hit_wires ";
152  copy(hit_wires.begin(), hit_wires.end(), ostream_iterator<int>(cout, " "));
153  cout << endl;
154  }
155 
156  int ndigis = 0;
157 
158  const auto& wire_digis_in_det = wires.get(layer_id);
159  for (auto w = wire_digis_in_det.first; w != wire_digis_in_det.second; ++w) {
160  if (verboseStrip_)
161  edm::LogInfo("CSCDigiMatcher") << "wdigi " << layer_id << " (wire, Tbin ) " << *w;
162 
163  // check that the first BX for this digi wasn't too early or too late
164  if (w->getTimeBin() < minBXWire_ || w->getTimeBin() > maxBXWire_)
165  continue;
166 
167  ndigis++;
168 
169  int wg = w->getWireGroup(); // wiregroups are counted from 1
170  // check that it matches a strip that was hit by SimHits from our track
171  if (hit_wires.find(wg) == hit_wires.end())
172  continue;
173 
174  if (verboseStrip_)
175  edm::LogInfo("CSCDigiMatcher") << "Matched wire digi " << *w << endl;
176  detid_to_wires_[id].push_back(*w);
177  chamber_to_wires_[layer_id.chamberId().rawId()].push_back(*w);
178  }
179  detid_to_totalwires_[id] = ndigis;
180  }
181 }
std::shared_ptr< CSCSimHitMatcher > muonSimHitMatcher_
std::map< unsigned int, CSCWireDigiContainer > detid_to_wires_
T w() const
std::map< unsigned int, int > detid_to_totalwires_
std::map< unsigned int, CSCWireDigiContainer > chamber_to_wires_
Log< level::Info, false > LogInfo

◆ muonSimHitMatcher()

std::shared_ptr<CSCSimHitMatcher> CSCDigiMatcher::muonSimHitMatcher ( ) const
inline

Definition at line 88 of file CSCDigiMatcher.h.

References muonSimHitMatcher_.

88 { return muonSimHitMatcher_; }
std::shared_ptr< CSCSimHitMatcher > muonSimHitMatcher_

◆ nCoincidenceComparatorChambers()

int CSCDigiMatcher::nCoincidenceComparatorChambers ( int  min_n_layers = 4) const

Definition at line 279 of file CSCDigiMatcher.cc.

References mps_fire::result.

279  {
280  int result = 0;
281  const auto& chamber_ids = chamberIdsComparator();
282  for (const auto& id : chamber_ids) {
283  if (nLayersWithComparatorInChamber(id) >= min_n_layers)
284  result += 1;
285  }
286  return result;
287 }
std::set< unsigned int > chamberIdsComparator(int csc_type=MuonHitHelper::CSC_ALL) const
int nLayersWithComparatorInChamber(unsigned int) const

◆ nCoincidenceStripChambers()

int CSCDigiMatcher::nCoincidenceStripChambers ( int  min_n_layers = 4) const

Definition at line 289 of file CSCDigiMatcher.cc.

References mps_fire::result.

289  {
290  int result = 0;
291  const auto& chamber_ids = chamberIdsStrip();
292  for (const auto& id : chamber_ids) {
293  if (nLayersWithStripInChamber(id) >= min_n_layers)
294  result += 1;
295  }
296  return result;
297 }
int nLayersWithStripInChamber(unsigned int) const
std::set< unsigned int > chamberIdsStrip(int csc_type=MuonHitHelper::CSC_ALL) const

◆ nCoincidenceWireChambers()

int CSCDigiMatcher::nCoincidenceWireChambers ( int  min_n_layers = 4) const

Definition at line 299 of file CSCDigiMatcher.cc.

References mps_fire::result.

299  {
300  int result = 0;
301  const auto& chamber_ids = chamberIdsWire();
302  for (const auto& id : chamber_ids) {
303  if (nLayersWithWireInChamber(id) >= min_n_layers)
304  result += 1;
305  }
306  return result;
307 }
std::set< unsigned int > chamberIdsWire(int csc_type=MuonHitHelper::CSC_ALL) const
int nLayersWithWireInChamber(unsigned int) const

◆ nLayersWithComparatorInChamber()

int CSCDigiMatcher::nLayersWithComparatorInChamber ( unsigned int  detid) const

Definition at line 243 of file CSCDigiMatcher.cc.

References dtT0FillChamberFromDBCorrection_cfg::chamberId, ALCARECOPPSCalTrackBasedSel_cff::detid, relativeConstraints::empty, mps_fire::i, and MuonTCMETValueMapProducer_cff::nLayers.

243  {
244  int nLayers = 0;
246  for (int i = 1; i <= 6; ++i) {
247  CSCDetId layerId(chamberId.endcap(), chamberId.station(), chamberId.ring(), chamberId.chamber(), i);
248  if (!comparatorDigisInDetId(layerId.rawId()).empty()) {
249  nLayers++;
250  }
251  }
252  return nLayers;
253 }
const CSCComparatorDigiContainer & comparatorDigisInDetId(unsigned int) const

◆ nLayersWithStripInChamber()

int CSCDigiMatcher::nLayersWithStripInChamber ( unsigned int  detid) const

Definition at line 255 of file CSCDigiMatcher.cc.

References dtT0FillChamberFromDBCorrection_cfg::chamberId, ALCARECOPPSCalTrackBasedSel_cff::detid, relativeConstraints::empty, mps_fire::i, and MuonTCMETValueMapProducer_cff::nLayers.

255  {
256  int nLayers = 0;
258  for (int i = 1; i <= 6; ++i) {
259  CSCDetId layerId(chamberId.endcap(), chamberId.station(), chamberId.ring(), chamberId.chamber(), i);
260  if (!stripDigisInDetId(layerId.rawId()).empty()) {
261  nLayers++;
262  }
263  }
264  return nLayers;
265 }
const CSCStripDigiContainer & stripDigisInDetId(unsigned int) const

◆ nLayersWithWireInChamber()

int CSCDigiMatcher::nLayersWithWireInChamber ( unsigned int  detid) const

Definition at line 267 of file CSCDigiMatcher.cc.

References dtT0FillChamberFromDBCorrection_cfg::chamberId, ALCARECOPPSCalTrackBasedSel_cff::detid, relativeConstraints::empty, mps_fire::i, and MuonTCMETValueMapProducer_cff::nLayers.

267  {
268  int nLayers = 0;
270  for (int i = 1; i <= 6; ++i) {
271  CSCDetId layerId(chamberId.endcap(), chamberId.station(), chamberId.ring(), chamberId.chamber(), i);
272  if (!wireDigisInDetId(layerId.rawId()).empty()) {
273  nLayers++;
274  }
275  }
276  return nLayers;
277 }
const CSCWireDigiContainer & wireDigisInDetId(unsigned int) const

◆ selectDetIds()

template<class T >
std::set< unsigned int > CSCDigiMatcher::selectDetIds ( const T digis,
int  csc_type 
) const
private

Definition at line 141 of file CSCDigiMatcher.h.

References hcalRecHitTable_cff::detId, AlCaHLTBitMon_ParallelJobs::p, mps_fire::result, and MuonHitHelper::toCSCType().

141  {
142  std::set<unsigned int> result;
143  for (const auto& p : digis) {
144  const auto& id = p.first;
145  if (csc_type > 0) {
146  CSCDetId detId(id);
147  if (MuonHitHelper::toCSCType(detId.station(), detId.ring()) != csc_type)
148  continue;
149  }
150  result.insert(p.first);
151  }
152  return result;
153 }
static int toCSCType(int st, int ri)

◆ stripDigisInChamber()

const CSCStripDigiContainer & CSCDigiMatcher::stripDigisInChamber ( unsigned int  detid) const

Definition at line 225 of file CSCDigiMatcher.cc.

References ALCARECOPPSCalTrackBasedSel_cff::detid.

225  {
226  if (chamber_to_strips_.find(detid) == chamber_to_strips_.end())
227  return no_strips_;
228  return chamber_to_strips_.at(detid);
229 }
CSCStripDigiContainer no_strips_
std::map< unsigned int, CSCStripDigiContainer > chamber_to_strips_

◆ stripDigisInDetId()

const CSCStripDigiContainer & CSCDigiMatcher::stripDigisInDetId ( unsigned int  detid) const

Definition at line 219 of file CSCDigiMatcher.cc.

References ALCARECOPPSCalTrackBasedSel_cff::detid.

219  {
220  if (detid_to_strips_.find(detid) == detid_to_strips_.end())
221  return no_strips_;
222  return detid_to_strips_.at(detid);
223 }
CSCStripDigiContainer no_strips_
std::map< unsigned int, CSCStripDigiContainer > detid_to_strips_

◆ stripsInChamber()

std::set< int > CSCDigiMatcher::stripsInChamber ( unsigned int  detid,
int  max_gap_to_fill = 0 
) const

Definition at line 356 of file CSCDigiMatcher.cc.

References ztail::d, ALCARECOPPSCalTrackBasedSel_cff::detid, mps_fire::result, and alignCSCRings::s.

356  {
357  set<int> result;
358  const auto& digis = stripDigisInChamber(detid);
359  for (const auto& d : digis) {
360  result.insert(d.getStrip());
361  }
362  if (max_gap_to_fill > 0) {
363  int prev = -111;
364  for (const auto& s : result) {
365  if (s - prev > 1 && s - prev - 1 <= max_gap_to_fill) {
366  for (int fill_s = prev + 1; fill_s < s; ++fill_s)
367  result.insert(fill_s);
368  }
369  prev = s;
370  }
371  }
372 
373  return result;
374 }
const CSCStripDigiContainer & stripDigisInChamber(unsigned int) const
d
Definition: ztail.py:151

◆ stripsInDetId()

std::set< int > CSCDigiMatcher::stripsInDetId ( unsigned int  detid) const

Definition at line 318 of file CSCDigiMatcher.cc.

References ztail::d, ALCARECOPPSCalTrackBasedSel_cff::detid, and mps_fire::result.

318  {
319  set<int> result;
320  const auto& digis = stripDigisInDetId(detid);
321  for (const auto& d : digis) {
322  result.insert(d.getStrip());
323  }
324  return result;
325 }
d
Definition: ztail.py:151
const CSCStripDigiContainer & stripDigisInDetId(unsigned int) const

◆ totalComparators()

int CSCDigiMatcher::totalComparators ( unsigned int  detid) const

Definition at line 395 of file CSCDigiMatcher.cc.

References ALCARECOPPSCalTrackBasedSel_cff::detid.

395  {
397  return 0;
399 }
std::map< unsigned int, int > detid_to_totalcomparators_

◆ totalStrips()

int CSCDigiMatcher::totalStrips ( unsigned int  detid) const

Definition at line 401 of file CSCDigiMatcher.cc.

References ALCARECOPPSCalTrackBasedSel_cff::detid.

401  {
403  return 0;
404  return detid_to_totalstrips_.at(detid);
405 }
std::map< unsigned int, int > detid_to_totalstrips_

◆ totalWires()

int CSCDigiMatcher::totalWires ( unsigned int  detid) const

Definition at line 407 of file CSCDigiMatcher.cc.

References ALCARECOPPSCalTrackBasedSel_cff::detid.

407  {
409  return 0;
410  return detid_to_totalwires_.at(detid);
411 }
std::map< unsigned int, int > detid_to_totalwires_

◆ wireDigisInChamber()

const CSCWireDigiContainer & CSCDigiMatcher::wireDigisInChamber ( unsigned int  detid) const

Definition at line 237 of file CSCDigiMatcher.cc.

References ALCARECOPPSCalTrackBasedSel_cff::detid.

237  {
238  if (chamber_to_wires_.find(detid) == chamber_to_wires_.end())
239  return no_wires_;
240  return chamber_to_wires_.at(detid);
241 }
std::map< unsigned int, CSCWireDigiContainer > chamber_to_wires_
CSCWireDigiContainer no_wires_

◆ wireDigisInDetId()

const CSCWireDigiContainer & CSCDigiMatcher::wireDigisInDetId ( unsigned int  detid) const

Definition at line 231 of file CSCDigiMatcher.cc.

References ALCARECOPPSCalTrackBasedSel_cff::detid.

231  {
232  if (detid_to_wires_.find(detid) == detid_to_wires_.end())
233  return no_wires_;
234  return detid_to_wires_.at(detid);
235 }
std::map< unsigned int, CSCWireDigiContainer > detid_to_wires_
CSCWireDigiContainer no_wires_

◆ wiregroupsInChamber()

std::set< int > CSCDigiMatcher::wiregroupsInChamber ( unsigned int  detid,
int  max_gap_to_fill = 0 
) const

Definition at line 376 of file CSCDigiMatcher.cc.

References ztail::d, ALCARECOPPSCalTrackBasedSel_cff::detid, mps_fire::result, and w().

376  {
377  set<int> result;
378  const auto& digis = wireDigisInChamber(detid);
379  for (const auto& d : digis) {
380  result.insert(d.getWireGroup());
381  }
382  if (max_gap_to_fill > 0) {
383  int prev = -111;
384  for (const auto& w : result) {
385  if (w - prev > 1 && w - prev - 1 <= max_gap_to_fill) {
386  for (int fill_w = prev + 1; fill_w < w; ++fill_w)
387  result.insert(fill_w);
388  }
389  prev = w;
390  }
391  }
392  return result;
393 }
T w() const
d
Definition: ztail.py:151
const CSCWireDigiContainer & wireDigisInChamber(unsigned int) const

◆ wiregroupsInDetId()

std::set< int > CSCDigiMatcher::wiregroupsInDetId ( unsigned int  detid) const

Definition at line 327 of file CSCDigiMatcher.cc.

References ztail::d, ALCARECOPPSCalTrackBasedSel_cff::detid, and mps_fire::result.

327  {
328  set<int> result;
329  const auto& digis = wireDigisInDetId(detid);
330  for (const auto& d : digis) {
331  result.insert(d.getWireGroup());
332  }
333  return result;
334 }
d
Definition: ztail.py:151
const CSCWireDigiContainer & wireDigisInDetId(unsigned int) const

Member Data Documentation

◆ chamber_to_comparators_

std::map<unsigned int, CSCComparatorDigiContainer> CSCDigiMatcher::chamber_to_comparators_
private

Definition at line 124 of file CSCDigiMatcher.h.

◆ chamber_to_strips_

std::map<unsigned int, CSCStripDigiContainer> CSCDigiMatcher::chamber_to_strips_
private

Definition at line 128 of file CSCDigiMatcher.h.

◆ chamber_to_wires_

std::map<unsigned int, CSCWireDigiContainer> CSCDigiMatcher::chamber_to_wires_
private

Definition at line 132 of file CSCDigiMatcher.h.

◆ comparatorDigiInput_

edm::EDGetTokenT<CSCComparatorDigiCollection> CSCDigiMatcher::comparatorDigiInput_
private

Definition at line 101 of file CSCDigiMatcher.h.

◆ comparatorDigisH_

edm::Handle<CSCComparatorDigiCollection> CSCDigiMatcher::comparatorDigisH_
private

Definition at line 105 of file CSCDigiMatcher.h.

◆ detid_to_comparators_

std::map<unsigned int, CSCComparatorDigiContainer> CSCDigiMatcher::detid_to_comparators_
private

Definition at line 123 of file CSCDigiMatcher.h.

◆ detid_to_strips_

std::map<unsigned int, CSCStripDigiContainer> CSCDigiMatcher::detid_to_strips_
private

Definition at line 127 of file CSCDigiMatcher.h.

◆ detid_to_totalcomparators_

std::map<unsigned int, int> CSCDigiMatcher::detid_to_totalcomparators_
private

Definition at line 125 of file CSCDigiMatcher.h.

◆ detid_to_totalstrips_

std::map<unsigned int, int> CSCDigiMatcher::detid_to_totalstrips_
private

Definition at line 129 of file CSCDigiMatcher.h.

◆ detid_to_totalwires_

std::map<unsigned int, int> CSCDigiMatcher::detid_to_totalwires_
private

Definition at line 133 of file CSCDigiMatcher.h.

◆ detid_to_wires_

std::map<unsigned int, CSCWireDigiContainer> CSCDigiMatcher::detid_to_wires_
private

Definition at line 131 of file CSCDigiMatcher.h.

◆ matchDeltaComparator_

int CSCDigiMatcher::matchDeltaComparator_
private

Definition at line 115 of file CSCDigiMatcher.h.

◆ matchDeltaStrip_

int CSCDigiMatcher::matchDeltaStrip_
private

Definition at line 116 of file CSCDigiMatcher.h.

◆ matchDeltaWG_

int CSCDigiMatcher::matchDeltaWG_
private

Definition at line 117 of file CSCDigiMatcher.h.

◆ maxBXComparator_

int CSCDigiMatcher::maxBXComparator_
private

Definition at line 111 of file CSCDigiMatcher.h.

◆ maxBXStrip_

int CSCDigiMatcher::maxBXStrip_
private

Definition at line 112 of file CSCDigiMatcher.h.

◆ maxBXWire_

int CSCDigiMatcher::maxBXWire_
private

Definition at line 113 of file CSCDigiMatcher.h.

◆ minBXComparator_

int CSCDigiMatcher::minBXComparator_
private

Definition at line 111 of file CSCDigiMatcher.h.

◆ minBXStrip_

int CSCDigiMatcher::minBXStrip_
private

Definition at line 112 of file CSCDigiMatcher.h.

◆ minBXWire_

int CSCDigiMatcher::minBXWire_
private

Definition at line 113 of file CSCDigiMatcher.h.

◆ muonSimHitMatcher_

std::shared_ptr<CSCSimHitMatcher> CSCDigiMatcher::muonSimHitMatcher_
private

Definition at line 109 of file CSCDigiMatcher.h.

Referenced by muonSimHitMatcher().

◆ no_comparators_

CSCComparatorDigiContainer CSCDigiMatcher::no_comparators_
private

Definition at line 135 of file CSCDigiMatcher.h.

◆ no_strips_

CSCStripDigiContainer CSCDigiMatcher::no_strips_
private

Definition at line 136 of file CSCDigiMatcher.h.

◆ no_wires_

CSCWireDigiContainer CSCDigiMatcher::no_wires_
private

Definition at line 137 of file CSCDigiMatcher.h.

◆ stripDigiInput_

edm::EDGetTokenT<CSCStripDigiCollection> CSCDigiMatcher::stripDigiInput_
private

Definition at line 102 of file CSCDigiMatcher.h.

◆ stripDigisH_

edm::Handle<CSCStripDigiCollection> CSCDigiMatcher::stripDigisH_
private

Definition at line 106 of file CSCDigiMatcher.h.

◆ verboseComparator_

int CSCDigiMatcher::verboseComparator_
private

Definition at line 119 of file CSCDigiMatcher.h.

◆ verboseStrip_

int CSCDigiMatcher::verboseStrip_
private

Definition at line 120 of file CSCDigiMatcher.h.

◆ verboseWG_

int CSCDigiMatcher::verboseWG_
private

Definition at line 121 of file CSCDigiMatcher.h.

◆ wireDigiInput_

edm::EDGetTokenT<CSCWireDigiCollection> CSCDigiMatcher::wireDigiInput_
private

Definition at line 103 of file CSCDigiMatcher.h.

◆ wireDigisH_

edm::Handle<CSCWireDigiCollection> CSCDigiMatcher::wireDigisH_
private

Definition at line 107 of file CSCDigiMatcher.h.