ATLAS Offline Software
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
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
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Protected Attributes

std::string m_isoDecSuffix {}
 

Private Member Functions

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

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::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

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  }

◆ 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 43 of file IsolationConditionFormula.cxx.

43  {
44  const float cutVal = m_cutFunction->Eval(x.pt);
45  if (!m_invertCut) return x.isolationValues.at(type()) <= cutVal;
46  return x.isolationValues.at(type()) > cutVal;
47  }

◆ 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  ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<"Accessor "<<SG::AuxTypeRegistry::instance().getName(acc.auxid())
34  <<" is not available. Expected when using primary AODs, post-p3793 derivations (only for *FixedRad or FixedCutPflow* for electrons), "
35  <<" pre-p3517 derivations (only for FC*), or pre-p3830 derivations (for other electron WPs)");
36  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'. ");
37  return false;
38  }
39  if (!m_invertCut) return acc(x) <= cutVal;
40  return acc(x) > cutVal;
41  }

◆ accessor()

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

Definition at line 38 of file IsolationCondition.cxx.

38 { return m_acc.at(n); }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

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

◆ msg() [1/2]

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

The standard message stream.

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

Definition at line 49 of file AsgMessaging.cxx.

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

◆ msg() [2/2]

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

The standard message stream.

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

Definition at line 57 of file AsgMessaging.cxx.

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

◆ msgLvl()

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

Test the output level of the object.

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

Definition at line 41 of file AsgMessaging.cxx.

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

◆ name()

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

Definition at line 36 of file IsolationCondition.cxx.

36 { return m_name; }

◆ num_types()

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

Definition at line 35 of file IsolationCondition.cxx.

35 { return m_isolationType.size(); }

◆ 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 37 of file IsolationCondition.cxx.

37 { return m_isolationType[n]; }

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 53 of file IsolationCondition.h.

◆ m_cutFunction

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

Definition at line 28 of file IsolationConditionFormula.h.

◆ m_imsg

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

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_invertCut

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

Definition at line 29 of file IsolationConditionFormula.h.

◆ m_isoDecSuffix

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

Definition at line 56 of file IsolationCondition.h.

◆ m_isolationType

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

Definition at line 52 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.

◆ 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 51 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:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
SG::AuxTypeRegistry::instance
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Definition: AuxTypeRegistry.cxx:640
CP::IsolationCondition::type
xAOD::Iso::IsolationType type(unsigned int n=0) const
Definition: IsolationCondition.cxx:37
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
x
#define x
CP::IsolationConditionFormula::m_cutFunction
std::shared_ptr< TF1 > m_cutFunction
Definition: IsolationConditionFormula.h:28
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
dumpTruth.getName
getName
Definition: dumpTruth.py:34
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
beamspotman.n
n
Definition: beamspotman.py:731
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
CP::IsolationCondition::IsolationCondition
IsolationCondition(const std::string &name, xAOD::Iso::IsolationType isoType, const std::string &isoDecSuffix="")
Definition: IsolationCondition.cxx:30
CP::IsolationCondition::name
const std::string & name() const
Definition: IsolationCondition.cxx:36
CP::IsolationCondition::accessor
const FloatAccessor & accessor(unsigned int n=0) const
Definition: IsolationCondition.cxx:38
CP::IsolationCondition::m_acc
std::vector< FloatAccessor > m_acc
Definition: IsolationCondition.h:53
CP::IsolationCondition::m_name
std::string m_name
Definition: IsolationCondition.h:51
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
CP::IsolationCondition::m_isolationType
std::vector< xAOD::Iso::IsolationType > m_isolationType
Definition: IsolationCondition.h:52
CP::IsolationCondition::m_isoDecSuffix
std::string m_isoDecSuffix
Definition: IsolationCondition.h:56
CP::FloatAccessor
SG::AuxElement::ConstAccessor< float > FloatAccessor
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:21
CP::IsolationConditionFormula::m_invertCut
bool m_invertCut
Definition: IsolationConditionFormula.h:29
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7