Skip to content

Commit

Permalink
Merge pull request #17496 from fwyzard/L1TGlobalProducer_fix_prescale…
Browse files Browse the repository at this point in the history
…_index

L1TGlobalProducer: fix prescale index counting
  • Loading branch information
cmsbuild committed Feb 14, 2017
2 parents b6fd472 + 1e6bdfd commit eeccab0
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions L1Trigger/L1TGlobal/plugins/L1TGlobalProducer.cc
Expand Up @@ -397,7 +397,7 @@ void L1TGlobalProducer::produce(edm::Event& iEvent, const edm::EventSetup& evSet
}
else{
// Set Prescale factors to initial dummy values
m_prescaleSet = 1;
m_prescaleSet = 0;
m_prescaleFactorsAlgoTrig = &m_initialPrescaleFactorsAlgoTrig;
m_triggerMaskAlgoTrig = &m_initialTriggerMaskAlgoTrig;
m_triggerMaskVetoAlgoTrig = &m_initialTriggerMaskVetoAlgoTrig;
Expand Down Expand Up @@ -520,22 +520,18 @@ void L1TGlobalProducer::produce(edm::Event& iEvent, const edm::EventSetup& evSet
}
LogDebug("L1TGlobalProducer") << "HW BxCross " << bxCrossHw << std::endl;


// get the prescale factor from the configuration for now
// Prescale set indexed by zero internally, but externally indexed by 1
unsigned int pfAlgoSetIndex = m_prescaleSet-1;

// Require that prescale set be positive
if( m_prescaleSet<=0 ) pfAlgoSetIndex = 0;
// prescale set index counts from zero
unsigned int pfAlgoSetIndex = m_prescaleSet;

if( pfAlgoSetIndex > (*m_prescaleFactorsAlgoTrig).size()-1 ){
LogTrace("L1TGlobalProducer")
auto max = (*m_prescaleFactorsAlgoTrig).size()-1;
if (pfAlgoSetIndex > max) {
edm::LogWarning("L1TGlobalProducer")
<< "\nAttempting to access prescale algo set: " << m_prescaleSet
<< "\nNumber of prescale algo sets available: " << (*m_prescaleFactorsAlgoTrig).size()
<< "\nNumber of prescale algo sets available: 0.." << max
<< "Setting former to latter."
<< std::endl;

pfAlgoSetIndex = (*m_prescaleFactorsAlgoTrig).size()-1;
pfAlgoSetIndex = max;
}

const std::vector<int>& prescaleFactorsAlgoTrig = (*m_prescaleFactorsAlgoTrig).at(pfAlgoSetIndex);
Expand Down

0 comments on commit eeccab0

Please sign in to comment.