ATLAS Offline Software
Loading...
Searching...
No Matches
ElectronDNNCalculator.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Dear emacs, this is -*-c++-*-
6
7#ifndef ELECTRONDNNCALCULATOR_H
8#define ELECTRONDNNCALCULATOR_H
9
10// This include is needed at the top before any includes regarding lwtnn
11// since it includes Eigen in a specific way which causes compilation errors
12// if not included before lwtnn
14
17#include "TTree.h"
18#include <vector>
19#include <string>
20#include "lwtnn/generic/FastGraph.hh"
21
22
24{
25public:
28 const std::string& modelFileName,
29 const std::string& quantileFileName,
30 const std::vector<std::string>& variablesName,
31 const bool multiClass);
32
35
37 Eigen::Matrix<float, -1, 1> calculate( const std::vector<double>& ) const;
38
39private:
41 double transformInput( const std::vector<double>& quantiles, double value ) const;
43 int readQuantileTransformer( TTree* tree );
44
46 std::unique_ptr<lwt::generic::FastGraph<float>> m_graph = 0;
47
49 std::vector<std::vector<double>> m_quantiles;
51 std::vector<double> m_references;
55 std::vector<std::string> m_variables;
57};
58
59#endif
unsigned int uint
Electron selector tool to select signal electrons using the ElectronDNNCalculator retrieve a score ba...
Eigen::Matrix< float, -1, 1 > calculate(const std::vector< double > &) const
Get the prediction of the DNN model.
~ElectronDNNCalculator()
Standard destructor.
std::vector< std::vector< double > > m_quantiles
Quantile values for each variable that needs to be transformed with the QuantileTransformer.
std::unique_ptr< lwt::generic::FastGraph< float > > m_graph
DNN interface via lwtnn.
double transformInput(const std::vector< double > &quantiles, double value) const
transform the input variables according to a given QuantileTransformer.
bool m_multiClass
Whether the used model is a multiclass model or not.
std::vector< std::string > m_variables
Model variables.
int readQuantileTransformer(TTree *tree)
read the bins and values of the QuantileTransformer to transform the input variables.
std::vector< double > m_references
Reference values for the QuantileTransformer. Basically just equidistant bins between 0 and 1.
ElectronDNNCalculator(AsgElectronSelectorTool *owner, const std::string &modelFileName, const std::string &quantileFileName, const std::vector< std::string > &variablesName, const bool multiClass)
Constructor of the class.
base class to forward messages to another class
TChain * tree