CMS 3D CMS Logo

CSCStubMatcher.cc
Go to the documentation of this file.
3 #include <algorithm>
4 
5 using namespace std;
6 
8  const auto& cscCLCT = pSet.getParameter<edm::ParameterSet>("cscCLCT");
9  minBXCLCT_ = cscCLCT.getParameter<int>("minBX");
10  maxBXCLCT_ = cscCLCT.getParameter<int>("maxBX");
11  verboseCLCT_ = cscCLCT.getParameter<int>("verbose");
12  minNHitsChamberCLCT_ = cscCLCT.getParameter<int>("minNHitsChamber");
13 
14  const auto& cscALCT = pSet.getParameter<edm::ParameterSet>("cscALCT");
15  minBXALCT_ = cscALCT.getParameter<int>("minBX");
16  maxBXALCT_ = cscALCT.getParameter<int>("maxBX");
17  verboseALCT_ = cscALCT.getParameter<int>("verbose");
18  minNHitsChamberALCT_ = cscALCT.getParameter<int>("minNHitsChamber");
19 
20  const auto& cscLCT = pSet.getParameter<edm::ParameterSet>("cscLCT");
21  minBXLCT_ = cscLCT.getParameter<int>("minBX");
22  maxBXLCT_ = cscLCT.getParameter<int>("maxBX");
23  verboseLCT_ = cscLCT.getParameter<int>("verbose");
24  minNHitsChamberLCT_ = cscLCT.getParameter<int>("minNHitsChamber");
25  addGhostLCTs_ = cscLCT.getParameter<bool>("addGhosts");
26 
27  const auto& cscMPLCT = pSet.getParameter<edm::ParameterSet>("cscMPLCT");
28  minBXMPLCT_ = cscMPLCT.getParameter<int>("minBX");
29  maxBXMPLCT_ = cscMPLCT.getParameter<int>("maxBX");
30  verboseMPLCT_ = cscMPLCT.getParameter<int>("verbose");
31  minNHitsChamberMPLCT_ = cscMPLCT.getParameter<int>("minNHitsChamber");
32 
33  gemDigiMatcher_.reset(new GEMDigiMatcher(pSet, std::move(iC)));
34  cscDigiMatcher_.reset(new CSCDigiMatcher(pSet, std::move(iC)));
35 
36  clctToken_ = iC.consumes<CSCCLCTDigiCollection>(cscCLCT.getParameter<edm::InputTag>("inputTag"));
37  alctToken_ = iC.consumes<CSCALCTDigiCollection>(cscALCT.getParameter<edm::InputTag>("inputTag"));
38  lctToken_ = iC.consumes<CSCCorrelatedLCTDigiCollection>(cscLCT.getParameter<edm::InputTag>("inputTag"));
39  mplctToken_ = iC.consumes<CSCCorrelatedLCTDigiCollection>(cscMPLCT.getParameter<edm::InputTag>("inputTag"));
40 
41  geomToken_ = iC.esConsumes<CSCGeometry, MuonGeometryRecord>();
42 }
43 
45  gemDigiMatcher_->init(iEvent, iSetup);
46  cscDigiMatcher_->init(iEvent, iSetup);
47 
48  iEvent.getByToken(clctToken_, clctsH_);
49  iEvent.getByToken(alctToken_, alctsH_);
50  iEvent.getByToken(lctToken_, lctsH_);
51  iEvent.getByToken(mplctToken_, mplctsH_);
52 
53  cscGeometry_ = &iSetup.getData(geomToken_);
54 }
55 
56 // do the matching
57 void CSCStubMatcher::match(const SimTrack& t, const SimVertex& v) {
58  // match simhits first
59  gemDigiMatcher_->match(t, v);
60  cscDigiMatcher_->match(t, v);
61 
62  const CSCCLCTDigiCollection& clcts = *clctsH_.product();
63  const CSCALCTDigiCollection& alcts = *alctsH_.product();
64  const CSCCorrelatedLCTDigiCollection& lcts = *lctsH_.product();
65  const CSCCorrelatedLCTDigiCollection& mplcts = *mplctsH_.product();
66 
67  // clear collections
68  clear();
69 
70  matchCLCTsToSimTrack(clcts);
71  matchALCTsToSimTrack(alcts);
72  matchLCTsToSimTrack(lcts);
73  matchMPLCTsToSimTrack(mplcts);
74 }
75 
77  const auto& cathode_ids = cscDigiMatcher_->chamberIdsStrip(0);
78 
79  for (const auto& id : cathode_ids) {
80  CSCDetId ch_id(id);
81  if (verboseCLCT_) {
82  edm::LogInfo("CSCStubMatcher") << "To check CSC chamber " << ch_id;
83  }
84 
85  int ring = ch_id.ring();
86 
87  // do not consider CSCs with too few hits
88  if (cscDigiMatcher_->nLayersWithStripInChamber(ch_id) < minNHitsChamberCLCT_)
89  continue;
90 
91  // get the comparator digis in this chamber
92  std::vector<CSCComparatorDigiContainer> comps;
93  for (int ilayer = 1; ilayer <= 6; ilayer++) {
94  CSCDetId layerid(ch_id.endcap(), ch_id.station(), ring, ch_id.chamber(), ilayer);
95  comps.push_back(cscDigiMatcher_->comparatorDigisInDetId(layerid));
96  }
97 
98  // print out the digis
99  if (verboseCLCT_) {
100  edm::LogInfo("CSCStubMatcher") << "clct: comparators " << ch_id;
101  int layer = 0;
102  for (const auto& p : comps) {
103  layer++;
104  for (const auto& q : p) {
105  edm::LogInfo("CSCStubMatcher") << "L" << layer << " " << q << " " << q.getHalfStrip() << " ";
106  }
107  }
108  }
109 
110  //use ME1b id to get CLCTs
111  const bool isME1a(ch_id.station() == 1 and ch_id.ring() == 4);
112  if (isME1a)
113  ring = 1;
114  CSCDetId ch_id2(ch_id.endcap(), ch_id.station(), ring, ch_id.chamber(), 0);
115 
116  const auto& clcts_in_det = clcts.get(ch_id2);
117 
118  for (auto c = clcts_in_det.first; c != clcts_in_det.second; ++c) {
119  if (verboseCLCT_)
120  edm::LogInfo("CSCStubMatcher") << "clct " << ch_id2 << " " << *c;
121 
122  if (!c->isValid())
123  continue;
124 
125  // check that the BX for this stub wasn't too early or too late
126  if (c->getBX() < minBXCLCT_ || c->getBX() > maxBXCLCT_)
127  continue;
128 
129  // store all CLCTs in this chamber
130  chamber_to_clcts_all_[id].push_back(*c);
131 
132  // check that at least 3 comparator digis were matched!
133  int nMatches = 0;
134  int layer = 0;
135  for (const auto& p : comps) {
136  layer++;
137  for (const auto& q : p) {
138  if (verboseCLCT_)
139  edm::LogInfo("CSCStubMatcher") << "L" << layer << " " << q << " " << q.getHalfStrip() << " " << std::endl;
140  for (const auto& clctComp : (*c).getHits()[layer - 1]) {
141  if (clctComp == 65535)
142  continue;
143  if (verboseCLCT_) {
144  edm::LogInfo("CSCStubMatcher") << "\t" << clctComp << " ";
145  }
146  if (q.getHalfStrip() == clctComp or (isME1a and q.getHalfStrip() + 128 == clctComp)) {
147  nMatches++;
148  if (verboseCLCT_) {
149  edm::LogInfo("CSCStubMatcher") << "\t\tnMatches " << nMatches << std::endl;
150  }
151  }
152  }
153  }
154  }
155 
156  // require at least 3 good matches
157  if (nMatches < 3)
158  continue;
159 
160  if (verboseCLCT_)
161  edm::LogInfo("CSCStubMatcher") << "clctGOOD";
162 
163  // store matching CLCTs in this chamber
164  if (std::find(chamber_to_clcts_[id].begin(), chamber_to_clcts_[id].end(), *c) == chamber_to_clcts_[id].end()) {
165  chamber_to_clcts_[id].push_back(*c);
166  }
167  }
168  if (chamber_to_clcts_[id].size() > 2) {
169  edm::LogInfo("CSCStubMatcher") << "WARNING!!! too many CLCTs " << chamber_to_clcts_[id].size() << " in " << ch_id;
170  for (auto& c : chamber_to_clcts_[id])
171  edm::LogInfo("CSCStubMatcher") << " " << c;
172  }
173  }
174 }
175 
177  const auto& anode_ids = cscDigiMatcher_->chamberIdsWire(0);
178  int n_minLayers = 0;
179  for (const auto& id : anode_ids) {
180  if (cscDigiMatcher_->nLayersWithWireInChamber(id) >= minNHitsChamberALCT_)
181  ++n_minLayers;
182  CSCDetId ch_id(id);
183 
184  // fill 1 WG wide gaps
185  const auto& digi_wgs = cscDigiMatcher_->wiregroupsInChamber(id, 1);
186  if (verboseALCT_) {
187  cout << "alct: digi_wgs " << ch_id << " ";
188  copy(digi_wgs.begin(), digi_wgs.end(), ostream_iterator<int>(cout, " "));
189  cout << endl;
190  }
191 
192  int ring = ch_id.ring();
193  if (ring == 4)
194  ring = 1; //use ME1b id to get CLCTs
195  CSCDetId ch_id2(ch_id.endcap(), ch_id.station(), ring, ch_id.chamber(), 0);
196 
197  const auto& alcts_in_det = alcts.get(ch_id2);
198  for (auto a = alcts_in_det.first; a != alcts_in_det.second; ++a) {
199  if (!a->isValid())
200  continue;
201 
202  if (verboseALCT_)
203  edm::LogInfo("CSCStubMatcher") << "alct " << ch_id << " " << *a;
204 
205  // check that the BX for stub wasn't too early or too late
206  if (a->getBX() < minBXALCT_ || a->getBX() > maxBXALCT_)
207  continue;
208 
209  int wg = a->getKeyWG() + 1; // as ALCT wiregroups numbers start from 0
210 
211  // store all ALCTs in this chamber
212  chamber_to_alcts_all_[id].push_back(*a);
213 
214  // match by wiregroup with the digis
215  if (digi_wgs.find(wg) == digi_wgs.end()) {
216  continue;
217  }
218  if (verboseALCT_)
219  edm::LogInfo("CSCStubMatcher") << "alctGOOD";
220 
221  // store matching ALCTs in this chamber
222  if (std::find(chamber_to_alcts_[id].begin(), chamber_to_alcts_[id].end(), *a) == chamber_to_alcts_[id].end()) {
223  chamber_to_alcts_[id].push_back(*a);
224  }
225  }
226  if (chamber_to_alcts_[id].size() > 2) {
227  edm::LogInfo("CSCStubMatcher") << "WARNING!!! too many ALCTs " << chamber_to_alcts_[id].size() << " in " << ch_id;
228  for (auto& a : chamber_to_alcts_[id])
229  edm::LogInfo("CSCStubMatcher") << " " << a;
230  }
231  }
232 }
233 
235  // only look for stubs in chambers that already have CLCT and ALCT
236  const auto& cathode_ids = chamberIdsAllCLCT(0);
237  const auto& anode_ids = chamberIdsAllALCT(0);
238 
239  std::set<int> cathode_and_anode_ids;
240  std::set_union(cathode_ids.begin(),
241  cathode_ids.end(),
242  anode_ids.begin(),
243  anode_ids.end(),
244  std::inserter(cathode_and_anode_ids, cathode_and_anode_ids.end()));
245 
246  for (const auto& id : cathode_and_anode_ids) {
247  int iLct = -1;
248 
249  CSCDetId ch_id(id);
250 
251  //use ME1b id to get LCTs
252  int ring = ch_id.ring();
253  if (ring == 4)
254  ring = 1;
255  CSCDetId ch_id2(ch_id.endcap(), ch_id.station(), ring, ch_id.chamber(), 0);
256 
257  const auto& lcts_in_det = lcts.get(ch_id2);
258 
259  std::map<int, CSCCorrelatedLCTDigiContainer> bx_to_lcts;
260 
261  // collect all valid LCTs in a handy container
263  for (auto lct = lcts_in_det.first; lct != lcts_in_det.second; ++lct) {
264  if (!lct->isValid())
265  continue;
266  lcts_tmp.push_back(*lct);
267  int bx = lct->getBX();
268  bx_to_lcts[bx].push_back(*lct);
269 
270  // Add ghost LCTs when there are two in bx
271  // and the two don't share half-strip or wiregroup
272  if (bx_to_lcts[bx].size() == 2 and addGhostLCTs_) {
273  // don't do this in station ME1/1 or ME2/1
274  if (!(ch_id.ring() == 1 and (ch_id.station() == 1 or ch_id.station() == 2))) {
275  auto lct11 = bx_to_lcts[bx][0];
276  auto lct22 = bx_to_lcts[bx][1];
277  int wg1 = lct11.getKeyWG();
278  int wg2 = lct22.getKeyWG();
279  int hs1 = lct11.getStrip();
280  int hs2 = lct22.getStrip();
281 
282  if (!(wg1 == wg2 || hs1 == hs2) and lct11.getType() == CSCCorrelatedLCTDigi::ALCTCLCT and
283  lct22.getType() == CSCCorrelatedLCTDigi::ALCTCLCT) {
284  CSCCorrelatedLCTDigi lct12 = lct11;
285  lct12.setWireGroup(wg2);
286  lct12.setALCT(lct22.getALCT());
287  lcts_tmp.push_back(lct12);
288 
289  CSCCorrelatedLCTDigi lct21 = lct22;
290  lct21.setWireGroup(wg1);
291  lct21.setALCT(lct11.getALCT());
292  lcts_tmp.push_back(lct21);
293  }
294  }
295  }
296  }
297 
298  for (const auto& lct : lcts_tmp) {
299  iLct++;
300 
301  bool lct_clct_match(false);
302  bool lct_alct_match(false);
303  bool lct_gem1_match(false);
304  bool lct_gem2_match(false);
305 
306  if (verboseLCT_) {
307  edm::LogInfo("CSCStubMatcher") << ch_id << " " << ch_id2;
308  edm::LogInfo("CSCStubMatcher") << lct;
309  edm::LogInfo("CSCStubMatcher") << "getCLCT " << lct.getCLCT() << "\ngetALCT " << lct.getALCT() << "\ngetGEM1 "
310  << lct.getGEM1() << "\ngetGEM2 " << lct.getGEM2();
311  }
312  // Check if matched to an CLCT
313  for (const auto& p : clctsInChamber(id)) {
314  if (p == lct.getCLCT()) {
315  lct_clct_match = true;
316  if (verboseLCT_)
317  edm::LogInfo("CSCStubMatcher") << "\t...lct_clct_match";
318  break;
319  }
320  }
321 
322  // Check if matched to an ALCT
323  for (const auto& p : alctsInChamber(id)) {
324  if (p == lct.getALCT()) {
325  lct_alct_match = true;
326  if (verboseLCT_)
327  edm::LogInfo("CSCStubMatcher") << "\t...lct_alct_match";
328  break;
329  }
330  }
331 
332  // fixME here: double check the timing of GEMPad
333  if (ch_id.ring() == 1 and (ch_id.station() == 1 or ch_id.station() == 2)) {
334  // Check if matched to an GEM pad L1
335  const GEMDetId gemDetIdL1(ch_id.zendcap(), 1, ch_id.station(), 1, ch_id.chamber(), 0);
336  for (const auto& p : gemDigiMatcher_->padsInChamber(gemDetIdL1.rawId())) {
337  if (p == lct.getGEM1()) {
338  lct_gem1_match = true;
339  if (verboseLCT_)
340  edm::LogInfo("CSCStubMatcher") << "\t...lct_gem1_match";
341  break;
342  }
343  }
344 
345  // Check if matched to an GEM pad L2
346  const GEMDetId gemDetIdL2(ch_id.zendcap(), 1, ch_id.station(), 2, ch_id.chamber(), 0);
347  for (const auto& p : gemDigiMatcher_->padsInChamber(gemDetIdL2.rawId())) {
348  if (p == lct.getGEM2()) {
349  lct_gem2_match = true;
350  if (verboseLCT_)
351  edm::LogInfo("CSCStubMatcher") << "\t...lct_gem2_match";
352  break;
353  }
354  }
355  }
356 
357  const bool alct_clct = lct_clct_match and lct_alct_match;
358  const bool alct_gem = lct_alct_match and lct_gem1_match and lct_gem2_match;
359  const bool clct_gem = lct_clct_match and lct_gem1_match and lct_gem2_match;
360 
361  bool lct_tight_matched = alct_clct or alct_gem or clct_gem;
362  bool lct_loose_matched = lct_clct_match or lct_alct_match;
363  bool lct_matched = lct_loose_matched or lct_tight_matched;
364 
365  if (lct_matched) {
366  if (verboseLCT_)
367  edm::LogInfo("CSCStubMatcher") << "...was matched";
368  if (std::find(chamber_to_lcts_[id].begin(), chamber_to_lcts_[id].end(), lct) == chamber_to_lcts_[id].end()) {
369  chamber_to_lcts_[id].emplace_back(lct);
370  }
371  }
372  } // lct loop over
373  }
374 }
375 
377  // match simtrack to MPC LCT by looking only in chambers
378  // that already have LCTs matched to this simtrack
379  const auto& lcts_ids = chamberIdsLCT(0);
380 
381  // loop on the detids
382  for (const auto& id : lcts_ids) {
383  const auto& mplcts_in_det = mplcts.get(id);
384 
385  // loop on the MPC LCTs in this detid
386  for (auto lct = mplcts_in_det.first; lct != mplcts_in_det.second; ++lct) {
387  if (!lct->isValid())
388  continue;
389 
390  chamber_to_mplcts_all_[id].emplace_back(*lct);
391 
392  // check if this stub corresponds with a previously matched stub
393  for (const auto& sim_stub : lctsInChamber(id)) {
394  if (sim_stub == *lct) {
395  if (std::find(chamber_to_mplcts_[id].begin(), chamber_to_mplcts_[id].end(), *lct) ==
396  chamber_to_mplcts_[id].end()) {
397  chamber_to_mplcts_[id].emplace_back(*lct);
398  }
399  }
400  }
401  }
402  }
403 }
404 
405 std::set<unsigned int> CSCStubMatcher::chamberIdsAllCLCT(int csc_type) const {
406  return selectDetIds(chamber_to_clcts_all_, csc_type);
407 }
408 
409 std::set<unsigned int> CSCStubMatcher::chamberIdsAllALCT(int csc_type) const {
410  return selectDetIds(chamber_to_alcts_all_, csc_type);
411 }
412 
413 std::set<unsigned int> CSCStubMatcher::chamberIdsAllLCT(int csc_type) const {
414  return selectDetIds(chamber_to_lcts_all_, csc_type);
415 }
416 
417 std::set<unsigned int> CSCStubMatcher::chamberIdsAllMPLCT(int csc_type) const {
418  return selectDetIds(chamber_to_mplcts_all_, csc_type);
419 }
420 
421 std::set<unsigned int> CSCStubMatcher::chamberIdsCLCT(int csc_type) const {
422  return selectDetIds(chamber_to_clcts_, csc_type);
423 }
424 
425 std::set<unsigned int> CSCStubMatcher::chamberIdsALCT(int csc_type) const {
426  return selectDetIds(chamber_to_alcts_, csc_type);
427 }
428 
429 std::set<unsigned int> CSCStubMatcher::chamberIdsLCT(int csc_type) const {
430  return selectDetIds(chamber_to_lcts_, csc_type);
431 }
432 
433 std::set<unsigned int> CSCStubMatcher::chamberIdsMPLCT(int csc_type) const {
434  return selectDetIds(chamber_to_mplcts_, csc_type);
435 }
436 
437 const CSCCLCTDigiContainer& CSCStubMatcher::allCLCTsInChamber(unsigned int detid) const {
438  if (chamber_to_clcts_all_.find(detid) == chamber_to_clcts_all_.end())
439  return no_clcts_;
440  return chamber_to_clcts_all_.at(detid);
441 }
442 
443 const CSCALCTDigiContainer& CSCStubMatcher::allALCTsInChamber(unsigned int detid) const {
444  if (chamber_to_alcts_all_.find(detid) == chamber_to_alcts_all_.end())
445  return no_alcts_;
446  return chamber_to_alcts_all_.at(detid);
447 }
448 
450  if (chamber_to_lcts_all_.find(detid) == chamber_to_lcts_all_.end())
451  return no_lcts_;
452  return chamber_to_lcts_all_.at(detid);
453 }
454 
456  if (chamber_to_mplcts_all_.find(detid) == chamber_to_mplcts_all_.end())
457  return no_mplcts_;
458  return chamber_to_mplcts_all_.at(detid);
459 }
460 
461 const CSCCLCTDigiContainer& CSCStubMatcher::clctsInChamber(unsigned int detid) const {
462  if (chamber_to_clcts_.find(detid) == chamber_to_clcts_.end())
463  return no_clcts_;
464  return chamber_to_clcts_.at(detid);
465 }
466 
467 const CSCALCTDigiContainer& CSCStubMatcher::alctsInChamber(unsigned int detid) const {
468  if (chamber_to_alcts_.find(detid) == chamber_to_alcts_.end())
469  return no_alcts_;
470  return chamber_to_alcts_.at(detid);
471 }
472 
474  if (chamber_to_lcts_.find(detid) == chamber_to_lcts_.end())
475  return no_lcts_;
476  return chamber_to_lcts_.at(detid);
477 }
478 
480  if (chamber_to_mplcts_.find(detid) == chamber_to_mplcts_.end())
481  return no_mplcts_;
482  return chamber_to_mplcts_.at(detid);
483 }
484 
486  //sort stubs based on quality
487  const auto& input(clctsInChamber(detid));
488  int bestQ = 0;
489  int index = -1;
490  for (unsigned int i = 0; i < input.size(); ++i) {
491  int quality = input[i].getQuality();
492  if (quality > bestQ) {
493  bestQ = quality;
494  index = i;
495  }
496  }
497  if (index != -1)
498  return input[index];
499  return CSCCLCTDigi();
500 }
501 
503  //sort stubs based on quality
504  const auto& input(alctsInChamber(detid));
505  int bestQ = 0;
506  int index = -1;
507  for (unsigned int i = 0; i < input.size(); ++i) {
508  int quality = input[i].getQuality();
509  if (quality > bestQ) {
510  bestQ = quality;
511  index = i;
512  }
513  }
514  if (index != -1)
515  return input[index];
516  return CSCALCTDigi();
517 }
518 
520  //sort stubs based on quality
521  const auto& input(lctsInChamber(detid));
522  int bestQ = 0;
523  int index = -1;
524  for (unsigned int i = 0; i < input.size(); ++i) {
525  int quality = input[i].getQuality();
526  if (quality > bestQ) {
527  bestQ = quality;
528  index = i;
529  }
530  }
531  if (index != -1)
532  return input[index];
533  return CSCCorrelatedLCTDigi();
534 }
535 
536 float CSCStubMatcher::zpositionOfLayer(unsigned int detid, int layer) const {
537  const auto& id = CSCDetId(detid);
538  const auto& chamber(cscGeometry_->chamber(id));
539  return fabs(chamber->layer(layer)->centerOfStrip(20).z());
540 }
541 
542 int CSCStubMatcher::nChambersWithCLCT(int min_quality) const {
543  int result = 0;
544  const auto& chamber_ids = chamberIdsCLCT();
545  for (const auto& id : chamber_ids) {
546  int nStubChamber = 0;
547  const auto& clcts = clctsInChamber(id);
548  for (const auto& clct : clcts) {
549  if (!clct.isValid())
550  continue;
551  if (clct.getQuality() >= min_quality) {
552  nStubChamber++;
553  }
554  }
555  if (nStubChamber > 0) {
556  ++result;
557  }
558  }
559  return result;
560 }
561 
562 int CSCStubMatcher::nChambersWithALCT(int min_quality) const {
563  int result = 0;
564  const auto& chamber_ids = chamberIdsALCT();
565  for (const auto& id : chamber_ids) {
566  int nStubChamber = 0;
567  const auto& alcts = alctsInChamber(id);
568  for (const auto& alct : alcts) {
569  if (!alct.isValid())
570  continue;
571  if (alct.getQuality() >= min_quality) {
572  nStubChamber++;
573  }
574  }
575  if (nStubChamber > 0) {
576  ++result;
577  }
578  }
579  return result;
580 }
581 
582 int CSCStubMatcher::nChambersWithLCT(int min_quality) const {
583  int result = 0;
584  const auto& chamber_ids = chamberIdsLCT();
585  for (const auto& id : chamber_ids) {
586  int nStubChamber = 0;
587  const auto& lcts = lctsInChamber(id);
588  for (const auto& lct : lcts) {
589  if (!lct.isValid())
590  continue;
591  if (lct.getQuality() >= min_quality) {
592  nStubChamber++;
593  }
594  }
595  if (nStubChamber > 0) {
596  ++result;
597  }
598  }
599  return result;
600 }
601 
602 int CSCStubMatcher::nChambersWithMPLCT(int min_quality) const {
603  int result = 0;
604  const auto& chamber_ids = chamberIdsMPLCT();
605  for (const auto& id : chamber_ids) {
606  int nStubChamber = 0;
607  const auto& mplcts = mplctsInChamber(id);
608  for (const auto& mplct : mplcts) {
609  if (!mplct.isValid())
610  continue;
611  if (mplct.getQuality() >= min_quality) {
612  nStubChamber++;
613  }
614  }
615  if (nStubChamber > 0) {
616  ++result;
617  }
618  }
619  return result;
620 }
621 
622 bool CSCStubMatcher::lctInChamber(const CSCDetId& id, const CSCCorrelatedLCTDigi& lct) const {
623  for (const auto& stub : lctsInChamber(id.rawId())) {
624  if (stub == lct)
625  return true;
626  }
627  return false;
628 }
629 
631  CSCDetId cscId(rawId);
632  CSCDetId key_id(cscId.endcap(), cscId.station(), cscId.ring(), cscId.chamber(), CSCConstants::KEY_CLCT_LAYER);
633  const auto& chamber = cscGeometry_->chamber(cscId);
634  float fractional_strip = lct.getFractionalStrip();
635  const auto& layer_geo = chamber->layer(CSCConstants::KEY_CLCT_LAYER)->geometry();
636  // LCT::getKeyWG() also starts from 0
637  float wire = layer_geo->middleWireOfGroup(lct.getKeyWG() + 1);
638  const LocalPoint& csc_intersect = layer_geo->intersectionOfStripAndWire(fractional_strip, wire);
639  const GlobalPoint& csc_gp = cscGeometry_->idToDet(key_id)->surface().toGlobal(csc_intersect);
640  return csc_gp;
641 }
642 
644  chamber_to_clcts_all_.clear();
645  chamber_to_alcts_all_.clear();
646  chamber_to_lcts_all_.clear();
647  chamber_to_mplcts_all_.clear();
648 
649  chamber_to_clcts_.clear();
650  chamber_to_alcts_.clear();
651  chamber_to_lcts_.clear();
652  chamber_to_mplcts_.clear();
653 }
CSCStubMatcher::clear
void clear()
Definition: CSCStubMatcher.cc:643
CSCStubMatcher::allLCTsInChamber
const CSCCorrelatedLCTDigiContainer & allLCTsInChamber(unsigned int) const
Definition: CSCStubMatcher.cc:449
mps_fire.i
i
Definition: mps_fire.py:428
CSCStubMatcher::bestAlctInChamber
CSCALCTDigi bestAlctInChamber(unsigned int) const
Definition: CSCStubMatcher.cc:502
CSCStubMatcher::alctsInChamber
const CSCALCTDigiContainer & alctsInChamber(unsigned int) const
Definition: CSCStubMatcher.cc:467
input
static const std::string input
Definition: EdmProvDump.cc:48
SimVertex
Definition: SimVertex.h:5
filterCSVwithJSON.copy
copy
Definition: filterCSVwithJSON.py:36
CSCStubMatcher::getGlobalPosition
GlobalPoint getGlobalPosition(unsigned int rawId, const CSCCorrelatedLCTDigi &lct) const
Definition: CSCStubMatcher.cc:630
CSCDetId::ring
int ring() const
Definition: CSCDetId.h:68
CSCDetId::zendcap
short int zendcap() const
Definition: CSCDetId.h:91
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
gather_cfg.cout
cout
Definition: gather_cfg.py:144
CSCCorrelatedLCTDigi::getKeyWG
uint16_t getKeyWG() const
return the key wire group. counts from 0.
Definition: CSCCorrelatedLCTDigi.h:61
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
CSCStubMatcher::lctsInChamber
const CSCCorrelatedLCTDigiContainer & lctsInChamber(unsigned int) const
Definition: CSCStubMatcher.cc:473
GEMDigiMatcher
Definition: GEMDigiMatcher.h:31
CSCStubMatcher::nChambersWithLCT
int nChambersWithLCT(int min_quality=0) const
Definition: CSCStubMatcher.cc:582
CSCCorrelatedLCTDigi::setWireGroup
void setWireGroup(const uint16_t wiregroup)
set wiregroup number
Definition: CSCCorrelatedLCTDigi.h:150
CSCCorrelatedLCTDigiContainer
std::vector< CSCCorrelatedLCTDigi > CSCCorrelatedLCTDigiContainer
Definition: CSCStubMatcher.h:20
CSCCorrelatedLCTDigi::getFractionalStrip
float getFractionalStrip(uint16_t n=2) const
return the fractional strip
Definition: CSCCorrelatedLCTDigi.cc:124
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
findQualityFiles.v
v
Definition: findQualityFiles.py:179
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
CSCCLCTDigi
Definition: CSCCLCTDigi.h:17
CSCCorrelatedLCTDigi::ALCTCLCT
Definition: CSCCorrelatedLCTDigi.h:196
CSCStubMatcher::nChambersWithMPLCT
int nChambersWithMPLCT(int min_quality=0) const
Definition: CSCStubMatcher.cc:602
CSCGeometry
Definition: CSCGeometry.h:24
CSCCorrelatedLCTDigi::setALCT
void setALCT(const CSCALCTDigi &alct)
Definition: CSCCorrelatedLCTDigi.h:209
CSCStubMatcher::bestClctInChamber
CSCCLCTDigi bestClctInChamber(unsigned int) const
best matching from a particular crossed chamber
Definition: CSCStubMatcher.cc:485
CSCStubMatcher::allCLCTsInChamber
const CSCCLCTDigiContainer & allCLCTsInChamber(unsigned int) const
all stubs (not necessarily matching) from a particular crossed chamber
Definition: CSCStubMatcher.cc:437
CSCStubMatcher::bestLctInChamber
CSCCorrelatedLCTDigi bestLctInChamber(unsigned int) const
Definition: CSCStubMatcher.cc:519
mps_fire.end
end
Definition: mps_fire.py:242
CSCConstants.h
CSCStubMatcher::clctsInChamber
const CSCCLCTDigiContainer & clctsInChamber(unsigned int) const
all matching from a particular crossed chamber
Definition: CSCStubMatcher.cc:461
Point3DBase< float, GlobalTag >
CSCStubMatcher::allMPLCTsInChamber
const CSCCorrelatedLCTDigiContainer & allMPLCTsInChamber(unsigned int) const
Definition: CSCStubMatcher.cc:455
CSCDigiMatcher
Definition: CSCDigiMatcher.h:25
muonCSCStubPSet.cscMPLCT
cscMPLCT
Definition: muonCSCStubPSet.py:30
CSCCLCTDigiContainer
std::vector< CSCCLCTDigi > CSCCLCTDigiContainer
Definition: CSCStubMatcher.h:19
CSCStubMatcher::matchMPLCTsToSimTrack
void matchMPLCTsToSimTrack(const CSCCorrelatedLCTDigiCollection &)
Definition: CSCStubMatcher.cc:376
CSCStubMatcher::mplctsInChamber
const CSCCorrelatedLCTDigiContainer & mplctsInChamber(unsigned int) const
Definition: CSCStubMatcher.cc:479
CSCStubMatcher::matchCLCTsToSimTrack
void matchCLCTsToSimTrack(const CSCCLCTDigiCollection &)
Definition: CSCStubMatcher.cc:76
edm::ParameterSet
Definition: ParameterSet.h:47
a
double a
Definition: hdecay.h:119
clear
void clear(HadCaloObj &c)
Definition: data.h:124
CSCStubMatcher.h
CSCStubMatcher::matchALCTsToSimTrack
void matchALCTsToSimTrack(const CSCALCTDigiCollection &)
Definition: CSCStubMatcher.cc:176
GEMDetId
Definition: GEMDetId.h:18
CSCStubMatcher::chamberIdsAllMPLCT
std::set< unsigned int > chamberIdsAllMPLCT(int csc_type=MuonHitHelper::CSC_ALL) const
Definition: CSCStubMatcher.cc:417
CSCDetId
Definition: CSCDetId.h:26
CSCStubMatcher::chamberIdsMPLCT
std::set< unsigned int > chamberIdsMPLCT(int csc_type=MuonHitHelper::CSC_ALL) const
Definition: CSCStubMatcher.cc:433
CSCStubMatcher::init
void init(const edm::Event &e, const edm::EventSetup &eventSetup)
initialize the event
Definition: CSCStubMatcher.cc:44
iEvent
int iEvent
Definition: GenABIO.cc:224
CSCStubMatcher::chamberIdsAllALCT
std::set< unsigned int > chamberIdsAllALCT(int csc_type=MuonHitHelper::CSC_ALL) const
Definition: CSCStubMatcher.cc:409
CSCALCTDigiCollection
CSCStubMatcher::nChambersWithCLCT
int nChambersWithCLCT(int min_quality=0) const
How many CSC chambers with matching stubs of some minimal quality did this SimTrack hit?
Definition: CSCStubMatcher.cc:542
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
CSCDetId::chamber
int chamber() const
Definition: CSCDetId.h:62
edm::EventSetup
Definition: EventSetup.h:57
CSCCorrelatedLCTDigiCollection
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
muonCSCStubPSet.cscCLCT
cscCLCT
Definition: muonCSCStubPSet.py:5
CSCALCTDigiContainer
std::vector< CSCALCTDigi > CSCALCTDigiContainer
Definition: CSCStubMatcher.h:18
muonCSCStubPSet.cscALCT
cscALCT
Definition: muonCSCStubPSet.py:13
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:120
CSCStubMatcher::CSCStubMatcher
CSCStubMatcher(edm::ParameterSet const &iPS, edm::ConsumesCollector &&iC)
Definition: CSCStubMatcher.cc:7
CSCStubMatcher::chamberIdsAllCLCT
std::set< unsigned int > chamberIdsAllCLCT(int csc_type=MuonHitHelper::CSC_ALL) const
crossed chamber detIds with not necessarily matching stubs
Definition: CSCStubMatcher.cc:405
muonCSCStubPSet.cscLCT
cscLCT
Definition: muonCSCStubPSet.py:21
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
qcdUeDQM_cfi.quality
quality
Definition: qcdUeDQM_cfi.py:31
SimTrack
Definition: SimTrack.h:6
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
CSCDetId::endcap
int endcap() const
Definition: CSCDetId.h:85
CSCCLCTDigiCollection
CSCALCTDigi
Definition: CSCALCTDigi.h:17
CSCConstants::KEY_CLCT_LAYER
Definition: CSCConstants.h:46
relativeConstraints.ring
ring
Definition: relativeConstraints.py:68
CSCStubMatcher::match
void match(const SimTrack &t, const SimVertex &v)
do the matching
Definition: CSCStubMatcher.cc:57
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
or
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
CSCStubMatcher::chamberIdsAllLCT
std::set< unsigned int > chamberIdsAllLCT(int csc_type=MuonHitHelper::CSC_ALL) const
Definition: CSCStubMatcher.cc:413
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
CSCStubMatcher::chamberIdsCLCT
std::set< unsigned int > chamberIdsCLCT(int csc_type=MuonHitHelper::CSC_ALL) const
chamber detIds with matching stubs
Definition: CSCStubMatcher.cc:421
mps_fire.result
result
Definition: mps_fire.py:311
CSCDetId::station
int station() const
Definition: CSCDetId.h:79
CSCStubMatcher::zpositionOfLayer
float zpositionOfLayer(unsigned int detid, int layer) const
Definition: CSCStubMatcher.cc:536
CSCStubMatcher::chamberIdsLCT
std::set< unsigned int > chamberIdsLCT(int csc_type=MuonHitHelper::CSC_ALL) const
Definition: CSCStubMatcher.cc:429
CSCStubMatcher::chamberIdsALCT
std::set< unsigned int > chamberIdsALCT(int csc_type=MuonHitHelper::CSC_ALL) const
Definition: CSCStubMatcher.cc:425
edm::Event
Definition: Event.h:73
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
CSCStubMatcher::allALCTsInChamber
const CSCALCTDigiContainer & allALCTsInChamber(unsigned int) const
Definition: CSCStubMatcher.cc:443
CSCCorrelatedLCTDigi
Definition: CSCCorrelatedLCTDigi.h:19
CSCStubMatcher::nChambersWithALCT
int nChambersWithALCT(int min_quality=0) const
Definition: CSCStubMatcher.cc:562
CSCStubMatcher::matchLCTsToSimTrack
void matchLCTsToSimTrack(const CSCCorrelatedLCTDigiCollection &)
Definition: CSCStubMatcher.cc:234
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
CSCStubMatcher::lctInChamber
bool lctInChamber(const CSCDetId &id, const CSCCorrelatedLCTDigi &lct) const
Definition: CSCStubMatcher.cc:622