ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArCalibUtils
src
LArHVCorrMaker.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// Include files
6
#include "
LArCalibUtils/LArHVCorrMaker.h
"
7
#include "
LArIdentifier/LArOnlineID.h
"
8
#include "
LArIdentifier/LArOnline_SuperCellID.h
"
9
#include "
AthenaPoolUtilities/CondAttrListCollection.h
"
10
#include "
AthenaPoolUtilities/AthenaAttributeList.h
"
11
#include "CoralBase/Blob.h"
12
#include "
LArCOOLConditions/LArHVScaleCorrFlat.h
"
13
#include "
LArRecConditions/LArHVCorr.h
"
14
#include "
StoreGate/ReadCondHandle.h
"
15
16
#include <cmath>
17
#include <unistd.h>
18
19
20
21
22
//---------------------------------------------------------------------------
23
LArHVCorrMaker::~LArHVCorrMaker
()
24
=
default
;
25
26
//---------------------------------------------------------------------------
27
StatusCode
LArHVCorrMaker::initialize
()
28
{
29
ATH_MSG_INFO
(
" in initialize "
);
30
ATH_CHECK
(
m_scaleCorrKey
.initialize() );
31
ATH_CHECK
(
m_cablingKey
.initialize() );
32
return
StatusCode::SUCCESS;
33
}
34
35
36
//---------------------------------------------------------------------------
37
StatusCode
LArHVCorrMaker::execute
(
const
EventContext&
/*ctx*/
)
38
{
39
return
StatusCode::SUCCESS;
40
}
41
42
43
//---------------------------------------------------------------------------
44
StatusCode
LArHVCorrMaker::stop
()
45
{
46
ATH_MSG_INFO
(
" in stop"
);
47
48
const
EventContext& ctx = Gaudi::Hive::currentContext();
49
50
SG::ReadCondHandle<LArOnOffIdMapping>
cabling (
m_cablingKey
, ctx);
51
52
SG::ReadCondHandle<ILArHVScaleCorr>
scaleCorr (
m_scaleCorrKey
, ctx);
53
54
const
LArOnlineID_Base
* lar_on_id =
nullptr
;
55
if
(
m_isSC
) {
56
const
LArOnline_SuperCellID
* scid=
nullptr
;
57
ATH_CHECK
(
detStore
()->retrieve(scid,
"LArOnline_SuperCellID"
) );
58
lar_on_id=scid;
59
}
else
{
60
const
LArOnlineID
* lid=
nullptr
;
61
ATH_CHECK
(
detStore
()->retrieve(lid,
"LArOnlineID"
) );
62
lar_on_id=lid;
63
}
64
65
const
unsigned
hashMax=lar_on_id->
channelHashMax
();
66
coral::AttributeListSpecification* spec =
new
coral::AttributeListSpecification;
67
spec->extend(
"HVScaleCorr"
,
"blob"
);
68
spec->extend<
unsigned
>(
"version"
);
69
auto
coll = std::make_unique<CondAttrListCollection>(
true
);
70
coral::AttributeList attrList(*spec);
71
spec->release();
72
attrList[
"version"
].setValue(0U);
73
coral::Blob& blob=attrList[
"HVScaleCorr"
].data<coral::Blob>();
74
blob.resize(hashMax*
sizeof
(
float
));
75
float
* pblob=
static_cast<
float
*
>
(blob.startingAddress());
76
//Loop over online hash (to make sure that *every* field of the blob gets filled
77
for
(
unsigned
hs=0;hs<hashMax;++hs) {
78
float
value=1.0;
79
if
(cabling->isOnlineConnectedFromHash(hs)) {
80
const
Identifier
id
=cabling->cnvToIdentifierFromHash(hs);
81
const
HWIdentifier
hwid = cabling->createSignalChannelID (
id
);
82
ATH_MSG_VERBOSE
(
"Filling value for id "
<<
id
.get_identifier32().get_compact());
83
value=scaleCorr->HVScaleCorr(hwid);
84
}
85
pblob[hs]=value;
86
}
87
88
if
(
m_isSC
) {
89
coll->add(0,attrList);
//Add as channel 0 to AttrListCollection
90
}
else
{
91
coll->add(1,attrList);
//Add as channel 1 to AttrListCollection
92
}
93
94
ATH_CHECK
(
detStore
()->record(std::move(coll),
m_folderName
) );
95
return
StatusCode::SUCCESS;
96
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
AthenaAttributeList.h
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
LArHVCorrMaker.h
LArHVCorr.h
LArHVScaleCorrFlat.h
LArOnlineID.h
LArOnline_SuperCellID.h
ReadCondHandle.h
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
HWIdentifier
Definition
HWIdentifier.h:13
LArHVCorrMaker::m_cablingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
Definition
LArHVCorrMaker.h:49
LArHVCorrMaker::m_scaleCorrKey
SG::ReadCondHandleKey< ILArHVScaleCorr > m_scaleCorrKey
Definition
LArHVCorrMaker.h:47
LArHVCorrMaker::stop
virtual StatusCode stop() override
Definition
LArHVCorrMaker.cxx:44
LArHVCorrMaker::initialize
virtual StatusCode initialize() override
Definition
LArHVCorrMaker.cxx:27
LArHVCorrMaker::m_folderName
Gaudi::Property< std::string > m_folderName
Definition
LArHVCorrMaker.h:42
LArHVCorrMaker::~LArHVCorrMaker
virtual ~LArHVCorrMaker()
LArHVCorrMaker::execute
virtual StatusCode execute(const EventContext &ctx) override
Execute method.
Definition
LArHVCorrMaker.cxx:37
LArHVCorrMaker::m_isSC
BooleanProperty m_isSC
Definition
LArHVCorrMaker.h:44
LArOnlineID_Base
Helper for the Liquid Argon Calorimeter cell identifiers.
Definition
LArOnlineID_Base.h:97
LArOnlineID_Base::channelHashMax
size_type channelHashMax() const
Define channel hash tables max size.
Definition
LArOnlineID_Base.cxx:1607
LArOnlineID
Definition
LArOnlineID.h:21
LArOnline_SuperCellID
Definition
LArOnline_SuperCellID.h:21
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
Identifier
Definition
IdentifierFieldParser.cxx:14
Generated on
for ATLAS Offline Software by
1.17.0