ATLAS Offline Software
Loading...
Searching...
No Matches
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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
LArBadXCont< LArBadFeb > LArBadFebCont
const ServiceHandle< StoreGateSvc > & detStore() const
value_type get_compact() const
Get the compact id.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
StatusCode finalize()
StatusCode execute()
StatusCode initialize()
SG::ReadCondHandleKey< LArBadFebCont > m_BFKey
Gaudi::Property< std::string > m_fileName
std::string stringStatus(const LArBadFeb &bc) const
BitWord packedData() const
Definition LArBadFeb.h:52
LArBC_t status(const HWIdentifier channel) const
Query the status of a particular channel or FEB This is the main client access method.
int feedthrough(const HWIdentifier id) const
Return the feedthrough of a hardware cell identifier : feedthrough = [0,31] Barrel - A/C side or H/...
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...
int barrel_ec(const HWIdentifier id) const
Return the position barrel or endcap of a hardware cell identifier: barrel_ec = [0,...
id_iterator feb_begin() const
Returns an iterator pointing to a feb identifier collection.
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...
id_iterator feb_end() const
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146