CMS 3D CMS Logo

CSCMuonPortCard.cc

Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 //
00003 //   Class: CSCMuonPortCard
00004 //
00005 //   Description: 
00006 //    Simulates the functionality of the Muon Port Card (MPC).  Each MPC
00007 //    is responsible for 9 Trigger Mother Boards (TMBs).  It takes the up to
00008 //    18 LCTs (2/TMB) in each (sub)sector every bunch crossing, sorts them,
00009 //    selects up to three best, and puts them into an output collection.
00010 //
00011 //   Author List: Benn Tannenbaum 30 August 1999.
00012 //                Based on code by Nick Wisniewski.
00013 //
00014 //   $Date: 2007/06/13 14:45:02 $
00015 //   $Revision: 1.5 $
00016 //
00017 //   Modifications: Numerous later improvements by Jason Mumford and
00018 //                  Slava Valuev (see cvs in ORCA).
00019 //   Porting/reworking from ORCA by L. Gray (UF), June 2006.
00020 //
00021 //-----------------------------------------------------------------------------
00022 
00023 #include <L1Trigger/CSCTriggerPrimitives/src/CSCMuonPortCard.h>
00024 #include <L1Trigger/CSCCommonTrigger/interface/CSCConstants.h>
00025 
00026 void CSCMuonPortCard::loadDigis(const CSCCorrelatedLCTDigiCollection& thedigis)
00027 {
00028   // Put everything from the digi container into a trigger container.
00029   // This allows us to sort per BX more easily.
00030   clear();
00031 
00032   CSCCorrelatedLCTDigiCollection::DigiRangeIterator Citer;
00033 
00034   for (Citer = thedigis.begin(); Citer != thedigis.end(); Citer++) {
00035     CSCCorrelatedLCTDigiCollection::const_iterator Diter = (*Citer).second.first;
00036     CSCCorrelatedLCTDigiCollection::const_iterator Dend = (*Citer).second.second;
00037 
00038     for (; Diter != Dend; Diter++) {
00039       csctf::TrackStub theStub((*Diter), (*Citer).first);
00040       _stubs.push_back(theStub);
00041     }
00042   }
00043 }
00044 
00045 std::vector<csctf::TrackStub> CSCMuonPortCard::sort(const unsigned endcap, const unsigned station, 
00046                                                     const unsigned sector, const unsigned subsector, const int bx)
00047 {
00048   std::vector<csctf::TrackStub> result;
00049   std::vector<csctf::TrackStub>::iterator LCT;
00050 
00051   result = _stubs.get(endcap, station, sector, subsector, bx);
00052 
00053   // Make sure no Quality 0 or non-valid LCTs come through the portcard.
00054   for (LCT = result.begin(); LCT != result.end(); LCT++) {
00055     if ( !(LCT->getQuality() && LCT->isValid()) )
00056       result.erase(LCT, LCT);
00057   }
00058 
00059   if (result.size()) {
00060     std::sort(result.begin(), result.end(), std::greater<csctf::TrackStub>());
00061     // Can only return maxStubs or less LCTs per bunch crossing.
00062     if (result.size() > CSCConstants::maxStubs)
00063       result.erase(result.begin() + CSCConstants::maxStubs, result.end());
00064 
00065 
00066     // Go through the sorted list and label the LCTs with a sorting number.
00067     unsigned i = 0;
00068     for (LCT = result.begin(); LCT != result.end(); LCT++)
00069       LCT->setMPCLink(++i);
00070   }
00071 
00072   return result;
00073 }

Generated on Tue Jun 9 17:39:59 2009 for CMSSW by  doxygen 1.5.4