Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HLT Menu check for the PCL Tracker Alignment #44783

Merged
merged 3 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
)