ATLAS Offline Software
Loading...
Searching...
No Matches
TileBeamElemToCell.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 : 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 , m_tileTBID(0)
49 , m_tileHWID(0)
50 , m_tileInfo(0)
51 , m_tileMgr(0)
52{
53 declareProperty("TileInfoName", m_infoName = "TileInfo"); // name of TileInfo store
54}
55
58
59//****************************************************************************
60//* Initialization
61//****************************************************************************
62
64{
65
66 // retrieve Tile detector manager, TileID helper and TileIfno from det store
67 CHECK( detStore()->retrieve(m_tileMgr) );
68 CHECK( detStore()->retrieve(m_tileTBID) );
69 CHECK( detStore()->retrieve(m_tileHWID) );
70 CHECK( detStore()->retrieve(m_tileInfo, m_infoName) );
71
72 ATH_CHECK( m_beamElemContainerKey.initialize() );
73 ATH_CHECK( m_cellContainerKey.initialize() );
74
75 ATH_MSG_INFO( "initialization completed" );
76
77 return StatusCode::SUCCESS;
78}
79
80
81//****************************************************************************
82//* Execution
83//****************************************************************************
84
86{
87
88 // create new container
90
91 /* Register the set of TileCells to the event store. */
92 ATH_CHECK( cellContainer.record(std::make_unique<CaloCellContainer>()) );
93
94 //**
95 //* Get TileBeamElems
96 //**
98
99 if(!beamElemContainer.isValid()) {
100 ATH_MSG_WARNING( "No signal from beam elements; container '"
101 << m_beamElemContainerKey.key() << "' doesn't exist in StoreGate" );
102
103 } else {
104
105 //* Iterate over BeamElem, creating new TileCells (or incrementing
106 //* existing ones). Add each new TileCell to the CaloCellContainer.
107
108 SelectAllObject<TileBeamElemContainer> beamElems(beamElemContainer.cptr());
109
110 for (const TileBeamElem* beamElem : beamElems) {
111
112 HWIdentifier adc_id = beamElem->adc_HWID();
113 std::vector<unsigned int> amp = beamElem->get_digits();
114 float ener = amp[0] * m_tileInfo->BeamElemChannelCalib(adc_id);
115
116 Identifier cell_ID = beamElem->pmt_ID();
117
118 // CaloDDE is NULL pointer here
119 // store cell in container
120 std::unique_ptr<TileCell> cell = std::make_unique<TileCell>(nullptr, cell_ID, ener);
121 cellContainer->push_back(cell.release());
122 }
123 }
124
125
126 // Execution completed.
127
128 ATH_MSG_VERBOSE( "TileCell container registered to the TES with name"
129 << m_cellContainerKey.key());
130
131
132 return StatusCode::SUCCESS;
133
134}
135
136
137//****************************************************************************
138//* Finalize
139//****************************************************************************
140
142{
143
144 ATH_MSG_INFO( "finalize() end" );
145
146 return StatusCode::SUCCESS;
147}
148
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(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 with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
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
const TileInfo * m_tileInfo
SG::ReadHandleKey< TileBeamElemContainer > m_beamElemContainerKey
TileBeamElemToCell(const std::string &name, ISvcLocator *pSvcLocator)