ATLAS Offline Software
ForwardDetectors
ZDC
ZdcConditions
src
ZdcGeometryDB.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
ZdcConditions/ZdcGeometryDB.h
"
6
#include "
PathResolver/PathResolver.h
"
7
8
#include <fstream>
9
10
const
ZdcGeometryDB
*
ZdcGeometryDB::getInstance
()
11
{
12
static
const
ZdcGeometryDB
map_run3;
13
return
&map_run3;
14
}
15
16
//constructor
17
ZdcGeometryDB::ZdcGeometryDB
() :
asg
::AsgMessaging(
"ZdcGeometryDB"
)
18
{
19
20
msg
().setLevel(MSG::INFO);
21
22
loadJSONFile
();
23
24
}
25
26
void
ZdcGeometryDB::loadJSONFile
(
const
std::string& geoStr)
27
{
28
29
std::string
filePath
=
PathResolver::find_file
(geoStr,
"DATAPATH"
,
PathResolver::RecursiveSearch
);
30
if
(!
filePath
.empty())
31
{
32
ATH_MSG_DEBUG
(
"ZdcGeometryDB::found ZDC JSON at "
<<
filePath
);
33
}
34
else
35
{
36
ATH_MSG_DEBUG
(
"ZdcGeometryDB::geometry NOT FOUND!"
) ;
37
filePath
=
"./"
+
m_geoStr
;
38
}
39
40
std::ifstream ifs(
filePath
);
41
42
if
(ifs.is_open())
43
ifs >>
m_mainJson
;
44
else
45
ATH_MSG_ERROR
(
"No ZDC geometry found"
);
46
47
}
PathResolver::RecursiveSearch
@ RecursiveSearch
Definition:
PathResolver.h:28
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
asg
Definition:
DataHandleTestTool.h:28
ZdcGeometryDB::m_geoStr
std::string m_geoStr
Definition:
ZdcGeometryDB.h:17
ZdcGeometryDB.h
ZdcGeometryDB
Definition:
ZdcGeometryDB.h:13
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition:
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition:
AthMsgStreamMacros.h:29
asg::AsgMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition:
AsgMessaging.cxx:49
ZdcGeometryDB::getInstance
static const ZdcGeometryDB * getInstance()
Definition:
ZdcGeometryDB.cxx:10
ZdcGeometryDB::m_mainJson
nlohmann::json m_mainJson
Definition:
ZdcGeometryDB.h:16
PathResolver.h
hancool.filePath
string filePath
Definition:
hancool.py:28
ZdcGeometryDB::ZdcGeometryDB
ZdcGeometryDB()
Definition:
ZdcGeometryDB.cxx:17
ZdcGeometryDB::loadJSONFile
void loadJSONFile(const std::string &geoStr="ZDCgeom_Run3.json")
Definition:
ZdcGeometryDB.cxx:26
Generated on Sun Dec 22 2024 21:23:04 for ATLAS Offline Software by
1.8.18