ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TileCalorimeter
TileRecUtils
src
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
14
#include "
TileLaserObjectDumper.h
"
15
#include "
StoreGate/ReadHandle.h
"
16
#include "
CxxUtils/StrFormat.h
"
17
#include <fstream>
18
19
25
TileLaserObjectDumper::TileLaserObjectDumper
(
const
std::string& name,
26
ISvcLocator* svcloc)
27
:
AthReentrantAlgorithm
(name, svcloc)
28
{
29
}
30
31
35
StatusCode
TileLaserObjectDumper::initialize
()
36
{
37
ATH_CHECK
(
m_contKey
.initialize() );
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
59
SG::ReadHandle<TileLaserObject>
cont (
m_contKey
, ctx);
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
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ReadHandle.h
Handle class for reading from StoreGate.
StrFormat.h
Provide helper functions to create formatted strings.
TileLaserObjectDumper.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
TileLaserObjectDumper::initialize
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
Definition
TileLaserObjectDumper.cxx:35
TileLaserObjectDumper::m_contKey
SG::ReadHandleKey< TileLaserObject > m_contKey
Handle to access input object.
Definition
TileLaserObjectDumper.h:58
TileLaserObjectDumper::TileLaserObjectDumper
TileLaserObjectDumper(const std::string &name, ISvcLocator *svcloc)
Constructor.
Definition
TileLaserObjectDumper.cxx:25
TileLaserObjectDumper::execute
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
Definition
TileLaserObjectDumper.cxx:46
TileLaserObjectDumper::m_prefix
Gaudi::Property< std::string > m_prefix
Output file name prefix.
Definition
TileLaserObjectDumper.h:62
fout
static TFile * fout
Definition
listroot.cxx:40
CxxUtils::strformat
std::string strformat(const char *fmt,...)
return a std::string according to a format fmt and varargs
Definition
StrFormat.cxx:49
Generated on
for ATLAS Offline Software by
1.17.0