Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
TForwardElectronLikelihoodTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
25 #ifndef TFORWARDELECTRONLIKELIHOODTOOL_H
26 #define TFORWARDELECTRONLIKELIHOODTOOL_H
27 
28 #include <string> // for string
29 #include <vector> // for vector
30 
31 // ROOT includes
32 #include "TFile.h"
33 #include "TH1.h"
34 
35 // Include the return objects and the base class
36 //#include "PATCore/TAccept.h"
37 //#include "PATCore/TResult.h"
38 #include "PATCore/AcceptData.h"
39 #include "PATCore/AcceptInfo.h"
40 //#include "PATCore/TCalculatorToolBase.h"
41 //#include "PATCore/TSelectorToolBase.h"
43 #include "AsgTools/IAsgTool.h"
44 #include "SafeTH1.h"
45 #include "memory"
46 
47 namespace {
48 const unsigned int IP_FBINS = 1;
49 }
50 
51 namespace LikeEnumForward {
52 enum Menu
53 {
58 };
59 
61 {
62  double likelihood;
63  double eta;
64  double eT;
65  double ip;
66 };
67 
69 {
70  double eta;
71  double eT;
72  double secondLambda;
73  double lateral;
74  double longitudinal;
75  double fracMax;
76  double centerLambda;
77  double secondR;
78  double secondDensity;
79  double significance;
80  double ip;
81 };
82 
84 {};
85 } // namespace LikeEnumForward
86 
87 namespace Root {
89 {
90 
91 public:
94  const char* name = "TForwardElectronLikelihoodTool");
95 
96 public:
99 
101  const asg::AcceptInfo& getAcceptInfo() const { return m_acceptInfo; }
102 
105  asg::AcceptData accept(double likelihood,
106  double eta,
107  double eT,
108  double ip) const;
109 
112 
113  double calculate(LikeEnumForward::LHCalcVars_t& vars_struct) const;
114  double calculate(double eta,
115  double eT,
116  double secondLambda,
117  double lateral,
118  double longitudinal,
119  double centerLambda,
120  double fracMax,
121  double secondR,
122  double significance,
123  double secondDensity,
124  double ip) const;
125 
127  inline void setPDFFileName(const std::string& val) { m_pdfFileName = val; }
128 
130  inline void setVariableNames(const std::string& val)
131  {
134  }
135 
137  int loadVarHistograms(const std::string& vstr, unsigned int varIndex);
138 
140  inline void setBinning(const std::string& val) { m_ipBinning = val; }
141 
142  unsigned int getBitmask(void) const { return m_variableBitMask; }
143  inline void setBitmask(unsigned int val) { m_variableBitMask = val; };
144 
145  // Private methods
146 private:
147  // For every input "varVector", make sure elements of vector are
148  // in the same order as prescribed in fVariables
149  // Internal methods to calculate the LH discriminant from a set of variables
150  double evaluateLikelihood(std::vector<double>& varVector,
151  double et,
152  double eta,
153  double ip = 0) const;
154  double evaluateLikelihood(std::vector<float>& varVector,
155  double et,
156  double eta,
157  double ip = 0) const;
158 
162  unsigned int getLikelihoodBitmask(const std::string& vars) const;
163 
164  // PHILIP interpolation is unused
165  /* double InterpolateCuts(const std::vector<double>& cuts,const
166  * std::vector<double>& cuts_4gev,double et,double eta) const; */
167  /* double InterpolatePdfs(unsigned int s_or_b,unsigned int ipbin,double
168  * et,double eta,int bin,unsigned int var) const; */
169 
171  // double TransformLikelihoodOutput(double ps, double pb) const;
173  // unsigned int getLikelihoodEtaBin(double eta) const;
175  // unsigned int getLikelihoodEtBin(double et) const;
176  // Pile-up binning
177  // unsigned int getIpBin(double ip) const;
178  // get the bin names as is in the input file
179  // void getBinName(char *buffer, int etbin, int etabin) const;
180 
181 public:
185  std::vector<double> m_cutLikelihood;
191  std::vector<double> m_cutLikelihoodPileupCorrectionA;
193  std::vector<double> m_cutLikelihoodPileupCorrectionB;
195  std::string m_variableNames;
197  std::string m_pdfFileName;
198 
199  // Private methods
200 private:
203  double TransformLikelihoodOutput(double ps, double pb) const;
204 
206  static unsigned int getLikelihoodEtaBin(double eta) ;
207 
209  static unsigned int getLikelihoodEtHistBin(double eT) ;
210 
211  // Private member variables
212 private:
215  unsigned int m_variableBitMask;
216 
219 
221  std::string m_ipBinning;
222 
224  TFile* m_pdfFile{};
225 
232 
233  static const double fIpBounds[IP_FBINS + 1];
234  static const unsigned int s_fnEtBinsHist =
235  4; // number of hists stored for nominal LH
236  static const unsigned int s_fnDiscEtBins =
237  4; // number of discs stored for original LH
238  static const unsigned int s_fnEtaBins = 10;
239  static const unsigned int s_fnVariables = 8;
240  static const std::string fVariables[s_fnVariables];
241  // 5D array of ptr to SafeTH1 // [sig(0)/bkg(1)][ip][et][eta][variable]
243  [s_fnVariables]{};
244 
245  static unsigned int getIpBin(double ip) ;
246  static std::string getBinName(int etbin,
247  int etabin,
248  int ipbin,
249  const std::string& iptype) ;
250 };
251 
252 } // namespace Root
253 
254 #endif
Root::EGSelectors::SafeTH1
Definition: SafeTH1.h:12
LikeEnumForward::LHCalcVars_t::secondDensity
double secondDensity
Definition: TForwardElectronLikelihoodTool.h:78
LikeEnumForward::Menu
Menu
Definition: TForwardElectronLikelihoodTool.h:53
et
Extra patterns decribing particle interation process.
LikeEnumForward::LHCalcVars_t::secondLambda
double secondLambda
Definition: TForwardElectronLikelihoodTool.h:72
Root::TForwardElectronLikelihoodTool::setBitmask
void setBitmask(unsigned int val)
Definition: TForwardElectronLikelihoodTool.h:143
Root
Definition: GoodRunsListSelectorTool.h:30
Root::TForwardElectronLikelihoodTool::s_fnEtBinsHist
static const unsigned int s_fnEtBinsHist
Definition: TForwardElectronLikelihoodTool.h:234
keylayer_zslicemap.pb
pb
Definition: keylayer_zslicemap.py:188
Root::TForwardElectronLikelihoodTool::TransformLikelihoodOutput
double TransformLikelihoodOutput(double ps, double pb) const
Apply a transform to zoom into the LH output peaks.
Definition: TForwardElectronLikelihoodTool.cxx:405
SafeTH1.h
LikeEnumForward::LHAcceptVars_t::eta
double eta
Definition: TForwardElectronLikelihoodTool.h:63
Root::TForwardElectronLikelihoodTool::setBinning
void setBinning(const std::string &val)
Define the binning.
Definition: TForwardElectronLikelihoodTool.h:140
LikeEnumForward::LHCalcVars_t::eta
double eta
Definition: TForwardElectronLikelihoodTool.h:70
Root::TForwardElectronLikelihoodTool::loadVarHistograms
int loadVarHistograms(const std::string &vstr, unsigned int varIndex)
Load the variable histograms from the pdf file.
Definition: TForwardElectronLikelihoodTool.cxx:132
LikeEnumForward::LHCalcVars_t::longitudinal
double longitudinal
Definition: TForwardElectronLikelihoodTool.h:74
Root::TForwardElectronLikelihoodTool::m_cutPosition_LH
int m_cutPosition_LH
The position of the likelihood cut bit in the AcceptInfo return object.
Definition: TForwardElectronLikelihoodTool.h:231
LikeEnumForward::LHCalcVars_t::eT
double eT
Definition: TForwardElectronLikelihoodTool.h:71
LikeEnumForward::Medium
@ Medium
Definition: TForwardElectronLikelihoodTool.h:55
Root::TForwardElectronLikelihoodTool::setPDFFileName
void setPDFFileName(const std::string &val)
Add an input file that holds the PDFs.
Definition: TForwardElectronLikelihoodTool.h:127
Root::TForwardElectronLikelihoodTool::accept
asg::AcceptData accept() const
Return dummy accept with only info.
Definition: TForwardElectronLikelihoodTool.h:111
LikeEnumForward::LHAcceptVars_t::ip
double ip
Definition: TForwardElectronLikelihoodTool.h:65
Root::TForwardElectronLikelihoodTool::m_cutLikelihoodPileupCorrectionA
std::vector< double > m_cutLikelihoodPileupCorrectionA
the cut on the PU discriminant is adjusted as a function of nVtx cut + nVtx*cutA + cutB this is diffe...
Definition: TForwardElectronLikelihoodTool.h:191
Root::TForwardElectronLikelihoodTool::m_acceptInfo
asg::AcceptInfo m_acceptInfo
Accept info.
Definition: TForwardElectronLikelihoodTool.h:218
Root::TForwardElectronLikelihoodTool::calculate
double calculate(LikeEnumForward::LHCalcVars_t &vars_struct) const
Definition: TForwardElectronLikelihoodTool.cxx:304
LikeEnumForward::Loose
@ Loose
Definition: TForwardElectronLikelihoodTool.h:54
AsgMessaging.h
Root::TForwardElectronLikelihoodTool::getBinName
static std::string getBinName(int etbin, int etabin, int ipbin, const std::string &iptype)
Definition: TForwardElectronLikelihoodTool.cxx:474
Root::TForwardElectronLikelihoodTool::getIpBin
static unsigned int getIpBin(double ip)
Definition: TForwardElectronLikelihoodTool.cxx:432
Root::TForwardElectronLikelihoodTool::m_cutLikelihood
std::vector< double > m_cutLikelihood
cut on likelihood output
Definition: TForwardElectronLikelihoodTool.h:185
Root::TForwardElectronLikelihoodTool::fVariables
static const std::string fVariables[s_fnVariables]
Definition: TForwardElectronLikelihoodTool.h:240
asg::AcceptInfo
Definition: AcceptInfo.h:28
IDTPM::eT
float eT(const U &p)
Accessor utility function for getting the value of Tranverse energy.
Definition: TrackParametersHelper.h:122
Root::TForwardElectronLikelihoodTool::fIpBounds
static const double fIpBounds[IP_FBINS+1]
Definition: TForwardElectronLikelihoodTool.h:233
Root::TForwardElectronLikelihoodTool::m_pdfFileName
std::string m_pdfFileName
Name of the pdf file.
Definition: TForwardElectronLikelihoodTool.h:197
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LikeEnumForward::LHCalcVars_t::lateral
double lateral
Definition: TForwardElectronLikelihoodTool.h:73
LikeEnumForward::LHCalcVars_t::ip
double ip
Definition: TForwardElectronLikelihoodTool.h:80
LikeEnumForward::LHCalcVars_t::significance
double significance
Definition: TForwardElectronLikelihoodTool.h:79
Root::TForwardElectronLikelihoodTool::m_ipBinning
std::string m_ipBinning
Deprecated.
Definition: TForwardElectronLikelihoodTool.h:221
Root::TForwardElectronLikelihoodTool::getLikelihoodEtaBin
static unsigned int getLikelihoodEtaBin(double eta)
Eta binning for pdfs and discriminant cuts.
Definition: TForwardElectronLikelihoodTool.cxx:443
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
Root::TForwardElectronLikelihoodTool
Definition: TForwardElectronLikelihoodTool.h:89
IAsgTool.h
Root::TForwardElectronLikelihoodTool::m_cutPosition_kinematicEt
int m_cutPosition_kinematicEt
Definition: TForwardElectronLikelihoodTool.h:229
AcceptData.h
Root::TForwardElectronLikelihoodTool::getLikelihoodEtHistBin
static unsigned int getLikelihoodEtHistBin(double eT)
Coarse Et binning. Used for the likelihood and discriminant pdfs.
Definition: TForwardElectronLikelihoodTool.cxx:456
LikeEnumForward::Tight
@ Tight
Definition: TForwardElectronLikelihoodTool.h:56
Root::TForwardElectronLikelihoodTool::TForwardElectronLikelihoodTool
TForwardElectronLikelihoodTool(const char *name="TForwardElectronLikelihoodTool")
Standard constructor.
Definition: TForwardElectronLikelihoodTool.cxx:22
Root::TForwardElectronLikelihoodTool::s_fnVariables
static const unsigned int s_fnVariables
Definition: TForwardElectronLikelihoodTool.h:239
LikeEnumForward
Definition: TForwardElectronLikelihoodTool.h:51
LikeEnumForward::LHAcceptVars_t::eT
double eT
Definition: TForwardElectronLikelihoodTool.h:64
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
asg::AsgMessaging
Class mimicking the AthMessaging class from the offline software.
Definition: AsgMessaging.h:40
LikeEnumForward::LHCalcVars_t::fracMax
double fracMax
Definition: TForwardElectronLikelihoodTool.h:75
Root::TForwardElectronLikelihoodTool::s_fnEtaBins
static const unsigned int s_fnEtaBins
Definition: TForwardElectronLikelihoodTool.h:238
Root::TForwardElectronLikelihoodTool::fPDFbins
EGSelectors::SafeTH1 * fPDFbins[2][IP_FBINS][s_fnEtBinsHist][s_fnEtaBins][s_fnVariables]
Definition: TForwardElectronLikelihoodTool.h:243
LikeEnumForward::LHAcceptVars_t
Definition: TForwardElectronLikelihoodTool.h:61
Root::TForwardElectronLikelihoodTool::setVariableNames
void setVariableNames(const std::string &val)
Define the variable names.
Definition: TForwardElectronLikelihoodTool.h:130
AcceptInfo.h
Root::TForwardElectronLikelihoodTool::m_doPileupCorrection
bool m_doPileupCorrection
Apply a transform to zoom into the LH output peaks.
Definition: TForwardElectronLikelihoodTool.h:183
Root::TForwardElectronLikelihoodTool::getLikelihoodBitmask
unsigned int getLikelihoodBitmask(const std::string &vars) const
Mask out the variables ,out of all possible ones, that are not employed in the current configuration ...
Definition: TForwardElectronLikelihoodTool.cxx:494
Root::TForwardElectronLikelihoodTool::m_variableBitMask
unsigned int m_variableBitMask
The bitmask corresponding to the variables in the likelihood.
Definition: TForwardElectronLikelihoodTool.h:215
Root::TForwardElectronLikelihoodTool::s_fnDiscEtBins
static const unsigned int s_fnDiscEtBins
Definition: TForwardElectronLikelihoodTool.h:236
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
LikeEnumForward::LHCalcVars_t::centerLambda
double centerLambda
Definition: TForwardElectronLikelihoodTool.h:76
LikeEnumForward::CustomOperatingPoint
@ CustomOperatingPoint
Definition: TForwardElectronLikelihoodTool.h:57
LikeEnumForward::LHCalcVars_t::secondR
double secondR
Definition: TForwardElectronLikelihoodTool.h:77
LikeEnumForward::LHAcceptVars_t::likelihood
double likelihood
Definition: TForwardElectronLikelihoodTool.h:62
LikeEnumForward::LHCalcVars_t
Definition: TForwardElectronLikelihoodTool.h:69
Root::TForwardElectronLikelihoodTool::m_cutPosition_kinematicEta
int m_cutPosition_kinematicEta
The position of the kinematic cuts bit in the AcceptInfo return object, separate for eta/Et.
Definition: TForwardElectronLikelihoodTool.h:228
Root::TForwardElectronLikelihoodTool::evaluateLikelihood
double evaluateLikelihood(std::vector< double > &varVector, double et, double eta, double ip=0) const
Definition: TForwardElectronLikelihoodTool.cxx:336
Root::TForwardElectronLikelihoodTool::m_variableNames
std::string m_variableNames
variables to use in the LH
Definition: TForwardElectronLikelihoodTool.h:195
Root::TForwardElectronLikelihoodTool::getAcceptInfo
const asg::AcceptInfo & getAcceptInfo() const
accesss to the accept info object
Definition: TForwardElectronLikelihoodTool.h:101
Root::TForwardElectronLikelihoodTool::m_cutLikelihoodPileupCorrectionB
std::vector< double > m_cutLikelihoodPileupCorrectionB
pileup constant factor for cut on likelihood output
Definition: TForwardElectronLikelihoodTool.h:193
asg::AcceptData
Definition: AcceptData.h:30
Root::TForwardElectronLikelihoodTool::m_pdfFile
TFile * m_pdfFile
Pointer to the opened TFile that holds the PDFs.
Definition: TForwardElectronLikelihoodTool.h:224
LikeEnumForward::ROOT6_NamespaceAutoloadHook
Definition: TForwardElectronLikelihoodTool.h:84
Root::TForwardElectronLikelihoodTool::initialize
StatusCode initialize()
Initialize this class.
Definition: TForwardElectronLikelihoodTool.cxx:36
Root::TForwardElectronLikelihoodTool::getBitmask
unsigned int getBitmask(void) const
Definition: TForwardElectronLikelihoodTool.h:142