ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
egammaMVAFunctions::ConversionHelper Struct Reference

The ConversionHelper struct is stll used by egammaMVATree in PhysicsAnalysis but not the functions in the dictionaries above. More...

#include <egammaMVAFunctions.h>

Inheritance diagram for egammaMVAFunctions::ConversionHelper:
Collaboration diagram for egammaMVAFunctions::ConversionHelper:

Public Member Functions

 ConversionHelper (const xAOD::Photon *ph)
 
 ConversionHelper (const xAOD::Photon &ph)
 
float ph_Rconv () const
 
float ph_zconv () const
 
int ph_convtrk1nPixHits () const
 
int ph_convtrk2nPixHits () const
 
int ph_convtrk1nSCTHits () const
 
int ph_convtrk2nSCTHits () const
 
float ph_pt1conv () const
 
float ph_pt2conv () const
 
float ph_ptconv () const
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Member Functions

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

Private Attributes

const xAOD::Vertexm_vertex
 
const xAOD::TrackParticlem_tp0
 
const xAOD::TrackParticlem_tp1
 
float m_pt1conv
 
float m_pt2conv
 
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

The ConversionHelper struct is stll used by egammaMVATree in PhysicsAnalysis but not the functions in the dictionaries above.

We could deprecate them

Definition at line 324 of file egammaMVAFunctions.h.

Constructor & Destructor Documentation

◆ ConversionHelper() [1/2]

egammaMVAFunctions::ConversionHelper::ConversionHelper ( const xAOD::Photon ph)
inline

Definition at line 326 of file egammaMVAFunctions.h.

327  : asg::AsgMessaging("ConversionHelper"),
328  m_vertex(ph ? ph->vertex() : nullptr),
329  m_tp0(m_vertex ? m_vertex->trackParticle(0) : nullptr),
330  m_tp1(m_vertex ? m_vertex->trackParticle(1) : nullptr),
331  m_pt1conv(0.), m_pt2conv(0.)
332  {
333 
334  ATH_MSG_DEBUG("init conversion helper");
335  if (!m_vertex) return;
336 
337  static const SG::AuxElement::Accessor<float> accPt1("pt1");
338  static const SG::AuxElement::Accessor<float> accPt2("pt2");
339  if (accPt1.isAvailable(*m_vertex) && accPt2.isAvailable(*m_vertex))
340  {
341  m_pt1conv = accPt1(*m_vertex);
342  m_pt2conv = accPt2(*m_vertex);
343  }
344  else
345  {
346  ATH_MSG_WARNING("pt1/pt2 not available, will approximate from first measurements");
349  }
350  }

◆ ConversionHelper() [2/2]

egammaMVAFunctions::ConversionHelper::ConversionHelper ( const xAOD::Photon ph)
inline

Definition at line 352 of file egammaMVAFunctions.h.

353  : ConversionHelper(&ph) { } // delegating constr

Member Function Documentation

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 42 of file AthMessaging.cxx.

43 {
45  m_lvl = m_imsg ?
46  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
47  MSG::INFO;
48 }

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

◆ ph_convtrk1nPixHits()

int egammaMVAFunctions::ConversionHelper::ph_convtrk1nPixHits ( ) const
inline

Definition at line 357 of file egammaMVAFunctions.h.

357  {
358  if (!m_tp0) { return 0; }
359  uint8_t hits = 0;
361  else {
362  ATH_MSG_WARNING("cannot read xAOD::numberOfPixelHits");
363  return 0;
364  }
365  }

◆ ph_convtrk1nSCTHits()

int egammaMVAFunctions::ConversionHelper::ph_convtrk1nSCTHits ( ) const
inline

Definition at line 375 of file egammaMVAFunctions.h.

375  {
376  if (!m_tp0) { return 0; }
377  uint8_t hits;
378  if (m_tp0->summaryValue(hits, xAOD::numberOfSCTHits)) { return hits; }
379  else {
380  ATH_MSG_WARNING("cannot read xAOD::numberOfSCTHits");
381  return 0;
382  }
383  }

◆ ph_convtrk2nPixHits()

int egammaMVAFunctions::ConversionHelper::ph_convtrk2nPixHits ( ) const
inline

Definition at line 366 of file egammaMVAFunctions.h.

366  {
367  if (!m_tp1) return 0;
368  uint8_t hits;
370  else {
371  ATH_MSG_WARNING("cannot read xAOD::numberOfPixelHits");
372  return 0;
373  }
374  }

◆ ph_convtrk2nSCTHits()

int egammaMVAFunctions::ConversionHelper::ph_convtrk2nSCTHits ( ) const
inline

Definition at line 384 of file egammaMVAFunctions.h.

384  {
385  if (!m_tp1) { return 0; }
386  uint8_t hits;
387  if (m_tp1->summaryValue(hits, xAOD::numberOfSCTHits)) { return hits; }
388  else {
389  ATH_MSG_WARNING("cannot read xAOD::numberOfSCTHits");
390  return 0;
391  }
392  }

◆ ph_pt1conv()

float egammaMVAFunctions::ConversionHelper::ph_pt1conv ( ) const
inline

Definition at line 393 of file egammaMVAFunctions.h.

393 { return m_pt1conv; }

◆ ph_pt2conv()

float egammaMVAFunctions::ConversionHelper::ph_pt2conv ( ) const
inline

Definition at line 394 of file egammaMVAFunctions.h.

394 { return m_pt2conv; }

◆ ph_ptconv()

float egammaMVAFunctions::ConversionHelper::ph_ptconv ( ) const
inline

Definition at line 395 of file egammaMVAFunctions.h.

395  {
396  // TODO: evaluate if move to this new definition, by now keep the previous one
397  // to be consistent with the training
398  // return m_vertex ? xAOD::EgammaHelpers::momentumAtVertex(*m_vertex).perp() : 0.;
399  TLorentzVector sum;
400  if (m_tp0) sum += m_tp0->p4();
401  if (m_tp1) sum += m_tp1->p4();
402  return sum.Perp();
403  }

◆ ph_Rconv()

float egammaMVAFunctions::ConversionHelper::ph_Rconv ( ) const
inline

Definition at line 355 of file egammaMVAFunctions.h.

355 { return m_vertex ? hypot(m_vertex->position().x(), m_vertex->position().y()) : 0; }

◆ ph_zconv()

float egammaMVAFunctions::ConversionHelper::ph_zconv ( ) const
inline

Definition at line 356 of file egammaMVAFunctions.h.

356 { return m_vertex ? m_vertex->position().z() : 0.; }

◆ 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  // Ensure initMessaging was called to avoid that the user
31  // defined message level is being overwritten (ATEAM-1117).
32  if (!m_initialized.test_and_set()) initMessaging();
33  m_lvl = lvl;
34 }

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_imsg

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

MessageSvc pointer.

Definition at line 135 of file AthMessaging.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.

◆ m_pt1conv

float egammaMVAFunctions::ConversionHelper::m_pt1conv
private

Definition at line 408 of file egammaMVAFunctions.h.

◆ m_pt2conv

float egammaMVAFunctions::ConversionHelper::m_pt2conv
private

Definition at line 408 of file egammaMVAFunctions.h.

◆ m_tp0

const xAOD::TrackParticle* egammaMVAFunctions::ConversionHelper::m_tp0
private

Definition at line 406 of file egammaMVAFunctions.h.

◆ m_tp1

const xAOD::TrackParticle* egammaMVAFunctions::ConversionHelper::m_tp1
private

Definition at line 407 of file egammaMVAFunctions.h.

◆ m_vertex

const xAOD::Vertex* egammaMVAFunctions::ConversionHelper::m_vertex
private

Definition at line 405 of file egammaMVAFunctions.h.


The documentation for this struct was generated from the following file:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:553
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
xAOD::TrackParticle_v1::summaryValue
bool summaryValue(uint8_t &value, const SummaryType &information) const
Accessor for TrackSummary values.
Definition: TrackParticle_v1.cxx:666
xAOD::numberOfPixelHits
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
Definition: TrackingPrimitives.h:260
xAOD::Vertex_v1::position
const Amg::Vector3D & position() const
Returns the 3-pos.
egammaMVAFunctions::getPtAtFirstMeasurement
float getPtAtFirstMeasurement(const xAOD::TrackParticle *tp)
Definition: egammaMVAFunctions.h:221
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
egammaMVAFunctions::ConversionHelper::m_pt2conv
float m_pt2conv
Definition: egammaMVAFunctions.h:408
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
xAOD::TrackParticle_v1::p4
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
Definition: TrackParticle_v1.cxx:122
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
egammaMVAFunctions::ConversionHelper::ConversionHelper
ConversionHelper(const xAOD::Photon *ph)
Definition: egammaMVAFunctions.h:326
xAOD::Vertex_v1::trackParticle
const TrackParticle * trackParticle(size_t i) const
Get the pointer to a given track that was used in vertex reco.
Definition: Vertex_v1.cxx:249
egammaMVAFunctions::ConversionHelper::m_vertex
const xAOD::Vertex * m_vertex
Definition: egammaMVAFunctions.h:405
asg::AsgMessaging
Class mimicking the AthMessaging class from the offline software.
Definition: AsgMessaging.h:40
egammaMVAFunctions::ConversionHelper::m_tp0
const xAOD::TrackParticle * m_tp0
Definition: egammaMVAFunctions.h:406
egammaMVAFunctions::ConversionHelper::m_pt1conv
float m_pt1conv
Definition: egammaMVAFunctions.h:408
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.Constants.INFO
int INFO
Definition: Control/AthenaCommon/python/Constants.py:15
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
xAOD::numberOfSCTHits
@ numberOfSCTHits
number of hits in SCT [unit8_t].
Definition: TrackingPrimitives.h:269
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:42
egammaMVAFunctions::ConversionHelper::m_tp1
const xAOD::TrackParticle * m_tp1
Definition: egammaMVAFunctions.h:407
xAOD::Photon_v1::vertex
const xAOD::Vertex * vertex(size_t index=0) const
Pointer to the xAOD::Vertex/es that match the photon candidate.
Definition: Photon_v1.cxx:46
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7