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);
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);
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);
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
static constexpr float track_trigger_eta_max
double pt() const final
transverse momentum
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
GraphDef * loadGraphDef(const std::string &pbFile)
std::vector< l1t::PFCandidate > PFCandidateCollection
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
edm::EDGetTokenT< vector< l1t::PFCandidate > > fL1PFToken_
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
void addTau(const l1t::PFCandidate &iCand, const l1t::PFCandidateCollection &iParts, std::unique_ptr< PFTauCollection > &outputTaus)
std::unique_ptr< TauNNId > fTauNNId_
constexpr Matriplex::idx_t NN
Abs< T >::type abs(const T &t)
static std::unique_ptr< TauNNTFCache > initializeGlobalCache(const edm::ParameterSet &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
~L1NNTauProducer() override
void setLogging(const std::string &level="3")
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static void globalEndJob(const TauNNTFCache *)
T getParameter(std::string const &) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
L1NNTauProducer(const edm::ParameterSet &, const TauNNTFCache *)
std::atomic< tensorflow::GraphDef * > graphDef