23 static std::unique_ptr<TauNNTFCache> initializeGlobalCache(
const edm::ParameterSet&);
30 std::unique_ptr<PFTauCollection>& outputTaus);
44 : fSeedPt_(
cfg.getParameter<double>(
"seedpt")),
45 fConeSize_(
cfg.getParameter<double>(
"conesize")),
46 fTauSize_(
cfg.getParameter<double>(
"tausize")),
47 fMaxTaus_(
cfg.getParameter<
int>(
"maxtaus")),
48 fNParticles_(
cfg.getParameter<
int>(
"nparticles")),
52 lNNFile.find(
"v0") == std::string::npos ?
"input_1:0" :
"dense_1_input:0",
cache, lNNFile,
fNParticles_);
53 produces<l1t::PFTauCollection>(
"L1PFTausNN");
61 return std::unique_ptr<TauNNTFCache>(
cache);
64 if (
cache->graphDef !=
nullptr) {
65 delete cache->graphDef;
72 std::vector<unique_ptr<l1t::PFCandidate>> pfChargedHadrons_sort_v;
73 std::vector<unique_ptr<l1t::PFCandidate>> pfChargedHadrons_seeds_v;
74 for (
const auto& l1PFCand : *l1PFCandidates)
77 pfChargedHadrons_sort_v.push_back(std::make_unique<l1t::PFCandidate>(l1PFCand));
80 pfChargedHadrons_sort_v.begin(),
81 pfChargedHadrons_sort_v.end(),
82 [](std::unique_ptr<l1t::PFCandidate>&
i, std::unique_ptr<l1t::PFCandidate>&
j) {
return (
i->pt() >
j->pt()); });
84 auto lTaus = std::make_unique<l1t::PFTauCollection>();
85 if (pfChargedHadrons_sort_v.empty()) {
88 lTaus->push_back(
dummy);
93 pfChargedHadrons_seeds_v.push_back(
std::move(pfChargedHadrons_sort_v[0]));
94 for (
unsigned int i0 = 1; i0 < pfChargedHadrons_sort_v.size(); i0++) {
96 for (
unsigned int i1 = 0;
i1 < pfChargedHadrons_seeds_v.size();
i1++) {
102 pfChargedHadrons_seeds_v.push_back(
std::move(pfChargedHadrons_sort_v[i0]));
103 if (
int(pfChargedHadrons_seeds_v.size()) >
fMaxTaus_ - 1)
106 for (
unsigned int i0 = 0; i0 < pfChargedHadrons_seeds_v.size(); i0++) {
107 addTau(*(pfChargedHadrons_seeds_v[i0]), (*l1PFCandidates), lTaus);
109 if (lTaus->empty()) {
111 lTaus->push_back(
dummy);
120 std::unique_ptr<l1t::PFTauCollection>& outputTaus) {
125 for (
const auto& l1PFCand : iParts) {
136 pfTauCands.push_back(l1PFCand);
142 float NN =
fTauNNId_->compute(iCand, pfTauCands);
145 outputTaus->push_back(l1PFTau);
150 desc.add<
std::string>(
"NNFileName",
"L1Trigger/Phase2L1ParticleFlow/data/tau_3layer.pb");
151 desc.add<
double>(
"tausize", 0.1);
152 desc.add<
int>(
"maxtaus", 5);
153 desc.add<
int>(
"nparticles", 10);
154 desc.add<
double>(
"conesize", 0.4);
155 desc.add<
double>(
"seedpt", 20);
157 descriptions.
add(
"L1NNTauProducer",
desc);