ATLAS Offline Software
Loading...
Searching...
No Matches
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
25
26// Calo includes
27#include "CaloCellMaker.h"
29#include "CaloEvent/CaloCell.h"
31
32#include "CLHEP/Units/SystemOfUnits.h"
33
34using CLHEP::microsecond;
35using CLHEP::second;
36
37
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
52
53 ATH_MSG_INFO( " Output CaloCellContainer Name " << m_caloCellsOutputKey.key() );
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
63StatusCode CaloCellMaker::execute (const EventContext& ctx) const {
64
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
95
96 return StatusCode::SUCCESS;
97
98}
99
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
static Double_t sc
Handle class for recording to StoreGate.
Gaudi::Property< bool > m_doChronoStat
SG::OwnershipPolicy m_ownPolicy
SG::WriteHandleKey< CaloCellContainer > m_caloCellsOutputKey
Output cell continer to be used.
virtual StatusCode initialize() override
ServiceHandle< IChronoStatSvc > m_chrono
ChronoStatSvc.
virtual StatusCode finalize() override
Gaudi::Property< bool > m_ownPolicyProp
ToolHandleArray< ICaloCellMakerTool > m_caloCellMakerTools
Array of CellMaker (and corrector) AlgTools.
virtual StatusCode execute(const EventContext &ctx) const override
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
OwnershipPolicy
@ OWN_ELEMENTS
this data object owns its elements
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts