ATLAS Offline Software
Loading...
Searching...
No Matches
DumpCaloBadChannels.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "GaudiKernel/MsgStream.h"
9#include <iostream>
10#include <fstream>
11
13 ISvcLocator * pSvcLocator) :
14 AthAlgorithm(name,pSvcLocator),
15 m_caloBCT("CaloBadChanTool"),
16 m_cellID(0)
17
18{
19 declareProperty("FileName",m_fileName="");
20}
21
22
24
25
27 ATH_MSG_INFO ( "in Intialize()" );
28 ATH_CHECK( detStore()->retrieve(m_cellID,"CaloCell_ID") );
29 ATH_CHECK( m_caloBCT.retrieve() );
30 return StatusCode::SUCCESS;
31}
32
33
34
35
37 ATH_MSG_INFO ( "in finalize()" );
38 std::ostream *out = &(std::cout);
39 std::ofstream outfile;
40 if (m_fileName.size()) {
41 outfile.open(m_fileName.c_str(),std::ios::out);
42 if (outfile.is_open()) {
43 ATH_MSG_INFO ( "Writing to file " << m_fileName );
44 out = &outfile;
45 }
46 else
47 ATH_MSG_ERROR ( "Failed to open file " << m_fileName );
48 }
49
50 for (const Identifier& id : m_cellID->cell_range()) {
51 CaloBadChannel bc=m_caloBCT ->caloStatus(id);
52 (*out) << "Chan: 0x" << std::hex << id.get_compact() << ": " << bc.packedData() << std::dec << std::endl;
53 }
54
55
56 if (outfile.is_open())
57 outfile.close();
58 return StatusCode::SUCCESS;
59}
61 return StatusCode::SUCCESS;
62}
63
64
#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