14 #include "boost/lexical_cast.hpp"
24 m_schemaversion = triggerDBSchemaVersion();
38 catch(
const coral::Exception&
e ) {
40 m_session.transaction().rollback();
44 chains.setEFLowerChainCounter();
55 std::unique_ptr< coral::IQuery >
q( m_session.nominalSchema().newQuery() );
58 q->addToTableList (
"SUPER_MASTER_TABLE",
"SM" );
59 q->addToTableList (
"HLT_MASTER_TABLE",
"HM" );
60 q->addToTableList (
"HLT_TRIGGER_MENU",
"TM" );
61 q->addToTableList (
"HLT_TM_TO_TC",
"TM2TC" );
62 q->addToTableList (
"HLT_TRIGGER_CHAIN",
"TC" );
66 bindList.extend<
int>(
"smid");
67 bindList[0].data<
int>() = (
int)m_smk;
69 string theCondition =
"";
70 theCondition += string(
" SM.SMT_ID = :smid");
71 theCondition += string(
" AND HM.HMT_ID = SM.SMT_HLT_MASTER_TABLE_ID" );
72 theCondition += string(
" AND TM.HTM_ID = HM.HMT_TRIGGER_MENU_ID" );
73 theCondition += string(
" AND TM.HTM_ID = TM2TC.HTM2TC_TRIGGER_MENU_ID " );
74 theCondition += string(
" AND TC.HTC_ID = TM2TC.HTM2TC_TRIGGER_CHAIN_ID" );
76 q->setCondition( theCondition, bindList );
80 attList.extend<
long> (
"TC.HTC_ID" );
81 attList.extend<
string>(
"TC.HTC_NAME" );
82 attList.extend<
string>(
"TC.HTC_LOWER_CHAIN_NAME" );
84 attList.extend<
string>(
"TC.HTC_L2_OR_EF" );
85 attList.extend<
string>(
"TC.HTC_RERUN_PRESCALE" );
87 attList.extend<
int> (
"TC.HTC_CHAIN_COUNTER" );
88 attList.extend<
int> (
"TC.HTC_VERSION" );
94 theOrder +=
" TC.HTC_L2_OR_EF DESC, ";
96 theOrder +=
" TC.HTC_CHAIN_COUNTER ASC";
97 q->addToOrderList( theOrder );
101 coral::ICursor&
cursor =
q->execute();
106 long chainId =
row[
"TC.HTC_ID"].data<
long>();
107 int counter =
row[
"TC.HTC_CHAIN_COUNTER"].data<
int>();
108 int version =
row[
"TC.HTC_VERSION"].data<
int>();
110 string lower_chain_name =
rmtilde(
row[
"TC.HTC_LOWER_CHAIN_NAME"].data<string>());
113 string level =
"HLT";
124 string rerunps_s =
rmtilde(
row[
"TC.HTC_RERUN_PRESCALE"].data<string>());
125 rerunps = boost::lexical_cast<float,string>(rerunps_s);
127 ch->set_rerun_prescale(rerunps);
135 TRG_MSG_INFO(
"Loaded " << chainlist.size() <<
" chains");
144 q->addToTableList (
"SUPER_MASTER_TABLE",
"SM" );
145 q->addToTableList (
"HLT_MASTER_TABLE",
"HM" );
146 q->addToTableList (
"HLT_TM_TO_TC",
"TM2TC" );
147 q->addToTableList (
"HLT_TRIGGER_CHAIN",
"TC" );
149 theCondition += string(
" SM.SMT_ID = :smid" );
150 theCondition += string(
" AND SM.SMT_HLT_MASTER_TABLE_ID = HM.HMT_ID" );
151 theCondition += string(
" AND HM.HMT_TRIGGER_MENU_ID = TM2TC.HTM2TC_TRIGGER_MENU_ID " );
152 theCondition += string(
" AND TC.HTC_ID = TM2TC.HTM2TC_TRIGGER_CHAIN_ID" );
154 bindings.extend<
int>(
"smid");
155 bindings[0].data<
int>() =
smk;
157 output.extend<
string>(
"TC.HTC_NAME" );
166 std::unique_ptr< coral::IQuery >
q( m_session.nominalSchema().newQuery() );
167 string theCondition(
"");
170 defineChainSubQuery(
q.get(), theCondition, bindings, m_smk,
output);
172 q->addToTableList (
"HLT_TRIGGER_GROUP",
"GR" );
174 theCondition += string(
" AND GR.HTG_TRIGGER_CHAIN_ID = TM2TC.HTM2TC_TRIGGER_CHAIN_ID" );
176 q->setCondition( theCondition, bindings );
178 output.extend<
string>(
"GR.HTG_NAME" );
183 coral::ICursor&
cursor =
q->execute();
190 string grname =
rmtilde(
row[
"GR.HTG_NAME"].data<string>());
205 std::unique_ptr< coral::IQuery >
q( m_session.nominalSchema().newQuery() );
206 string theCondition(
"");
209 defineChainSubQuery(
q.get(), theCondition, bindings, m_smk,
output);
211 q->addToTableList (
"HLT_TRIGGER_TYPE",
"TT" );
213 theCondition += string(
" AND TT.HTT_TRIGGER_CHAIN_ID = TM2TC.HTM2TC_TRIGGER_CHAIN_ID" );
215 q->setCondition( theCondition, bindings );
217 output.extend<
int>(
"TT.HTT_TYPEBIT" );
222 coral::ICursor&
cursor =
q->execute();
229 int triggertype =
row[
"TT.HTT_TYPEBIT"].data<
int>();
241 std::unique_ptr< coral::IQuery >
q( m_session.nominalSchema().newQuery() );
242 string theCondition(
"");
245 defineChainSubQuery(
q.get(), theCondition, bindings, m_smk,
output);
247 q->addToTableList (
"HLT_TC_TO_TR",
"TC2TR" );
248 q->addToTableList (
"HLT_TRIGGER_STREAM",
"TR" );
250 theCondition += string(
" AND TC2TR.HTC2TR_TRIGGER_CHAIN_ID = TC.HTC_ID" );
251 theCondition += string(
" AND TC2TR.HTC2TR_TRIGGER_STREAM_ID = TR.HTR_ID" );
253 output.extend<
string>(
"TC2TR.HTC2TR_TRIGGER_STREAM_PRESCALE");
254 output.extend<
string>(
"TR.HTR_NAME" );
255 output.extend<
string>(
"TR.HTR_TYPE" );
256 output.extend<
int>(
"TR.HTR_OBEYLB" );
260 q->setCondition( theCondition, bindings );
263 coral::ICursor&
cursor =
q->execute();
269 string chainname =
rmtilde(
row[
"TC.HTC_NAME"].data<string>());
270 string prescale_str =
rmtilde(
row[
"TC2TR.HTC2TR_TRIGGER_STREAM_PRESCALE"].data<string>());
271 string streamname =
rmtilde(
row[
"TR.HTR_NAME"].data<string>());
273 bool obeyLB =
row[
"TR.HTR_OBEYLB"].data<
int>();
276 prescale = boost::lexical_cast<int,string>(prescale_str);
278 catch(boost::bad_lexical_cast &
e) {}
290 std::unique_ptr< coral::IQuery >
q( m_session.nominalSchema().newQuery() );
291 string theCondition(
"");
294 defineChainSubQuery(
q.get(), theCondition, bindings, m_smk,
output);
296 q->addToTableList (
"HLT_TC_TO_TS",
"TC2TS" );
297 q->addToTableList (
"HLT_TRIGGER_SIGNATURE",
"TS" );
298 q->addToTableList (
"HLT_TS_TO_TE",
"TS2TE" );
299 q->addToTableList (
"HLT_TRIGGER_ELEMENT",
"TE" );
302 theCondition += string(
" AND TC2TS.HTC2TS_TRIGGER_CHAIN_ID = TC.HTC_ID" );
303 theCondition += string(
" AND TC2TS.HTC2TS_TRIGGER_SIGNATURE_ID = TS.HTS_ID" );
304 theCondition += string(
" AND TC2TS.HTC2TS_TRIGGER_SIGNATURE_ID = TS2TE.HTS2TE_TRIGGER_SIGNATURE_ID" );
305 theCondition += string(
" AND TE.HTE_ID = TS2TE.HTS2TE_TRIGGER_ELEMENT_ID" );
306 theCondition += string(
" AND TS2TE.HTS2TE_ELEMENT_COUNTER>=0" );
308 output.extend<
int>(
"TC2TS.HTC2TS_SIGNATURE_COUNTER" );
309 output.extend<
int>(
"TS2TE.HTS2TE_ELEMENT_COUNTER" );
310 output.extend<
int>(
"TS.HTS_LOGIC" );
311 output.extend<
int>(
"TE.HTE_ID" );
312 output.extend<
string>(
"TE.HTE_NAME" );
315 q->setCondition( theCondition, bindings );
319 q->addToOrderList(
"TC.HTC_NAME" );
320 q->addToOrderList(
"TC2TS.HTC2TS_SIGNATURE_COUNTER" );
321 q->addToOrderList(
"TS2TE.HTS2TE_ELEMENT_COUNTER" );
323 coral::ICursor&
cursor =
q->execute();
331 string chainname =
rmtilde(
row[
"TC.HTC_NAME"].data<string>());
334 unsigned int sig_counter = (
unsigned int)
row[
"TC2TS.HTC2TS_SIGNATURE_COUNTER"].data<int>();
335 if( sig_list.size() < sig_counter+1 )
336 sig_list.resize( sig_counter+1, 0 );
338 if( sig_list[sig_counter] == 0) {
339 int logic =
row[
"TS.HTS_LOGIC"].data<
int>();
340 sig_list[sig_counter] =
new HLTSignature(sig_counter, logic, std::vector<HLTTriggerElement*>());
341 sig_list[sig_counter]->set_label( chainname +
"_" + boost::lexical_cast<string,int>(sig_counter) );
345 vector<HLTTriggerElement*>& te_list =
sig->outputTEs();
347 unsigned int te_counter = (
unsigned int)
row[
"TS2TE.HTS2TE_ELEMENT_COUNTER"].data<int>();
348 if( te_list.size() < te_counter+1 )
349 te_list.resize( te_counter+1, 0 );
351 if( te_list[te_counter] == 0) {
352 int te_id =
row[
"TE.HTE_ID"].data<
int>();
353 string te_name =
row[
"TE.HTE_NAME"].data<
string>();
366 vector<HLTSignature*>&
s =
ch->signatureList();