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

Constructor & Destructor Documentation

◆ ConversionHelper() [1/2]

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

Definition at line 329 of file egammaMVAFunctions.h.

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

356 : 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 360 of file egammaMVAFunctions.h.

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

◆ ph_convtrk1nSCTHits()

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

Definition at line 378 of file egammaMVAFunctions.h.

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

◆ ph_convtrk2nPixHits()

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

Definition at line 369 of file egammaMVAFunctions.h.

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

◆ ph_convtrk2nSCTHits()

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

Definition at line 387 of file egammaMVAFunctions.h.

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

◆ ph_pt1conv()

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

Definition at line 396 of file egammaMVAFunctions.h.

396{ return m_pt1conv; }

◆ ph_pt2conv()

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

Definition at line 397 of file egammaMVAFunctions.h.

397{ return m_pt2conv; }

◆ ph_ptconv()

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

Definition at line 398 of file egammaMVAFunctions.h.

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

◆ ph_Rconv()

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

Definition at line 358 of file egammaMVAFunctions.h.

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

359{ 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 411 of file egammaMVAFunctions.h.

◆ m_pt2conv

float egammaMVAFunctions::ConversionHelper::m_pt2conv
private

Definition at line 411 of file egammaMVAFunctions.h.

◆ m_tp0

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

Definition at line 409 of file egammaMVAFunctions.h.

◆ m_tp1

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

Definition at line 410 of file egammaMVAFunctions.h.

◆ m_vertex

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

Definition at line 408 of file egammaMVAFunctions.h.


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