Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
ZdcFileGeometryDB Class Reference

#include <ZdcGeometryDB.h>

Inheritance diagram for ZdcFileGeometryDB:
Collaboration diagram for ZdcFileGeometryDB:

Public Member Functions

 ZdcFileGeometryDB ()
 
bool loadJSONFile ()
 
const nlohmann::jsongetDB () const
 

Static Public Member Functions

static const IZdcGeometryDBgetInstance ()
 

Protected Attributes

bool m_geoLoaded {}
 
nlohmann::json m_mainJson
 

Private Member Functions

void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 
void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

std::string m_fileStr
 
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

Definition at line 25 of file ZdcGeometryDB.h.

Constructor & Destructor Documentation

◆ ZdcFileGeometryDB()

ZdcFileGeometryDB::ZdcFileGeometryDB ( )

Definition at line 31 of file ZdcGeometryDB.cxx.

31  : asg::AsgMessaging("ZdcFileGeometryDB"),m_fileStr("ZDCgeom_Run3.json")
32 {
33 
34  msg().setLevel(MSG::INFO);
35 
37 
38 }

Member Function Documentation

◆ getDB()

const nlohmann::json& IZdcGeometryDB::getDB ( ) const
inlineinherited

Definition at line 21 of file ZdcGeometryDB.h.

21 {return m_mainJson;};

◆ getInstance()

const IZdcGeometryDB * ZdcFileGeometryDB::getInstance ( )
static

Definition at line 18 of file ZdcGeometryDB.cxx.

19 {
20  static const ZdcFileGeometryDB file_db_run3;
21  return &file_db_run3;
22 }

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

◆ loadJSONFile()

bool ZdcFileGeometryDB::loadJSONFile ( )

Definition at line 48 of file ZdcGeometryDB.cxx.

49 {
50  bool ret = false;
51  if (m_fileStr == "")
52  {
53  ATH_MSG_WARNING("No JSON filename defined!");
54  return ret;
55  }
57  if (!filePath.empty())
58  {
59  ATH_MSG_DEBUG( "ZdcGeometryDB::found ZDC JSON at " << filePath );
60  }
61  else
62  {
63  ATH_MSG_DEBUG( "ZdcGeometryDB::geometry NOT FOUND! Trying local file!" ) ;
64  filePath = "./"+m_fileStr;
65  }
66 
67  std::ifstream ifs(filePath);
68 
69  if (ifs.is_open())
70  {
71  ifs >> m_mainJson;
72  ret = true;
73  ATH_MSG_INFO("Loaded ZDC DB from file");
74  }
75  else
76  ATH_MSG_ERROR("No ZDC geometry found");
77 
78  return ret;
79 }

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

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

std::string ZdcFileGeometryDB::m_fileStr
private

Definition at line 28 of file ZdcGeometryDB.h.

◆ m_geoLoaded

bool IZdcGeometryDB::m_geoLoaded {}
protectedinherited

Definition at line 15 of file ZdcGeometryDB.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_mainJson

nlohmann::json IZdcGeometryDB::m_mainJson
protectedinherited

Definition at line 16 of file ZdcGeometryDB.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.


The documentation for this class was generated from the following files:
ZdcFileGeometryDB::m_fileStr
std::string m_fileStr
Definition: ZdcGeometryDB.h:28
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
PathResolver::RecursiveSearch
@ RecursiveSearch
Definition: PathResolver.h:28
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
PathResolver::find_file
static std::string find_file(const std::string &logical_file_name, const std::string &search_path, SearchType search_type=LocalSearch)
Definition: PathResolver.cxx:251
ZdcFileGeometryDB::loadJSONFile
bool loadJSONFile()
Definition: ZdcGeometryDB.cxx:48
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
IZdcGeometryDB::m_geoLoaded
bool m_geoLoaded
Definition: ZdcGeometryDB.h:15
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ZdcFileGeometryDB
Definition: ZdcGeometryDB.h:26
asg::AsgMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AsgMessaging.cxx:49
hancool.filePath
string filePath
Definition: hancool.py:28
asg::AsgMessaging
Class mimicking the AthMessaging class from the offline software.
Definition: AsgMessaging.h:40
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
IZdcGeometryDB::m_mainJson
nlohmann::json m_mainJson
Definition: ZdcGeometryDB.h:16
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7