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

#include <LArFCalTowerBuilderToolTestAlg.h>

Inheritance diagram for LArFCalTowerBuilderToolTestAlg:
Collaboration diagram for LArFCalTowerBuilderToolTestAlg:

Public Member Functions

 LArFCalTowerBuilderToolTestAlg (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor.
virtual StatusCode initialize () override
 Standard Gaudi initialize method.
virtual StatusCode execute () override
 Standard Gaudi execute 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

CaloCellContainermake_cells ()
StatusCode test_subseg (const EventContext &ctx, const CaloTowerSeg::SubSeg &subseg, const CaloCellContainer *cells, const CaloTowerContainer *tow0)
StatusCode test1 ()
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

ToolHandle< ICaloTowerBuilderToolBasem_builder
std::vector< CaloCell_ID::SUBCALOm_calos
CaloTowerSeg m_seg
uint32_t m_seed
SG::ReadCondHandleKey< CaloDetDescrManagerm_caloMgrKey
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

Definition at line 31 of file LArFCalTowerBuilderToolTestAlg.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

◆ LArFCalTowerBuilderToolTestAlg()

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

Constructor.

Definition at line 47 of file LArFCalTowerBuilderToolTestAlg.cxx.

50 : AthAlgorithm (name, pSvcLocator),
51 m_builder ("LArFCalTowerBuilderTool"),
52 m_seed (1)
53{
54}
AthAlgorithm()
Default constructor:
ToolHandle< ICaloTowerBuilderToolBase > m_builder

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 LArFCalTowerBuilderToolTestAlg::execute ( )
overridevirtual

Standard Gaudi execute method.

Definition at line 205 of file LArFCalTowerBuilderToolTestAlg.cxx.

206{
207 CHECK( test1() );
208 return StatusCode::SUCCESS;
209}
#define CHECK(...)
Evaluate an expression and check for errors.

◆ 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

◆ initialize()

StatusCode LArFCalTowerBuilderToolTestAlg::initialize ( )
overridevirtual

Standard Gaudi initialize method.

Definition at line 60 of file LArFCalTowerBuilderToolTestAlg.cxx.

61{
62 m_calos.push_back (CaloCell_ID::LARFCAL);
63
64 ATH_CHECK( m_builder.retrieve() );
65 ATH_CHECK( m_caloMgrKey.initialize() );
66
67 m_seg = CaloTowerSeg (100, 64, -5.0, 5.0);
68 m_builder->setTowerSeg (m_seg);
69 return StatusCode::SUCCESS;
70}
#define ATH_CHECK
Evaluate an expression and check for errors.
std::vector< CaloCell_ID::SUBCALO > m_calos
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey

◆ 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.

◆ make_cells()

CaloCellContainer * LArFCalTowerBuilderToolTestAlg::make_cells ( )
private

Definition at line 74 of file LArFCalTowerBuilderToolTestAlg.cxx.

75{
76 CaloCellContainer* cells = new CaloCellContainer;
77 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{m_caloMgrKey};
78 if(!caloMgrHandle.isValid()) std::abort();
79 const CaloDetDescrManager* ddman = *caloMgrHandle;
80
81 for (CaloCell_ID::SUBCALO subcalo : m_calos) {
82 for (const CaloDetDescrElement* dde :
83 ddman->element_range (subcalo))
84 {
86 cells->push_back (new CaloCell (dde, energy, 0, 0, 0,
88 }
89 }
90 cells->updateCaloIterators();
91 return cells;
92}
CaloCell_Base_ID::SUBCALO SUBCALO
Definition CaloCell_ID.h:50
calo_element_range element_range() const
Range over element vector.
float randf_seed(uint32_t &seed, float rmax, float rmin=0)
Generate a floating-point random number between rmin and rmax.
Definition random.h:53
@ LARMEDIUMGAIN
Definition CaloGain.h:18

◆ 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.

◆ test1()

StatusCode LArFCalTowerBuilderToolTestAlg::test1 ( )
private

Definition at line 158 of file LArFCalTowerBuilderToolTestAlg.cxx.

159{
160 std::cout << "test1\n";
161 const EventContext& ctx = Gaudi::Hive::currentContext();
162
163 const CaloCellContainer* cells = make_cells();
165 CHECK( m_builder->execute (ctx, tow1, cells) );
166
167#if 0
168 std::cout << "cells\n";
169 for (size_t i = 0; i < cells->size(); i++) {
170 const CaloCell* c = (*cells)[i];
171 std::cout << i << " "
172 << (int)(c->caloDDE()->calo_hash()) << " "
173 << c->eta() << " " << c->phi() << " " << c->energy() << "\n";
174 }
175#endif
176
177 std::cout << "towers\n";
178 for (size_t i = 0; i < tow1->size(); i++) {
179 const CaloTower* t = (*tow1)[i];
180 std::cout << i << " "
181 << tow1->getTowerEtaIndex(i) << " "
182 << tow1->getTowerPhiIndex(i) << " "
183 << t->energy() << " ";
184 for (CaloTower::cell_iterator cit = t->cell_begin();
185 cit != t->cell_end();
186 ++cit)
187 {
188 std::cout << (*cit)->caloDDE()->calo_hash() << " ";
189 }
190 std::cout << "\n";
191 }
192
193 CHECK( test_subseg (ctx, m_seg.subseg ( 4.5, 0.3, -0.2, 0.4), cells, tow1) );
194 CHECK( test_subseg (ctx, m_seg.subseg (-4.5, 0.3, 3.1, 0.4), cells, tow1) );
195
196 delete cells;
197 delete tow1;
198 return StatusCode::SUCCESS;
199}
Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current CaloTowerContainer
Definition CaloTPCnv.cxx:68
index_t getTowerEtaIndex(const CaloTower *aTower) const
Returns the index for a given tower.
index_t getTowerPhiIndex(const CaloTower *aTower) const
Returns the index for a given tower.
CaloEnergyCluster::cell_iterator cell_iterator
Iterator on CaloCell s.
size_type size() const noexcept
Returns the number of elements in the collection.
StatusCode test_subseg(const EventContext &ctx, const CaloTowerSeg::SubSeg &subseg, const CaloCellContainer *cells, const CaloTowerContainer *tow0)

◆ test_subseg()

StatusCode LArFCalTowerBuilderToolTestAlg::test_subseg ( const EventContext & ctx,
const CaloTowerSeg::SubSeg & subseg,
const CaloCellContainer * cells,
const CaloTowerContainer * tow0 )
private

Definition at line 96 of file LArFCalTowerBuilderToolTestAlg.cxx.

100{
102 CHECK( m_builder->execute (ctx, tow, cells, &subseg) );
103
104 for (size_t i = 0; i < tow->size(); i++) {
106 index_t ieta1 = tow->getTowerEtaIndex (i);
107 index_t iphi1 = tow->getTowerPhiIndex (i);
108 index_t ieta0 = ieta1 + subseg.etamin()-1;
109 index_t iphi0 = iphi1 + subseg.phimin()-1;
110 if (iphi0 > m_seg.nphi())
111 iphi0 -= m_seg.nphi();
112 const CaloTower* t0 = tow0->getTower (ieta0, iphi0);
113 const CaloTower* t1 = tow->getTower (i);
114 if (!comp (t0->energy(), t1->energy()) ||
115 !comp (t0->eta(), t1->eta()) ||
116 !comp (t0->phi(), t1->phi()))
117 {
118 std::cout << "Energy mismatch " << i << " "
119 << ieta1 << " " << iphi1 << " "
120 << t0->eta() << " " << t0->phi() << " "
121 << t1->eta() << " " << t1->phi() << " "
122 << t0->energy() << " " << t1->energy() << "\n";
123 }
124
125 std::vector<unsigned int> h0;
126 for (CaloTower::cell_iterator cit = t0->cell_begin();
127 cit != t0->cell_end();
128 ++cit)
129 {
130 h0.push_back ((*cit)->caloDDE()->calo_hash());
131 }
132
133 std::vector<unsigned int> h1;
134 for (CaloTower::cell_iterator cit = t1->cell_begin();
135 cit != t1->cell_end();
136 ++cit)
137 {
138 h1.push_back ((*cit)->caloDDE()->calo_hash());
139 }
140
141 if (h0 != h1) {
142 std::cout << "Cell list mismatch.\n";
143 for (size_t i = 0; i < h0.size(); i++)
144 std::cout << " " << h0[i];
145 std::cout << "\n";
146 for (size_t i = 0; i < h1.size(); i++)
147 std::cout << " " << h1[i];
148 std::cout << "\n";
149 }
150 }
151
152 delete tow;
153
154 return StatusCode::SUCCESS;
155}
static Double_t t0
CaloTower * getTower(index_t eta, index_t phi)
Returns a pointer to a tower with given indices.
index_t etamin() const
Lower eta index.
index_t phimin() const
Lower phi index.
CaloTowerSeg segmentation() const
Return a new segmentation object corresponding to this window.
std::vector< ALFA_RawDataCollection_p1 > t1
int32_t index_t
The index type of the node in the vector.

◆ 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_builder

ToolHandle<ICaloTowerBuilderToolBase> LArFCalTowerBuilderToolTestAlg::m_builder
private

Definition at line 62 of file LArFCalTowerBuilderToolTestAlg.h.

◆ m_caloMgrKey

SG::ReadCondHandleKey<CaloDetDescrManager> LArFCalTowerBuilderToolTestAlg::m_caloMgrKey
private
Initial value:
{ this
, "CaloDetDescrManager"
, "CaloDetDescrManager"
, "SG Key for CaloDetDescrManager in the Condition Store" }

Definition at line 66 of file LArFCalTowerBuilderToolTestAlg.h.

66 { this
67 , "CaloDetDescrManager"
68 , "CaloDetDescrManager"
69 , "SG Key for CaloDetDescrManager in the Condition Store" };

◆ m_calos

std::vector<CaloCell_ID::SUBCALO> LArFCalTowerBuilderToolTestAlg::m_calos
private

Definition at line 63 of file LArFCalTowerBuilderToolTestAlg.h.

◆ 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_seed

uint32_t LArFCalTowerBuilderToolTestAlg::m_seed
private

Definition at line 65 of file LArFCalTowerBuilderToolTestAlg.h.

◆ m_seg

CaloTowerSeg LArFCalTowerBuilderToolTestAlg::m_seg
private

Definition at line 64 of file LArFCalTowerBuilderToolTestAlg.h.

◆ 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: