ATLAS Offline Software
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 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
DumpCaloBadChannels::m_fileName
std::string m_fileName
Definition: DumpCaloBadChannels.h:26
DumpCaloBadChannels::DumpCaloBadChannels
DumpCaloBadChannels(const std::string &name, ISvcLocator *pSvcLocator)
Definition: DumpCaloBadChannels.cxx:12
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
DumpCaloBadChannels::initialize
StatusCode initialize()
Definition: DumpCaloBadChannels.cxx:26
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
DumpCaloBadChannels::execute
StatusCode execute()
Definition: DumpCaloBadChannels.cxx:60
CaloCell_ID.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
DumpCaloBadChannels::m_caloBCT
ToolHandle< ICaloBadChanTool > m_caloBCT
Definition: DumpCaloBadChannels.h:25
DumpCaloBadChannels::finalize
StatusCode finalize()
Definition: DumpCaloBadChannels.cxx:36
DumpCaloBadChannels::m_cellID
const CaloCell_ID * m_cellID
Definition: DumpCaloBadChannels.h:27
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
DumpCaloBadChannels::~DumpCaloBadChannels
~DumpCaloBadChannels()
Definition: DumpCaloBadChannels.cxx:23
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DumpCaloBadChannels.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthAlgorithm
Definition: AthAlgorithm.h:47
CaloCell_Base_ID::cell_range
id_range cell_range(void) const
Range over full set of Identifiers (LAr + Tiles)
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
CaloBadChannel::packedData
BitWord packedData() const
Definition: CaloBadChannel.h:32
CaloBadChannel
Definition: CaloBadChannel.h:8
PrepareReferenceFile.outfile
outfile
Definition: PrepareReferenceFile.py:42
StoreGateSvc.h