ATLAS Offline Software
Loading...
Searching...
No Matches
TileHitToCell Class Reference

This algorithm builds TileCells from TileHits. More...

#include <TileHitToCell.h>

Inheritance diagram for TileHitToCell:
Collaboration diagram for TileHitToCell:

Public Member Functions

 TileHitToCell (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor.
virtual ~TileHitToCell ()
 Destructor.
virtual StatusCode initialize () override
 initialize method
virtual StatusCode execute () override
 execute method
virtual StatusCode finalize () override
 finalize method
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadHandleKey< TileHitContainerm_hitContainerKey
SG::WriteHandleKey< CaloCellContainerm_cellContainerKey
SG::ReadCondHandleKey< TileSamplingFractionm_samplingFractionKey
 Name of TileSamplingFraction in condition store.
const TileIDm_tileID {nullptr}
 Pointer to TileID helper.
const TileHWIDm_tileHWID {nullptr}
 Pointer to TileHWID helper.
const TileDetDescrManagerm_tileMgr {nullptr}
 Pointer to TileDetDescrManager.
DataObjIDColl m_extendedExtraObjects
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

This algorithm builds TileCells from TileHits.

Hits from the PMTs in the cell are merged and calibration constants applied to obtained cell energy, time and quality.

TileHitToCell groups some PMT's output (energy deposit) contained in TileHit. (For barrel and ext.barrel, two Hits feed into each cell; for the Gap cells, there is only one PMT.) Calibrations constants are applied, and the total energy in the cell, the mean time of the energy deposition, and the quality of the measurement are returned. Clearly different things are needed for different data, e.g., full simulation vs. fast simulation vs. data. LAr handles this by a strategy of having a top level algorithm that calls builder sub-algs and a list of cell-correction sub-algs. It is not clear to us yet how we (tile) will want to tie to the database nor what level of complexity will exist in Tile for this task, so we will start with the simplest thing, TileCellBuilderAlg, which will do both the converstion of Hit to Cell and correctsions/scaling.

Definition at line 54 of file TileHitToCell.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TileHitToCell()

TileHitToCell::TileHitToCell ( const std::string & name,
ISvcLocator * pSvcLocator )

Constructor.

Definition at line 39 of file TileHitToCell.cxx.

40 : AthAlgorithm(name, pSvcLocator)
41{
42}
AthAlgorithm()
Default constructor:

◆ ~TileHitToCell()

TileHitToCell::~TileHitToCell ( )
virtual

Destructor.

Definition at line 44 of file TileHitToCell.cxx.

44 {
45}

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode TileHitToCell::execute ( )
overridevirtual

execute method

Definition at line 73 of file TileHitToCell.cxx.

73 {
74
75 ATH_MSG_DEBUG( "Executing TileHitToCell" );
76
77 SG::ReadCondHandle<TileSamplingFraction> samplingFraction(m_samplingFractionKey);
78 ATH_CHECK( samplingFraction.isValid() );
79
80 // step1: read hits from TES
81 SG::ReadHandle<TileHitContainer> hitContainer(m_hitContainerKey);
82 ATH_CHECK( hitContainer.isValid() );
83
84 //Zero sums for monitoring.
85 int nTwo = 0;
86 int nChan = 0;
87 int nCell = 0;
88 double eHitTot = 0.0;
89 double eCellTot = 0.0;
90
91 // step2: to figure out the cell energy from the hits obtained above
92 unsigned int nCellMax = m_tileMgr->tile_cell_size();
93 std::vector<double> enePmt1;
94 std::vector<double> enePmt2;
95 enePmt1.resize(nCellMax);
96 enePmt2.resize(nCellMax);
97
98 SelectAllObject<TileHitContainer> selAll(hitContainer.cptr());
99 SelectAllObject<TileHitContainer>::const_iterator hitItr = selAll.begin();
100 SelectAllObject<TileHitContainer>::const_iterator lastHit = selAll.end();
101
102 IdentifierHash cellHash_id;
103 IdContext cellContext = m_tileID->cell_context();
104
105 for (; hitItr != lastHit; ++hitItr) {
106
107 // Get hit id (logical pmt id)
108 Identifier pmt_id = (*hitItr)->identify();
109 int pmt = m_tileID->pmt(pmt_id); // 0 or 1 - first or second PMT of the cell
110
111 HWIdentifier pmt_hwid = (*hitItr)->pmt_HWID();
112 int ros = m_tileHWID->ros(pmt_hwid);
113 int drawer = m_tileHWID->drawer(pmt_hwid);
114 int channel = m_tileHWID->channel(pmt_hwid);
115 int drawerIdx = TileCalibUtils::getDrawerIdx(ros, drawer);
116
117 // Get logical ID of cell
118 Identifier cell_id = m_tileID->cell_id(pmt_id);
119 m_tileID->get_hash(cell_id, cellHash_id, &cellContext);
120
121 // Convert hit energy deposit to cell energy
122 double eHit = (*hitItr)->energy();
123 double fact = samplingFraction->getSamplingFraction(drawerIdx, channel);
124 double eCell = eHit * fact;
125
126 ++nChan;
127 eHitTot += eHit;
128 eCellTot += eCell;
129
130 // Add energy to existing entry for this cell, or
131 // make new cell entry if there is no previous entry for this cell
132 if (0 == pmt) {
133 ++nCell;
134 enePmt1[cellHash_id] = eCell;
135 } else {
136 ++nTwo;
137 enePmt2[cellHash_id] = eCell;
138 }
139
140 ATH_MSG_VERBOSE( "TileHitToCell: "
141 << " nChan=" << nChan
142 << " pmt_id=" << m_tileID->to_string(pmt_id, -1)
143 << " eHit=" << eHit
144 << " nCell=" << nCell
145 << " cell_id=" << m_tileID->to_string(cell_id, -2)
146 << " eCell=" << eCell );
147 }
148
149 // step3: form cells, and put them in container
150
151 SG::WriteHandle<CaloCellContainer> cellContainer(m_cellContainerKey);
152 ATH_CHECK( cellContainer.record(std::make_unique<CaloCellContainer>()) );
153 ATH_MSG_VERBOSE( "TileCell container registered to the TES with name" << m_cellContainerKey.key() );
154
155 for (unsigned int i = 0; i < nCellMax; ++i) {
156 const CaloDetDescrElement* caloDDE = m_tileMgr->get_cell_element(i);
157 TileCell* pCell = new TileCell(caloDDE, enePmt1[i], enePmt2[i], 0.0, 0.0, 0, 0
159 , CaloGain::INVALIDGAIN, CaloGain::INVALIDGAIN); // gain is not known
160 cellContainer->push_back(pCell);
161 }
162
163 // Execution completed.
164 if (msgLvl(MSG::DEBUG)) {
165 msg(MSG::DEBUG) << "TileHitToCell execution completed." << endmsg;
166 msg(MSG::DEBUG) << " nChan=" << nChan
167 << " eHitTot=" << eHitTot
168 << " nCell=" << nCell
169 << " n2=" << nTwo
170 << " eneTot=" << eCellTot << endmsg;
171 }
172
173
174
175 return StatusCode::SUCCESS;
176}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
SelectAllObjectMT< DCC, OBJECT > SelectAllObject
bool msgLvl(const MSG::Level lvl) const
MsgStream & msg() const
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
@ MASK_AMPL
Definition TileCell.h:65
const TileHWID * m_tileHWID
Pointer to TileHWID helper.
SG::WriteHandleKey< CaloCellContainer > m_cellContainerKey
SG::ReadHandleKey< TileHitContainer > m_hitContainerKey
const TileID * m_tileID
Pointer to TileID helper.
SG::ReadCondHandleKey< TileSamplingFraction > m_samplingFractionKey
Name of TileSamplingFraction in condition store.
const TileDetDescrManager * m_tileMgr
Pointer to TileDetDescrManager.
@ INVALIDGAIN
Definition CaloGain.h:18

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ finalize()

StatusCode TileHitToCell::finalize ( )
overridevirtual

finalize method

Definition at line 178 of file TileHitToCell.cxx.

178 {
179
180 ATH_MSG_INFO( "TileHitToCell::finalize() end" );
181
182 return StatusCode::SUCCESS;
183}
#define ATH_MSG_INFO(x)

◆ initialize()

StatusCode TileHitToCell::initialize ( )
overridevirtual

initialize method

Definition at line 50 of file TileHitToCell.cxx.

50 {
51
52 // retrieve Tile detector manager, TileID helper from det store
53
55
57
59
60 ATH_CHECK( m_hitContainerKey.initialize() );
61 ATH_CHECK( m_cellContainerKey.initialize() );
62
63 ATH_CHECK( m_samplingFractionKey.initialize() );
64
65 ATH_MSG_INFO( "TileHitToCell initialisation completed" );
66
67 return StatusCode::SUCCESS;
68}
const ServiceHandle< StoreGateSvc > & detStore() const
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
static Double_t sc
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_cellContainerKey

SG::WriteHandleKey<CaloCellContainer> TileHitToCell::m_cellContainerKey
private
Initial value:
{this,"TileCellContainer",
"TileCellContainer",
"Output Tile cell container key"}

Definition at line 70 of file TileHitToCell.h.

70 {this,"TileCellContainer",
71 "TileCellContainer",
72 "Output Tile cell container key"};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_hitContainerKey

SG::ReadHandleKey<TileHitContainer> TileHitToCell::m_hitContainerKey
private
Initial value:
{this,"TileHitContainer","TileHitContainer",
"input Tile hit container key"}

Definition at line 67 of file TileHitToCell.h.

67 {this,"TileHitContainer","TileHitContainer",
68 "input Tile hit container key"};

◆ m_samplingFractionKey

SG::ReadCondHandleKey<TileSamplingFraction> TileHitToCell::m_samplingFractionKey
private
Initial value:
{this,
"TileSamplingFraction", "TileSamplingFraction", "Input Tile sampling fraction"}

Name of TileSamplingFraction in condition store.

Definition at line 77 of file TileHitToCell.h.

77 {this,
78 "TileSamplingFraction", "TileSamplingFraction", "Input Tile sampling fraction"};

◆ m_tileHWID

const TileHWID* TileHitToCell::m_tileHWID {nullptr}
private

Pointer to TileHWID helper.

Definition at line 81 of file TileHitToCell.h.

81{nullptr};

◆ m_tileID

const TileID* TileHitToCell::m_tileID {nullptr}
private

Pointer to TileID helper.

Definition at line 80 of file TileHitToCell.h.

80{nullptr};

◆ m_tileMgr

const TileDetDescrManager* TileHitToCell::m_tileMgr {nullptr}
private

Pointer to TileDetDescrManager.

Definition at line 82 of file TileHitToCell.h.

82{nullptr};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: