ATLAS Offline Software
JobOptsDumperAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "Gaudi/Interfaces/IOptionsSvc.h"
6 #include "GaudiKernel/ServiceHandle.h"
7 
8 #include "JobOptsDumperAlg.h"
9 #include <fstream>
10 
12 
13  std::ofstream fout(m_fileName);
14  if (!fout.good()) {
15  ATH_MSG_ERROR("Failed to open output file " << m_fileName);
16  return StatusCode::FAILURE;
17  }
18 
19  ServiceHandle<Gaudi::Interfaces::IOptionsSvc> joSvc("JobOptionsSvc", name());
20  ATH_CHECK(joSvc.retrieve());
21 
22  std::vector<std::string> options;
23  for (const auto& [name, value] : joSvc->items()) {
24  std::ostringstream os;
25  os << name << " = " << value << std::endl;
26  options.emplace_back(os.str());
27  }
28 
29  std::sort(options.begin(), options.end());
30  for (const std::string& opt : options) {
31  fout << opt << std::endl;
32  }
33  fout.close();
34  return StatusCode::SUCCESS;
35 }
athena.value
value
Definition: athena.py:122
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
dqt_zlumi_alleff_HIST.fout
fout
Definition: dqt_zlumi_alleff_HIST.py:59
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
python.AtlRunQueryLib.options
options
Definition: AtlRunQueryLib.py:379
ReadFromCoolCompare.os
os
Definition: ReadFromCoolCompare.py:231
JobOptsDumperAlg.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
pmontree.opt
opt
Definition: pmontree.py:16
JobOptsDumperAlg::initialize
virtual StatusCode initialize() override
Definition: JobOptsDumperAlg.cxx:11
ServiceHandle< Gaudi::Interfaces::IOptionsSvc >
JobOptsDumperAlg::m_fileName
Gaudi::Property< std::string > m_fileName
Definition: JobOptsDumperAlg.h:24