19 , triggerResultsTag_(
"TriggerResults::HLT" )
21 , l1GtTriggerMenuLiteTag_(
"l1GtTriggerMenuLite" )
29 if ( config.
exists(
"prescaleWeightHltPaths" ) )
hltPaths_ = config.
getParameter< std::vector< std::string > >(
"prescaleWeightHltPaths" );
34 if (
verbosity_ > 0 )
edm::LogWarning(
"PrescaleWeightProvider" ) <<
"Process name not configured via TriggerResults InputTag";
59 if (
verbosity_ > 0 )
edm::LogWarning(
"PrescaleWeightProvider" ) <<
"Run initialisation failed due to failing configuration";
63 bool hltChanged(
false );
70 }
else if ( hltChanged ) {
73 if ( !
init_ )
return;
86 if ( !
init_ )
return 1;
95 if( ! triggerResults.
isValid() ) {
100 const int SENTINEL( -1 );
107 if (
verbosity_ > 0 )
edm::LogError(
"PrescaleWeightProvider::prescaleWeight" ) <<
"HLT path \"" << hltPath <<
"\" does not exist";
110 if ( ! triggerResults->accept( hltIndex ) )
continue;
113 if ( level1Seeds.size() != 1 ) {
114 if (
verbosity_ > 0 )
edm::LogError(
"PrescaleWeightProvider::prescaleWeight" ) <<
"HLT path \"" << hltPath <<
"\" provides too many L1 seeds";
119 if (
verbosity_ > 0 )
edm::LogWarning(
"PrescaleWeightProvider::prescaleWeight") <<
"Failed to parse L1 seeds for HLT path \"" << hltPath <<
"\"";
123 int l1Prescale( SENTINEL );
124 for (
unsigned uj = 0; uj <
l1SeedPaths_.size(); uj++ ) {
125 int l1TempPrescale( SENTINEL );
127 if ( level1Seeds.at( 0 ).first ) {
128 unsigned techBit( atoi(
l1SeedPaths_.at( uj ).c_str() ) );
130 if ( errorCode != 0 )
continue;
131 if ( ! l1GtUtils.
decision( event, techName, errorCode ) )
continue;
132 if ( errorCode != 0 )
continue;
133 l1TempPrescale = l1GtUtils.
prescaleFactor( event, techName, errorCode );
134 if ( errorCode != 0 )
continue;
138 if ( errorCode != 0 )
continue;
140 if ( errorCode != 0 )
continue;
142 if ( l1TempPrescale > 0 ){
143 if ( l1Prescale == SENTINEL || l1Prescale > l1TempPrescale ) l1Prescale = l1TempPrescale;
146 if ( l1Prescale == SENTINEL ){
147 if (
verbosity_ > 0 )
edm::LogError(
"PrescaleWeightProvider::prescaleWeight" ) <<
"Unable to find the L1 prescale for HLT path \"" << hltPath <<
"\"";
153 if ( hltPrescale * l1Prescale > 0 ) {
154 if ( weight == SENTINEL || weight > hltPrescale * l1Prescale ) {
155 weight = hltPrescale * l1Prescale;
160 if ( weight == SENTINEL ){
161 if (
verbosity_ > 0 )
edm::LogWarning(
"PrescaleWeightProvider::prescaleWeight" ) <<
"No valid weight for any requested HLT path, returning default weight of 1";
172 std::stringstream
ss( l1Seeds );
175 while ( ss.good() && ! ss.eof() ){
177 if ( buf[0] ==
'(' || buf[ buf.size() - 1 ] ==
')' || buf ==
"AND" || buf ==
"NOT" ){
179 if (
verbosity_ > 0 )
edm::LogWarning(
"PrescaleWeightProvider::parseL1Seeds" ) <<
"Only supported logical expression is OR";
182 else if (buf ==
"OR")
continue;
unsigned int size() const
number of trigger paths in trigger table
edm::EDGetTokenT< L1GtTriggerMenuLite > l1GtTriggerMenuLiteToken_
T getParameter(std::string const &) const
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
int prescaleWeight(const edm::Event &event, const edm::EventSetup &setup)
edm::Handle< L1GtTriggerMenuLite > triggerMenuLite_
std::vector< std::string > l1SeedPaths_
const std::vector< std::vector< std::pair< bool, std::string > > > & hltL1GTSeeds() const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
edm::InputTag triggerResultsTag_
triggerResultsToken_(consumes< edm::TriggerResults >(edm::InputTag("TriggerResults")))
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
std::vector< std::string > hltPaths_
unsigned int prescaleValue(unsigned int set, const std::string &trigger) const
HLT prescale value in specific prescale set for a specific trigger path.
const bool decision(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const std::string &nameAlgoTechTrig, int &errorCode) const
edm::EDGetTokenT< edm::TriggerResults > triggerResultsToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void initRun(const edm::Run &run, const edm::EventSetup &setup)
void retrieveL1EventSetup(const edm::EventSetup &)
retrieve all the relevant L1 trigger event setup records and cache them to improve the speed ...
static std::string const triggerResults
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
HLTConfigProvider hltConfig_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
PrescaleWeightProvider(const edm::ParameterSet &config, edm::ConsumesCollector &&iC)
const int prescaleFactor(const edm::Event &iEvent, const edm::InputTag &l1GtRecordInputTag, const edm::InputTag &l1GtReadoutRecordInputTag, const std::string &nameAlgoTechTrig, int &errorCode) const
return prescale factor for a given algorithm or technical trigger
edm::InputTag l1GtTriggerMenuLiteTag_
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void parseL1Seeds(const std::string &l1Seeds)