ATLAS Offline Software
TileLaserObjectDumper.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 /*
5  */
14 #include "TileLaserObjectDumper.h"
15 #include "StoreGate/ReadHandle.h"
16 #include "CxxUtils/StrFormat.h"
17 #include <fstream>
18 
19 
26  ISvcLocator* svcloc)
27  : AthReentrantAlgorithm (name, svcloc)
28 {
29 }
30 
31 
36 {
38  return StatusCode::SUCCESS;
39 }
40 
41 
46 StatusCode TileLaserObjectDumper::execute (const EventContext& ctx) const
47 {
48  std::string fname = CxxUtils::strformat ("%s%s_%08u_%08lu.dump",
49  m_prefix.value().c_str(),
50  m_contKey.key().c_str(),
51  ctx.eventID().run_number(),
52  ctx.eventID().event_number());
53  std::ofstream fout (fname);
54  if (!fout) {
55  ATH_MSG_ERROR ("Cannot open dump file: " << fname);
56  return StatusCode::FAILURE;
57  }
58 
60 
61  fout << "TileLaserObject/" << m_contKey.key() << " "
62  << "run " << ctx.eventID().run_number() << " "
63  << "event " << ctx.eventID().event_number() << std::endl;
64 
65  fout << static_cast<std::string> (*cont) << "\n";
66 
67  fout.close();
68 
69  return StatusCode::SUCCESS;
70 }
71 
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
TileLaserObjectDumper::execute
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
Definition: TileLaserObjectDumper.cxx:46
StrFormat.h
Provide helper functions to create formatted strings.
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
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
TileLaserObjectDumper::m_contKey
SG::ReadHandleKey< TileLaserObject > m_contKey
Handle to access input object.
Definition: TileLaserObjectDumper.h:58
CxxUtils::strformat
std::string strformat(const char *fmt,...)
return a std::string according to a format fmt and varargs
Definition: StrFormat.cxx:49
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TileLaserObjectDumper::TileLaserObjectDumper
TileLaserObjectDumper(const std::string &name, ISvcLocator *svcloc)
Constructor.
Definition: TileLaserObjectDumper.cxx:25
python.AthDsoLogger.fname
string fname
Definition: AthDsoLogger.py:67
TileLaserObjectDumper::m_prefix
Gaudi::Property< std::string > m_prefix
Output file name prefix.
Definition: TileLaserObjectDumper.h:62
TileLaserObjectDumper.h
TileLaserObjectDumper::initialize
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
Definition: TileLaserObjectDumper.cxx:35
ReadHandle.h
Handle class for reading from StoreGate.