ATLAS Offline Software
Loading...
Searching...
No Matches
TileBeamElemToCell.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//*****************************************************************************
6// Filename : TileBeamElemToCell.cxx
7// Author : Anna Lupi
8// Created : July 2004
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// Tile includes
21#include "TileBeamElemToCell.h"
25#include "TileEvent/TileCell.h"
26
27// Calo includes
29#include "CaloDetDescr/CaloDetDescrElement.h"
30
31// Atlas include
36// access all RawChannels inside container
38
39
40// C++ STL includes
41#include <map>
42
43//
44// Constructor
45//
46TileBeamElemToCell::TileBeamElemToCell(const std::string& name, ISvcLocator* pSvcLocator)
47 : AthAlgorithm(name, pSvcLocator)
48{
49}
50
53
54//****************************************************************************
55//* Initialization
56//****************************************************************************
57
59{
60
61 // retrieve Tile detector manager, TileID helper and TileIfno from det store
62 CHECK( detStore()->retrieve(m_tileMgr) );
63 CHECK( detStore()->retrieve(m_tileTBID) );
64 CHECK( detStore()->retrieve(m_tileHWID) );
65 CHECK( detStore()->retrieve(m_tileInfo, m_infoName.value()) );
66
67 ATH_CHECK( m_beamElemContainerKey.initialize() );
68 ATH_CHECK( m_cellContainerKey.initialize() );
69
70 ATH_MSG_INFO( "initialization completed" );
71
72 return StatusCode::SUCCESS;
73}
74
75
76//****************************************************************************
77//* Execution
78//****************************************************************************
79
80StatusCode TileBeamElemToCell::execute(const EventContext& ctx)
81{
82
83 // create new container
85
86 /* Register the set of TileCells to the event store. */
87 ATH_CHECK( cellContainer.record(std::make_unique<CaloCellContainer>()) );
88
89 //**
90 //* Get TileBeamElems
91 //**
93
94 if(!beamElemContainer.isValid()) {
95 ATH_MSG_WARNING( "No signal from beam elements; container '"
96 << m_beamElemContainerKey.key() << "' doesn't exist in StoreGate" );
97
98 } else {
99
100 //* Iterate over BeamElem, creating new TileCells (or incrementing
101 //* existing ones). Add each new TileCell to the CaloCellContainer.
102
103 SelectAllObject<TileBeamElemContainer> beamElems(beamElemContainer.cptr());
104
105 for (const TileBeamElem* beamElem : beamElems) {
106
107 HWIdentifier adc_id = beamElem->adc_HWID();
108 std::vector<unsigned int> amp = beamElem->get_digits();
109 float ener = amp[0] * m_tileInfo->BeamElemChannelCalib(adc_id);
110
111 Identifier cell_ID = beamElem->pmt_ID();
112
113 // CaloDDE is NULL pointer here
114 // store cell in container
115 std::unique_ptr<TileCell> cell = std::make_unique<TileCell>(nullptr, cell_ID, ener);
116 cellContainer->push_back(cell.release());
117 }
118 }
119
120
121 // Execution completed.
122
123 ATH_MSG_VERBOSE( "TileCell container registered to the TES with name"
124 << m_cellContainerKey.key());
125
126
127 return StatusCode::SUCCESS;
128
129}
130
131
132//****************************************************************************
133//* Finalize
134//****************************************************************************
135
137{
138
139 ATH_MSG_INFO( "finalize() end" );
140
141 return StatusCode::SUCCESS;
142}
143
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
#define ATH_MSG_INFO(x,...)
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
SelectAllObjectMT< DCC, OBJECT > SelectAllObject
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
const ServiceHandle< StoreGateSvc > & detStore() const
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
const TileHWID * m_tileHWID
const TileTBID * m_tileTBID
const TileDetDescrManager * m_tileMgr
SG::WriteHandleKey< CaloCellContainer > m_cellContainerKey
StatusCode execute(const EventContext &ctx)
Execute method.
const TileInfo * m_tileInfo
SG::ReadHandleKey< TileBeamElemContainer > m_beamElemContainerKey
Gaudi::Property< std::string > m_infoName
TileBeamElemToCell(const std::string &name, ISvcLocator *pSvcLocator)