ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArTest
LArConditionsTest
src
LArCablingTest.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
LArConditionsTest/LArCablingTest.h
"
6
7
#include "
LArIdentifier/LArOnlineID.h
"
8
#include "
CaloIdentifier/CaloIdManager.h
"
9
#include "
CaloIdentifier/CaloCell_ID.h
"
10
#include "
StoreGate/StoreGateSvc.h
"
11
#include <fstream>
12
13
LArCablingTest::LArCablingTest
(
const
std::string& name, ISvcLocator* pSvcLocator):
14
AthAlgorithm
(name, pSvcLocator),
m_print
(true),
15
m_onlineId
(0),
16
m_caloCellId
(0)
17
{
18
declareProperty
(
"Print"
,
m_print
=
true
);
19
declareProperty
(
"TestMode"
,
m_mode
=0xF,
20
"1: On->Off, 2: Off->On 4: disconnected, 8: FEB->ROD"
);
21
}
22
23
LArCablingTest::~LArCablingTest
() {
24
}
25
26
StatusCode
LArCablingTest::initialize
() {
27
detStore
()->retrieve(
m_onlineId
,
"LArOnlineID"
).ignore();
28
detStore
()->retrieve(
m_caloCellId
,
"CaloCell_ID"
).ignore();
29
30
ATH_CHECK
(
m_cablingKey
.initialize() );
31
ATH_CHECK
(
m_CLKey
.initialize() );
32
ATH_CHECK
(
m_RodKey
.initialize() );
33
34
return
StatusCode::SUCCESS;
35
}
36
37
38
39
StatusCode
LArCablingTest::execute
(
const
EventContext& ctx) {
40
41
std::ofstream outfile;
42
if
(
m_print
) {
43
outfile.open(
"identifiers.txt"
);
44
outfile <<
"hash id bec pn FT SL chan id calo pn sampl reg eta phi calib"
<< std::endl;
45
}
46
SG::ReadCondHandle<LArOnOffIdMapping>
cablingHdl{
m_cablingKey
, ctx};
47
const
LArOnOffIdMapping
* cabling{*cablingHdl};
48
if
(!cabling){
49
ATH_MSG_ERROR
(
"Do not have mapping object "
<<
m_cablingKey
.key() );
50
return
StatusCode::FAILURE;
51
}
52
SG::ReadCondHandle<LArCalibLineMapping>
clHdl{
m_CLKey
, ctx};
53
const
LArCalibLineMapping
*clCont {*clHdl};
54
if
(!clCont){
55
ATH_MSG_ERROR
(
"Do not have calib mapping object "
<<
m_CLKey
.key() );
56
return
StatusCode::FAILURE;
57
}
58
SG::ReadCondHandle<LArFebRodMapping>
rodHdl{
m_RodKey
, ctx};
59
const
LArFebRodMapping
*rodCont {*rodHdl};
60
if
(!rodCont){
61
ATH_MSG_ERROR
(
"Do not have ROD mapping object "
<<
m_RodKey
.key() );
62
return
StatusCode::FAILURE;
63
}
64
if
(
m_mode
& 1) {
65
for
(
HWIdentifier
hwid :
m_onlineId
->channel_range()) {
66
if
(
m_print
)
67
print
(hwid,outfile,cabling,clCont);
68
const
Identifier
id
=cabling->cnvToIdentifier(hwid);
69
if
(
m_print
)
70
if
(
id
!=
Identifier
())
71
std::cout <<
"ON:OFF 0x"
<< hwid.get_identifier32().get_compact() <<
":0x"
<<
id
.get_identifier32().get_compact() << std::dec << std::endl;
72
}
73
}
74
if
(
m_mode
& 2) {
75
for
(
Identifier
id
:
m_caloCellId
->cell_range()) {
76
if
(!
m_caloCellId
->is_tile(
id
)) {
77
const
HWIdentifier
hwid=cabling->createSignalChannelID(
id
);
78
if
(
m_print
)
79
std::cout <<
"OFF:ON 0x"
<< std::hex <<
id
.get_identifier32().get_compact() <<
":0x"
<<hwid.
get_identifier32
().
get_compact
() << std::dec << std::endl;
80
}
81
}
82
}
83
if
(
m_mode
& 4) {
84
for
(
HWIdentifier
hwid :
m_onlineId
->channel_range()) {
85
bool
result=cabling->isOnlineConnected(hwid);
86
if
(
m_print
)
87
std::cout <<
"Connected 0x"
<< std::hex << hwid.get_identifier32().get_compact() <<
":"
<<result << std::dec << std::endl;
88
}
89
}
90
91
if
(
m_mode
& 8) {
92
for
(
HWIdentifier
FEBID :
m_onlineId
->feb_range()) {
93
#ifdef LARREADOUTMODULEID_H
//Old version
94
const
uint32_t RODID=rodCont->
getReadoutModuleID
(FEBID).id();
95
#else
//New version, LArReadoutModuleID replaced my HWIdentifier
96
const
uint32_t RODID=rodCont->
getReadoutModuleID
(FEBID).
get_identifier32
().
get_compact
();
97
#endif
98
if
(
m_print
) {
99
std::cout <<
"FEB:ROD 0x"
<< FEBID.get_identifier32().get_compact() <<
":0x"
<<
100
RODID << std::dec << std::endl;
101
}
102
}
//end loop over FEBs
103
}
104
if
(
m_print
)
105
outfile.close();
106
m_print
=
false
;
107
return
StatusCode::SUCCESS;
108
}
109
110
111
112
void
LArCablingTest::print
(
const
HWIdentifier
& hwid, std::ostream& out,
const
LArOnOffIdMapping
* cabling,
const
LArCalibLineMapping
*clCont) {
113
const
IdentifierHash
hwid_hash=
m_onlineId
->channel_Hash(hwid);
114
out << hwid_hash <<
" "
<< std::hex <<
"0x"
<< hwid.
get_identifier32
().
get_compact
() << std::dec <<
" "
115
<<
m_onlineId
->barrel_ec(hwid) <<
" "
116
<<
m_onlineId
->pos_neg(hwid) <<
" "
117
<<
m_onlineId
->feedthrough(hwid) <<
" "
118
<<
m_onlineId
->slot(hwid) <<
" "
119
<<
m_onlineId
->channel(hwid) <<
" : "
;
120
if
(cabling->isOnlineConnected(hwid)) {
121
const
Identifier
id
=cabling->cnvToIdentifier(hwid);
122
out << std::hex <<
"0x"
<<
id
.get_identifier32().get_compact() << std::dec <<
" "
123
<<
m_caloCellId
->sub_calo(
id
) <<
" "
124
<<
m_caloCellId
->pos_neg(
id
) <<
" "
125
<<
m_caloCellId
->sampling(
id
) <<
" "
126
<<
m_caloCellId
->region(
id
) <<
" "
127
<<
m_caloCellId
->eta(
id
) <<
" "
128
<<
m_caloCellId
->phi(
id
) <<
" "
;
129
}
130
else
131
out <<
" disconnected "
;
132
133
const
std::vector<HWIdentifier>& calibIDs=clCont->
calibSlotLine
(hwid);
134
for
(
size_t
i=0;i<calibIDs.size();++i) {
135
out << std::hex <<
"0x"
<< calibIDs[i].get_identifier32().get_compact() <<
" "
;
136
}
137
out << std::dec << std::endl;
138
}
139
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:47
CaloCell_ID.h
CaloIdManager.h
LArCablingTest.h
LArOnlineID.h
StoreGateSvc.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
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
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
Identifier::get_identifier32
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
LArCablingTest::m_caloCellId
const CaloCell_ID * m_caloCellId
Definition
LArCablingTest.h:40
LArCablingTest::initialize
StatusCode initialize()
Definition
LArCablingTest.cxx:26
LArCablingTest::LArCablingTest
LArCablingTest(const std::string &name, ISvcLocator *pSvcLocator)
Definition
LArCablingTest.cxx:13
LArCablingTest::execute
StatusCode execute(const EventContext &ctx)
Execute method.
Definition
LArCablingTest.cxx:39
LArCablingTest::m_RodKey
SG::ReadCondHandleKey< LArFebRodMapping > m_RodKey
Definition
LArCablingTest.h:35
LArCablingTest::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition
LArCablingTest.h:33
LArCablingTest::m_print
bool m_print
Definition
LArCablingTest.h:37
LArCablingTest::m_mode
unsigned m_mode
Definition
LArCablingTest.h:38
LArCablingTest::m_onlineId
const LArOnlineID * m_onlineId
Definition
LArCablingTest.h:39
LArCablingTest::m_CLKey
SG::ReadCondHandleKey< LArCalibLineMapping > m_CLKey
Definition
LArCablingTest.h:34
LArCablingTest::~LArCablingTest
~LArCablingTest()
Definition
LArCablingTest.cxx:23
LArCablingTest::print
void print(const HWIdentifier &hwid, std::ostream &out, const LArOnOffIdMapping *cabling, const LArCalibLineMapping *clCont)
Definition
LArCablingTest.cxx:112
LArCalibLineMapping
Definition
LArCalibLineMapping.h:17
LArCalibLineMapping::calibSlotLine
const std::vector< HWIdentifier > & calibSlotLine(const HWIdentifier id) const
Definition
LArCalibLineMapping.cxx:15
LArFebRodMapping
Definition
LArFebRodMapping.h:17
LArFebRodMapping::getReadoutModuleID
HWIdentifier getReadoutModuleID(const HWIdentifier &id) const
Definition
LArFebRodMapping.cxx:15
LArOnOffIdMapping
Definition
LArOnOffIdMapping.h:20
SG::ReadCondHandle
Definition
ReadCondHandle.h:39
Identifier
Definition
IdentifierFieldParser.cxx:14
Generated on
for ATLAS Offline Software by
1.17.0