1 #ifndef RecoTauTag_RecoTau_DeepTauBase_h
2 #define RecoTauTag_RecoTau_DeepTauBase_h
13 #include <Math/VectorUtil.h>
17 #include "tensorflow/core/util/memmapped_file_system.h"
44 std::unique_ptr<TF1>
fn_;
50 using GraphPtr = std::shared_ptr<tensorflow::GraphDef>;
62 std::map<std::string, tensorflow::Session*>
sessions_;
63 std::map<std::string, std::unique_ptr<tensorflow::MemmappedEnv>>
memmappedEnv_;
78 using WPList = std::vector<CutterPtr>;
83 Output(
const std::vector<size_t>&
num,
const std::vector<size_t>& den) :
num_(num),
den_(den) {}
86 const tensorflow::Tensor& pred,
101 template <
typename ConsumeType>
void fill(const edm::Event &evt)
DeepTauCache(const std::map< std::string, std::string > &graph_names, bool mem_mapped)
std::unique_ptr< TF1 > fn_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::map< std::string, tensorflow::Session * > sessions_
edm::EDGetTokenT< TauCollection > tausToken_
dictionary working_points
double operator()(const reco::BaseTau &tau, bool isPFTau) const
const DeepTauCache * cache_
std::vector< size_t > num_
const tensorflow::GraphDef & getGraph(const std::string &name="") const
static void globalEndJob(const DeepTauCache *cache)
std::vector< size_t > den_
std::map< std::string, Output > OutputCollection
std::vector< CutterPtr > WPList
void produce(edm::Event &event, const edm::EventSetup &es) override
std::unique_ptr< TauDiscriminator > get_value(const edm::Handle< TauCollection > &taus, const tensorflow::Tensor &pred, const WPList *working_points, bool is_online) const
static const std::vector< BasicDiscriminator > requiredBasicDiscriminatorsdR03_
OutputCollection outputs_
Output(const std::vector< size_t > &num, const std::vector< size_t > &den)
std::vector< Electron > ElectronCollection
std::shared_ptr< tensorflow::GraphDef > GraphPtr
edm::EDGetTokenT< ConsumeType > disc_token
TauWPThreshold(const std::string &cut_str)
pat::ElectronCollection ElectronCollection
static const std::vector< BasicDiscriminator > requiredBasicDiscriminators_
DeepTauBase(const edm::ParameterSet &cfg, const OutputCollection &outputs, const DeepTauCache *cache)
std::map< std::string, WPList > workingPoints_
virtual tensorflow::Tensor getPredictions(edm::Event &event, edm::Handle< TauCollection > taus)=0
virtual void createOutputs(edm::Event &event, const tensorflow::Tensor &pred, edm::Handle< TauCollection > taus)
pat::MuonCollection MuonCollection
edm::ValueMap< SingleTauDiscriminatorContainer > TauDiscriminatorContainer
edm::Handle< ConsumeType > handle
uint8_t andPrediscriminants_
static const std::map< BasicDiscriminator, std::string > stringFromDiscriminator_
static std::unique_ptr< DeepTauCache > initializeGlobalCache(const edm::ParameterSet &cfg)
std::vector< Muon > MuonCollection
std::unique_ptr< Cutter > CutterPtr
std::map< std::string, GraphPtr > graphs_
std::map< std::string, std::unique_ptr< tensorflow::MemmappedEnv > > memmappedEnv_
std::vector< TauDiscInfo< pat::PATTauDiscriminator > > patPrediscriminants_
edm::EDGetTokenT< CandidateCollection > pfcandToken_
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double >> LorentzVectorXYZ
std::vector< TauDiscInfo< reco::PFTauDiscriminator > > recoPrediscriminants_
tensorflow::Session & getSession(const std::string &name="") const
edm::EDGetTokenT< reco::VertexCollection > vtxToken_