16#include <CoralBase/Attribute.h>
17#include <CoralBase/AttributeList.h>
19#include "RelationalAccess/ITable.h"
20#include "RelationalAccess/ISchema.h"
21#include "RelationalAccess/ICursor.h"
22#include "RelationalAccess/IQuery.h"
32 unsigned int smk = frame.
smk();
33 if(smk==0)
return false;
37 typedef pair<unsigned int, unsigned int> lbnpsk_t;
60 bool all_connected(
true);
62 for( lbnpsk_t lbnpsk: reqested_prescale_keys) {
63 unsigned int psk = lbnpsk.second;
64 bool is_connected = psk!=0 && connected_psk.find(psk)!=connected_psk.end();
65 TRG_MSG_INFO(
"LB " << setw(3) << right << lbnpsk.first <<
" : " << lbnpsk.second);
67 TRG_MSG_ERROR(
"prescale key " << lbnpsk.second <<
" is not connected to SMK");
68 all_connected =
false;
87 pair<bool, float> rrps = ch->rerun_prescale(
"");
96 TRG_MSG_ERROR(
"Not all requested HLT prescale keys are connected to the SMK");
98 for(
int psk: connected_psk) {
101 TRG_MSG_INFO(
"these HLT PSK are connected to SMK " << smk <<
": " << s.str());
102 throw runtime_error(
"HLTFrameLoader: not all requested HLT prescale keys are connected to the SMK");
107 bool needMerging(
false);
121 catch (
const std::exception& e) {
136 unique_ptr< coral::IQuery > q(
m_session.nominalSchema().tableHandle(
"SUPER_MASTER_TABLE").newQuery() );
138 std::string cond =
"SMT_ID = :smId";
139 coral::AttributeList bindings;
140 bindings.extend<
int>(
"smId");
141 bindings[0].data<
int>() = frame.
smk();
142 q->setCondition( cond, bindings );
144 coral::AttributeList attList;
145 attList.extend<std::string>(
"SMT_NAME" );
146 attList.extend<
int> (
"SMT_VERSION" );
147 attList.extend<std::string>(
"SMT_COMMENT" );
151 coral::ICursor& cursor = q->execute();
152 while (cursor.next()) {
153 const coral::AttributeList& row = cursor.currentRow();
154 string name = row[
"SMT_NAME" ].data<std::string>();
155 int version = row[
"SMT_VERSION"].data<
int>();
156 string comment = row[
"SMT_COMMENT"].data<std::string>();
168 set<unsigned int> connected_psks;
171 unique_ptr< coral::IQuery > q(
m_session.nominalSchema().newQuery() );
173 q->addToTableList(
"SUPER_MASTER_TABLE",
"SMT" );
174 q->addToTableList(
"HLT_MASTER_TABLE",
"HMT" );
175 q->addToTableList(
"HLT_TRIGGER_MENU",
"HTM" );
176 q->addToTableList(
"HLT_TM_TO_PS",
"HM2PS" );
178 coral::AttributeList bindings;
179 bindings.extend<
int>(
"smid");
180 bindings[0].data<
int>() = smk;
182 string theCondition(
"");
183 theCondition += string(
" SMT.SMT_ID = :smid");
184 theCondition += string(
" AND SMT.SMT_HLT_MASTER_TABLE_ID = HMT.HMT_ID" );
185 theCondition += string(
" AND HMT.HMT_TRIGGER_MENU_ID = HTM.HTM_ID" );
186 theCondition += string(
" AND HTM.HTM_ID = HM2PS.HTM2PS_TRIGGER_MENU_ID" );
189 q->setCondition( theCondition, bindings );
192 coral::AttributeList attList;
193 attList.extend<
int>(
"HM2PS.HTM2PS_PRESCALE_SET_ID" );
196 coral::ICursor& cursor = q->execute();
198 while (cursor.next()) {
199 const coral::AttributeList& row = cursor.currentRow();
200 int psk = row[
"HM2PS.HTM2PS_PRESCALE_SET_ID"].data<
int>();
201 connected_psks.insert(psk);
207 for(
int psk : connected_psks)
210 TRG_MSG_INFO(
"To SMK " << smk <<
" connected HLT prescale keys are " <<
ss.str() );
212 return connected_psks;
StorageMgr & m_storageMgr
reference to the storage manager
virtual MSGTC::Level outputLevel() const override
void commitSession()
commit session if not already done
virtual void setLevel(MSGTC::Level lvl) override
access to output stream
coral::ISessionProxy & m_session
CORAL interface to database session.
void startSession()
start session if not already active
void applyPrescaleSet(const HLTPrescaleSet *pss)
set prescales of all chains
TriggerDB loader of the HLT signatures.
virtual bool load(HLTFrame &frame)
HLT chain configuration information.
virtual bool load(HLTFrame &data) override
std::set< unsigned int > GetConnectedPSKs(unsigned int smk)
void loadSMT(HLTFrame &frame)
HLTPrescaleSetCollection & thePrescaleSetCollection()
const HLTPrescaleSetCollection & getPrescaleSetCollection() const
HLTChainList & theHLTChainList()
accessor to the list of HLT chains
void clear()
clear chains, sequences and prescales
const HLTChainList & getHLTChainList() const
const accessor to the list of HLT chains
virtual bool load(HLTPrescaleSetCollection &psc)
std::vector< std::pair< unsigned int, unsigned int > > prescale_keys() const
void set_prescale_keys_to_load(const std::vector< std::pair< unsigned int, unsigned int > > &)
std::list< cont > & sets()
size_t size() const
number of prescale sets
HLT chain configuration information.
HLTPrescale & thePrescale(unsigned int chain_counter, HLTLevel level)
HLTPrescale & setRerunPrescale(const std::string &targetName, float ps)
TriggerDB loader of the HLT signatures.
virtual bool load(HLTFrame &frame)
static void mergeHLTChainList2(TrigConf::HLTFrame &frame)
void setComment(const std::string &c)
void setName(const std::string &name)
void setVersion(unsigned int version)
void fillQuery(coral::IQuery *q, coral::AttributeList &attList)