|
ATLAS Offline Software
|
TriggerDB loader of the HLT job options.
More...
#include <JobOptionTableLoader.h>
|
bool | load (JobOptionTable &jot) override |
|
bool | loadHLTMasterTable (int SuperMasterKey, int &masterTableID, int &triggerMenuID, int &l2SetupID, int &efSetupID) |
|
bool | loadComponentNamesAndParameters (TrigConf::JobOptionTable &JOTable, const std::set< int > &compIDsToLoad) |
|
bool | loadComponentNamesAndParameters (TrigConf::JobOptionTable &JOTable, const std::set< int > &compIDsToLoad, std::vector< SplitParam > &splitparams, std::set< int >::const_iterator ¤t, unsigned int batchSize) |
|
std::set< int > | loadComponentIDsFromSetup (const int setup_id) |
|
std::set< int > | loadComponentIDsFromMenu (const int menu_id, int triggerLevel) |
|
std::set< int > | getChildCompIDs (const std::set< int > &compIDs) |
|
std::string | buildCond_IN_ (const std::string &field, const std::set< int > &IDs, std::set< int >::const_iterator ¤t, unsigned int batchSize) |
|
unsigned int | assembleSplitParameters (JobOptionTable &jot, const std::vector< SplitParam > &splitparams) |
|
unsigned int | assembleSplitParameters2 (JobOptionTable &jot, const std::vector< SplitParam > &splitparams) |
|
std::tuple< unsigned int, unsigned int > | loadSchemaVersion () const |
| get DB schema version and run number More...
|
|
TriggerDB loader of the HLT job options.
Definition at line 35 of file JobOptionTableLoader.h.
◆ JobOptionTableLoader()
TrigConf::JobOptionTableLoader::JobOptionTableLoader |
( |
StorageMgr & |
sm, |
|
|
coral::ISessionProxy & |
session |
|
) |
| |
|
inline |
constructor
- Parameters
-
sm | reference to storage manager |
session | reference to the database session |
Definition at line 48 of file JobOptionTableLoader.h.
49 :
DBLoader(
"JobOptionTableLoader", sm, session)
◆ ~JobOptionTableLoader()
virtual TrigConf::JobOptionTableLoader::~JobOptionTableLoader |
( |
| ) |
|
|
overridevirtualdefault |
◆ assembleSplitParameters()
Definition at line 411 of file JobOptionTableLoader.cxx.
413 unsigned int paramCount = 0;
416 std::string mergedvalue =
"";
417 std::string aliasname =
"";
418 std::string paraname =
"";
422 vector< SplitParam > alreadymatched_v;
424 for (
unsigned int sit=0; sit<splitparams.size(); sit++) {
426 const SplitParam & splitpar = splitparams.at(sit);
428 std::string actualname = splitpar.actualname;
433 for (
unsigned int mit=0; mit<alreadymatched_v.size(); mit++){
434 SplitParam matchtemp = alreadymatched_v.at(mit);
435 matched = ( matchtemp.actualname==actualname && matchtemp.alias == splitpar.alias );
442 if( paraname!=actualname || aliasname!=splitpar.alias ){
446 JobOption jo( aliasname, paraname,
"type",
"set", mergedvalue);
450 aliasname = splitpar.alias;
451 paraname = actualname;
455 alreadymatched_v.push_back( splitpar );
456 mergedvalue = splitpar.value;
459 for (
unsigned int sit2=sit+1; sit2<splitparams.size(); sit2++){
460 const SplitParam& newtemp2 = splitparams.at(sit2);
461 std::string actualname2 = newtemp2.actualname;
463 if(actualname2==actualname && splitpar.alias==newtemp2.alias ){
464 mergedvalue+= newtemp2.value;
465 TRG_MSG_VERBOSE(
"Found split parameters " << splitpar.alias <<
" : " << splitpar.name <<
" - " << newtemp2.name);
475 JobOption jo( aliasname, paraname,
"type",
"set", mergedvalue);
◆ assembleSplitParameters2()
Definition at line 506 of file JobOptionTableLoader.cxx.
508 std::map<AssembledPar, std::vector<std::string>, APlessthan > assembled_params;
511 boost::cmatch matches;
514 for(
const SplitParam & splitpar: splitparams ) {
517 if(boost::regex_match(splitpar.name.c_str(), matches, pname_exp)) {
519 const std::string& comp_alias = splitpar.alias;
520 std::string par_name(matches[1].
first, matches[1].
second);
521 unsigned int pos = boost::lexical_cast<unsigned int,std::string>(
string(matches[2].
first, matches[2].
second)) - 1;
523 std::vector<std::string>&
values = assembled_params[ AssembledPar(comp_alias, par_name) ];
529 std::cout <<
"ERROR, can't parse " << splitpar.name << std::endl;
534 for(
auto par: assembled_params) {
536 const string& comp_alias =
par.first.comp_alias;
537 const string& par_name =
par.first.par_name;
544 return assembled_params.size();
◆ buildCond_IN_()
std::string TrigConf::JobOptionTableLoader::buildCond_IN_ |
( |
const std::string & |
field, |
|
|
const std::set< int > & |
IDs, |
|
|
std::set< int >::const_iterator & |
current, |
|
|
unsigned int |
batchSize |
|
) |
| |
|
private |
◆ commitSession()
void TrigConf::DBLoader::commitSession |
( |
| ) |
|
|
inherited |
commit session if not already done
Definition at line 45 of file DBLoader.cxx.
◆ defineQueries()
void TrigConf::JobOptionTableLoader::defineQueries |
( |
| ) |
|
◆ getChildCompIDs()
std::set< int > TrigConf::JobOptionTableLoader::getChildCompIDs |
( |
const std::set< int > & |
compIDs | ) |
|
|
private |
Definition at line 335 of file JobOptionTableLoader.cxx.
337 std::set<int> childCompIDs;
341 vector<int> sortedParentIDs = createSortedVector(compIDs);
343 vector<string> splitParentIDs = concatAndSplit(sortedParentIDs, 7500);
345 for(
const string& idList : splitParentIDs) {
348 string cond =
"HCP2CP_PARENT_COMP_ID IN (" + idList +
")";
350 coral::ITable&
table =
m_session.nominalSchema().tableHandle(
"HLT_CP_TO_CP");
351 std::unique_ptr< coral::IQuery >
q(
table.newQuery() );
354 q->setCondition( cond, bind );
358 attList.extend<
int>(
"HCP2CP_CHILD_COMP_ID" );
365 coral::ICursor&
cursor =
q->execute();
370 int id =
row[
"HCP2CP_CHILD_COMP_ID"].data<
int>();
371 childCompIDs.insert(
id);
377 if(childCompIDs.size()==0)
384 childCompIDs.insert(allSubChildrenIDs.begin(),allSubChildrenIDs.end());
◆ isRun1()
bool TrigConf::DBLoader::isRun1 |
( |
| ) |
|
|
inlineinherited |
◆ isRun2()
bool DBLoader::isRun2 |
( |
| ) |
|
|
inherited |
◆ load() [1/2]
Implements TrigConf::IJobOptionTableLoader.
Definition at line 549 of file JobOptionTableLoader.cxx.
562 int masterTableID(0);
563 int triggerMenuID(0);
579 if(l2SetupID==efSetupID) {
587 if( l2SetupID == efSetupID ||
588 (l2SetupID != 0 && efSetupID==0) )
591 int setupId = (
level==0 ||
level==2) ? l2SetupID : efSetupID;
596 TRG_MSG_INFO(
"Direct components => " << compIDsToLoad.size());
600 TRG_MSG_INFO(
"All children => " << childCompIDs.size());
602 compIDsToLoad.insert(childCompIDs.begin(), childCompIDs.end());
604 TRG_MSG_INFO(
"All components => " << compIDsToLoad.size());
◆ load() [2/2]
bool TrigConf::JobOptionTableLoader::load |
( |
TrigConfData & |
data | ) |
|
|
virtual |
◆ loadComponentIDsFromMenu()
std::set< int > TrigConf::JobOptionTableLoader::loadComponentIDsFromMenu |
( |
const int |
menu_id, |
|
|
int |
triggerLevel |
|
) |
| |
|
private |
Definition at line 206 of file JobOptionTableLoader.cxx.
208 std::set<int> compIDs;
210 std::unique_ptr< coral::IQuery >
q(
m_session.nominalSchema().newQuery() );
211 q->setRowCacheSize( 1000 );
213 q->addToTableList(
"HLT_TM_TO_TC",
"TM2TC" );
214 q->addToTableList(
"HLT_TRIGGER_CHAIN",
"TC" );
215 q->addToTableList(
"HLT_TC_TO_TS",
"TC2TS" );
216 q->addToTableList(
"HLT_TS_TO_TE",
"TS2TE" );
217 q->addToTableList(
"HLT_TE_TO_CP",
"TE2CP" );
221 bind.extend<
int>(
"menuid");
222 bind[0].data<
int>() = menu_id;
226 std::string cond(
"TM2TC.HTM2TC_TRIGGER_MENU_ID = :menuid");
227 cond +=
" AND TM2TC.HTM2TC_TRIGGER_CHAIN_ID = TC.HTC_ID";
228 cond +=
" AND TM2TC.HTM2TC_TRIGGER_CHAIN_ID = TC2TS.HTC2TS_TRIGGER_CHAIN_ID";
229 cond +=
" AND TC2TS.HTC2TS_TRIGGER_SIGNATURE_ID = TS2TE.HTS2TE_TRIGGER_SIGNATURE_ID";
230 cond +=
" AND TS2TE.HTS2TE_TRIGGER_ELEMENT_ID = TE2CP.HTE2CP_TRIGGER_ELEMENT_ID";
233 if(triggerLevel!=2) {
234 cond +=
" AND TC.HTC_L2_OR_EF = ";
235 cond += ( triggerLevel==0 ?
"'L2'" :
"'EF'" );
238 q->setCondition( cond , bind );
242 attList.extend<
int>(
"TE2CP.HTE2CP_COMPONENT_ID" );
246 coral::ICursor&
cursor =
q->execute();
249 int id =
row[
"TE2CP.HTE2CP_COMPONENT_ID"].data<
int>();
253 TRG_MSG_INFO(
"Loaded M-Components => " << compIDs.size());
◆ loadComponentIDsFromSetup()
std::set< int > TrigConf::JobOptionTableLoader::loadComponentIDsFromSetup |
( |
const int |
setup_id | ) |
|
|
private |
Definition at line 168 of file JobOptionTableLoader.cxx.
170 std::set<int> compIDs;
172 std::unique_ptr< coral::IQuery >
q(
m_session.nominalSchema().newQuery() );
173 q->setRowCacheSize( 1000 );
176 q->addToTableList (
"HLT_ST_TO_CP",
"ST2CP" );
180 bind.extend<
int>(
"setupid");
181 bind[0].data<
int>() = setup_id;
183 std::string cond(
"ST2CP.HST2CP_SETUP_ID = :setupid");
184 q->setCondition( cond , bind );
188 attList.extend<
int>(
"ST2CP.HST2CP_COMPONENT_ID" );
192 coral::ICursor&
cursor =
q->execute();
195 int id =
row[
"ST2CP.HST2CP_COMPONENT_ID"].data<
int>();
199 TRG_MSG_INFO(
"Loaded I-Components => " << compIDs.size());
◆ loadComponentNamesAndParameters() [1/2]
bool TrigConf::JobOptionTableLoader::loadComponentNamesAndParameters |
( |
TrigConf::JobOptionTable & |
JOTable, |
|
|
const std::set< int > & |
compIDsToLoad |
|
) |
| |
|
private |
Definition at line 91 of file JobOptionTableLoader.cxx.
93 unsigned int batchSize = 500;
94 set<int>::const_iterator
current = compIDsToLoad.begin();
95 vector< SplitParam > splitparams;
98 while(
current!=compIDsToLoad.end()) {
103 TRG_MSG_INFO(
"Split parameters => " << splitparams.size());
106 TRG_MSG_INFO(
"Assembled split parameters => " << countSplitParam);
◆ loadComponentNamesAndParameters() [2/2]
bool JobOptionTableLoader::loadComponentNamesAndParameters |
( |
TrigConf::JobOptionTable & |
JOTable, |
|
|
const std::set< int > & |
compIDsToLoad, |
|
|
std::vector< SplitParam > & |
splitparams, |
|
|
std::set< int >::const_iterator & |
current, |
|
|
unsigned int |
batchSize |
|
) |
| |
|
private |
Definition at line 112 of file JobOptionTableLoader.cxx.
118 unique_ptr< coral::IQuery >
q(
m_session.nominalSchema().newQuery() );
119 q->setRowCacheSize( 500 );
121 q->addToTableList (
"HLT_COMPONENT",
"CP" );
122 q->addToTableList (
"HLT_CP_TO_PA",
"CP2PA" );
123 q->addToTableList (
"HLT_PARAMETER",
"PA" );
130 cond +=
" AND CP2PA.HCP2PA_COMPONENT_ID = CP.HCP_ID";
131 cond +=
" AND CP2PA.HCP2PA_PARAMETER_ID = PA.HPA_ID";
132 q->setCondition( cond , bind );
136 attList.extend<std::string>(
"CP.HCP_ALIAS" );
137 attList.extend<std::string>(
"CP.HCP_TYPE" );
138 attList.extend<std::string>(
"PA.HPA_NAME" );
139 attList.extend<std::string>(
"PA.HPA_VALUE" );
142 coral::ICursor&
cursor =
q->execute();
148 string alias =
row[
"CP.HCP_ALIAS"].data<std::string>();
149 string type =
"type";
150 string name =
row[
"PA.HPA_NAME"].data<std::string>();
151 string value =
row[
"PA.HPA_VALUE"].data<std::string>();
156 if(
name.find(
"__IPC__",0) != string::npos){
◆ loadHLTMasterTable()
bool TrigConf::JobOptionTableLoader::loadHLTMasterTable |
( |
int |
SuperMasterKey, |
|
|
int & |
masterTableID, |
|
|
int & |
triggerMenuID, |
|
|
int & |
l2SetupID, |
|
|
int & |
efSetupID |
|
) |
| |
|
private |
Definition at line 35 of file JobOptionTableLoader.cxx.
41 unique_ptr< coral::IQuery >
q(
m_session.nominalSchema().newQuery() );
44 q->addToTableList (
"SUPER_MASTER_TABLE",
"SM" );
45 q->addToTableList (
"HLT_MASTER_TABLE",
"HM" );
49 bindList.extend<
int>(
"smid");
50 bindList[0].data<
int>() = SuperMasterKey;
53 string theCondition =
"SM.SMT_HLT_MASTER_TABLE_ID = HM.HMT_ID AND SM.SMT_ID = :smid";
55 q->setCondition( theCondition, bindList );
59 attList.extend<
int> (
"HM.HMT_ID" );
60 attList.extend<
int> (
"HM.HMT_TRIGGER_MENU_ID" );
62 attList.extend<
int> (
"HM.HMT_L2_SETUP_ID" );
63 attList.extend<
int> (
"HM.HMT_EF_SETUP_ID" );
65 attList.extend<
int> (
"HM.HMT_SETUP_ID" );
70 coral::ICursor&
cursor =
q->execute();
78 masterTableID =
row[
"HM.HMT_ID"].data<
int>();
79 triggerMenuID =
row[
"HM.HMT_TRIGGER_MENU_ID"].data<
int>();
81 l2SetupID =
row[
"HM.HMT_L2_SETUP_ID"].data<
int>();
82 efSetupID =
row[
"HM.HMT_EF_SETUP_ID"].data<
int>();
84 l2SetupID = efSetupID =
row[
"HM.HMT_SETUP_ID"].data<
int>();
◆ loadL1MasterKey()
bool TrigConf::DBLoader::loadL1MasterKey |
( |
int |
SuperMasterKey, |
|
|
int & |
Lvl1MasterKey |
|
) |
| |
|
inherited |
get l1 master from super master
Definition at line 128 of file DBLoader.cxx.
132 unique_ptr< coral::IQuery >
q(
m_session.nominalSchema().tableHandle(
"SUPER_MASTER_TABLE").newQuery() );
133 q->setRowCacheSize( 5 );
137 bindings.extend<
int>(
"smtid");
138 bindings[0].data<
int>() =
smk;
139 q->setCondition(
"SMT_ID = :smtid", bindings );
143 attList.extend<
int>(
"SMT_L1_MASTER_TABLE_ID" );
146 coral::ICursor&
cursor =
q->execute();
148 msg() <<
"DBLoader: No such SuperMaster key exists " <<
smk << endl;
149 throw runtime_error(
"DBLoader: SuperMasterKey not available" );
153 Lvl1MasterKey =
row[
"SMT_L1_MASTER_TABLE_ID"].data<
int>();
157 msg() <<
"DBLoader: C++ exception: " <<
e.what() << std::endl;
◆ loadL1MenuKey()
bool TrigConf::DBLoader::loadL1MenuKey |
( |
int |
SuperMasterKey, |
|
|
int & |
Lvl1MenuKey |
|
) |
| |
|
inherited |
get l1 menu id from super master
Definition at line 167 of file DBLoader.cxx.
175 unique_ptr< coral::IQuery >
q(
m_session.nominalSchema().tableHandle(
"L1_MASTER_TABLE").newQuery() );
176 q->setRowCacheSize( 5 );
180 bindings.extend<
int>(
"l1mtid");
181 bindings[0].data<
int>() = l1Master;
182 q->setCondition(
"L1MT_ID = :l1mtid" , bindings );
186 attList.extend<
int>(
"L1MT_TRIGGER_MENU_ID" );
187 q->defineOutput(attList);
188 q->addToOutputList(
"L1MT_TRIGGER_MENU_ID" );
190 coral::ICursor&
cursor =
q->execute();
192 msg() <<
"DBLoader >> No such L1 Master key exists " << l1Master << std::endl;
193 throw std::runtime_error(
"DBLoader >> L1MasterKey not available" );
198 Lvl1MenuKey =
row[
"L1MT_TRIGGER_MENU_ID"].data<
int>();
204 msg() <<
"DBLoader >> Standard C++ exception: " <<
e.what() << std::endl;
◆ loadSchemaVersion()
std::tuple< unsigned int, unsigned int > DBLoader::loadSchemaVersion |
( |
| ) |
const |
|
privateinherited |
get DB schema version and run number
Definition at line 81 of file DBLoader.cxx.
83 const static auto versions = [&]() -> std::tuple<unsigned int,unsigned int> {
84 bool mySession =
false;
85 if ( !
m_session.transaction().isActive() ) {
90 std::unique_ptr< coral::IQuery >
q(
m_session.nominalSchema().tableHandle(
"TRIGGER_SCHEMA").newQuery() );
91 q->setRowCacheSize( 1 );
95 attList.extend<
int>(
"TS_ID" );
96 q->defineOutput(attList);
97 q->addToOutputList(
"TS_ID" );
99 q->addToOrderList(
"TS_ID desc");
100 coral::ICursor&
cursor =
q->execute();
104 if ( mySession )
m_session.transaction().commit();
105 throw std::runtime_error(
"DBLoader::loadSchemaVersion() >> Table TRIGGER_SCHEMA is not filled" );
113 const unsigned int run =
m_session.nominalSchema().existsTable(
"ACTIVE_MASTERS" ) ? 2 : 1;
119 if ( mySession )
m_session.transaction().commit();
◆ msg() [1/4]
The standard message stream.
Returns a reference to the message stream May not be invoked before sysInitialize() has been invoked.
Definition at line 52 of file TrigConfMessaging.h.
◆ msg() [2/4]
MsgStreamTC & TrigConf::TrigConfMessaging::msg |
( |
| ) |
const |
|
inlineinherited |
The standard message stream.
Returns a reference to the message stream May not be invoked before sysInitialize() has been invoked.
Definition at line 81 of file TrigConfMessaging.h.
◆ msg() [3/4]
The standard message stream.
Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.
Definition at line 58 of file TrigConfMessaging.h.
◆ msg() [4/4]
The standard message stream.
Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.
Definition at line 91 of file TrigConfMessaging.h.
◆ msgLvl()
Test the output level.
- Parameters
-
lvl | The message level to test against |
- Returns
- boolean Indicting if messages at given level will be printed
- Return values
-
true | Messages at level "lvl" will be printed |
Definition at line 70 of file TrigConfMessaging.h.
◆ outputLevel()
virtual MSGTC::Level TrigConf::DBLoader::outputLevel |
( |
| ) |
const |
|
inlineoverridevirtualinherited |
◆ setLevel()
◆ setVerbose()
virtual void TrigConf::DBLoader::setVerbose |
( |
int |
v | ) |
|
|
inlineoverridevirtualinherited |
◆ startSession()
void TrigConf::DBLoader::startSession |
( |
| ) |
|
|
inherited |
start session if not already active
Definition at line 35 of file DBLoader.cxx.
37 if ( !
m_session.transaction().isActive() ) {
◆ triggerDBSchemaVersion()
unsigned int DBLoader::triggerDBSchemaVersion |
( |
| ) |
|
|
inherited |
◆ verbose()
virtual int TrigConf::DBLoader::verbose |
( |
| ) |
const |
|
inlineoverridevirtualinherited |
◆ m_msg_tls
boost::thread_specific_ptr<MsgStreamTC> TrigConf::TrigConfMessaging::m_msg_tls |
|
mutableprivateinherited |
◆ m_name
std::string TrigConf::TrigConfMessaging::m_name |
|
privateinherited |
◆ m_session
coral::ISessionProxy& TrigConf::DBLoader::m_session |
|
protectedinherited |
CORAL interface to database session.
Definition at line 68 of file DBLoader.h.
◆ m_sessionOwner
bool TrigConf::DBLoader::m_sessionOwner {false} |
|
protectedinherited |
remember if the loader started the session in the first place
Definition at line 69 of file DBLoader.h.
◆ m_storageMgr
reference to the storage manager
Definition at line 67 of file DBLoader.h.
◆ m_verbose
int TrigConf::DBLoader::m_verbose {1} |
|
privateinherited |
The documentation for this class was generated from the following files:
JetConstituentVector::iterator iterator
bool loadComponentNamesAndParameters(TrigConf::JobOptionTable &JOTable, const std::set< int > &compIDsToLoad)
char data[hepevt_bytes_allocation_ATLAS]
std::set< int > getChildCompIDs(const std::set< int > &compIDs)
std::vector< JobOption > & jobOptionVector()
accessor to the vector of job options
boost::thread_specific_ptr< MsgStreamTC > m_msg_tls
MsgStreamTC instance (a std::cout like with print-out levels)
#define TRG_MSG_VERBOSE(x)
int hltMasterTableId() const
accessor to the HLT master table configuration key
void fillQuery(coral::IQuery *q, coral::AttributeList &attList)
unsigned int triggerDBSchemaVersion()
coral::ISessionProxy & m_session
CORAL interface to database session.
table to hold the complete list of JobOption entries for a single configuration, from which the JobOp...
DBLoader(StorageMgr &sm, coral::ISessionProxy &session)
constructor
void setHltMasterTableId(int id)
setter of the HLT master table configuration key
bool m_sessionOwner
remember if the loader started the session in the first place
MsgStreamTC & msg() const
The standard message stream.
std::set< int > loadComponentIDsFromSetup(const int setup_id)
MSGTC::Level level()
Return message level of stream.
int triggerLevel() const
accessor to the trigger level
hold a single job option (parameter and value)
bool loadHLTMasterTable(int SuperMasterKey, int &masterTableID, int &triggerMenuID, int &l2SetupID, int &efSetupID)
void sort()
sort alphabetically by component and property name
void commitSession()
commit session if not already done
void addJobOption(const JobOption &jo)
adds a job option to the table
virtual bool load(TrigConfData &data)
unsigned int assembleSplitParameters2(JobOptionTable &jot, const std::vector< SplitParam > &splitparams)
std::tuple< unsigned int, unsigned int > loadSchemaVersion() const
get DB schema version and run number
void startSession()
start session if not already active
void setLevel(MSGTC::Level lvl)
Set message level of stream.
std::string buildCond_IN_(const std::string &field, const std::set< int > &IDs, std::set< int >::const_iterator ¤t, unsigned int batchSize)
bool loadL1MasterKey(int SuperMasterKey, int &Lvl1MasterKey)
get l1 master from super master