ATLAS Offline Software
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
32 #include "StoreGate/ReadHandle.h"
33 #include "StoreGate/WriteHandle.h"
36 // access all RawChannels inside container
38 
39 
40 // C++ STL includes
41 #include <map>
42 
43 //
44 // Constructor
45 //
46 TileBeamElemToCell::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 
57 {}
58 
59 //****************************************************************************
60 //* Initialization
61 //****************************************************************************
62 
64 {
65 
66  // retrieve Tile detector manager, TileID helper and TileIfno from det store
71 
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 
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
TileBeamElemToCell::~TileBeamElemToCell
virtual ~TileBeamElemToCell()
Definition: TileBeamElemToCell.cxx:56
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
TileBeamElemToCell::finalize
StatusCode finalize()
Definition: TileBeamElemToCell.cxx:141
TileInfo.h
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
HWIdentifier
Definition: HWIdentifier.h:13
TileDetDescrManager.h
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
TileBeamElemToCell::m_beamElemContainerKey
SG::ReadHandleKey< TileBeamElemContainer > m_beamElemContainerKey
Definition: TileBeamElemToCell.h:84
SelectAllObjectMT
Definition: SelectAllObjectMT.h:11
TileHWID.h
TileBeamElemToCell::m_tileInfo
const TileInfo * m_tileInfo
Definition: TileBeamElemToCell.h:96
TileBeamElemToCell::m_infoName
std::string m_infoName
Definition: TileBeamElemToCell.h:92
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TileCell.h
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
TileBeamElemToCell::m_tileTBID
const TileTBID * m_tileTBID
Definition: TileBeamElemToCell.h:94
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
TileBeamElemToCell::m_tileHWID
const TileHWID * m_tileHWID
Definition: TileBeamElemToCell.h:95
AthAlgorithm
Definition: AthAlgorithm.h:47
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
TileBeamElemToCell::m_cellContainerKey
SG::WriteHandleKey< CaloCellContainer > m_cellContainerKey
Definition: TileBeamElemToCell.h:88
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
IdentifierHash.h
errorcheck.h
Helpers for checking error return status codes and reporting errors.
TileBeamElemToCell::initialize
StatusCode initialize()
Definition: TileBeamElemToCell.cxx:63
SG::WriteHandle< CaloCellContainer >
TileBeamElemToCell::m_tileMgr
const TileDetDescrManager * m_tileMgr
Definition: TileBeamElemToCell.h:97
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CaloCellContainer::push_back
void push_back(CaloCell *)
reimplementation of const push_back
Definition: CaloCellContainer.cxx:74
TileBeamElemToCell.h
TileBeamElemToCell::execute
StatusCode execute()
Definition: TileBeamElemToCell.cxx:85
TileBeamElemToCell::TileBeamElemToCell
TileBeamElemToCell(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TileBeamElemToCell.cxx:46
SelectAllObject.h
ReadHandle.h
Handle class for reading from StoreGate.
TileBeamElem
Definition: TileBeamElem.h:27
Identifier
Definition: IdentifierFieldParser.cxx:14