ATLAS Offline Software
Loading...
Searching...
No Matches
TileTBHitToBeamElem.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5//*****************************************************************************
6// Filename : TileTBHitToBeamElem.cxx
7// Author : Alexander Solodkov
8// Created : July 2004
9//
10// DESCRIPTION:
11// Implement the TileTBHitToBeamElem class
12//
13// HISTORY:
14//
15// BUGS:
16//
17//*****************************************************************************
18
19// Tile includes
23
24// Calo includes
27
28// Atlas includes
32
33
34//
35// Constructor
36//
37TileTBHitToBeamElem::TileTBHitToBeamElem(const std::string& name, ISvcLocator* pSvcLocator)
38 : AthAlgorithm(name, pSvcLocator)
39 , m_infoName("TileInfo")
40 , m_tileTBID(0)
41 , m_tileHWID(0)
42 , m_tileInfo(0)
43{
44 declareProperty("TileInfoName", m_infoName);
45}
46
49
50//
51// Alg standard initialize function
52//
54
55 // retrieve TileID helper and TileIfno from det store
56
57 CHECK( detStore()->retrieve(m_tileTBID) );
58
59 CHECK( detStore()->retrieve(m_tileHWID) );
60
61 CHECK( detStore()->retrieve(m_tileInfo, m_infoName) );
62
63 ATH_CHECK( m_hitVectorKey.initialize() );
64 ATH_CHECK( m_beamElemContainerKey.initialize() );
65
66 ATH_MSG_INFO( "TileTBHitToBeamElem initialization completed" );
67
68 return StatusCode::SUCCESS;
69}
70
71//
72// Alg standard execute function
73//
75
76 ATH_MSG_DEBUG( "Executing TileTBHitToBeamElem" );
77
78 // create new container
79 auto beamElemContainer = std::make_unique<TileMutableBeamElemContainer>(true);
80 ATH_CHECK( beamElemContainer->status() );
81
82 //**
83 //* Get TileHits from TileHitVector
84 //**
86 ATH_CHECK( hitVector.isValid() );
87
88 //**
89 //* Iterate over hits
90 //**
91 for (const TileHit& tile_hit : *hitVector) {
92
93 // Get hit Identifier (= identifier of pmt)
94 Identifier pmt_id = tile_hit.pmt_ID();
95 // adc_id and channel_id for beam elem are the same
96 // because there is only one gain, i.e. gain bit is always 0
97 HWIdentifier adc_id = tile_hit.pmt_HWID();
98
99 /* Get hit amplitude and convert to energy (cell-dependent) */
100 double hit_calib = m_tileInfo->BeamElemHitCalib(pmt_id);
101 double e_hit = tile_hit.energy();
102 double e_ch = e_hit * hit_calib;
103
104 /* Convert to amplitude of channel */
105 /* need to divide here, because "calib" converts amp to energy */
106 double calib = m_tileInfo->BeamElemChannelCalib(adc_id);
107 // amplitude is an integer number, this is the signal we get from ADC
108 int amp_ch = (int) (e_ch / calib);
109
110 ATH_MSG_VERBOSE( " pmt=" << m_tileTBID->to_string(pmt_id)
111 << " adc=" << m_tileHWID->to_string(adc_id)
112 << " amp=" << amp_ch);
113
114 std::unique_ptr<TileBeamElem> beamElem = std::make_unique<TileBeamElem>(adc_id, amp_ch);
115 ATH_CHECK( beamElemContainer->push_back(std::move(beamElem)) );
116 }
117
119 ATH_CHECK( beamElemCnt.record(std::move(beamElemContainer)) );
120
121 // Execution completed.
122 ATH_MSG_DEBUG( "TileTBHitToBeamElem execution completed." );
123
124 return StatusCode::SUCCESS;
125}
126
128
129 ATH_MSG_INFO( "TileTBHitToBeamElem::finalize() end." );
130
131 return StatusCode::SUCCESS;
132}
133
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(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.
std::vector< FPGATrackSimHit > hitVector
Handle class for reading from StoreGate.
Handle class for recording to StoreGate.
Helper for holding non-const raw data prior to recording in SG.
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
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
SG::ReadHandleKey< TileHitVector > m_hitVectorKey
std::string m_infoName
name of the TileInfo object in TES
const TileTBID * m_tileTBID
Pointer to TileID helper.
virtual ~TileTBHitToBeamElem()
Destructor.
TileTBHitToBeamElem(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
const TileInfo * m_tileInfo
Pointer to TileInfo.
virtual StatusCode initialize() override
initialize method
virtual StatusCode execute() override
execute method
const TileHWID * m_tileHWID
Pointer to TileHWID helper.
virtual StatusCode finalize() override
finalize method
SG::WriteHandleKey< TileBeamElemContainer > m_beamElemContainerKey