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

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

#include <AsgElectronLikelihoodTool.h>

Inheritance diagram for AsgElectronLikelihoodTool:
Collaboration diagram for AsgElectronLikelihoodTool:

Public Member Functions

virtual StatusCode initialize () override
 Gaudi Service Interface method implementations.
virtual const asg::AcceptInfogetAcceptInfo () const override
 Method to get the plain AcceptInfo.
virtual asg::AcceptData accept (const xAOD::IParticle *part) const override final
 The main accept method: using the generic interface.
virtual asg::AcceptData accept (const EventContext &ctx, const xAOD::IParticle *part) const override final
virtual asg::AcceptData accept (const EventContext &ctx, const xAOD::Electron *eg) const override final
 The main accept method: the actual cuts are applied here.
virtual asg::AcceptData accept (const EventContext &ctx, const xAOD::Egamma *eg) const override final
 The main accept method: the actual cuts are applied here.
virtual asg::AcceptData accept (const EventContext &ctx, const xAOD::Electron *eg, double mu) const override final
 The main accept method: in case mu not in EventInfo online.
virtual asg::AcceptData accept (const EventContext &ctx, const xAOD::Egamma *eg, double mu) const override final
 The main accept method: in case mu not in EventInfo online.
virtual double calculate (const EventContext &ctx, const xAOD::IParticle *part) const override final
 calculate method: for pointer to IParticle
virtual double calculate (const EventContext &ctx, const xAOD::Electron *eg) const override final
 The main result method: the actual likelihood is calculated here.
virtual double calculate (const EventContext &ctx, const xAOD::Egamma *eg) const override final
 The main result method: the actual likelihood is calculated here.
virtual double calculate (const EventContext &ctx, const xAOD::Electron *eg, double mu) const override final
 The main result method: the actual likelihood is calculated here.
virtual double calculate (const EventContext &ctx, const xAOD::Egamma *eg, double mu) const override final
 The main result method: the actual likelihood is calculated here.
virtual std::vector< float > calculateMultipleOutputs (const EventContext &ctx, const xAOD::Electron *eg, double mu=-99) const override final
 The result method for multiple outputs: only one output is used so return vector of that output.
virtual std::string getOperatingPointName () const override final
 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(AsgElectronLikelihoodTool, IAsgElectronLikelihoodTool, IAsgSelectionTool) public ~AsgElectronLikelihoodTool ()
 Standard constructor.
double getIpVariable (double mu, const EventContext &ctx) const
 Get IP variable based on user configuration.
unsigned int getNPrimVertices (const EventContext &ctx) const
 Get the number of primary vertices.
double getAverageMu (const EventContext &ctx) const
 Get the average mu.
double getFcalEt (const EventContext &ctx) const
 Get the FCal ET for centrality determination (for HI collisions)
bool isForwardElectron (const xAOD::Egamma *eg, const float eta) const
 check for FwdElectron
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
 Working Point.
std::string m_configFile
Root::TElectronLikelihoodToolm_rootTool
 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)
bool m_useCaloSumsCont
 Whether or not to use the CaloSums container in HI events.
double m_fcalEtDefault
 defualt FCal ET (when not using CaloSums container, in HI events)
std::string m_pdfFileName
 The input ROOT file name that holds the PDFs.
bool m_caloOnly = false
 Flag for calo only LH.
bool m_skipDeltaPoverP
 Flag for skip the use of deltaPoverP in LH computation (like at HLT)
bool m_correctDeltaEta = false
 Flag to toggle the correction of deltaEta1 for the pear shape distortion of the LAr.
bool m_useAverageMu = false
SG::ReadHandleKey< xAOD::HIEventShapeContainerm_HIESContKey
 read handle key to heavy ion container
SG::ReadHandleKey< xAOD::VertexContainerm_primVtxContKey
 read handle key to primary vertex container
SG::ReadDecorHandleKey< xAOD::EventInfom_avgMuKey
 read handle key to averager mu
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 Athena using an underlying pure ROOT tool.

Author
Karsten Koeneke , Jovan Mitrevski
Date
October 2012 @update April 2014, converted to ASGTool by Jovan Mitrevski

Definition at line 27 of file AsgElectronLikelihoodTool.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/6]

virtual asg::AcceptData AsgElectronLikelihoodTool::accept ( const EventContext & ctx,
const xAOD::Egamma * eg ) const
inlinefinaloverridevirtual

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

Implements IAsgElectronLikelihoodTool.

Definition at line 71 of file AsgElectronLikelihoodTool.h.

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

◆ accept() [2/6]

asg::AcceptData AsgElectronLikelihoodTool::accept ( const EventContext & ctx,
const xAOD::Egamma * eg,
double mu ) const
finaloverridevirtual

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

Implements IAsgElectronLikelihoodTool.

Definition at line 409 of file AsgElectronLikelihoodTool.cxx.

412{
413 if (!eg) {
414 ATH_MSG_ERROR("Failed, no egamma object.");
415 return m_rootTool->accept();
416 }
417 // Call the main accept if this is not a calo-only LH
418 if (!m_caloOnly) {
419 if (eg->type() == xAOD::Type::Electron) {
420 const xAOD::Electron* el = static_cast<const xAOD::Electron*>(eg);
421 return accept(ctx, el, mu);
422 }
423 ATH_MSG_ERROR("Input is not an electron and not caloOnly is set");
424 return m_rootTool->accept();
425 }
426
427 // Calo only LH
428 const xAOD::CaloCluster* cluster = eg->caloCluster();
429 if (!cluster) {
430 ATH_MSG_ERROR("Failed, no cluster.");
431 return m_rootTool->accept();
432 }
433 if (!cluster->hasSampling(CaloSampling::CaloSample::EMB2) &&
434 !cluster->hasSampling(CaloSampling::CaloSample::EME2)) {
435 ATH_MSG_ERROR("Failed, cluster is missing samplings EMB2 and EME2");
436 return m_rootTool->accept();
437 }
438
439 const double energy = cluster->e();
440 const float eta = (cluster->etaBE(2));
441 if (isForwardElectron(eg, eta)) {
443 "Failed, this is a forward electron! The AsgElectronLikelihoodTool is "
444 "only suitable for central electrons!");
445 return m_rootTool->accept();
446 }
447
448 const double et = (cosh(eta) != 0.) ? energy / cosh(eta) : 0.;
449
450 // Variables the EFCaloLH ignores
451 uint8_t nSiHitsPlusDeadSensors(0);
453 bool passBLayerRequirement(false);
454 uint8_t ambiguityBit(0);
455
456 // Get the pileup or centrality information
457 double ip = getIpVariable(mu, ctx);
458
459 // for now don't cache.
460 double likelihood = calculate(ctx, eg, ip);
461
462 double deltaEta = 0;
463 double deltaPhiRescaled2 = 0;
464 double d0 = 0;
465 float wstot = 0;
466 float EoverP = 0;
467
468 bool allFound = true;
469 std::string notFoundList = "";
470
471 // Wstot for use when CutWstotAtHighET vector is filled
472 if (!eg->showerShapeValue(wstot, xAOD::EgammaParameters::wtots1)) {
473 allFound = false;
474 notFoundList += "wtots1 ";
475 }
476
477 if (!allFound) {
479 "Skipping LH rectangular cuts! The following variables are missing: "
480 << notFoundList);
481 return m_rootTool->accept();
482 }
483
484 // Get the answer from the underlying ROOT tool
485 return m_rootTool->accept(likelihood,
486 eta,
487 et,
488 nSiHitsPlusDeadSensors,
489 nPixHitsPlusDeadSensors,
490 passBLayerRequirement,
491 ambiguityBit,
492 d0,
493 deltaEta,
494 deltaPhiRescaled2,
495 wstot,
496 EoverP,
497 ip);
498}
Scalar eta() const
pseudorapidity method
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
float et(const xAOD::jFexSRJetRoI *j)
virtual double calculate(const EventContext &ctx, const xAOD::IParticle *part) const override final
calculate method: for pointer to IParticle
bool isForwardElectron(const xAOD::Egamma *eg, const float eta) const
check for FwdElectron
bool m_caloOnly
Flag for calo only LH.
double getIpVariable(double mu, const EventContext &ctx) const
Get IP variable based on user configuration.
Root::TElectronLikelihoodTool * m_rootTool
Pointer to the underlying ROOT based tool.
virtual double e() const
The total energy of the particle.
bool hasSampling(const CaloSample s) const
Checks if certain smapling contributes to cluster.
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
bool passBLayerRequirement(const xAOD::TrackParticle &tp)
return true if effective number of BL hits + outliers is at least one
double deltaEta(const I4Momentum &p1, const I4Momentum &p2)
Computes efficiently .
Definition P4Helpers.h:66
@ Electron
The object is an electron.
Definition ObjectType.h:46
@ deltaPhiRescaled2
difference between the cluster phi (second sampling) and the phi of the track extrapolated to the sec...
@ wtots1
shower width is determined in a window detaxdphi = 0,0625 ×~0,2, corresponding typically to 20 strips...
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
setEt setPhi setE277 setWeta2 setEta1 setE2tsts1 wstot
Electron_v1 Electron
Definition of the current "egamma version".

◆ accept() [3/6]

virtual asg::AcceptData AsgElectronLikelihoodTool::accept ( const EventContext & ctx,
const xAOD::Electron * eg ) const
inlinefinaloverridevirtual

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

Implements IAsgElectronLikelihoodTool.

Definition at line 63 of file AsgElectronLikelihoodTool.h.

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

◆ accept() [4/6]

asg::AcceptData AsgElectronLikelihoodTool::accept ( const EventContext & ctx,
const xAOD::Electron * eg,
double mu ) const
finaloverridevirtual

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

Implements IAsgElectronLikelihoodTool.

Definition at line 265 of file AsgElectronLikelihoodTool.cxx.

268{
269 if (!el) {
270 ATH_MSG_ERROR("Failed, no electron object.");
271 return m_rootTool->accept();
272 }
273
274 const xAOD::CaloCluster* cluster = el->caloCluster();
275 if (!cluster) {
276 ATH_MSG_ERROR("exiting because cluster is NULL " << cluster);
277 return m_rootTool->accept();
278 }
279
280 if (!cluster->hasSampling(CaloSampling::CaloSample::EMB2) &&
281 !cluster->hasSampling(CaloSampling::CaloSample::EME2)) {
282 ATH_MSG_ERROR("Failed, cluster is missing samplings EMB2 and EME2");
283 return m_rootTool->accept();
284 }
285
286 const double energy = cluster->e();
287 const float eta = (cluster->etaBE(2));
288
289 if (isForwardElectron(el, eta)) {
291 "Failed, this is a forward electron! The AsgElectronLikelihoodTool is "
292 "only suitable for central electrons!");
293 return m_rootTool->accept();
294 }
295
296 double et = 0.;
297 if (el->trackParticle() && !m_caloOnly) {
298 et = (cosh(el->trackParticle()->eta()) != 0.)
299 ? energy / cosh(el->trackParticle()->eta())
300 : 0.;
301 } else
302 et = (cosh(eta) != 0.) ? energy / cosh(eta) : 0.;
303
304 // number of track hits
305 uint8_t nSiHitsPlusDeadSensors(0);
307 bool passBLayerRequirement(false);
308 float d0(0.0);
309 float deltaEta = 0;
310 float deltaPhiRescaled2 = 0;
311 float wstot = 0;
312 float EoverP = 0;
313 uint8_t ambiguityBit(0);
314 double ip(0);
315
316 bool allFound = true;
317 std::string notFoundList = "";
318
319 // Wstot for use when CutWstotAtHighET vector is filled
320 if (!el->showerShapeValue(wstot, xAOD::EgammaParameters::wtots1)) {
321 allFound = false;
322 notFoundList += "wtots1 ";
323 }
324
325 // get the ambiguity type from the decoration
326 if (!m_rootTool->m_cutAmbiguity.empty()) {
327 static const SG::AuxElement::Accessor<uint8_t> ambiguityTypeAcc("ambiguityType");
328 if (ambiguityTypeAcc.isAvailable(*el)) {
329 ambiguityBit = ambiguityTypeAcc(*el);
330 } else {
331 allFound = false;
332 notFoundList += "ambiguityType ";
333 }
334 }
335
336 if (!m_caloOnly) {
337 // retrieve associated track
338 const xAOD::TrackParticle* t = el->trackParticle();
339 if (t) {
340 nSiHitsPlusDeadSensors =
345 d0 = t->d0();
346 EoverP = std::abs(t->qOverP()) * energy;
347 } else {
348 ATH_MSG_ERROR("Failed, no track particle. et= " << et << "eta= " << eta);
349 return m_rootTool->accept();
350 }
351
352 if (!el->trackCaloMatchValue(deltaEta, xAOD::EgammaParameters::deltaEta1)) {
353 allFound = false;
354 notFoundList += "deltaEta1 ";
355 }
356 // correction of deltaEta1 for pear shape distortion
357 else if (m_correctDeltaEta) {
358 const static SG::AuxElement::Accessor<float> acc(
359 "deltaEta1PearDistortion");
360 if (acc.isAvailable(*el)) {
361 deltaEta -= acc(*el);
362 } else {
363 allFound = false;
364 notFoundList += "deltaEta1PearDistortion ";
365 }
366 }
367
368 if (!el->trackCaloMatchValue(deltaPhiRescaled2,
370 allFound = false;
371 notFoundList += "deltaPhiRescaled2 ";
372 }
373
374 } // if not calo ONly
375
376 // Get the number of primary vertices,
377 // avg mu or FCal ET in this event,
378 // depending on user configuration
379 ip = getIpVariable(mu, ctx);
380
381 // for now don't cache.
382 double likelihood = calculate(ctx, el, ip);
383
384 if (!allFound) {
386 "Skipping LH rectangular cuts! The following variables are missing: "
387 << notFoundList);
388 return m_rootTool->accept();
389 }
390
391 // Get the answer from the underlying ROOT tool
392 return m_rootTool->accept(likelihood,
393 eta,
394 et,
395 nSiHitsPlusDeadSensors,
396 nPixHitsPlusDeadSensors,
397 passBLayerRequirement,
398 ambiguityBit,
399 d0,
400 deltaEta,
401 deltaPhiRescaled2,
402 wstot,
403 EoverP,
404 ip);
405}
bool m_correctDeltaEta
Flag to toggle the correction of deltaEta1 for the pear shape distortion of the LAr.
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
std::size_t numberOfPixelHitsAndDeadSensors(const xAOD::TrackParticle &tp)
return the number of Pixel hits plus dead sensors in the track particle
std::size_t numberOfSiliconHitsAndDeadSensors(const xAOD::TrackParticle &tp)
return the number of Silicon hits plus dead sensors in the track particle
@ deltaEta1
difference between the cluster eta (first sampling) and the eta of the track extrapolated to the firs...
TrackParticle_v1 TrackParticle
Reference the current persistent version:

◆ accept() [5/6]

asg::AcceptData AsgElectronLikelihoodTool::accept ( const EventContext & ctx,
const xAOD::IParticle * part ) const
finaloverridevirtual

Implements IAsgElectronLikelihoodTool.

Definition at line 875 of file AsgElectronLikelihoodTool.cxx.

877{
878 if (part->type() == xAOD::Type::Electron) {
879 const xAOD::Electron* el = static_cast<const xAOD::Electron*>(part);
880 return accept(ctx, el);
881 }
882 ATH_MSG_ERROR("Input is not an electron");
883 return m_rootTool->accept();
884}

◆ accept() [6/6]

asg::AcceptData AsgElectronLikelihoodTool::accept ( const xAOD::IParticle * part) const
finaloverridevirtual

The main accept method: using the generic interface.

Implements IAsgElectronLikelihoodTool.

Definition at line 868 of file AsgElectronLikelihoodTool.cxx.

869{
870 // Backwards compatibility
871 return accept(Gaudi::Hive::currentContext(), part);
872}

◆ calculate() [1/5]

virtual double AsgElectronLikelihoodTool::calculate ( const EventContext & ctx,
const xAOD::Egamma * eg ) const
inlinefinaloverridevirtual

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

Implements IAsgElectronLikelihoodTool.

Definition at line 102 of file AsgElectronLikelihoodTool.h.

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

◆ calculate() [2/5]

double AsgElectronLikelihoodTool::calculate ( const EventContext & ctx,
const xAOD::Egamma * eg,
double mu ) const
finaloverridevirtual

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

Implements IAsgElectronLikelihoodTool.

Definition at line 723 of file AsgElectronLikelihoodTool.cxx.

726{
727 if (!eg) {
728 ATH_MSG_ERROR("Failed, no egamma object.");
729 return -999;
730 }
731
732 if (!m_caloOnly) {
733 if (eg->type() == xAOD::Type::Electron) {
734 const xAOD::Electron* el = static_cast<const xAOD::Electron*>(eg);
735 return calculate(ctx, el);
736 }
737
738 ATH_MSG_ERROR("Input is not an electron and not Calo Only is required");
739 return -999;
740 }
741
742 const xAOD::CaloCluster* cluster = eg->caloCluster();
743 if (!cluster) {
744 ATH_MSG_ERROR("Failed, no cluster.");
745 return -999;
746 }
747
748 if (!cluster->hasSampling(CaloSampling::CaloSample::EMB2) &&
749 !cluster->hasSampling(CaloSampling::CaloSample::EME2)) {
750 ATH_MSG_ERROR("Failed, cluster is missing samplings EMB2 and EME2");
751 return -999;
752 }
753
754 const double energy = cluster->e();
755 const float eta = cluster->etaBE(2);
756
757 if (isForwardElectron(eg, eta)) {
759 "Failed, this is a forward electron! The AsgElectronLikelihoodTool is "
760 "only suitable for central electrons!");
761 return -999;
762 }
763
764 const double et = (cosh(eta) != 0.) ? energy / cosh(eta) : 0.;
765
766 // Track variables that the EFCaloLH will not use
767 float d0(0.0);
768 float d0sigma(0.0);
769 double dpOverp(0.0);
770
771 float deltaEta = 0;
772 float deltaPhiRescaled2 = 0;
773 float TRT_PID(0.0);
774
775 // Calo Variables
776 float Reta(0);
777 float Rphi(0);
778 float Rhad1(0);
779 float Rhad(0);
780 float w2(0);
781 float f1(0);
782 float Eratio(0);
783 float f3(0);
784
785 bool allFound = true;
786 std::string notFoundList = "";
787
788 // reta = e237/e277
789 if (!eg->showerShapeValue(Reta, xAOD::EgammaParameters::Reta)) {
790 allFound = false;
791 notFoundList += "Reta ";
792 }
793 // rphi e233/e237
794 if (!eg->showerShapeValue(Rphi, xAOD::EgammaParameters::Rphi)) {
795 allFound = false;
796 notFoundList += "Rphi ";
797 }
798 // rhad1 = ethad1/et
799 if (!eg->showerShapeValue(Rhad1, xAOD::EgammaParameters::Rhad1)) {
800 allFound = false;
801 notFoundList += "Rhad1 ";
802 }
803 // rhad = ethad/et
804 if (!eg->showerShapeValue(Rhad, xAOD::EgammaParameters::Rhad)) {
805 allFound = false;
806 notFoundList += "Rhad ";
807 }
808 // shower width in 2nd sampling
809 if (!eg->showerShapeValue(w2, xAOD::EgammaParameters::weta2)) {
810 allFound = false;
811 notFoundList += "weta2 ";
812 }
813 // fraction of energy reconstructed in the 1st sampling
814 if (!eg->showerShapeValue(f1, xAOD::EgammaParameters::f1)) {
815 allFound = false;
816 notFoundList += "f1 ";
817 }
818 // E of 2nd max between max and min in strips
819 if (!eg->showerShapeValue(Eratio, xAOD::EgammaParameters::Eratio)) {
820 allFound = false;
821 notFoundList += "Eratio ";
822 }
823 // fraction of energy reconstructed in the 3rd sampling
824 if (!eg->showerShapeValue(f3, xAOD::EgammaParameters::f3)) {
825 allFound = false;
826 notFoundList += "f3 ";
827 }
828
829 // Get the pileup or centrality information
830 double ip = getIpVariable(mu, ctx);
831
832 if (!allFound) {
834 "Skipping LH calculation! The following variables are missing: "
835 << notFoundList);
836 return -999;
837 }
838
839 // Get the answer from the underlying ROOT tool
840 return m_rootTool->calculate(eta,
841 et,
842 f3,
843 Rhad,
844 Rhad1,
845 Reta,
846 w2,
847 f1,
848 Eratio,
849 deltaEta,
850 d0,
851 d0sigma,
852 Rphi,
853 dpOverp,
854 deltaPhiRescaled2,
855 TRT_PID,
856 ip);
857}
@ f3
fraction of energy reconstructed in 3rd sampling
Definition EgammaEnums.h:55
@ f1
E1/E = fraction of energy reconstructed in the first sampling, where E1 is energy in all strips belon...
Definition EgammaEnums.h:53
@ Eratio
(emaxs1-e2tsts1)/(emaxs1+e2tsts1)
@ weta2
the lateral width is calculated with a window of 3x5 cells using the energy weighted sum over all cel...

◆ calculate() [3/5]

virtual double AsgElectronLikelihoodTool::calculate ( const EventContext & ctx,
const xAOD::Electron * eg ) const
inlinefinaloverridevirtual

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

Implements IAsgElectronLikelihoodTool.

Definition at line 94 of file AsgElectronLikelihoodTool.h.

96 {
97 return calculate(
98 ctx, eg, -99); // mu = -99 as input will force accept to grab the pileup
99 // variable from the xAOD object
100 }

◆ calculate() [4/5]

double AsgElectronLikelihoodTool::calculate ( const EventContext & ctx,
const xAOD::Electron * eg,
double mu ) const
finaloverridevirtual

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

Implements IAsgElectronLikelihoodTool.

Definition at line 502 of file AsgElectronLikelihoodTool.cxx.

505{
506 if (!el) {
507 ATH_MSG_ERROR("Failed, no egamma object.");
508 return -999;
509 }
510 const xAOD::CaloCluster* cluster = el->caloCluster();
511 if (!cluster) {
512 ATH_MSG_ERROR("Failed, no cluster.");
513 return -999;
514 }
515 if (!cluster->hasSampling(CaloSampling::CaloSample::EMB2) &&
516 !cluster->hasSampling(CaloSampling::CaloSample::EME2)) {
517 ATH_MSG_ERROR("Failed, cluster is missing samplings EMB2 and EME2");
518 return -999;
519 }
520
521 const double energy = cluster->e();
522 const float eta = cluster->etaBE(2);
523
524 if (isForwardElectron(el, eta)) {
526 "Failed, this is a forward electron! The AsgElectronLikelihoodTool is "
527 "only suitable for central electrons!");
528 return -999;
529 }
530
531 double et = 0.;
532 if (el->trackParticle() && !m_caloOnly) {
533 et = (cosh(el->trackParticle()->eta()) != 0.)
534 ? energy / cosh(el->trackParticle()->eta())
535 : 0.;
536 } else {
537 et = (cosh(eta) != 0.) ? energy / cosh(eta) : 0.;
538 }
539
540 // number of track hits and other track quantities
541 float trackqoverp(0.0);
542 float d0(0.0);
543 float d0sigma(0.0);
544 double dpOverp(0.0);
545 float TRT_PID(0.0);
546 double trans_TRT_PID(0.0);
547 float deltaEta = 0;
548 float deltaPhiRescaled2 = 0;
549
550 bool allFound = true;
551 std::string notFoundList = "";
552
553 if (!m_caloOnly) {
554 // retrieve associated TrackParticle
555 const xAOD::TrackParticle* t = el->trackParticle();
556 if (t) {
557 trackqoverp = t->qOverP();
558 d0 = t->d0();
559 float vard0 = t->definingParametersCovMatrix()(0, 0);
560 if (vard0 > 0) {
561 d0sigma = sqrtf(vard0);
562 }
563
564 const static SG::AuxElement::Accessor<float> trans_TRT_PID_acc("transformed_e_probability_ht");
565 if (!trans_TRT_PID_acc.isAvailable(*el)) {
566 // most probable case, need to compute the variable
567
568 if (!t->summaryValue(TRT_PID, xAOD::eProbabilityHT)) {
569 allFound = false;
570 notFoundList += "eProbabilityHT ";
571 }
572
573 // Transform the TRT PID output for use in the LH tool.
574 const double tau = 15.0;
575 const double fEpsilon = 1.0e-30; // to avoid zero division
576 double pid_tmp = TRT_PID;
577 if (pid_tmp >= 1.0)
578 pid_tmp = 1.0 - 1.0e-15; // this number comes from TMVA
579 else if (pid_tmp <= fEpsilon)
580 pid_tmp = fEpsilon;
581 trans_TRT_PID = -log(1.0 / pid_tmp - 1.0) * (1. / double(tau));
582 }
583 else
584 {
585 // it means the variable have been already computed by another tool
586 // usually this is the EGammaVariableCorrection, which means that
587 // it is also fudged (only MC)
588 trans_TRT_PID = trans_TRT_PID_acc(*el);
589 }
590
591 unsigned int index;
592 if (t->indexOfParameterAtPosition(index, xAOD::LastMeasurement)) {
593
594 double refittedTrack_LMqoverp =
595 t->charge() / sqrt(std::pow(t->parameterPX(index), 2) +
596 std::pow(t->parameterPY(index), 2) +
597 std::pow(t->parameterPZ(index), 2));
598
599 dpOverp = 1 - trackqoverp / (refittedTrack_LMqoverp);
600 } else if (!m_skipDeltaPoverP) {
601 allFound = false;
602 notFoundList += "deltaPoverP ";
603 }
604
605 } else {
606 ATH_MSG_ERROR("Failed, no track particle. et= " << et << "eta= " << eta);
607 return -999;
608 }
609 } // if not calo Only
610
611 float Reta(0);
612 float Rphi(0);
613 float Rhad1(0);
614 float Rhad(0);
615 float w2(0);
616 float f1(0);
617 float Eratio(0);
618 float f3(0);
619
620 // reta = e237/e277
621 if (!el->showerShapeValue(Reta, xAOD::EgammaParameters::Reta)) {
622 allFound = false;
623 notFoundList += "Reta ";
624 }
625 // rphi e233/e237
626 if (!el->showerShapeValue(Rphi, xAOD::EgammaParameters::Rphi)) {
627 allFound = false;
628 notFoundList += "Rphi ";
629 }
630 // rhad1 = ethad1/et
631 if (!el->showerShapeValue(Rhad1, xAOD::EgammaParameters::Rhad1)) {
632 allFound = false;
633 notFoundList += "Rhad1 ";
634 }
635 // rhad = ethad/et
636 if (!el->showerShapeValue(Rhad, xAOD::EgammaParameters::Rhad)) {
637 allFound = false;
638 notFoundList += "Rhad ";
639 }
640 // shower width in 2nd sampling
641 if (!el->showerShapeValue(w2, xAOD::EgammaParameters::weta2)) {
642 allFound = false;
643 notFoundList += "weta2 ";
644 }
645 // fraction of energy reconstructed in the 1st sampling
646 if (!el->showerShapeValue(f1, xAOD::EgammaParameters::f1)) {
647 allFound = false;
648 notFoundList += "f1 ";
649 }
650 // E of 2nd max between max and min in strips
651 if (!el->showerShapeValue(Eratio, xAOD::EgammaParameters::Eratio)) {
652 allFound = false;
653 notFoundList += "Eratio ";
654 }
655 // fraction of energy reconstructed in the 3rd sampling
656 if (!el->showerShapeValue(f3, xAOD::EgammaParameters::f3)) {
657 allFound = false;
658 notFoundList += "f3 ";
659 }
660
661 if (!m_caloOnly) {
662 // deltaEta1
663 if (!el->trackCaloMatchValue(deltaEta, xAOD::EgammaParameters::deltaEta1)) {
664 allFound = false;
665 notFoundList += "deltaEta1 ";
666 }
667 // correction of deltaEta1 for pear shape distortion
668 else if (m_correctDeltaEta) {
669 const static SG::AuxElement::Accessor<float> acc(
670 "deltaEta1PearDistortion");
671 if (acc.isAvailable(*el)) {
672 deltaEta -= acc(*el);
673 } else {
674 allFound = false;
675 notFoundList += "deltaEta1PearDistortion ";
676 }
677 }
678
679 // difference between the cluster phi (sampling 2) and the eta of the track
680 // extrapolated from the last measurement point.
681 if (!el->trackCaloMatchValue(deltaPhiRescaled2,
683 allFound = false;
684 notFoundList += "deltaPhiRescaled2 ";
685 }
686 }
687
688 // Get the number of primary vertices, avg mu or FCal ET in this event,
689 // depending on user configuration
690 double ip = static_cast<double>(m_nPVdefault);
691
692 ip = getIpVariable(mu, ctx);
693
694 if (!allFound) {
696 "Skipping LH calculation! The following variables are missing: "
697 << notFoundList);
698 return -999;
699 }
700
701 // Get the answer from the underlying ROOT tool
702 return m_rootTool->calculate(eta,
703 et,
704 f3,
705 Rhad,
706 Rhad1,
707 Reta,
708 w2,
709 f1,
710 Eratio,
711 deltaEta,
712 d0,
713 d0sigma,
714 Rphi,
715 dpOverp,
716 deltaPhiRescaled2,
717 trans_TRT_PID,
718 ip);
719}
unsigned int m_nPVdefault
defualt nPV (when not using PVCont)
bool m_skipDeltaPoverP
Flag for skip the use of deltaPoverP in LH computation (like at HLT)
str index
Definition DeMoScan.py:362
@ eProbabilityHT
Electron probability from High Threshold (HT) information [float].
@ LastMeasurement
Parameter defined at the position of the last measurement.

◆ calculate() [5/5]

double AsgElectronLikelihoodTool::calculate ( const EventContext & ctx,
const xAOD::IParticle * part ) const
finaloverridevirtual

calculate method: for pointer to IParticle

Implements IAsgElectronLikelihoodTool.

Definition at line 887 of file AsgElectronLikelihoodTool.cxx.

889{
890 if (part->type() == xAOD::Type::Electron) {
891 const xAOD::Electron* el = static_cast<const xAOD::Electron*>(part);
892 return calculate(ctx, el);
893 }
894
895 ATH_MSG_ERROR("Input is not an electron");
896 return -999;
897}

◆ calculateMultipleOutputs()

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

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

Implements IAsgElectronLikelihoodTool.

Definition at line 122 of file AsgElectronLikelihoodTool.h.

125 {
126 return {static_cast<float>(calculate(ctx, eg, mu))};
127 }

◆ 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 & AsgElectronLikelihoodTool::getAcceptInfo ( ) const
overridevirtual

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 258 of file AsgElectronLikelihoodTool.cxx.

259{
260 return m_rootTool->getAcceptInfo();
261}

◆ getAverageMu()

double AsgElectronLikelihoodTool::getAverageMu ( const EventContext & ctx) const
private

Get the average mu.

Definition at line 940 of file AsgElectronLikelihoodTool.cxx.

941{
942 SG::ReadDecorHandle<xAOD::EventInfo,float> eventInfoDecor(m_avgMuKey, ctx);
943 if(!eventInfoDecor.isPresent()) {
944 ATH_MSG_WARNING("Cannot find " << m_avgMuKey.key()
945 << ", returning 0");
946 }
947 return eventInfoDecor(0);
948}
SG::ReadDecorHandleKey< xAOD::EventInfo > m_avgMuKey
read handle key to averager mu

◆ getFcalEt()

double AsgElectronLikelihoodTool::getFcalEt ( const EventContext & ctx) const
private

Get the FCal ET for centrality determination (for HI collisions)

Definition at line 952 of file AsgElectronLikelihoodTool.cxx.

953{
954 static const SG::ConstAccessor<std::string> SummaryAcc ("Summary");
955 double fcalEt(0.);
956 SG::ReadHandle<xAOD::HIEventShapeContainer> HIESCont(m_HIESContKey, ctx);
957 xAOD::HIEventShapeContainer::const_iterator es_itr = HIESCont->begin();
958 xAOD::HIEventShapeContainer::const_iterator es_end = HIESCont->end();
959 for (; es_itr != es_end; ++es_itr) {
960 double et = (*es_itr)->et();
961 const std::string& name = SummaryAcc (**es_itr);
962 if (name == "FCal")
963 fcalEt = et * 1.e-6;
964 }
965 return fcalEt;
966}
SG::ReadHandleKey< xAOD::HIEventShapeContainer > m_HIESContKey
read handle key to heavy ion container
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838

◆ getIpVariable()

double AsgElectronLikelihoodTool::getIpVariable ( double mu,
const EventContext & ctx ) const
private

Get IP variable based on user configuration.

Definition at line 902 of file AsgElectronLikelihoodTool.cxx.

903{
904 if (mu < 0) { // determine variable if mu is negative (not given)
905 bool doCentralityTransform = m_rootTool->m_doCentralityTransform;
906 if (doCentralityTransform)
907 return static_cast<double>(m_useCaloSumsCont ? this->getFcalEt(ctx)
909 else if (m_useAverageMu)
910 return this->getAverageMu(ctx);
911 else
912 return static_cast<double>(m_usePVCont ? this->getNPrimVertices(ctx)
913 : m_nPVdefault);
914 }
915 return mu;
916}
double getAverageMu(const EventContext &ctx) const
Get the average mu.
unsigned int getNPrimVertices(const EventContext &ctx) const
Get the number of primary vertices.
bool m_usePVCont
Whether to use the PV (not available for trigger)
bool m_useCaloSumsCont
Whether or not to use the CaloSums container in HI events.
double m_fcalEtDefault
defualt FCal ET (when not using CaloSums container, in HI events)
double getFcalEt(const EventContext &ctx) const
Get the FCal ET for centrality determination (for HI collisions)

◆ 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 AsgElectronLikelihoodTool::getNPrimVertices ( const EventContext & ctx) const
private

Get the number of primary vertices.

Definition at line 921 of file AsgElectronLikelihoodTool.cxx.

922{
923 unsigned int nVtx(0);
924 SG::ReadHandle<xAOD::VertexContainer> vtxCont(m_primVtxContKey, ctx);
925 if (!vtxCont.isValid()) {
926 ATH_MSG_WARNING("Cannot find " << m_primVtxContKey.key()
927 << " container, returning default nVtx");
928 return m_nPVdefault;
929 }
930 for (const auto *vxcand : *vtxCont) {
931 if (vxcand->nTrackParticles() >= 2)
932 nVtx++;
933 }
934 return nVtx;
935}
SG::ReadHandleKey< xAOD::VertexContainer > m_primVtxContKey
read handle key to primary vertex container

◆ getOperatingPointName()

std::string AsgElectronLikelihoodTool::getOperatingPointName ( ) const
finaloverridevirtual

Get the name of the current operating point.

Implements IAsgElectronLikelihoodTool.

Definition at line 861 of file AsgElectronLikelihoodTool.cxx.

862{
863 return m_WorkingPoint;
864}
std::string m_WorkingPoint
Working 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 AsgElectronLikelihoodTool::initialize ( void )
overridevirtual

Gaudi Service Interface method implementations.

--------—Begin of text config-------------------------—

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

Reimplemented from asg::AsgTool.

Definition at line 80 of file AsgElectronLikelihoodTool.cxx.

81{
82 std::string configFile, PDFfilename, resolvedPDF; // Default
83
84 if (!m_WorkingPoint.empty()) {
87 }
88
89 if (!m_configFile.empty()) {
91 if (configFile.empty()) {
92 ATH_MSG_ERROR("Could not locate config " << m_configFile);
93 return StatusCode::FAILURE;
94 }
95
96 TEnv env;
97 if (env.ReadFile(configFile.c_str(), kEnvLocal)) {
98 ATH_MSG_ERROR("Could not open config " << configFile);
99 return StatusCode::FAILURE;
100 }
101
102 // Get the input PDFs for the tool.
103 // We need to see if the user had provided
104 // an override, if not needs to be in the input
105 // config file
106 if (!m_pdfFileName.empty()) {
107 // If the property was set by the user, take that.
108 ATH_MSG_INFO("Setting user specified PDF file " << m_pdfFileName);
109 PDFfilename = m_pdfFileName;
110 } else {
111 if (!env.Defined("inputPDFFileName")) {
112 ATH_MSG_WARNING("will use default PDF filename "
113 "since none is specified in the config "
114 << m_configFile);
115 }
116 PDFfilename = env.GetValue(
117 "inputPDFFileName",
118 "ElectronPhotonSelectorTools/v1/ElectronLikelihoodPdfs.root");
119 if (PDFfilename.empty()) {
120 ATH_MSG_ERROR("empty inputPDFFilename in " << configFile);
121 return StatusCode::FAILURE;
122 }
123 if (m_configFile.find("dev/") != std::string::npos) {
124 PDFfilename.insert(0, "dev/");
125 }
126 }
127
128 resolvedPDF = PathResolverFindCalibFile(PDFfilename);
129 if (!resolvedPDF.empty()) {
130 m_rootTool->setPDFFileName(resolvedPDF);
131 } else {
132 ATH_MSG_ERROR("Couldn't resolve PDF filename from "
133 << PDFfilename << ", config file = " << configFile);
134 return StatusCode::FAILURE;
135 }
136
138 // The following are all taken from the config
139 // file
140 m_rootTool->m_variableNames = env.GetValue("VariableNames", "");
141 m_rootTool->m_cutLikelihood =
142 AsgConfigHelper::HelperDouble("CutLikelihood", env);
143 m_rootTool->m_cutLikelihoodPileupCorrection =
144 AsgConfigHelper::HelperDouble("CutLikelihoodPileupCorrection", env);
145 m_rootTool->m_cutLikelihood4GeV =
146 AsgConfigHelper::HelperDouble("CutLikelihood4GeV", env);
147 m_rootTool->m_cutLikelihoodPileupCorrection4GeV =
148 AsgConfigHelper::HelperDouble("CutLikelihoodPileupCorrection4GeV", env);
149 // do the ambiguity cut
150 m_rootTool->m_cutAmbiguity =
151 AsgConfigHelper::HelperInt("CutAmbiguity", env);
152 // cut on b-layer
153 m_rootTool->m_cutBL = AsgConfigHelper::HelperInt("CutBL", env);
154 // cut on pixel hits
155 m_rootTool->m_cutPi = AsgConfigHelper::HelperInt("CutPi", env);
156 // cut on precision hits
157 m_rootTool->m_cutSi = AsgConfigHelper::HelperInt("CutSi", env);
158 // cut on d0
159 m_rootTool->m_cutA0 = AsgConfigHelper::HelperDouble("CutA0", env);
160 // cut on deltaEta
161 m_rootTool->m_cutDeltaEta =
162 AsgConfigHelper::HelperDouble("CutDeltaEta", env);
163 // cut on deltaPhiRes
164 m_rootTool->m_cutDeltaPhiRes =
165 AsgConfigHelper::HelperDouble("CutDeltaPhiRes", env);
166 // turn off f3 at high Et
167 m_rootTool->m_doRemoveF3AtHighEt =
168 env.GetValue("doRemoveF3AtHighEt", false);
169 // turn off TRTPID at high Et
170 m_rootTool->m_doRemoveTRTPIDAtHighEt =
171 env.GetValue("doRemoveTRTPIDAtHighEt", false);
172 // do smooth interpolation between bins
173 m_rootTool->m_doSmoothBinInterpolation =
174 env.GetValue("doSmoothBinInterpolation", false);
175 m_caloOnly = env.GetValue("caloOnly", false);
176
177 m_rootTool->m_useOneExtraHighETLHBin =
178 env.GetValue("useOneExtraHighETLHBin", false);
179 // cut on Wstot above HighETBinThreshold
180 m_rootTool->m_cutWstotAtHighET =
181 AsgConfigHelper::HelperDouble("CutWstotAtHighET", env);
182 // cut on EoverP above HighETBinThreshold
183 m_rootTool->m_cutEoverPAtHighET =
184 AsgConfigHelper::HelperDouble("CutEoverPAtHighET", env);
185 m_rootTool->m_highETBinThreshold = env.GetValue("HighETBinThreshold", 125);
186
187 m_rootTool->m_doPileupTransform = env.GetValue("doPileupTransform", false);
188 m_rootTool->m_doCentralityTransform =
189 env.GetValue("doCentralityTransform", false);
190 m_rootTool->m_discHardCutForPileupTransform =
191 AsgConfigHelper::HelperDouble("DiscHardCutForPileupTransform", env);
192 m_rootTool->m_discHardCutSlopeForPileupTransform =
193 AsgConfigHelper::HelperDouble("DiscHardCutSlopeForPileupTransform", env);
194 m_rootTool->m_discHardCutQuadForPileupTransform =
195 AsgConfigHelper::HelperDouble("DiscHardCutQuadForPileupTransform", env);
196 m_rootTool->m_discLooseForPileupTransform =
197 AsgConfigHelper::HelperDouble("DiscLooseForPileupTransform", env);
198 m_rootTool->m_discHardCutForPileupTransform4GeV =
199 AsgConfigHelper::HelperDouble("DiscHardCutForPileupTransform4GeV", env);
200 m_rootTool->m_discHardCutSlopeForPileupTransform4GeV =
201 AsgConfigHelper::HelperDouble("DiscHardCutSlopeForPileupTransform4GeV",
202 env);
203 m_rootTool->m_discHardCutQuadForPileupTransform4GeV =
204 AsgConfigHelper::HelperDouble("DiscHardCutQuadForPileupTransform4GeV",
205 env);
206 m_rootTool->m_discLooseForPileupTransform4GeV =
207 AsgConfigHelper::HelperDouble("DiscLooseForPileupTransform4GeV", env);
208 m_rootTool->m_discMaxForPileupTransform =
209 env.GetValue("DiscMaxForPileupTransform", 2.0);
210 m_rootTool->m_pileupMaxForPileupTransform =
211 env.GetValue("PileupMaxForPileupTransform", 50);
212 // if true, deltaEta1 will be corrected for the pear shape distortion of the
213 // LAr
214 m_correctDeltaEta = env.GetValue("doCorrectDeltaEta", false);
215
216 if (m_rootTool->m_doCentralityTransform && m_useAverageMu) {
217 ATH_MSG_ERROR("Cannot use centrality transform and average mu "
218 << "at the same time as they affect the same variable");
219 return StatusCode::FAILURE;
220 }
221 } else { // Error if it cant find the conf
222 ATH_MSG_ERROR("Could not find configuration file");
223 return StatusCode::FAILURE;
224 }
225
227
228 // Setup primary vertex key handle
230 // Setup average mu key handle
232
233 // Setup HI container key handle (must come after init from env)
234 bool doCentralityTransform = m_rootTool->m_doCentralityTransform;
235 ATH_CHECK(
236 m_HIESContKey.initialize(doCentralityTransform && m_useCaloSumsCont));
237
238 // Get the message level and set the underlying ROOT tool message level
239 // accordingly
240 m_rootTool->msg().setLevel(this->msg().level());
241
242 // We need to initialize the underlying ROOT TSelectorTool
243 if (m_rootTool->initialize().isFailure()) {
244 ATH_MSG_ERROR("Could not initialize the TElectronLikelihoodTool! "
245 "Configuration details: "
246 << "working point = \"" << m_WorkingPoint
247 << "\", config file = \"" << m_configFile
248 << "\", resolved file = \"" << configFile
249 << "\", PDF file = \"" << PDFfilename
250 << "\", resolved file = \"" << resolvedPDF);
251 return StatusCode::FAILURE;
252 }
253 return StatusCode::SUCCESS;
254}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
std::string m_pdfFileName
The input ROOT file name that holds the PDFs.
std::vector< int > HelperInt(const std::string &input, TEnv &env)
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 > LHPointToConfFile
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.

◆ isForwardElectron()

bool AsgElectronLikelihoodTool::isForwardElectron ( const xAOD::Egamma * eg,
const float eta ) const
private

check for FwdElectron

Definition at line 969 of file AsgElectronLikelihoodTool.cxx.

971{
972
973 static const SG::AuxElement::ConstAccessor<uint16_t> accAuthor("author");
974
975 if (accAuthor.isAvailable(*eg)) {
976
977 // cannot just do eg->author() because it isn't always filled
978 // at trigger level
979 if (accAuthor(*eg) == xAOD::EgammaParameters::AuthorFwdElectron) {
981 "Failed, this is a forward electron! The AsgElectronLikelihoodTool is "
982 "only suitable for central electrons!");
983 return true;
984 }
985 } else {
986 // Check for fwd via eta range the old logic
987 if (std::abs(eta) > 2.5) {
988 ATH_MSG_WARNING("Failed, cluster->etaBE(2) range due to "
989 << eta << " seems like a fwd electron");
990 return true;
991 }
992 }
993
994 return false;
995}
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:569
const uint16_t AuthorFwdElectron
Electron reconstructed by the Forward cluster-based algorithm.
Definition EgammaDefs.h:30

◆ 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

◆ ~AsgElectronLikelihoodTool()

AsgElectronLikelihoodTool::~AsgElectronLikelihoodTool ( )
privatevirtual

Standard constructor.

Standard destructor

Definition at line 74 of file AsgElectronLikelihoodTool.cxx.

75{
76 delete m_rootTool;
77}

Member Data Documentation

◆ m_avgMuKey

SG::ReadDecorHandleKey<xAOD::EventInfo> AsgElectronLikelihoodTool::m_avgMuKey
private
Initial value:
{
this, "averageInteractionsPerCrossingKey",
"EventInfo.averageInteractionsPerCrossing",
"Decoration for Average Interaction Per Crossing"
}

read handle key to averager mu

Definition at line 204 of file AsgElectronLikelihoodTool.h.

204 {
205 this, "averageInteractionsPerCrossingKey",
206 "EventInfo.averageInteractionsPerCrossing",
207 "Decoration for Average Interaction Per Crossing"
208 };

◆ m_caloOnly

bool AsgElectronLikelihoodTool::m_caloOnly = false
private

Flag for calo only LH.

Definition at line 176 of file AsgElectronLikelihoodTool.h.

◆ m_configFile

std::string AsgElectronLikelihoodTool::m_configFile
private

Definition at line 155 of file AsgElectronLikelihoodTool.h.

◆ m_correctDeltaEta

bool AsgElectronLikelihoodTool::m_correctDeltaEta = false
private

Flag to toggle the correction of deltaEta1 for the pear shape distortion of the LAr.

Definition at line 182 of file AsgElectronLikelihoodTool.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_fcalEtDefault

double AsgElectronLikelihoodTool::m_fcalEtDefault
private

defualt FCal ET (when not using CaloSums container, in HI events)

Definition at line 170 of file AsgElectronLikelihoodTool.h.

◆ m_HIESContKey

SG::ReadHandleKey<xAOD::HIEventShapeContainer> AsgElectronLikelihoodTool::m_HIESContKey
private
Initial value:
{
this,
"CaloSumsContainer",
"CaloSums",
"The CaloSums container name"
}

read handle key to heavy ion container

Definition at line 188 of file AsgElectronLikelihoodTool.h.

188 {
189 this,
190 "CaloSumsContainer",
191 "CaloSums",
192 "The CaloSums container name"
193 };

◆ m_nPVdefault

unsigned int AsgElectronLikelihoodTool::m_nPVdefault
private

defualt nPV (when not using PVCont)

Definition at line 164 of file AsgElectronLikelihoodTool.h.

◆ m_pdfFileName

std::string AsgElectronLikelihoodTool::m_pdfFileName
private

The input ROOT file name that holds the PDFs.

Definition at line 173 of file AsgElectronLikelihoodTool.h.

◆ m_primVtxContKey

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

read handle key to primary vertex container

Definition at line 196 of file AsgElectronLikelihoodTool.h.

196 {
197 this,
198 "primaryVertexContainer",
199 "PrimaryVertices",
200 "The primary vertex container name"
201 };

◆ m_rootTool

Root::TElectronLikelihoodTool* AsgElectronLikelihoodTool::m_rootTool
private

Pointer to the underlying ROOT based tool.

Definition at line 158 of file AsgElectronLikelihoodTool.h.

◆ m_skipDeltaPoverP

bool AsgElectronLikelihoodTool::m_skipDeltaPoverP
private

Flag for skip the use of deltaPoverP in LH computation (like at HLT)

Definition at line 179 of file AsgElectronLikelihoodTool.h.

◆ m_useAverageMu

bool AsgElectronLikelihoodTool::m_useAverageMu = false
private

Definition at line 185 of file AsgElectronLikelihoodTool.h.

◆ m_useCaloSumsCont

bool AsgElectronLikelihoodTool::m_useCaloSumsCont
private

Whether or not to use the CaloSums container in HI events.

Definition at line 167 of file AsgElectronLikelihoodTool.h.

◆ m_usePVCont

bool AsgElectronLikelihoodTool::m_usePVCont
private

Whether to use the PV (not available for trigger)

Definition at line 161 of file AsgElectronLikelihoodTool.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 AsgElectronLikelihoodTool::m_WorkingPoint
private

Working Point.

Definition at line 152 of file AsgElectronLikelihoodTool.h.


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