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
ZdcGeoDBGeometryDB Class Reference

#include <ZdcGeometryDB.h>

Inheritance diagram for ZdcGeoDBGeometryDB:
Collaboration diagram for ZdcGeoDBGeometryDB:

Public Member Functions

 ZdcGeoDBGeometryDB ()
 
bool loadGeoDB ()
 
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_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 37 of file ZdcGeometryDB.h.

Constructor & Destructor Documentation

◆ ZdcGeoDBGeometryDB()

ZdcGeoDBGeometryDB::ZdcGeoDBGeometryDB ( )

Definition at line 40 of file ZdcGeometryDB.cxx.

40  : asg::AsgMessaging("ZdcGeoDBGeometryDB")
41 {
42  msg().setLevel(MSG::INFO);
43 
45 }

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 * ZdcGeoDBGeometryDB::getInstance ( )
static

Definition at line 24 of file ZdcGeometryDB.cxx.

25 {
26  static const ZdcGeoDBGeometryDB geodb_run3;
27  return &geodb_run3;
28 }

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

◆ loadGeoDB()

bool ZdcGeoDBGeometryDB::loadGeoDB ( )

Definition at line 81 of file ZdcGeometryDB.cxx.

82 {
83  SmartIF<IRDBAccessSvc> iAccessSvc(Gaudi::svcLocator()->service("RDBAccessSvc"));
84  if (!iAccessSvc)
85  {
86  ATH_MSG_FATAL("No RDBAccessSvc");
87  throw std::runtime_error("No RDBAccessSvc found!");
88  }
89 
90  SmartIF<IGeoModelSvc> geoModel{Gaudi::svcLocator()->service ("GeoModelSvc")};
91  if (!geoModel)
92  {
93  ATH_MSG_FATAL("No GeoModelSvc");
94  throw std::runtime_error("No GeoModelSvc found!");
95  }
96  DecodeVersionKey versionKey(geoModel, "ForwardDetectors");
97 
98  ATH_MSG_INFO("Loading ZDC geometry from tag: " << versionKey.tag() << " node: " << versionKey.node());
99  IRDBRecordset_ptr tanParams = iAccessSvc->getRecordsetPtr("TanTaxn",versionKey.tag(), versionKey.node());
100  IRDBRecordset_ptr zdcParams = iAccessSvc->getRecordsetPtr("ZdcPrd",versionKey.tag(), versionKey.node());
101 
102  IRDBRecordset::const_iterator AccessSvc_iter;
103  for(AccessSvc_iter = tanParams->begin(); AccessSvc_iter != tanParams->end(); ++AccessSvc_iter)
104  {
105  const std::string & name = (*AccessSvc_iter)->getString("NAME");
106  int side = (*AccessSvc_iter)->getInt("SIDE");
107  double x = (*AccessSvc_iter)->getDouble("X");
108  double y = (*AccessSvc_iter)->getDouble("Y");
109  double z = (*AccessSvc_iter)->getDouble("Z");
110  double w = (*AccessSvc_iter)->getDouble("WIDTH");
111  double h = (*AccessSvc_iter)->getDouble("HEIGHT");
112  double d = (*AccessSvc_iter)->getDouble("DEPTH");
113 
114  m_mainJson["TAN/TAXN"][name]["name"]=name;
115  m_mainJson["TAN/TAXN"][name]["side"]=side;
116  m_mainJson["TAN/TAXN"][name]["x"]=x;
117  m_mainJson["TAN/TAXN"][name]["y"]=y;
118  m_mainJson["TAN/TAXN"][name]["z"]=z;
119  m_mainJson["TAN/TAXN"][name]["width"]=w;
120  m_mainJson["TAN/TAXN"][name]["height"]=h;
121  m_mainJson["TAN/TAXN"][name]["depth"]=d;
122  }
123 
124  for(AccessSvc_iter = zdcParams->begin(); AccessSvc_iter != zdcParams->end(); ++AccessSvc_iter)
125  {
126  const std::string & name = (*AccessSvc_iter)->getString("NAME");
127  std::string key = name;
128  if ( (key.find("RPD") == std::string::npos) &&
129  (key.find("BRAN") == std::string::npos) )
130  key = "ZDC"+key;
131 
132  int side = (*AccessSvc_iter)->getInt("SIDE");
133  int mod = (*AccessSvc_iter)->getInt("MODUL");
134  int type = -1;
135  if (!(*AccessSvc_iter)->isFieldNull("TYPE"))
136  {
137  type = (*AccessSvc_iter)->getInt("TYPE");
138  }
139  double x = (*AccessSvc_iter)->getDouble("X");
140  double y = (*AccessSvc_iter)->getDouble("Y");
141  double z = (*AccessSvc_iter)->getDouble("Z");
142  double q = (*AccessSvc_iter)->getDouble("Q");
143  double i = (*AccessSvc_iter)->getDouble("I");
144  double j = (*AccessSvc_iter)->getDouble("J");
145  double k = (*AccessSvc_iter)->getDouble("K");
146 
147  m_mainJson["Detector"][key]["name"]=name;
148  m_mainJson["Detector"][key]["module"]=mod;
149  m_mainJson["Detector"][key]["side"]=side;
150  if (type>-1) m_mainJson["Detector"][key]["type"]=type; // RPD & BRAN have no "type" in some versions of the GeoDB
151  m_mainJson["Detector"][key]["x"]=x;
152  m_mainJson["Detector"][key]["y"]=y;
153  m_mainJson["Detector"][key]["z"]=z;
154  m_mainJson["Detector"][key]["q"]=q;
155  m_mainJson["Detector"][key]["i"]=i;
156  m_mainJson["Detector"][key]["j"]=j;
157  m_mainJson["Detector"][key]["k"]=k;
158  }
159 
160  ATH_MSG_INFO("Loaded ZDC DB from GeoDB" << versionKey.tag());
161  return true;
162 }

◆ 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_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:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
hist_file_dump.d
d
Definition: hist_file_dump.py:143
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
x
#define x
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
TRT::Hit::side
@ side
Definition: HitInfo.h:83
IZdcGeometryDB::m_geoLoaded
bool m_geoLoaded
Definition: ZdcGeometryDB.h:15
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
lumiFormat.i
int i
Definition: lumiFormat.py:85
z
#define z
ZdcGeoDBGeometryDB
Definition: ZdcGeometryDB.h:38
extractSporadic.h
list h
Definition: extractSporadic.py:97
DecodeVersionKey
This is a helper class to query the version tags from GeoModelSvc and determine the appropriate tag a...
Definition: DecodeVersionKey.h:18
asg::AsgMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AsgMessaging.cxx:49
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition: IRDBAccessSvc.h:25
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
asg::AsgMessaging
Class mimicking the AthMessaging class from the offline software.
Definition: AsgMessaging.h:40
y
#define y
h
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
extractSporadic.q
list q
Definition: extractSporadic.py:98
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
IZdcGeometryDB::m_mainJson
nlohmann::json m_mainJson
Definition: ZdcGeometryDB.h:16
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
IRDBRecordset::const_iterator
RecordsVector::const_iterator const_iterator
Definition: IRDBRecordset.h:52
ZdcGeoDBGeometryDB::loadGeoDB
bool loadGeoDB()
Definition: ZdcGeometryDB.cxx:81
fitman.k
k
Definition: fitman.py:528
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37