Skip to content

Commit 65da010

Browse files
authored
Merge pull request #48652 from mmusich/mm_patch_ScoutingMuonTriggerAnalyzer_v2
reset the list of trigger paths used for `ScoutingMuonTriggerAnalyzer` in presence of `Special` menus
2 parents 6beadc9 + 89e55de commit 65da010

File tree

2 files changed

+38
-5
lines changed

2 files changed

+38
-5
lines changed

HLTriggerOffline/Scouting/plugins/ScoutingMuonTriggerAnalyzer.cc

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ scouting muon triggers (selected in python/ScoutingMuonTriggerAnalyzer_cfi.py)
2121
#include <vector>
2222

2323
// user includes
24+
#include "CommonTools/Utils/interface/StringCutObjectSelector.h"
2425
#include "DQMServices/Core/interface/DQMEDAnalyzer.h"
2526
#include "DQMServices/Core/interface/DQMGlobalEDAnalyzer.h"
2627
#include "DataFormats/Common/interface/TriggerResults.h"
@@ -36,17 +37,18 @@ scouting muon triggers (selected in python/ScoutingMuonTriggerAnalyzer_cfi.py)
3637
#include "FWCore/Framework/interface/MakerMacros.h"
3738
#include "FWCore/MessageLogger/interface/MessageLogger.h"
3839
#include "FWCore/ParameterSet/interface/ParameterSet.h"
40+
#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
3941
#include "HLTrigger/HLTcore/interface/TriggerExpressionData.h"
4042
#include "HLTrigger/HLTcore/interface/TriggerExpressionEvaluator.h"
4143
#include "HLTrigger/HLTcore/interface/TriggerExpressionParser.h"
4244
#include "L1Trigger/L1TGlobal/interface/L1TGlobalUtil.h"
43-
#include "CommonTools/Utils/interface/StringCutObjectSelector.h"
4445

4546
// Classes to be declared
4647
class ScoutingMuonTriggerAnalyzer : public DQMEDAnalyzer {
4748
public:
4849
explicit ScoutingMuonTriggerAnalyzer(const edm::ParameterSet& conf);
4950
~ScoutingMuonTriggerAnalyzer() override = default;
51+
void dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) override;
5052
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
5153

5254
private:
@@ -61,12 +63,18 @@ class ScoutingMuonTriggerAnalyzer : public DQMEDAnalyzer {
6163
const edm::EDGetTokenT<std::vector<pat::Muon>> muonCollection_;
6264
const edm::EDGetTokenT<std::vector<Run3ScoutingMuon>> scoutingMuonCollection_;
6365

66+
// to clear the list of menus to use
67+
HLTConfigProvider hltConfig_;
68+
const std::string hltProcessName_;
69+
bool isSpecial_;
70+
const std::vector<std::string> special_HLT_Menus_;
71+
6472
std::vector<triggerExpression::Evaluator*> vtriggerSelector_;
6573
edm::EDGetToken algToken_;
6674
std::shared_ptr<l1t::L1TGlobalUtil> l1GtUtils_;
6775
std::vector<std::string> l1Seeds_;
6876
TString l1Names[100] = {""};
69-
Bool_t l1Result[100] = {false};
77+
bool l1Result[100] = {false};
7078
StringCutObjectSelector<Run3ScoutingMuon, false> muonsCut_;
7179

7280
// Histogram declaration
@@ -100,6 +108,9 @@ ScoutingMuonTriggerAnalyzer::ScoutingMuonTriggerAnalyzer(const edm::ParameterSet
100108
vtriggerSelection_{iConfig.getParameter<vector<string>>("triggerSelection")},
101109
scoutingMuonCollection_{
102110
consumes<std::vector<Run3ScoutingMuon>>(iConfig.getParameter<edm::InputTag>("ScoutingMuonCollection"))},
111+
hltProcessName_(iConfig.getParameter<std::string>("hltProcessName")),
112+
isSpecial_{false},
113+
special_HLT_Menus_{iConfig.getParameter<std::vector<std::string>>("special_HLT_Menus")},
103114
algToken_{consumes<BXVector<GlobalAlgBlk>>(iConfig.getParameter<edm::InputTag>("AlgInputTag"))},
104115
muonsCut_{iConfig.getParameter<std::string>("muonSelection")} {
105116
vtriggerSelector_.reserve(vtriggerSelection_.size());
@@ -113,6 +124,24 @@ ScoutingMuonTriggerAnalyzer::ScoutingMuonTriggerAnalyzer(const edm::ParameterSet
113124
}
114125
}
115126

127+
void ScoutingMuonTriggerAnalyzer::dqmBeginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {
128+
bool changed{false};
129+
hltConfig_.init(iRun, iSetup, hltProcessName_, changed);
130+
for (const auto& menu : special_HLT_Menus_) {
131+
std::size_t found = hltConfig_.tableName().find(menu);
132+
if (found != std::string::npos) {
133+
isSpecial_ = true;
134+
edm::LogWarning("ScoutingMuonTriggerAnalyzer")
135+
<< "Detected " << menu << " in HLT Config tableName(): " << hltConfig_.tableName()
136+
<< "; the list of trigger expressions is going to be overriden!" << std::endl;
137+
break;
138+
}
139+
}
140+
vtriggerSelector_.clear();
141+
vtriggerSelector_.resize(1);
142+
vtriggerSelector_.push_back(triggerExpression::parse("DST_PFScouting_ZeroBias*"));
143+
}
144+
116145
// Core of the implementation
117146
void ScoutingMuonTriggerAnalyzer::analyze(edm::Event const& iEvent, edm::EventSetup const& iSetup) {
118147
edm::Handle<std::vector<Run3ScoutingMuon>> sctMuons;
@@ -249,7 +278,10 @@ void ScoutingMuonTriggerAnalyzer::fillDescriptions(edm::ConfigurationDescription
249278
edm::ParameterSetDescription desc;
250279

251280
desc.add<std::string>("OutputInternalPath", "MY_FOLDER");
252-
desc.add<vector<string>>("triggerSelection", {});
281+
desc.add<std::vector<string>>("triggerSelection", {});
282+
desc.add<std::string>("hltProcessName", "HLT");
283+
desc.add<std::vector<std::string>>("special_HLT_Menus", {})
284+
->setComment("list of HLT menus to use to clear the trigger selection");
253285
desc.add<edm::InputTag>("ScoutingMuonCollection", edm::InputTag("hltScoutingMuonPackerVtx"));
254286
desc.add<edm::InputTag>("AlgInputTag", edm::InputTag("gtStage2Digis"));
255287
desc.add<std::vector<std::string>>("l1Seeds", {});

HLTriggerOffline/Scouting/python/ScoutingMuonTriggerAnalyzer_cfi.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@
3030
ScoutingMuonTriggerAnalysis_DoubleMu = DQMEDAnalyzer('ScoutingMuonTriggerAnalyzer',
3131
OutputInternalPath = cms.string('/HLT/ScoutingOffline/Muons/L1Efficiency/DoubleMu'), #Output of the root file
3232
ScoutingMuonCollection = cms.InputTag('hltScoutingMuonPackerVtx'),
33-
triggerSelection = cms.vstring(["DST_PFScouting_ZeroBias*", "DST_PFScouting_DoubleEG_v*", "DST_PFScouting_JetHT_v*"]), #Denominator
33+
triggerSelection = cms.vstring(["DST_PFScouting_ZeroBias_v*", "DST_PFScouting_DoubleEG_v*", "DST_PFScouting_JetHT_v*"]), #Denominator
34+
special_HLT_Menus = cms.vstring(["LumiScan"]), # list of menus to use to reset the trigge selections
3435
triggerConfiguration = cms.PSet(
3536
hltResults = cms.InputTag('TriggerResults','','HLT'),
3637
l1tResults = cms.InputTag('','',''),
3738
l1tIgnoreMaskAndPrescale = cms.bool(False),
38-
throw = cms.bool(False),
39+
throw = cms.bool(True),
3940
usePathStatus = cms.bool(False),
4041
),
4142
AlgInputTag = cms.InputTag("gtStage2Digis"),

0 commit comments

Comments
 (0)