ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TileCalorimeter
TileRecUtils
src
TileBeamElemDumper.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
10
11
12
#include "
TileBeamElemDumper.h
"
13
#include "
StoreGate/ReadHandle.h
"
14
#include <fstream>
15
16
22
TileBeamElemDumper::TileBeamElemDumper
(
const
std::string& name, ISvcLocator* svcloc)
23
:
AthReentrantAlgorithm
(name, svcloc)
24
{
25
}
26
27
31
StatusCode
TileBeamElemDumper::initialize
()
32
{
33
ATH_CHECK
(
m_contKey
.initialize() );
34
return
StatusCode::SUCCESS;
35
}
36
37
42
StatusCode
TileBeamElemDumper::execute
(
const
EventContext& ctx)
const
43
{
44
std::string fname = std::format (
"{}{}_{:08}_{:08}.dump"
,
45
m_prefix
.value().c_str(),
46
m_contKey
.key().c_str(),
47
ctx.eventID().run_number(),
48
ctx.eventID().event_number());
49
std::ofstream
fout
(fname);
50
if
(!
fout
) {
51
ATH_MSG_ERROR
(
"Cannot open dump file: "
<< fname);
52
return
StatusCode::FAILURE;
53
}
54
55
SG::ReadHandle<TileBeamElemContainer>
cont (
m_contKey
, ctx);
56
57
fout
<<
"TileBeamElemContainer/"
<<
m_contKey
.key() <<
" "
58
<<
"run "
<< ctx.eventID().run_number() <<
" "
59
<<
"event "
<< ctx.eventID().event_number() << std::endl;
60
61
fout
<<
"Type: "
<< cont->get_type() <<
" ("
62
<<
TileFragHash::typeToString
(cont->get_type()) <<
") Units: "
63
<< cont->get_unit() <<
" ("
64
<<
TileRawChannelUnit::unitToString
(cont->get_unit())
65
<<
") BSflags: 0x"
<< std::hex << cont->get_bsflags() << std::dec
66
<< std::endl;
67
68
for
(
auto
coll : *cont) {
69
fout << static_cast<std::string>
(*coll);
70
fout
<<
"\n"
;
71
}
72
73
fout
.close();
74
75
return
StatusCode::SUCCESS;
76
}
77
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:47
ReadHandle.h
Handle class for reading from StoreGate.
TileBeamElemDumper.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:66
TileBeamElemDumper::m_prefix
Gaudi::Property< std::string > m_prefix
Output file name prefix.
Definition
TileBeamElemDumper.h:62
TileBeamElemDumper::TileBeamElemDumper
TileBeamElemDumper(const std::string &name, ISvcLocator *svcloc)
Constructor.
Definition
TileBeamElemDumper.cxx:22
TileBeamElemDumper::execute
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
Definition
TileBeamElemDumper.cxx:42
TileBeamElemDumper::initialize
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
Definition
TileBeamElemDumper.cxx:31
TileBeamElemDumper::m_contKey
SG::ReadHandleKey< TileBeamElemContainer > m_contKey
Handle to access input tile digits.
Definition
TileBeamElemDumper.h:58
TileFragHash::typeToString
static std::string typeToString(TYPE type)
Printable representation of a type.
Definition
TileFragHash.cxx:85
TileRawChannelUnit::unitToString
static std::string unitToString(UNIT type)
Printable representation of a unit.
Definition
TileRawChannelUnit.cxx:14
fout
static TFile * fout
Definition
listroot.cxx:40
Generated on
for ATLAS Offline Software by
1.17.0