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 // $Date: 2012/12/05 21:14:23 $
15 // $Revision: 1.7 $
16 //
17 // Modifications: Numerous later improvements by Jason Mumford and
18 // Slava Valuev (see cvs in ORCA).
19 // Porting/reworking from ORCA by L. Gray (UF), June 2006.
20 //
21 //-----------------------------------------------------------------------------
22 
25 #include <algorithm>
26 
28 {
30 }
31 
33 {
35 
36  edm::ParameterSet commonParams = conf.getParameter<edm::ParameterSet>("commonParam");
37  if (commonParams.getUntrackedParameter<bool>("isSLHC",false))
38  {
39  edm::ParameterSet mpcParams = conf.getParameter<edm::ParameterSet>("mpcSLHC");
40  max_stubs_ = mpcParams.getUntrackedParameter<unsigned int>("mpcMaxStubs", CSCConstants::maxStubs);
41  }
42 }
43 
45 {
46  // Put everything from the digi container into a trigger container.
47  // This allows us to sort per BX more easily.
48  clear();
49 
51 
52  for (Citer = thedigis.begin(); Citer != thedigis.end(); Citer++) {
53  CSCCorrelatedLCTDigiCollection::const_iterator Diter = (*Citer).second.first;
54  CSCCorrelatedLCTDigiCollection::const_iterator Dend = (*Citer).second.second;
55 
56  for (; Diter != Dend; Diter++) {
57  csctf::TrackStub theStub((*Diter), (*Citer).first);
58  stubs_.push_back(theStub);
59  }
60  }
61 }
62 
63 std::vector<csctf::TrackStub> CSCMuonPortCard::sort(const unsigned endcap, const unsigned station,
64  const unsigned sector, const unsigned subsector, const int bx)
65 {
66  std::vector<csctf::TrackStub> result;
67  std::vector<csctf::TrackStub>::iterator LCT;
68 
69  result = stubs_.get(endcap, station, sector, subsector, bx);
70 
71  // Make sure no Quality 0 or non-valid LCTs come through the portcard.
72  for (LCT = result.begin(); LCT != result.end(); LCT++) {
73  if ( !(LCT->getQuality() && LCT->isValid()) )
74  result.erase(LCT, LCT);
75  }
76 
77  if (result.size()) {
78  std::sort(result.begin(), result.end(), std::greater<csctf::TrackStub>());
79  // Can only return maxStubs or less LCTs per bunch crossing.
80  if (result.size() > max_stubs_)
81  result.erase(result.begin() + max_stubs_, result.end());
82 
83 
84  // Go through the sorted list and label the LCTs with a sorting number.
85  unsigned i = 0;
86  for (LCT = result.begin(); LCT != result.end(); LCT++)
87  LCT->setMPCLink(++i);
88  }
89 
90  return result;
91 }
unsigned int max_stubs_
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< T > get() const
void push_back(const T data)
void loadDigis(const CSCCorrelatedLCTDigiCollection &thedigis)
tuple result
Definition: query.py:137
tuple conf
Definition: dbtoconf.py:185
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)