ATLAS Offline Software
ZdcLucrodMapRun3.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 #include <fstream>
9 
11 {
12  static const ZdcLucrodMapRun3 map_run3;
13  return &map_run3;
14 }
15 
16 //constructor
17 ZdcLucrodMapRun3::ZdcLucrodMapRun3() : asg::AsgMessaging("ZdcLucrodMapRun3")
18 {
19  msg().setLevel(MSG::INFO);
20 
21  std::string filePath = PathResolver::find_file("ZDC_Run3_conditions.json","DATAPATH", PathResolver::RecursiveSearch);
22  if (!filePath.empty())
23  {
24  ATH_MSG_DEBUG( "ZdcLucrodMapRun3::found ZDC JSON at " << filePath );
25  }
26  else
27  {
28  ATH_MSG_DEBUG( "ZdcLucrodMapRun3::mapping NOT FOUND!" ) ;
29  filePath = "./ZDC_Run3_mapping.json";
30  }
31 
32  std::ifstream ifs(filePath);
33 
34  ifs >> m_mainJson;
35 
36  m_lucrodInfo.resize(6);
37 
38  for (const auto& element: m_mainJson)
39  {
40  int source_ID = element["source_ID"] ;
41  m_lucrodInfo[source_ID] = element;
42  }
43 
44 }
ZdcLucrodMapRun3::m_mainJson
nlohmann::json m_mainJson
Definition: ZdcLucrodMapRun3.h:17
PathResolver::RecursiveSearch
@ RecursiveSearch
Definition: PathResolver.h:28
ZdcLucrodMapRun3
Definition: ZdcLucrodMapRun3.h:13
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
ZdcLucrodMapRun3::ZdcLucrodMapRun3
ZdcLucrodMapRun3()
Definition: ZdcLucrodMapRun3.cxx:17
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ZdcLucrodMapRun3.h
asg::AsgMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AsgMessaging.cxx:49
PathResolver.h
hancool.filePath
string filePath
Definition: hancool.py:28
ZdcLucrodMapRun3::m_lucrodInfo
std::vector< nlohmann::json > m_lucrodInfo
Definition: ZdcLucrodMapRun3.h:16
ZdcLucrodMapRun3::getInstance
static const ZdcLucrodMapRun3 * getInstance()
Definition: ZdcLucrodMapRun3.cxx:10