ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloRec
src
CaloCellMaker.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
/********************************************************************
6
7
8
NAME: CaloCellMaker.h
9
PACKAGE: offline/Calorimeter/CaloRec
10
11
AUTHORS: David Rousseau
12
CREATED: May 11, 2004
13
14
PURPOSE: Create a CaloCellContainer by calling a set of tools
15
sharing interface CaloInterface/ICaloCellMakerTool.h
16
FIXME : should see how Chronostat and MemStat report could still be obtained
17
********************************************************************/
18
19
// Gaudi includes
20
#include "GaudiKernel/IChronoStatSvc.h"
21
22
// Athena includes
23
#include "
AthenaKernel/errorcheck.h
"
24
#include "
StoreGate/WriteHandle.h
"
25
26
// Calo includes
27
#include "
CaloCellMaker.h
"
28
#include "
CaloInterface/ICaloCellMakerTool.h
"
29
#include "
CaloEvent/CaloCell.h
"
30
#include "
CaloEvent/CaloCellContainer.h
"
31
32
#include "CLHEP/Units/SystemOfUnits.h"
33
34
using
CLHEP::microsecond;
35
using
CLHEP::second;
36
37
38
StatusCode
CaloCellMaker::initialize
() {
39
40
// Retrieve ChronoStatSvc
41
if
(
m_doChronoStat
) {
42
ATH_CHECK
(
m_chrono
.retrieve() );
43
}
44
45
// access tools and store them
46
CHECK
(
m_caloCellMakerTools
.retrieve() );
47
ATH_MSG_DEBUG
(
"Successfully retrieve CaloCellMakerTools: "
<<
m_caloCellMakerTools
);
48
49
ATH_CHECK
(
m_caloCellsOutputKey
.initialize());
50
51
m_ownPolicy
=
m_ownPolicyProp
.value() ?
SG::OWN_ELEMENTS
:
SG::VIEW_ELEMENTS
;
52
53
ATH_MSG_INFO
(
" Output CaloCellContainer Name "
<<
m_caloCellsOutputKey
.key() );
54
if
(
m_ownPolicy
==
SG::OWN_ELEMENTS
) {
55
ATH_MSG_INFO
(
"...will OWN its cells."
);
56
}
else
{
57
ATH_MSG_INFO
(
"...will VIEW its cells."
);
58
}
59
return
StatusCode::SUCCESS;
60
61
}
62
63
StatusCode
CaloCellMaker::execute
(
const
EventContext& ctx)
const
{
64
65
SG::WriteHandle<CaloCellContainer>
caloCellsOutput(
m_caloCellsOutputKey
, ctx);
66
67
ATH_CHECK
( caloCellsOutput.
record
(std::make_unique<CaloCellContainer>(
static_cast<
SG::OwnershipPolicy
>
(
m_ownPolicy
))) );
68
69
// loop on tools
70
// note that finalization and checks are also done with tools
71
for
(
const
ToolHandle<ICaloCellMakerTool>& tool :
m_caloCellMakerTools
) {
72
ATH_MSG_DEBUG
(
"Calling tool "
<< tool.name() );
73
74
std::string chronoName = this->name() +
"_"
+ tool.name();
75
76
if
(
m_doChronoStat
) {
77
m_chrono
->chronoStart(chronoName);
78
}
79
StatusCode
sc
= tool->process(caloCellsOutput.
ptr
(), ctx);
80
if
(
m_doChronoStat
) {
81
m_chrono
->chronoStop(chronoName);
82
83
ATH_MSG_DEBUG
(
"Chrono stop : delta "
<<
m_chrono
->chronoDelta(chronoName, IChronoStatSvc::USER) * (microsecond / second) <<
" second "
);
84
}
85
86
if
(
sc
.isFailure()) {
87
ATH_MSG_ERROR
(
"Error executing tool "
<< tool.name() );
88
}
89
}
90
91
return
StatusCode::SUCCESS;
92
}
93
94
StatusCode
CaloCellMaker::finalize
() {
95
96
return
StatusCode::SUCCESS;
97
98
}
99
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:32
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:30
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:28
CaloCellContainer.h
CaloCellMaker.h
CaloCell.h
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition
Control/AthenaKernel/AthenaKernel/errorcheck.h:422
ICaloCellMakerTool.h
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
WriteHandle.h
Handle class for recording to StoreGate.
CaloCellMaker::m_doChronoStat
Gaudi::Property< bool > m_doChronoStat
Definition
CaloCellMaker.h:50
CaloCellMaker::m_ownPolicy
SG::OwnershipPolicy m_ownPolicy
Definition
CaloCellMaker.h:54
CaloCellMaker::m_caloCellsOutputKey
SG::WriteHandleKey< CaloCellContainer > m_caloCellsOutputKey
Output cell continer to be used.
Definition
CaloCellMaker.h:57
CaloCellMaker::initialize
virtual StatusCode initialize() override
Definition
CaloCellMaker.cxx:38
CaloCellMaker::m_chrono
ServiceHandle< IChronoStatSvc > m_chrono
ChronoStatSvc.
Definition
CaloCellMaker.h:49
CaloCellMaker::finalize
virtual StatusCode finalize() override
Definition
CaloCellMaker.cxx:94
CaloCellMaker::m_ownPolicyProp
Gaudi::Property< bool > m_ownPolicyProp
Definition
CaloCellMaker.h:53
CaloCellMaker::m_caloCellMakerTools
ToolHandleArray< ICaloCellMakerTool > m_caloCellMakerTools
Array of CellMaker (and corrector) AlgTools.
Definition
CaloCellMaker.h:60
CaloCellMaker::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
CaloCellMaker.cxx:63
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
SG::OwnershipPolicy
OwnershipPolicy
Definition
OwnershipPolicy.h:16
SG::OWN_ELEMENTS
@ OWN_ELEMENTS
this data object owns its elements
Definition
OwnershipPolicy.h:17
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition
OwnershipPolicy.h:18
Generated on
for ATLAS Offline Software by
1.17.0