ATLAS Offline Software
Loading...
Searching...
No Matches
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"
14#include <fstream>
15
16
22TileBeamElemDumper::TileBeamElemDumper (const std::string& name, ISvcLocator* svcloc)
23 : AthReentrantAlgorithm (name, svcloc)
24{
25}
26
27
32{
33 ATH_CHECK( m_contKey.initialize() );
34 return StatusCode::SUCCESS;
35}
36
37
42StatusCode 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
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) {
70 fout << "\n";
71 }
72
73 fout.close();
74
75 return StatusCode::SUCCESS;
76}
77
#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.
Gaudi::Property< std::string > m_prefix
Output file name prefix.
TileBeamElemDumper(const std::string &name, ISvcLocator *svcloc)
Constructor.
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
SG::ReadHandleKey< TileBeamElemContainer > m_contKey
Handle to access input tile digits.
static std::string typeToString(TYPE type)
Printable representation of a type.
static std::string unitToString(UNIT type)
Printable representation of a unit.
static TFile * fout
Definition listroot.cxx:40