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");
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");
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");
27 comparatorDigiInput_ =
34 muonSimHitMatcher_->init(
iEvent, iSetup);
36 iEvent.getByToken(comparatorDigiInput_, comparatorDigisH_);
37 iEvent.getByToken(stripDigiInput_, stripDigisH_);
38 iEvent.getByToken(wireDigiInput_, wireDigisH_);
44 muonSimHitMatcher_->match(
t,
v);
54 matchComparatorsToSimTrack(comparators);
55 matchStripsToSimTrack(
strips);
56 matchWiresToSimTrack(
wires);
60 const auto& det_ids = muonSimHitMatcher_->detIds(0);
61 for (
const auto&
id : det_ids) {
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,
" "));
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) {
74 if (verboseComparator_)
75 edm::LogInfo(
"CSCDigiMatcher") <<
"sdigi " << layer_id <<
" (comparator, comparator, Tbin ) " << *
c;
78 if (
c->getTimeBin() < minBXComparator_ ||
c->getTimeBin() > maxBXComparator_)
83 int comparator =
c->getStrip();
85 if (hit_comparators.find(comparator) == hit_comparators.end())
88 if (verboseComparator_)
89 edm::LogInfo(
"CSCDigiMatcher") <<
"Matched comparator " << *
c;
90 detid_to_comparators_[
id].push_back(*
c);
93 detid_to_totalcomparators_[
id] = ndigis;
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) {
104 edm::LogInfo(
"CSCDigiMatcher") <<
"CSCid " <<
id <<
" Strip digi (strip, strip, Tbin ) " << (*digiIt);
108 const auto& det_ids = muonSimHitMatcher_->detIds(0);
109 for (
const auto&
id : det_ids) {
112 const auto& hit_strips = muonSimHitMatcher_->hitStripsInDetId(
id, matchDeltaStrip_);
114 cout <<
"hit_strips_fat, CSCid " << layer_id <<
" ";
115 copy(hit_strips.begin(), hit_strips.end(), ostream_iterator<int>(
cout,
" "));
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) {
126 edm::LogInfo(
"CSCDigiMatcher") <<
"sdigi " << layer_id <<
" (strip, ADC ) " << *
c;
130 int strip =
c->getStrip();
132 if (hit_strips.find(
strip) == hit_strips.end())
137 detid_to_strips_[
id].push_back(*
c);
140 detid_to_totalstrips_[
id] = ndigis;
145 const auto& det_ids = muonSimHitMatcher_->detIds(0);
146 for (
const auto&
id : det_ids) {
149 const auto& hit_wires = muonSimHitMatcher_->hitWiregroupsInDetId(
id, matchDeltaWG_);
151 cout <<
"hit_wires ";
152 copy(hit_wires.begin(), hit_wires.end(), ostream_iterator<int>(
cout,
" "));
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) {
161 edm::LogInfo(
"CSCDigiMatcher") <<
"wdigi " << layer_id <<
" (wire, Tbin ) " << *
w;
164 if (
w->getTimeBin() < minBXWire_ ||
w->getTimeBin() > maxBXWire_)
169 int wg =
w->getWireGroup();
171 if (hit_wires.find(wg) == hit_wires.end())
175 edm::LogInfo(
"CSCDigiMatcher") <<
"Matched wire digi " << *
w << endl;
176 detid_to_wires_[
id].push_back(*
w);
179 detid_to_totalwires_[
id] = ndigis;
184 return selectDetIds(detid_to_comparators_, csc_type);
188 return selectDetIds(detid_to_strips_, csc_type);
192 return selectDetIds(detid_to_wires_, csc_type);
196 return selectDetIds(chamber_to_comparators_, csc_type);
200 return selectDetIds(chamber_to_strips_, csc_type);
204 return selectDetIds(chamber_to_wires_, csc_type);
208 if (detid_to_comparators_.find(detid) == detid_to_comparators_.end())
209 return no_comparators_;
210 return detid_to_comparators_.at(detid);
214 if (chamber_to_comparators_.find(detid) == chamber_to_comparators_.end())
215 return no_comparators_;
216 return chamber_to_comparators_.at(detid);
220 if (detid_to_strips_.find(detid) == detid_to_strips_.end())
222 return detid_to_strips_.at(detid);
226 if (chamber_to_strips_.find(detid) == chamber_to_strips_.end())
228 return chamber_to_strips_.at(detid);
232 if (detid_to_wires_.find(detid) == detid_to_wires_.end())
234 return detid_to_wires_.at(detid);
238 if (chamber_to_wires_.find(detid) == chamber_to_wires_.end())
240 return chamber_to_wires_.at(detid);
246 for (
int i = 1;
i <= 6; ++
i) {
248 if (!comparatorDigisInDetId(layerId.rawId()).
empty()) {
258 for (
int i = 1;
i <= 6; ++
i) {
260 if (!stripDigisInDetId(layerId.rawId()).
empty()) {
270 for (
int i = 1;
i <= 6; ++
i) {
272 if (!wireDigisInDetId(layerId.rawId()).
empty()) {
281 const auto& chamber_ids = chamberIdsComparator();
282 for (
const auto&
id : chamber_ids) {
283 if (nLayersWithComparatorInChamber(
id) >= min_n_layers)
291 const auto& chamber_ids = chamberIdsStrip();
292 for (
const auto&
id : chamber_ids) {
293 if (nLayersWithStripInChamber(
id) >= min_n_layers)
301 const auto& chamber_ids = chamberIdsWire();
302 for (
const auto&
id : chamber_ids) {
303 if (nLayersWithWireInChamber(
id) >= min_n_layers)
311 const auto& digis = comparatorDigisInDetId(detid);
312 for (
const auto&
d : digis) {
313 result.insert(
d.getHalfStrip());
320 const auto& digis = stripDigisInDetId(detid);
321 for (
const auto&
d : digis) {
329 const auto& digis = wireDigisInDetId(detid);
330 for (
const auto&
d : digis) {
331 result.insert(
d.getWireGroup());
338 const auto& digis = comparatorDigisInChamber(detid);
339 for (
const auto&
d : digis) {
342 if (max_gap_to_fill > 0) {
345 if (
s - prev > 1 &&
s - prev - 1 <= max_gap_to_fill) {
346 for (
int fill_s = prev + 1; fill_s <
s; ++fill_s)
358 const auto& digis = stripDigisInChamber(detid);
359 for (
const auto&
d : digis) {
362 if (max_gap_to_fill > 0) {
365 if (
s - prev > 1 &&
s - prev - 1 <= max_gap_to_fill) {
366 for (
int fill_s = prev + 1; fill_s <
s; ++fill_s)
378 const auto& digis = wireDigisInChamber(detid);
379 for (
const auto&
d : digis) {
380 result.insert(
d.getWireGroup());
382 if (max_gap_to_fill > 0) {
385 if (
w - prev > 1 &&
w - prev - 1 <= max_gap_to_fill) {
386 for (
int fill_w = prev + 1; fill_w <
w; ++fill_w)
396 if (detid_to_totalcomparators_.find(detid) == detid_to_totalcomparators_.end())
398 return detid_to_totalcomparators_.at(detid);
402 if (detid_to_totalstrips_.find(detid) == detid_to_totalstrips_.end())
404 return detid_to_totalstrips_.at(detid);
408 if (detid_to_totalwires_.find(detid) == detid_to_totalwires_.end())
410 return detid_to_totalwires_.at(detid);
414 detid_to_comparators_.clear();
415 chamber_to_comparators_.clear();
417 detid_to_strips_.clear();
418 chamber_to_strips_.clear();
420 detid_to_wires_.clear();
421 chamber_to_wires_.clear();
std::set< int > comparatorsInDetId(unsigned int) const
int nCoincidenceWireChambers(int min_n_layers=4) const
void match(const SimTrack &t, const SimVertex &v)
do the matching
std::set< unsigned int > detIdsStrip(int csc_type=MuonHitHelper::CSC_ALL) const
int totalWires(unsigned int) const
int totalComparators(unsigned int) const
std::set< int > stripsInDetId(unsigned int) const
std::vector< CSCStripDigi > CSCStripDigiContainer
void matchStripsToSimTrack(const CSCStripDigiCollection &strips)
std::set< int > wiregroupsInDetId(unsigned int) const
void matchWiresToSimTrack(const CSCWireDigiCollection &wires)
std::set< int > stripsInChamber(unsigned int, int max_gap_to_fill=0) const
int nLayersWithStripInChamber(unsigned int) const
int nCoincidenceStripChambers(int min_n_layers=4) const
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
CSCDigiMatcher(edm::ParameterSet const &iPS, edm::ConsumesCollector &&iC)
const CSCComparatorDigiContainer & comparatorDigisInDetId(unsigned int) const
void init(const edm::Event &e, const edm::EventSetup &eventSetup)
int totalStrips(unsigned int) const
const CSCStripDigiContainer & stripDigisInChamber(unsigned int) const
Log< level::Info, false > LogInfo
const CSCWireDigiContainer & wireDigisInChamber(unsigned int) const
std::vector< CSCComparatorDigi > CSCComparatorDigiContainer
std::vector< CSCWireDigi > CSCWireDigiContainer
constexpr uint32_t rawId() const
get the raw id
CSCDetId chamberId() const
void matchComparatorsToSimTrack(const CSCComparatorDigiCollection &comparators)
std::set< unsigned int > chamberIdsComparator(int csc_type=MuonHitHelper::CSC_ALL) const
std::set< unsigned int > chamberIdsStrip(int csc_type=MuonHitHelper::CSC_ALL) const
const CSCWireDigiContainer & wireDigisInDetId(unsigned int) const
std::set< unsigned int > detIdsComparator(int csc_type=MuonHitHelper::CSC_ALL) const
std::set< unsigned int > chamberIdsWire(int csc_type=MuonHitHelper::CSC_ALL) const
std::set< unsigned int > detIdsWire(int csc_type=MuonHitHelper::CSC_ALL) const
const CSCStripDigiContainer & stripDigisInDetId(unsigned int) const
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
int nLayersWithWireInChamber(unsigned int) const
const CSCComparatorDigiContainer & comparatorDigisInChamber(unsigned int) const
std::set< int > comparatorsInChamber(unsigned int, int max_gap_to_fill=0) const
std::set< int > wiregroupsInChamber(unsigned int, int max_gap_to_fill=0) const
int nLayersWithComparatorInChamber(unsigned int) const
int nCoincidenceComparatorChambers(int min_n_layers=4) const