Go to the documentation of this file.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 #include <algorithm>
00026
00027 CSCMuonPortCard::CSCMuonPortCard()
00028 {
00029 max_stubs_ = CSCConstants::maxStubs;
00030 }
00031
00032 CSCMuonPortCard::CSCMuonPortCard(const edm::ParameterSet& conf)
00033 {
00034 max_stubs_ = CSCConstants::maxStubs;
00035
00036 edm::ParameterSet commonParams = conf.getParameter<edm::ParameterSet>("commonParam");
00037 if (commonParams.getUntrackedParameter<bool>("isSLHC",false))
00038 {
00039 edm::ParameterSet mpcParams = conf.getParameter<edm::ParameterSet>("mpcSLHC");
00040 max_stubs_ = mpcParams.getUntrackedParameter<unsigned int>("mpcMaxStubs", CSCConstants::maxStubs);
00041 }
00042 }
00043
00044 void CSCMuonPortCard::loadDigis(const CSCCorrelatedLCTDigiCollection& thedigis)
00045 {
00046
00047
00048 clear();
00049
00050 CSCCorrelatedLCTDigiCollection::DigiRangeIterator Citer;
00051
00052 for (Citer = thedigis.begin(); Citer != thedigis.end(); Citer++) {
00053 CSCCorrelatedLCTDigiCollection::const_iterator Diter = (*Citer).second.first;
00054 CSCCorrelatedLCTDigiCollection::const_iterator Dend = (*Citer).second.second;
00055
00056 for (; Diter != Dend; Diter++) {
00057 csctf::TrackStub theStub((*Diter), (*Citer).first);
00058 stubs_.push_back(theStub);
00059 }
00060 }
00061 }
00062
00063 std::vector<csctf::TrackStub> CSCMuonPortCard::sort(const unsigned endcap, const unsigned station,
00064 const unsigned sector, const unsigned subsector, const int bx)
00065 {
00066 std::vector<csctf::TrackStub> result;
00067 std::vector<csctf::TrackStub>::iterator LCT;
00068
00069 result = stubs_.get(endcap, station, sector, subsector, bx);
00070
00071
00072 for (LCT = result.begin(); LCT != result.end(); LCT++) {
00073 if ( !(LCT->getQuality() && LCT->isValid()) )
00074 result.erase(LCT, LCT);
00075 }
00076
00077 if (result.size()) {
00078 std::sort(result.begin(), result.end(), std::greater<csctf::TrackStub>());
00079
00080 if (result.size() > max_stubs_)
00081 result.erase(result.begin() + max_stubs_, result.end());
00082
00083
00084
00085 unsigned i = 0;
00086 for (LCT = result.begin(); LCT != result.end(); LCT++)
00087 LCT->setMPCLink(++i);
00088 }
00089
00090 return result;
00091 }