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-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// $Id$
12
13
14
#include "
CaloConstCellMaker.h
"
15
#include "
CaloInterface/ICaloConstCellMakerTool.h
"
16
17
#include "
AthenaKernel/Chrono.h
"
18
#include "
AthenaKernel/errorcheck.h
"
19
#include "GaudiKernel/IChronoStatSvc.h"
20
#include "CLHEP/Units/SystemOfUnits.h"
21
#include <memory>
22
23
using
CLHEP::microsecond;
24
using
CLHEP::second;
25
26
32
CaloConstCellMaker::CaloConstCellMaker
(
const
std::string& name,
33
ISvcLocator* pSvcLocator)
34
:
AthReentrantAlgorithm
(name, pSvcLocator),
35
m_caloCellMakerTools
(this),
36
m_caloCellsOutputKey
(
""
),
37
m_chrono
(
"ChronoStatSvc"
, name)
38
{
39
declareProperty
(
"OwnPolicy"
,
m_ownPolicy
=
static_cast<
int
>
(
SG::VIEW_ELEMENTS
),
40
"Will the new container own its cells? Default is no."
);
41
declareProperty
(
"CaloCellMakerTools"
,
m_caloCellMakerTools
,
42
"List of tools to run."
);
43
declareProperty
(
"CaloCellsOutputName"
,
m_caloCellsOutputKey
,
44
"Output container name."
);
45
}
46
47
51
StatusCode
CaloConstCellMaker::initialize
()
52
{
53
ATH_CHECK
(
m_chrono
.retrieve() );
54
55
// access tools and store them
56
ATH_CHECK
(
m_caloCellMakerTools
.retrieve() );
57
ATH_CHECK
(
m_caloCellsOutputKey
.initialize());
58
59
ATH_MSG_DEBUG
(
"Successfully retrieved CaloConstCellMakerTools: "
60
<<
m_caloCellMakerTools
);
61
62
ATH_MSG_INFO
(
" Output CaloConstCellContainer Name "
63
<<
m_caloCellsOutputKey
.key() );
64
if
(
m_ownPolicy
==
SG::OWN_ELEMENTS
) {
65
ATH_MSG_INFO
(
"...will OWN its cells."
);
66
}
else
{
67
ATH_MSG_INFO
(
"...will VIEW its cells."
);
68
}
69
70
return
StatusCode::SUCCESS;
71
}
72
73
77
StatusCode
CaloConstCellMaker::execute
(
const
EventContext& ctx)
const
78
{
79
// Create empty container.
80
81
SG::WriteHandle<CaloConstCellContainer>
theContainer(
m_caloCellsOutputKey
, ctx);
82
ATH_CHECK
( theContainer.
record
(std::make_unique<CaloConstCellContainer>(
static_cast<
SG::OwnershipPolicy
>
(
m_ownPolicy
))) );
83
84
// Loop on tools.
85
// Note that finalization and checks are also done with tools.
86
for
(
const
auto
& tool :
m_caloCellMakerTools
) {
87
// For performance reasons want to remove the cell-checker tool
88
// from the list of tools after the fifth event.
89
if
(ctx.evt() > 5) {
90
if
(tool.typeAndName() ==
"CaloCellContainerCheckerTool/CaloCellContainerCheckerTool"
)
91
continue
;
92
}
93
94
ATH_MSG_DEBUG
(
"Calling tool "
<< tool.name() );
95
96
std::string chronoName = this->name() +
"_"
+ tool.name();
97
98
StatusCode
sc
;
99
sc
.ignore();
100
{
101
Athena::Chrono
give_me_a_name (chronoName, &*
m_chrono
);
102
sc
= tool->process(theContainer.
ptr
(), ctx);
103
}
104
105
ATH_MSG_DEBUG
(
"Chrono stop : delta "
106
<<
m_chrono
->chronoDelta(chronoName, IChronoStatSvc::USER) * (microsecond / second)
107
<<
" second "
);
108
109
if
(
sc
.isFailure()) {
110
ATH_MSG_ERROR
(
"Error executing tool "
<< tool.name() );
111
}
112
}
113
114
115
return
StatusCode::SUCCESS;
116
}
117
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:33
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloConstCellMaker.h
Chrono.h
Exception-safe IChronoSvc caller.
errorcheck.h
Helpers for checking error return status codes and reporting errors.
ICaloConstCellMakerTool.h
Operate on pointers to const CaloCell.
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
AthCommonAlgorithm< Gaudi::Algorithm >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
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:32
CaloConstCellMaker::m_ownPolicy
int m_ownPolicy
Property: Will the new CellContainer will own its cells (default no)?
Definition
CaloConstCellMaker.h:56
CaloConstCellMaker::m_chrono
ServiceHandle< IChronoStatSvc > m_chrono
For timekeeping.
Definition
CaloConstCellMaker.h:65
CaloConstCellMaker::m_caloCellMakerTools
ToolHandleArray< ICaloConstCellMakerTool > m_caloCellMakerTools
Property: List of tools to run.
Definition
CaloConstCellMaker.h:59
CaloConstCellMaker::initialize
virtual StatusCode initialize() override
Standard Gaudi initialize method.
Definition
CaloConstCellMaker.cxx:51
CaloConstCellMaker::execute
virtual StatusCode execute(const EventContext &ctx) const override
Standard Gaudi execute method.
Definition
CaloConstCellMaker.cxx:77
CaloConstCellMaker::m_caloCellsOutputKey
SG::WriteHandleKey< CaloConstCellContainer > m_caloCellsOutputKey
Property: Output container key.
Definition
CaloConstCellMaker.h:62
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