ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
InDet::FuncSummaryValueCut< N > Class Template Reference

#include <InDetSecVtxTrackCut.h>

Inheritance diagram for InDet::FuncSummaryValueCut< N >:
Collaboration diagram for InDet::FuncSummaryValueCut< N >:

Public Member Functions

 FuncSummaryValueCut (InDetSecVtxTrackSelectionTool *, const std::array< xAOD::SummaryType, N > &&)
 
void setFunction (std::function< bool(const std::array< uint8_t, N > &)> func)
 
virtual StatusCode initialize ()
 
virtual bool result () const
 
 operator bool () const
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Protected Member Functions

template<class AccessorType >
StatusCode getAccessor (const std::string &name, std::shared_ptr< AccessorType > &accessor)
 

Private Member Functions

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

Private Attributes

std::function< bool(const std::array< uint8_t, N > &)> m_func
 
std::array< xAOD::SummaryType, N > m_summaryTypes
 
std::array< std::shared_ptr< SummaryAccessor >, N > m_summaryAccessors
 
std::unordered_map< std::string, std::shared_ptr< SecVtxTrackAccessor > > * m_trackAccessors
 
InDetSecVtxTrackSelectionToolm_selectionTool
 
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

template<size_t N>
class InDet::FuncSummaryValueCut< N >

Definition at line 57 of file InDetSecVtxTrackCut.h.

Constructor & Destructor Documentation

◆ FuncSummaryValueCut()

template<size_t N>
InDet::FuncSummaryValueCut< N >::FuncSummaryValueCut ( InDet::InDetSecVtxTrackSelectionTool tool,
const std::array< xAOD::SummaryType, N > &&  sumTypes 
)

Definition at line 64 of file InDetSecVtxTrackCut.cxx.

66  , m_summaryTypes(sumTypes)
67 {
68 }

Member Function Documentation

◆ getAccessor()

template<class AccessorType >
StatusCode InDet::SecVtxTrackCut::getAccessor ( const std::string &  name,
std::shared_ptr< AccessorType > &  accessor 
)
protectedinherited

Definition at line 72 of file InDetSecVtxTrackCut.h.

74 {
75  // this function looks for the accessor indicated by "name" in the tool's
76  // track accessors and assigns "accessor" to it if it exists, creating
77  // the accessor if it does not.
78  std::unordered_map< std::string, std::shared_ptr<SecVtxTrackAccessor> >::const_iterator it =
79  std::find_if(m_trackAccessors->begin(), m_trackAccessors->end(),
80  [&] (std::pair< std::string, std::shared_ptr<SecVtxTrackAccessor> > acc)
81  {return acc.first == accessorName;} );
82  if (it == m_trackAccessors->end()) {
83  // if we can't find the accessor, add one to the tool
84  if (!m_selectionTool) {
85  ATH_MSG_ERROR( "Must initialize SecVtxTrackCut with pointer to the selection tool before adding accessors." );
86  return StatusCode::FAILURE;
87  }
88  accessor = std::make_shared<AccessorType>(m_selectionTool);
89  (*m_trackAccessors)[accessorName] = accessor;
90  ATH_MSG_DEBUG( "Adding accessor " << accessorName );
91  } else {
92  accessor = std::dynamic_pointer_cast<AccessorType>(it->second);
93  if (accessor==nullptr) {
94  ATH_MSG_ERROR( "Logic error: could not cast accessor to type " << typeid(AccessorType).name() );
95  return StatusCode::FAILURE;
96  }
97  }
98 
99  if (!accessor) {
100  // this could happen if the accessor indicated by "name" is not of type "AccessorType"
101  ATH_MSG_ERROR( "Could not instantiate "<< accessorName <<
102  " accessor. Pointer to accessor is to type " <<
103  typeid(AccessorType).name() << ". Is this correct?" );
104  return StatusCode::FAILURE;
105  }
106  return StatusCode::SUCCESS;
107 }

◆ initialize()

template<size_t N>
StatusCode InDet::FuncSummaryValueCut< N >::initialize
virtual

Reimplemented from InDet::SecVtxTrackCut.

Definition at line 71 of file InDetSecVtxTrackCut.cxx.

72 {
73  // first run the base class version to get access to the tool's accessors
75 
76  for (size_t i=0; i<N; ++i) {
77  std::string summaryName = "summaryType";
78  summaryName += std::to_string(m_summaryTypes[i]);
79  std::shared_ptr<SummaryAccessor> accessor;
80  ATH_CHECK( getAccessor(summaryName, accessor) );
81  accessor->setSummaryType( m_summaryTypes[i] );
82  m_summaryAccessors[i] = std::move(accessor);
83  }
84 
85  return StatusCode::SUCCESS;
86 }

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

◆ operator bool()

InDet::SecVtxTrackCut::operator bool ( ) const
inlineinherited

Definition at line 33 of file InDetSecVtxTrackCut.h.

33 {return this->result();}

◆ result()

template<size_t N>
bool InDet::FuncSummaryValueCut< N >::result
virtual

Implements InDet::SecVtxTrackCut.

Definition at line 89 of file InDetSecVtxTrackCut.cxx.

90 {
91  std::array<uint8_t,N> results{}; // member variable to store the results
92 
93  for (size_t i=0; i<N; ++i) {
94  if (!m_summaryAccessors[i]) {
95  ATH_MSG_WARNING( "Track summary accessor not valid. Track will not pass this cut." );
96  return false;
97  }
98  results[i] = m_summaryAccessors[i]->getValue();
99  }
100  return m_func(results);
101 }

◆ setFunction()

template<size_t N>
void InDet::FuncSummaryValueCut< N >::setFunction ( std::function< bool(const std::array< uint8_t, N > &)>  func)
inline

Definition at line 60 of file InDetSecVtxTrackCut.h.

60 {m_func = func;}

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

template<size_t N>
std::function<bool(const std::array<uint8_t,N>&)> InDet::FuncSummaryValueCut< N >::m_func
private

Definition at line 64 of file InDetSecVtxTrackCut.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_selectionTool

InDetSecVtxTrackSelectionTool* InDet::SecVtxTrackCut::m_selectionTool
privateinherited

Definition at line 42 of file InDetSecVtxTrackCut.h.

◆ m_summaryAccessors

template<size_t N>
std::array< std::shared_ptr<SummaryAccessor>,N > InDet::FuncSummaryValueCut< N >::m_summaryAccessors
private

Definition at line 66 of file InDetSecVtxTrackCut.h.

◆ m_summaryTypes

template<size_t N>
std::array< xAOD::SummaryType, N> InDet::FuncSummaryValueCut< N >::m_summaryTypes
private

Definition at line 65 of file InDetSecVtxTrackCut.h.

◆ m_trackAccessors

std::unordered_map< std::string, std::shared_ptr<SecVtxTrackAccessor> >* InDet::SecVtxTrackCut::m_trackAccessors
privateinherited

Definition at line 40 of file InDetSecVtxTrackCut.h.


The documentation for this class was generated from the following files:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
verify_menu_config.results
results
Definition: verify_menu_config.py:67
InDet::FuncSummaryValueCut::m_summaryTypes
std::array< xAOD::SummaryType, N > m_summaryTypes
Definition: InDetSecVtxTrackCut.h:65
skel.it
it
Definition: skel.GENtoEVGEN.py:396
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
InDet::SecVtxTrackCut::initialize
virtual StatusCode initialize()
Definition: InDetSecVtxTrackCut.cxx:26
InDet::SecVtxTrackCut::m_selectionTool
InDetSecVtxTrackSelectionTool * m_selectionTool
Definition: InDetSecVtxTrackCut.h:42
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
InDet::SecVtxTrackCut::result
virtual bool result() const =0
InDet::SecVtxTrackCut
Definition: InDetSecVtxTrackCut.h:25
InDet::SecVtxTrackCut::m_trackAccessors
std::unordered_map< std::string, std::shared_ptr< SecVtxTrackAccessor > > * m_trackAccessors
Definition: InDetSecVtxTrackCut.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
InDet::FuncSummaryValueCut::m_func
std::function< bool(const std::array< uint8_t, N > &)> m_func
Definition: InDetSecVtxTrackCut.h:64
InDet::SecVtxTrackCut::getAccessor
StatusCode getAccessor(const std::string &name, std::shared_ptr< AccessorType > &accessor)
Definition: InDetSecVtxTrackCut.h:72
xAOD::JetAttributeAccessor::accessor
const AccessorWrapper< T > * accessor(xAOD::JetAttribute::AttributeID id)
Returns an attribute accessor corresponding to an AttributeID.
Definition: JetAccessorMap.h:26
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
InDet::FuncSummaryValueCut::m_summaryAccessors
std::array< std::shared_ptr< SummaryAccessor >, N > m_summaryAccessors
Definition: InDetSecVtxTrackCut.h:66
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7