ATLAS Offline Software
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
30 #include "StoreGate/ReadHandle.h"
31 #include "StoreGate/WriteHandle.h"
32 
33 
34 //
35 // Constructor
36 //
37 TileTBHitToBeamElem::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 
48 }
49 
50 //
51 // Alg standard initialize function
52 //
54 
55  // retrieve TileID helper and TileIfno from det store
56 
58 
60 
62 
63  ATH_CHECK( m_hitVectorKey.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 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
TileTBHitToBeamElem::m_tileTBID
const TileTBID * m_tileTBID
Pointer to TileID helper.
Definition: TileTBHitToBeamElem.h:75
TileTBID::to_string
std::string to_string(const Identifier &id, int level=0) const
extract all fields from TileTB identifier Identifier get_all_fields ( const Identifier & id,...
Definition: TileTBID.cxx:48
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
TileTBHitToBeamElem::finalize
virtual StatusCode finalize() override
finalize method
Definition: TileTBHitToBeamElem.cxx:127
hitVector
std::vector< FPGATrackSimHit > hitVector
Definition: FPGATrackSimCluster.h:23
TileTBHitToBeamElem::m_infoName
std::string m_infoName
name of the TileInfo object in TES
Definition: TileTBHitToBeamElem.h:73
TileInfo.h
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
HWIdentifier
Definition: HWIdentifier.h:13
TileMutableBeamElemContainer.h
Helper for holding non-const raw data prior to recording in SG.
AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:95
WriteHandle.h
Handle class for recording to StoreGate.
TileTBID.h
TileHWID.h
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
TileTBHitToBeamElem::TileTBHitToBeamElem
TileTBHitToBeamElem(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: TileTBHitToBeamElem.cxx:37
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
TileInfo::BeamElemChannelCalib
double BeamElemChannelCalib(const HWIdentifier &) const
Method returns and returned always 1.
Definition: TileInfo.h:272
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
TileTBHitToBeamElem.h
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
TileTBHitToBeamElem::~TileTBHitToBeamElem
virtual ~TileTBHitToBeamElem()
Destructor
Definition: TileTBHitToBeamElem.cxx:47
AthAlgorithm
Definition: AthAlgorithm.h:47
TileTBHitToBeamElem::m_tileHWID
const TileHWID * m_tileHWID
Pointer to TileHWID helper.
Definition: TileTBHitToBeamElem.h:76
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
TileTBHitToBeamElem::m_tileInfo
const TileInfo * m_tileInfo
Pointer to TileInfo.
Definition: TileTBHitToBeamElem.h:77
errorcheck.h
Helpers for checking error return status codes and reporting errors.
TileInfo::BeamElemHitCalib
double BeamElemHitCalib(const Identifier &) const
TileHit to TileCell energy conversion for ancillary testbeam detectors.
Definition: TileInfo.h:268
TileHit
Definition: TileSimEvent/TileSimEvent/TileHit.h:30
PlotSFuncertainty.calib
calib
Definition: PlotSFuncertainty.py:110
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
TileTBHitToBeamElem::m_beamElemContainerKey
SG::WriteHandleKey< TileBeamElemContainer > m_beamElemContainerKey
Definition: TileTBHitToBeamElem.h:68
TileTBHitToBeamElem::execute
virtual StatusCode execute() override
execute method
Definition: TileTBHitToBeamElem.cxx:74
TileTBHitToBeamElem::m_hitVectorKey
SG::ReadHandleKey< TileHitVector > m_hitVectorKey
Definition: TileTBHitToBeamElem.h:65
TileHWID::to_string
std::string to_string(const HWIdentifier &id, int level=0) const
extract all fields from HW identifier HWIdentifier get_all_fields ( const HWIdentifier & id,...
Definition: TileHWID.cxx:49
ReadHandle.h
Handle class for reading from StoreGate.
TileTBHitToBeamElem::initialize
virtual StatusCode initialize() override
initialize method
Definition: TileTBHitToBeamElem.cxx:53