ATLAS Offline Software
LArBadFeb2Ascii.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
9 #include <fstream>
10 
11 
13 
14  ATH_MSG_INFO ( "initialize()" );
15  ATH_CHECK(m_BFKey.initialize());
16  return StatusCode::SUCCESS;
17 }
18 
20 {return StatusCode::SUCCESS;}
21 
23  const LArOnlineID* larOnlineID = nullptr;
24  ATH_CHECK( detStore()->retrieve(larOnlineID,"LArOnlineID") );
25 
26  std::ostream *out = &(std::cout);
27  std::ofstream outfile;
28  if (!m_fileName.empty()) {
29  outfile.open(m_fileName.value().c_str(),std::ios::out);
30  if (outfile.is_open()) {
31  ATH_MSG_INFO ( "Writing to file " << m_fileName );
32  out = &outfile;
33  }
34  else
35  ATH_MSG_ERROR ( "Failed to open file " << m_fileName );
36  }
37 
38 
40  const LArBadFebCont* badfebCont{*bfc};
41 
42 
43  const LArBadFebBitPacking packing;
44 
45 
46  std::vector<HWIdentifier>::const_iterator it = larOnlineID->feb_begin();
47  std::vector<HWIdentifier>::const_iterator it_e= larOnlineID->feb_end();
48  unsigned count=0;
49  for(;it!=it_e;++it) {
50  const HWIdentifier fid=*it;
51  LArBadFeb bf = badfebCont->status(fid);
52  if (bf.packedData()) {
53  ++count;
54  (*out) << std::format("{} {} {} {} ",larOnlineID->barrel_ec(fid),larOnlineID->pos_neg(fid),larOnlineID->feedthrough(fid),larOnlineID->slot(fid));
55  (*out) << packing.stringStatus(bf);
56  (*out) << std::format(" # {:#x}", fid.get_identifier32().get_compact()) << std::endl;
57  }
58  }
59  ATH_MSG_INFO ( "Found " << count << " entries in the bad-FEB database." );
60  if (outfile.is_open())
61  outfile.close();
62  return StatusCode::SUCCESS;
63 }
64 
65 
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:12
LArBadXCont
Conditions-Data class holding LAr Bad Channel or Bad Feb information.
Definition: LArBadChannelCont.h:28
skel.it
it
Definition: skel.GENtoEVGEN.py:423
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
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:1961
LArOnlineID_Base::feb_begin
id_iterator feb_begin() const
Returns an iterator pointing to a feb identifier collection.
Definition: LArOnlineID_Base.cxx:1910
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:1942
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
LArBadFeb2Ascii::finalize
StatusCode finalize()
Definition: LArBadFeb2Ascii.cxx:22
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:19
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
LArBadChannelDBTools.h
Identifier32::get_compact
value_type get_compact(void) const
Get the compact id.
Definition: Identifier32.h:171
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:1954
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
LArOnlineID_Base::feb_end
id_iterator feb_end() const
Definition: LArOnlineID_Base.cxx:1915
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:1948
LArBadFeb::packedData
BitWord packedData() const
Definition: LArBadFeb.h:52
LArBadFebBitPacking::stringStatus
std::string stringStatus(const LArBadFeb &bc) const
Definition: LArBadFebBitPacking.cxx:86
LArBadFeb2Ascii.h
Identifier::get_identifier32
Identifier32 get_identifier32(void) const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
PrepareReferenceFile.outfile
outfile
Definition: PrepareReferenceFile.py:42
LArOnlineID.h