ATLAS Offline Software
TileMuonReceiverDumper.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 "TileMuonReceiverDumper.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 {
37  ATH_CHECK( m_contKey.initialize() );
38  return StatusCode::SUCCESS;
39 }
40 
41 
46 StatusCode TileMuonReceiverDumper::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 << "TileMuonReceiverContainer/" << 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 
TileMuonReceiverDumper::execute
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
Definition: TileMuonReceiverDumper.cxx:46
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
TileMuonReceiverDumper::m_contKey
SG::ReadHandleKey< TileMuonReceiverContainer > m_contKey
Handle to access input tile digits.
Definition: TileMuonReceiverDumper.h:58
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
StrFormat.h
Provide helper functions to create formatted strings.
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
TileMuonReceiverDumper.h
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
TileMuonReceiverDumper::m_prefix
Gaudi::Property< std::string > m_prefix
Output file name prefix.
Definition: TileMuonReceiverDumper.h:62
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TileMuonReceiverDumper::TileMuonReceiverDumper
TileMuonReceiverDumper(const std::string &name, ISvcLocator *svcloc)
Constructor.
Definition: TileMuonReceiverDumper.cxx:25
TileMuonReceiverDumper::initialize
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
Definition: TileMuonReceiverDumper.cxx:35
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
python.AthDsoLogger.fname
string fname
Definition: AthDsoLogger.py:67
ReadHandle.h
Handle class for reading from StoreGate.