ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloRec
src
CaloConstCellMaker.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// $Id$
12
13
14
#include "
CaloConstCellMaker.h
"
15
16
#include "
AthenaKernel/Chrono.h
"
17
#include "
AthenaKernel/errorcheck.h
"
18
#include "GaudiKernel/IChronoStatSvc.h"
19
#include "CLHEP/Units/SystemOfUnits.h"
20
#include <memory>
21
22
using
CLHEP::microsecond;
23
using
CLHEP::second;
24
25
31
CaloConstCellMaker::CaloConstCellMaker
(
const
std::string& name,
32
ISvcLocator* pSvcLocator)
33
:
AthReentrantAlgorithm
(name, pSvcLocator),
34
m_chrono
(
"ChronoStatSvc"
, name)
35
{
36
}
37
38
42
StatusCode
CaloConstCellMaker::initialize
()
43
{
44
ATH_CHECK
(
m_chrono
.retrieve() );
45
46
// access tools and store them
47
ATH_CHECK
(
m_caloCellMakerTools
.retrieve() );
48
ATH_CHECK
(
m_caloCellsOutputKey
.initialize());
49
50
ATH_MSG_DEBUG
(
"Successfully retrieved CaloConstCellMakerTools: "
51
<<
m_caloCellMakerTools
);
52
53
ATH_MSG_INFO
(
" Output CaloConstCellContainer Name "
54
<<
m_caloCellsOutputKey
.key() );
55
if
(
m_ownPolicy
==
SG::OWN_ELEMENTS
) {
56
ATH_MSG_INFO
(
"...will OWN its cells."
);
57
}
else
{
58
ATH_MSG_INFO
(
"...will VIEW its cells."
);
59
}
60
61
return
StatusCode::SUCCESS;
62
}
63
64
68
StatusCode
CaloConstCellMaker::execute
(
const
EventContext& ctx)
const
69
{
70
// Create empty container.
71
72
SG::WriteHandle<CaloConstCellContainer>
theContainer(
m_caloCellsOutputKey
, ctx);
73
ATH_CHECK
( theContainer.
record
(std::make_unique<CaloConstCellContainer>(
static_cast<
SG::OwnershipPolicy
>
(
m_ownPolicy
.value()))) );
74
75
// Loop on tools.
76
// Note that finalization and checks are also done with tools.
77
for
(
const
auto
& tool :
m_caloCellMakerTools
) {
78
// For performance reasons want to remove the cell-checker tool
79
// from the list of tools after the fifth event.
80
if
(ctx.evt() > 5) {
81
if
(tool.typeAndName() ==
"CaloCellContainerCheckerTool/CaloCellContainerCheckerTool"
)
82
continue
;
83
}
84
85
ATH_MSG_DEBUG
(
"Calling tool "
<< tool.name() );
86
87
std::string chronoName = this->name() +
"_"
+ tool.name();
88
89
StatusCode
sc
;
90
sc
.ignore();
91
{
92
Athena::Chrono
give_me_a_name (chronoName, &*
m_chrono
);
93
sc
= tool->process(theContainer.
ptr
(), ctx);
94
}
95
96
ATH_MSG_DEBUG
(
"Chrono stop : delta "
97
<<
m_chrono
->chronoDelta(chronoName, IChronoStatSvc::USER) * (microsecond / second)
98
<<
" second "
);
99
100
if
(
sc
.isFailure()) {
101
ATH_MSG_ERROR
(
"Error executing tool "
<< tool.name() );
102
}
103
}
104
105
106
return
StatusCode::SUCCESS;
107
}
108
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x,...)
Definition
AthMsgStreamMacros.h:47
ATH_MSG_INFO
#define ATH_MSG_INFO(x,...)
Definition
AthMsgStreamMacros.h:45
CaloConstCellMaker.h
Chrono.h
Exception-safe IChronoSvc caller.
errorcheck.h
Helpers for checking error return status codes and reporting errors.
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
Athena::Chrono
Exception-safe IChronoSvc caller.
Definition
Chrono.h:50
CaloConstCellMaker::CaloConstCellMaker
CaloConstCellMaker(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition
CaloConstCellMaker.cxx:31
CaloConstCellMaker::m_chrono
ServiceHandle< IChronoStatSvc > m_chrono
For timekeeping.
Definition
CaloConstCellMaker.h:66
CaloConstCellMaker::m_caloCellMakerTools
ToolHandleArray< ICaloConstCellMakerTool > m_caloCellMakerTools
Property: List of tools to run.
Definition
CaloConstCellMaker.h:60
CaloConstCellMaker::initialize
virtual StatusCode initialize() override
Standard Gaudi initialize method.
Definition
CaloConstCellMaker.cxx:42
CaloConstCellMaker::execute
virtual StatusCode execute(const EventContext &ctx) const override
Standard Gaudi execute method.
Definition
CaloConstCellMaker.cxx:68
CaloConstCellMaker::m_caloCellsOutputKey
SG::WriteHandleKey< CaloConstCellContainer > m_caloCellsOutputKey
Property: Output container key.
Definition
CaloConstCellMaker.h:63
CaloConstCellMaker::m_ownPolicy
Gaudi::Property< int > m_ownPolicy
Property: Will the new CellContainer will own its cells (default no)?
Definition
CaloConstCellMaker.h:57
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:71
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
Generated on
for ATLAS Offline Software by
1.17.0