ATLAS Offline Software
TForwardElectronLikelihoodTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 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:
93 
95  const char* name = "TForwardElectronLikelihoodTool");
96 
99 
100 public:
103 
105  const asg::AcceptInfo& getAcceptInfo() const { return m_acceptInfo; }
106 
109  asg::AcceptData accept(double likelihood,
110  double eta,
111  double eT,
112  double ip) const;
113 
116 
117  double calculate(LikeEnumForward::LHCalcVars_t& vars_struct) const;
118  double calculate(double eta,
119  double eT,
120  double secondLambda,
121  double lateral,
122  double longitudinal,
123  double centerLambda,
124  double fracMax,
125  double secondR,
126  double significance,
127  double secondDensity,
128  double ip) const;
129 
131  inline void setPDFFileName(const std::string& val) { m_pdfFileName = val; }
132 
134  inline void setVariableNames(const std::string& val)
135  {
138  }
139 
141  int loadVarHistograms(const std::string& vstr, unsigned int varIndex);
142 
144  inline void setBinning(const std::string& val) { m_ipBinning = val; }
145 
146  unsigned int getBitmask(void) const { return m_variableBitMask; }
147  inline void setBitmask(unsigned int val) { m_variableBitMask = val; };
148 
149  // Private methods
150 private:
151  // For every input "varVector", make sure elements of vector are
152  // in the same order as prescribed in fVariables
153  // Internal methods to calculate the LH discriminant from a set of variables
154  double evaluateLikelihood(std::vector<double>& varVector,
155  double et,
156  double eta,
157  double ip = 0) const;
158  double evaluateLikelihood(std::vector<float>& varVector,
159  double et,
160  double eta,
161  double ip = 0) const;
162 
166  unsigned int getLikelihoodBitmask(const std::string& vars) const;
167 
168  // PHILIP interpolation is unused
169  /* double InterpolateCuts(const std::vector<double>& cuts,const
170  * std::vector<double>& cuts_4gev,double et,double eta) const; */
171  /* double InterpolatePdfs(unsigned int s_or_b,unsigned int ipbin,double
172  * et,double eta,int bin,unsigned int var) const; */
173 
175  // double TransformLikelihoodOutput(double ps, double pb) const;
177  // unsigned int getLikelihoodEtaBin(double eta) const;
179  // unsigned int getLikelihoodEtBin(double et) const;
180  // Pile-up binning
181  // unsigned int getIpBin(double ip) const;
182  // get the bin names as is in the input file
183  // void getBinName(char *buffer, int etbin, int etabin) const;
184 
185 public:
189  std::vector<double> m_cutLikelihood;
195  std::vector<double> m_cutLikelihoodPileupCorrectionA;
197  std::vector<double> m_cutLikelihoodPileupCorrectionB;
199  std::string m_variableNames;
201  std::string m_pdfFileName;
202 
203  // Private methods
204 private:
207  double TransformLikelihoodOutput(double ps, double pb) const;
208 
210  static unsigned int getLikelihoodEtaBin(double eta) ;
211 
213  static unsigned int getLikelihoodEtHistBin(double eT) ;
214 
215  // Private member variables
216 private:
219  unsigned int m_variableBitMask;
220 
223 
225  std::string m_ipBinning;
226 
228  TFile* m_pdfFile{};
229 
236 
237  static const double fIpBounds[IP_FBINS + 1];
238  static const unsigned int s_fnEtBinsHist =
239  4; // number of hists stored for nominal LH
240  static const unsigned int s_fnDiscEtBins =
241  4; // number of discs stored for original LH
242  static const unsigned int s_fnEtaBins = 10;
243  static const unsigned int s_fnVariables = 8;
244  static const std::string fVariables[s_fnVariables];
245  // 5D array of ptr to SafeTH1 // [sig(0)/bkg(1)][ip][et][eta][variable]
247  [s_fnVariables]{};
248 
249  static unsigned int getIpBin(double ip) ;
250  static void getBinName(char* buffer,
251  int etbin,
252  int etabin,
253  int ipbin,
254  const std::string& iptype) ;
255 };
256 
257 } // namespace Root
258 
259 #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:147
Root::TForwardElectronLikelihoodTool::getBinName
static void getBinName(char *buffer, int etbin, int etabin, int ipbin, const std::string &iptype)
Definition: TForwardElectronLikelihoodTool.cxx:514
Root
Definition: GoodRunsListSelectorTool.h:30
Root::TForwardElectronLikelihoodTool::s_fnEtBinsHist
static const unsigned int s_fnEtBinsHist
Definition: TForwardElectronLikelihoodTool.h:238
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:445
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:144
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:161
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:235
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:131
Root::TForwardElectronLikelihoodTool::accept
asg::AcceptData accept() const
Return dummy accept with only info.
Definition: TForwardElectronLikelihoodTool.h:115
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:195
Root::TForwardElectronLikelihoodTool::m_acceptInfo
asg::AcceptInfo m_acceptInfo
Accept info.
Definition: TForwardElectronLikelihoodTool.h:222
Root::TForwardElectronLikelihoodTool::calculate
double calculate(LikeEnumForward::LHCalcVars_t &vars_struct) const
Definition: TForwardElectronLikelihoodTool.cxx:344
LikeEnumForward::Loose
@ Loose
Definition: TForwardElectronLikelihoodTool.h:54
AsgMessaging.h
Root::TForwardElectronLikelihoodTool::getIpBin
static unsigned int getIpBin(double ip)
Definition: TForwardElectronLikelihoodTool.cxx:472
Root::TForwardElectronLikelihoodTool::m_cutLikelihood
std::vector< double > m_cutLikelihood
cut on likelihood output
Definition: TForwardElectronLikelihoodTool.h:189
createCoolChannelIdFile.buffer
buffer
Definition: createCoolChannelIdFile.py:12
Root::TForwardElectronLikelihoodTool::fVariables
static const std::string fVariables[s_fnVariables]
Definition: TForwardElectronLikelihoodTool.h:244
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:120
Root::TForwardElectronLikelihoodTool::fIpBounds
static const double fIpBounds[IP_FBINS+1]
Definition: TForwardElectronLikelihoodTool.h:237
Root::TForwardElectronLikelihoodTool::m_pdfFileName
std::string m_pdfFileName
Name of the pdf file.
Definition: TForwardElectronLikelihoodTool.h:201
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:225
Root::TForwardElectronLikelihoodTool::getLikelihoodEtaBin
static unsigned int getLikelihoodEtaBin(double eta)
Eta binning for pdfs and discriminant cuts.
Definition: TForwardElectronLikelihoodTool.cxx:483
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:233
AcceptData.h
Root::TForwardElectronLikelihoodTool::getLikelihoodEtHistBin
static unsigned int getLikelihoodEtHistBin(double eT)
Coarse Et binning. Used for the likelihood and discriminant pdfs.
Definition: TForwardElectronLikelihoodTool.cxx:496
LikeEnumForward::Tight
@ Tight
Definition: TForwardElectronLikelihoodTool.h:56
Root::TForwardElectronLikelihoodTool::TForwardElectronLikelihoodTool
TForwardElectronLikelihoodTool(const char *name="TForwardElectronLikelihoodTool")
Standard constructor.
Definition: TForwardElectronLikelihoodTool.cxx:21
Root::TForwardElectronLikelihoodTool::~TForwardElectronLikelihoodTool
~TForwardElectronLikelihoodTool()
Standard destructor.
Definition: TForwardElectronLikelihoodTool.cxx:48
Root::TForwardElectronLikelihoodTool::s_fnVariables
static const unsigned int s_fnVariables
Definition: TForwardElectronLikelihoodTool.h:243
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:221
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:242
Root::TForwardElectronLikelihoodTool::fPDFbins
EGSelectors::SafeTH1 * fPDFbins[2][IP_FBINS][s_fnEtBinsHist][s_fnEtaBins][s_fnVariables]
Definition: TForwardElectronLikelihoodTool.h:247
LikeEnumForward::LHAcceptVars_t
Definition: TForwardElectronLikelihoodTool.h:61
Root::TForwardElectronLikelihoodTool::setVariableNames
void setVariableNames(const std::string &val)
Define the variable names.
Definition: TForwardElectronLikelihoodTool.h:134
AcceptInfo.h
Root::TForwardElectronLikelihoodTool::m_doPileupCorrection
bool m_doPileupCorrection
Apply a transform to zoom into the LH output peaks.
Definition: TForwardElectronLikelihoodTool.h:187
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:538
Root::TForwardElectronLikelihoodTool::m_variableBitMask
unsigned int m_variableBitMask
The bitmask corresponding to the variables in the likelihood.
Definition: TForwardElectronLikelihoodTool.h:219
Root::TForwardElectronLikelihoodTool::s_fnDiscEtBins
static const unsigned int s_fnDiscEtBins
Definition: TForwardElectronLikelihoodTool.h:240
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:232
Root::TForwardElectronLikelihoodTool::evaluateLikelihood
double evaluateLikelihood(std::vector< double > &varVector, double et, double eta, double ip=0) const
Definition: TForwardElectronLikelihoodTool.cxx:376
Root::TForwardElectronLikelihoodTool::m_variableNames
std::string m_variableNames
variables to use in the LH
Definition: TForwardElectronLikelihoodTool.h:199
Root::TForwardElectronLikelihoodTool::getAcceptInfo
const asg::AcceptInfo & getAcceptInfo() const
accesss to the accept info object
Definition: TForwardElectronLikelihoodTool.h:105
Root::TForwardElectronLikelihoodTool::m_cutLikelihoodPileupCorrectionB
std::vector< double > m_cutLikelihoodPileupCorrectionB
pileup constant factor for cut on likelihood output
Definition: TForwardElectronLikelihoodTool.h:197
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:228
LikeEnumForward::ROOT6_NamespaceAutoloadHook
Definition: TForwardElectronLikelihoodTool.h:84
Root::TForwardElectronLikelihoodTool::initialize
StatusCode initialize()
Initialize this class.
Definition: TForwardElectronLikelihoodTool.cxx:65
Root::TForwardElectronLikelihoodTool::getBitmask
unsigned int getBitmask(void) const
Definition: TForwardElectronLikelihoodTool.h:146