CMS 3D CMS Logo

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