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 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 }
#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 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 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 357 of file egammaMVAFunctions.h.

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

◆ ph_convtrk1nSCTHits()

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

Definition at line 375 of file egammaMVAFunctions.h.

375 {
376 if (!m_tp0) { return 0; }
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 }
@ numberOfSCTHits
number of hits in SCT [unit8_t].

◆ ph_convtrk2nPixHits()

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

Definition at line 366 of file egammaMVAFunctions.h.

366 {
367 if (!m_tp1) return 0;
369 if (m_tp1->summaryValue(hits, xAOD::numberOfPixelHits)) { return 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; }
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 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 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: