ATLAS Offline Software
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
CP::IsolationConditionCombined Class Reference

#include <IsolationConditionCombined.h>

Inheritance diagram for CP::IsolationConditionCombined:
Collaboration diagram for CP::IsolationConditionCombined:

Public Member Functions

 IsolationConditionCombined (const std::string &name, const std::vector< xAOD::Iso::IsolationType > &isoType, std::unique_ptr< TF1 > isoFunction, const std::string &cutFunction, const std::string &isoDecSuffix="")
 
virtual ~IsolationConditionCombined ()=default
 
bool accept (const xAOD::IParticle &x) const override
 
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::unique_ptr< TF1 > m_cutFunction
 
std::unique_ptr< TF1 > m_isoFunction
 
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 13 of file IsolationConditionCombined.h.

Constructor & Destructor Documentation

◆ IsolationConditionCombined()

CP::IsolationConditionCombined::IsolationConditionCombined ( const std::string &  name,
const std::vector< xAOD::Iso::IsolationType > &  isoType,
std::unique_ptr< TF1 >  isoFunction,
const std::string &  cutFunction,
const std::string &  isoDecSuffix = "" 
)

Definition at line 15 of file IsolationConditionCombined.cxx.

16  :
17  IsolationCondition(name, isoType, isoDecSuffix),
18  m_cutFunction (std::make_unique<TF1>(cutFunction.c_str(), cutFunction.c_str())),
19  m_isoFunction (std::move(isoFunction))
20  {
21  }

◆ ~IsolationConditionCombined()

virtual CP::IsolationConditionCombined::~IsolationConditionCombined ( )
virtualdefault

Member Function Documentation

◆ accept() [1/2]

bool CP::IsolationConditionCombined::accept ( const strObj x) const
overridevirtual

Implements CP::IsolationCondition.

Definition at line 45 of file IsolationConditionCombined.cxx.

45  {
46  const float cutValue = m_cutFunction->Eval(x.pt);
47  std::vector<double> isoVars;
48  for (unsigned int itype = 0; itype < num_types(); ++itype) isoVars.push_back(x.isolationValues[type(itype)]);
49  TF1* f ATLAS_THREAD_SAFE = m_isoFunction.get(); // see comment above
50  const float isoValue = f->EvalPar(isoVars.data());
51  return isoValue <= cutValue;
52  }

◆ accept() [2/2]

bool CP::IsolationConditionCombined::accept ( const xAOD::IParticle x) const
overridevirtual

Implements CP::IsolationCondition.

Definition at line 22 of file IsolationConditionCombined.cxx.

22  {
23  const float cutValue = m_cutFunction->Eval(x.pt());
24  std::vector<double> isoVars(num_types(), 0);
25  for (unsigned int acc = 0; acc < num_types(); ++acc) {
26  const FloatAccessor& acc_ele = accessor(acc);
27 
28  if (!acc_ele.isAvailable(x)) {
29  ATH_MSG_WARNING(__FILE__<<":"<<__LINE__<<"Accessor "<<SG::AuxTypeRegistry::instance().getName(acc_ele.auxid())
30  <<" is not available. Expected when using primary AODs, post-p3793 derivations (only for *FixedRad or FixedCutPflow* for electrons), "
31  <<" pre-p3517 derivations (only for FC*), or pre-p3830 derivations (for other electron WPs)");
32  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'. ");
33  isoVars[acc] = FLT_MAX;
34  } else
35  isoVars[acc] = acc_ele(x);
36  }
37  // In general TF1::EvalPar is non-const/not thread-safe. But for the special
38  // case of using it as TFormula it can be considered const/safe. It would be safer
39  // to change the interface to not allow a generic TF1.
40  TF1* f ATLAS_THREAD_SAFE = m_isoFunction.get();
41  const float isoValue = f->EvalPar(isoVars.data());
42  return isoValue <= cutValue;
43  }

◆ 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::unique_ptr<TF1> CP::IsolationConditionCombined::m_cutFunction
private

Definition at line 23 of file IsolationConditionCombined.h.

◆ m_imsg

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

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_isoDecSuffix

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

Definition at line 56 of file IsolationCondition.h.

◆ m_isoFunction

std::unique_ptr<TF1> CP::IsolationConditionCombined::m_isoFunction
private

Definition at line 24 of file IsolationConditionCombined.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
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
CP::IsolationConditionCombined::m_isoFunction
std::unique_ptr< TF1 > m_isoFunction
Definition: IsolationConditionCombined.h:24
CP::IsolationCondition::num_types
unsigned int num_types() const
Definition: IsolationCondition.cxx:35
dumpTruth.getName
getName
Definition: dumpTruth.py:34
AthMessaging::ATLAS_THREAD_SAFE
std::atomic_flag m_initialized ATLAS_THREAD_SAFE
Messaging initialized (initMessaging)
Definition: AthMessaging.h:141
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
hist_file_dump.f
f
Definition: hist_file_dump.py:135
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::IsolationConditionCombined::m_cutFunction
std::unique_ptr< TF1 > m_cutFunction
Definition: IsolationConditionCombined.h:23
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7