Skip to content

Commit

Permalink
Merge pull request #44783 from phnattla/PCL_Alignment_HLT_Menu_check
Browse files Browse the repository at this point in the history
HLT Menu check for the PCL Tracker Alignment
  • Loading branch information
cmsbuild authored Apr 22, 2024
2 parents 8664037 + 8111271 commit f24c6f7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions Alignment/CommonAlignmentProducer/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@
</library>

<library file="LSNumberFilter.cc" name="AlignmentCommonAlignmentProducerFilter">
<use name="HLTrigger/HLTcore"/>
<flags EDM_PLUGIN="1"/>
</library>
26 changes: 24 additions & 2 deletions Alignment/CommonAlignmentProducer/plugins/LSNumberFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
#include <iostream>

//
// class declaration
Expand All @@ -16,12 +18,17 @@ class LSNumberFilter : public edm::stream::EDFilter<> {
~LSNumberFilter() override;

private:
void beginRun(edm::Run const&, edm::EventSetup const&) override;
bool filter(edm::Event&, const edm::EventSetup&) override;
bool is_HLT_vetoed;
unsigned int minLS;
const std::vector<std::string> veto_HLT_Menu;
HLTConfigProvider hltConfig_;
};

LSNumberFilter::LSNumberFilter(const edm::ParameterSet& iConfig)
: minLS(iConfig.getUntrackedParameter<unsigned>("minLS", 21)) {}
: minLS(iConfig.getUntrackedParameter<unsigned>("minLS", 21)),
veto_HLT_Menu(iConfig.getUntrackedParameter<std::vector<std::string>>("veto_HLT_Menu")) {}

LSNumberFilter::~LSNumberFilter() {}

Expand All @@ -31,11 +38,26 @@ LSNumberFilter::~LSNumberFilter() {}

// ------------ method called on each new Event ------------
bool LSNumberFilter::filter(edm::Event& iEvent, const edm::EventSetup& iSetup) {
if (iEvent.luminosityBlock() < minLS)
if ((iEvent.luminosityBlock() < minLS) || is_HLT_vetoed)
return false;

return true;
}

void LSNumberFilter::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {
bool changed(false);
hltConfig_.init(iRun, iSetup, "HLT", changed);
is_HLT_vetoed = false;
for (unsigned int i = 0; i < veto_HLT_Menu.size(); i++) {
std::size_t found = hltConfig_.tableName().find(veto_HLT_Menu[i]);
if (found != std::string::npos) {
is_HLT_vetoed = true;
edm::LogWarning("LSNumberFilter") << "Detected " << veto_HLT_Menu[i]
<< " in HLT Config tableName(): " << hltConfig_.tableName()
<< "; Events of this run will be ignored" << std::endl;
break;
}
}
}
//define this as a plug-in
DEFINE_FWK_MODULE(LSNumberFilter);
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import FWCore.ParameterSet.Config as cms

lsNumberFilter = cms.EDFilter("LSNumberFilter",
minLS = cms.untracked.uint32(21)
minLS = cms.untracked.uint32(21),
veto_HLT_Menu = cms.untracked.vstring("LumiScan")
)

0 comments on commit f24c6f7

Please sign in to comment.