8 minBXWire_ = wireDigi.getParameter<
int>(
"minBX");
9 maxBXWire_ = wireDigi.getParameter<
int>(
"maxBX");
10 matchDeltaWG_ = wireDigi.getParameter<
int>(
"matchDeltaWG");
13 verboseComparator_ = comparatorDigi.
getParameter<
int>(
"verbose");
14 minBXComparator_ = comparatorDigi.getParameter<
int>(
"minBX");
15 maxBXComparator_ = comparatorDigi.getParameter<
int>(
"maxBX");
16 matchDeltaComparator_ = comparatorDigi.getParameter<
int>(
"matchDeltaStrip");
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);
88 chamber_to_comparators_[layer_id.
chamberId().
rawId()].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) {
306 result.insert(
d.getStrip());
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) {
324 result.insert(
d.getStrip());
326 if (max_gap_to_fill > 0) {
328 for (
const auto&
s : result) {
329 if (
s - prev > 1 &&
s - prev - 1 <= max_gap_to_fill) {
330 for (
int fill_s = prev + 1; fill_s <
s; ++fill_s)
331 result.insert(fill_s);
342 const auto& digis = stripDigisInChamber(detid);
343 for (
const auto&
d : digis) {
344 result.insert(
d.getStrip());
346 if (max_gap_to_fill > 0) {
348 for (
const auto&
s : result) {
349 if (
s - prev > 1 &&
s - prev - 1 <= max_gap_to_fill) {
350 for (
int fill_s = prev + 1; fill_s <
s; ++fill_s)
351 result.insert(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) {
368 for (
const auto&
w : result) {
369 if (
w - prev > 1 &&
w - prev - 1 <= max_gap_to_fill) {
370 for (
int fill_w = prev + 1; fill_w <
w; ++fill_w)
371 result.insert(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();
std::set< int > stripsInDetId(unsigned int) const
std::set< unsigned int > detIdsWire(int csc_type=MuonHitHelper::CSC_ALL) const
const edm::EventSetup & c
uint16_t *__restrict__ id
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
void match(const SimTrack &t, const SimVertex &v)
do the matching
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const CSCWireDigiContainer & wireDigisInDetId(unsigned int) const
int nLayersWithStripInChamber(unsigned int) const
std::set< unsigned int > chamberIdsWire(int csc_type=MuonHitHelper::CSC_ALL) const
constexpr uint32_t rawId() const
get the raw id
int nLayersWithWireInChamber(unsigned int) const
std::set< unsigned int > chamberIdsComparator(int csc_type=MuonHitHelper::CSC_ALL) const
std::vector< CSCStripDigi > CSCStripDigiContainer
const CSCComparatorDigiContainer & comparatorDigisInDetId(unsigned int) const
const uint16_t range(const Frame &aFrame)
void matchStripsToSimTrack(const CSCStripDigiCollection &strips)
void matchWiresToSimTrack(const CSCWireDigiCollection &wires)
int nCoincidenceComparatorChambers(int min_n_layers=4) const
const CSCStripDigiContainer & stripDigisInChamber(unsigned int) const
std::set< unsigned int > chamberIdsStrip(int csc_type=MuonHitHelper::CSC_ALL) const
int nLayersWithComparatorInChamber(unsigned int) const
tuple 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
CSCDetId chamberId() const
std::set< int > comparatorsInDetId(unsigned int) const
CSCDigiMatcher(edm::ParameterSet const &iPS, edm::ConsumesCollector &&iC)
std::set< int > wiregroupsInChamber(unsigned int, int max_gap_to_fill=0) const
int nCoincidenceWireChambers(int min_n_layers=4) const
void init(const edm::Event &e, const edm::EventSetup &eventSetup)
std::set< unsigned int > detIdsComparator(int csc_type=MuonHitHelper::CSC_ALL) const
std::set< int > stripsInChamber(unsigned int, int max_gap_to_fill=0) const
const CSCWireDigiContainer & wireDigisInChamber(unsigned int) const
int nCoincidenceStripChambers(int min_n_layers=4) const
Log< level::Info, false > LogInfo
std::vector< CSCComparatorDigi > CSCComparatorDigiContainer
std::set< int > wiregroupsInDetId(unsigned int) const
std::vector< CSCWireDigi > CSCWireDigiContainer
ParameterSet const & getParameterSet(std::string const &) const
std::set< int > comparatorsInChamber(unsigned int, int max_gap_to_fill=0) const
T getParameter(std::string const &) const
std::set< unsigned int > detIdsStrip(int csc_type=MuonHitHelper::CSC_ALL) const
void matchComparatorsToSimTrack(const CSCComparatorDigiCollection &comparators)
const CSCStripDigiContainer & stripDigisInDetId(unsigned int) const
const CSCComparatorDigiContainer & comparatorDigisInChamber(unsigned int) const