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

#include <TBCondRunParTool.h>

Inheritance diagram for TBCondRunParTool:
Collaboration diagram for TBCondRunParTool:

Public Member Functions

 TBCondRunParTool (const std::string &type, const std::string &name, const IInterface *parent)
 ~TBCondRunParTool ()
StatusCode initialize ()
StatusCode finalize ()
int status ()
int run_number ()
int trigger_type ()
int det_mask ()
int beam_type ()
int beam_energy ()
std::string & file_tag ()
std::string & time_SOR ()
StatusCode getTable (const std::string &table, const int irow, const void *tblptr, int &ncol, int &nrow, std::vector< std::string > &names, std::vector< std::string > &rows) const
StatusCode extractVal (const std::vector< std::string > &names, const std::vector< std::string > &rows, const std::string &name, int &ival) const
StatusCode extractVal (const std::vector< std::string > &names, const std::vector< std::string > &rows, const std::string &name, float &fval) const
StatusCode extractVal (const std::vector< std::string > &names, const std::vector< std::string > &rows, const std::string &name, std::string &sval) const
void printTable (const std::vector< std::string > &names, const std::vector< std::string > &rows) const
StatusCode getVal (const std::string &folder, const unsigned int chnum, float &fval)
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

Static Public Member Functions

static const InterfaceID & interfaceID ()

Public Attributes

 IOVDbSvc = Service("IOVDbSvc")
 ToolSvc = Service("ToolSvc")
 RunParamFolder

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

bool checkcache ()
bool extractCool (const int run)
bool extractCoolTest (const std::string &folder, int run) const
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

int m_crun {-1}
int m_cevent {-1}
std::string m_runpfolder
int m_status {-1}
int m_run_number {-1}
int m_trigger_type {-1}
int m_det_mask {-1}
int m_beam_type {-1}
int m_beam_energy {-1}
std::string m_file_tag
std::string m_time_SOR
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 19 of file TBCondRunParTool.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

◆ TBCondRunParTool()

TBCondRunParTool::TBCondRunParTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 17 of file TBCondRunParTool.cxx.

19 : AthAlgTool(type,name,parent)
20{
21 declareInterface<TBCondRunParTool>(this);
22 declareProperty("RunParamFolder",m_runpfolder);
23}

◆ ~TBCondRunParTool()

TBCondRunParTool::~TBCondRunParTool ( )

Definition at line 25 of file TBCondRunParTool.cxx.

26{}

Member Function Documentation

◆ beam_energy()

int TBCondRunParTool::beam_energy ( )
inline

Definition at line 86 of file TBCondRunParTool.h.

87 { checkcache(); return m_beam_energy;}

◆ beam_type()

int TBCondRunParTool::beam_type ( )
inline

Definition at line 84 of file TBCondRunParTool.h.

85 { checkcache(); return m_beam_type;}

◆ checkcache()

bool TBCondRunParTool::checkcache ( )
private

Definition at line 46 of file TBCondRunParTool.cxx.

46 {
47 // find the current run and event - check if data structure may have changed
48 const EventContext& ctx = Gaudi::Hive::currentContext();
49 int run = ctx.eventID().run_number();
50 int event = ctx.eventID().event_number();
51 bool update=false;
52 if (run!=m_crun || event!=m_cevent) {
53 ATH_MSG_DEBUG ( "Retrieve new data for run/event " << run << "/" << event );
54 m_crun=run;
55 m_cevent=event;
56 // access the database and update cached values
57 update=true;
58 m_run_number=-1;
59 m_trigger_type=-1;
60 m_det_mask=-1;
61 m_beam_type=-1;
62 m_beam_energy=-1;
63 m_file_tag="";
64
65 update=extractCool(run);
66 }
67 return update;
68}
#define ATH_MSG_DEBUG(x)
Definition run.py:1

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

◆ det_mask()

int TBCondRunParTool::det_mask ( )
inline

Definition at line 82 of file TBCondRunParTool.h.

83 { checkcache(); return m_det_mask;}

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

◆ extractCool()

bool TBCondRunParTool::extractCool ( const int run)
private

Definition at line 164 of file TBCondRunParTool.cxx.

164 {
165 bool update=true;
166 const AthenaAttributeList* atrlist=0;
167 std::string table=m_runpfolder+"/RunParams.RunParams";
168 if (StatusCode::SUCCESS==detStore()->retrieve(atrlist,table)) {
169 // std::ostringstream atrs;
170 // atrlist->print(atrs);
171 // m_log << "Attribute list contents: " << atrs.str() << endmsg;
172 long ldata;
173 m_run_number=(*atrlist)["run_number"].data<int>();
174 m_trigger_type=(*atrlist)["trigger_type"].data<int>();
175 m_det_mask=(*atrlist)["detector_mask"].data<int>();
176 m_beam_type=(*atrlist)["beam_type"].data<int>();
177 m_beam_energy=(*atrlist)["beam_energy"].data<int>();
178 m_file_tag=(*atrlist)["filename_tag"].data<std::string>();
179 // FIXME should be long
180 ldata=(*atrlist)["timeSOR"].data<int>();
181 std::ostringstream timeSOR;
182 timeSOR << ldata;
183 m_time_SOR=timeSOR.str();
184 ATH_MSG_DEBUG ("run_number: "<<m_run_number<<" m_beam_energy: "<<m_beam_energy);
185 // check consistency
186 m_status=0;
187 if (m_run_number!=run) m_status=1;
188 } else {
189 ATH_MSG_ERROR ( "Cannot retrieve AttributeList for " << table );
190 m_status=1;
191 }
192 return update;
193}
#define ATH_MSG_ERROR(x)
An AttributeList represents a logical row of attributes in a metadata table.

◆ extractCoolTest()

bool TBCondRunParTool::extractCoolTest ( const std::string & folder,
int run ) const
private

Definition at line 195 of file TBCondRunParTool.cxx.

195 {
196 bool update=true;
197 const CondAttrListCollection* atrlist=0;
198 if (StatusCode::SUCCESS==detStore()->retrieve(atrlist,folder)) {
199// std::ostringstream atrs;
200 ATH_MSG_DEBUG ( "Attribute list contents: " );
201 atrlist->dump();
202 }
203 return update;
204}
This class is a collection of AttributeLists where each one is associated with a channel number.
void dump() const
Dump our contents to std::cout.

◆ extractVal() [1/3]

StatusCode TBCondRunParTool::extractVal ( const std::vector< std::string > & names,
const std::vector< std::string > & rows,
const std::string & name,
float & fval ) const

Definition at line 104 of file TBCondRunParTool.cxx.

107 {
108 StatusCode found=StatusCode::FAILURE;
109 for (unsigned int icol=0;icol<names.size();++icol) {
110 ATH_MSG_DEBUG ( "Check " << icol << " " << names[icol] << rows[icol] );
111 if (names[icol]==name) {
112 fval=atof(rows[icol].c_str());
113 found=StatusCode::SUCCESS;
114 break;
115 }
116 }
117 return found;
118}

◆ extractVal() [2/3]

StatusCode TBCondRunParTool::extractVal ( const std::vector< std::string > & names,
const std::vector< std::string > & rows,
const std::string & name,
int & ival ) const

Definition at line 88 of file TBCondRunParTool.cxx.

91 {
92 StatusCode found=StatusCode::FAILURE;
93 for (unsigned int icol=0;icol<names.size();++icol) {
94 ATH_MSG_DEBUG ( "Check " << icol << " " << names[icol] << rows[icol] );
95 if (names[icol]==name) {
96 ival=atoi(rows[icol].c_str());
97 found=StatusCode::SUCCESS;
98 break;
99 }
100 }
101 return found;
102}

◆ extractVal() [3/3]

StatusCode TBCondRunParTool::extractVal ( const std::vector< std::string > & names,
const std::vector< std::string > & rows,
const std::string & name,
std::string & sval ) const

Definition at line 120 of file TBCondRunParTool.cxx.

123 {
124 StatusCode found=StatusCode::FAILURE;
125 for (unsigned int icol=0;icol<names.size();++icol) {
126 ATH_MSG_DEBUG ( "Check " << icol << " " << names[icol] << rows[icol] );
127 if (names[icol]==name) {
128 sval=rows[icol];
129 found=StatusCode::SUCCESS;
130 break;
131 }
132 }
133 return found;
134}

◆ 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

◆ file_tag()

std::string & TBCondRunParTool::file_tag ( )
inline

Definition at line 88 of file TBCondRunParTool.h.

89 { checkcache(); return m_file_tag; }

◆ finalize()

StatusCode TBCondRunParTool::finalize ( )

Definition at line 41 of file TBCondRunParTool.cxx.

41 {
42 ATH_MSG_DEBUG ( "Finalize called" );
43 return StatusCode::SUCCESS;
44}

◆ getTable()

StatusCode TBCondRunParTool::getTable ( const std::string & table,
const int irow,
const void * tblptr,
int & ncol,
int & nrow,
std::vector< std::string > & names,
std::vector< std::string > & rows ) const

Definition at line 70 of file TBCondRunParTool.cxx.

73 {
74 // this implementation is dummy - at present it does not return anything
75 //tblptr=0;
76 ncol=0;
77 nrow=0;
78 names.clear();
79 rows.clear();
80 ATH_MSG_DEBUG ( "getTable: " << table );
81 bool iret = extractCoolTest(std::string("/TILE/DCS/TILE_LV_62/BEAM"), 0);
82 // get number of columns and rows
83 if(!iret)
84 ATH_MSG_DEBUG ( "extractCoolTest: /TILE/DCS/TILE_LV_62/BEAM failed !" );
85 return StatusCode::SUCCESS;
86}

◆ getVal()

StatusCode TBCondRunParTool::getVal ( const std::string & folder,
const unsigned int chnum,
float & fval )

Definition at line 142 of file TBCondRunParTool.cxx.

142 {
143 StatusCode found=StatusCode::FAILURE;
144 const CondAttrListCollection* atrlist=0;
145 if (StatusCode::SUCCESS==detStore()->retrieve(atrlist,folder)) {
148 for (; it != last; ++it) {
149 if(chnum == (*it).first) {
150// std::cout << "chan, attr: " << (*it).first << " / "<<(*it).second.toOutputStream(std::cout)<< std::endl;
151 fval = (*it).second[0].data<float>();
152 found = StatusCode::SUCCESS;
153 ATH_MSG_DEBUG ( "chnum: "<<chnum<<" chan, attr: " << (*it).first <<" fval: "<<fval);
154 break;
155 }
156 }
157 }
158
159 return found;
160}
const_iterator end() const
const_iterator begin() const
Access to Chan/AttributeList pairs via iterators.
ChanAttrListMap::const_iterator const_iterator

◆ initialize()

StatusCode TBCondRunParTool::initialize ( )

Definition at line 31 of file TBCondRunParTool.cxx.

32{
33 ATH_MSG_INFO ( "In initialize of TBCondRunParTool" );
35 "RunParams will be read from folder: " << m_runpfolder <<
36 " in COOL database" );
37 // check StoreGate service available
38 return StatusCode::SUCCESS;
39}
#define ATH_MSG_INFO(x)

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

◆ interfaceID()

const InterfaceID & TBCondRunParTool::interfaceID ( )
static

Definition at line 28 of file TBCondRunParTool.cxx.

static const InterfaceID IID_TBCONDRUNPAR_TBCondRunParTool("TBCondRunParTool", 1, 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 }

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

◆ printTable()

void TBCondRunParTool::printTable ( const std::vector< std::string > & names,
const std::vector< std::string > & rows ) const

Definition at line 136 of file TBCondRunParTool.cxx.

137 {
138 for (unsigned int icol=0;icol<names.size();++icol)
139 ATH_MSG_INFO ( "Column: " << icol << " " << names[icol] << rows[icol] );
140}

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

◆ run_number()

int TBCondRunParTool::run_number ( )
inline

Definition at line 78 of file TBCondRunParTool.h.

79 { checkcache(); return m_run_number;}

◆ status()

int TBCondRunParTool::status ( )
inline

Definition at line 76 of file TBCondRunParTool.h.

77 { checkcache(); return m_status;}

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

◆ time_SOR()

std::string & TBCondRunParTool::time_SOR ( )
inline

Definition at line 90 of file TBCondRunParTool.h.

91 { checkcache(); return m_time_SOR; }

◆ trigger_type()

int TBCondRunParTool::trigger_type ( )
inline

Definition at line 80 of file TBCondRunParTool.h.

81 { checkcache(); return m_trigger_type;}

◆ 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

Member Data Documentation

◆ IOVDbSvc

TBCondRunParTool.IOVDbSvc = Service("IOVDbSvc")

Definition at line 4 of file TBCondRunParTool.py.

◆ m_beam_energy

int TBCondRunParTool::m_beam_energy {-1}
private

Definition at line 70 of file TBCondRunParTool.h.

70{-1};

◆ m_beam_type

int TBCondRunParTool::m_beam_type {-1}
private

Definition at line 69 of file TBCondRunParTool.h.

69{-1};

◆ m_cevent

int TBCondRunParTool::m_cevent {-1}
private

Definition at line 62 of file TBCondRunParTool.h.

62{-1};

◆ m_crun

int TBCondRunParTool::m_crun {-1}
private

Definition at line 61 of file TBCondRunParTool.h.

61{-1};

◆ m_det_mask

int TBCondRunParTool::m_det_mask {-1}
private

Definition at line 68 of file TBCondRunParTool.h.

68{-1};

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

std::string TBCondRunParTool::m_file_tag
private

Definition at line 71 of file TBCondRunParTool.h.

◆ m_run_number

int TBCondRunParTool::m_run_number {-1}
private

Definition at line 66 of file TBCondRunParTool.h.

66{-1};

◆ m_runpfolder

std::string TBCondRunParTool::m_runpfolder
private

Definition at line 63 of file TBCondRunParTool.h.

◆ m_status

int TBCondRunParTool::m_status {-1}
private

Definition at line 65 of file TBCondRunParTool.h.

65{-1};

◆ m_time_SOR

std::string TBCondRunParTool::m_time_SOR
private

Definition at line 72 of file TBCondRunParTool.h.

◆ m_trigger_type

int TBCondRunParTool::m_trigger_type {-1}
private

Definition at line 67 of file TBCondRunParTool.h.

67{-1};

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

◆ RunParamFolder

TBCondRunParTool.RunParamFolder

Definition at line 13 of file TBCondRunParTool.py.

◆ ToolSvc

TBCondRunParTool.ToolSvc = Service("ToolSvc")

Definition at line 5 of file TBCondRunParTool.py.


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