36AsgForwardElectronLikelihoodTool::AsgForwardElectronLikelihoodTool(
37 const std::string& myname)
40 , m_rootForwardTool{ nullptr }
48 declareProperty(
"WorkingPoint", m_WorkingPoint =
"",
"The Working Point");
49 declareProperty(
"ConfigFile", m_configFile =
"",
"The config file to use");
51 "usePVContainer", m_usePVCont =
true,
"Whether to use the PV container");
53 "nPVdefault", m_nPVdefault = 0,
"The default number of PVs if not counted");
58 declareProperty(
"inputPDFFileName",
60 "The input ROOT file name that holds the PDFs");
62 declareProperty(
"VariableNames",
63 m_rootForwardTool->m_variableNames,
64 "Variable names input to the LH");
67 declareProperty(
"CutLikelihood",
68 m_rootForwardTool->m_cutLikelihood,
69 "Cut on likelihood discriminant");
71 declareProperty(
"DiscCutSlopeForPileupTransform",
72 m_rootForwardTool->m_cutLikelihoodPileupCorrectionA,
73 "Slope correction for pileup dependent discriminant cut");
74 declareProperty(
"DiscCutForPileupTransform",
75 m_rootForwardTool->m_cutLikelihoodPileupCorrectionB,
76 "Additional offset for pileup dependent discriminant cut");
77 declareProperty(
"doPileupCorrection",
78 m_rootForwardTool->m_doPileupCorrection,
79 "Do pileup-dependent discriminant cut");
100 std::string PDFfilename(
"");
110 if (configFile.empty()) {
112 return StatusCode::FAILURE;
117 env.ReadFile(configFile.c_str(), kEnvLocal);
128 std::string PDFdevval = env.GetValue(
130 "ElectronPhotonSelectorTools/offline/mc16_20180716/"
131 "ForwardElectronLikelihoodPdfs.root");
133 PDFfilename = (
"dev/" + PDFdevval);
134 ATH_MSG_DEBUG(
"Getting the input PDFs from: " << PDFfilename);
137 env.GetValue(
"inputPDFFileName",
138 "ElectronPhotonSelectorTools/offline/mc16_20180716/"
139 "ForwardElectronLikelihoodPdfs.root");
140 ATH_MSG_DEBUG(
"Getting the input PDFs from: " << PDFfilename);
145 if (!filename.empty()) {
149 return StatusCode::FAILURE;
160 env.GetValue(
"doPileupCorrection",
false);
163 return StatusCode::FAILURE;
174 "Going to massage the labels based on the provided operating point...");
183 "ERROR! Could not initialize the TForwardElectronLikelihoodTool!");
184 return StatusCode::FAILURE;
187 return StatusCode::SUCCESS;
218 return accept(Gaudi::Hive::currentContext(), eg, mu);
228 return accept(ctx, el, mu);
250 const double energy = cluster->
e();
251 const float eta = (cluster->
eta());
252 if (fabs(
eta) > 300.0) {
258 double et = (cosh(
eta) != 0.) ? energy / cosh(
eta) : 0.;
270 double likelihood =
calculate(ctx, eg, ip);
293 return calculate(Gaudi::Hive::currentContext(), el, mu);
325 const double energy = cluster->
e();
326 const float eta = cluster->
eta();
327 if (fabs(
eta) > 300.0) {
333 const double et = (cosh(
eta) != 0.) ? energy / cosh(
eta) : 0.;
336 double secondDensity(0), significance(0), secondLambda(0), lateral(0),
337 longitudinal(0), fracMax(0), secondR(0), centerLambda(0);
339 bool allFound =
true;
340 std::string notFoundList =
"";
346 notFoundList +=
"secondLambda ";
351 notFoundList +=
"lateral ";
356 notFoundList +=
"longitudinal ";
361 notFoundList +=
"fracMax ";
366 notFoundList +=
"secondR ";
372 notFoundList +=
"centerLambda ";
377 notFoundList +=
"secondDensity ";
381 notFoundList +=
"significance ";
395 Form(
"Vars: eta=%8.5f, et=%8.5f, 2nd lambda=%8.5f, lateral=%8.5f, "
396 "longitudinal=%8.5f, center lambda=%8.5f, frac max=%8.5f, "
397 "secondR=%8.5f, significance=%8.5f, 2nd density=%8.5f, ip=%8.5f",
412 "Skipping LH calculation! The following variables are missing: "
444 return accept(Gaudi::Hive::currentContext(), part);
463 return calculate(Gaudi::Hive::currentContext(), part);
486 const EventContext& ctx)
const
488 unsigned int nVtx(0);
492 <<
" container, returning default nVtx");
495 for (
const auto *vxcand : *vtxCont) {
496 if (vxcand->nTrackParticles() >= 2)
Scalar eta() const
pseudorapidity method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
static const Attributes_t empty
virtual bool isValid() override final
Can the handle be successfully dereferenced?
bool retrieveMoment(MomentType type, double &value) const
Retrieve individual moment.
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double e() const
The total energy of the particle.
@ SECOND_ENG_DENS
Second Moment in E/V.
@ SECOND_LAMBDA
Second Moment in .
@ LATERAL
Normalized lateral moment.
@ LONGITUDINAL
Normalized longitudinal moment.
@ ENG_FRAC_MAX
Energy fraction of hottest cell.
@ SECOND_R
Second Moment in .
@ CENTER_LAMBDA
Shower depth at Cluster Centroid.
@ SIGNIFICANCE
Cluster significance.
Class providing the definition of the 4-vector interface.
std::vector< double > HelperDouble(const std::string &input, TEnv &env)
std::string findConfigFile(const std::string &input, const std::map< std::string, std::string > &configmap)
const std::map< std::string, std::string > ForwardLHPointToConfFile
@ Electron
The object is an electron.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Egamma_v1 Egamma
Definition of the current "egamma version".
Electron_v1 Electron
Definition of the current "egamma version".
Extra patterns decribing particle interation process.