ATLAS Offline Software
Loading...
Searching...
No Matches
AsgForwardElectronLikelihoodTool Class Reference

Electron selector tool to select objects in Asgena using an underlying pure ROOT tool. More...

#include <AsgForwardElectronLikelihoodTool.h>

Inheritance diagram for AsgForwardElectronLikelihoodTool:
Collaboration diagram for AsgForwardElectronLikelihoodTool:

Public Member Functions

double calculate (const xAOD::IParticle *part) const
 The main result method: the actual likelihood is calculated here.
double calculate (const EventContext &ctx, const xAOD::IParticle *part) const override
 calculate method: for pointer to IParticle
double calculate (const xAOD::Electron *eg) const
 The main result method: the actual likelihood is calculated here.
double calculate (const EventContext &ctx, const xAOD::Electron *eg) const override
 calculate method: for pointer to electron
double calculate (const xAOD::Egamma *eg) const
 The main result method: the actual likelihood is calculated here.
double calculate (const EventContext &ctx, const xAOD::Egamma *eg) const override
 calculate method: for pointer to egamma
double calculate (const xAOD::Electron *eg, double mu) const
 The main result method: the actual likelihood is calculated here.
double calculate (const EventContext &ctx, const xAOD::Electron *eg, double mu) const override
 calculate method: for pointer to electron when mu not in EventInfo for online
double calculate (const xAOD::Egamma *eg, double mu) const
 The main result method: the actual likelihood is calculated here.
double calculate (const EventContext &ctx, const xAOD::Egamma *eg, double mu) const override
 calculate method: for pointer to egamma when mu not in EventInfo for online
virtual std::vector< float > calculateMultipleOutputs (const EventContext &ctx, const xAOD::Electron *eg, double mu=-99) const override
 The result method for multiple outputs: only one output is used so return vector of that output.
virtual std::string getOperatingPointName () const override
 Get the name of the current operating point.
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

virtual ASG_TOOL_CLASS2(AsgForwardElectronLikelihoodTool, IAsgElectronLikelihoodTool, IAsgSelectionTool) public ~AsgForwardElectronLikelihoodTool ()
 Standard constructor.
virtual StatusCode initialize () override final
 Gaudi Service Interface method implementations.
virtual const asg::AcceptInfogetAcceptInfo () const override
 Method to get the plain AcceptInfo.
asg::AcceptData accept (const xAOD::IParticle *part) const override
 The main accept method: using the generic interface.
asg::AcceptData accept (const EventContext &ctx, const xAOD::IParticle *part) const override
asg::AcceptData accept (const xAOD::Electron *eg) const
 The main accept method: the actual cuts are applied here.
asg::AcceptData accept (const EventContext &ctx, const xAOD::Electron *eg) const override
 accept method with pointer to electron
asg::AcceptData accept (const xAOD::Egamma *eg) const
 The main accept method: the actual cuts are applied here.
asg::AcceptData accept (const EventContext &ctx, const xAOD::Egamma *eg) const override
 accept method with pointer to egamma
asg::AcceptData accept (const xAOD::Electron *eg, double mu) const
 The main accept method: in case mu not in EventInfo online.
asg::AcceptData accept (const EventContext &ctx, const xAOD::Electron *eg, double mu) const override
 accept method with pointer to electron when mu not in EventInfo for online
asg::AcceptData accept (const xAOD::Egamma *eg, double mu) const
 The main accept method: in case mu not in EventInfo online.
asg::AcceptData accept (const EventContext &ctx, const xAOD::Egamma *eg, double mu) const override
 accept method with pointer to egammma when mu not in EventInfo for online
unsigned int getNPrimVertices (const EventContext &ctx) const
 Get the number of primary vertices.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

std::string m_WorkingPoint
 Get the name of the current operating point.
std::string m_configFile
Root::TForwardElectronLikelihoodToolm_rootForwardTool
 Pointer to the underlying ROOT based tool.
bool m_usePVCont
 Whether to use the PV (not available for trigger)
unsigned int m_nPVdefault
 defualt nPV (when not using PVCont)
SG::ReadHandleKey< xAOD::VertexContainerm_primVtxContKey
 read handle key to primary vertex container
std::string m_pdfFileName
 The input ROOT file name that holds the PDFs.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Electron selector tool to select objects in Asgena using an underlying pure ROOT tool.

Definition at line 25 of file AsgForwardElectronLikelihoodTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Member Function Documentation

◆ accept() [1/10]

asg::AcceptData AsgForwardElectronLikelihoodTool::accept ( const EventContext & ctx,
const xAOD::Egamma * part ) const
inlineoverrideprivatevirtual

accept method with pointer to egamma

Implements IAsgElectronLikelihoodTool.

Definition at line 73 of file AsgForwardElectronLikelihoodTool.h.

75 {
76 return accept(ctx, eg, -99); // mu = -99 as input will force accept to grab
77 // the pileup variable from the xAOD object
78 }
asg::AcceptData accept(const xAOD::IParticle *part) const override
The main accept method: using the generic interface.

◆ accept() [2/10]

asg::AcceptData AsgForwardElectronLikelihoodTool::accept ( const EventContext & ctx,
const xAOD::Egamma * part,
double mu ) const
overrideprivatevirtual

accept method with pointer to egammma when mu not in EventInfo for online

Implements IAsgElectronLikelihoodTool.

Definition at line 222 of file AsgForwardElectronLikelihoodTool.cxx.

225{
226
227 const xAOD::Electron* el = dynamic_cast<const xAOD::Electron*>(eg);
228 return accept(ctx, el, mu);
229}
Electron_v1 Electron
Definition of the current "egamma version".

◆ accept() [3/10]

asg::AcceptData AsgForwardElectronLikelihoodTool::accept ( const EventContext & ctx,
const xAOD::Electron * part ) const
inlineoverrideprivatevirtual

accept method with pointer to electron

Implements IAsgElectronLikelihoodTool.

Definition at line 60 of file AsgForwardElectronLikelihoodTool.h.

62 {
63 return accept(ctx, eg, -99); // mu = -99 as input will force accept to grab
64 // the pileup variable from the xAOD object
65 }

◆ accept() [4/10]

asg::AcceptData AsgForwardElectronLikelihoodTool::accept ( const EventContext & ctx,
const xAOD::Electron * part,
double mu ) const
overrideprivatevirtual

accept method with pointer to electron when mu not in EventInfo for online

Implements IAsgElectronLikelihoodTool.

Definition at line 235 of file AsgForwardElectronLikelihoodTool.cxx.

238{
239 if (!eg) {
240 ATH_MSG_ERROR("Failed, no egamma object.");
241 return m_rootForwardTool->accept();
242 }
243
244 const xAOD::CaloCluster* cluster = eg->caloCluster();
245 if (!cluster) {
246 ATH_MSG_WARNING("Failed, no cluster.");
247 return m_rootForwardTool->accept();
248 }
249
250 const double energy = cluster->e();
251 const float eta = (cluster->eta());
252 if (fabs(eta) > 300.0) {
253 ATH_MSG_WARNING("Failed, eta > 3000.");
254 return m_rootForwardTool->accept();
255 }
256
257 // transverse energy of the electron (using the track eta)
258 double et = (cosh(eta) != 0.) ? energy / cosh(eta) : 0.;
259 double ip(0);
260
261 // Get the number of primary vertices in this event
262 if (mu < 0) { // use npv if mu is negative (not given)
263 ip = static_cast<double>(m_usePVCont ? this->getNPrimVertices(ctx)
264 : m_nPVdefault);
265 } else {
266 ip = mu;
267 }
268
269 // for now don't cache.
270 double likelihood = calculate(ctx, eg, ip);
271
272 // Get the answer from the underlying ROOT tool
273 return m_rootForwardTool->accept(likelihood, eta, et, ip);
274}
Scalar eta() const
pseudorapidity method
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
float et(const xAOD::jFexSRJetRoI *j)
unsigned int m_nPVdefault
defualt nPV (when not using PVCont)
unsigned int getNPrimVertices(const EventContext &ctx) const
Get the number of primary vertices.
double calculate(const xAOD::IParticle *part) const
The main result method: the actual likelihood is calculated here.
Root::TForwardElectronLikelihoodTool * m_rootForwardTool
Pointer to the underlying ROOT based tool.
bool m_usePVCont
Whether to use the PV (not available for trigger)
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double e() const
The total energy of the particle.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.

◆ accept() [5/10]

asg::AcceptData AsgForwardElectronLikelihoodTool::accept ( const EventContext & ctx,
const xAOD::IParticle * part ) const
overrideprivatevirtual

Implements IAsgElectronLikelihoodTool.

Definition at line 448 of file AsgForwardElectronLikelihoodTool.cxx.

450{
451 if (part->type() == xAOD::Type::Electron) {
452 const xAOD::Electron* el = static_cast<const xAOD::Electron*>(part);
453 return accept(ctx, el);
454 }
455 ATH_MSG_ERROR("Input is not an electron");
456 return m_rootForwardTool->accept();
457}
@ Electron
The object is an electron.
Definition ObjectType.h:46

◆ accept() [6/10]

asg::AcceptData AsgForwardElectronLikelihoodTool::accept ( const xAOD::Egamma * eg) const
inlineprivate

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

Definition at line 68 of file AsgForwardElectronLikelihoodTool.h.

69 {
70 return accept(eg, -99); // mu = -99 as input will force accept to grab the
71 // pileup variable from the xAOD object
72 }

◆ accept() [7/10]

asg::AcceptData AsgForwardElectronLikelihoodTool::accept ( const xAOD::Egamma * eg,
double mu ) const
private

The main accept method: in case mu not in EventInfo online.

Definition at line 204 of file AsgForwardElectronLikelihoodTool.cxx.

206{
207
208 const xAOD::Electron* el = dynamic_cast<const xAOD::Electron*>(eg);
209 return accept(el, mu);
210}

◆ accept() [8/10]

asg::AcceptData AsgForwardElectronLikelihoodTool::accept ( const xAOD::Electron * eg) const
inlineprivate

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

Definition at line 55 of file AsgForwardElectronLikelihoodTool.h.

56 {
57 return accept(eg, -99); // mu = -99 as input will force accept to grab the
58 // pileup variable from the xAOD object
59 }

◆ accept() [9/10]

asg::AcceptData AsgForwardElectronLikelihoodTool::accept ( const xAOD::Electron * eg,
double mu ) const
private

The main accept method: in case mu not in EventInfo online.

Definition at line 213 of file AsgForwardElectronLikelihoodTool.cxx.

215{
216
217 // Backwards compatbility
218 return accept(Gaudi::Hive::currentContext(), eg, mu);
219}

◆ accept() [10/10]

asg::AcceptData AsgForwardElectronLikelihoodTool::accept ( const xAOD::IParticle * part) const
overrideprivatevirtual

The main accept method: using the generic interface.

Implements IAsgElectronLikelihoodTool.

Definition at line 441 of file AsgForwardElectronLikelihoodTool.cxx.

442{
443 // Backwards compatibility
444 return accept(Gaudi::Hive::currentContext(), part);
445}

◆ calculate() [1/10]

double AsgForwardElectronLikelihoodTool::calculate ( const EventContext & ctx,
const xAOD::Egamma * eg ) const
inlineoverridevirtual

calculate method: for pointer to egamma

Implements IAsgElectronLikelihoodTool.

Definition at line 119 of file AsgForwardElectronLikelihoodTool.h.

121 {
122 return calculate(
123 ctx, eg, -99); // mu = -99 as input will force accept to grab the pileup
124 // variable from the xAOD object
125 }

◆ calculate() [2/10]

double AsgForwardElectronLikelihoodTool::calculate ( const EventContext & ctx,
const xAOD::Egamma * eg,
double mu ) const
overridevirtual

calculate method: for pointer to egamma when mu not in EventInfo for online

Implements IAsgElectronLikelihoodTool.

Definition at line 297 of file AsgForwardElectronLikelihoodTool.cxx.

300{
301
302 const xAOD::Electron* el = dynamic_cast<const xAOD::Electron*>(eg);
303 return calculate(ctx, el, mu);
304}

◆ calculate() [3/10]

double AsgForwardElectronLikelihoodTool::calculate ( const EventContext & ctx,
const xAOD::Electron * eg ) const
inlineoverridevirtual

calculate method: for pointer to electron

Implements IAsgElectronLikelihoodTool.

Definition at line 105 of file AsgForwardElectronLikelihoodTool.h.

107 {
108 return calculate(
109 ctx, eg, -99); // mu = -99 as input will force accept to grab the pileup
110 // variable from the xAOD object
111 }

◆ calculate() [4/10]

double AsgForwardElectronLikelihoodTool::calculate ( const EventContext & ctx,
const xAOD::Electron * eg,
double mu ) const
overridevirtual

calculate method: for pointer to electron when mu not in EventInfo for online

Implements IAsgElectronLikelihoodTool.

Definition at line 310 of file AsgForwardElectronLikelihoodTool.cxx.

313{
314 if (!eg) {
315 ATH_MSG_ERROR("Failed, no egamma object.");
316 return -999;
317 }
318
319 const xAOD::CaloCluster* cluster = eg->caloCluster();
320 if (!cluster) {
321 ATH_MSG_ERROR("Failed, no cluster.");
322 return -999;
323 }
324
325 const double energy = cluster->e();
326 const float eta = cluster->eta();
327 if (fabs(eta) > 300.0) {
328 ATH_MSG_ERROR("Failed, eta range.");
329 ATH_MSG_ERROR("checking at other place ." << eta);
330 return -999;
331 }
332
333 const double et = (cosh(eta) != 0.) ? energy / cosh(eta) : 0.;
334
335 // Shower shape variables
336 double secondDensity(0), significance(0), secondLambda(0), lateral(0),
337 longitudinal(0), fracMax(0), secondR(0), centerLambda(0);
338
339 bool allFound = true;
340 std::string notFoundList = "";
341
342 // secondLambda
344 secondLambda)) {
345 allFound = false;
346 notFoundList += "secondLambda ";
347 }
348 // lateral
349 if (!cluster->retrieveMoment(xAOD::CaloCluster::LATERAL, lateral)) {
350 allFound = false;
351 notFoundList += "lateral ";
352 }
353 // longitudinal
354 if (!cluster->retrieveMoment(xAOD::CaloCluster::LONGITUDINAL, longitudinal)) {
355 allFound = false;
356 notFoundList += "longitudinal ";
357 }
358 // fracMax
359 if (!cluster->retrieveMoment(xAOD::CaloCluster::ENG_FRAC_MAX, fracMax)) {
360 allFound = false;
361 notFoundList += "fracMax ";
362 }
363 // secondR
364 if (!cluster->retrieveMoment(xAOD::CaloCluster::SECOND_R, secondR)) {
365 allFound = false;
366 notFoundList += "secondR ";
367 }
368 // centerlambda
370 centerLambda)) {
371 allFound = false;
372 notFoundList += "centerLambda ";
373 }
375 secondDensity)) {
376 allFound = false;
377 notFoundList += "secondDensity ";
378 }
379 if (!cluster->retrieveMoment(xAOD::CaloCluster::SIGNIFICANCE, significance)) {
380 allFound = false;
381 notFoundList += "significance ";
382 }
383
384 // Get the number of primary vertices in this event
385 double ip = static_cast<double>(m_nPVdefault);
386
387 if (mu < 0) { // use npv if mu is negative (not given)
388 ip = static_cast<double>(m_usePVCont ? this->getNPrimVertices(ctx)
389 : m_nPVdefault);
390 } else {
391 ip = mu;
392 }
393
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",
398 eta,
399 et,
400 secondLambda,
401 lateral,
402 longitudinal,
403 centerLambda,
404 fracMax,
405 secondR,
406 significance,
407 secondDensity,
408 ip));
409
410 if (!allFound) {
412 "Skipping LH calculation! The following variables are missing: "
413 << notFoundList);
414 return -999;
415 }
416
417 // Get the answer from the underlying ROOT tool
418 return m_rootForwardTool->calculate(eta,
419 et,
420 secondLambda,
421 lateral,
422 longitudinal,
423 centerLambda,
424 fracMax,
425 secondR,
426 significance,
427 secondDensity,
428 ip);
429}
#define ATH_MSG_VERBOSE(x)
bool retrieveMoment(MomentType type, double &value) const
Retrieve individual moment.
@ 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.

◆ calculate() [5/10]

double AsgForwardElectronLikelihoodTool::calculate ( const EventContext & ctx,
const xAOD::IParticle * part ) const
overridevirtual

calculate method: for pointer to IParticle

Implements IAsgElectronLikelihoodTool.

Definition at line 467 of file AsgForwardElectronLikelihoodTool.cxx.

469{
470 if (part->type() == xAOD::Type::Electron) {
471 const xAOD::Electron* el = static_cast<const xAOD::Electron*>(part);
472 return calculate(ctx, el);
473 }
474 ATH_MSG_ERROR("Input is not an electron");
475 return -999;
476}

◆ calculate() [6/10]

double AsgForwardElectronLikelihoodTool::calculate ( const xAOD::Egamma * eg) const
inline

The main result method: the actual likelihood is calculated here.

Definition at line 114 of file AsgForwardElectronLikelihoodTool.h.

115 {
116 return calculate(eg, -99); // mu = -99 as input will force accept to grab
117 // the pileup variable from the xAOD object
118 }

◆ calculate() [7/10]

double AsgForwardElectronLikelihoodTool::calculate ( const xAOD::Egamma * eg,
double mu ) const

The main result method: the actual likelihood is calculated here.

Definition at line 280 of file AsgForwardElectronLikelihoodTool.cxx.

282{
283
284 const xAOD::Electron* el = dynamic_cast<const xAOD::Electron*>(eg);
285 return calculate(el, mu);
286}

◆ calculate() [8/10]

double AsgForwardElectronLikelihoodTool::calculate ( const xAOD::Electron * eg) const
inline

The main result method: the actual likelihood is calculated here.

Definition at line 100 of file AsgForwardElectronLikelihoodTool.h.

101 {
102 return calculate(eg, -99); // mu = -99 as input will force accept to grab
103 // the pileup variable from the xAOD object
104 }

◆ calculate() [9/10]

double AsgForwardElectronLikelihoodTool::calculate ( const xAOD::Electron * eg,
double mu ) const

The main result method: the actual likelihood is calculated here.

Definition at line 289 of file AsgForwardElectronLikelihoodTool.cxx.

291{
292 // Backward compatbility
293 return calculate(Gaudi::Hive::currentContext(), el, mu);
294}

◆ calculate() [10/10]

double AsgForwardElectronLikelihoodTool::calculate ( const xAOD::IParticle * part) const

The main result method: the actual likelihood is calculated here.

Definition at line 460 of file AsgForwardElectronLikelihoodTool.cxx.

461{
462 // Backwards compatibily
463 return calculate(Gaudi::Hive::currentContext(), part);
464}

◆ calculateMultipleOutputs()

virtual std::vector< float > AsgForwardElectronLikelihoodTool::calculateMultipleOutputs ( const EventContext & ctx,
const xAOD::Electron * eg,
double mu = -99 ) const
inlineoverridevirtual

The result method for multiple outputs: only one output is used so return vector of that output.

Implements IAsgElectronLikelihoodTool.

Definition at line 141 of file AsgForwardElectronLikelihoodTool.h.

144 {
145 return {static_cast<float>(calculate(ctx, eg, mu))};
146 }

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ getAcceptInfo()

const asg::AcceptInfo & AsgForwardElectronLikelihoodTool::getAcceptInfo ( ) const
overrideprivatevirtual

Method to get the plain AcceptInfo.

This is needed so that one can already get the AcceptInfo and query what cuts are defined before the first object is passed to the tool.

Implements IAsgSelectionTool.

Definition at line 195 of file AsgForwardElectronLikelihoodTool.cxx.

196{
197 return m_rootForwardTool->getAcceptInfo();
198}

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void * ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119 {
120
121#ifdef XAOD_STANDALONE
122 // In case we use @c xAOD::TEvent, we have a direct function call
123 // for this.
124 return evtStore()->event()->getKey( ptr );
125#else
126 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127 return ( proxy == nullptr ? 0 : proxy->sgkey() );
128#endif // XAOD_STANDALONE
129 }
ServiceHandle< StoreGateSvc > & evtStore()

◆ getName()

const std::string & asg::AsgTool::getName ( const void * ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106 {
107
108#ifdef XAOD_STANDALONE
109 // In case we use @c xAOD::TEvent, we have a direct function call
110 // for this.
111 return evtStore()->event()->getName( ptr );
112#else
113 const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114 static const std::string dummy = "";
115 return ( proxy == nullptr ? dummy : proxy->name() );
116#endif // XAOD_STANDALONE
117 }

◆ getNPrimVertices()

unsigned int AsgForwardElectronLikelihoodTool::getNPrimVertices ( const EventContext & ctx) const
private

Get the number of primary vertices.

Definition at line 485 of file AsgForwardElectronLikelihoodTool.cxx.

487{
488 unsigned int nVtx(0);
489 SG::ReadHandle<xAOD::VertexContainer> vtxCont(m_primVtxContKey, ctx);
490 if (!vtxCont.isValid()) {
491 ATH_MSG_WARNING("Cannot find " << m_primVtxContKey.key()
492 << " container, returning default nVtx");
493 return m_nPVdefault;
494 }
495 for (const auto *vxcand : *vtxCont) {
496 if (vxcand->nTrackParticles() >= 2)
497 nVtx++;
498 }
499 return nVtx;
500}
SG::ReadHandleKey< xAOD::VertexContainer > m_primVtxContKey
read handle key to primary vertex container

◆ getOperatingPointName()

std::string AsgForwardElectronLikelihoodTool::getOperatingPointName ( ) const
overridevirtual

Get the name of the current operating point.

Implements IAsgElectronLikelihoodTool.

Definition at line 435 of file AsgForwardElectronLikelihoodTool.cxx.

436{
437 return m_WorkingPoint;
438}
std::string m_WorkingPoint
Get the name of the current operating point.

◆ getProperty()

template<class T>
const T * asg::AsgTool::getProperty ( const std::string & name) const
inherited

Get one of the tool's properties.

◆ initialize()

StatusCode AsgForwardElectronLikelihoodTool::initialize ( void )
finaloverrideprivatevirtual

Gaudi Service Interface method implementations.

--------—End of text config-------------------------—

Reimplemented from asg::AsgTool.

Definition at line 94 of file AsgForwardElectronLikelihoodTool.cxx.

95{
96
97 ATH_MSG_INFO("initialize : WP " << m_WorkingPoint.size() << " "
98 << m_configFile.size());
99
100 std::string PDFfilename(""); // Default
101
102 if (!m_WorkingPoint.empty()) {
105 ATH_MSG_INFO("operating point : " << this->getOperatingPointName());
106 }
107
108 if (!m_configFile.empty()) {
110 if (configFile.empty()) {
111 ATH_MSG_ERROR("Could not locate " << m_configFile);
112 return StatusCode::FAILURE;
113 }
114
115 ATH_MSG_DEBUG("Get the input PDFs in the tool ");
116 TEnv env;
117 env.ReadFile(configFile.c_str(), kEnvLocal);
118
119 // Get the input PDFs in the tool.
120 ATH_MSG_DEBUG("Get the input PDFs in the tool ");
121
122 if (!m_pdfFileName
123 .empty()) { // If the property was set by the user, take that.
124 ATH_MSG_INFO("Setting user specified PDF file " << m_pdfFileName);
125 PDFfilename = m_pdfFileName;
126 } else {
127 if (m_configFile.find("dev/") != std::string::npos) {
128 std::string PDFdevval = env.GetValue(
129 "inputPDFFileName",
130 "ElectronPhotonSelectorTools/offline/mc16_20180716/"
131 "ForwardElectronLikelihoodPdfs.root"); // this is the first PDF ever
132 // released
133 PDFfilename = ("dev/" + PDFdevval);
134 ATH_MSG_DEBUG("Getting the input PDFs from: " << PDFfilename);
135 } else {
136 PDFfilename =
137 env.GetValue("inputPDFFileName",
138 "ElectronPhotonSelectorTools/offline/mc16_20180716/"
139 "ForwardElectronLikelihoodPdfs.root");
140 ATH_MSG_DEBUG("Getting the input PDFs from: " << PDFfilename);
141 }
142 }
143 std::string filename = PathResolverFindCalibFile(PDFfilename);
144
145 if (!filename.empty()) {
146 m_rootForwardTool->setPDFFileName(filename);
147 } else {
148 ATH_MSG_ERROR("Could not find PDF file");
149 return StatusCode::FAILURE;
150 }
151
152 m_rootForwardTool->m_variableNames = env.GetValue("VariableNames", "");
153 m_rootForwardTool->m_cutLikelihood =
154 AsgConfigHelper::HelperDouble("CutLikelihood", env);
155 m_rootForwardTool->m_cutLikelihoodPileupCorrectionA =
156 AsgConfigHelper::HelperDouble("DiscCutSlopeForPileupCorrection", env);
157 m_rootForwardTool->m_cutLikelihoodPileupCorrectionB =
158 AsgConfigHelper::HelperDouble("DiscCutForPileupCorrection", env);
159 m_rootForwardTool->m_doPileupCorrection =
160 env.GetValue("doPileupCorrection", false);
161 } else { // Error if it cant find the conf
162 ATH_MSG_ERROR("Could not find configuration file");
163 return StatusCode::FAILURE;
164 }
165
167
168 // Setup primary vertex key handle
170
171 // Get the name of the current operating point, and massage the other strings
172 // accordingly
174 "Going to massage the labels based on the provided operating point...");
175
176 // Get the message level and set the underlying ROOT tool message level
177 // accordingly
178 m_rootForwardTool->msg().setLevel(this->msg().level());
179
180 // We need to initialize the underlying ROOT TSelectorTool
181 if (m_rootForwardTool->initialize().isFailure()) {
183 "ERROR! Could not initialize the TForwardElectronLikelihoodTool!");
184 return StatusCode::FAILURE;
185 }
186
187 return StatusCode::SUCCESS;
188}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
static const Attributes_t empty
std::string m_pdfFileName
The input ROOT file name that holds the PDFs.
virtual std::string getOperatingPointName() const override
Get the name of the current operating point.
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
MsgStream & msg
Definition testRead.cxx:32

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101 {
102
103 return MSG::name( msg().level() );
104 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ print()

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

◆ ~AsgForwardElectronLikelihoodTool()

AsgForwardElectronLikelihoodTool::~AsgForwardElectronLikelihoodTool ( )
privatevirtual

Standard constructor.

Standard destructor

Definition at line 85 of file AsgForwardElectronLikelihoodTool.cxx.

86{
87 delete m_rootForwardTool;
88}

Member Data Documentation

◆ m_configFile

std::string AsgForwardElectronLikelihoodTool::m_configFile
private

Definition at line 163 of file AsgForwardElectronLikelihoodTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_nPVdefault

unsigned int AsgForwardElectronLikelihoodTool::m_nPVdefault
private

defualt nPV (when not using PVCont)

Definition at line 172 of file AsgForwardElectronLikelihoodTool.h.

◆ m_pdfFileName

std::string AsgForwardElectronLikelihoodTool::m_pdfFileName
private

The input ROOT file name that holds the PDFs.

Definition at line 183 of file AsgForwardElectronLikelihoodTool.h.

◆ m_primVtxContKey

SG::ReadHandleKey<xAOD::VertexContainer> AsgForwardElectronLikelihoodTool::m_primVtxContKey
private
Initial value:
{
this,
"primaryVertexContainer",
"PrimaryVertices",
"The primary vertex container name"
}

read handle key to primary vertex container

Definition at line 175 of file AsgForwardElectronLikelihoodTool.h.

175 {
176 this,
177 "primaryVertexContainer",
178 "PrimaryVertices",
179 "The primary vertex container name"
180 };

◆ m_rootForwardTool

Root::TForwardElectronLikelihoodTool* AsgForwardElectronLikelihoodTool::m_rootForwardTool
private

Pointer to the underlying ROOT based tool.

Definition at line 166 of file AsgForwardElectronLikelihoodTool.h.

◆ m_usePVCont

bool AsgForwardElectronLikelihoodTool::m_usePVCont
private

Whether to use the PV (not available for trigger)

Definition at line 169 of file AsgForwardElectronLikelihoodTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.

◆ m_WorkingPoint

std::string AsgForwardElectronLikelihoodTool::m_WorkingPoint
private

Get the name of the current operating point.

Definition at line 160 of file AsgForwardElectronLikelihoodTool.h.


The documentation for this class was generated from the following files: