ATLAS Offline Software
Loading...
Searching...
No Matches
DumpCaloBadChannels.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "GaudiKernel/MsgStream.h"
7#include "GaudiKernel/ThreadLocalContext.h"
10#include <iostream>
11#include <fstream>
12
14 ISvcLocator * pSvcLocator) :
15 AthAlgorithm(name,pSvcLocator),
16 m_caloBCT("CaloBadChanTool"),
17 m_cellID(0)
18
19{
20 declareProperty("FileName",m_fileName="");
21}
22
23
25
26
28 ATH_MSG_INFO ( "in Intialize()" );
29 ATH_CHECK( detStore()->retrieve(m_cellID,"CaloCell_ID") );
30 ATH_CHECK( m_caloBCT.retrieve() );
31 return StatusCode::SUCCESS;
32}
33
34
35
36
38 ATH_MSG_INFO ( "in finalize()" );
39 std::ostream *out = &(std::cout);
40 std::ofstream outfile;
41 if (m_fileName.size()) {
42 outfile.open(m_fileName.c_str(),std::ios::out);
43 if (outfile.is_open()) {
44 ATH_MSG_INFO ( "Writing to file " << m_fileName );
45 out = &outfile;
46 }
47 else
48 ATH_MSG_ERROR ( "Failed to open file " << m_fileName );
49 }
50
51 const EventContext& ctx = Gaudi::Hive::currentContext();
52 for (const Identifier& id : m_cellID->cell_range()) {
53 CaloBadChannel bc=m_caloBCT ->caloStatus(ctx, id);
54 (*out) << "Chan: 0x" << std::hex << id.get_compact() << ": " << bc.packedData() << std::dec << std::endl;
55 }
56
57
58 if (outfile.is_open())
59 outfile.close();
60 return StatusCode::SUCCESS;
61}
63 return StatusCode::SUCCESS;
64}
65
66
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
BitWord packedData() const
DumpCaloBadChannels(const std::string &name, ISvcLocator *pSvcLocator)
const CaloCell_ID * m_cellID
ToolHandle< ICaloBadChanTool > m_caloBCT