ATLAS Offline Software
Loading...
Searching...
No Matches
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 */
12
13
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
46StatusCode 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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
Handle class for reading from StoreGate.
Provide helper functions to create formatted strings.
An algorithm that can be simultaneously executed in multiple threads.
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
SG::ReadHandleKey< TileLaserObject > m_contKey
Handle to access input object.
TileLaserObjectDumper(const std::string &name, ISvcLocator *svcloc)
Constructor.
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
Gaudi::Property< std::string > m_prefix
Output file name prefix.
std::string strformat(const char *fmt,...)
return a std::string according to a format fmt and varargs
Definition StrFormat.cxx:49