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

#include <FPGATrackSimBinStep.h>

Inheritance diagram for FPGATrackSimBinStep:
Collaboration diagram for FPGATrackSimBinStep:

Public Member Functions

 FPGATrackSimBinStep (const std::string &algname, const std::string &name, const IInterface *ifc)
virtual StatusCode initialize () override
StatusCode setRanges (FPGATrackSimBinStep *prev, const FPGATrackSimBinUtil::ParSet &parMin, const FPGATrackSimBinUtil::ParSet &parMax)
const std::vector< unsigned > stepIdx (FPGATrackSimBinUtil::IdxSet idx) const
const std::vector< unsigned > stepBins () const
const std::vector< unsigned > & stepPars () const
const std::vector< unsigned > nBins () const
const std::string stepName () const
unsigned stepNum () const
double binCenter (unsigned par, unsigned bin) const
double binLowEdge (unsigned par, unsigned bin) const
double binHighEdge (unsigned par, unsigned bin) const
double binWidth (unsigned par) const
FPGATrackSimBinUtil::ParSet binLowEdge (const FPGATrackSimBinUtil::IdxSet &idx) const
FPGATrackSimBinUtil::ParSet binCenter (const FPGATrackSimBinUtil::IdxSet &idx) const
unsigned binIdx (unsigned par, double val) const
FPGATrackSimBinUtil::IdxSet binIdx (const FPGATrackSimBinUtil::ParSet &pars) const
FPGATrackSimBinUtil::IdxSet convertToPrev (const FPGATrackSimBinUtil::IdxSet &cur) const
bool isFirstStep () const
void initValidBins ()
void setValidBin (const std::vector< unsigned > &idx)
void printValidBin () const
const FPGATrackSimBinArray< int > & validBinsFull () const
const FPGATrackSimBinArray< int > & validBinsLocal () const
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 sysInitialize () override
 Perform system initialization for an algorithm.
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

Gaudi::Property< std::vector< unsigned > > m_parBinsConfig {this,"parBins",{},"Vector of number of bins for each parameter (expect 5)"}
std::vector< unsigned > m_pars {}
FPGATrackSimBinArray< int > m_validBinFull
FPGATrackSimBinArray< int > m_validBinLocal
FPGATrackSimBinStepm_prev {0}
unsigned m_stepNum {}
FPGATrackSimBinUtil::IdxSet m_parBins
FPGATrackSimBinUtil::ParSet m_parStep
FPGATrackSimBinUtil::ParSet m_parMin
FPGATrackSimBinUtil::ParSet m_parMax
friend FPGATrackSimBinTool
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 45 of file FPGATrackSimBinStep.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ FPGATrackSimBinStep()

FPGATrackSimBinStep::FPGATrackSimBinStep ( const std::string & algname,
const std::string & name,
const IInterface * ifc )
inline

Definition at line 47 of file FPGATrackSimBinStep.h.

48 : AthAlgTool(algname, name, ifc) {}
AthAlgTool()
Default constructor:

Member Function Documentation

◆ binCenter() [1/2]

ParSet FPGATrackSimBinStep::binCenter ( const FPGATrackSimBinUtil::IdxSet & idx) const

Definition at line 91 of file FPGATrackSimBinStep.cxx.

92{
93 ParSet parset;
94 for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++)
95 {
96 parset[i] = binCenter(i, idx[i]);
97 }
98 return parset;
99}
double binCenter(unsigned par, unsigned bin) const

◆ binCenter() [2/2]

double FPGATrackSimBinStep::binCenter ( unsigned par,
unsigned bin ) const
inline

Definition at line 62 of file FPGATrackSimBinStep.h.

62{ return m_parMin[par] + m_parStep[par] * (double(bin) + 0.5); }
FPGATrackSimBinUtil::ParSet m_parMin
FPGATrackSimBinUtil::ParSet m_parStep

◆ binHighEdge()

double FPGATrackSimBinStep::binHighEdge ( unsigned par,
unsigned bin ) const
inline

Definition at line 64 of file FPGATrackSimBinStep.h.

64{ return m_parMin[par] + m_parStep[par] * (double(bin) + 1.0);}

◆ binIdx() [1/2]

IdxSet FPGATrackSimBinStep::binIdx ( const FPGATrackSimBinUtil::ParSet & pars) const

Definition at line 101 of file FPGATrackSimBinStep.cxx.

102{
103 IdxSet retv;
104 for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++)
105 {
106 retv[i] = binIdx(i, pars[i]);
107 }
108 return retv;
109}
unsigned binIdx(unsigned par, double val) const

◆ binIdx() [2/2]

unsigned FPGATrackSimBinStep::binIdx ( unsigned par,
double val ) const
inline

Definition at line 70 of file FPGATrackSimBinStep.h.

70 {
71 // Guard against both underflow and overflow.
72 if (val < m_parMin[par]) return 0;
73 else if (val > m_parMax[par]) return unsigned(floor((m_parMax[par] - m_parMin[par]) / m_parStep[par])) - 1;
74 else return unsigned(floor((val - m_parMin[par]) / m_parStep[par]));
75 }
FPGATrackSimBinUtil::ParSet m_parMax

◆ binLowEdge() [1/2]

ParSet FPGATrackSimBinStep::binLowEdge ( const FPGATrackSimBinUtil::IdxSet & idx) const

Definition at line 81 of file FPGATrackSimBinStep.cxx.

82{
83 ParSet parset;
84 for (unsigned i = 0; i < FPGATrackSimTrackPars::NPARS; i++)
85 {
86 parset[i] = binLowEdge(i, idx[i]);
87 }
88 return parset;
89}
double binLowEdge(unsigned par, unsigned bin) const

◆ binLowEdge() [2/2]

double FPGATrackSimBinStep::binLowEdge ( unsigned par,
unsigned bin ) const
inline

Definition at line 63 of file FPGATrackSimBinStep.h.

63{ return m_parMin[par] + m_parStep[par] * (double(bin)); }

◆ binWidth()

double FPGATrackSimBinStep::binWidth ( unsigned par) const
inline

Definition at line 65 of file FPGATrackSimBinStep.h.

65{ return m_parStep[par]; }

◆ convertToPrev()

IdxSet FPGATrackSimBinStep::convertToPrev ( const FPGATrackSimBinUtil::IdxSet & cur) const

Definition at line 114 of file FPGATrackSimBinStep.cxx.

114 {
115 IdxSet retv{};
116 if (m_prev) {
117 for (unsigned par =0; par < FPGATrackSimTrackPars::NPARS; par++) {
118 retv[par] = int(cur[par]*((const FPGATrackSimBinStep*)m_prev)->m_parBins[par]/m_parBins[par]);
119 }
120 } else {
121 ATH_MSG_FATAL("convertToPrev called, but no previous");
122 }
123 return retv;
124}
#define ATH_MSG_FATAL(x)
FPGATrackSimBinStep(const std::string &algname, const std::string &name, const IInterface *ifc)
FPGATrackSimBinStep * m_prev
FPGATrackSimBinUtil::IdxSet m_parBins

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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< AlgTool > >::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< AlgTool > >::evtStore ( )
inlineinherited

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

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::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

◆ initialize()

StatusCode FPGATrackSimBinStep::initialize ( )
overridevirtual

Definition at line 19 of file FPGATrackSimBinStep.cxx.

20{
21 // Dump the configuration to make sure it propagated through right
22 const std::vector<Gaudi::Details::PropertyBase*> props = this->getProperties();
23 for( Gaudi::Details::PropertyBase* prop : props ) {
24 if (prop->ownerTypeName()==this->type()) {
25 ATH_MSG_DEBUG("Property:\t" << prop->name() << "\t : \t" << prop->toString());
26 }
27 }
28
29 return StatusCode::SUCCESS;
30}
#define ATH_MSG_DEBUG(x)

◆ initValidBins()

void FPGATrackSimBinStep::initValidBins ( )

Definition at line 139 of file FPGATrackSimBinStep.cxx.

139 {
140 m_validBinFull.setsize(m_parBins, false);
141 m_validBinLocal.setsize(stepIdx(m_parBins), false);
142}
FPGATrackSimBinArray< int > m_validBinLocal
FPGATrackSimBinArray< int > m_validBinFull
const std::vector< unsigned > stepIdx(FPGATrackSimBinUtil::IdxSet idx) const

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::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.

◆ isFirstStep()

bool FPGATrackSimBinStep::isFirstStep ( ) const
inline

Definition at line 84 of file FPGATrackSimBinStep.h.

84{return m_prev==0;}

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

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

Definition at line 30 of file AthCommonMsg.h.

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

◆ nBins()

const std::vector< unsigned > FPGATrackSimBinStep::nBins ( ) const
inline

Definition at line 57 of file FPGATrackSimBinStep.h.

57{return m_parBins;} // bin sizes for only the pars used in this step

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::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.

◆ printValidBin()

void FPGATrackSimBinStep::printValidBin ( ) const

Definition at line 144 of file FPGATrackSimBinStep.cxx.

144 {
145 // count valid bins
146 int validBinsFull = 0;
147
148 for (FPGATrackSimBinArray<int>::ConstIterator bin : m_validBinFull) {
149 if (bin.data())
151 }
152 ATH_MSG_INFO("Step" << name() << "Valid Bins Full: " << validBinsFull);
153
154 // count valid bins local
155 int validBinsLocal = 0;
156 for (FPGATrackSimBinArray<int>::ConstIterator bin : m_validBinLocal) {
157 if (bin.data())
159 }
160 ATH_MSG_INFO("Step" << name() << "Valid Bins Local: " << validBinsLocal);
161
162}
#define ATH_MSG_INFO(x)
const FPGATrackSimBinArray< int > & validBinsLocal() const
const FPGATrackSimBinArray< int > & validBinsFull() const

◆ 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< AlgTool > >::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< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setRanges()

StatusCode FPGATrackSimBinStep::setRanges ( FPGATrackSimBinStep * prev,
const FPGATrackSimBinUtil::ParSet & parMin,
const FPGATrackSimBinUtil::ParSet & parMax )

Definition at line 32 of file FPGATrackSimBinStep.cxx.

34 {
35
36 m_prev = prev;
37 if (prev) {
38 m_stepNum = prev->m_stepNum+1;
39 } else {
40 m_stepNum = 0;
41 }
42 m_parMin = parMin;
43 m_parMax = parMax;
44 m_parBins = std::vector<unsigned>(m_parBinsConfig);
45 for (unsigned par = 0; par < FPGATrackSimTrackPars::NPARS; par++) {
46 if (m_parBins[par] <= 0) {
47 ATH_MSG_FATAL("Every dimension must be at least one bin");
48 return StatusCode::FAILURE;
49 }
51 if (m_parBins[par] <= 0)
52 {
53 ATH_MSG_FATAL("Every dimension must be at least one bin (set #bins=1 for not binning in that parameter)");
54 }
55 if (prev) {
56 if (m_parBins[par] < prev->m_parBins[par]) {
57 ATH_MSG_FATAL("Number of bins can only increase with each step");
58 return StatusCode::FAILURE;
59 }
60 if (m_parBins[par] % prev->m_parBins[par] !=0) {
61 ATH_MSG_FATAL("Number of bins must be integer multiple of bins in previous step");
62 return StatusCode::FAILURE;
63 }
64 if (m_parBins[par] != prev->m_parBins[par]) {
65 // This step involves this parameter
66 m_pars.push_back(par);
67 }
68 } else {
69 if (m_parBins[par] != 1) {
70 // This step involves this parameter
71 m_pars.push_back(par);
72 }
73 }
74 }
75
76 ATH_MSG_DEBUG("Parameters = " << m_pars);
77
78 return StatusCode::SUCCESS;
79}
Gaudi::Property< std::vector< unsigned > > m_parBinsConfig
std::vector< unsigned > m_pars

◆ setValidBin()

void FPGATrackSimBinStep::setValidBin ( const std::vector< unsigned > & idx)

Definition at line 133 of file FPGATrackSimBinStep.cxx.

133 {
134 m_validBinFull[idx] = true;
135 m_validBinLocal[stepIdx(idx)] = true;
136 if (m_prev) m_prev->setValidBin(convertToPrev(idx));
137}
FPGATrackSimBinUtil::IdxSet convertToPrev(const FPGATrackSimBinUtil::IdxSet &cur) const

◆ stepBins()

const std::vector< unsigned > FPGATrackSimBinStep::stepBins ( ) const

Definition at line 130 of file FPGATrackSimBinStep.cxx.

130 {
std::vector< unsigned > subVec(const std::vector< unsigned > &elems, const IdxSet &invec)

◆ stepIdx()

const std::vector< unsigned > FPGATrackSimBinStep::stepIdx ( FPGATrackSimBinUtil::IdxSet idx) const

Definition at line 127 of file FPGATrackSimBinStep.cxx.

127 {

◆ stepName()

const std::string FPGATrackSimBinStep::stepName ( ) const
inline

Definition at line 58 of file FPGATrackSimBinStep.h.

58{return this->name().substr(this->name().find_last_of(".")+1);}

◆ stepNum()

unsigned FPGATrackSimBinStep::stepNum ( ) const
inline

Definition at line 59 of file FPGATrackSimBinStep.h.

59{return m_stepNum;}

◆ stepPars()

const std::vector< unsigned > & FPGATrackSimBinStep::stepPars ( ) const
inline

Definition at line 56 of file FPGATrackSimBinStep.h.

56{return m_pars;} // parameters used for this step

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::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< AlgTool > >::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

◆ validBinsFull()

const FPGATrackSimBinArray< int > & FPGATrackSimBinStep::validBinsFull ( ) const
inline

Definition at line 97 of file FPGATrackSimBinStep.h.

97{ return m_validBinFull;}

◆ validBinsLocal()

const FPGATrackSimBinArray< int > & FPGATrackSimBinStep::validBinsLocal ( ) const
inline

Definition at line 98 of file FPGATrackSimBinStep.h.

98{ return m_validBinLocal;}

Member Data Documentation

◆ FPGATrackSimBinTool

friend FPGATrackSimBinStep::FPGATrackSimBinTool
private

Definition at line 124 of file FPGATrackSimBinStep.h.

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_parBins

FPGATrackSimBinUtil::IdxSet FPGATrackSimBinStep::m_parBins
private

Definition at line 117 of file FPGATrackSimBinStep.h.

◆ m_parBinsConfig

Gaudi::Property<std::vector<unsigned> > FPGATrackSimBinStep::m_parBinsConfig {this,"parBins",{},"Vector of number of bins for each parameter (expect 5)"}
private

Definition at line 101 of file FPGATrackSimBinStep.h.

101{this,"parBins",{},"Vector of number of bins for each parameter (expect 5)"};

◆ m_parMax

FPGATrackSimBinUtil::ParSet FPGATrackSimBinStep::m_parMax
private

Definition at line 122 of file FPGATrackSimBinStep.h.

◆ m_parMin

FPGATrackSimBinUtil::ParSet FPGATrackSimBinStep::m_parMin
private

Definition at line 121 of file FPGATrackSimBinStep.h.

◆ m_pars

std::vector<unsigned> FPGATrackSimBinStep::m_pars {}
private

Definition at line 104 of file FPGATrackSimBinStep.h.

104{};

◆ m_parStep

FPGATrackSimBinUtil::ParSet FPGATrackSimBinStep::m_parStep
private

Definition at line 118 of file FPGATrackSimBinStep.h.

◆ m_prev

FPGATrackSimBinStep* FPGATrackSimBinStep::m_prev {0}
private

Definition at line 113 of file FPGATrackSimBinStep.h.

113{0};

◆ m_stepNum

unsigned FPGATrackSimBinStep::m_stepNum {}
private

Definition at line 114 of file FPGATrackSimBinStep.h.

114{}; // number of step

◆ m_validBinFull

FPGATrackSimBinArray<int> FPGATrackSimBinStep::m_validBinFull
private

Definition at line 109 of file FPGATrackSimBinStep.h.

◆ m_validBinLocal

FPGATrackSimBinArray<int> FPGATrackSimBinStep::m_validBinLocal
private

Definition at line 110 of file FPGATrackSimBinStep.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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