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 257 of file egammaMVAFunctions.h.

Constructor & Destructor Documentation

◆ ConversionHelper() [1/2]

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

Definition at line 259 of file egammaMVAFunctions.h.

260  : asg::AsgMessaging("ConversionHelper"),
261  m_vertex(ph ? ph->vertex() : nullptr),
262  m_tp0(m_vertex ? m_vertex->trackParticle(0) : nullptr),
263  m_tp1(m_vertex ? m_vertex->trackParticle(1) : nullptr),
264  m_pt1conv(0.), m_pt2conv(0.)
265  {
266 
267  ATH_MSG_DEBUG("init conversion helper");
268  if (!m_vertex) return;
269 
270  static const SG::AuxElement::Accessor<float> accPt1("pt1");
271  static const SG::AuxElement::Accessor<float> accPt2("pt2");
272  if (accPt1.isAvailable(*m_vertex) && accPt2.isAvailable(*m_vertex))
273  {
274  m_pt1conv = accPt1(*m_vertex);
275  m_pt2conv = accPt2(*m_vertex);
276  }
277  else
278  {
279  ATH_MSG_WARNING("pt1/pt2 not available, will approximate from first measurements");
282  }
283  }

◆ ConversionHelper() [2/2]

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

Definition at line 285 of file egammaMVAFunctions.h.

286  : 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 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  }

◆ ph_convtrk1nPixHits()

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

Definition at line 290 of file egammaMVAFunctions.h.

290  {
291  if (!m_tp0) { return 0; }
292  uint8_t hits = 0;
294  else {
295  ATH_MSG_WARNING("cannot read xAOD::numberOfPixelHits");
296  return 0;
297  }
298  }

◆ ph_convtrk1nSCTHits()

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

Definition at line 308 of file egammaMVAFunctions.h.

308  {
309  if (!m_tp0) { return 0; }
310  uint8_t hits;
311  if (m_tp0->summaryValue(hits, xAOD::numberOfSCTHits)) { return hits; }
312  else {
313  ATH_MSG_WARNING("cannot read xAOD::numberOfSCTHits");
314  return 0;
315  }
316  }

◆ ph_convtrk2nPixHits()

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

Definition at line 299 of file egammaMVAFunctions.h.

299  {
300  if (!m_tp1) return 0;
301  uint8_t hits;
303  else {
304  ATH_MSG_WARNING("cannot read xAOD::numberOfPixelHits");
305  return 0;
306  }
307  }

◆ ph_convtrk2nSCTHits()

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

Definition at line 317 of file egammaMVAFunctions.h.

317  {
318  if (!m_tp1) { return 0; }
319  uint8_t hits;
320  if (m_tp1->summaryValue(hits, xAOD::numberOfSCTHits)) { return hits; }
321  else {
322  ATH_MSG_WARNING("cannot read xAOD::numberOfSCTHits");
323  return 0;
324  }
325  }

◆ ph_pt1conv()

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

Definition at line 326 of file egammaMVAFunctions.h.

326 { return m_pt1conv; }

◆ ph_pt2conv()

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

Definition at line 327 of file egammaMVAFunctions.h.

327 { return m_pt2conv; }

◆ ph_ptconv()

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

Definition at line 328 of file egammaMVAFunctions.h.

328  {
329  // TODO: evaluate if move to this new definition, by now keep the previous one
330  // to be consistent with the training
331  // return m_vertex ? xAOD::EgammaHelpers::momentumAtVertex(*m_vertex).perp() : 0.;
332  TLorentzVector sum;
333  if (m_tp0) sum += m_tp0->p4();
334  if (m_tp1) sum += m_tp1->p4();
335  return sum.Perp();
336  }

◆ ph_Rconv()

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

Definition at line 288 of file egammaMVAFunctions.h.

288 { 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 289 of file egammaMVAFunctions.h.

289 { 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  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_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 341 of file egammaMVAFunctions.h.

◆ m_pt2conv

float egammaMVAFunctions::ConversionHelper::m_pt2conv
private

Definition at line 341 of file egammaMVAFunctions.h.

◆ m_tp0

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

Definition at line 339 of file egammaMVAFunctions.h.

◆ m_tp1

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

Definition at line 340 of file egammaMVAFunctions.h.

◆ m_vertex

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

Definition at line 338 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
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:575
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:66
xAOD::TrackParticle_v1::summaryValue
bool summaryValue(uint8_t &value, const SummaryType &information) const
Accessor for TrackSummary values.
Definition: TrackParticle_v1.cxx:736
xAOD::numberOfPixelHits
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
Definition: TrackingPrimitives.h:259
xAOD::Vertex_v1::position
const Amg::Vector3D & position() const
Returns the 3-pos.
egammaMVAFunctions::getPtAtFirstMeasurement
float getPtAtFirstMeasurement(const xAOD::TrackParticle *tp)
Definition: egammaMVAFunctions.h:156
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
egammaMVAFunctions::ConversionHelper::m_pt2conv
float m_pt2conv
Definition: egammaMVAFunctions.h:341
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:129
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
LArG4ShowerLibProcessing.hits
hits
Definition: LArG4ShowerLibProcessing.py:136
egammaMVAFunctions::ConversionHelper::ConversionHelper
ConversionHelper(const xAOD::Photon *ph)
Definition: egammaMVAFunctions.h:259
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:338
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:339
egammaMVAFunctions::ConversionHelper::m_pt1conv
float m_pt1conv
Definition: egammaMVAFunctions.h:341
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
xAOD::numberOfSCTHits
@ numberOfSCTHits
number of hits in SCT [unit8_t].
Definition: TrackingPrimitives.h:268
egammaMVAFunctions::ConversionHelper::m_tp1
const xAOD::TrackParticle * m_tp1
Definition: egammaMVAFunctions.h:340
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