ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloRec
src
CaloClusterCorrDBWriter.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
//-----------------------------------------------------------------------
6
//
7
// Description: see CaloClusterCorrDBWriter.h
8
//-----------------------------------------------------------------------
9
10
11
#include "
CaloClusterCorrDBWriter.h
"
12
#include "GaudiKernel/ThreadLocalContext.h"
13
14
#include "
CaloConditions/ToolConstants.h
"
15
#include "
AthenaPoolUtilities/CondAttrListCollection.h
"
16
#include "
AthenaKernel/errorcheck.h
"
17
18
19
using namespace
CaloRec
;
20
21
//#############################################################################
22
23
StatusCode
CaloClusterCorrDBWriter::initialize
()
24
{
25
ATH_CHECK
(
m_blobTool
.retrieve());
26
ATH_CHECK
(
m_tools
.retrieve());
27
REPORT_MESSAGE
(MSG::INFO) <<
m_key
<<
": "
28
<<
"Found "
<<
m_tools
.size() <<
29
" tools."
;
30
return
StatusCode::SUCCESS;
31
}
32
33
//#############################################################################
34
35
StatusCode
CaloClusterCorrDBWriter::finalize
()
36
{
37
const
EventContext& ctx = Gaudi::Hive::currentContext();
38
if
(!
m_inlineFolder
.empty()) {
39
CaloRec::ToolConstants
tc
;
40
std::string toolnames;
41
unsigned
coolChannelNbr=
m_blobTool
->nameToChannelNumber(
m_key
);
42
CondAttrListCollection
* attrColl=
nullptr
;
43
if
(
detStore
()->
contains<CondAttrListCollection>
(
m_inlineFolder
)) {
44
CHECK
(
detStore
()->retrieve(attrColl,
m_inlineFolder
));
45
}
46
else
{
47
attrColl=
new
CondAttrListCollection
(
true
);
48
CHECK
(
detStore
()->record(attrColl,
m_inlineFolder
));
49
}
50
51
for
(
size_t
i = 0; i <
m_tools
.size(); i++) {
52
CHECK
(
m_tools
[i]->mergeConstants (
tc
, ctx) );
53
toolnames +=
m_tools
[i]->name() +
" "
;
54
}
55
coral::AttributeList* attrList=
m_blobTool
->ToolConstantsToAttrList(&
tc
);
56
if
(!attrList)
57
return
StatusCode::FAILURE;
58
59
const
std::string& tName=
m_key
;
60
attrColl->
add
(coolChannelNbr,tName);
61
attrColl->
add
(coolChannelNbr,*attrList);
62
63
delete
attrList;
64
65
66
REPORT_MESSAGE
(MSG::INFO) <<
"Recorded CondAttributeListCollection with key "
<<
m_inlineFolder
<<
" channel name "
<<
m_key
67
<<
" to DetStore.\n Tools: "
<< toolnames;
68
}
69
else
{
70
auto
tc
= std::make_unique<CaloRec::ToolConstants>();
71
std::string toolnames;
72
for
(
size_t
i = 0; i <
m_tools
.size(); i++) {
73
CHECK
(
m_tools
[i]->mergeConstants (*
tc
, ctx) );
74
toolnames +=
m_tools
[i]->name() +
" "
;
75
}
76
77
CHECK
(
detStore
()->record (std::move(
tc
),
m_key
) );
78
REPORT_MESSAGE
(MSG::INFO) <<
"Recorded constants for key "
<<
m_key
79
<<
" to DetStore.\n Tools: "
<< toolnames;
80
}
//end else m_inline
81
82
83
84
85
//std::cout << detStore()->dump() << std::endl;
86
87
88
return
StatusCode::SUCCESS;
89
}
90
91
//#############################################################################
92
93
StatusCode
CaloClusterCorrDBWriter::execute
(
const
EventContext&
/*ctx*/
)
const
94
{
95
// Make sure the detector store gets created.
96
(void)
detStore
()->name();
97
return
StatusCode::SUCCESS;
98
}
99
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
CaloClusterCorrDBWriter.h
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
errorcheck.h
Helpers for checking error return status codes and reporting errors.
REPORT_MESSAGE
#define REPORT_MESSAGE(LVL)
Report a message.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:365
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
tc
static Double_t tc
Definition
LArPhysWaveHECTool.cxx:38
ToolConstants.h
Container for the tool constants managed by ToolWithConstants.
AthCommonAlgorithm< Gaudi::Algorithm >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
Definition
AthCommonDataStore.h:95
CaloClusterCorrDBWriter::initialize
virtual StatusCode initialize() override
Definition
CaloClusterCorrDBWriter.cxx:23
CaloClusterCorrDBWriter::m_inlineFolder
StringProperty m_inlineFolder
Definition
CaloClusterCorrDBWriter.h:53
CaloClusterCorrDBWriter::m_blobTool
ToolHandle< Blob2ToolConstants > m_blobTool
Definition
CaloClusterCorrDBWriter.h:56
CaloClusterCorrDBWriter::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
CaloClusterCorrDBWriter.cxx:93
CaloClusterCorrDBWriter::finalize
virtual StatusCode finalize() override
Definition
CaloClusterCorrDBWriter.cxx:35
CaloClusterCorrDBWriter::m_key
StringProperty m_key
Key for the DetectorStore (jobOptions) The ToolConstants will be recorded with this key.
Definition
CaloClusterCorrDBWriter.h:50
CaloClusterCorrDBWriter::m_tools
ToolHandleArray< IToolWithConstants > m_tools
The list of tools.
Definition
CaloClusterCorrDBWriter.h:44
CaloRec::ToolConstants
Container for the tool constants managed by ToolWithConstants.
Definition
ToolConstants.h:32
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number.
Definition
CondAttrListCollection.h:51
CondAttrListCollection::add
bool add(ChanNum chanNum, const AttributeList &attributeList)
Adding in chan/attrList pairs.
Definition
CondAttrListCollection.h:451
contains
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
Definition
hcg.cxx:116
CaloRec
Namespace for helper functions.
Definition
CaloCellPositionShift.h:23
Generated on
for ATLAS Offline Software by
1.17.0