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: 2009/02/09 21:33:37 $
15 // $Revision: 1.6 $
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 {
29  // Put everything from the digi container into a trigger container.
30  // This allows us to sort per BX more easily.
31  clear();
32 
34 
35  for (Citer = thedigis.begin(); Citer != thedigis.end(); Citer++) {
36  CSCCorrelatedLCTDigiCollection::const_iterator Diter = (*Citer).second.first;
37  CSCCorrelatedLCTDigiCollection::const_iterator Dend = (*Citer).second.second;
38 
39  for (; Diter != Dend; Diter++) {
40  csctf::TrackStub theStub((*Diter), (*Citer).first);
41  _stubs.push_back(theStub);
42  }
43  }
44 }
45 
46 std::vector<csctf::TrackStub> CSCMuonPortCard::sort(const unsigned endcap, const unsigned station,
47  const unsigned sector, const unsigned subsector, const int bx)
48 {
49  std::vector<csctf::TrackStub> result;
50  std::vector<csctf::TrackStub>::iterator LCT;
51 
52  result = _stubs.get(endcap, station, sector, subsector, bx);
53 
54  // Make sure no Quality 0 or non-valid LCTs come through the portcard.
55  for (LCT = result.begin(); LCT != result.end(); LCT++) {
56  if ( !(LCT->getQuality() && LCT->isValid()) )
57  result.erase(LCT, LCT);
58  }
59 
60  if (result.size()) {
61  std::sort(result.begin(), result.end(), std::greater<csctf::TrackStub>());
62  // Can only return maxStubs or less LCTs per bunch crossing.
63  if (result.size() > CSCConstants::maxStubs)
64  result.erase(result.begin() + CSCConstants::maxStubs, result.end());
65 
66 
67  // Go through the sorted list and label the LCTs with a sorting number.
68  unsigned i = 0;
69  for (LCT = result.begin(); LCT != result.end(); LCT++)
70  LCT->setMPCLink(++i);
71  }
72 
73  return result;
74 }
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
CSCTriggerContainer< csctf::TrackStub > _stubs
std::vector< DigiType >::const_iterator const_iterator
std::vector< csctf::TrackStub > sort(const unsigned endcap, const unsigned station, const unsigned sector, const unsigned subsector, const int bx)