CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CSCMuonPortCard.cc
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 //
3 // Class: CSCMuonPortCard
4 //
5 // Description:
6 // Simulates the functionality of the Muon Port Card (MPC). Each MPC
7 // is responsible for 9 Trigger Mother Boards (TMBs). It takes the up to
8 // 18 LCTs (2/TMB) in each (sub)sector every bunch crossing, sorts them,
9 // selects up to three best, and puts them into an output collection.
10 //
11 // Author List: Benn Tannenbaum 30 August 1999.
12 // Based on code by Nick Wisniewski.
13 //
14 //
15 // Modifications: Numerous later improvements by Jason Mumford and
16 // Slava Valuev (see cvs in ORCA).
17 // Porting/reworking from ORCA by L. Gray (UF), June 2006.
18 //
19 //-----------------------------------------------------------------------------
20 
23 #include <algorithm>
24 
26 {
28 }
29 
31 {
33 
34  edm::ParameterSet commonParams = conf.getParameter<edm::ParameterSet>("commonParam");
35  if (commonParams.getParameter<bool>("isSLHC"))
36  {
37  edm::ParameterSet mpcParams = conf.getParameter<edm::ParameterSet>("mpcSLHC");
38  max_stubs_ = mpcParams.getParameter<unsigned int>("mpcMaxStubs");
39  }
40 }
41 
43 {
44  // Put everything from the digi container into a trigger container.
45  // This allows us to sort per BX more easily.
46  clear();
47 
49 
50  for (Citer = thedigis.begin(); Citer != thedigis.end(); Citer++) {
51  CSCCorrelatedLCTDigiCollection::const_iterator Diter = (*Citer).second.first;
52  CSCCorrelatedLCTDigiCollection::const_iterator Dend = (*Citer).second.second;
53 
54  for (; Diter != Dend; Diter++) {
55  csctf::TrackStub theStub((*Diter), (*Citer).first);
56  stubs_.push_back(theStub);
57  }
58  }
59 }
60 
61 std::vector<csctf::TrackStub> CSCMuonPortCard::sort(const unsigned endcap, const unsigned station,
62  const unsigned sector, const unsigned subsector, const int bx)
63 {
64  std::vector<csctf::TrackStub> result;
65  std::vector<csctf::TrackStub>::iterator LCT;
66 
67  result = stubs_.get(endcap, station, sector, subsector, bx);
68 
69  // Make sure no Quality 0 or non-valid LCTs come through the portcard.
70  for (LCT = result.begin(); LCT != result.end(); LCT++) {
71  if ( !(LCT->getQuality() && LCT->isValid()) )
72  result.erase(LCT, LCT);
73  }
74 
75  if (result.size()) {
76  std::sort(result.begin(), result.end(), std::greater<csctf::TrackStub>());
77  // Can only return maxStubs or less LCTs per bunch crossing.
78  if (result.size() > max_stubs_)
79  result.erase(result.begin() + max_stubs_, result.end());
80 
81 
82  // Go through the sorted list and label the LCTs with a sorting number.
83  unsigned i = 0;
84  for (LCT = result.begin(); LCT != result.end(); LCT++)
85  LCT->setMPCLink(++i);
86  }
87 
88  return result;
89 }
unsigned int max_stubs_
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< T > get() const
void push_back(const T &data)
tuple result
Definition: mps_fire.py:95
void loadDigis(const CSCCorrelatedLCTDigiCollection &thedigis)
std::vector< CSCCorrelatedLCTDigi >::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)