ATLAS Offline Software
Loading...
Searching...
No Matches
TileCellIDCToCell.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5//*****************************************************************************
6// Filename : TileCellIDCToCell.cxx
7// Author : Alexandre Solodkov
8// Created : Jan, 2003
9//
10// DESCRIPTION:
11// Implementation comments only. Class level comments go in .h file.
12//
13// HISTORY:
14//
15// BUGS:
16//
17//*****************************************************************************
18
19
20#include "TileCellIDCToCell.h"
21
22
23// access all Cells inside container
26
27// Calo includes
30
31// Tile includes
35#include "TileEvent/TileCell.h"
36
37
38//
39// Constructor
40//
41TileCellIDCToCell::TileCellIDCToCell(const std::string& name, ISvcLocator* pSvcLocator)
42 : AthAlgorithm(name, pSvcLocator)
43 , m_tileID(0)
44 , m_tileInfo(0)
45 , m_tileMgr(0)
46{
47 declareProperty("TileCellIDC", m_cellIDC = "TileCellIDC"); // Name of input container
48 declareProperty("TileCellContainer", m_cellContainer = "TileCellContainer"); // Name of output container
49 declareProperty("TileInfoName", m_infoName = "TileInfo"); // name of TileInfo store
50}
51
54
55//****************************************************************************
56//* Initialization
57//****************************************************************************
58
60{
61
62 // retrieve Tile detector manager, TileID helper and TileIfno from det store
63 CHECK( detStore()->retrieve(m_tileMgr) );
64 CHECK( detStore()->retrieve(m_tileID) );
65 CHECK( detStore()->retrieve(m_tileInfo, m_infoName) );
66
67 ATH_MSG_INFO( "TileCellIDCToCell initialization completed" );
68
69 return StatusCode::SUCCESS;
70}
71
72
73//****************************************************************************
74//* Execution
75//****************************************************************************
76
78{
79
80 /* zero all counters and sums */
81 int nCell = 0;
82 float eCellTot = 0.0;
83
85
86 //**
87 //* Get TileCells from TileIDC
88 //**
89 const TileCellIDC* inputCells;
90
91 if (evtStore()->retrieve(inputCells, m_cellIDC).isFailure() ) {
92
93 ATH_MSG_WARNING( " Could not find container " << m_cellIDC );
94 ATH_MSG_WARNING( " creating empty cell container " );
95
96 } else {
97
98 SelectAllObject<TileCellIDC> selAll(inputCells);
99 SelectAllObject<TileCellIDC>::const_iterator inpItr=selAll.begin();
100 SelectAllObject<TileCellIDC>::const_iterator end=selAll.end();
101
102 TileCell * c;
103 const TileCell * cinp;
104
105 //**
106 //* Iterate over cells, creating new TileCells
107 //* Add each TileCell to the CaloCellContainer.
108 //**
109
110 for( ; inpItr != end; ++inpItr) {
111
112 cinp = (*inpItr);
113
114 ++nCell;
115 eCellTot += cinp->energy();
116
117 c = new TileCell( cinp );
118 cells->push_back( c );
119
120 ATH_MSG_VERBOSE( "TileCellIDCToCell: cell_id="
121 << m_tileID->to_string(cinp->subcalo_hash(),-2)
122 << " nCell=" << nCell << " energy=" << cinp->energy());
123 }
124 }
125
126 /* Register the set of TileCells to the event store. */
127
128 CHECK( evtStore()->record(cells, m_cellContainer, false ) );
129
130 // Execution completed.
131 ATH_MSG_DEBUG( "TileCellIDCToCell execution completed." );
132 ATH_MSG_DEBUG( " nCell=" << nCell << " eneTot=" << eCellTot );
133
134 ATH_MSG_VERBOSE( "TileCell container registered to the TES with name"
135 << m_cellContainer );
136
137 return StatusCode::SUCCESS;
138}
139
140//************************************************************************
141
142
143//****************************************************************************
144//* Finalize
145//****************************************************************************
146
148{
149
150 ATH_MSG_INFO( "TileCellIDCToCell::finalize() end" );
151
152 return StatusCode::SUCCESS;
153}
154
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(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.
SelectAllObjectMT< DCC, OBJECT > SelectAllObject
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
Container class for CaloCell.
double energy() const
get energy (data member)
Definition CaloCell.h:327
const_iterator end()
const_iterator begin()
const TileID * m_tileID
const TileDetDescrManager * m_tileMgr
std::string m_cellContainer
const TileInfo * m_tileInfo
TileCellIDCToCell(const std::string &name, ISvcLocator *pSvcLocator)
IdentifierHash subcalo_hash(void) const
get subcalo hash for TileCal cells
Definition TileCell.h:222