ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCondTools
src
LArFebRodMapConvert.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
LArFebRodMapConvert.h
"
6
7
#include "
LArIdentifier/LArOnlineID.h
"
8
#include "
AthenaPoolUtilities/AthenaAttributeList.h
"
9
#include "CoralBase/Blob.h"
10
11
#include <fstream>
12
13
LArFebRodMapConvert::LArFebRodMapConvert
(
const
std::string& name,
14
ISvcLocator* pSvcLocator ) :
15
::
AthAlgorithm
( name, pSvcLocator ),
16
m_onlineID
(nullptr)
17
{
18
19
}
20
21
LArFebRodMapConvert::~LArFebRodMapConvert
()
22
23
{}
24
25
StatusCode
LArFebRodMapConvert::initialize
() {
26
27
ATH_CHECK
(
detStore
()->retrieve(
m_onlineID
,
"LArOnlineID"
));
28
29
ATH_CHECK
(
m_cablingKey
.initialize() );
30
31
return
StatusCode::SUCCESS;
32
}
33
34
StatusCode
LArFebRodMapConvert::finalize
()
35
{
36
37
return
StatusCode::SUCCESS;
38
}
39
40
41
StatusCode
LArFebRodMapConvert::execute
(
const
EventContext& ctx) {
42
43
const
uint32_t onlHashMax=
m_onlineID
-> febHashMax();
44
45
coral::AttributeListSpecification* spec_febrod =
new
coral::AttributeListSpecification();
46
spec_febrod->extend(
"FebHashToRODs"
,
"blob"
);
47
spec_febrod->extend<
unsigned
>(
"version"
);
48
AthenaAttributeList
* al_febrod =
new
AthenaAttributeList
(*spec_febrod);
49
(*al_febrod)[
"version"
].setValue(0U);
50
coral::Blob& blobFebRod=(*al_febrod)[
"FebHashToRODs"
].data<coral::Blob>();
51
blobFebRod.resize(onlHashMax*
sizeof
(uint32_t));
52
uint32_t* pBlobFebRod=
static_cast<
uint32_t*
>
(blobFebRod.startingAddress());
53
54
spec_febrod->release();
55
// cppcheck-suppress memleak
56
spec_febrod =
nullptr
;
57
58
size_t
index
=0;
59
60
std::ofstream outfile(
"febrod.txt"
);
61
if
(!outfile.good()) {
62
ATH_MSG_ERROR
(
"Could not open output file febrod.txt"
);
63
return
StatusCode::FAILURE;
64
}
65
66
outfile <<
"hash id rodid"
<< std::endl;
67
68
SG::ReadCondHandle<LArFebRodMapping>
cablingHdl{
m_cablingKey
, ctx};
69
const
LArFebRodMapping
* cabling{*cablingHdl};
70
if
(!cabling) {
71
ATH_MSG_ERROR
(
"Do not have cabling mapping from key "
<<
m_cablingKey
.key() );
72
return
StatusCode::FAILURE;
73
}
74
75
for
(uint32_t onlHash=0;onlHash<onlHashMax;++onlHash) {
76
const
HWIdentifier
hwid=
m_onlineID
->feb_Id(onlHash);
77
#ifdef LARREADOUTMODULEID_H
//Old version
78
const
uint32_t rodid=cabling->getReadoutModuleID(hwid).id();
79
#else
//New version, LArReadoutModuleID replaced my HWIdentifier
80
const
uint32_t rodid=cabling->getReadoutModuleID(hwid).get_identifier32().get_compact();
81
#endif
82
pBlobFebRod[
index
++]=rodid;
83
outfile << onlHash <<
" 0x"
<< std:: hex << hwid.
get_compact
() <<
" 0x"
<< rodid << std::dec << std::endl;
84
}
85
86
outfile.close();
87
88
ATH_MSG_INFO
(
"BlobSize OnOffId:"
<<
index
);
89
90
ATH_CHECK
(
detStore
()->record(al_febrod,
"/LAR/Identifier/FebRodMap"
));
91
92
return
StatusCode::SUCCESS;
93
}
94
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
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
AthenaAttributeList.h
LArFebRodMapConvert.h
LArOnlineID.h
AthAlgorithm::AthAlgorithm
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
AthAlgorithm.cxx:10
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
AthenaAttributeList
An AttributeList represents a logical row of attributes in a metadata table.
Definition
PersistentDataModel/PersistentDataModel/AthenaAttributeList.h:46
HWIdentifier
Definition
HWIdentifier.h:13
Identifier::get_compact
value_type get_compact() const
Get the compact id.
LArFebRodMapConvert::finalize
virtual StatusCode finalize() override
Definition
LArFebRodMapConvert.cxx:34
LArFebRodMapConvert::LArFebRodMapConvert
LArFebRodMapConvert()
Default constructor:
LArFebRodMapConvert::m_onlineID
const LArOnlineID * m_onlineID
Definition
LArFebRodMapConvert.h:45
LArFebRodMapConvert::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
LArFebRodMapConvert.cxx:41
LArFebRodMapConvert::initialize
virtual StatusCode initialize() override
Definition
LArFebRodMapConvert.cxx:25
LArFebRodMapConvert::~LArFebRodMapConvert
virtual ~LArFebRodMapConvert()
Destructor:
Definition
LArFebRodMapConvert.cxx:21
LArFebRodMapConvert::m_cablingKey
SG::ReadCondHandleKey< LArFebRodMapping > m_cablingKey
Definition
LArFebRodMapConvert.h:40
LArFebRodMapping
Definition
LArFebRodMapping.h:17
SG::ReadCondHandle
Definition
ReadCondHandle.h:39
index
Definition
index.py:1
Generated on
for ATLAS Offline Software by
1.17.0