Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
48 changes: 48 additions & 0 deletions HLTrigger/Configuration/python/customizeHLTforCMSSW.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,53 @@ def customizeHLTfor44576(process):
break
return process

def customizeHLTfor45063(process):
"""Assigns value of MuonHLTSeedMVAClassifier mva input file, scales and mean values according to the value of isFromL1"""
for prod in producers_by_type(process, 'MuonHLTSeedMVAClassifier'):
if hasattr(prod, "isFromL1"):
if (prod.isFromL1 == True):
if hasattr(prod, "mvaFileBL1"):
prod.mvaFileB = prod.mvaFileBL1
if hasattr(prod, "mvaFileEL1"):
prod.mvaFileE = prod.mvaFileEL1
if hasattr(prod, "mvaScaleMeanBL1"):
prod.mvaScaleMeanB = prod.mvaScaleMeanBL1
if hasattr(prod, "mvaScaleStdBL1"):
prod.mvaScaleStdB = prod.mvaScaleStdBL1
if hasattr(prod, "mvaScaleMeanEL1"):
prod.mvaScaleMeanE = prod.mvaScaleMeanEL1
if hasattr(prod, "mvaScaleStdEL1"):
prod.mvaScaleStdE = prod.mvaScaleStdEL1
else:
if hasattr(prod, "mvaFileBL2"):
prod.mvaFileB = prod.mvaFileBL2
if hasattr(prod, "mvaFileEL2"):
prod.mvaFileE = prod.mvaFileEL2
if hasattr(prod, "mvaScaleMeanBL2"):
prod.mvaScaleMeanB = prod.mvaScaleMeanBL2
if hasattr(prod, "mvaScaleStdBL2"):
prod.mvaScaleStdB = prod.mvaScaleStdBL2
if hasattr(prod, "mvaScaleMeanEL2"):
prod.mvaScaleMeanE = prod.mvaScaleMeanEL2
if hasattr(prod, "mvaScaleStdEL2"):
prod.mvaScaleStdE = prod.mvaScaleStdEL2

for prod in producers_by_type(process, 'MuonHLTSeedMVAClassifier'):
delattr(prod,"mvaFileBL1")
delattr(prod,"mvaFileEL1")
delattr(prod,"mvaScaleMeanBL1")
delattr(prod,"mvaScaleStdBL1")
delattr(prod,"mvaScaleMeanEL1")
delattr(prod,"mvaScaleStdEL1")
delattr(prod,"mvaFileBL2")
delattr(prod,"mvaFileEL2")
delattr(prod,"mvaScaleMeanBL2")
delattr(prod,"mvaScaleStdBL2")
delattr(prod,"mvaScaleMeanEL2")
delattr(prod,"mvaScaleStdEL2")

return process

# CMSSW version specific customizations
def customizeHLTforCMSSW(process, menuType="GRun"):

Expand All @@ -278,5 +325,6 @@ def customizeHLTforCMSSW(process, menuType="GRun"):

process = checkHLTfor43774(process)
process = customizeHLTfor44576(process)
process = customizeHLTfor45063(process)

return process
51 changes: 25 additions & 26 deletions RecoMuon/TrackerSeedGenerator/plugins/MuonHLTSeedMVAClassifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,28 +92,35 @@ MuonHLTSeedMVAClassifier::MuonHLTSeedMVAClassifier(const edm::ParameterSet& iCon
l1MuonToken_(consumes<l1t::MuonBxCollection>(iConfig.getParameter<edm::InputTag>("L1Muon"))),
l2MuonToken_(consumes<reco::RecoChargedCandidateCollection>(iConfig.getParameter<edm::InputTag>("L2Muon"))),
trackerGeometryToken_(esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>()),

rejectAll_(iConfig.getParameter<bool>("rejectAll")),
isFromL1_(iConfig.getParameter<bool>("isFromL1")),

mvaFileB_(iConfig.getParameter<edm::FileInPath>(isFromL1_ ? "mvaFileBL1" : "mvaFileBL2")),
mvaFileE_(iConfig.getParameter<edm::FileInPath>(isFromL1_ ? "mvaFileEL1" : "mvaFileEL2")),

mvaScaleMeanB_(iConfig.getParameter<std::vector<double>>(isFromL1_ ? "mvaScaleMeanBL1" : "mvaScaleMeanBL2")),
mvaScaleStdB_(iConfig.getParameter<std::vector<double>>(isFromL1_ ? "mvaScaleStdBL1" : "mvaScaleStdBL2")),
mvaScaleMeanE_(iConfig.getParameter<std::vector<double>>(isFromL1_ ? "mvaScaleMeanEL1" : "mvaScaleMeanEL2")),
mvaScaleStdE_(iConfig.getParameter<std::vector<double>>(isFromL1_ ? "mvaScaleStdEL1" : "mvaScaleStdEL2")),

mvaFileB_(iConfig.getParameter<edm::FileInPath>("mvaFileB")),
mvaFileE_(iConfig.getParameter<edm::FileInPath>("mvaFileE")),
mvaScaleMeanB_(iConfig.getParameter<std::vector<double>>("mvaScaleMeanB")),
mvaScaleStdB_(iConfig.getParameter<std::vector<double>>("mvaScaleStdB")),
mvaScaleMeanE_(iConfig.getParameter<std::vector<double>>("mvaScaleMeanE")),
mvaScaleStdE_(iConfig.getParameter<std::vector<double>>("mvaScaleStdE")),
doSort_(iConfig.getParameter<bool>("doSort")),
nSeedsMaxB_(iConfig.getParameter<int>("nSeedsMaxB")),
nSeedsMaxE_(iConfig.getParameter<int>("nSeedsMaxE")),

etaEdge_(iConfig.getParameter<double>("etaEdge")),
mvaCutB_(iConfig.getParameter<double>("mvaCutB")),
mvaCutE_(iConfig.getParameter<double>("mvaCutE")),

minL1Qual_(iConfig.getParameter<int>("minL1Qual")),
baseScore_(iConfig.getParameter<double>("baseScore")) {
const auto& mvaFileBPath = mvaFileB_.fullPath();
const auto& mvaFileEPath = mvaFileE_.fullPath();

if (!isFromL1_ and
((mvaFileBPath.find("FromL1") != std::string::npos) or (mvaFileEPath.find("FromL1") != std::string::npos))) {
throw cms::Exception("ConfigurationError")
<< " isFromL1 parameter is False, but using FromL1 MVA files.\n Please check your configuration";
} else if (isFromL1_ and ((mvaFileBPath.find("FromL1") == std::string::npos) or
(mvaFileEPath.find("FromL1") == std::string::npos))) {
throw cms::Exception("ConfigurationError")
<< " isFromL1 parameter is True, but not using FromL1 MVA files.\n Please check your configuration";
}

if (!rejectAll_) {
mvaEstimator_ = std::make_pair(
std::make_unique<SeedMvaEstimator>(mvaFileB_, mvaScaleMeanB_, mvaScaleStdB_, isFromL1_, minL1Qual_),
Expand Down Expand Up @@ -247,22 +254,14 @@ void MuonHLTSeedMVAClassifier::fillDescriptions(edm::ConfigurationDescriptions&
desc.add<bool>("rejectAll", false);
desc.add<bool>("isFromL1", false);

desc.add<edm::FileInPath>("mvaFileBL1",
desc.add<edm::FileInPath>("mvaFileB",
edm::FileInPath("RecoMuon/TrackerSeedGenerator/data/xgb_Run3_Iter2FromL1Seeds_barrel.xml"));
desc.add<edm::FileInPath>("mvaFileEL1",
desc.add<edm::FileInPath>("mvaFileE",
edm::FileInPath("RecoMuon/TrackerSeedGenerator/data/xgb_Run3_Iter2FromL1Seeds_endcap.xml"));
desc.add<edm::FileInPath>("mvaFileBL2",
edm::FileInPath("RecoMuon/TrackerSeedGenerator/data/xgb_Run3_Iter2Seeds_barrel.xml"));
desc.add<edm::FileInPath>("mvaFileEL2",
edm::FileInPath("RecoMuon/TrackerSeedGenerator/data/xgb_Run3_Iter2Seeds_endcap.xml"));
desc.add<std::vector<double>>("mvaScaleMeanBL1", {0., 0., 0., 0., 0., 0., 0., 0.});
desc.add<std::vector<double>>("mvaScaleStdBL1", {1., 1., 1., 1., 1., 1., 1., 1.});
desc.add<std::vector<double>>("mvaScaleMeanEL1", {0., 0., 0., 0., 0., 0., 0., 0.});
desc.add<std::vector<double>>("mvaScaleStdEL1", {1., 1., 1., 1., 1., 1., 1., 1.});
desc.add<std::vector<double>>("mvaScaleMeanBL2", {0., 0., 0., 0., 0., 0., 0., 0., 0., 0.});
desc.add<std::vector<double>>("mvaScaleStdBL2", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
desc.add<std::vector<double>>("mvaScaleMeanEL2", {0., 0., 0., 0., 0., 0., 0., 0., 0., 0.});
desc.add<std::vector<double>>("mvaScaleStdEL2", {1., 1., 1., 1., 1., 1., 1., 1., 1., 1.});
desc.add<std::vector<double>>("mvaScaleMeanB", {0., 0., 0., 0., 0., 0., 0., 0.});
desc.add<std::vector<double>>("mvaScaleStdB", {1., 1., 1., 1., 1., 1., 1., 1.});
desc.add<std::vector<double>>("mvaScaleMeanE", {0., 0., 0., 0., 0., 0., 0., 0.});
desc.add<std::vector<double>>("mvaScaleStdE", {1., 1., 1., 1., 1., 1., 1., 1.});

desc.add<bool>("doSort", false);
desc.add<int>("nSeedsMaxB", 1e6);
Expand Down