ATLAS Offline Software
Loading...
Searching...
No Matches
TileRawChannelDumper.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
14#include <fstream>
15
16
22TileRawChannelDumper::TileRawChannelDumper (const std::string& name, ISvcLocator* svcloc)
23 : AthReentrantAlgorithm (name, svcloc)
24{
25}
26
27
32{
33 ATH_CHECK( m_contKey.initialize() );
34 if (!m_altContKey.key().empty()) {
35 ATH_CHECK( m_altContKey.initialize() );
36 }
37 return StatusCode::SUCCESS;
38}
39
40
45StatusCode TileRawChannelDumper::execute (const EventContext& ctx) const
46{
47 if (!m_altContKey.key().empty()) {
49 *altCont;
50 }
51
52 std::string fname = std::format ("{}{}_{:08}_{:08}.dump",
53 m_prefix.value().c_str(),
54 m_contKey.key().c_str(),
55 ctx.eventID().run_number(),
56 ctx.eventID().event_number());
57 std::ofstream fout (fname);
58 if (!fout) {
59 ATH_MSG_ERROR ("Cannot open dump file: " << fname);
60 return StatusCode::FAILURE;
61 }
62
64
65 fout << "TileRawChannelContainer/" << m_contKey.key() << " "
66 << "run " << ctx.eventID().run_number() << " "
67 << "event " << ctx.eventID().event_number() << std::endl;
68
69 fout << "Type: " << cont->get_type() << " ("
70 << TileFragHash::typeToString (cont->get_type()) << ") Units: "
71 << cont->get_unit() << " ("
72 << TileRawChannelUnit::unitToString (cont->get_unit())
73 << ") BSflags: 0x" << std::hex << cont->get_bsflags() << std::dec
74 << std::endl;
75
76 for (const TileRawChannelCollection* coll : *cont) {
78 fout << "\n";
79 }
80
81 fout.close();
82
83 return StatusCode::SUCCESS;
84}
85
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x,...)
Handle class for reading from StoreGate.
An algorithm that can be simultaneously executed in multiple threads.
static std::string typeToString(TYPE type)
Printable representation of a type.
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
Gaudi::Property< std::string > m_prefix
Output file name prefix.
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
TileRawChannelDumper(const std::string &name, ISvcLocator *svcloc)
Constructor.
SG::ReadHandleKey< TileRawChannelContainer > m_altContKey
Optional additional input dependency — used when we access the object produced on the side by the con...
SG::ReadHandleKey< TileRawChannelContainer > m_contKey
Handle to access input tile digits.
static std::string unitToString(UNIT type)
Printable representation of a unit.
static TFile * fout
Definition listroot.cxx:40