CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Public Attributes
deep_tau::DeepTauBase::Output Struct Reference

#include <DeepTauBase.h>

Public Types

using ResultMap = std::map< std::string, std::unique_ptr< TauDiscriminator >>
 

Public Member Functions

ResultMap get_value (const edm::Handle< TauCollection > &taus, const tensorflow::Tensor &pred, const WPMap &working_points) const
 
 Output (const std::vector< size_t > &num, const std::vector< size_t > &den)
 

Public Attributes

std::vector< size_t > den_
 
std::vector< size_t > num_
 

Detailed Description

Definition at line 72 of file DeepTauBase.h.

Member Typedef Documentation

using deep_tau::DeepTauBase::Output::ResultMap = std::map<std::string, std::unique_ptr<TauDiscriminator>>

Definition at line 73 of file DeepTauBase.h.

Constructor & Destructor Documentation

deep_tau::DeepTauBase::Output::Output ( const std::vector< size_t > &  num,
const std::vector< size_t > &  den 
)
inline

Definition at line 76 of file DeepTauBase.h.

References das::get_value(), nano_cff::taus, and FWLite::working_points.

76 : num_(num), den_(den) {}
std::vector< size_t > num_
Definition: DeepTauBase.h:74
std::vector< size_t > den_
Definition: DeepTauBase.h:74

Member Function Documentation

DeepTauBase::Output::ResultMap deep_tau::DeepTauBase::Output::get_value ( const edm::Handle< TauCollection > &  taus,
const tensorflow::Tensor &  pred,
const WPMap working_points 
) const

Definition at line 50 of file DeepTauBase.cc.

References SiStripPI::max, convertSQLitetoXML_cfg::output, and metsig::tau.

53 {
55  output[""] = std::make_unique<TauDiscriminator>(TauRefProd(taus));
56  for(const auto& wp : working_points)
57  output[wp.first] = std::make_unique<TauDiscriminator>(TauRefProd(taus));
58 
59  for(size_t tau_index = 0; tau_index < taus->size(); ++tau_index) {
60  float x = 0;
61  for(size_t num_elem : num_)
62  x += pred.matrix<float>()(tau_index, num_elem);
63  if(x != 0 && !den_.empty()) {
64  float den_val = 0;
65  for(size_t den_elem : den_)
66  den_val += pred.matrix<float>()(tau_index, den_elem);
67  x = den_val != 0 ? x / den_val : std::numeric_limits<float>::max();
68  }
69  output[""]->setValue(tau_index, x);
70  for(const auto& wp : working_points) {
71  const auto& tau = taus->at(tau_index);
72  const bool pass = x > (*wp.second)(tau);
73  output[wp.first]->setValue(tau_index, pass);
74  }
75  }
76  return output;
77 }
std::vector< size_t > num_
Definition: DeepTauBase.h:74
working_points
Definition: FWLite.py:126
edm::RefProd< TauCollection > TauRefProd
Definition: DeepTauBase.h:64
std::vector< size_t > den_
Definition: DeepTauBase.h:74
std::map< std::string, std::unique_ptr< TauDiscriminator >> ResultMap
Definition: DeepTauBase.h:73

Member Data Documentation

std::vector<size_t> deep_tau::DeepTauBase::Output::den_

Definition at line 74 of file DeepTauBase.h.

std::vector<size_t> deep_tau::DeepTauBase::Output::num_

Definition at line 74 of file DeepTauBase.h.