ATLAS Offline Software
Loading...
Searching...
No Matches
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.
Functions providing the same interface as AthMessaging
bool msgLvl (const MSG::Level lvl) const
 Test the output level of the object.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.

Private Member Functions

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

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

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

Constructor & Destructor Documentation

◆ ConversionHelper() [1/2]

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

Definition at line 328 of file egammaMVAFunctions.h.

329 : asg::AsgMessaging("ConversionHelper"),
330 m_vertex(ph ? ph->vertex() : nullptr),
331 m_tp0(m_vertex ? m_vertex->trackParticle(0) : nullptr),
332 m_tp1(m_vertex ? m_vertex->trackParticle(1) : nullptr),
333 m_pt1conv(0.), m_pt2conv(0.)
334 {
335
336 ATH_MSG_DEBUG("init conversion helper");
337 if (!m_vertex) return;
338
339 static const SG::AuxElement::Accessor<float> accPt1("pt1");
340 static const SG::AuxElement::Accessor<float> accPt2("pt2");
341 if (accPt1.isAvailable(*m_vertex) && accPt2.isAvailable(*m_vertex))
342 {
343 m_pt1conv = accPt1(*m_vertex);
344 m_pt2conv = accPt2(*m_vertex);
345 }
346 else
347 {
348 ATH_MSG_WARNING("pt1/pt2 not available, will approximate from first measurements");
351 }
352 }
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
const xAOD::Vertex * vertex(size_t index=0) const
Pointer to the xAOD::Vertex/es that match the photon candidate.
Definition Photon_v1.cxx:61
float getPtAtFirstMeasurement(const xAOD::TrackParticle *tp)

◆ ConversionHelper() [2/2]

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

Definition at line 354 of file egammaMVAFunctions.h.

355 : 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 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ 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
51 return ::AthMessaging::msg();
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
59 return ::AthMessaging::msg( lvl );
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 359 of file egammaMVAFunctions.h.

359 {
360 if (!m_tp0) { return 0; }
361 uint8_t hits = 0;
362 if (m_tp0->summaryValue(hits, xAOD::numberOfPixelHits)) { return hits; }
363 else {
364 ATH_MSG_WARNING("cannot read xAOD::numberOfPixelHits");
365 return 0;
366 }
367 }
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].

◆ ph_convtrk1nSCTHits()

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

Definition at line 377 of file egammaMVAFunctions.h.

377 {
378 if (!m_tp0) { return 0; }
380 if (m_tp0->summaryValue(hits, xAOD::numberOfSCTHits)) { return hits; }
381 else {
382 ATH_MSG_WARNING("cannot read xAOD::numberOfSCTHits");
383 return 0;
384 }
385 }
@ numberOfSCTHits
number of hits in SCT [unit8_t].

◆ ph_convtrk2nPixHits()

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

Definition at line 368 of file egammaMVAFunctions.h.

368 {
369 if (!m_tp1) return 0;
371 if (m_tp1->summaryValue(hits, xAOD::numberOfPixelHits)) { return hits; }
372 else {
373 ATH_MSG_WARNING("cannot read xAOD::numberOfPixelHits");
374 return 0;
375 }
376 }

◆ ph_convtrk2nSCTHits()

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

Definition at line 386 of file egammaMVAFunctions.h.

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

◆ ph_pt1conv()

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

Definition at line 395 of file egammaMVAFunctions.h.

395{ return m_pt1conv; }

◆ ph_pt2conv()

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

Definition at line 396 of file egammaMVAFunctions.h.

396{ return m_pt2conv; }

◆ ph_ptconv()

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

Definition at line 397 of file egammaMVAFunctions.h.

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

◆ ph_Rconv()

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

Definition at line 357 of file egammaMVAFunctions.h.

357{ 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 358 of file egammaMVAFunctions.h.

358{ 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.

135{ nullptr };

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

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

◆ m_pt2conv

float egammaMVAFunctions::ConversionHelper::m_pt2conv
private

Definition at line 410 of file egammaMVAFunctions.h.

◆ m_tp0

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

Definition at line 408 of file egammaMVAFunctions.h.

◆ m_tp1

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

Definition at line 409 of file egammaMVAFunctions.h.

◆ m_vertex

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

Definition at line 407 of file egammaMVAFunctions.h.


The documentation for this struct was generated from the following file: