CMS 3D CMS Logo

CSCMuonPortCard.cc
Go to the documentation of this file.
3 #include <algorithm>
4 
6 
8  edm::ParameterSet mpcRun2Params = conf.getParameter<edm::ParameterSet>("mpcRun2");
9  sort_stubs_ = mpcRun2Params.getParameter<bool>("sortStubs");
10  drop_invalid_stubs_ = mpcRun2Params.getParameter<bool>("dropInvalidStubs");
11  drop_low_quality_stubs_ = mpcRun2Params.getParameter<bool>("dropLowQualityStubs");
12 }
13 
15  // Put everything from the digi container into a trigger container.
16  // This allows us to sort per BX more easily.
17  clear();
18 
20 
21  for (Citer = thedigis.begin(); Citer != thedigis.end(); Citer++) {
22  CSCCorrelatedLCTDigiCollection::const_iterator Diter = (*Citer).second.first;
23  CSCCorrelatedLCTDigiCollection::const_iterator Dend = (*Citer).second.second;
24 
25  for (; Diter != Dend; Diter++) {
26  csctf::TrackStub theStub((*Diter), (*Citer).first);
27  stubs_.push_back(theStub);
28  }
29  }
30 }
31 
32 std::vector<csctf::TrackStub> CSCMuonPortCard::sort(
33  const unsigned endcap, const unsigned station, const unsigned sector, const unsigned subsector, const int bx) {
34  std::vector<csctf::TrackStub> result;
35  std::vector<csctf::TrackStub>::iterator LCT;
36 
37  result = stubs_.get(endcap, station, sector, subsector, bx);
38 
39  // Make sure no Quality 0 or non-valid LCTs come through the portcard.
40  for (LCT = result.begin(); LCT != result.end(); LCT++) {
41  if ((drop_invalid_stubs_ && !LCT->isValid()) || (drop_low_quality_stubs_ && LCT->getQuality() == 0))
42  result.erase(LCT, LCT);
43  }
44 
45  if (!result.empty()) {
46  if (sort_stubs_)
47  std::sort(result.begin(), result.end(), std::greater<csctf::TrackStub>());
48 
49  // Can return up to MAX_LCTS_PER_MPC (default 18) per bunch crossing.
50  if (result.size() > CSCConstants::MAX_LCTS_PER_MPC)
51  result.erase(result.begin() + CSCConstants::MAX_LCTS_PER_MPC, result.end());
52 
53  // Go through the sorted list and label the LCTs with a sorting number.
54  unsigned i = 0;
55  for (LCT = result.begin(); LCT != result.end(); LCT++)
56  LCT->setMPCLink(++i);
57  }
58 
59  return result;
60 }
T getParameter(std::string const &) const
std::vector< T > get() const
void push_back(const T &data)
void loadDigis(const CSCCorrelatedLCTDigiCollection &thedigis)
bool drop_low_quality_stubs_
std::vector< DigiType >::const_iterator const_iterator
CSCTriggerContainer< csctf::TrackStub > stubs_
std::vector< csctf::TrackStub > sort(const unsigned endcap, const unsigned station, const unsigned sector, const unsigned subsector, const int bx)