ATLAS Offline Software
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 {
25 public:
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 
39 private:
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
AsgElectronSelectorTool
Electron selector tool to select signal electrons using the ElectronDNNCalculator retrieve a score ba...
Definition: AsgElectronSelectorTool.h:27
ElectronDNNCalculator::~ElectronDNNCalculator
~ElectronDNNCalculator()
Standard destructor.
Definition: ElectronDNNCalculator.h:34
ElectronDNNCalculator::m_graph
std::unique_ptr< lwt::generic::FastGraph< float > > m_graph
DNN interface via lwtnn.
Definition: ElectronDNNCalculator.h:46
ElectronDNNCalculator::ElectronDNNCalculator
ElectronDNNCalculator(AsgElectronSelectorTool *owner, const std::string &modelFileName, const std::string &quantileFileName, const std::vector< std::string > &variablesName, const bool multiClass)
Constructor of the class.
Definition: ElectronDNNCalculator.cxx:26
ElectronDNNCalculator::transformInput
double transformInput(const std::vector< double > &quantiles, double value) const
transform the input variables according to a given QuantileTransformer.
Definition: ElectronDNNCalculator.cxx:110
asg::AsgMessagingForward
base class to forward messages to another class
Definition: AsgMessagingForward.h:29
ElectronDNNCalculator::m_references
std::vector< double > m_references
Reference values for the QuantileTransformer. Basically just equidistant bins between 0 and 1.
Definition: ElectronDNNCalculator.h:51
ElectronDNNCalculator::m_multiClass
bool m_multiClass
Whether the used model is a multiclass model or not.
Definition: ElectronDNNCalculator.h:53
ElectronDNNCalculator::m_variables
std::vector< std::string > m_variables
Model variables.
Definition: ElectronDNNCalculator.h:55
tree
TChain * tree
Definition: tile_monitor.h:30
AsgMessagingForward.h
athena.value
value
Definition: athena.py:124
AsgElectronSelectorTool.h
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
ElectronDNNCalculator::calculate
Eigen::Matrix< float, -1, 1 > calculate(const std::vector< double > &) const
Get the prediction of the DNN model.
Definition: ElectronDNNCalculator.cxx:85
ElectronDNNCalculator::readQuantileTransformer
int readQuantileTransformer(TTree *tree)
read the bins and values of the QuantileTransformer to transform the input variables.
Definition: ElectronDNNCalculator.cxx:142
RTTAlgmain.Matrix
list Matrix
Definition: RTTAlgmain.py:19
ElectronDNNCalculator::m_quantiles
std::vector< std::vector< double > > m_quantiles
Quantile values for each variable that needs to be transformed with the QuantileTransformer.
Definition: ElectronDNNCalculator.h:49
EventPrimitives.h
ElectronDNNCalculator
Used by AsgElectronSelectorTool to calculate the score of a python trained DNN using lwtnn as interfa...
Definition: ElectronDNNCalculator.h:24
ElectronDNNCalculator::m_var_size
uint m_var_size
Definition: ElectronDNNCalculator.h:56
readCCLHist.float
float
Definition: readCCLHist.py:83