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);
52 matchComparatorsToSimTrack(comparators);
53 matchStripsToSimTrack(
strips);
54 matchWiresToSimTrack(
wires);
58 for (
auto detUnitIt = comparators.begin(); detUnitIt != comparators.end(); ++detUnitIt) {
59 const CSCDetId&
id = (*detUnitIt).first;
60 const auto&
range = (*detUnitIt).second;
61 for (
auto digiIt =
range.first; digiIt !=
range.second; ++digiIt) {
63 if (verboseComparator_)
64 cout <<
"CSCid " <<
id <<
" Comparator digi (comparator, comparator, Tbin ) " << (*digiIt) << endl;
68 const auto& det_ids = muonSimHitMatcher_->detIds(0);
69 for (
const auto&
id : det_ids) {
72 const auto& hit_comparators = muonSimHitMatcher_->hitStripsInDetId(
id, matchDeltaStrip_);
73 if (verboseComparator_) {
74 cout <<
"hit_comparators_fat, CSCid " << layer_id <<
" ";
75 copy(hit_comparators.begin(), hit_comparators.end(), ostream_iterator<int>(
cout,
" "));
79 const auto& comp_digis_in_det = comparators.get(layer_id);
80 for (
auto c = comp_digis_in_det.first;
c != comp_digis_in_det.second; ++
c) {
81 if (verboseComparator_)
82 cout <<
"sdigi " << layer_id <<
" (comparator, comparator, Tbin ) " << *
c << endl;
85 if (
c->getTimeBin() < minBXComparator_ ||
c->getTimeBin() > maxBXComparator_)
88 int comparator =
c->getStrip();
90 if (hit_comparators.find(comparator) == hit_comparators.end())
93 if (verboseComparator_)
94 cout <<
"Matched comparator " << *
c << endl;
95 detid_to_comparators_[
id].push_back(*
c);
102 for (
auto detUnitIt =
strips.begin(); detUnitIt !=
strips.end(); ++detUnitIt) {
103 const CSCDetId&
id = (*detUnitIt).first;
104 const auto&
range = (*detUnitIt).second;
105 for (
auto digiIt =
range.first; digiIt !=
range.second; ++digiIt) {
108 cout <<
"CSCid " <<
id <<
" Strip digi (strip, strip, Tbin ) " << (*digiIt) << endl;
112 const auto& det_ids = muonSimHitMatcher_->detIds(0);
113 for (
const auto&
id : det_ids) {
116 const auto& hit_strips = muonSimHitMatcher_->hitStripsInDetId(
id, matchDeltaStrip_);
118 cout <<
"hit_strips_fat, CSCid " << layer_id <<
" ";
119 copy(hit_strips.begin(), hit_strips.end(), ostream_iterator<int>(
cout,
" "));
123 const auto& strip_digis_in_det =
strips.get(layer_id);
124 for (
auto c = strip_digis_in_det.first;
c != strip_digis_in_det.second; ++
c) {
126 cout <<
"sdigi " << layer_id <<
" (strip, Tbin ) " << *
c << endl;
128 int strip =
c->getStrip();
130 if (hit_strips.find(
strip) == hit_strips.end())
134 cout <<
"Matched strip " << *
c << endl;
135 detid_to_strips_[
id].push_back(*
c);
142 const auto& det_ids = muonSimHitMatcher_->detIds(0);
143 for (
const auto&
id : det_ids) {
146 const auto& hit_wires = muonSimHitMatcher_->hitWiregroupsInDetId(
id, matchDeltaWG_);
148 cout <<
"hit_wires ";
149 copy(hit_wires.begin(), hit_wires.end(), ostream_iterator<int>(
cout,
" "));
153 const auto& wire_digis_in_det =
wires.get(layer_id);
154 for (
auto w = wire_digis_in_det.first;
w != wire_digis_in_det.second; ++
w) {
156 if (
w->getTimeBin() < minBXWire_ ||
w->getTimeBin() > maxBXWire_)
159 int wg =
w->getWireGroup();
161 if (hit_wires.find(wg) == hit_wires.end())
165 cout <<
"Matched wire digi " << *
w << endl;
166 detid_to_wires_[
id].push_back(*
w);
173 return selectDetIds(detid_to_comparators_, csc_type);
177 return selectDetIds(detid_to_strips_, csc_type);
181 return selectDetIds(detid_to_wires_, csc_type);
185 return selectDetIds(chamber_to_comparators_, csc_type);
189 return selectDetIds(chamber_to_strips_, csc_type);
193 return selectDetIds(chamber_to_wires_, csc_type);
197 if (detid_to_comparators_.find(detid) == detid_to_comparators_.end())
198 return no_comparators_;
199 return detid_to_comparators_.at(detid);
203 if (chamber_to_comparators_.find(detid) == chamber_to_comparators_.end())
204 return no_comparators_;
205 return chamber_to_comparators_.at(detid);
209 if (detid_to_strips_.find(detid) == detid_to_strips_.end())
211 return detid_to_strips_.at(detid);
215 if (chamber_to_strips_.find(detid) == chamber_to_strips_.end())
217 return chamber_to_strips_.at(detid);
221 if (detid_to_wires_.find(detid) == detid_to_wires_.end())
223 return detid_to_wires_.at(detid);
227 if (chamber_to_wires_.find(detid) == chamber_to_wires_.end())
229 return chamber_to_wires_.at(detid);
235 for (
int i = 1;
i <= 6; ++
i) {
237 if (!comparatorDigisInDetId(layerId.rawId()).
empty()) {
247 for (
int i = 1;
i <= 6; ++
i) {
249 if (!stripDigisInDetId(layerId.rawId()).
empty()) {
259 for (
int i = 1;
i <= 6; ++
i) {
261 if (!wireDigisInDetId(layerId.rawId()).
empty()) {
270 const auto& chamber_ids = chamberIdsComparator();
271 for (
const auto&
id : chamber_ids) {
272 if (nLayersWithComparatorInChamber(
id) >= min_n_layers)
280 const auto& chamber_ids = chamberIdsStrip();
281 for (
const auto&
id : chamber_ids) {
282 if (nLayersWithStripInChamber(
id) >= min_n_layers)
290 const auto& chamber_ids = chamberIdsWire();
291 for (
const auto&
id : chamber_ids) {
292 if (nLayersWithWireInChamber(
id) >= min_n_layers)
300 const auto& digis = comparatorDigisInDetId(detid);
301 for (
const auto&
d : digis) {
302 result.insert(
d.getHalfStrip());
309 const auto& digis = stripDigisInDetId(detid);
310 for (
const auto&
d : digis) {
318 const auto& digis = wireDigisInDetId(detid);
319 for (
const auto&
d : digis) {
320 result.insert(
d.getWireGroup());
327 const auto& digis = comparatorDigisInChamber(detid);
328 for (
const auto&
d : digis) {
331 if (max_gap_to_fill > 0) {
335 if (
s - prev > 1 &&
s - prev - 1 <= max_gap_to_fill) {
337 for (
int fill_s = prev + 1; fill_s <
s; ++fill_s)
351 const auto& digis = stripDigisInChamber(detid);
352 for (
const auto&
d : digis) {
355 if (max_gap_to_fill > 0) {
359 if (
s - prev > 1 &&
s - prev - 1 <= max_gap_to_fill) {
361 for (
int fill_s = prev + 1; fill_s <
s; ++fill_s)
375 const auto& digis = wireDigisInChamber(detid);
376 for (
const auto&
d : digis) {
377 result.insert(
d.getWireGroup());
379 if (max_gap_to_fill > 0) {
382 if (
w - prev > 1 &&
w - prev - 1 <= max_gap_to_fill) {
383 for (
int fill_w = prev + 1; fill_w <
w; ++fill_w)