CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
DeepTauId Class Reference
Inheritance diagram for DeepTauId:
deep_tau::DeepTauBase edm::stream::EDProducer< edm::GlobalCache< DeepTauCache > >

Public Member Functions

 DeepTauId (const edm::ParameterSet &cfg, const deep_tau::DeepTauCache *cache)
 
- Public Member Functions inherited from deep_tau::DeepTauBase
 DeepTauBase (const edm::ParameterSet &cfg, const OutputCollection &outputs, const DeepTauCache *cache)
 
void produce (edm::Event &event, const edm::EventSetup &es) override
 
 ~DeepTauBase () override
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DeepTauCache > >
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
static const OutputCollectionGetOutputs ()
 
static void globalEndJob (const deep_tau::DeepTauCache *cache_)
 
static std::unique_ptr< deep_tau::DeepTauCacheinitializeGlobalCache (const edm::ParameterSet &cfg)
 
- Static Public Member Functions inherited from deep_tau::DeepTauBase
static void globalEndJob (const DeepTauCache *cache)
 
static std::unique_ptr< DeepTauCacheinitializeGlobalCache (const edm::ParameterSet &cfg)
 

Static Public Attributes

static float default_value = -999.
 

Private Member Functions

void checkInputs (const tensorflow::Tensor &inputs, const char *block_name, int n_inputs, int n_eta=1, int n_phi=1) const
 
void createConvFeatures (const TauType &tau, const reco::Vertex &pv, double rho, const pat::ElectronCollection &electrons, const pat::MuonCollection &muons, const pat::PackedCandidateCollection &pfCands, const CellGrid &grid, bool is_inner)
 
void createEgammaBlockInputs (unsigned idx, const TauType &tau, const reco::Vertex &pv, double rho, const pat::ElectronCollection &electrons, const pat::PackedCandidateCollection &pfCands, const Cell &cell_map, bool is_inner)
 
void createHadronsBlockInputs (unsigned idx, const TauType &tau, const reco::Vertex &pv, double rho, const pat::PackedCandidateCollection &pfCands, const Cell &cell_map, bool is_inner)
 
template<typename dnn >
tensorflow::Tensor createInputsV1 (const TauType &tau, const ElectronCollection &electrons, const MuonCollection &muons) const
 
void createMuonBlockInputs (unsigned idx, const TauType &tau, const reco::Vertex &pv, double rho, const pat::MuonCollection &muons, const pat::PackedCandidateCollection &pfCands, const Cell &cell_map, bool is_inner)
 
void createTauBlockInputs (const TauType &tau, const reco::Vertex &pv, double rho)
 
template<typename Collection >
void fillGrids (const TauType &tau, const Collection &objects, CellGrid &inner_grid, CellGrid &outer_grid)
 
tensorflow::Tensor getPartialPredictions (bool is_inner)
 
tensorflow::Tensor getPredictions (edm::Event &event, const edm::EventSetup &es, edm::Handle< TauCollection > taus) override
 
void getPredictionsV1 (const TauType &tau, const pat::ElectronCollection &electrons, const pat::MuonCollection &muons, std::vector< tensorflow::Tensor > &pred_vector)
 
void getPredictionsV2 (const TauType &tau, const pat::ElectronCollection &electrons, const pat::MuonCollection &muons, const pat::PackedCandidateCollection &pfCands, const reco::Vertex &pv, double rho, std::vector< tensorflow::Tensor > &pred_vector)
 
void setCellConvFeatures (tensorflow::Tensor &convTensor, const tensorflow::Tensor &features, unsigned batch_idx, int eta_index, int phi_index)
 

Static Private Member Functions

static void calculateElectronClusterVars (const pat::Electron *ele, float &elecEe, float &elecEgamma)
 
static bool calculateElectronClusterVarsV2 (const pat::Electron &ele, float &cc_ele_energy, float &cc_gamma_energy, int &cc_n_gamma)
 
static bool calculateGottfriedJacksonAngleDifference (const pat::Tau &tau, double &gj_diff)
 
static float calculateGottfriedJacksonAngleDifference (const pat::Tau &tau)
 
static const pat::ElectronfindMatchedElectron (const pat::Tau &tau, const pat::ElectronCollection &electrons, double deltaR)
 
static double getInnerSignalConeRadius (double pt)
 
template<typename T >
static float getValue (T value)
 
template<typename T >
static float getValueLinear (T value, float min_value, float max_value, bool positive)
 
template<typename T >
static float getValueNorm (T value, float mean, float sigma, float n_sigmas_max=5)
 
static bool isInEcalCrack (double eta)
 
template<typename CandidateCollection >
static void processIsolationPFComponents (const pat::Tau &tau, const CandidateCollection &candidates, LorentzVectorXYZ &p4, float &pt, float &d_eta, float &d_phi, float &m, float &n)
 
template<typename CandidateCollection >
static void processSignalPFComponents (const pat::Tau &tau, const CandidateCollection &candidates, LorentzVectorXYZ &p4_inner, LorentzVectorXYZ &p4_outer, float &pt_inner, float &dEta_inner, float &dPhi_inner, float &m_inner, float &pt_outer, float &dEta_outer, float &dPhi_outer, float &m_outer, float &n_inner, float &n_outer)
 

Private Attributes

std::array< std::unique_ptr< tensorflow::Tensor >, 2 > convTensor_
 
const int debug_level
 
const bool disable_dxy_pca_
 
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > eGammaTensor_
 
edm::EDGetTokenT< ElectronCollectionelectrons_token_
 
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > hadronsTensor_
 
std::string input_layer_
 
edm::EDGetTokenT< MuonCollectionmuons_token_
 
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > muonTensor_
 
std::string output_layer_
 
edm::EDGetTokenT< double > rho_token_
 
std::unique_ptr< tensorflow::Tensor > tauBlockTensor_
 
const unsigned version
 
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > zeroOutputTensor_
 

Static Private Attributes

static float pi = M_PI
 

Additional Inherited Members

- Public Types inherited from deep_tau::DeepTauBase
using Cutter = TauWPThreshold
 
using CutterPtr = std::unique_ptr< Cutter >
 
using ElectronCollection = pat::ElectronCollection
 
using LorentzVectorXYZ = ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double >>
 
using MuonCollection = pat::MuonCollection
 
using OutputCollection = std::map< std::string, Output >
 
using TauCollection = std::vector< TauType >
 
using TauDiscriminator = pat::PATTauDiscriminator
 
using TauRef = edm::Ref< TauCollection >
 
using TauRefProd = edm::RefProd< TauCollection >
 
using TauType = pat::Tau
 
using WPMap = std::map< std::string, CutterPtr >
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DeepTauCache > >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Protected Attributes inherited from deep_tau::DeepTauBase
const DeepTauCachecache_
 
OutputCollection outputs_
 
edm::EDGetTokenT< pat::PackedCandidateCollectionpfcandToken_
 
edm::EDGetTokenT< TauCollectiontausToken_
 
edm::EDGetTokenT< reco::VertexCollectionvtxToken_
 
std::map< std::string, WPMapworkingPoints_
 

Detailed Description

Definition at line 808 of file DeepTauId.cc.

Constructor & Destructor Documentation

DeepTauId::DeepTauId ( const edm::ParameterSet cfg,
const deep_tau::DeepTauCache cache 
)
inlineexplicit

Definition at line 854 of file DeepTauId.cc.

References Exception, dqmiodumpmetadata::n, Skims_PA_cff::name, and BeamSplash_cfg::version.

855  : DeepTauBase(cfg, GetOutputs(), cache),
856  electrons_token_(consumes<ElectronCollection>(cfg.getParameter<edm::InputTag>("electrons"))),
857  muons_token_(consumes<MuonCollection>(cfg.getParameter<edm::InputTag>("muons"))),
858  rho_token_(consumes<double>(cfg.getParameter<edm::InputTag>("rho"))),
859  version(cfg.getParameter<unsigned>("version")),
860  debug_level(cfg.getParameter<int>("debug_level")),
861  disable_dxy_pca_(cfg.getParameter<bool>("disable_dxy_pca")) {
862  if (version == 1) {
863  input_layer_ = cache_->getGraph().node(0).name();
864  output_layer_ = cache_->getGraph().node(cache_->getGraph().node_size() - 1).name();
865  const auto& shape = cache_->getGraph().node(0).attr().at("shape").shape();
866  if (shape.dim(1).size() != dnn_inputs_2017v1::NumberOfInputs)
867  throw cms::Exception("DeepTauId")
868  << "number of inputs does not match the expected inputs for the given version";
869  } else if (version == 2) {
870  tauBlockTensor_ = std::make_unique<tensorflow::Tensor>(
871  tensorflow::DT_FLOAT, tensorflow::TensorShape{1, dnn_inputs_2017_v2::TauBlockInputs::NumberOfInputs});
872  for (size_t n = 0; n < 2; ++n) {
873  const bool is_inner = n == 0;
874  const auto n_cells =
875  is_inner ? dnn_inputs_2017_v2::number_of_inner_cell : dnn_inputs_2017_v2::number_of_outer_cell;
876  eGammaTensor_[is_inner] = std::make_unique<tensorflow::Tensor>(
877  tensorflow::DT_FLOAT,
878  tensorflow::TensorShape{1, 1, 1, dnn_inputs_2017_v2::EgammaBlockInputs::NumberOfInputs});
879  muonTensor_[is_inner] = std::make_unique<tensorflow::Tensor>(
880  tensorflow::DT_FLOAT,
881  tensorflow::TensorShape{1, 1, 1, dnn_inputs_2017_v2::MuonBlockInputs::NumberOfInputs});
882  hadronsTensor_[is_inner] = std::make_unique<tensorflow::Tensor>(
883  tensorflow::DT_FLOAT,
884  tensorflow::TensorShape{1, 1, 1, dnn_inputs_2017_v2::HadronBlockInputs::NumberOfInputs});
885  convTensor_[is_inner] = std::make_unique<tensorflow::Tensor>(
886  tensorflow::DT_FLOAT,
887  tensorflow::TensorShape{1, n_cells, n_cells, dnn_inputs_2017_v2::number_of_conv_features});
888  zeroOutputTensor_[is_inner] = std::make_unique<tensorflow::Tensor>(
889  tensorflow::DT_FLOAT, tensorflow::TensorShape{1, 1, 1, dnn_inputs_2017_v2::number_of_conv_features});
890 
891  eGammaTensor_[is_inner]->flat<float>().setZero();
892  muonTensor_[is_inner]->flat<float>().setZero();
893  hadronsTensor_[is_inner]->flat<float>().setZero();
894 
895  setCellConvFeatures(*zeroOutputTensor_[is_inner], getPartialPredictions(is_inner), 0, 0, 0);
896  }
897  } else {
898  throw cms::Exception("DeepTauId") << "version " << version << " is not supported.";
899  }
900  }
T getParameter(std::string const &) const
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > hadronsTensor_
Definition: DeepTauId.cc:2101
edm::EDGetTokenT< ElectronCollection > electrons_token_
Definition: DeepTauId.cc:2093
const bool disable_dxy_pca_
Definition: DeepTauId.cc:2099
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > zeroOutputTensor_
Definition: DeepTauId.cc:2101
const DeepTauCache * cache_
Definition: DeepTauBase.h:105
const tensorflow::GraphDef & getGraph(const std::string &name="") const
Definition: DeepTauBase.h:50
void setCellConvFeatures(tensorflow::Tensor &convTensor, const tensorflow::Tensor &features, unsigned batch_idx, int eta_index, int phi_index)
Definition: DeepTauId.cc:1172
static const OutputCollection & GetOutputs()
Definition: DeepTauId.cc:812
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > convTensor_
Definition: DeepTauId.cc:2101
std::string output_layer_
Definition: DeepTauId.cc:2096
std::string input_layer_
Definition: DeepTauId.cc:2096
DeepTauBase(const edm::ParameterSet &cfg, const OutputCollection &outputs, const DeepTauCache *cache)
Definition: DeepTauBase.cc:76
const unsigned version
Definition: DeepTauId.cc:2097
tensorflow::Tensor getPartialPredictions(bool is_inner)
Definition: DeepTauId.cc:1086
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > eGammaTensor_
Definition: DeepTauId.cc:2101
edm::EDGetTokenT< MuonCollection > muons_token_
Definition: DeepTauId.cc:2094
const int debug_level
Definition: DeepTauId.cc:2098
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > muonTensor_
Definition: DeepTauId.cc:2101
edm::EDGetTokenT< double > rho_token_
Definition: DeepTauId.cc:2095
std::unique_ptr< tensorflow::Tensor > tauBlockTensor_
Definition: DeepTauId.cc:2100

Member Function Documentation

static void DeepTauId::calculateElectronClusterVars ( const pat::Electron ele,
float &  elecEe,
float &  elecEgamma 
)
inlinestaticprivate

Definition at line 1956 of file DeepTauId.cc.

References HCALHighEnergyHPDFilter_cfi::energy, and pat::Electron::superCluster().

1956  {
1957  if (ele) {
1958  elecEe = elecEgamma = 0;
1959  auto superCluster = ele->superCluster();
1960  if (superCluster.isNonnull() && superCluster.isAvailable() && superCluster->clusters().isNonnull() &&
1961  superCluster->clusters().isAvailable()) {
1962  for (auto iter = superCluster->clustersBegin(); iter != superCluster->clustersEnd(); ++iter) {
1963  const double energy = (*iter)->energy();
1964  if (iter == superCluster->clustersBegin())
1965  elecEe += energy;
1966  else
1967  elecEgamma += energy;
1968  }
1969  }
1970  } else {
1971  elecEe = elecEgamma = default_value;
1972  }
1973  }
static float default_value
Definition: DeepTauId.cc:810
reco::SuperClusterRef superCluster() const override
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
static bool DeepTauId::calculateElectronClusterVarsV2 ( const pat::Electron ele,
float &  cc_ele_energy,
float &  cc_gamma_energy,
int &  cc_n_gamma 
)
inlinestaticprivate

Definition at line 933 of file DeepTauId.cc.

References HCALHighEnergyHPDFilter_cfi::energy, and pat::Electron::superCluster().

936  {
937  cc_ele_energy = cc_gamma_energy = 0;
938  cc_n_gamma = 0;
939  const auto& superCluster = ele.superCluster();
940  if (superCluster.isNonnull() && superCluster.isAvailable() && superCluster->clusters().isNonnull() &&
941  superCluster->clusters().isAvailable()) {
942  for (auto iter = superCluster->clustersBegin(); iter != superCluster->clustersEnd(); ++iter) {
943  const float energy = static_cast<float>((*iter)->energy());
944  if (iter == superCluster->clustersBegin())
945  cc_ele_energy += energy;
946  else {
947  cc_gamma_energy += energy;
948  ++cc_n_gamma;
949  }
950  }
951  return true;
952  } else
953  return false;
954  }
reco::SuperClusterRef superCluster() const override
override the reco::GsfElectron::superCluster method, to access the internal storage of the superclust...
static bool DeepTauId::calculateGottfriedJacksonAngleDifference ( const pat::Tau tau,
double &  gj_diff 
)
inlinestaticprivate

Definition at line 2049 of file DeepTauId.cc.

References funct::abs(), constexpr, pat::Tau::flightLength(), pat::Tau::hasSecondaryVertex(), reco::LeafCandidate::p(), reco::LeafCandidate::p4(), and funct::pow().

2049  {
2050  if (tau.hasSecondaryVertex()) {
2051  static constexpr double mTau = 1.77682;
2052  const double mAOne = tau.p4().M();
2053  const double pAOneMag = tau.p();
2054  const double argumentThetaGJmax = (std::pow(mTau, 2) - std::pow(mAOne, 2)) / (2 * mTau * pAOneMag);
2055  const double argumentThetaGJmeasured =
2056  tau.p4().Vect().Dot(tau.flightLength()) / (pAOneMag * tau.flightLength().R());
2057  if (std::abs(argumentThetaGJmax) <= 1. && std::abs(argumentThetaGJmeasured) <= 1.) {
2058  double thetaGJmax = std::asin(argumentThetaGJmax);
2059  double thetaGJmeasured = std::acos(argumentThetaGJmeasured);
2060  gj_diff = thetaGJmeasured - thetaGJmax;
2061  return true;
2062  }
2063  }
2064  return false;
2065  }
const pat::tau::TauPFEssential::Vector & flightLength() const
Definition: Tau.h:284
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const LorentzVector & p4() const final
four-momentum Lorentz vector
bool hasSecondaryVertex() const
Definition: Tau.h:283
double p() const final
magnitude of momentum vector
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
#define constexpr
static float DeepTauId::calculateGottfriedJacksonAngleDifference ( const pat::Tau tau)
inlinestaticprivate

Definition at line 2067 of file DeepTauId.cc.

2067  {
2068  double gj_diff;
2069  if (calculateGottfriedJacksonAngleDifference(tau, gj_diff))
2070  return static_cast<float>(gj_diff);
2071  return default_value;
2072  }
static bool calculateGottfriedJacksonAngleDifference(const pat::Tau &tau, double &gj_diff)
Definition: DeepTauId.cc:2049
static float default_value
Definition: DeepTauId.cc:810
void DeepTauId::checkInputs ( const tensorflow::Tensor &  inputs,
const char *  block_name,
int  n_inputs,
int  n_eta = 1,
int  n_phi = 1 
) const
inlineprivate

Definition at line 956 of file DeepTauId.cc.

References gather_cfg::cout, PVValHelper::eta, Exception, alignBH_cfg::fixed, dqmMemoryStats::float, input, edm::isNotFinite(), and dqmdumpme::k.

957  {
958  if (debug_level >= 1) {
959  for (int eta = 0; eta < n_eta; ++eta) {
960  for (int phi = 0; phi < n_phi; phi++) {
961  for (int k = 0; k < n_inputs; ++k) {
962  const float input =
963  n_eta == 1 && n_phi == 1 ? inputs.matrix<float>()(0, k) : inputs.tensor<float, 4>()(0, eta, phi, k);
964  if (edm::isNotFinite(input))
965  throw cms::Exception("DeepTauId")
966  << "in the " << block_name << ", input is not finite, i.e. infinite or NaN, for eta_index = " << n_eta
967  << ", phi_index = " << n_phi << ", input_index = " << k;
968  if (debug_level >= 2)
969  std::cout << block_name << "," << eta << "," << phi << "," << k << "," << std::setprecision(5)
970  << std::fixed << input << '\n';
971  }
972  }
973  }
974  }
975  }
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
static std::string const input
Definition: EdmProvDump.cc:48
const int debug_level
Definition: DeepTauId.cc:2098
void DeepTauId::createConvFeatures ( const TauType tau,
const reco::Vertex pv,
double  rho,
const pat::ElectronCollection electrons,
const pat::MuonCollection muons,
const pat::PackedCandidateCollection pfCands,
const CellGrid &  grid,
bool  is_inner 
)
inlineprivate

Definition at line 1110 of file DeepTauId.cc.

References PVValHelper::eta, training_settings::idx, and createfilelist::int.

1117  {
1118  tensorflow::Tensor& convTensor = *convTensor_.at(is_inner);
1119 
1120  eGammaTensor_[is_inner] = std::make_unique<tensorflow::Tensor>(
1121  tensorflow::DT_FLOAT,
1122  tensorflow::TensorShape{
1123  (long long int)grid.num_valid_cells(), 1, 1, dnn_inputs_2017_v2::EgammaBlockInputs::NumberOfInputs});
1124  muonTensor_[is_inner] = std::make_unique<tensorflow::Tensor>(
1125  tensorflow::DT_FLOAT,
1126  tensorflow::TensorShape{
1127  (long long int)grid.num_valid_cells(), 1, 1, dnn_inputs_2017_v2::MuonBlockInputs::NumberOfInputs});
1128  hadronsTensor_[is_inner] = std::make_unique<tensorflow::Tensor>(
1129  tensorflow::DT_FLOAT,
1130  tensorflow::TensorShape{
1131  (long long int)grid.num_valid_cells(), 1, 1, dnn_inputs_2017_v2::HadronBlockInputs::NumberOfInputs});
1132 
1133  eGammaTensor_[is_inner]->flat<float>().setZero();
1134  muonTensor_[is_inner]->flat<float>().setZero();
1135  hadronsTensor_[is_inner]->flat<float>().setZero();
1136 
1137  unsigned idx = 0;
1138  for (int eta = -grid.maxEtaIndex(); eta <= grid.maxEtaIndex(); ++eta) {
1139  for (int phi = -grid.maxPhiIndex(); phi <= grid.maxPhiIndex(); ++phi) {
1140  const CellIndex cell_index{eta, phi};
1141  const auto cell_iter = grid.find(cell_index);
1142  if (cell_iter != grid.end()) {
1143  const Cell& cell = cell_iter->second;
1144  createEgammaBlockInputs(idx, tau, pv, rho, electrons, pfCands, cell, is_inner);
1145  createMuonBlockInputs(idx, tau, pv, rho, muons, pfCands, cell, is_inner);
1146  createHadronsBlockInputs(idx, tau, pv, rho, pfCands, cell, is_inner);
1147  idx += 1;
1148  }
1149  }
1150  }
1151 
1152  const auto predTensor = getPartialPredictions(is_inner);
1153 
1154  idx = 0;
1155  for (int eta = -grid.maxEtaIndex(); eta <= grid.maxEtaIndex(); ++eta) {
1156  for (int phi = -grid.maxPhiIndex(); phi <= grid.maxPhiIndex(); ++phi) {
1157  const CellIndex cell_index{eta, phi};
1158  const int eta_index = grid.getEtaTensorIndex(cell_index);
1159  const int phi_index = grid.getPhiTensorIndex(cell_index);
1160 
1161  const auto cell_iter = grid.find(cell_index);
1162  if (cell_iter != grid.end()) {
1163  setCellConvFeatures(convTensor, predTensor, idx, eta_index, phi_index);
1164  idx += 1;
1165  } else {
1166  setCellConvFeatures(convTensor, *zeroOutputTensor_[is_inner], 0, eta_index, phi_index);
1167  }
1168  }
1169  }
1170  }
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > hadronsTensor_
Definition: DeepTauId.cc:2101
void createEgammaBlockInputs(unsigned idx, const TauType &tau, const reco::Vertex &pv, double rho, const pat::ElectronCollection &electrons, const pat::PackedCandidateCollection &pfCands, const Cell &cell_map, bool is_inner)
Definition: DeepTauId.cc:1280
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > zeroOutputTensor_
Definition: DeepTauId.cc:2101
void setCellConvFeatures(tensorflow::Tensor &convTensor, const tensorflow::Tensor &features, unsigned batch_idx, int eta_index, int phi_index)
Definition: DeepTauId.cc:1172
void createMuonBlockInputs(unsigned idx, const TauType &tau, const reco::Vertex &pv, double rho, const pat::MuonCollection &muons, const pat::PackedCandidateCollection &pfCands, const Cell &cell_map, bool is_inner)
Definition: DeepTauId.cc:1499
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > convTensor_
Definition: DeepTauId.cc:2101
tensorflow::Tensor getPartialPredictions(bool is_inner)
Definition: DeepTauId.cc:1086
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > eGammaTensor_
Definition: DeepTauId.cc:2101
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > muonTensor_
Definition: DeepTauId.cc:2101
void createHadronsBlockInputs(unsigned idx, const TauType &tau, const reco::Vertex &pv, double rho, const pat::PackedCandidateCollection &pfCands, const Cell &cell_map, bool is_inner)
Definition: DeepTauId.cc:1639
void DeepTauId::createEgammaBlockInputs ( unsigned  idx,
const TauType tau,
const reco::Vertex pv,
double  rho,
const pat::ElectronCollection electrons,
const pat::PackedCandidateCollection pfCands,
const Cell &  cell_map,
bool  is_inner 
)
inlineprivate

Definition at line 1280 of file DeepTauId.cc.

References funct::abs(), HLT_2018_cff::dPhi, nanoDQM_cff::Electron, f, pat::Tau::flightLength(), dqmMemoryStats::float, reco::JetExtendedAssociation::getValue(), PixelMapPlotter::inputs, reco::LeafCandidate::polarP4(), reco::Vertex::position(), ZElectronSkim_cff::rho, runTauDisplay::tau_eta, and runTauDisplay::tau_pt.

1287  {
1288  namespace dnn = dnn_inputs_2017_v2::EgammaBlockInputs;
1289 
1290  tensorflow::Tensor& inputs = *eGammaTensor_.at(is_inner);
1291 
1292  const auto& get = [&](int var_index) -> float& { return inputs.tensor<float, 4>()(idx, 0, 0, var_index); };
1293 
1294  const bool valid_index_pf_ele = cell_map.count(CellObjectType::PfCand_electron);
1295  const bool valid_index_pf_gamma = cell_map.count(CellObjectType::PfCand_gamma);
1296  const bool valid_index_ele = cell_map.count(CellObjectType::Electron);
1297 
1298  if (!cell_map.empty()) {
1299  get(dnn::rho) = getValueNorm(rho, 21.49f, 9.713f);
1300  get(dnn::tau_pt) = getValueLinear(tau.polarP4().pt(), 20.f, 1000.f, true);
1301  get(dnn::tau_eta) = getValueLinear(tau.polarP4().eta(), -2.3f, 2.3f, false);
1302  get(dnn::tau_inside_ecal_crack) = getValue(isInEcalCrack(tau.polarP4().eta()));
1303  }
1304  if (valid_index_pf_ele) {
1305  size_t index_pf_ele = cell_map.at(CellObjectType::PfCand_electron);
1306 
1307  get(dnn::pfCand_ele_valid) = valid_index_pf_ele;
1308  get(dnn::pfCand_ele_rel_pt) = getValueNorm(pfCands.at(index_pf_ele).polarP4().pt() / tau.polarP4().pt(),
1309  is_inner ? 0.9792f : 0.304f,
1310  is_inner ? 0.5383f : 1.845f);
1311  get(dnn::pfCand_ele_deta) = getValueLinear(pfCands.at(index_pf_ele).polarP4().eta() - tau.polarP4().eta(),
1312  is_inner ? -0.1f : -0.5f,
1313  is_inner ? 0.1f : 0.5f,
1314  false);
1315  get(dnn::pfCand_ele_dphi) = getValueLinear(dPhi(tau.polarP4(), pfCands.at(index_pf_ele).polarP4()),
1316  is_inner ? -0.1f : -0.5f,
1317  is_inner ? 0.1f : 0.5f,
1318  false);
1319  get(dnn::pfCand_ele_pvAssociationQuality) =
1320  getValueLinear<int>(pfCands.at(index_pf_ele).pvAssociationQuality(), 0, 7, true);
1321  get(dnn::pfCand_ele_puppiWeight) = getValue(pfCands.at(index_pf_ele).puppiWeight());
1322  get(dnn::pfCand_ele_charge) = getValue(pfCands.at(index_pf_ele).charge());
1323  get(dnn::pfCand_ele_lostInnerHits) = getValue<int>(pfCands.at(index_pf_ele).lostInnerHits());
1324  get(dnn::pfCand_ele_numberOfPixelHits) =
1325  getValueLinear(pfCands.at(index_pf_ele).numberOfPixelHits(), 0, 10, true);
1326  get(dnn::pfCand_ele_vertex_dx) =
1327  getValueNorm(pfCands.at(index_pf_ele).vertex().x() - pv.position().x(), 0.f, 0.1221f);
1328  get(dnn::pfCand_ele_vertex_dy) =
1329  getValueNorm(pfCands.at(index_pf_ele).vertex().y() - pv.position().y(), 0.f, 0.1226f);
1330  get(dnn::pfCand_ele_vertex_dz) =
1331  getValueNorm(pfCands.at(index_pf_ele).vertex().z() - pv.position().z(), 0.001f, 1.024f);
1332  get(dnn::pfCand_ele_vertex_dx_tauFL) = getValueNorm(
1333  pfCands.at(index_pf_ele).vertex().x() - pv.position().x() - tau.flightLength().x(), 0.f, 0.3411f);
1334  get(dnn::pfCand_ele_vertex_dy_tauFL) = getValueNorm(
1335  pfCands.at(index_pf_ele).vertex().y() - pv.position().y() - tau.flightLength().y(), 0.0003f, 0.3385f);
1336  get(dnn::pfCand_ele_vertex_dz_tauFL) =
1337  getValueNorm(pfCands.at(index_pf_ele).vertex().z() - pv.position().z() - tau.flightLength().z(), 0.f, 1.307f);
1338 
1339  const bool hasTrackDetails = pfCands.at(index_pf_ele).hasTrackDetails();
1340  if (hasTrackDetails) {
1341  get(dnn::pfCand_ele_hasTrackDetails) = hasTrackDetails;
1342  get(dnn::pfCand_ele_dxy) = getValueNorm(pfCands.at(index_pf_ele).dxy(), 0.f, 0.171f);
1343  get(dnn::pfCand_ele_dxy_sig) =
1344  getValueNorm(std::abs(pfCands.at(index_pf_ele).dxy()) / pfCands.at(index_pf_ele).dxyError(), 1.634f, 6.45f);
1345  get(dnn::pfCand_ele_dz) = getValueNorm(pfCands.at(index_pf_ele).dz(), 0.001f, 1.02f);
1346  get(dnn::pfCand_ele_dz_sig) =
1347  getValueNorm(std::abs(pfCands.at(index_pf_ele).dz()) / pfCands.at(index_pf_ele).dzError(), 24.56f, 210.4f);
1348  get(dnn::pfCand_ele_track_chi2_ndof) =
1349  getValueNorm(pfCands.at(index_pf_ele).pseudoTrack().chi2() / pfCands.at(index_pf_ele).pseudoTrack().ndof(),
1350  2.272f,
1351  8.439f);
1352  get(dnn::pfCand_ele_track_ndof) = getValueNorm(pfCands.at(index_pf_ele).pseudoTrack().ndof(), 15.18f, 3.203f);
1353  }
1354  }
1355  if (valid_index_pf_gamma) {
1356  size_t index_pf_gamma = cell_map.at(CellObjectType::PfCand_gamma);
1357  get(dnn::pfCand_gamma_valid) = valid_index_pf_gamma;
1358  get(dnn::pfCand_gamma_rel_pt) = getValueNorm(pfCands.at(index_pf_gamma).polarP4().pt() / tau.polarP4().pt(),
1359  is_inner ? 0.6048f : 0.02576f,
1360  is_inner ? 1.669f : 0.3833f);
1361  get(dnn::pfCand_gamma_deta) = getValueLinear(pfCands.at(index_pf_gamma).polarP4().eta() - tau.polarP4().eta(),
1362  is_inner ? -0.1f : -0.5f,
1363  is_inner ? 0.1f : 0.5f,
1364  false);
1365  get(dnn::pfCand_gamma_dphi) = getValueLinear(dPhi(tau.polarP4(), pfCands.at(index_pf_gamma).polarP4()),
1366  is_inner ? -0.1f : -0.5f,
1367  is_inner ? 0.1f : 0.5f,
1368  false);
1369  get(dnn::pfCand_gamma_pvAssociationQuality) =
1370  getValueLinear<int>(pfCands.at(index_pf_gamma).pvAssociationQuality(), 0, 7, true);
1371  get(dnn::pfCand_gamma_fromPV) = getValueLinear<int>(pfCands.at(index_pf_gamma).fromPV(), 0, 3, true);
1372  get(dnn::pfCand_gamma_puppiWeight) = getValue(pfCands.at(index_pf_gamma).puppiWeight());
1373  get(dnn::pfCand_gamma_puppiWeightNoLep) = getValue(pfCands.at(index_pf_gamma).puppiWeightNoLep());
1374  get(dnn::pfCand_gamma_lostInnerHits) = getValue<int>(pfCands.at(index_pf_gamma).lostInnerHits());
1375  get(dnn::pfCand_gamma_numberOfPixelHits) =
1376  getValueLinear(pfCands.at(index_pf_gamma).numberOfPixelHits(), 0, 7, true);
1377  get(dnn::pfCand_gamma_vertex_dx) =
1378  getValueNorm(pfCands.at(index_pf_gamma).vertex().x() - pv.position().x(), 0.f, 0.0067f);
1379  get(dnn::pfCand_gamma_vertex_dy) =
1380  getValueNorm(pfCands.at(index_pf_gamma).vertex().y() - pv.position().y(), 0.f, 0.0069f);
1381  get(dnn::pfCand_gamma_vertex_dz) =
1382  getValueNorm(pfCands.at(index_pf_gamma).vertex().z() - pv.position().z(), 0.f, 0.0578f);
1383  get(dnn::pfCand_gamma_vertex_dx_tauFL) = getValueNorm(
1384  pfCands.at(index_pf_gamma).vertex().x() - pv.position().x() - tau.flightLength().x(), 0.001f, 0.9565f);
1385  get(dnn::pfCand_gamma_vertex_dy_tauFL) = getValueNorm(
1386  pfCands.at(index_pf_gamma).vertex().y() - pv.position().y() - tau.flightLength().y(), 0.0008f, 0.9592f);
1387  get(dnn::pfCand_gamma_vertex_dz_tauFL) = getValueNorm(
1388  pfCands.at(index_pf_gamma).vertex().z() - pv.position().z() - tau.flightLength().z(), 0.0038f, 2.154f);
1389 
1390  const bool hasTrackDetails = pfCands.at(index_pf_gamma).hasTrackDetails();
1391  if (hasTrackDetails) {
1392  get(dnn::pfCand_gamma_hasTrackDetails) = hasTrackDetails;
1393  get(dnn::pfCand_gamma_dxy) = getValueNorm(pfCands.at(index_pf_gamma).dxy(), 0.0004f, 0.882f);
1394  get(dnn::pfCand_gamma_dxy_sig) = getValueNorm(
1395  std::abs(pfCands.at(index_pf_gamma).dxy()) / pfCands.at(index_pf_gamma).dxyError(), 4.271f, 63.78f);
1396  get(dnn::pfCand_gamma_dz) = getValueNorm(pfCands.at(index_pf_gamma).dz(), 0.0071f, 5.285f);
1397  get(dnn::pfCand_gamma_dz_sig) = getValueNorm(
1398  std::abs(pfCands.at(index_pf_gamma).dz()) / pfCands.at(index_pf_gamma).dzError(), 162.1f, 622.4f);
1399  get(dnn::pfCand_gamma_track_chi2_ndof) = pfCands.at(index_pf_gamma).pseudoTrack().ndof() > 0
1400  ? getValueNorm(pfCands.at(index_pf_gamma).pseudoTrack().chi2() /
1401  pfCands.at(index_pf_gamma).pseudoTrack().ndof(),
1402  4.268f,
1403  15.47f)
1404  : 0;
1405  get(dnn::pfCand_gamma_track_ndof) =
1406  pfCands.at(index_pf_gamma).pseudoTrack().ndof() > 0
1407  ? getValueNorm(pfCands.at(index_pf_gamma).pseudoTrack().ndof(), 12.25f, 4.774f)
1408  : 0;
1409  }
1410  }
1411  if (valid_index_ele) {
1412  size_t index_ele = cell_map.at(CellObjectType::Electron);
1413 
1414  get(dnn::ele_valid) = valid_index_ele;
1415  get(dnn::ele_rel_pt) = getValueNorm(electrons.at(index_ele).polarP4().pt() / tau.polarP4().pt(),
1416  is_inner ? 1.067f : 0.5111f,
1417  is_inner ? 1.521f : 2.765f);
1418  get(dnn::ele_deta) = getValueLinear(electrons.at(index_ele).polarP4().eta() - tau.polarP4().eta(),
1419  is_inner ? -0.1f : -0.5f,
1420  is_inner ? 0.1f : 0.5f,
1421  false);
1422  get(dnn::ele_dphi) = getValueLinear(dPhi(tau.polarP4(), electrons.at(index_ele).polarP4()),
1423  is_inner ? -0.1f : -0.5f,
1424  is_inner ? 0.1f : 0.5f,
1425  false);
1426 
1427  float cc_ele_energy, cc_gamma_energy;
1428  int cc_n_gamma;
1429  const bool cc_valid =
1430  calculateElectronClusterVarsV2(electrons.at(index_ele), cc_ele_energy, cc_gamma_energy, cc_n_gamma);
1431  if (cc_valid) {
1432  get(dnn::ele_cc_valid) = cc_valid;
1433  get(dnn::ele_cc_ele_rel_energy) =
1434  getValueNorm(cc_ele_energy / electrons.at(index_ele).polarP4().pt(), 1.729f, 1.644f);
1435  get(dnn::ele_cc_gamma_rel_energy) = getValueNorm(cc_gamma_energy / cc_ele_energy, 0.1439f, 0.3284f);
1436  get(dnn::ele_cc_n_gamma) = getValueNorm(cc_n_gamma, 1.794f, 2.079f);
1437  }
1438  get(dnn::ele_rel_trackMomentumAtVtx) = getValueNorm(
1439  electrons.at(index_ele).trackMomentumAtVtx().R() / electrons.at(index_ele).polarP4().pt(), 1.531f, 1.424f);
1440  get(dnn::ele_rel_trackMomentumAtCalo) = getValueNorm(
1441  electrons.at(index_ele).trackMomentumAtCalo().R() / electrons.at(index_ele).polarP4().pt(), 1.531f, 1.424f);
1442  get(dnn::ele_rel_trackMomentumOut) = getValueNorm(
1443  electrons.at(index_ele).trackMomentumOut().R() / electrons.at(index_ele).polarP4().pt(), 0.7735f, 0.935f);
1444  get(dnn::ele_rel_trackMomentumAtEleClus) =
1445  getValueNorm(electrons.at(index_ele).trackMomentumAtEleClus().R() / electrons.at(index_ele).polarP4().pt(),
1446  0.7735f,
1447  0.935f);
1448  get(dnn::ele_rel_trackMomentumAtVtxWithConstraint) = getValueNorm(
1449  electrons.at(index_ele).trackMomentumAtVtxWithConstraint().R() / electrons.at(index_ele).polarP4().pt(),
1450  1.625f,
1451  1.581f);
1452  get(dnn::ele_rel_ecalEnergy) =
1453  getValueNorm(electrons.at(index_ele).ecalEnergy() / electrons.at(index_ele).polarP4().pt(), 1.993f, 1.308f);
1454  get(dnn::ele_ecalEnergy_sig) = getValueNorm(
1455  electrons.at(index_ele).ecalEnergy() / electrons.at(index_ele).ecalEnergyError(), 70.25f, 58.16f);
1456  get(dnn::ele_eSuperClusterOverP) = getValueNorm(electrons.at(index_ele).eSuperClusterOverP(), 2.432f, 15.13f);
1457  get(dnn::ele_eSeedClusterOverP) = getValueNorm(electrons.at(index_ele).eSeedClusterOverP(), 2.034f, 13.96f);
1458  get(dnn::ele_eSeedClusterOverPout) = getValueNorm(electrons.at(index_ele).eSeedClusterOverPout(), 6.64f, 36.8f);
1459  get(dnn::ele_eEleClusterOverPout) = getValueNorm(electrons.at(index_ele).eEleClusterOverPout(), 4.183f, 20.63f);
1460  get(dnn::ele_deltaEtaSuperClusterTrackAtVtx) =
1461  getValueNorm(electrons.at(index_ele).deltaEtaSuperClusterTrackAtVtx(), 0.f, 0.0363f);
1462  get(dnn::ele_deltaEtaSeedClusterTrackAtCalo) =
1463  getValueNorm(electrons.at(index_ele).deltaEtaSeedClusterTrackAtCalo(), -0.0001f, 0.0512f);
1464  get(dnn::ele_deltaEtaEleClusterTrackAtCalo) =
1465  getValueNorm(electrons.at(index_ele).deltaEtaEleClusterTrackAtCalo(), -0.0001f, 0.0541f);
1466  get(dnn::ele_deltaPhiEleClusterTrackAtCalo) =
1467  getValueNorm(electrons.at(index_ele).deltaPhiEleClusterTrackAtCalo(), 0.0002f, 0.0553f);
1468  get(dnn::ele_deltaPhiSuperClusterTrackAtVtx) =
1469  getValueNorm(electrons.at(index_ele).deltaPhiSuperClusterTrackAtVtx(), 0.0001f, 0.0523f);
1470  get(dnn::ele_deltaPhiSeedClusterTrackAtCalo) =
1471  getValueNorm(electrons.at(index_ele).deltaPhiSeedClusterTrackAtCalo(), 0.0004f, 0.0777f);
1472  get(dnn::ele_mvaInput_earlyBrem) = getValue(electrons.at(index_ele).mvaInput().earlyBrem);
1473  get(dnn::ele_mvaInput_lateBrem) = getValue(electrons.at(index_ele).mvaInput().lateBrem);
1474  get(dnn::ele_mvaInput_sigmaEtaEta) =
1475  getValueNorm(electrons.at(index_ele).mvaInput().sigmaEtaEta, 0.0008f, 0.0052f);
1476  get(dnn::ele_mvaInput_hadEnergy) = getValueNorm(electrons.at(index_ele).mvaInput().hadEnergy, 14.04f, 69.48f);
1477  get(dnn::ele_mvaInput_deltaEta) = getValueNorm(electrons.at(index_ele).mvaInput().deltaEta, 0.0099f, 0.0851f);
1478 
1479  const auto& gsfTrack = electrons.at(index_ele).gsfTrack();
1480  if (gsfTrack.isNonnull()) {
1481  get(dnn::ele_gsfTrack_normalizedChi2) = getValueNorm(gsfTrack->normalizedChi2(), 3.049f, 10.39f);
1482  get(dnn::ele_gsfTrack_numberOfValidHits) = getValueNorm(gsfTrack->numberOfValidHits(), 16.52f, 2.806f);
1483  get(dnn::ele_rel_gsfTrack_pt) =
1484  getValueNorm(gsfTrack->pt() / electrons.at(index_ele).polarP4().pt(), 1.355f, 16.81f);
1485  get(dnn::ele_gsfTrack_pt_sig) = getValueNorm(gsfTrack->pt() / gsfTrack->ptError(), 5.046f, 3.119f);
1486  }
1487  const auto& closestCtfTrack = electrons.at(index_ele).closestCtfTrackRef();
1488  const bool has_closestCtfTrack = closestCtfTrack.isNonnull();
1489  if (has_closestCtfTrack) {
1490  get(dnn::ele_has_closestCtfTrack) = has_closestCtfTrack;
1491  get(dnn::ele_closestCtfTrack_normalizedChi2) = getValueNorm(closestCtfTrack->normalizedChi2(), 2.411f, 6.98f);
1492  get(dnn::ele_closestCtfTrack_numberOfValidHits) =
1493  getValueNorm(closestCtfTrack->numberOfValidHits(), 15.16f, 5.26f);
1494  }
1495  }
1496  checkInputs(inputs, is_inner ? "egamma_inner_block" : "egamma_outer_block", dnn::NumberOfInputs);
1497  }
static float getValueLinear(T value, float min_value, float max_value, bool positive)
Definition: DeepTauId.cc:917
static bool isInEcalCrack(double eta)
Definition: DeepTauId.cc:2074
const Point & position() const
position
Definition: Vertex.h:113
static float getValue(T value)
Definition: DeepTauId.cc:912
static float getValueNorm(T value, float mean, float sigma, float n_sigmas_max=5)
Definition: DeepTauId.cc:927
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
void checkInputs(const tensorflow::Tensor &inputs, const char *block_name, int n_inputs, int n_eta=1, int n_phi=1) const
Definition: DeepTauId.cc:956
static bool calculateElectronClusterVarsV2(const pat::Electron &ele, float &cc_ele_energy, float &cc_gamma_energy, int &cc_n_gamma)
Definition: DeepTauId.cc:933
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > eGammaTensor_
Definition: DeepTauId.cc:2101
void DeepTauId::createHadronsBlockInputs ( unsigned  idx,
const TauType tau,
const reco::Vertex pv,
double  rho,
const pat::PackedCandidateCollection pfCands,
const Cell &  cell_map,
bool  is_inner 
)
inlineprivate

Definition at line 1639 of file DeepTauId.cc.

References funct::abs(), HLT_2018_cff::dPhi, f, pat::Tau::flightLength(), dqmMemoryStats::float, edm::Ptr< T >::get(), reco::JetExtendedAssociation::getValue(), PixelMapPlotter::inputs, pat::Tau::leadChargedHadrCand(), reco::LeafCandidate::polarP4(), reco::Vertex::position(), ZElectronSkim_cff::rho, runTauDisplay::tau_eta, and runTauDisplay::tau_pt.

1645  {
1646  namespace dnn = dnn_inputs_2017_v2::HadronBlockInputs;
1647 
1648  tensorflow::Tensor& inputs = *hadronsTensor_.at(is_inner);
1649 
1650  const auto& get = [&](int var_index) -> float& { return inputs.tensor<float, 4>()(idx, 0, 0, var_index); };
1651 
1652  const bool valid_chH = cell_map.count(CellObjectType::PfCand_chargedHadron);
1653  const bool valid_nH = cell_map.count(CellObjectType::PfCand_neutralHadron);
1654 
1655  if (!cell_map.empty()) {
1656  get(dnn::rho) = getValueNorm(rho, 21.49f, 9.713f);
1657  get(dnn::tau_pt) = getValueLinear(tau.polarP4().pt(), 20.f, 1000.f, true);
1658  get(dnn::tau_eta) = getValueLinear(tau.polarP4().eta(), -2.3f, 2.3f, false);
1659  get(dnn::tau_inside_ecal_crack) = getValue(isInEcalCrack(tau.polarP4().eta()));
1660  }
1661  if (valid_chH) {
1662  size_t index_chH = cell_map.at(CellObjectType::PfCand_chargedHadron);
1663 
1664  get(dnn::pfCand_chHad_valid) = valid_chH;
1665  get(dnn::pfCand_chHad_rel_pt) = getValueNorm(pfCands.at(index_chH).polarP4().pt() / tau.polarP4().pt(),
1666  is_inner ? 0.2564f : 0.0194f,
1667  is_inner ? 0.8607f : 0.1865f);
1668  get(dnn::pfCand_chHad_deta) = getValueLinear(pfCands.at(index_chH).polarP4().eta() - tau.polarP4().eta(),
1669  is_inner ? -0.1f : -0.5f,
1670  is_inner ? 0.1f : 0.5f,
1671  false);
1672  get(dnn::pfCand_chHad_dphi) = getValueLinear(dPhi(tau.polarP4(), pfCands.at(index_chH).polarP4()),
1673  is_inner ? -0.1f : -0.5f,
1674  is_inner ? 0.1f : 0.5f,
1675  false);
1676  get(dnn::pfCand_chHad_leadChargedHadrCand) = getValue(
1677  &pfCands.at(index_chH) == dynamic_cast<const pat::PackedCandidate*>(tau.leadChargedHadrCand().get()));
1678  get(dnn::pfCand_chHad_pvAssociationQuality) =
1679  getValueLinear<int>(pfCands.at(index_chH).pvAssociationQuality(), 0, 7, true);
1680  get(dnn::pfCand_chHad_fromPV) = getValueLinear<int>(pfCands.at(index_chH).fromPV(), 0, 3, true);
1681  get(dnn::pfCand_chHad_puppiWeight) = getValue(pfCands.at(index_chH).puppiWeight());
1682  get(dnn::pfCand_chHad_puppiWeightNoLep) = getValue(pfCands.at(index_chH).puppiWeightNoLep());
1683  get(dnn::pfCand_chHad_charge) = getValue(pfCands.at(index_chH).charge());
1684  get(dnn::pfCand_chHad_lostInnerHits) = getValue<int>(pfCands.at(index_chH).lostInnerHits());
1685  get(dnn::pfCand_chHad_numberOfPixelHits) = getValueLinear(pfCands.at(index_chH).numberOfPixelHits(), 0, 12, true);
1686  get(dnn::pfCand_chHad_vertex_dx) =
1687  getValueNorm(pfCands.at(index_chH).vertex().x() - pv.position().x(), 0.0005f, 1.735f);
1688  get(dnn::pfCand_chHad_vertex_dy) =
1689  getValueNorm(pfCands.at(index_chH).vertex().y() - pv.position().y(), -0.0008f, 1.752f);
1690  get(dnn::pfCand_chHad_vertex_dz) =
1691  getValueNorm(pfCands.at(index_chH).vertex().z() - pv.position().z(), -0.0201f, 8.333f);
1692  get(dnn::pfCand_chHad_vertex_dx_tauFL) = getValueNorm(
1693  pfCands.at(index_chH).vertex().x() - pv.position().x() - tau.flightLength().x(), -0.0014f, 1.93f);
1694  get(dnn::pfCand_chHad_vertex_dy_tauFL) = getValueNorm(
1695  pfCands.at(index_chH).vertex().y() - pv.position().y() - tau.flightLength().y(), 0.0022f, 1.948f);
1696  get(dnn::pfCand_chHad_vertex_dz_tauFL) = getValueNorm(
1697  pfCands.at(index_chH).vertex().z() - pv.position().z() - tau.flightLength().z(), -0.0138f, 8.622f);
1698 
1699  const bool hasTrackDetails = pfCands.at(index_chH).hasTrackDetails();
1700  if (hasTrackDetails) {
1701  get(dnn::pfCand_chHad_hasTrackDetails) = hasTrackDetails;
1702  get(dnn::pfCand_chHad_dxy) = getValueNorm(pfCands.at(index_chH).dxy(), -0.012f, 2.386f);
1703  get(dnn::pfCand_chHad_dxy_sig) =
1704  getValueNorm(std::abs(pfCands.at(index_chH).dxy()) / pfCands.at(index_chH).dxyError(), 6.417f, 36.28f);
1705  get(dnn::pfCand_chHad_dz) = getValueNorm(pfCands.at(index_chH).dz(), -0.0246f, 7.618f);
1706  get(dnn::pfCand_chHad_dz_sig) =
1707  getValueNorm(std::abs(pfCands.at(index_chH).dz()) / pfCands.at(index_chH).dzError(), 301.3f, 491.1f);
1708  get(dnn::pfCand_chHad_track_chi2_ndof) =
1709  pfCands.at(index_chH).pseudoTrack().ndof() > 0
1710  ? getValueNorm(pfCands.at(index_chH).pseudoTrack().chi2() / pfCands.at(index_chH).pseudoTrack().ndof(),
1711  0.7876f,
1712  3.694f)
1713  : 0;
1714  get(dnn::pfCand_chHad_track_ndof) =
1715  pfCands.at(index_chH).pseudoTrack().ndof() > 0
1716  ? getValueNorm(pfCands.at(index_chH).pseudoTrack().ndof(), 13.92f, 6.581f)
1717  : 0;
1718  }
1719  float hcal_fraction = 0.;
1720  if (pfCands.at(index_chH).pdgId() == 1 || pfCands.at(index_chH).pdgId() == 130) {
1721  hcal_fraction = pfCands.at(index_chH).hcalFraction();
1722  } else if (pfCands.at(index_chH).isIsolatedChargedHadron()) {
1723  hcal_fraction = pfCands.at(index_chH).rawHcalFraction();
1724  }
1725  get(dnn::pfCand_chHad_hcalFraction) = getValue(hcal_fraction);
1726  get(dnn::pfCand_chHad_rawCaloFraction) = getValueLinear(pfCands.at(index_chH).rawCaloFraction(), 0.f, 2.6f, true);
1727  }
1728  if (valid_nH) {
1729  size_t index_nH = cell_map.at(CellObjectType::PfCand_neutralHadron);
1730 
1731  get(dnn::pfCand_nHad_valid) = valid_nH;
1732  get(dnn::pfCand_nHad_rel_pt) = getValueNorm(pfCands.at(index_nH).polarP4().pt() / tau.polarP4().pt(),
1733  is_inner ? 0.3163f : 0.0502f,
1734  is_inner ? 0.2769f : 0.4266f);
1735  get(dnn::pfCand_nHad_deta) = getValueLinear(pfCands.at(index_nH).polarP4().eta() - tau.polarP4().eta(),
1736  is_inner ? -0.1f : -0.5f,
1737  is_inner ? 0.1f : 0.5f,
1738  false);
1739  get(dnn::pfCand_nHad_dphi) = getValueLinear(
1740  dPhi(tau.polarP4(), pfCands.at(index_nH).polarP4()), is_inner ? -0.1f : -0.5f, is_inner ? 0.1f : 0.5f, false);
1741  get(dnn::pfCand_nHad_puppiWeight) = getValue(pfCands.at(index_nH).puppiWeight());
1742  get(dnn::pfCand_nHad_puppiWeightNoLep) = getValue(pfCands.at(index_nH).puppiWeightNoLep());
1743  float hcal_fraction = 0.;
1744  if (pfCands.at(index_nH).pdgId() == 1 || pfCands.at(index_nH).pdgId() == 130) {
1745  hcal_fraction = pfCands.at(index_nH).hcalFraction();
1746  } else if (pfCands.at(index_nH).isIsolatedChargedHadron()) {
1747  hcal_fraction = pfCands.at(index_nH).rawHcalFraction();
1748  }
1749  get(dnn::pfCand_nHad_hcalFraction) = getValue(hcal_fraction);
1750  }
1751  checkInputs(inputs, is_inner ? "hadron_inner_block" : "hadron_outer_block", dnn::NumberOfInputs);
1752  }
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > hadronsTensor_
Definition: DeepTauId.cc:2101
static float getValueLinear(T value, float min_value, float max_value, bool positive)
Definition: DeepTauId.cc:917
static bool isInEcalCrack(double eta)
Definition: DeepTauId.cc:2074
const Point & position() const
position
Definition: Vertex.h:113
static float getValue(T value)
Definition: DeepTauId.cc:912
static float getValueNorm(T value, float mean, float sigma, float n_sigmas_max=5)
Definition: DeepTauId.cc:927
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
void checkInputs(const tensorflow::Tensor &inputs, const char *block_name, int n_inputs, int n_eta=1, int n_phi=1) const
Definition: DeepTauId.cc:956
template<typename dnn >
tensorflow::Tensor DeepTauId::createInputsV1 ( const TauType tau,
const ElectronCollection electrons,
const MuonCollection muons 
) const
inlineprivate

Definition at line 1755 of file DeepTauId.cc.

References funct::abs(), tauProducer_cfi::chargedIsoPtSum, constexpr, taus_cff::decayMode, pat::Tau::decayMode(), HLT_2018_cff::dEta, HLT_2018_cff::dPhi, PVValHelper::dxy, pat::Tau::dxy(), pat::Tau::dxy_Sig(), PVValHelper::dz, pat::Tau::ecalEnergyLeadChargedHadrCand(), pat::Tau::emFraction_MVA(), reco::tau::eratio(), PVValHelper::eta, pat::Tau::etaAtEcalEntranceLeadChargedCand(), Exception, pat::Tau::flightLength(), pat::Tau::flightLengthSig(), edm::Ptr< T >::get(), pat::Tau::hasSecondaryVertex(), pat::Tau::hcalEnergyLeadChargedHadrCand(), PixelMapPlotter::inputs, pat::Tau::ip3d(), electrons_cff::ip3d, pat::Tau::ip3d_Sig(), edm::Ptr< T >::isNonnull(), pat::Tau::leadChargedHadrCand(), pat::Tau::leadingTrackNormChi2(), pat::Tau::leadPFChargedHadrCand(), EgHLTOffHistBins_cfi::mass, reco::tau::n_photons_total(), tauProducer_cfi::neutralIsoPtSum, tauProducer_cfi::neutralIsoPtSumWeight, reco::LeafCandidate::p4(), tauProducer_cfi::photonPtSumOutsideSignalCone, DiDispStaMuonMonitor_cfi::pt, reco::tau::pt_weighted_deta_strip(), reco::tau::pt_weighted_dphi_strip(), reco::tau::pt_weighted_dr_iso(), reco::tau::pt_weighted_dr_signal(), pat::Tau::ptLeadChargedCand(), tauProducer_cfi::puCorrPtSum, metsig::tau, and pat::Tau::tauID().

1757  {
1758  static constexpr bool check_all_set = false;
1759  static constexpr float default_value_for_set_check = -42;
1760 
1761  tensorflow::Tensor inputs(tensorflow::DT_FLOAT, {1, dnn_inputs_2017v1::NumberOfInputs});
1762  const auto& get = [&](int var_index) -> float& { return inputs.matrix<float>()(0, var_index); };
1763  auto leadChargedHadrCand = dynamic_cast<const pat::PackedCandidate*>(tau.leadChargedHadrCand().get());
1764 
1765  if (check_all_set) {
1766  for (int var_index = 0; var_index < dnn::NumberOfInputs; ++var_index) {
1767  get(var_index) = default_value_for_set_check;
1768  }
1769  }
1770 
1771  get(dnn::pt) = tau.p4().pt();
1772  get(dnn::eta) = tau.p4().eta();
1773  get(dnn::mass) = tau.p4().mass();
1774  get(dnn::decayMode) = tau.decayMode();
1775  get(dnn::chargedIsoPtSum) = tau.tauID("chargedIsoPtSum");
1776  get(dnn::neutralIsoPtSum) = tau.tauID("neutralIsoPtSum");
1777  get(dnn::neutralIsoPtSumWeight) = tau.tauID("neutralIsoPtSumWeight");
1778  get(dnn::photonPtSumOutsideSignalCone) = tau.tauID("photonPtSumOutsideSignalCone");
1779  get(dnn::puCorrPtSum) = tau.tauID("puCorrPtSum");
1780  get(dnn::dxy) = tau.dxy();
1781  get(dnn::dxy_sig) = tau.dxy_Sig();
1782  get(dnn::dz) = leadChargedHadrCand ? leadChargedHadrCand->dz() : default_value;
1783  get(dnn::ip3d) = tau.ip3d();
1784  get(dnn::ip3d_sig) = tau.ip3d_Sig();
1785  get(dnn::hasSecondaryVertex) = tau.hasSecondaryVertex();
1786  get(dnn::flightLength_r) = tau.flightLength().R();
1787  get(dnn::flightLength_dEta) = dEta(tau.flightLength(), tau.p4());
1788  get(dnn::flightLength_dPhi) = dPhi(tau.flightLength(), tau.p4());
1789  get(dnn::flightLength_sig) = tau.flightLengthSig();
1790  get(dnn::leadChargedHadrCand_pt) = leadChargedHadrCand ? leadChargedHadrCand->p4().Pt() : default_value;
1791  get(dnn::leadChargedHadrCand_dEta) =
1792  leadChargedHadrCand ? dEta(leadChargedHadrCand->p4(), tau.p4()) : default_value;
1793  get(dnn::leadChargedHadrCand_dPhi) =
1794  leadChargedHadrCand ? dPhi(leadChargedHadrCand->p4(), tau.p4()) : default_value;
1795  get(dnn::leadChargedHadrCand_mass) = leadChargedHadrCand ? leadChargedHadrCand->p4().mass() : default_value;
1800  get(dnn::leadingTrackNormChi2) = tau.leadingTrackNormChi2();
1801  get(dnn::e_ratio) = reco::tau::eratio(tau);
1802  get(dnn::gj_angle_diff) = calculateGottfriedJacksonAngleDifference(tau);
1803  get(dnn::n_photons) = reco::tau::n_photons_total(tau);
1804  get(dnn::emFraction) = tau.emFraction_MVA();
1805  get(dnn::has_gsf_track) = leadChargedHadrCand && std::abs(leadChargedHadrCand->pdgId()) == 11;
1806  get(dnn::inside_ecal_crack) = isInEcalCrack(tau.p4().Eta());
1807  auto gsf_ele = findMatchedElectron(tau, electrons, 0.3);
1808  get(dnn::gsf_ele_matched) = gsf_ele != nullptr;
1809  get(dnn::gsf_ele_pt) = gsf_ele != nullptr ? gsf_ele->p4().Pt() : default_value;
1810  get(dnn::gsf_ele_dEta) = gsf_ele != nullptr ? dEta(gsf_ele->p4(), tau.p4()) : default_value;
1811  get(dnn::gsf_ele_dPhi) = gsf_ele != nullptr ? dPhi(gsf_ele->p4(), tau.p4()) : default_value;
1812  get(dnn::gsf_ele_mass) = gsf_ele != nullptr ? gsf_ele->p4().mass() : default_value;
1813  calculateElectronClusterVars(gsf_ele, get(dnn::gsf_ele_Ee), get(dnn::gsf_ele_Egamma));
1814  get(dnn::gsf_ele_Pin) = gsf_ele != nullptr ? gsf_ele->trackMomentumAtVtx().R() : default_value;
1815  get(dnn::gsf_ele_Pout) = gsf_ele != nullptr ? gsf_ele->trackMomentumOut().R() : default_value;
1816  get(dnn::gsf_ele_EtotOverPin) = get(dnn::gsf_ele_Pin) > 0
1817  ? (get(dnn::gsf_ele_Ee) + get(dnn::gsf_ele_Egamma)) / get(dnn::gsf_ele_Pin)
1818  : default_value;
1819  get(dnn::gsf_ele_Eecal) = gsf_ele != nullptr ? gsf_ele->ecalEnergy() : default_value;
1820  get(dnn::gsf_ele_dEta_SeedClusterTrackAtCalo) =
1821  gsf_ele != nullptr ? gsf_ele->deltaEtaSeedClusterTrackAtCalo() : default_value;
1822  get(dnn::gsf_ele_dPhi_SeedClusterTrackAtCalo) =
1823  gsf_ele != nullptr ? gsf_ele->deltaPhiSeedClusterTrackAtCalo() : default_value;
1824  get(dnn::gsf_ele_mvaIn_sigmaEtaEta) = gsf_ele != nullptr ? gsf_ele->mvaInput().sigmaEtaEta : default_value;
1825  get(dnn::gsf_ele_mvaIn_hadEnergy) = gsf_ele != nullptr ? gsf_ele->mvaInput().hadEnergy : default_value;
1826  get(dnn::gsf_ele_mvaIn_deltaEta) = gsf_ele != nullptr ? gsf_ele->mvaInput().deltaEta : default_value;
1827 
1828  get(dnn::gsf_ele_Chi2NormGSF) = default_value;
1829  get(dnn::gsf_ele_GSFNumHits) = default_value;
1830  get(dnn::gsf_ele_GSFTrackResol) = default_value;
1831  get(dnn::gsf_ele_GSFTracklnPt) = default_value;
1832  if (gsf_ele != nullptr && gsf_ele->gsfTrack().isNonnull()) {
1833  get(dnn::gsf_ele_Chi2NormGSF) = gsf_ele->gsfTrack()->normalizedChi2();
1834  get(dnn::gsf_ele_GSFNumHits) = gsf_ele->gsfTrack()->numberOfValidHits();
1835  if (gsf_ele->gsfTrack()->pt() > 0) {
1836  get(dnn::gsf_ele_GSFTrackResol) = gsf_ele->gsfTrack()->ptError() / gsf_ele->gsfTrack()->pt();
1837  get(dnn::gsf_ele_GSFTracklnPt) = std::log10(gsf_ele->gsfTrack()->pt());
1838  }
1839  }
1840 
1841  get(dnn::gsf_ele_Chi2NormKF) = default_value;
1842  get(dnn::gsf_ele_KFNumHits) = default_value;
1843  if (gsf_ele != nullptr && gsf_ele->closestCtfTrackRef().isNonnull()) {
1844  get(dnn::gsf_ele_Chi2NormKF) = gsf_ele->closestCtfTrackRef()->normalizedChi2();
1845  get(dnn::gsf_ele_KFNumHits) = gsf_ele->closestCtfTrackRef()->numberOfValidHits();
1846  }
1847  get(dnn::leadChargedCand_etaAtEcalEntrance) = tau.etaAtEcalEntranceLeadChargedCand();
1848  get(dnn::leadChargedCand_pt) = tau.ptLeadChargedCand();
1849 
1850  get(dnn::leadChargedHadrCand_HoP) = default_value;
1851  get(dnn::leadChargedHadrCand_EoP) = default_value;
1852  if (tau.leadChargedHadrCand()->pt() > 0) {
1853  get(dnn::leadChargedHadrCand_HoP) = tau.hcalEnergyLeadChargedHadrCand() / tau.leadChargedHadrCand()->pt();
1854  get(dnn::leadChargedHadrCand_EoP) = tau.ecalEnergyLeadChargedHadrCand() / tau.leadChargedHadrCand()->pt();
1855  }
1856 
1857  MuonHitMatchV1 muon_hit_match;
1858  if (tau.leadPFChargedHadrCand().isNonnull() && tau.leadPFChargedHadrCand()->muonRef().isNonnull())
1859  muon_hit_match.addMatchedMuon(*tau.leadPFChargedHadrCand()->muonRef(), tau);
1860 
1861  auto matched_muons = muon_hit_match.findMatchedMuons(tau, muons, 0.3, 5);
1862  for (auto muon : matched_muons)
1863  muon_hit_match.addMatchedMuon(*muon, tau);
1864  muon_hit_match.fillTensor<dnn>(get, tau, default_value);
1865 
1866  LorentzVectorXYZ signalChargedHadrCands_sumIn, signalChargedHadrCands_sumOut;
1868  tau.signalChargedHadrCands(),
1869  signalChargedHadrCands_sumIn,
1870  signalChargedHadrCands_sumOut,
1871  get(dnn::signalChargedHadrCands_sum_innerSigCone_pt),
1872  get(dnn::signalChargedHadrCands_sum_innerSigCone_dEta),
1873  get(dnn::signalChargedHadrCands_sum_innerSigCone_dPhi),
1874  get(dnn::signalChargedHadrCands_sum_innerSigCone_mass),
1875  get(dnn::signalChargedHadrCands_sum_outerSigCone_pt),
1876  get(dnn::signalChargedHadrCands_sum_outerSigCone_dEta),
1877  get(dnn::signalChargedHadrCands_sum_outerSigCone_dPhi),
1878  get(dnn::signalChargedHadrCands_sum_outerSigCone_mass),
1879  get(dnn::signalChargedHadrCands_nTotal_innerSigCone),
1880  get(dnn::signalChargedHadrCands_nTotal_outerSigCone));
1881 
1882  LorentzVectorXYZ signalNeutrHadrCands_sumIn, signalNeutrHadrCands_sumOut;
1884  tau.signalNeutrHadrCands(),
1885  signalNeutrHadrCands_sumIn,
1886  signalNeutrHadrCands_sumOut,
1887  get(dnn::signalNeutrHadrCands_sum_innerSigCone_pt),
1888  get(dnn::signalNeutrHadrCands_sum_innerSigCone_dEta),
1889  get(dnn::signalNeutrHadrCands_sum_innerSigCone_dPhi),
1890  get(dnn::signalNeutrHadrCands_sum_innerSigCone_mass),
1891  get(dnn::signalNeutrHadrCands_sum_outerSigCone_pt),
1892  get(dnn::signalNeutrHadrCands_sum_outerSigCone_dEta),
1893  get(dnn::signalNeutrHadrCands_sum_outerSigCone_dPhi),
1894  get(dnn::signalNeutrHadrCands_sum_outerSigCone_mass),
1895  get(dnn::signalNeutrHadrCands_nTotal_innerSigCone),
1896  get(dnn::signalNeutrHadrCands_nTotal_outerSigCone));
1897 
1898  LorentzVectorXYZ signalGammaCands_sumIn, signalGammaCands_sumOut;
1900  tau.signalGammaCands(),
1901  signalGammaCands_sumIn,
1902  signalGammaCands_sumOut,
1903  get(dnn::signalGammaCands_sum_innerSigCone_pt),
1904  get(dnn::signalGammaCands_sum_innerSigCone_dEta),
1905  get(dnn::signalGammaCands_sum_innerSigCone_dPhi),
1906  get(dnn::signalGammaCands_sum_innerSigCone_mass),
1907  get(dnn::signalGammaCands_sum_outerSigCone_pt),
1908  get(dnn::signalGammaCands_sum_outerSigCone_dEta),
1909  get(dnn::signalGammaCands_sum_outerSigCone_dPhi),
1910  get(dnn::signalGammaCands_sum_outerSigCone_mass),
1911  get(dnn::signalGammaCands_nTotal_innerSigCone),
1912  get(dnn::signalGammaCands_nTotal_outerSigCone));
1913 
1914  LorentzVectorXYZ isolationChargedHadrCands_sum;
1916  tau.isolationChargedHadrCands(),
1917  isolationChargedHadrCands_sum,
1918  get(dnn::isolationChargedHadrCands_sum_pt),
1919  get(dnn::isolationChargedHadrCands_sum_dEta),
1920  get(dnn::isolationChargedHadrCands_sum_dPhi),
1921  get(dnn::isolationChargedHadrCands_sum_mass),
1922  get(dnn::isolationChargedHadrCands_nTotal));
1923 
1924  LorentzVectorXYZ isolationNeutrHadrCands_sum;
1926  tau.isolationNeutrHadrCands(),
1927  isolationNeutrHadrCands_sum,
1928  get(dnn::isolationNeutrHadrCands_sum_pt),
1929  get(dnn::isolationNeutrHadrCands_sum_dEta),
1930  get(dnn::isolationNeutrHadrCands_sum_dPhi),
1931  get(dnn::isolationNeutrHadrCands_sum_mass),
1932  get(dnn::isolationNeutrHadrCands_nTotal));
1933 
1934  LorentzVectorXYZ isolationGammaCands_sum;
1936  tau.isolationGammaCands(),
1937  isolationGammaCands_sum,
1938  get(dnn::isolationGammaCands_sum_pt),
1939  get(dnn::isolationGammaCands_sum_dEta),
1940  get(dnn::isolationGammaCands_sum_dPhi),
1941  get(dnn::isolationGammaCands_sum_mass),
1942  get(dnn::isolationGammaCands_nTotal));
1943 
1944  get(dnn::tau_visMass_innerSigCone) = (signalGammaCands_sumIn + signalChargedHadrCands_sumIn).mass();
1945 
1946  if (check_all_set) {
1947  for (int var_index = 0; var_index < dnn::NumberOfInputs; ++var_index) {
1948  if (get(var_index) == default_value_for_set_check)
1949  throw cms::Exception("DeepTauId: variable with index = ") << var_index << " is not set.";
1950  }
1951  }
1952 
1953  return inputs;
1954  }
unsigned int n_photons_total(const reco::PFTau &tau)
return total number of pf photon candidates with pT>500 MeV, which are associated to signal ...
float pt_weighted_dr_signal(const reco::PFTau &tau, int dm)
static bool isInEcalCrack(double eta)
Definition: DeepTauId.cc:2074
static void processIsolationPFComponents(const pat::Tau &tau, const CandidateCollection &candidates, LorentzVectorXYZ &p4, float &pt, float &d_eta, float &d_phi, float &m, float &n)
Definition: DeepTauId.cc:2020
float pt_weighted_deta_strip(const reco::PFTau &tau, int dm)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float pt_weighted_dr_iso(const reco::PFTau &tau, int dm)
float pt_weighted_dphi_strip(const reco::PFTau &tau, int dm)
float eratio(const reco::PFTau &tau)
return ratio of energy in ECAL over sum of energy in ECAL and HCAL
static void processSignalPFComponents(const pat::Tau &tau, const CandidateCollection &candidates, LorentzVectorXYZ &p4_inner, LorentzVectorXYZ &p4_outer, float &pt_inner, float &dEta_inner, float &dPhi_inner, float &m_inner, float &pt_outer, float &dEta_outer, float &dPhi_outer, float &m_outer, float &n_inner, float &n_outer)
Definition: DeepTauId.cc:1976
static bool calculateGottfriedJacksonAngleDifference(const pat::Tau &tau, double &gj_diff)
Definition: DeepTauId.cc:2049
static const pat::Electron * findMatchedElectron(const pat::Tau &tau, const pat::ElectronCollection &electrons, double deltaR)
Definition: DeepTauId.cc:2079
static float default_value
Definition: DeepTauId.cc:810
static void calculateElectronClusterVars(const pat::Electron *ele, float &elecEe, float &elecEgamma)
Definition: DeepTauId.cc:1956
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double >> LorentzVectorXYZ
Definition: DeepTauBase.h:67
#define constexpr
void DeepTauId::createMuonBlockInputs ( unsigned  idx,
const TauType tau,
const reco::Vertex pv,
double  rho,
const pat::MuonCollection muons,
const pat::PackedCandidateCollection pfCands,
const Cell &  cell_map,
bool  is_inner 
)
inlineprivate

Definition at line 1499 of file DeepTauId.cc.

References funct::abs(), MuonSubdetId::CSC, HLT_2018_cff::dPhi, MuonSubdetId::DT, f, pat::Tau::flightLength(), dqmMemoryStats::float, reco::JetExtendedAssociation::getValue(), PixelMapPlotter::inputs, dumpRecoGeometry_cfg::Muon, reco::LeafCandidate::polarP4(), reco::Vertex::position(), pat::Muon::PV2D, ZElectronSkim_cff::rho, MuonSubdetId::RPC, relativeConstraints::station, runTauDisplay::tau_eta, and runTauDisplay::tau_pt.

1506  {
1507  namespace dnn = dnn_inputs_2017_v2::MuonBlockInputs;
1508 
1509  tensorflow::Tensor& inputs = *muonTensor_.at(is_inner);
1510 
1511  const auto& get = [&](int var_index) -> float& { return inputs.tensor<float, 4>()(idx, 0, 0, var_index); };
1512 
1513  const bool valid_index_pf_muon = cell_map.count(CellObjectType::PfCand_muon);
1514  const bool valid_index_muon = cell_map.count(CellObjectType::Muon);
1515 
1516  if (!cell_map.empty()) {
1517  get(dnn::rho) = getValueNorm(rho, 21.49f, 9.713f);
1518  get(dnn::tau_pt) = getValueLinear(tau.polarP4().pt(), 20.f, 1000.f, true);
1519  get(dnn::tau_eta) = getValueLinear(tau.polarP4().eta(), -2.3f, 2.3f, false);
1520  get(dnn::tau_inside_ecal_crack) = getValue(isInEcalCrack(tau.polarP4().eta()));
1521  }
1522  if (valid_index_pf_muon) {
1523  size_t index_pf_muon = cell_map.at(CellObjectType::PfCand_muon);
1524 
1525  get(dnn::pfCand_muon_valid) = valid_index_pf_muon;
1526  get(dnn::pfCand_muon_rel_pt) = getValueNorm(pfCands.at(index_pf_muon).polarP4().pt() / tau.polarP4().pt(),
1527  is_inner ? 0.9509f : 0.0861f,
1528  is_inner ? 0.4294f : 0.4065f);
1529  get(dnn::pfCand_muon_deta) = getValueLinear(pfCands.at(index_pf_muon).polarP4().eta() - tau.polarP4().eta(),
1530  is_inner ? -0.1f : -0.5f,
1531  is_inner ? 0.1f : 0.5f,
1532  false);
1533  get(dnn::pfCand_muon_dphi) = getValueLinear(dPhi(tau.polarP4(), pfCands.at(index_pf_muon).polarP4()),
1534  is_inner ? -0.1f : -0.5f,
1535  is_inner ? 0.1f : 0.5f,
1536  false);
1537  get(dnn::pfCand_muon_pvAssociationQuality) =
1538  getValueLinear<int>(pfCands.at(index_pf_muon).pvAssociationQuality(), 0, 7, true);
1539  get(dnn::pfCand_muon_fromPV) = getValueLinear<int>(pfCands.at(index_pf_muon).fromPV(), 0, 3, true);
1540  get(dnn::pfCand_muon_puppiWeight) = getValue(pfCands.at(index_pf_muon).puppiWeight());
1541  get(dnn::pfCand_muon_charge) = getValue(pfCands.at(index_pf_muon).charge());
1542  get(dnn::pfCand_muon_lostInnerHits) = getValue<int>(pfCands.at(index_pf_muon).lostInnerHits());
1543  get(dnn::pfCand_muon_numberOfPixelHits) =
1544  getValueLinear(pfCands.at(index_pf_muon).numberOfPixelHits(), 0, 11, true);
1545  get(dnn::pfCand_muon_vertex_dx) =
1546  getValueNorm(pfCands.at(index_pf_muon).vertex().x() - pv.position().x(), -0.0007f, 0.6869f);
1547  get(dnn::pfCand_muon_vertex_dy) =
1548  getValueNorm(pfCands.at(index_pf_muon).vertex().y() - pv.position().y(), 0.0001f, 0.6784f);
1549  get(dnn::pfCand_muon_vertex_dz) =
1550  getValueNorm(pfCands.at(index_pf_muon).vertex().z() - pv.position().z(), -0.0117f, 4.097f);
1551  get(dnn::pfCand_muon_vertex_dx_tauFL) = getValueNorm(
1552  pfCands.at(index_pf_muon).vertex().x() - pv.position().x() - tau.flightLength().x(), -0.0001f, 0.8642f);
1553  get(dnn::pfCand_muon_vertex_dy_tauFL) = getValueNorm(
1554  pfCands.at(index_pf_muon).vertex().y() - pv.position().y() - tau.flightLength().y(), 0.0004f, 0.8561f);
1555  get(dnn::pfCand_muon_vertex_dz_tauFL) = getValueNorm(
1556  pfCands.at(index_pf_muon).vertex().z() - pv.position().z() - tau.flightLength().z(), -0.0118f, 4.405f);
1557 
1558  const bool hasTrackDetails = pfCands.at(index_pf_muon).hasTrackDetails();
1559  if (hasTrackDetails) {
1560  get(dnn::pfCand_muon_hasTrackDetails) = hasTrackDetails;
1561  get(dnn::pfCand_muon_dxy) = getValueNorm(pfCands.at(index_pf_muon).dxy(), -0.0045f, 0.9655f);
1562  get(dnn::pfCand_muon_dxy_sig) = getValueNorm(
1563  std::abs(pfCands.at(index_pf_muon).dxy()) / pfCands.at(index_pf_muon).dxyError(), 4.575f, 42.36f);
1564  get(dnn::pfCand_muon_dz) = getValueNorm(pfCands.at(index_pf_muon).dz(), -0.0117f, 4.097f);
1565  get(dnn::pfCand_muon_dz_sig) = getValueNorm(
1566  std::abs(pfCands.at(index_pf_muon).dz()) / pfCands.at(index_pf_muon).dzError(), 80.37f, 343.3f);
1567  get(dnn::pfCand_muon_track_chi2_ndof) = getValueNorm(
1568  pfCands.at(index_pf_muon).pseudoTrack().chi2() / pfCands.at(index_pf_muon).pseudoTrack().ndof(),
1569  0.69f,
1570  1.711f);
1571  get(dnn::pfCand_muon_track_ndof) = getValueNorm(pfCands.at(index_pf_muon).pseudoTrack().ndof(), 17.5f, 5.11f);
1572  }
1573  }
1574  if (valid_index_muon) {
1575  size_t index_muon = cell_map.at(CellObjectType::Muon);
1576 
1577  get(dnn::muon_valid) = valid_index_muon;
1578  get(dnn::muon_rel_pt) = getValueNorm(muons.at(index_muon).polarP4().pt() / tau.polarP4().pt(),
1579  is_inner ? 0.7966f : 0.2678f,
1580  is_inner ? 3.402f : 3.592f);
1581  get(dnn::muon_deta) = getValueLinear(muons.at(index_muon).polarP4().eta() - tau.polarP4().eta(),
1582  is_inner ? -0.1f : -0.5f,
1583  is_inner ? 0.1f : 0.5f,
1584  false);
1585  get(dnn::muon_dphi) = getValueLinear(
1586  dPhi(tau.polarP4(), muons.at(index_muon).polarP4()), is_inner ? -0.1f : -0.5f, is_inner ? 0.1f : 0.5f, false);
1587  get(dnn::muon_dxy) = getValueNorm(muons.at(index_muon).dB(pat::Muon::PV2D), 0.0019f, 1.039f);
1588  get(dnn::muon_dxy_sig) =
1589  getValueNorm(std::abs(muons.at(index_muon).dB(pat::Muon::PV2D)) / muons.at(index_muon).edB(pat::Muon::PV2D),
1590  8.98f,
1591  71.17f);
1592 
1593  const bool normalizedChi2_valid =
1594  muons.at(index_muon).globalTrack().isNonnull() && muons.at(index_muon).normChi2() >= 0;
1595  if (normalizedChi2_valid) {
1596  get(dnn::muon_normalizedChi2_valid) = normalizedChi2_valid;
1597  get(dnn::muon_normalizedChi2) = getValueNorm(muons.at(index_muon).normChi2(), 21.52f, 265.8f);
1598  if (muons.at(index_muon).innerTrack().isNonnull())
1599  get(dnn::muon_numberOfValidHits) = getValueNorm(muons.at(index_muon).numberOfValidHits(), 21.84f, 10.59f);
1600  }
1601  get(dnn::muon_segmentCompatibility) = getValue(muons.at(index_muon).segmentCompatibility());
1602  get(dnn::muon_caloCompatibility) = getValue(muons.at(index_muon).caloCompatibility());
1603 
1604  const bool pfEcalEnergy_valid = muons.at(index_muon).pfEcalEnergy() >= 0;
1605  if (pfEcalEnergy_valid) {
1606  get(dnn::muon_pfEcalEnergy_valid) = pfEcalEnergy_valid;
1607  get(dnn::muon_rel_pfEcalEnergy) =
1608  getValueNorm(muons.at(index_muon).pfEcalEnergy() / muons.at(index_muon).polarP4().pt(), 0.2273f, 0.4865f);
1609  }
1610 
1611  MuonHitMatchV2 hit_match(muons.at(index_muon));
1612  static const std::map<int, std::pair<int, int>> muonMatchHitVars = {
1613  {MuonSubdetId::DT, {dnn::muon_n_matches_DT_1, dnn::muon_n_hits_DT_1}},
1614  {MuonSubdetId::CSC, {dnn::muon_n_matches_CSC_1, dnn::muon_n_hits_CSC_1}},
1615  {MuonSubdetId::RPC, {dnn::muon_n_matches_RPC_1, dnn::muon_n_hits_RPC_1}}};
1616 
1617  static const std::map<int, std::vector<float>> muonMatchVarLimits = {
1618  {MuonSubdetId::DT, {2, 2, 2, 2}}, {MuonSubdetId::CSC, {6, 2, 2, 2}}, {MuonSubdetId::RPC, {7, 6, 4, 4}}};
1619 
1620  static const std::map<int, std::vector<float>> muonHitVarLimits = {{MuonSubdetId::DT, {12, 12, 12, 8}},
1621  {MuonSubdetId::CSC, {24, 12, 12, 12}},
1622  {MuonSubdetId::RPC, {4, 4, 2, 2}}};
1623 
1624  for (int subdet : hit_match.MuonHitMatchV2::consideredSubdets()) {
1625  const auto& matchHitVar = muonMatchHitVars.at(subdet);
1626  const auto& matchLimits = muonMatchVarLimits.at(subdet);
1627  const auto& hitLimits = muonHitVarLimits.at(subdet);
1628  for (int station = MuonHitMatchV2::first_station_id; station <= MuonHitMatchV2::last_station_id; ++station) {
1629  const unsigned n_matches = hit_match.nMatches(subdet, station);
1630  const unsigned n_hits = hit_match.nHits(subdet, station);
1631  get(matchHitVar.first + station - 1) = getValueLinear(n_matches, 0, matchLimits.at(station - 1), true);
1632  get(matchHitVar.second + station - 1) = getValueLinear(n_hits, 0, hitLimits.at(station - 1), true);
1633  }
1634  }
1635  }
1636  checkInputs(inputs, is_inner ? "muon_inner_block" : "muon_outer_block", dnn::NumberOfInputs);
1637  }
static float getValueLinear(T value, float min_value, float max_value, bool positive)
Definition: DeepTauId.cc:917
static bool isInEcalCrack(double eta)
Definition: DeepTauId.cc:2074
const Point & position() const
position
Definition: Vertex.h:113
static float getValue(T value)
Definition: DeepTauId.cc:912
static float getValueNorm(T value, float mean, float sigma, float n_sigmas_max=5)
Definition: DeepTauId.cc:927
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
static constexpr int RPC
Definition: MuonSubdetId.h:13
void checkInputs(const tensorflow::Tensor &inputs, const char *block_name, int n_inputs, int n_eta=1, int n_phi=1) const
Definition: DeepTauId.cc:956
static constexpr int DT
Definition: MuonSubdetId.h:11
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > muonTensor_
Definition: DeepTauId.cc:2101
static constexpr int CSC
Definition: MuonSubdetId.h:12
void DeepTauId::createTauBlockInputs ( const TauType tau,
const reco::Vertex pv,
double  rho 
)
inlineprivate

Definition at line 1181 of file DeepTauId.cc.

References funct::abs(), reco::LeafCandidate::charge(), tauProducer_cfi::chargedIsoPtSum, pat::Tau::decayMode(), pat::Tau::dxy(), pat::Tau::dxy_error(), pat::Tau::dxy_PCA(), pat::Tau::emFraction_MVA(), reco::tau::eratio(), pat::Tau::etaAtEcalEntranceLeadChargedCand(), f, pat::Tau::flightLength(), tauProducer_cfi::footprintCorrection, edm::Ptr< T >::get(), reco::JetExtendedAssociation::getValue(), PixelMapPlotter::inputs, pat::Tau::ip3d(), pat::Tau::ip3d_error(), pat::Tau::leadChargedHadrCand(), pat::Tau::leadingTrackNormChi2(), reco::tau::n_photons_total(), tauProducer_cfi::neutralIsoPtSum, reco::LeafCandidate::p4(), tauProducer_cfi::photonPtSumOutsideSignalCone, pi, reco::LeafCandidate::polarP4(), reco::tau::pt_weighted_deta_strip(), reco::tau::pt_weighted_dphi_strip(), reco::tau::pt_weighted_dr_iso(), reco::tau::pt_weighted_dr_signal(), tauProducer_cfi::puCorrPtSum, ZElectronSkim_cff::rho, runTauDisplay::tau_eta, runTauDisplay::tau_mass, runTauDisplay::tau_phi, runTauDisplay::tau_pt, and pat::Tau::tauID().

1181  {
1182  namespace dnn = dnn_inputs_2017_v2::TauBlockInputs;
1183 
1184  tensorflow::Tensor& inputs = *tauBlockTensor_;
1185  inputs.flat<float>().setZero();
1186 
1187  const auto& get = [&](int var_index) -> float& { return inputs.matrix<float>()(0, var_index); };
1188 
1189  auto leadChargedHadrCand = dynamic_cast<const pat::PackedCandidate*>(tau.leadChargedHadrCand().get());
1190 
1191  get(dnn::rho) = getValueNorm(rho, 21.49f, 9.713f);
1192  get(dnn::tau_pt) = getValueLinear(tau.polarP4().pt(), 20.f, 1000.f, true);
1193  get(dnn::tau_eta) = getValueLinear(tau.polarP4().eta(), -2.3f, 2.3f, false);
1194  get(dnn::tau_phi) = getValueLinear(tau.polarP4().phi(), -pi, pi, false);
1195  get(dnn::tau_mass) = getValueNorm(tau.polarP4().mass(), 0.6669f, 0.6553f);
1196  get(dnn::tau_E_over_pt) = getValueLinear(tau.p4().energy() / tau.p4().pt(), 1.f, 5.2f, true);
1197  get(dnn::tau_charge) = getValue(tau.charge());
1198  get(dnn::tau_n_charged_prongs) = getValueLinear(tau.decayMode() / 5 + 1, 1, 3, true);
1199  get(dnn::tau_n_neutral_prongs) = getValueLinear(tau.decayMode() % 5, 0, 2, true);
1200  get(dnn::chargedIsoPtSum) = getValueNorm(tau.tauID("chargedIsoPtSum"), 47.78f, 123.5f);
1201  get(dnn::chargedIsoPtSumdR03_over_dR05) = getValue(tau.tauID("chargedIsoPtSumdR03") / tau.tauID("chargedIsoPtSum"));
1202  get(dnn::footprintCorrection) = getValueNorm(tau.tauID("footprintCorrectiondR03"), 9.029f, 26.42f);
1203  get(dnn::neutralIsoPtSum) = getValueNorm(tau.tauID("neutralIsoPtSum"), 57.59f, 155.3f);
1204  get(dnn::neutralIsoPtSumWeight_over_neutralIsoPtSum) =
1205  getValue(tau.tauID("neutralIsoPtSumWeight") / tau.tauID("neutralIsoPtSum"));
1206  get(dnn::neutralIsoPtSumWeightdR03_over_neutralIsoPtSum) =
1207  getValue(tau.tauID("neutralIsoPtSumWeightdR03") / tau.tauID("neutralIsoPtSum"));
1208  get(dnn::neutralIsoPtSumdR03_over_dR05) = getValue(tau.tauID("neutralIsoPtSumdR03") / tau.tauID("neutralIsoPtSum"));
1210  getValueNorm(tau.tauID("photonPtSumOutsideSignalConedR03"), 1.731f, 6.846f);
1211  get(dnn::puCorrPtSum) = getValueNorm(tau.tauID("puCorrPtSum"), 22.38f, 16.34f);
1212  // The global PCA coordinates were used as inputs during the NN training, but it was decided to disable
1213  // them for the inference, because modeling of dxy_PCA in MC poorly describes the data, and x and y coordinates
1214  // in data results outside of the expected 5 std. dev. input validity range. On the other hand,
1215  // these coordinates are strongly era-dependent. Kept as comment to document what NN expects.
1216  if (!disable_dxy_pca_) {
1217  get(dnn::tau_dxy_pca_x) = getValueNorm(tau.dxy_PCA().x(), -0.0241f, 0.0074f);
1218  get(dnn::tau_dxy_pca_y) = getValueNorm(tau.dxy_PCA().y(), 0.0675f, 0.0128f);
1219  get(dnn::tau_dxy_pca_z) = getValueNorm(tau.dxy_PCA().z(), 0.7973f, 3.456f);
1220  } else {
1221  get(dnn::tau_dxy_pca_x) = 0;
1222  get(dnn::tau_dxy_pca_y) = 0;
1223  get(dnn::tau_dxy_pca_z) = 0;
1224  }
1225 
1226  const bool tau_dxy_valid =
1227  std::isnormal(tau.dxy()) && tau.dxy() > -10 && std::isnormal(tau.dxy_error()) && tau.dxy_error() > 0;
1228  if (tau_dxy_valid) {
1229  get(dnn::tau_dxy_valid) = tau_dxy_valid;
1230  get(dnn::tau_dxy) = getValueNorm(tau.dxy(), 0.0018f, 0.0085f);
1231  get(dnn::tau_dxy_sig) = getValueNorm(std::abs(tau.dxy()) / tau.dxy_error(), 2.26f, 4.191f);
1232  }
1233  const bool tau_ip3d_valid =
1234  std::isnormal(tau.ip3d()) && tau.ip3d() > -10 && std::isnormal(tau.ip3d_error()) && tau.ip3d_error() > 0;
1235  if (tau_ip3d_valid) {
1236  get(dnn::tau_ip3d_valid) = tau_ip3d_valid;
1237  get(dnn::tau_ip3d) = getValueNorm(tau.ip3d(), 0.0026f, 0.0114f);
1238  get(dnn::tau_ip3d_sig) = getValueNorm(std::abs(tau.ip3d()) / tau.ip3d_error(), 2.928f, 4.466f);
1239  }
1240  if (leadChargedHadrCand) {
1241  get(dnn::tau_dz) = getValueNorm(leadChargedHadrCand->dz(), 0.f, 0.0190f);
1242  const bool tau_dz_sig_valid = leadChargedHadrCand->hasTrackDetails() &&
1243  std::isnormal(leadChargedHadrCand->dz()) &&
1244  std::isnormal(leadChargedHadrCand->dzError()) && leadChargedHadrCand->dzError() > 0;
1245  get(dnn::tau_dz_sig_valid) = tau_dz_sig_valid;
1246  const double dzError = leadChargedHadrCand->hasTrackDetails() ? leadChargedHadrCand->dzError() : default_value;
1247  get(dnn::tau_dz_sig) = getValueNorm(std::abs(leadChargedHadrCand->dz()) / dzError, 4.717f, 11.78f);
1248  }
1249  get(dnn::tau_flightLength_x) = getValueNorm(tau.flightLength().x(), -0.0003f, 0.7362f);
1250  get(dnn::tau_flightLength_y) = getValueNorm(tau.flightLength().y(), -0.0009f, 0.7354f);
1251  get(dnn::tau_flightLength_z) = getValueNorm(tau.flightLength().z(), -0.0022f, 1.993f);
1252  // get(dnn::tau_flightLength_sig) = getValueNorm(tau.flightLengthSig(), -4.78f, 9.573f);
1253  get(dnn::tau_flightLength_sig) = 0.55756444; //This value is set due to a bug in the training
1254  get(dnn::tau_pt_weighted_deta_strip) =
1255  getValueLinear(reco::tau::pt_weighted_deta_strip(tau, tau.decayMode()), 0, 1, true);
1256 
1257  get(dnn::tau_pt_weighted_dphi_strip) =
1258  getValueLinear(reco::tau::pt_weighted_dphi_strip(tau, tau.decayMode()), 0, 1, true);
1259  get(dnn::tau_pt_weighted_dr_signal) =
1260  getValueNorm(reco::tau::pt_weighted_dr_signal(tau, tau.decayMode()), 0.0052f, 0.01433f);
1261  get(dnn::tau_pt_weighted_dr_iso) = getValueLinear(reco::tau::pt_weighted_dr_iso(tau, tau.decayMode()), 0, 1, true);
1262  get(dnn::tau_leadingTrackNormChi2) = getValueNorm(tau.leadingTrackNormChi2(), 1.538f, 4.401f);
1263  const auto eratio = reco::tau::eratio(tau);
1264  const bool tau_e_ratio_valid = std::isnormal(eratio) && eratio > 0.f;
1265  get(dnn::tau_e_ratio_valid) = tau_e_ratio_valid;
1266  get(dnn::tau_e_ratio) = tau_e_ratio_valid ? getValueLinear(eratio, 0, 1, true) : 0.f;
1267  const double gj_angle_diff = calculateGottfriedJacksonAngleDifference(tau);
1268  const bool tau_gj_angle_diff_valid = (std::isnormal(gj_angle_diff) || gj_angle_diff == 0) && gj_angle_diff >= 0;
1269  get(dnn::tau_gj_angle_diff_valid) = tau_gj_angle_diff_valid;
1270  get(dnn::tau_gj_angle_diff) = tau_gj_angle_diff_valid ? getValueLinear(gj_angle_diff, 0, pi, true) : 0;
1271  get(dnn::tau_n_photons) = getValueNorm(reco::tau::n_photons_total(tau), 2.95f, 3.927f);
1272  get(dnn::tau_emFraction) = getValueLinear(tau.emFraction_MVA(), -1, 1, false);
1273  get(dnn::tau_inside_ecal_crack) = getValue(isInEcalCrack(tau.p4().eta()));
1274  get(dnn::leadChargedCand_etaAtEcalEntrance_minus_tau_eta) =
1275  getValueNorm(tau.etaAtEcalEntranceLeadChargedCand() - tau.p4().eta(), 0.0042f, 0.0323f);
1276 
1277  checkInputs(inputs, "tau_block", dnn::NumberOfInputs);
1278  }
unsigned int n_photons_total(const reco::PFTau &tau)
return total number of pf photon candidates with pT>500 MeV, which are associated to signal ...
float pt_weighted_dr_signal(const reco::PFTau &tau, int dm)
const bool disable_dxy_pca_
Definition: DeepTauId.cc:2099
static float getValueLinear(T value, float min_value, float max_value, bool positive)
Definition: DeepTauId.cc:917
static bool isInEcalCrack(double eta)
Definition: DeepTauId.cc:2074
static float getValue(T value)
Definition: DeepTauId.cc:912
float pt_weighted_deta_strip(const reco::PFTau &tau, int dm)
static float getValueNorm(T value, float mean, float sigma, float n_sigmas_max=5)
Definition: DeepTauId.cc:927
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float pt_weighted_dr_iso(const reco::PFTau &tau, int dm)
double f[11][100]
float pt_weighted_dphi_strip(const reco::PFTau &tau, int dm)
float eratio(const reco::PFTau &tau)
return ratio of energy in ECAL over sum of energy in ECAL and HCAL
void checkInputs(const tensorflow::Tensor &inputs, const char *block_name, int n_inputs, int n_eta=1, int n_phi=1) const
Definition: DeepTauId.cc:956
static bool calculateGottfriedJacksonAngleDifference(const pat::Tau &tau, double &gj_diff)
Definition: DeepTauId.cc:2049
static float pi
Definition: DeepTauId.cc:909
static float default_value
Definition: DeepTauId.cc:810
std::unique_ptr< tensorflow::Tensor > tauBlockTensor_
Definition: DeepTauId.cc:2100
static void DeepTauId::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 822 of file DeepTauId.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), HLT_2018_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

822  {
824  desc.add<edm::InputTag>("electrons", edm::InputTag("slimmedElectrons"));
825  desc.add<edm::InputTag>("muons", edm::InputTag("slimmedMuons"));
826  desc.add<edm::InputTag>("taus", edm::InputTag("slimmedTaus"));
827  desc.add<edm::InputTag>("pfcands", edm::InputTag("packedPFCandidates"));
828  desc.add<edm::InputTag>("vertices", edm::InputTag("offlineSlimmedPrimaryVertices"));
829  desc.add<edm::InputTag>("rho", edm::InputTag("fixedGridRhoAll"));
830  desc.add<std::vector<std::string>>("graph_file",
831  {"RecoTauTag/TrainingFiles/data/DeepTauId/deepTau_2017v2p6_e6.pb"});
832  desc.add<bool>("mem_mapped", false);
833  desc.add<unsigned>("version", 2);
834  desc.add<int>("debug_level", 0);
835  desc.add<bool>("disable_dxy_pca", false);
836 
838  descWP.add<std::string>("VVVLoose", "0");
839  descWP.add<std::string>("VVLoose", "0");
840  descWP.add<std::string>("VLoose", "0");
841  descWP.add<std::string>("Loose", "0");
842  descWP.add<std::string>("Medium", "0");
843  descWP.add<std::string>("Tight", "0");
844  descWP.add<std::string>("VTight", "0");
845  descWP.add<std::string>("VVTight", "0");
846  descWP.add<std::string>("VVVTight", "0");
847  desc.add<edm::ParameterSetDescription>("VSeWP", descWP);
848  desc.add<edm::ParameterSetDescription>("VSmuWP", descWP);
849  desc.add<edm::ParameterSetDescription>("VSjetWP", descWP);
850  descriptions.add("DeepTau", desc);
851  }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
template<typename Collection >
void DeepTauId::fillGrids ( const TauType tau,
const Collection &  objects,
CellGrid &  inner_grid,
CellGrid &  outer_grid 
)
inlineprivate

Definition at line 1050 of file DeepTauId.cc.

References constexpr, reco::deltaPhi(), getRunAppsInfo::grid, dqmiodumpmetadata::n, getGTfromDQMFile::obj, reco::LeafCandidate::polarP4(), and funct::pow().

1050  {
1051  static constexpr double outer_dR2 = 0.25; //0.5^2
1052  const double inner_radius = getInnerSignalConeRadius(tau.polarP4().pt());
1053  const double inner_dR2 = std::pow(inner_radius, 2);
1054 
1055  const auto addObject = [&](size_t n, double deta, double dphi, CellGrid& grid) {
1056  const auto& obj = objects.at(n);
1057  const CellObjectType obj_type = GetCellObjectType(obj);
1058  if (obj_type == CellObjectType::Other)
1059  return;
1060  CellIndex cell_index;
1061  if (grid.tryGetCellIndex(deta, dphi, cell_index)) {
1062  Cell& cell = grid[cell_index];
1063  auto iter = cell.find(obj_type);
1064  if (iter != cell.end()) {
1065  const auto& prev_obj = objects.at(iter->second);
1066  if (obj.polarP4().pt() > prev_obj.polarP4().pt())
1067  iter->second = n;
1068  } else {
1069  cell[obj_type] = n;
1070  }
1071  }
1072  };
1073 
1074  for (size_t n = 0; n < objects.size(); ++n) {
1075  const auto& obj = objects.at(n);
1076  const double deta = obj.polarP4().eta() - tau.polarP4().eta();
1077  const double dphi = reco::deltaPhi(obj.polarP4().phi(), tau.polarP4().phi());
1078  const double dR2 = std::pow(deta, 2) + std::pow(dphi, 2);
1079  if (dR2 < inner_dR2)
1080  addObject(n, deta, dphi, inner_grid);
1081  if (dR2 < outer_dR2)
1082  addObject(n, deta, dphi, outer_grid);
1083  }
1084  }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
static double getInnerSignalConeRadius(double pt)
Definition: DeepTauId.cc:2042
CellObjectType
Definition: DeepTauId.cc:703
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
#define constexpr
static const pat::Electron* DeepTauId::findMatchedElectron ( const pat::Tau tau,
const pat::ElectronCollection electrons,
double  deltaR 
)
inlinestaticprivate

Definition at line 2079 of file DeepTauId.cc.

References PbPb_ZMuSkimMuonDPG_cff::deltaR, reco::deltaR2(), reco::LeafCandidate::p4(), and reco::LeafCandidate::pt().

2081  {
2082  const double dR2 = deltaR * deltaR;
2083  const pat::Electron* matched_ele = nullptr;
2084  for (const auto& ele : electrons) {
2085  if (reco::deltaR2(tau.p4(), ele.p4()) < dR2 && (!matched_ele || matched_ele->pt() < ele.pt())) {
2086  matched_ele = &ele;
2087  }
2088  }
2089  return matched_ele;
2090  }
double pt() const final
transverse momentum
const LorentzVector & p4() const final
four-momentum Lorentz vector
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
Analysis-level electron class.
Definition: Electron.h:51
static double DeepTauId::getInnerSignalConeRadius ( double  pt)
inlinestaticprivate

Definition at line 2042 of file DeepTauId.cc.

References constexpr, SiStripPI::max, and cosmictrackSelector_cfi::min_pt.

2042  {
2043  static constexpr double min_pt = 30., min_radius = 0.05, cone_opening_coef = 3.;
2044  // This is equivalent of the original formula (std::max(std::min(0.1, 3.0/pt), 0.05)
2045  return std::max(cone_opening_coef / std::max(pt, min_pt), min_radius);
2046  }
#define constexpr
static const OutputCollection& DeepTauId::GetOutputs ( )
inlinestatic

Definition at line 812 of file DeepTauId.cc.

References constexpr, and Output.

812  {
813  static constexpr size_t e_index = 0, mu_index = 1, tau_index = 2, jet_index = 3;
814  static const OutputCollection outputs_ = {
815  {"VSe", Output({tau_index}, {e_index, tau_index})},
816  {"VSmu", Output({tau_index}, {mu_index, tau_index})},
817  {"VSjet", Output({tau_index}, {jet_index, tau_index})},
818  };
819  return outputs_;
820  }
std::map< std::string, Output > OutputCollection
Definition: DeepTauBase.h:83
OutputCollection outputs_
Definition: DeepTauBase.h:104
#define Output(cl)
Definition: vmac.h:194
#define constexpr
tensorflow::Tensor DeepTauId::getPartialPredictions ( bool  is_inner)
inlineprivate

Definition at line 1086 of file DeepTauId.cc.

References tensorflow::run().

1086  {
1087  std::vector<tensorflow::Tensor> pred_vector;
1088  if (is_inner) {
1089  tensorflow::run(&(cache_->getSession("inner")),
1090  {
1091  {"input_inner_egamma", *eGammaTensor_.at(is_inner)},
1092  {"input_inner_muon", *muonTensor_.at(is_inner)},
1093  {"input_inner_hadrons", *hadronsTensor_.at(is_inner)},
1094  },
1095  {"inner_all_dropout_4/Identity"},
1096  &pred_vector);
1097  } else {
1098  tensorflow::run(&(cache_->getSession("outer")),
1099  {
1100  {"input_outer_egamma", *eGammaTensor_.at(is_inner)},
1101  {"input_outer_muon", *muonTensor_.at(is_inner)},
1102  {"input_outer_hadrons", *hadronsTensor_.at(is_inner)},
1103  },
1104  {"outer_all_dropout_4/Identity"},
1105  &pred_vector);
1106  }
1107  return pred_vector.at(0);
1108  }
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > hadronsTensor_
Definition: DeepTauId.cc:2101
const DeepTauCache * cache_
Definition: DeepTauBase.h:105
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > eGammaTensor_
Definition: DeepTauId.cc:2101
void run(Session *session, const NamedTensorList &inputs, const std::vector< std::string > &outputNames, const std::vector< std::string > &targetNodes, std::vector< Tensor > *outputs)
Definition: TensorFlow.cc:176
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > muonTensor_
Definition: DeepTauId.cc:2101
tensorflow::Session & getSession(const std::string &name="") const
Definition: DeepTauBase.h:49
tensorflow::Tensor DeepTauId::getPredictions ( edm::Event event,
const edm::EventSetup es,
edm::Handle< TauCollection taus 
)
inlineoverrideprivatevirtual

Implements deep_tau::DeepTauBase.

Definition at line 978 of file DeepTauId.cc.

References pwdgSkimBPark_cfi::electrons, Exception, dqmdumpme::k, PDWG_BPHSkim_cff::muons, deep_tau::NumberOfOutputs, BeamSplash_cfg::version, and pwdgSkimBPark_cfi::vertices.

980  {
982  event.getByToken(electrons_token_, electrons);
983 
985  event.getByToken(muons_token_, muons);
986 
988  event.getByToken(pfcandToken_, pfCands);
989 
991  event.getByToken(vtxToken_, vertices);
992 
994  event.getByToken(rho_token_, rho);
995 
996  tensorflow::Tensor predictions(tensorflow::DT_FLOAT, {static_cast<int>(taus->size()), deep_tau::NumberOfOutputs});
997  for (size_t tau_index = 0; tau_index < taus->size(); ++tau_index) {
998  std::vector<tensorflow::Tensor> pred_vector;
999  if (version == 1)
1000  getPredictionsV1(taus->at(tau_index), *electrons, *muons, pred_vector);
1001  else if (version == 2)
1002  getPredictionsV2(taus->at(tau_index), *electrons, *muons, *pfCands, vertices->at(0), *rho, pred_vector);
1003  else
1004  throw cms::Exception("DeepTauId") << "version " << version << " is not supported.";
1005  for (int k = 0; k < deep_tau::NumberOfOutputs; ++k) {
1006  const float pred = pred_vector[0].flat<float>()(k);
1007  if (!(pred >= 0 && pred <= 1))
1008  throw cms::Exception("DeepTauId")
1009  << "invalid prediction = " << pred << " for tau_index = " << tau_index << ", pred_index = " << k;
1010  predictions.matrix<float>()(tau_index, k) = pred;
1011  }
1012  }
1013  return predictions;
1014  }
edm::EDGetTokenT< ElectronCollection > electrons_token_
Definition: DeepTauId.cc:2093
int NumberOfOutputs
Definition: DeepTauId.cc:13
void getPredictionsV2(const TauType &tau, const pat::ElectronCollection &electrons, const pat::MuonCollection &muons, const pat::PackedCandidateCollection &pfCands, const reco::Vertex &pv, double rho, std::vector< tensorflow::Tensor > &pred_vector)
Definition: DeepTauId.cc:1024
void getPredictionsV1(const TauType &tau, const pat::ElectronCollection &electrons, const pat::MuonCollection &muons, std::vector< tensorflow::Tensor > &pred_vector)
Definition: DeepTauId.cc:1016
const unsigned version
Definition: DeepTauId.cc:2097
edm::EDGetTokenT< MuonCollection > muons_token_
Definition: DeepTauId.cc:2094
edm::EDGetTokenT< double > rho_token_
Definition: DeepTauId.cc:2095
edm::EDGetTokenT< pat::PackedCandidateCollection > pfcandToken_
Definition: DeepTauBase.h:101
edm::EDGetTokenT< reco::VertexCollection > vtxToken_
Definition: DeepTauBase.h:102
void DeepTauId::getPredictionsV1 ( const TauType tau,
const pat::ElectronCollection electrons,
const pat::MuonCollection muons,
std::vector< tensorflow::Tensor > &  pred_vector 
)
inlineprivate

Definition at line 1016 of file DeepTauId.cc.

References pwdgSkimBPark_cfi::electrons, PixelMapPlotter::inputs, PDWG_BPHSkim_cff::muons, tensorflow::run(), and metsig::tau.

1019  {
1020  const tensorflow::Tensor& inputs = createInputsV1<dnn_inputs_2017v1>(tau, electrons, muons);
1021  tensorflow::run(&(cache_->getSession()), {{input_layer_, inputs}}, {output_layer_}, &pred_vector);
1022  }
const DeepTauCache * cache_
Definition: DeepTauBase.h:105
std::string output_layer_
Definition: DeepTauId.cc:2096
std::string input_layer_
Definition: DeepTauId.cc:2096
void run(Session *session, const NamedTensorList &inputs, const std::vector< std::string > &outputNames, const std::vector< std::string > &targetNodes, std::vector< Tensor > *outputs)
Definition: TensorFlow.cc:176
tensorflow::Session & getSession(const std::string &name="") const
Definition: DeepTauBase.h:49
void DeepTauId::getPredictionsV2 ( const TauType tau,
const pat::ElectronCollection electrons,
const pat::MuonCollection muons,
const pat::PackedCandidateCollection pfCands,
const reco::Vertex pv,
double  rho,
std::vector< tensorflow::Tensor > &  pred_vector 
)
inlineprivate

Definition at line 1024 of file DeepTauId.cc.

References tensorflow::run().

1030  {
1031  CellGrid inner_grid(dnn_inputs_2017_v2::number_of_inner_cell, dnn_inputs_2017_v2::number_of_inner_cell, 0.02, 0.02);
1032  CellGrid outer_grid(dnn_inputs_2017_v2::number_of_outer_cell, dnn_inputs_2017_v2::number_of_outer_cell, 0.05, 0.05);
1033  fillGrids(tau, electrons, inner_grid, outer_grid);
1034  fillGrids(tau, muons, inner_grid, outer_grid);
1035  fillGrids(tau, pfCands, inner_grid, outer_grid);
1036 
1038  createConvFeatures(tau, pv, rho, electrons, muons, pfCands, inner_grid, true);
1039  createConvFeatures(tau, pv, rho, electrons, muons, pfCands, outer_grid, false);
1040 
1041  tensorflow::run(&(cache_->getSession("core")),
1042  {{"input_tau", *tauBlockTensor_},
1043  {"input_inner", *convTensor_.at(true)},
1044  {"input_outer", *convTensor_.at(false)}},
1045  {"main_output/Softmax"},
1046  &pred_vector);
1047  }
void createConvFeatures(const TauType &tau, const reco::Vertex &pv, double rho, const pat::ElectronCollection &electrons, const pat::MuonCollection &muons, const pat::PackedCandidateCollection &pfCands, const CellGrid &grid, bool is_inner)
Definition: DeepTauId.cc:1110
const DeepTauCache * cache_
Definition: DeepTauBase.h:105
void createTauBlockInputs(const TauType &tau, const reco::Vertex &pv, double rho)
Definition: DeepTauId.cc:1181
std::array< std::unique_ptr< tensorflow::Tensor >, 2 > convTensor_
Definition: DeepTauId.cc:2101
void fillGrids(const TauType &tau, const Collection &objects, CellGrid &inner_grid, CellGrid &outer_grid)
Definition: DeepTauId.cc:1050
void run(Session *session, const NamedTensorList &inputs, const std::vector< std::string > &outputNames, const std::vector< std::string > &targetNodes, std::vector< Tensor > *outputs)
Definition: TensorFlow.cc:176
std::unique_ptr< tensorflow::Tensor > tauBlockTensor_
Definition: DeepTauId.cc:2100
tensorflow::Session & getSession(const std::string &name="") const
Definition: DeepTauBase.h:49
template<typename T >
static float DeepTauId::getValue ( T  value)
inlinestaticprivate

Definition at line 912 of file DeepTauId.cc.

References f, and relativeConstraints::value.

912  {
913  return std::isnormal(value) ? static_cast<float>(value) : 0.f;
914  }
double f[11][100]
Definition: value.py:1
template<typename T >
static float DeepTauId::getValueLinear ( T  value,
float  min_value,
float  max_value,
bool  positive 
)
inlinestaticprivate

Definition at line 917 of file DeepTauId.cc.

References reco::JetExtendedAssociation::getValue(), and hcaldqm::quantity::min_value.

917  {
918  const float fixed_value = getValue(value);
919  const float clamped_value = std::clamp(fixed_value, min_value, max_value);
920  float transformed_value = (clamped_value - min_value) / (max_value - min_value);
921  if (!positive)
922  transformed_value = transformed_value * 2 - 1;
923  return transformed_value;
924  }
const std::map< ValueQuantityType, double > min_value
static float getValue(T value)
Definition: DeepTauId.cc:912
Definition: value.py:1
const std::map< ValueQuantityType, double > max_value
template<typename T >
static float DeepTauId::getValueNorm ( T  value,
float  mean,
float  sigma,
float  n_sigmas_max = 5 
)
inlinestaticprivate

Definition at line 927 of file DeepTauId.cc.

References reco::JetExtendedAssociation::getValue(), and SiStripPI::mean.

927  {
928  const float fixed_value = getValue(value);
929  const float norm_value = (fixed_value - mean) / sigma;
930  return std::clamp(norm_value, -n_sigmas_max, n_sigmas_max);
931  }
static float getValue(T value)
Definition: DeepTauId.cc:912
Definition: value.py:1
static void DeepTauId::globalEndJob ( const deep_tau::DeepTauCache cache_)
inlinestatic

Definition at line 906 of file DeepTauId.cc.

References deep_tau::DeepTauBase::globalEndJob().

906 { return DeepTauBase::globalEndJob(cache_); }
static std::unique_ptr<deep_tau::DeepTauCache> DeepTauId::initializeGlobalCache ( const edm::ParameterSet cfg)
inlinestatic

Definition at line 902 of file DeepTauId.cc.

References deep_tau::DeepTauBase::initializeGlobalCache().

902  {
903  return DeepTauBase::initializeGlobalCache(cfg);
904  }
static bool DeepTauId::isInEcalCrack ( double  eta)
inlinestaticprivate

Definition at line 2074 of file DeepTauId.cc.

References funct::abs().

2074  {
2075  const double abs_eta = std::abs(eta);
2076  return abs_eta > 1.46 && abs_eta < 1.558;
2077  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
template<typename CandidateCollection >
static void DeepTauId::processIsolationPFComponents ( const pat::Tau tau,
const CandidateCollection &  candidates,
LorentzVectorXYZ p4,
float &  pt,
float &  d_eta,
float &  d_phi,
float &  m,
float &  n 
)
inlinestaticprivate

Definition at line 2020 of file DeepTauId.cc.

References HLT_2018_cff::dEta, HLT_2018_cff::dPhi, dqmiodumpmetadata::n, and reco::LeafCandidate::p4().

2027  {
2028  p4 = LorentzVectorXYZ(0, 0, 0, 0);
2029  n = 0;
2030 
2031  for (const auto& cand : candidates) {
2032  p4 += cand->p4();
2033  ++n;
2034  }
2035 
2036  pt = n != 0 ? p4.Pt() : default_value;
2037  d_eta = n != 0 ? dEta(p4, tau.p4()) : default_value;
2038  d_phi = n != 0 ? dPhi(p4, tau.p4()) : default_value;
2039  m = n != 0 ? p4.mass() : default_value;
2040  }
double p4[4]
Definition: TauolaWrapper.h:92
const LorentzVector & p4() const final
four-momentum Lorentz vector
static float default_value
Definition: DeepTauId.cc:810
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double >> LorentzVectorXYZ
Definition: DeepTauBase.h:67
template<typename CandidateCollection >
static void DeepTauId::processSignalPFComponents ( const pat::Tau tau,
const CandidateCollection &  candidates,
LorentzVectorXYZ p4_inner,
LorentzVectorXYZ p4_outer,
float &  pt_inner,
float &  dEta_inner,
float &  dPhi_inner,
float &  m_inner,
float &  pt_outer,
float &  dEta_outer,
float &  dPhi_outer,
float &  m_outer,
float &  n_inner,
float &  n_outer 
)
inlinestaticprivate

Definition at line 1976 of file DeepTauId.cc.

References reco::deltaR(), HLT_2018_cff::dEta, HLT_2018_cff::dPhi, HGC3DClusterGenMatchSelector_cfi::dR, pat::Tau::leadChargedHadrCand(), reco::LeafCandidate::p4(), and reco::LeafCandidate::pt().

1989  {
1990  p4_inner = LorentzVectorXYZ(0, 0, 0, 0);
1991  p4_outer = LorentzVectorXYZ(0, 0, 0, 0);
1992  n_inner = 0;
1993  n_outer = 0;
1994 
1995  const double innerSigCone_radius = getInnerSignalConeRadius(tau.pt());
1996  for (const auto& cand : candidates) {
1997  const double dR = reco::deltaR(cand->p4(), tau.leadChargedHadrCand()->p4());
1998  const bool isInside_innerSigCone = dR < innerSigCone_radius;
1999  if (isInside_innerSigCone) {
2000  p4_inner += cand->p4();
2001  ++n_inner;
2002  } else {
2003  p4_outer += cand->p4();
2004  ++n_outer;
2005  }
2006  }
2007 
2008  pt_inner = n_inner != 0 ? p4_inner.Pt() : default_value;
2009  dEta_inner = n_inner != 0 ? dEta(p4_inner, tau.p4()) : default_value;
2010  dPhi_inner = n_inner != 0 ? dPhi(p4_inner, tau.p4()) : default_value;
2011  m_inner = n_inner != 0 ? p4_inner.mass() : default_value;
2012 
2013  pt_outer = n_outer != 0 ? p4_outer.Pt() : default_value;
2014  dEta_outer = n_outer != 0 ? dEta(p4_outer, tau.p4()) : default_value;
2015  dPhi_outer = n_outer != 0 ? dPhi(p4_outer, tau.p4()) : default_value;
2016  m_outer = n_outer != 0 ? p4_outer.mass() : default_value;
2017  }
static double getInnerSignalConeRadius(double pt)
Definition: DeepTauId.cc:2042
double pt() const final
transverse momentum
const LorentzVector & p4() const final
four-momentum Lorentz vector
const reco::CandidatePtr leadChargedHadrCand() const
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:30
static float default_value
Definition: DeepTauId.cc:810
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double >> LorentzVectorXYZ
Definition: DeepTauBase.h:67
void DeepTauId::setCellConvFeatures ( tensorflow::Tensor &  convTensor,
const tensorflow::Tensor &  features,
unsigned  batch_idx,
int  eta_index,
int  phi_index 
)
inlineprivate

Definition at line 1172 of file DeepTauId.cc.

References dqmiodumpmetadata::n.

1176  {
1177  for (int n = 0; n < dnn_inputs_2017_v2::number_of_conv_features; ++n)
1178  convTensor.tensor<float, 4>()(0, eta_index, phi_index, n) = features.tensor<float, 4>()(batch_idx, 0, 0, n);
1179  }

Member Data Documentation

std::array<std::unique_ptr<tensorflow::Tensor>, 2> DeepTauId::convTensor_
private

Definition at line 2101 of file DeepTauId.cc.

const int DeepTauId::debug_level
private

Definition at line 2098 of file DeepTauId.cc.

float DeepTauId::default_value = -999.
static

Definition at line 810 of file DeepTauId.cc.

const bool DeepTauId::disable_dxy_pca_
private

Definition at line 2099 of file DeepTauId.cc.

std::array<std::unique_ptr<tensorflow::Tensor>, 2> DeepTauId::eGammaTensor_
private

Definition at line 2101 of file DeepTauId.cc.

edm::EDGetTokenT<ElectronCollection> DeepTauId::electrons_token_
private

Definition at line 2093 of file DeepTauId.cc.

std::array<std::unique_ptr<tensorflow::Tensor>, 2> DeepTauId::hadronsTensor_
private

Definition at line 2101 of file DeepTauId.cc.

std::string DeepTauId::input_layer_
private

Definition at line 2096 of file DeepTauId.cc.

edm::EDGetTokenT<MuonCollection> DeepTauId::muons_token_
private

Definition at line 2094 of file DeepTauId.cc.

std::array<std::unique_ptr<tensorflow::Tensor>, 2> DeepTauId::muonTensor_
private

Definition at line 2101 of file DeepTauId.cc.

std::string DeepTauId::output_layer_
private

Definition at line 2096 of file DeepTauId.cc.

float DeepTauId::pi = M_PI
staticprivate

Definition at line 909 of file DeepTauId.cc.

edm::EDGetTokenT<double> DeepTauId::rho_token_
private

Definition at line 2095 of file DeepTauId.cc.

std::unique_ptr<tensorflow::Tensor> DeepTauId::tauBlockTensor_
private

Definition at line 2100 of file DeepTauId.cc.

const unsigned DeepTauId::version
private
std::array<std::unique_ptr<tensorflow::Tensor>, 2> DeepTauId::zeroOutputTensor_
private

Definition at line 2101 of file DeepTauId.cc.