ATLAS Offline Software
Loading...
Searching...
No Matches
CP::IsolationConditionFormula Class Reference

#include <IsolationConditionFormula.h>

Inheritance diagram for CP::IsolationConditionFormula:
Collaboration diagram for CP::IsolationConditionFormula:

Public Member Functions

 IsolationConditionFormula (const std::string &name, xAOD::Iso::IsolationType isoType, const std::string &cutFunction, bool invertCut=false, const std::string &isoDecSuffix="")
 IsolationConditionFormula (const std::string &name, const std::string &isoType, const std::string &cutFunction, bool invertCut=false, const std::string &isoDecSuffix="")
virtual ~IsolationConditionFormula ()=default
virtual bool accept (const xAOD::IParticle &x) const override
virtual bool accept (const strObj &x) const override
const std::string & name () const
unsigned int num_types () const
xAOD::Iso::IsolationType type (unsigned int n=0) const
const FloatAccessoraccessor (unsigned int n=0) const
const FloatAccessoraccessor_noCloseBy (unsigned int n=0) const
void setLevel (MSG::Level lvl)
 Change the current logging level.
Functions providing the same interface as AthMessaging
bool msgLvl (const MSG::Level lvl) const
 Test the output level of the object.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.

Protected Attributes

std::string m_isoDecSuffix {}

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

std::shared_ptr< TF1 > m_cutFunction {nullptr}
bool m_invertCut {false}
std::string m_name
std::vector< xAOD::Iso::IsolationTypem_isolationType
std::vector< FloatAccessorm_acc
std::vector< FloatAccessorm_acc_noCloseBy
std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels)
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging)

Detailed Description

Definition at line 17 of file IsolationConditionFormula.h.

Constructor & Destructor Documentation

◆ IsolationConditionFormula() [1/2]

CP::IsolationConditionFormula::IsolationConditionFormula ( const std::string & name,
xAOD::Iso::IsolationType isoType,
const std::string & cutFunction,
bool invertCut = false,
const std::string & isoDecSuffix = "" )

Definition at line 15 of file IsolationConditionFormula.cxx.

16 :
17 IsolationCondition(name, isoType, isoDecSuffix),
18 m_cutFunction (std::make_unique<TF1>(cutFunction.c_str(), cutFunction.c_str())),
19 m_invertCut (invertCut)
20 {
21 }
IsolationCondition(const std::string &name, xAOD::Iso::IsolationType isoType, const std::string &isoDecSuffix="")
const std::string & name() const

◆ IsolationConditionFormula() [2/2]

CP::IsolationConditionFormula::IsolationConditionFormula ( const std::string & name,
const std::string & isoType,
const std::string & cutFunction,
bool invertCut = false,
const std::string & isoDecSuffix = "" )

Definition at line 22 of file IsolationConditionFormula.cxx.

23 :
24 IsolationCondition(name, isoType, isoDecSuffix),
25 m_cutFunction (std::make_unique<TF1>(cutFunction.c_str(), cutFunction.c_str())),
26 m_invertCut (invertCut)
27 {
28 }

◆ ~IsolationConditionFormula()

virtual CP::IsolationConditionFormula::~IsolationConditionFormula ( )
virtualdefault

Member Function Documentation

◆ accept() [1/2]

bool CP::IsolationConditionFormula::accept ( const strObj & x) const
overridevirtual

Implements CP::IsolationCondition.

Definition at line 52 of file IsolationConditionFormula.cxx.

52 {
53 const float cutVal = m_cutFunction->Eval(x.pt);
54 if (!m_invertCut) return x.isolationValues.at(type()) <= cutVal;
55 return x.isolationValues.at(type()) > cutVal;
56 }
#define x
xAOD::Iso::IsolationType type(unsigned int n=0) const

◆ accept() [2/2]

bool CP::IsolationConditionFormula::accept ( const xAOD::IParticle & x) const
overridevirtual

Implements CP::IsolationCondition.

Definition at line 29 of file IsolationConditionFormula.cxx.

29 {
30 const float cutVal = m_cutFunction->Eval(x.pt());
31 const FloatAccessor& acc = accessor();
32 if (!acc.isAvailable(x)) {
33 // Temporary fix for missing closeByCorr variables if no primary vertex exists for the event
34 // If closeByCorr variable does not exist, fallback to the standard isolation variable 2025/02
35 const FloatAccessor& acc_noCloseBy = accessor_noCloseBy();
36 if (acc_noCloseBy.isAvailable(x)) {
37 if (!m_invertCut) return acc_noCloseBy(x) <= cutVal;
38 return acc_noCloseBy(x) > cutVal;
39 }
40 else {
41 ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<"Accessor "<<SG::AuxTypeRegistry::instance().getName(acc.auxid())
42 <<" is not available. Expected when using primary AODs, post-p3793 derivations (only for *FixedRad or FixedCutPflow* for electrons), "
43 <<" pre-p3517 derivations (only for FC*), or pre-p3830 derivations (for other electron WPs)");
44 if (!m_isoDecSuffix.empty()) throw std::runtime_error ("IsolationConditionCombined: IsolationSelectionTool property 'IsoDecSuffix' is set to " + m_isoDecSuffix + ". Must run on derivation made with IsolationCloseByCorrection to create the isolation variables with this suffix, or remove 'IsoDecSuffix'. ");
45 return false;
46 }
47 }
48 if (!m_invertCut) return acc(x) <= cutVal;
49 return acc(x) > cutVal;
50 }
#define ATH_MSG_WARNING(x)
const FloatAccessor & accessor_noCloseBy(unsigned int n=0) const
const FloatAccessor & accessor(unsigned int n=0) const
static AuxTypeRegistry & instance()
Return the singleton registry instance.
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.

◆ accessor()

const SG::AuxElement::ConstAccessor< float > & CP::IsolationCondition::accessor ( unsigned int n = 0) const
inherited

Definition at line 44 of file IsolationCondition.cxx.

44{ return m_acc.at(n); }
std::vector< FloatAccessor > m_acc

◆ accessor_noCloseBy()

const SG::AuxElement::ConstAccessor< float > & CP::IsolationCondition::accessor_noCloseBy ( unsigned int n = 0) const
inherited

Definition at line 45 of file IsolationCondition.cxx.

45{ return m_acc_noCloseBy.at(n); }
std::vector< FloatAccessor > m_acc_noCloseBy

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40{
42 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ msg() [1/2]

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

The standard message stream.

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

Definition at line 49 of file AsgMessaging.cxx.

49 {
50#ifndef XAOD_STANDALONE
51 return ::AthMessaging::msg();
52#else // not XAOD_STANDALONE
53 return m_msg;
54#endif // not XAOD_STANDALONE
55 }

◆ msg() [2/2]

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

The standard message stream.

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

Definition at line 57 of file AsgMessaging.cxx.

57 {
58#ifndef XAOD_STANDALONE
59 return ::AthMessaging::msg( lvl );
60#else // not XAOD_STANDALONE
61 m_msg << lvl;
62 return m_msg;
63#endif // not XAOD_STANDALONE
64 }

◆ msgLvl()

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

Test the output level of the object.

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

Definition at line 41 of file AsgMessaging.cxx.

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

◆ name()

const std::string & CP::IsolationCondition::name ( ) const
inherited

Definition at line 42 of file IsolationCondition.cxx.

42{ return m_name; }

◆ num_types()

unsigned int CP::IsolationCondition::num_types ( ) const
inherited

Definition at line 41 of file IsolationCondition.cxx.

41{ return m_isolationType.size(); }
std::vector< xAOD::Iso::IsolationType > m_isolationType

◆ setLevel()

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

Change the current logging level.

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

Definition at line 28 of file AthMessaging.cxx.

29{
30 m_lvl = lvl;
31}

◆ type()

xAOD::Iso::IsolationType CP::IsolationCondition::type ( unsigned int n = 0) const
inherited

Definition at line 43 of file IsolationCondition.cxx.

Member Data Documentation

◆ ATLAS_THREAD_SAFE

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

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_acc

std::vector<FloatAccessor> CP::IsolationCondition::m_acc
privateinherited

Definition at line 54 of file IsolationCondition.h.

◆ m_acc_noCloseBy

std::vector<FloatAccessor> CP::IsolationCondition::m_acc_noCloseBy
privateinherited

Definition at line 55 of file IsolationCondition.h.

◆ m_cutFunction

std::shared_ptr<TF1> CP::IsolationConditionFormula::m_cutFunction {nullptr}
private

Definition at line 28 of file IsolationConditionFormula.h.

28{nullptr};

◆ m_imsg

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

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_invertCut

bool CP::IsolationConditionFormula::m_invertCut {false}
private

Definition at line 29 of file IsolationConditionFormula.h.

29{false};

◆ m_isoDecSuffix

std::string CP::IsolationCondition::m_isoDecSuffix {}
protectedinherited

Definition at line 58 of file IsolationCondition.h.

58{};

◆ m_isolationType

std::vector<xAOD::Iso::IsolationType> CP::IsolationCondition::m_isolationType
privateinherited

Definition at line 53 of file IsolationCondition.h.

◆ m_lvl

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

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_msg_tls

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

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

Definition at line 132 of file AthMessaging.h.

◆ m_name

std::string CP::IsolationCondition::m_name
privateinherited

Definition at line 52 of file IsolationCondition.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.


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