ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArBadChannelTool
src
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
5
#include "
LArBadChannelTool/LArBadFeb2Ascii.h
"
6
7
#include "
LArBadChannelTool/LArBadChannelDBTools.h
"
8
#include "
LArIdentifier/LArOnlineID.h
"
9
#include <format>
10
#include <fstream>
11
12
13
StatusCode
LArBadFeb2Ascii::initialize
() {
14
15
ATH_MSG_INFO
(
"initialize()"
);
16
ATH_CHECK
(
m_BFKey
.initialize());
17
return
StatusCode::SUCCESS;
18
}
19
20
StatusCode
LArBadFeb2Ascii::execute
(
const
EventContext&
/*ctx*/
)
21
{
return
StatusCode::SUCCESS;}
22
23
StatusCode
LArBadFeb2Ascii::finalize
() {
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
40
SG::ReadCondHandle<LArBadFebCont>
bfc{
m_BFKey
};
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
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
LArBadFebCont
LArBadXCont< LArBadFeb > LArBadFebCont
Definition
LArBadChannelCont.h:115
LArBadChannelDBTools.h
LArBadFeb2Ascii.h
LArOnlineID.h
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
HWIdentifier
Definition
HWIdentifier.h:13
Identifier32::get_compact
value_type get_compact() const
Get the compact id.
Definition
Identifier32.h:47
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
LArBadFeb2Ascii::finalize
StatusCode finalize()
Definition
LArBadFeb2Ascii.cxx:23
LArBadFeb2Ascii::execute
StatusCode execute(const EventContext &ctx)
Execute method.
Definition
LArBadFeb2Ascii.cxx:20
LArBadFeb2Ascii::initialize
StatusCode initialize()
Definition
LArBadFeb2Ascii.cxx:13
LArBadFeb2Ascii::m_BFKey
SG::ReadCondHandleKey< LArBadFebCont > m_BFKey
Definition
LArBadFeb2Ascii.h:27
LArBadFeb2Ascii::m_fileName
Gaudi::Property< std::string > m_fileName
Definition
LArBadFeb2Ascii.h:28
LArBadFebBitPacking
Definition
LArBadFebBitPacking.h:16
LArBadFebBitPacking::stringStatus
std::string stringStatus(const LArBadFeb &bc) const
Definition
LArBadFebBitPacking.cxx:86
LArBadFeb
Definition
LArBadFeb.h:10
LArBadFeb::packedData
BitWord packedData() const
Definition
LArBadFeb.h:52
LArBadXCont::status
LArBC_t status(const HWIdentifier channel) const
Query the status of a particular channel or FEB This is the main client access method.
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:1654
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:1667
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:1648
LArOnlineID_Base::feb_begin
id_iterator feb_begin() const
Returns an iterator pointing to a feb identifier collection.
Definition
LArOnlineID_Base.cxx:1616
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:1660
LArOnlineID_Base::feb_end
id_iterator feb_end() const
Definition
LArOnlineID_Base.cxx:1621
LArOnlineID
Definition
LArOnlineID.h:21
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
count
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
Definition
hcg.cxx:148
Generated on
for ATLAS Offline Software by
1.17.0