Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Root::TForwardElectronLikelihoodTool Class Reference

#include <TForwardElectronLikelihoodTool.h>

Inheritance diagram for Root::TForwardElectronLikelihoodTool:
Collaboration diagram for Root::TForwardElectronLikelihoodTool:

Public Member Functions

 TForwardElectronLikelihoodTool (const char *name="TForwardElectronLikelihoodTool")
 Standard constructor. More...
 
StatusCode initialize ()
 Initialize this class. More...
 
const asg::AcceptInfogetAcceptInfo () const
 accesss to the accept info object More...
 
asg::AcceptData accept (LikeEnumForward::LHAcceptVars_t &vars_struct) const
 The main accept method: the actual cuts are applied here. More...
 
asg::AcceptData accept (double likelihood, double eta, double eT, double ip) const
 
asg::AcceptData accept () const
 Return dummy accept with only info. More...
 
double calculate (LikeEnumForward::LHCalcVars_t &vars_struct) const
 
double calculate (double eta, double eT, double secondLambda, double lateral, double longitudinal, double centerLambda, double fracMax, double secondR, double significance, double secondDensity, double ip) const
 
void setPDFFileName (const std::string &val)
 Add an input file that holds the PDFs. More...
 
void setVariableNames (const std::string &val)
 Define the variable names. More...
 
int loadVarHistograms (const std::string &vstr, unsigned int varIndex)
 Load the variable histograms from the pdf file. More...
 
void setBinning (const std::string &val)
 Define the binning. More...
 
unsigned int getBitmask (void) const
 
void setBitmask (unsigned int val)
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Public Attributes

bool m_doPileupCorrection
 Apply a transform to zoom into the LH output peaks. More...
 
std::vector< double > m_cutLikelihood
 cut on likelihood output More...
 
std::vector< double > m_cutLikelihoodPileupCorrectionA
 the cut on the PU discriminant is adjusted as a function of nVtx cut + nVtx*cutA + cutB this is different from the procedure for central electrons More...
 
std::vector< double > m_cutLikelihoodPileupCorrectionB
 pileup constant factor for cut on likelihood output More...
 
std::string m_variableNames
 variables to use in the LH More...
 
std::string m_pdfFileName
 Name of the pdf file. More...
 

Private Member Functions

double evaluateLikelihood (std::vector< double > &varVector, double et, double eta, double ip=0) const
 
double evaluateLikelihood (std::vector< float > &varVector, double et, double eta, double ip=0) const
 
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 as read from the input config file. More...
 
double TransformLikelihoodOutput (double ps, double pb) const
 Apply a transform to zoom into the LH output peaks. More...
 
void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Static Private Member Functions

static unsigned int getLikelihoodEtaBin (double eta)
 Eta binning for pdfs and discriminant cuts. More...
 
static unsigned int getLikelihoodEtHistBin (double eT)
 Coarse Et binning. Used for the likelihood and discriminant pdfs. More...
 
static unsigned int getIpBin (double ip)
 
static std::string getBinName (int etbin, int etabin, int ipbin, const std::string &iptype)
 

Private Attributes

unsigned int m_variableBitMask
 The bitmask corresponding to the variables in the likelihood. More...
 
asg::AcceptInfo m_acceptInfo
 Accept info. More...
 
std::string m_ipBinning
 Deprecated. More...
 
TFile * m_pdfFile {}
 Pointer to the opened TFile that holds the PDFs. More...
 
int m_cutPosition_kinematicEta
 The position of the kinematic cuts bit in the AcceptInfo return object, separate for eta/Et. More...
 
int m_cutPosition_kinematicEt
 
int m_cutPosition_LH
 The position of the likelihood cut bit in the AcceptInfo return object. More...
 
EGSelectors::SafeTH1fPDFbins [2][IP_FBINS][s_fnEtBinsHist][s_fnEtaBins][s_fnVariables] {}
 
std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

Static Private Attributes

static const double fIpBounds [IP_FBINS+1]
 
static const unsigned int s_fnEtBinsHist
 
static const unsigned int s_fnDiscEtBins
 
static const unsigned int s_fnEtaBins = 10
 
static const unsigned int s_fnVariables = 8
 
static const std::string fVariables [s_fnVariables]
 

Detailed Description

Definition at line 88 of file TForwardElectronLikelihoodTool.h.

Constructor & Destructor Documentation

◆ TForwardElectronLikelihoodTool()

Root::TForwardElectronLikelihoodTool::TForwardElectronLikelihoodTool ( const char *  name = "TForwardElectronLikelihoodTool")

Standard constructor.

Definition at line 22 of file TForwardElectronLikelihoodTool.cxx.

24  : asg::AsgMessaging(std::string(name))
25  , m_doPileupCorrection(false)
26  , m_variableNames("")
27  , m_pdfFileName("")
28  , m_variableBitMask(0x0)
31  , m_cutPosition_LH(-9)
32 {
33 }

Member Function Documentation

◆ accept() [1/3]

asg::AcceptData Root::TForwardElectronLikelihoodTool::accept ( ) const
inline

Return dummy accept with only info.

Definition at line 111 of file TForwardElectronLikelihoodTool.h.

111 { return asg::AcceptData(&m_acceptInfo); }

◆ accept() [2/3]

asg::AcceptData Root::TForwardElectronLikelihoodTool::accept ( double  likelihood,
double  eta,
double  eT,
double  ip 
) const

Definition at line 193 of file TForwardElectronLikelihoodTool.cxx.

197 {
199 
200  vars.likelihood = likelihood;
201  vars.eta = eta;
202  vars.eT = eT;
203  vars.ip = ip;
204 
205  return accept(vars);
206 }

◆ accept() [3/3]

asg::AcceptData Root::TForwardElectronLikelihoodTool::accept ( LikeEnumForward::LHAcceptVars_t vars_struct) const

The main accept method: the actual cuts are applied here.

Definition at line 211 of file TForwardElectronLikelihoodTool.cxx.

213 {
214  // Setup return accept with AcceptInfo
215  asg::AcceptData acceptData(&m_acceptInfo);
216 
217  // Set up the individual cuts
218  bool passKineEta(true);
219  bool passKineEt(true);
220  bool passLH(true);
221 
222  if (fabs(vars_struct.eta) < 2.5) {
223  ATH_MSG_DEBUG("This forward electron has"
224  << vars_struct.eta
225  << ", which is fabs(eta)<2.5 Returning False.");
226  passKineEta = false;
227  }
228  // Return if the kinematic requirements are not fulfilled
229  acceptData.setCutResult(m_cutPosition_kinematicEta, passKineEta);
230  if (!passKineEta) {
231  return acceptData;
232  }
233 
234  unsigned int etbin = getLikelihoodEtHistBin(vars_struct.eT);
235  unsigned int etabin = getLikelihoodEtaBin(vars_struct.eta);
236 
237  if (etbin >= s_fnDiscEtBins) {
238  ATH_MSG_WARNING("Cannot evaluate likelihood for Et "
239  << vars_struct.eT << ". Returning false..");
240  passKineEt = false;
241  }
242 
243  // Return if the kinematic requirements are not fulfilled
244  acceptData.setCutResult(m_cutPosition_kinematicEt, passKineEt);
245  if (!passKineEt) {
246  return acceptData;
247  }
248 
249  double cutDiscriminant = -999.;
250  unsigned int ibin_combined = etbin * s_fnEtaBins + etabin;
251 
252  if (!m_cutLikelihood.empty()) {
253 
254  cutDiscriminant = m_cutLikelihood[ibin_combined];
255  // If doPileupCorrection, then correct the discriminant itself instead of
256  // the cut value
257  if (m_doPileupCorrection) {
258  cutDiscriminant +=
259  vars_struct.ip * m_cutLikelihoodPileupCorrectionA[ibin_combined] +
260  m_cutLikelihoodPileupCorrectionB[ibin_combined];
261  }
262  }
263 
264  // Determine if the calculated likelihood value passes the cut
265  ATH_MSG_DEBUG("Likelihood macro: Discriminant: ");
266  if (vars_struct.likelihood < cutDiscriminant) {
267  ATH_MSG_DEBUG("Likelihood macro: Disciminant Cut Failed.");
268  passLH = false;
269  }
270  acceptData.setCutResult(m_cutPosition_LH, passLH);
271  return acceptData;
272 }

◆ calculate() [1/2]

double Root::TForwardElectronLikelihoodTool::calculate ( double  eta,
double  eT,
double  secondLambda,
double  lateral,
double  longitudinal,
double  centerLambda,
double  fracMax,
double  secondR,
double  significance,
double  secondDensity,
double  ip 
) const

Definition at line 275 of file TForwardElectronLikelihoodTool.cxx.

286 {
288  vars.eta = eta;
289  vars.eT = eT;
290  vars.secondLambda = secondLambda;
291  vars.lateral = lateral;
292  vars.longitudinal = longitudinal;
293  vars.centerLambda = centerLambda;
294  vars.fracMax = fracMax;
295  vars.secondR = secondR;
296  vars.significance = significance;
297  vars.secondDensity = secondDensity;
298  vars.ip = ip;
299  return calculate(vars);
300 }

◆ calculate() [2/2]

double Root::TForwardElectronLikelihoodTool::calculate ( LikeEnumForward::LHCalcVars_t vars_struct) const

Definition at line 304 of file TForwardElectronLikelihoodTool.cxx.

306 {
307  // Reset the results to defaul values
308  double result = -999;
309  double arr[] = { vars_struct.secondLambda, vars_struct.lateral,
310  vars_struct.longitudinal, vars_struct.centerLambda,
311  vars_struct.fracMax, vars_struct.secondR,
312  vars_struct.significance, vars_struct.secondDensity };
313  std::vector<double> vec(arr, arr + sizeof(arr) / sizeof(double));
314 
315  // Calculate the actual likelihood value and fill the return object
316  result = this->evaluateLikelihood(
317  vec, vars_struct.eT, vars_struct.eta, vars_struct.ip);
318  return result;
319 }

◆ evaluateLikelihood() [1/2]

double Root::TForwardElectronLikelihoodTool::evaluateLikelihood ( std::vector< double > &  varVector,
double  et,
double  eta,
double  ip = 0 
) const
private

Definition at line 336 of file TForwardElectronLikelihoodTool.cxx.

341 {
342  // const double GeV = 1000;
343  unsigned int etbin = getLikelihoodEtHistBin(et);
344  unsigned int etabin = getLikelihoodEtaBin(eta);
345  unsigned int ipbin = getIpBin(ip);
346 
347  if (etbin >= s_fnEtBinsHist) {
348  ATH_MSG_WARNING("skipping etbin " << etbin << ", et " << et);
349  return -999.;
350  }
351  if (etabin >= s_fnEtaBins) {
352  ATH_MSG_WARNING("skipping etabin " << etabin << ", eta " << eta);
353  return -999.;
354  }
355 
356  if (varVector.size() != s_fnVariables) {
357  ATH_MSG_WARNING("Error! Variable vector size mismatch! Check your vector!");
358  return -999.;
359  }
360 
361  double SigmaS = 1.;
362  double SigmaB = 1.;
363 
364  for (unsigned int var = 0; var < s_fnVariables; var++) {
365 
366  std::string varstr = fVariables[var];
367 
368  // Skip variables that are masked off (not used) in the likelihood
369  if (!(m_variableBitMask & (0x1 << var))) {
370  continue;
371  }
372 
373  for (unsigned int s_or_b = 0; s_or_b < 2; s_or_b++) {
374 
375  int bin =
376  fPDFbins[s_or_b][ipbin][etbin][etabin][var]->FindBin(varVector[var]);
377  double prob = 0;
378 
379  double integral =
380  double(fPDFbins[s_or_b][ipbin][etbin][etabin][var]->Integral());
381  if (integral == 0) { // currently, the crack always has integral == 0
383  "Error! PDF integral == 0!"); // changed it to debug message since we
384  // intend to run the tool in the
385  // derivations
386  return -1.35;
387  }
388 
389  prob = double(fPDFbins[s_or_b][ipbin][etbin][etabin][var]->GetBinContent(
390  bin)) /
391  integral;
392 
393  if (s_or_b == 0)
394  SigmaS *= prob;
395  else if (s_or_b == 1)
396  SigmaB *= prob;
397  }
398  }
399 
400  return TransformLikelihoodOutput(SigmaS, SigmaB);
401 }

◆ evaluateLikelihood() [2/2]

double Root::TForwardElectronLikelihoodTool::evaluateLikelihood ( std::vector< float > &  varVector,
double  et,
double  eta,
double  ip = 0 
) const
private

Definition at line 322 of file TForwardElectronLikelihoodTool.cxx.

327 {
328  std::vector<double> vec;
329  for (unsigned int var = 0; var < s_fnVariables; var++) {
330  vec.push_back(varVector[var]);
331  }
332  return evaluateLikelihood(vec, et, eta, ip);
333 }

◆ getAcceptInfo()

const asg::AcceptInfo& Root::TForwardElectronLikelihoodTool::getAcceptInfo ( ) const
inline

accesss to the accept info object

Definition at line 101 of file TForwardElectronLikelihoodTool.h.

101 { return m_acceptInfo; }

◆ getBinName()

std::string Root::TForwardElectronLikelihoodTool::getBinName ( int  etbin,
int  etabin,
int  ipbin,
const std::string &  iptype 
)
staticprivate

Definition at line 474 of file TForwardElectronLikelihoodTool.cxx.

479 {
480  double eta_bounds[s_fnEtaBins] = { 2.5, 2.6, 2.7, 2.8, 2.9,
481  3.0, 3.1, 3.16, 3.35, 3.6 };
482  int et_bounds[s_fnEtBinsHist] = { 20, 30, 40, 50 };
483  if (!iptype.empty()) {
484  return std::format("{}{}et{:02}eta{:.2f}",
485  iptype, int(fIpBounds[ipbin]),
486  et_bounds[etbin], eta_bounds[etabin]);
487  } else {
488  return std::format("et{}eta{:.2f}",
489  et_bounds[etbin], eta_bounds[etabin]);
490  }
491 }

◆ getBitmask()

unsigned int Root::TForwardElectronLikelihoodTool::getBitmask ( void  ) const
inline

Definition at line 142 of file TForwardElectronLikelihoodTool.h.

142 { return m_variableBitMask; }

◆ getIpBin()

unsigned int Root::TForwardElectronLikelihoodTool::getIpBin ( double  ip)
staticprivate

Definition at line 432 of file TForwardElectronLikelihoodTool.cxx.

433 {
434  for (unsigned int ipBin = 0; ipBin < IP_FBINS; ++ipBin) {
435  if (ip < fIpBounds[ipBin + 1])
436  return ipBin;
437  }
438  return 0;
439 }

◆ getLikelihoodBitmask()

unsigned int Root::TForwardElectronLikelihoodTool::getLikelihoodBitmask ( const std::string &  vars) const
private

Mask out the variables ,out of all possible ones, that are not employed in the current configuration as read from the input config file.

Definition at line 494 of file TForwardElectronLikelihoodTool.cxx.

496 {
497  unsigned int mask = 0x0;
498  ATH_MSG_DEBUG("Variables to be used: ");
499  for (unsigned int var = 0; var < s_fnVariables; var++) {
500  if (vars.find(fVariables[var]) != std::string::npos) {
502  mask = mask | 0x1 << var;
503  }
504  }
505  ATH_MSG_DEBUG("mask: " << mask);
506  return mask;
507 }

◆ getLikelihoodEtaBin()

unsigned int Root::TForwardElectronLikelihoodTool::getLikelihoodEtaBin ( double  eta)
staticprivate

Eta binning for pdfs and discriminant cuts.

Definition at line 443 of file TForwardElectronLikelihoodTool.cxx.

444 {
445  const unsigned int nEtaBins = s_fnEtaBins;
446  const double etaBins[nEtaBins] = { 2.6, 2.7, 2.8, 2.9, 3.0,
447  3.1, 3.16, 3.35, 3.6, 4.9 };
448  for (unsigned int etaBin = 0; etaBin < nEtaBins; ++etaBin) {
449  if (fabs(eta) < etaBins[etaBin])
450  return etaBin;
451  }
452  return (nEtaBins - 1);
453 }

◆ getLikelihoodEtHistBin()

unsigned int Root::TForwardElectronLikelihoodTool::getLikelihoodEtHistBin ( double  eT)
staticprivate

Coarse Et binning. Used for the likelihood and discriminant pdfs.

Definition at line 456 of file TForwardElectronLikelihoodTool.cxx.

457 {
458  const double GeV = 1000;
459  const unsigned int nEtBins = s_fnDiscEtBins;
460  const double eTBins[nEtBins] = {
461  30 * GeV, 40 * GeV, 50 * GeV, 7000 * GeV
462  }; // removed 20 GeV bin since we're upper bound oriented
463  for (unsigned int eTBin = 0; eTBin < nEtBins; ++eTBin) {
464  if (eT < eTBins[eTBin]) {
465  return eTBin;
466  }
467  }
468  return (nEtBins - 1); // Return the last bin if > the last bin.
469 }

◆ initialize()

StatusCode Root::TForwardElectronLikelihoodTool::initialize ( )

Initialize this class.

Definition at line 36 of file TForwardElectronLikelihoodTool.cxx.

37 {
38  ATH_MSG_DEBUG("TForwardElectronLikelihoodTool initialize.");
39  // use an int as a StatusCode
40  StatusCode sc(StatusCode::SUCCESS);
41 
42  // Check that all needed variables are setup
43  if (m_pdfFileName.empty()) {
45  "You need to specify the input PDF file name before you call "
46  "initialize() with setPDFFileName('your/file/name.root') ");
47  sc = StatusCode::FAILURE;
48  }
49 
50  unsigned int number_of_expected_bin = s_fnDiscEtBins * s_fnEtaBins;
51  if (m_cutLikelihood.size() != number_of_expected_bin) {
52  ATH_MSG_ERROR("Configuration issue : CutLikelihood expected size "
53  << number_of_expected_bin << " input size "
54  << m_cutLikelihood.size());
56  "Could NOT initialize! Please fix the errors mentioned above...");
57  sc = StatusCode::FAILURE;
58  return sc;
59  }
60 
61  // --------------------------------------------------------------------------
62  // Register the cuts and check that the registration worked:
63 
64  // Cut position for the kineatic pre-selection, separately for eta/Et
66  m_acceptInfo.addCut("kinematicEta", "pass kinematic eta");
68  sc = StatusCode::FAILURE;
70  m_acceptInfo.addCut("kinematicEt", "pass kinematic Et ");
72  sc = StatusCode::FAILURE;
73 
74  // Cut position for the likelihood selection - DO NOT CHANGE ORDER!
75  m_cutPosition_LH = m_acceptInfo.addCut("passLH", "pass Likelihood");
76  if (m_cutPosition_LH < 0) {
77  sc = StatusCode::FAILURE;
78  }
79 
80  // Check that we got everything OK
81  if (sc == StatusCode::FAILURE) {
83  "! Something went wrong with the setup of the return objects...");
84  return sc;
85  }
86 
87  // Get the correct bit mask for the current likelihood operating point
89 
90  //----------File/Histo operation------------------------------------
91  // Load the ROOT file containing the PDFs
92  TString tmpString(m_pdfFileName);
93  gSystem->ExpandPathName(tmpString);
94  std::string fname(tmpString.Data());
95  m_pdfFile = TFile::Open(fname.c_str(), "READ");
96  // Check that we could load the ROOT file
97  if (!m_pdfFile) {
98  ATH_MSG_ERROR(" No ROOT file found here: " << m_pdfFileName);
99  return StatusCode::FAILURE;
100  }
101 
102  // Load the histograms
103  for (unsigned int varIndex = 0; varIndex < s_fnVariables; varIndex++) {
104  const std::string& vstr = fVariables[varIndex];
105  // Skip the loading of PDFs for variables we don't care about for this
106  // operating point. If the string is empty (which is true in the default
107  // 2012 case), load all of them.
108  if (m_variableNames.find(vstr) == std::string::npos &&
109  !m_variableNames.empty()) {
110  continue;
111  }
112  loadVarHistograms(vstr, varIndex);
113  }
114 
115  // TFile close does not free the memory
116  m_pdfFile->Close();
117  // We need the destructor to be called
118  delete m_pdfFile;
119  //----------End File/Histo operation------------------------------------
120 
121  ATH_MSG_DEBUG("Initialization complete for a LH tool with these specs:"
122  << "\n - PdfFileName : "
123  << m_pdfFileName
124  << "\n - Variable bitmask : "
126  << "\n - VariableNames : "
127  << m_variableNames);
128  return sc;
129 }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ loadVarHistograms()

int Root::TForwardElectronLikelihoodTool::loadVarHistograms ( const std::string &  vstr,
unsigned int  varIndex 
)

Load the variable histograms from the pdf file.

Definition at line 132 of file TForwardElectronLikelihoodTool.cxx.

134 {
135  for (unsigned int s_or_b = 0; s_or_b < 2; ++s_or_b) {
136  for (unsigned int ip = 0; ip < IP_FBINS; ++ip) {
137  for (unsigned int et = 0; et < s_fnEtBinsHist; ++et) {
138  for (unsigned int eta = 0; eta < s_fnEtaBins; ++eta) {
139 
140  std::string sig_bkg = (s_or_b == 0) ? "sig" : "bkg";
141  // For the fwd LH PDFs and optimisation have matching eta bin
142  // boundaries unsigned int eta_tmp = (eta > 0) ? eta-1 : eta ;
143  unsigned int eta_tmp = eta;
144  unsigned int et_tmp = et;
145  std::string binname = getBinName(et_tmp, eta_tmp, ip, m_ipBinning);
146 
147  const std::string pdfdir = std::format("{}/{}", vstr, sig_bkg);
148  std::string pdf = std::format("{}_{}_smoothed_hist_from_KDE_{}",
149  vstr, sig_bkg, binname);
150 
151  if (!m_pdfFile->GetListOfKeys()->Contains(vstr.c_str())) {
152  ATH_MSG_INFO("Warning: skipping variable "
153  << vstr << " because the folder does not exist.");
154  return 1;
155  }
156  if (!((TDirectory*)m_pdfFile->Get(vstr.c_str()))
157  ->GetListOfKeys()
158  ->Contains(sig_bkg.c_str())) {
159  ATH_MSG_INFO("Warning: skipping variable "
160  << vstr << " because the folder does not exist.");
161  return 1;
162  }
163  // Use the first Et bin given in the root file for all Et ranges below
164  if (et == 0 && !((TDirectory*)m_pdfFile->Get(pdfdir.c_str()))
165  ->GetListOfKeys()
166  ->Contains(pdf.c_str())) {
167  ATH_MSG_INFO("using lowest GeV bin in place of all below.");
168  binname = getBinName(et_tmp + 1, eta_tmp, ip, m_ipBinning);
169  pdf = std::format("{}_{}_smoothed_hist_from_KDE_{}",
170  vstr, sig_bkg, binname);
171  }
172  if (((TDirectory*)m_pdfFile->Get(pdfdir.c_str()))
173  ->GetListOfKeys()
174  ->Contains(pdf.c_str())) {
175  TH1F* hist =
176  (TH1F*)(((TDirectory*)m_pdfFile->Get(pdfdir.c_str()))->Get(pdf.c_str()));
177  fPDFbins[s_or_b][ip][et][eta][varIndex] =
178  new EGSelectors::SafeTH1(hist);
179  delete hist;
180  } else {
181  ATH_MSG_INFO("Warning: Object " << pdf << " does not exist.");
182  ATH_MSG_INFO("Skipping all other histograms with this variable.");
183  return 1;
184  }
185  }
186  }
187  }
188  }
189  return 1;
190 }

◆ msg() [1/2]

MsgStream & asg::AsgMessaging::msg ( ) const
inherited

The standard message stream.

Returns
A reference to the default message stream of this object.

Definition at line 49 of file AsgMessaging.cxx.

49  {
50 #ifndef XAOD_STANDALONE
52 #else // not XAOD_STANDALONE
53  return m_msg;
54 #endif // not XAOD_STANDALONE
55  }

◆ msg() [2/2]

MsgStream & asg::AsgMessaging::msg ( const MSG::Level  lvl) const
inherited

The standard message stream.

Parameters
lvlThe message level to set the stream to
Returns
A reference to the default message stream, set to level "lvl"

Definition at line 57 of file AsgMessaging.cxx.

57  {
58 #ifndef XAOD_STANDALONE
60 #else // not XAOD_STANDALONE
61  m_msg << lvl;
62  return m_msg;
63 #endif // not XAOD_STANDALONE
64  }

◆ msgLvl()

bool asg::AsgMessaging::msgLvl ( const MSG::Level  lvl) const
inherited

Test the output level of the object.

Parameters
lvlThe message level to test against
Returns
boolean Indicting if messages at given level will be printed
true If messages at level "lvl" will be printed

Definition at line 41 of file AsgMessaging.cxx.

41  {
42 #ifndef XAOD_STANDALONE
43  return ::AthMessaging::msgLvl( lvl );
44 #else // not XAOD_STANDALONE
45  return m_msg.msgLevel( lvl );
46 #endif // not XAOD_STANDALONE
47  }

◆ setBinning()

void Root::TForwardElectronLikelihoodTool::setBinning ( const std::string &  val)
inline

Define the binning.

Definition at line 140 of file TForwardElectronLikelihoodTool.h.

140 { m_ipBinning = val; }

◆ setBitmask()

void Root::TForwardElectronLikelihoodTool::setBitmask ( unsigned int  val)
inline

Definition at line 143 of file TForwardElectronLikelihoodTool.h.

143 { m_variableBitMask = val; };

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

◆ setPDFFileName()

void Root::TForwardElectronLikelihoodTool::setPDFFileName ( const std::string &  val)
inline

Add an input file that holds the PDFs.

Definition at line 127 of file TForwardElectronLikelihoodTool.h.

127 { m_pdfFileName = val; }

◆ setVariableNames()

void Root::TForwardElectronLikelihoodTool::setVariableNames ( const std::string &  val)
inline

Define the variable names.

Definition at line 130 of file TForwardElectronLikelihoodTool.h.

131  {
134  }

◆ TransformLikelihoodOutput()

double Root::TForwardElectronLikelihoodTool::TransformLikelihoodOutput ( double  ps,
double  pb 
) const
private

Apply a transform to zoom into the LH output peaks.

Optionally do pileup correction too

Definition at line 405 of file TForwardElectronLikelihoodTool.cxx.

407 {
408  // returns transformed or non-transformed output
409  // (Taken mostly from TMVA likelihood code)
410  double fEpsilon = 1e-99;
411  // If both signal and bkg are 0, we want it to fail.
412  if (ps < fEpsilon)
413  ps = 0;
414  if (pb < fEpsilon)
415  pb = fEpsilon;
416  double disc = ps / double(ps + pb);
417 
418  if (disc >= 1.0)
419  disc = 1. - 1.e-15;
420  else if (disc <= 0.0)
421  disc = fEpsilon;
422 
423  double tau = 15.0;
424  disc = -log(1.0 / disc - 1.0) * (1. / double(tau));
425 
426  ATH_MSG_DEBUG("disc is " << disc);
427  return disc;
428 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ fIpBounds

const double Root::TForwardElectronLikelihoodTool::fIpBounds
staticprivate
Initial value:
= {
0.,
500.
}

Definition at line 233 of file TForwardElectronLikelihoodTool.h.

◆ fPDFbins

EGSelectors::SafeTH1* Root::TForwardElectronLikelihoodTool::fPDFbins[2][IP_FBINS][s_fnEtBinsHist][s_fnEtaBins][s_fnVariables] {}
private

Definition at line 242 of file TForwardElectronLikelihoodTool.h.

◆ fVariables

const std::string Root::TForwardElectronLikelihoodTool::fVariables
staticprivate
Initial value:
= {
"el_secondLambda", "el_lateral", "el_longitudinal", "el_centerLambda",
"el_fracMax", "el_secondR", "el_significance", "el_secondDensity"
}

Definition at line 240 of file TForwardElectronLikelihoodTool.h.

◆ m_acceptInfo

asg::AcceptInfo Root::TForwardElectronLikelihoodTool::m_acceptInfo
private

Accept info.

Definition at line 218 of file TForwardElectronLikelihoodTool.h.

◆ m_cutLikelihood

std::vector<double> Root::TForwardElectronLikelihoodTool::m_cutLikelihood

cut on likelihood output

Definition at line 185 of file TForwardElectronLikelihoodTool.h.

◆ m_cutLikelihoodPileupCorrectionA

std::vector<double> Root::TForwardElectronLikelihoodTool::m_cutLikelihoodPileupCorrectionA

the cut on the PU discriminant is adjusted as a function of nVtx cut + nVtx*cutA + cutB this is different from the procedure for central electrons

pileup slope factor for cut on likelihood output

Definition at line 191 of file TForwardElectronLikelihoodTool.h.

◆ m_cutLikelihoodPileupCorrectionB

std::vector<double> Root::TForwardElectronLikelihoodTool::m_cutLikelihoodPileupCorrectionB

pileup constant factor for cut on likelihood output

Definition at line 193 of file TForwardElectronLikelihoodTool.h.

◆ m_cutPosition_kinematicEt

int Root::TForwardElectronLikelihoodTool::m_cutPosition_kinematicEt
private

Definition at line 229 of file TForwardElectronLikelihoodTool.h.

◆ m_cutPosition_kinematicEta

int Root::TForwardElectronLikelihoodTool::m_cutPosition_kinematicEta
private

The position of the kinematic cuts bit in the AcceptInfo return object, separate for eta/Et.

Definition at line 228 of file TForwardElectronLikelihoodTool.h.

◆ m_cutPosition_LH

int Root::TForwardElectronLikelihoodTool::m_cutPosition_LH
private

The position of the likelihood cut bit in the AcceptInfo return object.

Definition at line 231 of file TForwardElectronLikelihoodTool.h.

◆ m_doPileupCorrection

bool Root::TForwardElectronLikelihoodTool::m_doPileupCorrection

Apply a transform to zoom into the LH output peaks.

Eta binning for pdfs and discriminant cuts. Et binning for for the likelihood pdfs and discriminants.

do pileup-dependent correction on discriminant value

Definition at line 183 of file TForwardElectronLikelihoodTool.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_ipBinning

std::string Root::TForwardElectronLikelihoodTool::m_ipBinning
private

Deprecated.

Definition at line 221 of file TForwardElectronLikelihoodTool.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_pdfFile

TFile* Root::TForwardElectronLikelihoodTool::m_pdfFile {}
private

Pointer to the opened TFile that holds the PDFs.

Definition at line 224 of file TForwardElectronLikelihoodTool.h.

◆ m_pdfFileName

std::string Root::TForwardElectronLikelihoodTool::m_pdfFileName

Name of the pdf file.

Definition at line 197 of file TForwardElectronLikelihoodTool.h.

◆ m_variableBitMask

unsigned int Root::TForwardElectronLikelihoodTool::m_variableBitMask
private

The bitmask corresponding to the variables in the likelihood.

For internal use.

Definition at line 215 of file TForwardElectronLikelihoodTool.h.

◆ m_variableNames

std::string Root::TForwardElectronLikelihoodTool::m_variableNames

variables to use in the LH

Definition at line 195 of file TForwardElectronLikelihoodTool.h.

◆ s_fnDiscEtBins

const unsigned int Root::TForwardElectronLikelihoodTool::s_fnDiscEtBins
staticprivate
Initial value:
=
4

Definition at line 236 of file TForwardElectronLikelihoodTool.h.

◆ s_fnEtaBins

const unsigned int Root::TForwardElectronLikelihoodTool::s_fnEtaBins = 10
staticprivate

Definition at line 238 of file TForwardElectronLikelihoodTool.h.

◆ s_fnEtBinsHist

const unsigned int Root::TForwardElectronLikelihoodTool::s_fnEtBinsHist
staticprivate
Initial value:
=
4

Definition at line 234 of file TForwardElectronLikelihoodTool.h.

◆ s_fnVariables

const unsigned int Root::TForwardElectronLikelihoodTool::s_fnVariables = 8
staticprivate

Definition at line 239 of file TForwardElectronLikelihoodTool.h.


The documentation for this class was generated from the following files:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
LikeEnumForward::LHCalcVars_t::secondDensity
double secondDensity
Definition: TForwardElectronLikelihoodTool.h:78
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
et
Extra patterns decribing particle interation process.
LikeEnumForward::LHCalcVars_t::secondLambda
double secondLambda
Definition: TForwardElectronLikelihoodTool.h:72
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
get_generator_info.result
result
Definition: get_generator_info.py:21
Root::TForwardElectronLikelihoodTool::s_fnEtBinsHist
static const unsigned int s_fnEtBinsHist
Definition: TForwardElectronLikelihoodTool.h:234
vtune_athena.format
format
Definition: vtune_athena.py:14
keylayer_zslicemap.pb
pb
Definition: keylayer_zslicemap.py:188
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
TCS::KFMET::nEtaBins
constexpr unsigned nEtaBins
Definition: KalmanMETCorrectionConstants.h:18
Root::TForwardElectronLikelihoodTool::TransformLikelihoodOutput
double TransformLikelihoodOutput(double ps, double pb) const
Apply a transform to zoom into the LH output peaks.
Definition: TForwardElectronLikelihoodTool.cxx:405
integral
double integral(TH1 *h)
Definition: computils.cxx:58
xAOD::et
et
Definition: TrigEMCluster_v1.cxx:25
LikeEnumForward::LHAcceptVars_t::eta
double eta
Definition: TForwardElectronLikelihoodTool.h:63
LikeEnumForward::LHCalcVars_t::eta
double eta
Definition: TForwardElectronLikelihoodTool.h:70
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
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
plotmaker.hist
hist
Definition: plotmaker.py:148
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
ConvertOldUJHistosToNewHistos.etaBins
list etaBins
Definition: ConvertOldUJHistosToNewHistos.py:145
bin
Definition: BinsDiffFromStripMedian.h:43
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
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:9
Root::TForwardElectronLikelihoodTool::m_acceptInfo
asg::AcceptInfo m_acceptInfo
Accept info.
Definition: TForwardElectronLikelihoodTool.h:218
covarianceTool.prob
prob
Definition: covarianceTool.py:678
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
Root::TForwardElectronLikelihoodTool::calculate
double calculate(LikeEnumForward::LHCalcVars_t &vars_struct) const
Definition: TForwardElectronLikelihoodTool.cxx:304
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
Root::TForwardElectronLikelihoodTool::getBinName
static std::string getBinName(int etbin, int etabin, int ipbin, const std::string &iptype)
Definition: TForwardElectronLikelihoodTool.cxx:474
CxxUtils::vec
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
Definition: vec.h:207
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
xAOD::etaBin
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap etaBin
Definition: L2StandAloneMuon_v1.cxx:148
Root::TForwardElectronLikelihoodTool::fVariables
static const std::string fVariables[s_fnVariables]
Definition: TForwardElectronLikelihoodTool.h:240
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
Root::EGSelectors::SafeTH1::FindBin
int FindBin(double value) const
Definition: SafeTH1.h:33
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
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
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
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
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
Root::TForwardElectronLikelihoodTool::m_cutPosition_kinematicEt
int m_cutPosition_kinematicEt
Definition: TForwardElectronLikelihoodTool.h:229
Root::TForwardElectronLikelihoodTool::getLikelihoodEtHistBin
static unsigned int getLikelihoodEtHistBin(double eT)
Coarse Et binning. Used for the likelihood and discriminant pdfs.
Definition: TForwardElectronLikelihoodTool.cxx:456
Root::TForwardElectronLikelihoodTool::s_fnVariables
static const unsigned int s_fnVariables
Definition: TForwardElectronLikelihoodTool.h:239
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
python.AthDsoLogger.fname
string fname
Definition: AthDsoLogger.py:67
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
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
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
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
PowhegPythia8EvtGen_jetjet.pdf
pdf
Definition: PowhegPythia8EvtGen_jetjet.py:4
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
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
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
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
asg::AcceptInfo::addCut
int addCut(const std::string &cutName, const std::string &cutDescription)
Add a cut; returning the cut position.
Definition: AcceptInfo.h:53