ATLAS Offline Software
LArBadFeb2Ascii.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
9 #include <format>
10 #include <fstream>
11 
12 
14 
15  ATH_MSG_INFO ( "initialize()" );
16  ATH_CHECK(m_BFKey.initialize());
17  return StatusCode::SUCCESS;
18 }
19 
21 {return StatusCode::SUCCESS;}
22 
24  const LArOnlineID* larOnlineID = nullptr;
25  ATH_CHECK( detStore()->retrieve(larOnlineID,"LArOnlineID") );
26 
27  std::ostream *out = &(std::cout);
28  std::ofstream outfile;
29  if (!m_fileName.empty()) {
30  outfile.open(m_fileName.value().c_str(),std::ios::out);
31  if (outfile.is_open()) {
32  ATH_MSG_INFO ( "Writing to file " << m_fileName );
33  out = &outfile;
34  }
35  else
36  ATH_MSG_ERROR ( "Failed to open file " << m_fileName );
37  }
38 
39 
41  const LArBadFebCont* badfebCont{*bfc};
42 
43 
44  const LArBadFebBitPacking packing;
45 
46 
47  std::vector<HWIdentifier>::const_iterator it = larOnlineID->feb_begin();
48  std::vector<HWIdentifier>::const_iterator it_e= larOnlineID->feb_end();
49  unsigned count=0;
50  for(;it!=it_e;++it) {
51  const HWIdentifier fid=*it;
52  LArBadFeb bf = badfebCont->status(fid);
53  if (bf.packedData()) {
54  ++count;
55  (*out) << std::format("{} {} {} {} ",larOnlineID->barrel_ec(fid),larOnlineID->pos_neg(fid),larOnlineID->feedthrough(fid),larOnlineID->slot(fid));
56  (*out) << packing.stringStatus(bf);
57  (*out) << std::format(" # {:#x}", fid.get_identifier32().get_compact()) << std::endl;
58  }
59  }
60  ATH_MSG_INFO ( "Found " << count << " entries in the bad-FEB database." );
61  if (outfile.is_open())
62  outfile.close();
63  return StatusCode::SUCCESS;
64 }
65 
66 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
vtune_athena.format
format
Definition: vtune_athena.py:14
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
LArBadFeb2Ascii::initialize
StatusCode initialize()
Definition: LArBadFeb2Ascii.cxx:13
LArBadXCont
Conditions-Data class holding LAr Bad Channel or Bad Feb information.
Definition: LArBadChannelCont.h:28
skel.it
it
Definition: skel.GENtoEVGEN.py:407
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:70
LArOnlineID_Base::slot
int slot(const HWIdentifier id) const
Return the slot number of a hardware cell identifier: slot = [1,15] Slot-ID in top part of the crat...
Definition: LArOnlineID_Base.cxx:1957
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
LArOnlineID_Base::feb_begin
id_iterator feb_begin() const
Returns an iterator pointing to a feb identifier collection.
Definition: LArOnlineID_Base.cxx:1906
HWIdentifier
Definition: HWIdentifier.h:13
LArOnlineID_Base::barrel_ec
int barrel_ec(const HWIdentifier id) const
Return the position barrel or endcap of a hardware cell identifier: barrel_ec = [0,...
Definition: LArOnlineID_Base.cxx:1938
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition: Identifier32.h:44
XMLtoHeader.count
count
Definition: XMLtoHeader.py:84
LArBadFeb2Ascii::finalize
StatusCode finalize()
Definition: LArBadFeb2Ascii.cxx:23
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
LArBadFeb2Ascii::m_BFKey
SG::ReadCondHandleKey< LArBadFebCont > m_BFKey
Definition: LArBadFeb2Ascii.h:27
LArBadFeb2Ascii::execute
StatusCode execute()
Definition: LArBadFeb2Ascii.cxx:20
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArBadChannelDBTools.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LArBadFeb2Ascii::m_fileName
Gaudi::Property< std::string > m_fileName
Definition: LArBadFeb2Ascii.h:28
LArOnlineID_Base::pos_neg
int pos_neg(const HWIdentifier id) const
Return the side of a hardware cell identifier pos_neg = [0,1] positive-side or negative-side Barrel...
Definition: LArOnlineID_Base.cxx:1950
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LArOnlineID_Base::feb_end
id_iterator feb_end() const
Definition: LArOnlineID_Base.cxx:1911
LArBadFeb
Definition: LArBadFeb.h:10
LArOnlineID
Definition: LArOnlineID.h:20
LArBadFebBitPacking
Definition: LArBadFebBitPacking.h:16
LArOnlineID_Base::feedthrough
int feedthrough(const HWIdentifier id) const
Return the feedthrough of a hardware cell identifier : feedthrough = [0,31] Barrel - A/C side or H/...
Definition: LArOnlineID_Base.cxx:1944
LArBadFeb::packedData
BitWord packedData() const
Definition: LArBadFeb.h:52
LArBadFebBitPacking::stringStatus
std::string stringStatus(const LArBadFeb &bc) const
Definition: LArBadFebBitPacking.cxx:86
LArBadFeb2Ascii.h
PrepareReferenceFile.outfile
outfile
Definition: PrepareReferenceFile.py:42
LArOnlineID.h