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,
" "));
71 const auto& comp_digis_in_det = comparators.get(layer_id);
72 for (
auto c = comp_digis_in_det.first;
c != comp_digis_in_det.second; ++
c) {
73 if (verboseComparator_)
74 edm::LogInfo(
"CSCDigiMatcher") <<
"sdigi " << layer_id <<
" (comparator, comparator, Tbin ) " << *
c;
77 if (
c->getTimeBin() < minBXComparator_ ||
c->getTimeBin() > maxBXComparator_)
80 int comparator =
c->getStrip();
82 if (hit_comparators.find(comparator) == hit_comparators.end())
85 if (verboseComparator_)
86 edm::LogInfo(
"CSCDigiMatcher") <<
"Matched comparator " << *
c;
87 detid_to_comparators_[
id].push_back(*
c);
94 for (
auto detUnitIt =
strips.begin(); detUnitIt !=
strips.end(); ++detUnitIt) {
95 const CSCDetId&
id = (*detUnitIt).first;
96 const auto&
range = (*detUnitIt).second;
97 for (
auto digiIt =
range.first; digiIt !=
range.second; ++digiIt) {
100 edm::LogInfo(
"CSCDigiMatcher") <<
"CSCid " <<
id <<
" Strip digi (strip, strip, Tbin ) " << (*digiIt);
104 const auto& det_ids = muonSimHitMatcher_->detIds(0);
105 for (
const auto&
id : det_ids) {
108 const auto& hit_strips = muonSimHitMatcher_->hitStripsInDetId(
id, matchDeltaStrip_);
110 cout <<
"hit_strips_fat, CSCid " << layer_id <<
" ";
111 copy(hit_strips.begin(), hit_strips.end(), ostream_iterator<int>(
cout,
" "));
115 const auto& strip_digis_in_det =
strips.get(layer_id);
116 for (
auto c = strip_digis_in_det.first;
c != strip_digis_in_det.second; ++
c) {
118 edm::LogInfo(
"CSCDigiMatcher") <<
"sdigi " << layer_id <<
" (strip, Tbin ) " << *
c;
120 int strip =
c->getStrip();
122 if (hit_strips.find(
strip) == hit_strips.end())
127 detid_to_strips_[
id].push_back(*
c);
134 const auto& det_ids = muonSimHitMatcher_->detIds(0);
135 for (
const auto&
id : det_ids) {
138 const auto& hit_wires = muonSimHitMatcher_->hitWiregroupsInDetId(
id, matchDeltaWG_);
140 cout <<
"hit_wires ";
141 copy(hit_wires.begin(), hit_wires.end(), ostream_iterator<int>(
cout,
" "));
145 const auto& wire_digis_in_det =
wires.get(layer_id);
146 for (
auto w = wire_digis_in_det.first;
w != wire_digis_in_det.second; ++
w) {
148 edm::LogInfo(
"CSCDigiMatcher") <<
"wdigi " << layer_id <<
" (wire, Tbin ) " << *
w;
151 if (
w->getTimeBin() < minBXWire_ ||
w->getTimeBin() > maxBXWire_)
154 int wg =
w->getWireGroup();
156 if (hit_wires.find(wg) == hit_wires.end())
160 edm::LogInfo(
"CSCDigiMatcher") <<
"Matched wire digi " << *
w << endl;
161 detid_to_wires_[
id].push_back(*
w);
168 return selectDetIds(detid_to_comparators_, csc_type);
172 return selectDetIds(detid_to_strips_, csc_type);
176 return selectDetIds(detid_to_wires_, csc_type);
180 return selectDetIds(chamber_to_comparators_, csc_type);
184 return selectDetIds(chamber_to_strips_, csc_type);
188 return selectDetIds(chamber_to_wires_, csc_type);
192 if (detid_to_comparators_.find(detid) == detid_to_comparators_.end())
193 return no_comparators_;
194 return detid_to_comparators_.at(detid);
198 if (chamber_to_comparators_.find(detid) == chamber_to_comparators_.end())
199 return no_comparators_;
200 return chamber_to_comparators_.at(detid);
204 if (detid_to_strips_.find(detid) == detid_to_strips_.end())
206 return detid_to_strips_.at(detid);
210 if (chamber_to_strips_.find(detid) == chamber_to_strips_.end())
212 return chamber_to_strips_.at(detid);
216 if (detid_to_wires_.find(detid) == detid_to_wires_.end())
218 return detid_to_wires_.at(detid);
222 if (chamber_to_wires_.find(detid) == chamber_to_wires_.end())
224 return chamber_to_wires_.at(detid);
230 for (
int i = 1;
i <= 6; ++
i) {
232 if (!comparatorDigisInDetId(layerId.rawId()).
empty()) {
242 for (
int i = 1;
i <= 6; ++
i) {
244 if (!stripDigisInDetId(layerId.rawId()).
empty()) {
254 for (
int i = 1;
i <= 6; ++
i) {
256 if (!wireDigisInDetId(layerId.rawId()).
empty()) {
265 const auto& chamber_ids = chamberIdsComparator();
266 for (
const auto&
id : chamber_ids) {
267 if (nLayersWithComparatorInChamber(
id) >= min_n_layers)
275 const auto& chamber_ids = chamberIdsStrip();
276 for (
const auto&
id : chamber_ids) {
277 if (nLayersWithStripInChamber(
id) >= min_n_layers)
285 const auto& chamber_ids = chamberIdsWire();
286 for (
const auto&
id : chamber_ids) {
287 if (nLayersWithWireInChamber(
id) >= min_n_layers)
295 const auto& digis = comparatorDigisInDetId(detid);
296 for (
const auto&
d : digis) {
297 result.insert(
d.getHalfStrip());
304 const auto& digis = stripDigisInDetId(detid);
305 for (
const auto&
d : digis) {
313 const auto& digis = wireDigisInDetId(detid);
314 for (
const auto&
d : digis) {
315 result.insert(
d.getWireGroup());
322 const auto& digis = comparatorDigisInChamber(detid);
323 for (
const auto&
d : digis) {
326 if (max_gap_to_fill > 0) {
329 if (
s - prev > 1 &&
s - prev - 1 <= max_gap_to_fill) {
330 for (
int fill_s = prev + 1; fill_s <
s; ++fill_s)
342 const auto& digis = stripDigisInChamber(detid);
343 for (
const auto&
d : digis) {
346 if (max_gap_to_fill > 0) {
349 if (
s - prev > 1 &&
s - prev - 1 <= max_gap_to_fill) {
350 for (
int fill_s = prev + 1; fill_s <
s; ++fill_s)
362 const auto& digis = wireDigisInChamber(detid);
363 for (
const auto&
d : digis) {
364 result.insert(
d.getWireGroup());
366 if (max_gap_to_fill > 0) {
369 if (
w - prev > 1 &&
w - prev - 1 <= max_gap_to_fill) {
370 for (
int fill_w = prev + 1; fill_w <
w; ++fill_w)
380 detid_to_comparators_.clear();
381 chamber_to_comparators_.clear();
383 detid_to_strips_.clear();
384 chamber_to_strips_.clear();
386 detid_to_wires_.clear();
387 chamber_to_wires_.clear();