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

#include <IsoVariableHelper.h>

Inheritance diagram for CP::IsoVariableHelper:
Collaboration diagram for CP::IsoVariableHelper:

Public Member Functions

CorrectionCode getOriginalIsolation (const xAOD::IParticle *particle, float &value) const
 
CorrectionCode getIsolation (const xAOD::IParticle *particle, float &value) const
 
CorrectionCode backupIsolation (const xAOD::IParticle *particle) const
 
CorrectionCode setIsolation (const xAOD::IParticle *P, float value) const
 
IsoType isotype () const
 
std::string name () const
 
 IsoVariableHelper (IsoType type, const std::string &backupPreFix, const std::string &isoDecSuffix="")
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Member Functions

CorrectionCode getIsolationFromOriginal (const xAOD::IParticle *particle, float &value) const
 
void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

IsoType m_isoType
 
bool m_BackupIso
 
CharDecorator m_dec_IsoIsBackup
 
CharAccessor m_acc_IsoIsBackup
 
FloatAccessor m_acc_iso_variable
 
FloatDecorator m_dec_iso_variable
 
FloatAccessor m_acc_iso_backup
 
FloatDecorator m_dec_iso_backup
 
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 20 of file IsoVariableHelper.h.

Constructor & Destructor Documentation

◆ IsoVariableHelper()

CP::IsoVariableHelper::IsoVariableHelper ( IsoType  type,
const std::string &  backupPreFix,
const std::string &  isoDecSuffix = "" 
)

Definition at line 13 of file IsoVariableHelper.cxx.

13  :
14  asg::AsgMessaging{"IsoVariableHelper_ "+ std::string(xAOD::Iso::toString(type))},
15  m_isoType(type),
16  m_BackupIso(!backupPreFix.empty()),
17  m_dec_IsoIsBackup("IsBackup_" + std::string(xAOD::Iso::toString(type)) + (backupPreFix.empty() ? "" : "_") + backupPreFix),
18  m_acc_IsoIsBackup("IsBackup_" + std::string(xAOD::Iso::toString(type)) + (backupPreFix.empty() ? "" : "_") + backupPreFix),
20  m_dec_iso_variable(xAOD::Iso::toString(type) + (isoDecSuffix.empty() ? "" : "_") + isoDecSuffix),
21  m_acc_iso_backup(std::string(xAOD::Iso::toString(type)) + (backupPreFix.empty() ? "" : "_") + backupPreFix),
22  m_dec_iso_backup(std::string(xAOD::Iso::toString(type)) + (backupPreFix.empty() ? "" : "_") + backupPreFix) {}

Member Function Documentation

◆ backupIsolation()

CorrectionCode CP::IsoVariableHelper::backupIsolation ( const xAOD::IParticle particle) const

Definition at line 63 of file IsoVariableHelper.cxx.

63  {
64  if (!particle) {
65  ATH_MSG_ERROR(__func__<<"() -- "<<__LINE__<<": no particle given");
66  return CorrectionCode::Error;
67  }
69  float Isovalue = 0;
70  if (getIsolation(particle, Isovalue) == CorrectionCode::Error) {
71  return CorrectionCode::Error;
72  }
73  m_dec_IsoIsBackup(*particle) = true;
74  m_dec_iso_backup(*particle) = Isovalue;
75  }
76  return CorrectionCode::Ok;
77  }

◆ getIsolation()

CorrectionCode CP::IsoVariableHelper::getIsolation ( const xAOD::IParticle particle,
float &  value 
) const

Definition at line 54 of file IsoVariableHelper.cxx.

54  {
56  ATH_MSG_ERROR(__func__<<"() -- "<<__LINE__<<": Failed to retrieve isolation "<<
58  return CorrectionCode::Error;
59  }
61  return CorrectionCode::Ok;
62  }

◆ getIsolationFromOriginal()

CorrectionCode CP::IsoVariableHelper::getIsolationFromOriginal ( const xAOD::IParticle particle,
float &  value 
) const
private

Definition at line 44 of file IsoVariableHelper.cxx.

44  {
45  const xAOD::IParticle* originalParticle = xAOD::getOriginalObject(*particle);
46  if (originalParticle && getIsolation(originalParticle, value) == CorrectionCode::Error)
47  return CorrectionCode::Error;
48  else if (!originalParticle) {
49  ATH_MSG_DEBUG(__func__<<"() -- "<<__LINE__<<": No orignal object was found");
50  return getIsolation(particle, value);
51  }
52  return CorrectionCode::Ok;
53  }

◆ getOriginalIsolation()

CorrectionCode CP::IsoVariableHelper::getOriginalIsolation ( const xAOD::IParticle particle,
float &  value 
) const

Definition at line 24 of file IsoVariableHelper.cxx.

24  {
25  if (!particle) {
26  ATH_MSG_ERROR(__func__<<"() -- "<<__LINE__<<": no particle given");
27  return CorrectionCode::Error;
28  }
29  if (!m_BackupIso) {
31  } else {
33  ATH_MSG_WARNING(__func__<<"() -- "<<__LINE__<<":"
34  <<" No isolation value was backuped thus far. "
35  <<"Did you call the BackupIsolation before for "
37  return CorrectionCode::Error;
38  } else {
40  }
41  }
42  return CorrectionCode::Ok;
43  }

◆ 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 }

◆ isotype()

IsoType CP::IsoVariableHelper::isotype ( ) const

Definition at line 90 of file IsoVariableHelper.cxx.

90 { return m_isoType; }

◆ 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()

std::string CP::IsoVariableHelper::name ( ) const

Definition at line 91 of file IsoVariableHelper.cxx.

91 { return std::string(xAOD::Iso::toCString(isotype())); }

◆ setIsolation()

CorrectionCode CP::IsoVariableHelper::setIsolation ( const xAOD::IParticle P,
float  value 
) const

Definition at line 78 of file IsoVariableHelper.cxx.

78  {
79  if (!particle) {
80  ATH_MSG_ERROR(__func__<<"() -- "<<__LINE__<<": no particle given");
81  return CorrectionCode::Error;
82  }
83  if (std::isnan(value) || std::isinf(value)) {
84  ATH_MSG_ERROR(__func__<<"() -- "<<__LINE__<<": the value is not a number");
85  return CorrectionCode::Error;
86  }
88  return CorrectionCode::Ok;
89  }

◆ 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 }

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_iso_backup

FloatAccessor CP::IsoVariableHelper::m_acc_iso_backup
private

Definition at line 42 of file IsoVariableHelper.h.

◆ m_acc_iso_variable

FloatAccessor CP::IsoVariableHelper::m_acc_iso_variable
private

Definition at line 39 of file IsoVariableHelper.h.

◆ m_acc_IsoIsBackup

CharAccessor CP::IsoVariableHelper::m_acc_IsoIsBackup
private

Definition at line 37 of file IsoVariableHelper.h.

◆ m_BackupIso

bool CP::IsoVariableHelper::m_BackupIso
private

Definition at line 35 of file IsoVariableHelper.h.

◆ m_dec_iso_backup

FloatDecorator CP::IsoVariableHelper::m_dec_iso_backup
private

Definition at line 43 of file IsoVariableHelper.h.

◆ m_dec_iso_variable

FloatDecorator CP::IsoVariableHelper::m_dec_iso_variable
private

Definition at line 40 of file IsoVariableHelper.h.

◆ m_dec_IsoIsBackup

CharDecorator CP::IsoVariableHelper::m_dec_IsoIsBackup
private

Definition at line 36 of file IsoVariableHelper.h.

◆ m_imsg

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

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_isoType

IsoType CP::IsoVariableHelper::m_isoType
private

Definition at line 34 of file IsoVariableHelper.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_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
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
SG::AuxTypeRegistry::instance
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Definition: AuxTypeRegistry.cxx:639
CP::IsoVariableHelper::m_BackupIso
bool m_BackupIso
Definition: IsoVariableHelper.h:35
xAOD::Iso::toString
std::string toString(const IsoType &iso)
Definition: IsolationHelpers.h:59
SG::ConstAccessor::auxid
SG::auxid_t auxid() const
Return the aux id for this variable.
athena.value
value
Definition: athena.py:124
CP::IsoVariableHelper::m_acc_iso_variable
FloatAccessor m_acc_iso_variable
Definition: IsoVariableHelper.h:39
CP::IsoVariableHelper::m_dec_iso_backup
FloatDecorator m_dec_iso_backup
Definition: IsoVariableHelper.h:43
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
dumpTruth.getName
getName
Definition: dumpTruth.py:34
CP::IsoVariableHelper::getIsolation
CorrectionCode getIsolation(const xAOD::IParticle *particle, float &value) const
Definition: IsoVariableHelper.cxx:54
CP::IsoVariableHelper::isotype
IsoType isotype() const
Definition: IsoVariableHelper.cxx:90
CP::CorrectionCode::Error
@ Error
Some error happened during the object correction.
Definition: CorrectionCode.h:36
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CP::IsoVariableHelper::m_dec_IsoIsBackup
CharDecorator m_dec_IsoIsBackup
Definition: IsoVariableHelper.h:36
CP::IsoVariableHelper::m_acc_IsoIsBackup
CharAccessor m_acc_IsoIsBackup
Definition: IsoVariableHelper.h:37
CP::IsoVariableHelper::m_dec_iso_variable
FloatDecorator m_dec_iso_variable
Definition: IsoVariableHelper.h:40
CP::IsoVariableHelper::getIsolationFromOriginal
CorrectionCode getIsolationFromOriginal(const xAOD::IParticle *particle, float &value) const
Definition: IsoVariableHelper.cxx:44
asg::AsgMessaging
Class mimicking the AthMessaging class from the offline software.
Definition: AsgMessaging.h:40
CP::CorrectionCode::Ok
@ Ok
The correction was done successfully.
Definition: CorrectionCode.h:38
CP::IsoVariableHelper::m_acc_iso_backup
FloatAccessor m_acc_iso_backup
Definition: IsoVariableHelper.h:42
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
xAOD::getOriginalObject
const IParticle * getOriginalObject(const IParticle &copy)
This function can be used to conveniently get a pointer back to the original object from which a copy...
Definition: IParticleHelpers.cxx:140
CP::IsoVariableHelper::m_isoType
IsoType m_isoType
Definition: IsoVariableHelper.h:34
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7