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

Fixes to L2Tau CNN and deepTauID for HLT #36009

Merged
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
3 changes: 2 additions & 1 deletion RecoTauTag/HLTProducers/python/applyL2TauTag.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def update(process):
nExpected = 2,
L1TauSrc = 'hltL1sDoubleTauBigOR',
L2Outcomes = 'hltL2TauTagNNProducer:DoubleTau',
DiscrWP = thWp[working_point]
DiscrWP = thWp[working_point],
l1TauPtThreshold = 250,
)
# L2 updated Sequence
process.hltL2TauTagNNSequence = cms.Sequence(process.HLTDoCaloSequence + process.hltL1sDoubleTauBigOR + process.hltL2TauTagNNProducer)
Expand Down
7 changes: 5 additions & 2 deletions RecoTauTag/HLTProducers/src/L2TauTagFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class L2TauTagFilter : public HLTFilter {
l1TauSrc_(cfg.getParameter<edm::InputTag>("L1TauSrc")),
l1TauSrcToken_(consumes<trigger::TriggerFilterObjectWithRefs>(l1TauSrc_)),
l2OutcomesToken_(consumes<std::vector<float>>(cfg.getParameter<edm::InputTag>("L2Outcomes"))),
discrWP_(cfg.getParameter<double>("DiscrWP")) {}
discrWP_(cfg.getParameter<double>("DiscrWP")),
l1PtTh_(cfg.getParameter<double>("l1TauPtThreshold")) {}
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
makeHLTFilterDescription(desc);
Expand All @@ -35,6 +36,7 @@ class L2TauTagFilter : public HLTFilter {
->setComment("Which trigger should the L1 Taus collection pass");
desc.add<edm::InputTag>("L2Outcomes", edm::InputTag(""))->setComment("L2 CNN outcomes");
desc.add<double>("DiscrWP", 0.1227)->setComment("value of discriminator threshold");
desc.add<double>("l1TauPtThreshold", 250)->setComment("value of L1Tau pass-through pt threshold");
descriptions.addWithDefaultLabel(desc);
}

Expand All @@ -55,7 +57,7 @@ class L2TauTagFilter : public HLTFilter {
throw cms::Exception("Inconsistent Data", "L2TauTagFilter::hltFilter") << "CNN output size != L1 taus size \n";
}
for (size_t l1_idx = 0; l1_idx < l1Taus.size(); l1_idx++) {
if (L2Outcomes[l1_idx] >= discrWP_) {
if (L2Outcomes[l1_idx] >= discrWP_ || l1Taus[l1_idx]->pt() > l1PtTh_) {
filterproduct.addObject(nTauPassed, l1Taus[l1_idx]);
nTauPassed++;
}
Expand All @@ -70,6 +72,7 @@ class L2TauTagFilter : public HLTFilter {
const edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> l1TauSrcToken_;
const edm::EDGetTokenT<std::vector<float>> l2OutcomesToken_;
const double discrWP_;
const double l1PtTh_;
};

//define this as a plug-in
Expand Down
29 changes: 16 additions & 13 deletions RecoTauTag/HLTProducers/src/L2TauTagNNProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -255,18 +255,21 @@ void L2TauNNProducer::fillDescriptions(edm::ConfigurationDescriptions& descripti
edm::ParameterSetDescription desc;
desc.add<int>("debugLevel", 0)->setComment("set debug level for printing out info");
edm::ParameterSetDescription l1TausPset;
l1TausPset.add<std::string>("L1CollectionName", "")->setComment("Name of collections");
l1TausPset.add<edm::InputTag>("L1TauTrigger", edm::InputTag(""))
l1TausPset.add<std::string>("L1CollectionName", "DoubleTau")->setComment("Name of collections");
l1TausPset.add<edm::InputTag>("L1TauTrigger", edm::InputTag("hltL1sDoubleTauBigOR"))
->setComment("Which trigger should the L1 Taus collection pass");
desc.addVPSet("L1Taus", l1TausPset);
desc.add<edm::InputTag>("hbheInput", edm::InputTag(""))->setComment("HBHE recHit collection");
desc.add<edm::InputTag>("hoInput", edm::InputTag(""))->setComment("HO recHit Collection");
desc.add<edm::InputTag>("ebInput", edm::InputTag(""))->setComment("EB recHit Collection");
desc.add<edm::InputTag>("eeInput", edm::InputTag(""))->setComment("EE recHit Collection");
edm::ParameterSet l1TausPSetDefault;
l1TausPSetDefault.addParameter<std::string>("L1CollectionName", "DoubleTau");
l1TausPSetDefault.addParameter<edm::InputTag>("L1TauTrigger", edm::InputTag("hltL1sDoubleTauBigOR"));
desc.addVPSet("L1Taus", l1TausPset, {l1TausPSetDefault});
desc.add<edm::InputTag>("hbheInput", edm::InputTag("hltHbhereco"))->setComment("HBHE recHit collection");
desc.add<edm::InputTag>("hoInput", edm::InputTag("hltHoreco"))->setComment("HO recHit Collection");
desc.add<edm::InputTag>("ebInput", edm::InputTag("hltEcalRecHit:EcalRecHitsEB"))->setComment("EB recHit Collection");
desc.add<edm::InputTag>("eeInput", edm::InputTag("hltEcalRecHit:EcalRecHitsEE"))->setComment("EE recHit Collection");
desc.add<edm::InputTag>("pataVertices", edm::InputTag("hltPixelVerticesSoA"))
->setComment("patatrack vertices collection");
desc.add<edm::InputTag>("pataTracks", edm::InputTag("hltPixelTracksSoA"))->setComment("patatrack collection");
desc.add<edm::InputTag>("BeamSpot", edm::InputTag(""))->setComment("BeamSpot Collection");
desc.add<edm::InputTag>("BeamSpot", edm::InputTag("hltOnlineBeamSpot"))->setComment("BeamSpot Collection");
desc.add<uint>("maxVtx", 100)->setComment("max output collection size (number of accepted vertices)");
desc.add<double>("fractionSumPt2", 0.3)->setComment("threshold on sumPt2 fraction of the leading vertex");
desc.add<double>("minSumPt2", 0.)->setComment("min sumPt2");
Expand Down Expand Up @@ -403,8 +406,8 @@ void L2TauNNProducer::fillL1TauVars(tensorflow::Tensor& cellGridMatrix, const st
auto getCell = [&](NNInputs input) -> float& {
return getCellImpl(cellGridMatrix, tau_idx, phi_idx, eta_idx, input);
};
getCell(NNInputs::l1Tau_pt) = allTaus[tau_idx]->polarP4().pt();
getCell(NNInputs::l1Tau_eta) = allTaus[tau_idx]->polarP4().eta();
getCell(NNInputs::l1Tau_pt) = allTaus[tau_idx]->pt();
getCell(NNInputs::l1Tau_eta) = allTaus[tau_idx]->eta();
getCell(NNInputs::l1Tau_hwIso) = allTaus[tau_idx]->hwIso();
}
}
Expand Down Expand Up @@ -675,8 +678,8 @@ void L2TauNNProducer::fillPatatracks(tensorflow::Tensor& cellGridMatrix,
};
const int nTaus = static_cast<int>(allTaus.size());
for (tau_idx = 0; tau_idx < nTaus; tau_idx++) {
const float tauEta = allTaus[tau_idx]->polarP4().eta();
const float tauPhi = allTaus[tau_idx]->polarP4().phi();
const float tauEta = allTaus[tau_idx]->eta();
const float tauPhi = allTaus[tau_idx]->phi();

auto maxTracks = patatracks_tsoa.stride();
auto const* quality = patatracks_tsoa.qualityData();
Expand Down Expand Up @@ -826,7 +829,7 @@ void L2TauNNProducer::produce(edm::Event& event, const edm::EventSetup& eventset
for (size_t tau_pos = 0; tau_pos < nTau; ++tau_pos) {
const auto tau_idx = TauCollectionMap[inp_idx][tau_pos];
if (debugLevel_ > 0) {
edm::LogInfo("DebugInfo") << event.id().event() << " \t " << (allTaus[tau_idx])->polarP4().pt() << " \t "
edm::LogInfo("DebugInfo") << event.id().event() << " \t " << (allTaus[tau_idx])->pt() << " \t "
<< tau_score.at(tau_idx) << std::endl;
}
(*tau_tags)[tau_pos] = tau_score.at(tau_idx);
Expand Down
6 changes: 3 additions & 3 deletions RecoTauTag/RecoTau/plugins/DeepTauId.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1163,9 +1163,9 @@ class DeepTauId : public deep_tau::DeepTauBase {
desc.add<bool>("save_inputs", false);
desc.add<bool>("is_online", false);

desc.add<std::vector<std::string>>("VSeWP");
desc.add<std::vector<std::string>>("VSmuWP");
desc.add<std::vector<std::string>>("VSjetWP");
desc.add<std::vector<std::string>>("VSeWP", {"-1."});
desc.add<std::vector<std::string>>("VSmuWP", {"-1."});
desc.add<std::vector<std::string>>("VSjetWP", {"-1."});

desc.addUntracked<edm::InputTag>("basicTauDiscriminators", edm::InputTag("basicTauDiscriminators"));
desc.addUntracked<edm::InputTag>("basicTauDiscriminatorsdR03", edm::InputTag("basicTauDiscriminatorsdR03"));
Expand Down