00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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
00029
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
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
00062 if (result.size() > CSCConstants::maxStubs)
00063 result.erase(result.begin() + CSCConstants::maxStubs, result.end());
00064
00065
00066
00067 unsigned i = 0;
00068 for (LCT = result.begin(); LCT != result.end(); LCT++)
00069 LCT->setMPCLink(++i);
00070 }
00071
00072 return result;
00073 }