ATLAS Offline Software
Loading...
Searching...
No Matches
TrigConf::L1TopoMenuLoader Class Reference

TriggerDB loader of the HLT menu. More...

#include <L1TopoMenuLoader.h>

Inheritance diagram for TrigConf::L1TopoMenuLoader:
Collaboration diagram for TrigConf::L1TopoMenuLoader:

Public Member Functions

 L1TopoMenuLoader (StorageMgr &sm, coral::ISessionProxy &session)
 constructor
virtual ~L1TopoMenuLoader () override=default
 destructor
virtual bool load (TXC::L1TopoMenu &) override
bool loadTopoAlgos (TXC::L1TopoMenu &tcaTarget)
bool loadOutputList (TXC::L1TopoMenu &tcaTarget, const int &ctplinkid)
bool loadTopoConfig (TXC::L1TopoMenu &tcaTarget)
bool loadAllAlgsInput (std::map< uint, TXC::L1TopoConfigAlg > &idToAlgMap)
bool loadAllAlgsOutput (std::map< uint, TXC::L1TopoConfigAlg > &idToAlgMap)
bool loadAllAlgsRegister (std::map< uint, TXC::L1TopoConfigAlg > &idToAlgMap)
bool loadAllAlgsFixed (std::map< uint, TXC::L1TopoConfigAlg > &idToAlgMap)
virtual void setLevel (MSGTC::Level lvl) override
 Load the configuration data from the configuration source.
virtual MSGTC::Level outputLevel () const override
void startSession ()
 start session if not already active
void commitSession ()
 commit session if not already done
bool loadL1MasterKey (int SuperMasterKey, int &Lvl1MasterKey)
 get l1 master from super master
bool loadL1MenuKey (int SuperMasterKey, int &Lvl1MenuKey)
 get l1 menu id from super master
unsigned int triggerDBSchemaVersion ()
virtual int verbose () const override
virtual void setVerbose (int v) override
bool isRun1 ()
bool isRun2 ()
bool msgLvl (const MSGTC::Level lvl) const
 Test the output level.
MsgStreamTCmsg () const
 The standard message stream.
MsgStreamTCmsg (const MSGTC::Level lvl) const
 The standard message stream.
const std::string & getName () const
 name accessor

Protected Attributes

StorageMgrm_storageMgr
 reference to the storage manager
coral::ISessionProxy & m_session
 CORAL interface to database session.
bool m_sessionOwner {false}
 remember if the loader started the session in the first place

Private Member Functions

std::tuple< unsigned int, unsigned int > loadSchemaVersion () const
 get DB schema version and run number

Private Attributes

int m_verbose {1}
boost::thread_specific_ptr< MsgStreamTCm_msg_tls
 MsgStreamTC instance (a std::cout like with print-out levels)
std::string m_name

Detailed Description

TriggerDB loader of the HLT menu.

Definition at line 18 of file L1TopoMenuLoader.h.

Constructor & Destructor Documentation

◆ L1TopoMenuLoader()

TrigConf::L1TopoMenuLoader::L1TopoMenuLoader ( StorageMgr & sm,
coral::ISessionProxy & session )
inline

constructor

Parameters
smreference to storage manager
sessionreference to the database session

Definition at line 26 of file L1TopoMenuLoader.h.

26 :
27 IL1TopoMenuLoader(), DBLoader("L1TopoMenuLoader", sm, session) {}
DBLoader(StorageMgr &sm, coral::ISessionProxy &session)
constructor
Definition DBLoader.cxx:31

◆ ~L1TopoMenuLoader()

virtual TrigConf::L1TopoMenuLoader::~L1TopoMenuLoader ( )
overridevirtualdefault

destructor

Member Function Documentation

◆ commitSession()

void TrigConf::DBLoader::commitSession ( )
inherited

commit session if not already done

Definition at line 45 of file DBLoader.cxx.

46{
47 if ( m_session.transaction().isActive() && m_sessionOwner) {
48 m_session.transaction().commit();
49 }
50}
bool m_sessionOwner
remember if the loader started the session in the first place
Definition DBLoader.h:68
coral::ISessionProxy & m_session
CORAL interface to database session.
Definition DBLoader.h:67

◆ getName()

const std::string & TrigConf::TrigConfMessaging::getName ( ) const
inlineinherited

name accessor

Returns
the name

Definition at line 101 of file TrigConfMessaging.h.

101 {
102 return m_name;
103 }

◆ isRun1()

bool TrigConf::DBLoader::isRun1 ( )
inlineinherited

Definition at line 59 of file DBLoader.h.

59{ return ! isRun2(); }

◆ isRun2()

bool DBLoader::isRun2 ( )
inherited

Definition at line 54 of file DBLoader.cxx.

54 {
55 const static unsigned int run = std::get<1>(loadSchemaVersion());
56 return run == 2;
57}
std::tuple< unsigned int, unsigned int > loadSchemaVersion() const
get DB schema version and run number
Definition DBLoader.cxx:81
int run(int argc, char *argv[])

◆ load()

bool TrigConf::L1TopoMenuLoader::load ( TXC::L1TopoMenu & tcaTarget)
overridevirtual

Implements TrigConf::IL1TopoMenuLoader.

Definition at line 27 of file L1TopoMenuLoader.cxx.

27 {
28 try {
29 unsigned int schema = triggerDBSchemaVersion();
30 TRG_MSG_DEBUG("L1TopoMenuLoader Run " << (isRun1()? 1 : 2) << ", schema version " << schema);
31 if(isRun1()) {
32 TRG_MSG_INFO("Not loading L1 TopoMenu from a run 1 database");
33 return true;
34 }
35 TRG_MSG_INFO("Loading L1 TopoMenu with SMK " << tcaTarget.getSMK());
37 loadTopoAlgos(tcaTarget);
40 tcaTarget.print();
41 } catch( const std::exception& e ) {
42 TRG_MSG_ERROR("L1TopoMenuLoader::load >> Standard C++ exception: " << e.what());
43 } catch( ... ) {
44 TRG_MSG_ERROR("L1TopoMenuLoader::load >> ... caught ");
45 }
46 TRG_MSG_INFO( "Loaded L1 TopoMenu with " << tcaTarget.getL1TopoConfigAlgs().size() << " algorithms and "
47 << tcaTarget.getL1TopoConfigOutputList().getTriggerLines().size() << " trigger lines");
48 return true;
49}
const std::vector< TriggerLine > & getTriggerLines() const
const unsigned int & getSMK() const
Definition L1TopoMenu.h:48
const L1TopoConfigOutputList & getL1TopoConfigOutputList() const
Definition L1TopoMenu.h:55
const std::vector< TXC::L1TopoConfigAlg > & getL1TopoConfigAlgs() const
Definition L1TopoMenu.h:53
void print() const
print menu
void commitSession()
commit session if not already done
Definition DBLoader.cxx:45
unsigned int triggerDBSchemaVersion()
Definition DBLoader.cxx:76
void startSession()
start session if not already active
Definition DBLoader.cxx:36
bool loadTopoAlgos(TXC::L1TopoMenu &tcaTarget)
MsgStreamTC & msg() const
The standard message stream.

◆ loadAllAlgsFixed()

bool TrigConf::L1TopoMenuLoader::loadAllAlgsFixed ( std::map< uint, TXC::L1TopoConfigAlg > & idToAlgMap)

Definition at line 383 of file L1TopoMenuLoader.cxx.

383 {
384 TRG_MSG_VERBOSE("Calling loadAllAlgsFixed");
385
386 set<uint> algIds;
387 for( auto & e : idToAlgMap ) {
388 algIds.insert(e.first);
389 }
390
391 string algIdsConc = "(";
392 bool first = true;
393 for( int id : algIds ) {
394 if(first) { first = false; } else { algIdsConc += ","; }
395 algIdsConc += to_string(id);
396 }
397 algIdsConc+=")";
398
399 try {
400 startSession();
401
402 unique_ptr<coral::IQuery> query0(m_session.nominalSchema().newQuery());
403 query0->addToTableList("TA_TO_TG","TA2TG");
404 query0->addToTableList("TOPO_GENERIC","TG");
405 //Bind list
406 coral::AttributeList bindList0;
407// bindList0.extend<int>("taId");
408// bindList0[0].data<int>() = ta_id;
409
410 string theCondition0 = "";
411 theCondition0 += string(" TA2TG.TA2TG_ALGO_ID IN " + algIdsConc);
412 theCondition0 += string(" AND TA2TG.TA2TG_GENERIC_ID = TG.TG_ID");
413 query0->setCondition( theCondition0, bindList0 );
414
415 query0->addToOrderList("TG.TG_NAME");
416
417 coral::AttributeList attList0;
418 attList0.extend<int>( "TA2TG.TA2TG_ALGO_ID" );
419 attList0.extend<string>( "TG.TG_NAME" );
420 attList0.extend<string>( "TG.TG_VALUE" );
421 query0->defineOutput(attList0);
422 fillQuery(query0.get(), attList0);
423 //std::cout << "Executing loadAlgFiexed query " << std::endl;
424 coral::ICursor& cursor0 = query0->execute();
425
426 uint fixedCount(0);
427 while(cursor0.next()){
428 fixedCount++;
429 const coral::AttributeList& row0 = cursor0.currentRow();
430 //std::cout << "loadAlgFixed my row " << row0 << std::endl;
431 string tg_name = row0["TG.TG_NAME"].data<string>();
432 string tg_value = row0["TG.TG_VALUE"].data<string>();
433
434 // fill the alg
435 int algoId = row0["TA2TG.TA2TG_ALGO_ID"].data<int>();
436 auto match = idToAlgMap.find(algoId);
437 if (match == idToAlgMap.end()) continue;
438 TXC::L1TopoConfigAlg & alg = match->second;
439 alg.addFixedParameter(tg_name,tg_value);
440 }
441
442 TRG_MSG_DEBUG("" << fixedCount << " Fixed found");
443
444 } catch (const exception& e){
445 TRG_MSG_ERROR("loadAlgFixed >> Standard C++ exception: " << e.what());
446 return false;
447 }
448 return true;
449
450}
static std::string to_string(const std::vector< T > &v)
unsigned int uint
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition hcg.cxx:357
bool first
Definition DeMoScan.py:534
void fillQuery(coral::IQuery *q, coral::AttributeList &attList)
Definition DBHelper.cxx:13

◆ loadAllAlgsInput()

bool TrigConf::L1TopoMenuLoader::loadAllAlgsInput ( std::map< uint, TXC::L1TopoConfigAlg > & idToAlgMap)

Definition at line 153 of file L1TopoMenuLoader.cxx.

153 {
154
155 TRG_MSG_VERBOSE("Calling loadAllAlgsInput");
156
157 set<uint> algIds;
158 for( auto & e : idToAlgMap ) {
159 algIds.insert(e.first);
160 }
161
162 string algIdsConc = "(";
163 bool first = true;
164 for( int id : algIds ) {
165 if(first) { first = false; } else { algIdsConc += ","; }
166 algIdsConc += to_string(id);
167 }
168 algIdsConc+=")";
169
170 TRG_MSG_DEBUG("" << algIds.size() << " algorithms ");
171 TRG_MSG_VERBOSE("Alg IDs : " << algIdsConc);
172
173 try {
174 startSession();
175
176 unique_ptr<coral::IQuery> query0(m_session.nominalSchema().newQuery());
177 query0->addToTableList("TA_TO_TI","TA2TI");
178 query0->addToTableList("TOPO_ALGO_INPUT","TAI");
179 coral::AttributeList bindList0;
180
181 string theCondition0 = "";
182 theCondition0 += " TA2TI.TA2TI_ALGO_ID IN " + algIdsConc;
183 theCondition0 += string(" AND TA2TI.TA2TI_INPUT_ID = TAI.TAI_ID");
184 query0->setCondition( theCondition0, bindList0 );
185
186 coral::AttributeList attList0;
187 attList0.extend<int>( "TA2TI.TA2TI_ALGO_ID" );
188 attList0.extend<string>( "TAI.TAI_NAME" );
189 attList0.extend<string>( "TAI.TAI_VALUE" );
190 attList0.extend<int>( "TAI.TAI_POSITION" );
191 query0->defineOutput(attList0);
192 fillQuery(query0.get(), attList0);
193 //std::cout << "Executing loadAlgInput query " << std::endl;
194 coral::ICursor& cursor0 = query0->execute();
195
196 uint inputCount = 0;
197 while(cursor0.next()){
198 inputCount ++;
199
200 const coral::AttributeList& row0 = cursor0.currentRow();
201
202 //std::cout << "loadAlgInput my row " << row0 << std::endl;
203 string tai_name = row0["TAI.TAI_NAME"].data<string>();
204 string tai_value = row0["TAI.TAI_VALUE"].data<string>();
205 int tai_pos = row0["TAI.TAI_POSITION"].data<int>();
206 if(tai_pos<0) tai_pos=0; // when position is missing in XML, currently the TT uploads -1 instead of 0
207
208 // fill the alg
209 int algoId = row0["TA2TI.TA2TI_ALGO_ID"].data<int>();
210 auto match = idToAlgMap.find(algoId);
211 if (match == idToAlgMap.end()) continue;
212 TXC::L1TopoConfigAlg & alg = match->second;
213 alg.addInput(tai_name,tai_value,tai_pos);
214 }
215
216 TRG_MSG_DEBUG("" << inputCount << " inputs found");
217
218 } catch (const exception& e){
219 TRG_MSG_ERROR("loadAlgInput >> Standard C++ exception: " << e.what());
220 throw;
221 }
222 return true;
223}

◆ loadAllAlgsOutput()

bool TrigConf::L1TopoMenuLoader::loadAllAlgsOutput ( std::map< uint, TXC::L1TopoConfigAlg > & idToAlgMap)

Definition at line 227 of file L1TopoMenuLoader.cxx.

227 {
228 TRG_MSG_VERBOSE("Calling loadAllAlgsOutput");
229
230 set<uint> algIds;
231 for( auto & e : idToAlgMap ) {
232 algIds.insert(e.first);
233 }
234
235 string algIdsConc = "(";
236 bool first = true;
237 for( int id : algIds ) {
238 if(first) { first = false; } else { algIdsConc += ","; }
239 algIdsConc += to_string(id);
240 }
241 algIdsConc+=")";
242
243 try {
244 startSession();
245 unique_ptr<coral::IQuery> query0(m_session.nominalSchema().newQuery());
246 query0->addToTableList("TOPO_ALGO","TA");
247 query0->addToTableList("TA_TO_TO","TA2TO");
248 query0->addToTableList("TOPO_ALGO_OUTPUT","TAO");
249 //Bind list
250 coral::AttributeList bindList0;
251// bindList0.extend<int>("taId");
252// bindList0[0].data<int>() = ta_id;
253
254 string theCondition0 = "";
255 theCondition0 += " TA.TA_ID IN " + algIdsConc;
256 theCondition0 += " AND TA.TA_ID = TA2TO.TA2TO_ALGO_ID";
257 theCondition0 += " AND TA2TO.TA2TO_OUTPUT_ID = TAO.TAO_ID";
258 query0->setCondition( theCondition0, bindList0 );
259
260 coral::AttributeList attList0;
261 attList0.extend<int>( "TA2TO.TA2TO_ALGO_ID" );
262 attList0.extend<string>( "TAO.TAO_NAME" );
263 attList0.extend<string>( "TAO.TAO_VALUE" );
264 attList0.extend<string>( "TAO.TAO_BITNAME" );
265 attList0.extend<int>( "TAO.TAO_SELECTION" );
266 attList0.extend<int>( "TA.TA_BITS" );
267 query0->defineOutput(attList0);
268 fillQuery(query0.get(), attList0);
269 //std::cout << "Executing loadAlgOutput query " << std::endl;
270 coral::ICursor& cursor0 = query0->execute();
271
272
273 uint outputCount = 0;
274 while(cursor0.next()){
275 outputCount ++;
276
277 const coral::AttributeList& row0 = cursor0.currentRow();
278 //std::cout << "loadAlgOutput my row " << row0 << std::endl;
279 string tao_name = row0["TAO.TAO_NAME"].data<string>();
280 string tao_value = row0["TAO.TAO_VALUE"].data<string>();
281 string tao_bitname = row0["TAO.TAO_BITNAME"].data<string>();
282 int tao_sel = row0["TAO.TAO_SELECTION"].data<int>();
283 int ta_bits = row0["TA.TA_BITS"].data<int>();
284
285 // fill the alg
286 int algoId = row0["TA2TO.TA2TO_ALGO_ID"].data<int>();
287 auto match = idToAlgMap.find(algoId);
288 if (match == idToAlgMap.end()) continue;
289 TXC::L1TopoConfigAlg & alg = match->second;
290 alg.addOutput(tao_name,tao_value,ta_bits,tao_bitname, tao_sel);
291 }
292
293 TRG_MSG_DEBUG("" << outputCount << " outputs found");
294
295 } catch (const exception& e){
296 TRG_MSG_ERROR("loadAlgOutput >> Standard C++ exception: " << e.what());
297 throw;
298 }
299 return true;
300}

◆ loadAllAlgsRegister()

bool TrigConf::L1TopoMenuLoader::loadAllAlgsRegister ( std::map< uint, TXC::L1TopoConfigAlg > & idToAlgMap)

Definition at line 305 of file L1TopoMenuLoader.cxx.

305 {
306
307 TRG_MSG_VERBOSE("Calling loadAllAlgsRegister");
308
309 set<uint> algIds;
310 for( auto & e : idToAlgMap ) {
311 algIds.insert(e.first);
312 }
313
314 string algIdsConc = "(";
315 bool first = true;
316 for( int id : algIds ) {
317 if(first) { first = false; } else { algIdsConc += ","; }
318 algIdsConc += to_string(id);
319 }
320 algIdsConc+=")";
321
322 try {
323 startSession();
324
325 unique_ptr<coral::IQuery> query0(m_session.nominalSchema().newQuery());
326 query0->addToTableList("TA_TO_TP","TA2TP");
327 query0->addToTableList("TOPO_PARAMETER","TP");
328 //Bind list
329 coral::AttributeList bindList0;
330// bindList0.extend<int>("taId");
331// bindList0[0].data<int>() = ta_id;
332
333 string theCondition0 = "";
334 theCondition0 += " TA2TP.TA2TP_ALGO_ID IN " + algIdsConc;
335 theCondition0 += " AND TA2TP.TA2TP_PARAM_ID = TP.TP_ID";
336 query0->setCondition( theCondition0, bindList0 );
337
338 coral::AttributeList attList0;
339 attList0.extend<int>( "TA2TP.TA2TP_ALGO_ID" );
340 attList0.extend<string>( "TP.TP_NAME" );
341 attList0.extend<long>( "TP.TP_VALUE" );
342 attList0.extend<int>( "TP.TP_POSITION" );
343 attList0.extend<int>( "TP.TP_SELECTION" );
344 query0->defineOutput(attList0);
345 fillQuery(query0.get(), attList0);
346 //std::cout << "Executing loadAlgRegister query " << std::endl;
347 coral::ICursor& cursor0 = query0->execute();
348
349 uint registerCount(0);
350 while(cursor0.next()){
351 registerCount++;
352 const coral::AttributeList& row0 = cursor0.currentRow();
353 //std::cout << "loadAlgRegister my row " << row0 << std::endl;
354 string tp_name = row0["TP.TP_NAME"].data<string>();
355 long tp_value = row0["TP.TP_VALUE"].data<long>();
356 int tp_pos = row0["TP.TP_POSITION"].data<int>();
357 int tp_sel = row0["TP.TP_SELECTION"].data<int>();
358 if(tp_pos<0) tp_pos=0;
359 if(tp_sel<0) tp_sel=0;
360
361
362 // fill the alg
363 int algoId = row0["TA2TP.TA2TP_ALGO_ID"].data<int>();
364 auto match = idToAlgMap.find(algoId);
365 if (match == idToAlgMap.end()) continue;
366 TXC::L1TopoConfigAlg & alg = match->second;
367 alg.addParameter(tp_name,to_string(tp_value),tp_pos, tp_sel);
368 }
369
370 TRG_MSG_DEBUG("" << registerCount << " registers found");
371
372 } catch (const exception& e){
373 TRG_MSG_ERROR("loadAlgRegister >> Standard C++ exception: " << e.what());
374 throw;
375 }
376 return true;
377}

◆ loadL1MasterKey()

bool TrigConf::DBLoader::loadL1MasterKey ( int SuperMasterKey,
int & Lvl1MasterKey )
inherited

get l1 master from super master

Definition at line 128 of file DBLoader.cxx.

128 {
129 try {
130 startSession();
131
132 unique_ptr< coral::IQuery > q( m_session.nominalSchema().tableHandle( "SUPER_MASTER_TABLE").newQuery() );
133 q->setRowCacheSize( 5 );
134
135 //Bind list
136 coral::AttributeList bindings;
137 bindings.extend<int>("smtid");
138 bindings[0].data<int>() = smk;
139 q->setCondition( "SMT_ID = :smtid", bindings );
140
141 //Output data and types
142 coral::AttributeList attList;
143 attList.extend<int>( "SMT_L1_MASTER_TABLE_ID" );
144 fillQuery(q.get(), attList);
145
146 coral::ICursor& cursor = q->execute();
147 if ( ! cursor.next() ) {
148 msg() << "DBLoader: No such SuperMaster key exists " << smk << endl;
149 throw runtime_error( "DBLoader: SuperMasterKey not available" );
150 }
151
152 const coral::AttributeList& row = cursor.currentRow();
153 Lvl1MasterKey = row["SMT_L1_MASTER_TABLE_ID"].data<int>();
154 }
155 catch( const std::exception& e ) {
157 msg() << "DBLoader: C++ exception: " << e.what() << std::endl;
158 throw;
159 }
161 return true;
162}
row
Appending html table to final .html summary file.

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

167 {
168 try {
169
170 int l1Master = 0;
171 loadL1MasterKey(SuperMasterKey, l1Master);
172
173 startSession();
174
175 unique_ptr< coral::IQuery > q( m_session.nominalSchema().tableHandle( "L1_MASTER_TABLE").newQuery() );
176 q->setRowCacheSize( 5 );
177
178 //Bind list
179 coral::AttributeList bindings;
180 bindings.extend<int>("l1mtid");
181 bindings[0].data<int>() = l1Master;
182 q->setCondition( "L1MT_ID = :l1mtid" , bindings );
183
184 //Output data and types
185 coral::AttributeList attList;
186 attList.extend<int>( "L1MT_TRIGGER_MENU_ID" );
187 q->defineOutput(attList);
188 q->addToOutputList( "L1MT_TRIGGER_MENU_ID" );
189
190 coral::ICursor& cursor = q->execute();
191 if ( ! cursor.next() ) {
192 msg() << "DBLoader >> No such L1 Master key exists " << l1Master << std::endl;
193 throw std::runtime_error( "DBLoader >> L1MasterKey not available" );
194 }
195
196 const coral::AttributeList& row = cursor.currentRow();
197 Lvl1MenuKey = row["L1MT_TRIGGER_MENU_ID"].data<int>();
198
200
201 }
202 catch( const std::exception& e ) {
203 msg() << "DBLoader >> Standard C++ exception: " << e.what() << std::endl;
204 m_session.transaction().rollback();
205 throw;
206 }
207 return true;
208}
bool loadL1MasterKey(int SuperMasterKey, int &Lvl1MasterKey)
get l1 master from super master
Definition DBLoader.cxx:128

◆ loadOutputList()

bool TrigConf::L1TopoMenuLoader::loadOutputList ( TXC::L1TopoMenu & tcaTarget,
const int & ctplinkid )

Definition at line 625 of file L1TopoMenuLoader.cxx.

625 {
626 try {
627 TRG_MSG_VERBOSE("Calling loadOutputList");
628 startSession();
629
630 unique_ptr<coral::IQuery> query0(m_session.nominalSchema().newQuery());
631 query0->addToTableList("TOPO_OUTPUT_LIST","TOL");
632 query0->addToTableList("TOPO_OUTPUT_LINK","TOLK");
633 query0->addToTableList("TOPO_OUTPUT_LINE","TOLINE");
634 //Bind list
635 coral::AttributeList bindList0;
636 bindList0.extend<int>("ctpLId");
637 bindList0[0].data<int>() = ctplinkid;
638
639 string theCondition0 = "";
640 theCondition0 += string(" TOL.OL_ID = :ctpLId" );
641 theCondition0 += string(" AND TOLK.TL_LINK_ID = TOL.OL_ID");
642 theCondition0 += string(" AND TOLK.TL_OUTPUT_ID = TOLINE.TOL_ID");
643 query0->setCondition( theCondition0, bindList0 );
644
645 coral::AttributeList attList0;
646 attList0.extend<int>( "TOLINE.TOL_ID" );
647 attList0.extend<string>( "TOLINE.TOL_ALGO_NAME" );
648 attList0.extend<string>( "TOLINE.TOL_TRIGGERLINE" );
649 attList0.extend<unsigned int>( "TOLINE.TOL_ALGO_ID" );
650 attList0.extend<unsigned int>( "TOLINE.TOL_MODULE" );
651 attList0.extend<unsigned int>( "TOLINE.TOL_FPGA" );
652 attList0.extend<unsigned int>( "TOLINE.TOL_FIRST_BIT" );
653 attList0.extend<unsigned int>( "TOLINE.TOL_CLOCK" );
654 query0->defineOutput(attList0);
655 fillQuery(query0.get(), attList0);
656 //std::cout << "Executing loadAlgFiexed query " << std::endl;
657 coral::ICursor& cursor0 = query0->execute();
658 while(cursor0.next()){
659 const coral::AttributeList& row0 = cursor0.currentRow();
660 //std::cout << "loadOutputList my row " << row0 << std::endl;
661 string tol_name = row0["TOLINE.TOL_ALGO_NAME"].data<string>();
662 unsigned int tol_algoId = row0["TOLINE.TOL_ALGO_ID"].data<unsigned int>();
663 unsigned int tol_module = row0["TOLINE.TOL_MODULE"].data<unsigned int>();
664 unsigned int tol_fpga = row0["TOLINE.TOL_FPGA"].data<unsigned int>();
665 unsigned int tol_clock = row0["TOLINE.TOL_CLOCK"].data<unsigned int>();
666 unsigned int tol_firstbit = row0["TOLINE.TOL_FIRST_BIT"].data<unsigned int>();
667 tcaTarget.addL1TopoXMLOutput(TXC::OutputListElement( tol_name, tol_algoId, tol_module, tol_fpga, tol_clock, tol_firstbit));
668 }
669 tcaTarget.setTriggerList();
670 } catch (const exception& e){
671 TRG_MSG_ERROR("loadOutputList >> Standard C++ exception: " << e.what());
672 throw;
673 }
674 return true;
675}
void addL1TopoXMLOutput(const TXC::OutputListElement &output)
add output
Definition L1TopoMenu.h:69
TCS::StatusCode setTriggerList()

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

82{
83 const static auto versions = [&]() -> std::tuple<unsigned int,unsigned int> {
84 bool mySession = false;
85 if ( ! m_session.transaction().isActive() ) {
86 m_session.transaction().start(true);
87 mySession = true;
88 }
89
90 std::unique_ptr< coral::IQuery > q( m_session.nominalSchema().tableHandle( "TRIGGER_SCHEMA").newQuery() );
91 q->setRowCacheSize( 1 );
92
93 //Output data and types
94 coral::AttributeList attList;
95 attList.extend<int>( "TS_ID" );
96 q->defineOutput(attList);
97 q->addToOutputList( "TS_ID" );
98
99 q->addToOrderList("TS_ID desc");
100 coral::ICursor& cursor = q->execute();
101
102 if ( ! cursor.next() ) {
103 TRG_MSG_ERROR("Table TRIGGER_SCHEMA is not filled");
104 if ( mySession ) m_session.transaction().commit();
105 throw std::runtime_error( "DBLoader::loadSchemaVersion() >> Table TRIGGER_SCHEMA is not filled" );
106 }
107
108 const coral::AttributeList& row = cursor.currentRow();
109 const unsigned int triggerDBSchemaVersion = row["TS_ID"].data<int>();
110
111 TRG_MSG_INFO("TriggerDB schema version: " << triggerDBSchemaVersion);
112
113 const unsigned int run = m_session.nominalSchema().existsTable( "ACTIVE_MASTERS" ) ? 2 : 1;
114
115 TRG_MSG_INFO("Database has Run " << run << " schema");
116 TRG_MSG_INFO("Total number of tables : " << m_session.nominalSchema().listTables().size());
117
118 //commitSession();
119 if ( mySession ) m_session.transaction().commit();
120
121 return {triggerDBSchemaVersion, run};
122 }();
123
124 return versions;
125}

◆ loadTopoAlgos()

bool TrigConf::L1TopoMenuLoader::loadTopoAlgos ( TXC::L1TopoMenu & tcaTarget)

Definition at line 52 of file L1TopoMenuLoader.cxx.

52 {
53
54 TRG_MSG_VERBOSE("Calling loadTopoAlgos for SMK " << tcaTarget.getSMK());
55
56 try {
58
59 unique_ptr<coral::IQuery> query0(m_session.nominalSchema().newQuery());
60 query0->addToTableList("SUPER_MASTER_TABLE","SM");
61 query0->addToTableList("TOPO_MASTER_TABLE","TMT");
62 query0->addToTableList("TOPO_TRIGGER_MENU","TTM");
63 query0->addToTableList("TTM_TO_TA","TTM2TA");
64 query0->addToTableList("TOPO_ALGO","TA");
65 query0->setRowCacheSize(1000);
66
67 //Bind list
68 coral::AttributeList bindList0;
69 bindList0.extend<unsigned int>("tmtId");
70 std::string cond = "TMT_ID = :tmtId";
71 bindList0[0].data<unsigned int>() = tcaTarget.getSMK();
72
73 string theCondition0 = "";
74 theCondition0 += string(" SM.SMT_ID = :tmtId");
75 theCondition0 += string(" AND TMT.TMT_ID = SM.SMT_TOPO_MASTER_TABLE_ID ");
76 theCondition0 += string(" AND TTM.TTM_ID = TMT.TMT_TRIGGER_MENU_ID ");
77 theCondition0 += string(" AND TTM2TA.TTM2TA_MENU_ID = TTM.TTM_ID ");
78 theCondition0 += string(" AND TA.TA_ID = TTM2TA.TTM2TA_ALGO_ID ");
79 query0->setCondition( theCondition0, bindList0 );
80
81 coral::AttributeList attList0;
82
83 //TMT.TMT_TRIGGER_MENU_ID, TMT.TMT_VERSION,TTM.TTM_NAME,TTM.TTM_VERSION,TTM.TTM_CTPLINK_ID,TA.TA_ID,TA.TA_NAME,TA.TA_OUTPUT,TA.TA_TYPE,TA.TA_BITS,TA.TA_SORT_DECI,TA.TA_ALGO_ID
84 //attList0.extend<int>( "TMT.TMT_TRIGGER_MENU_ID" );
85 //attList0.extend<long>( "TMT.TMT_VERSION" );
86 attList0.extend<string>( "TTM.TTM_NAME" );
87 //attList0.extend<int>( "TTM.TTM_VERSION" );
88 attList0.extend<int>( "TTM.TTM_CTPLINK_ID" );
89 attList0.extend<int>( "TA.TA_ID" );
90 attList0.extend<string>( "TA.TA_NAME" );
91 attList0.extend<string>( "TA.TA_OUTPUT" );
92 attList0.extend<string>( "TA.TA_TYPE" );
93 attList0.extend<int>( "TA.TA_BITS" );
94 attList0.extend<string>( "TA.TA_SORT_DECI" );
95 attList0.extend<int>( "TA.TA_ALGO_ID" );
96 query0->defineOutput(attList0);
97 fillQuery(query0.get(), attList0);
98 TRG_MSG_VERBOSE("Executing loadTopoAlgos query ");
99 coral::ICursor& cursor0 = query0->execute();
100
101 int ctplinkid = 0;
102
103 std::map<uint, TXC::L1TopoConfigAlg> idToAlgMap; // map of id -> alg for later bulk loading of inputs, outputs, etc.
104
105 while(cursor0.next()){
106 const coral::AttributeList& row0 = cursor0.currentRow();
107 int ta_id = row0["TA.TA_ID"].data<int>();
108 string ta_name = row0["TA.TA_NAME"].data<string>();
109 string ta_output = row0["TA.TA_OUTPUT"].data<string>();
110 string ta_type = row0["TA.TA_TYPE"].data<string>();
111 //int ta_bits = row0["TA.TA_BITS"].data<int>();
112 string ta_sort_deci = row0["TA.TA_SORT_DECI"].data<string>();
113 int ta_algo_id = row0["TA.TA_ALGO_ID"].data<int>();
114 ctplinkid = row0["TTM.TTM_CTPLINK_ID"].data<int>();
115 tcaTarget.setName(row0["TTM.TTM_NAME"].data<string>());
116 tcaTarget.setVersion(std::to_string(ta_id));
117
118
119 TXC::L1TopoConfigAlg alg(ta_name,ta_type);
120 if(ta_sort_deci=="Decision") alg.setAlgKind(TXC::L1TopoConfigAlg::DECISION);
121 else if(ta_sort_deci=="Sort") alg.setAlgKind(TXC::L1TopoConfigAlg::SORT);
122 else alg.setAlgKind(TXC::L1TopoConfigAlg::NONE);
123 alg.setAlgOutput(ta_output);
124 alg.setAlgoID(ta_algo_id);
125 // loadAlgInput(alg,ta_id);
126 // loadAlgOutput(alg,ta_id,ta_bits);
127 // loadAlgRegister(alg, ta_id);
128 // loadAlgFixed(alg, ta_id);
129 idToAlgMap.emplace(ta_id,std::move(alg));
130 // tcaTarget.addAlgorithm(alg);
131 }
132
133 loadAllAlgsInput(idToAlgMap);
134 loadAllAlgsOutput(idToAlgMap);
135 loadAllAlgsRegister(idToAlgMap);
136 loadAllAlgsFixed(idToAlgMap);
137
138 for( auto & e : idToAlgMap ) {
139 tcaTarget.addAlgorithm(std::move(e.second));
140 }
141 idToAlgMap.clear();//invalid aftermove
142 loadTopoConfig(tcaTarget);
143 loadOutputList(tcaTarget,ctplinkid);
144 } catch( const std::exception& e ) {
145 TRG_MSG_ERROR("loadTopoAlgos >> Standard C++ exception: " << e.what());
147 throw;
148 }
149 return true;
150}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
void setName(const std::string &name)
setter methods
Definition L1TopoMenu.h:61
void setVersion(const std::string &version)
Definition L1TopoMenu.h:62
void addAlgorithm(TXC::L1TopoConfigAlg &&alg)
add algorithm
bool loadOutputList(TXC::L1TopoMenu &tcaTarget, const int &ctplinkid)
bool loadAllAlgsOutput(std::map< uint, TXC::L1TopoConfigAlg > &idToAlgMap)
bool loadAllAlgsFixed(std::map< uint, TXC::L1TopoConfigAlg > &idToAlgMap)
bool loadAllAlgsInput(std::map< uint, TXC::L1TopoConfigAlg > &idToAlgMap)
bool loadAllAlgsRegister(std::map< uint, TXC::L1TopoConfigAlg > &idToAlgMap)
bool loadTopoConfig(TXC::L1TopoMenu &tcaTarget)

◆ loadTopoConfig()

bool TrigConf::L1TopoMenuLoader::loadTopoConfig ( TXC::L1TopoMenu & tcaTarget)

Definition at line 677 of file L1TopoMenuLoader.cxx.

677 {
678
679 try {
680 TRG_MSG_VERBOSE("Calling loadTopoConfig");
681 startSession();
682
683 unique_ptr<coral::IQuery> query0(m_session.nominalSchema().newQuery());
684 query0->addToTableList("SUPER_MASTER_TABLE","SM");
685 query0->addToTableList("TOPO_MASTER_TABLE","TMT");
686 query0->addToTableList("TOPO_TRIGGER_MENU","TTM");
687 query0->addToTableList("TTM_TO_TC","TTM2TC");
688 query0->addToTableList("TOPO_CONFIG","TC");
689 query0->setRowCacheSize(5);
690
691 //Bind list
692 coral::AttributeList bindList0;
693 bindList0.extend<unsigned int>("tmtId");
694 std::string cond = "TMT_ID = :tmtId";
695 bindList0[0].data<unsigned int>() = tcaTarget.getSMK();
696
697 string theCondition0 = "";
698 theCondition0 += string(" SM.SMT_ID = :tmtId");
699 theCondition0 += string(" AND TMT.TMT_ID = SM.SMT_TOPO_MASTER_TABLE_ID ");
700 theCondition0 += string(" AND TTM.TTM_ID = TMT.TMT_TRIGGER_MENU_ID ");
701 theCondition0 += string(" AND TTM2TC.TTM2TC_ID = TTM.TTM_ID ");
702 theCondition0 += string(" AND TC.TC_ID = TTM2TC.TTM2TC_CONFIG_ID ");
703 query0->setCondition( theCondition0, bindList0 );
704
705 coral::AttributeList attList0;
706 attList0.extend<string>( "TC.TC_NAME" );
707 attList0.extend<string>( "TC.TC_VALUE" );
708 query0->defineOutput(attList0);
709 fillQuery(query0.get(), attList0);
710 coral::ICursor& cursor0 = query0->execute();
711
712 while(cursor0.next()){
713 const coral::AttributeList& row0 = cursor0.currentRow();
714
715 string tc_name = row0["TC.TC_NAME"].data<string>();
716 string tc_value = row0["TC.TC_VALUE"].data<string>();
717
718 tcaTarget.addL1TopoConfigGlobal(TXC::TopoConfigElement(tc_name,tc_value));
719 }
720
721 } catch( const std::exception& e ) {
722 TRG_MSG_ERROR("loadTopoConfig >> Standard C++ exception: " << e.what());
724 throw;
725 }
726 return true;
727}
void addL1TopoConfigGlobal(const TXC::TopoConfigElement &topoconfig)
add config
Definition L1TopoMenu.h:72

◆ msg() [1/2]

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 86 of file TrigConfMessaging.h.

87 {
88 MsgStreamTC* ms = m_msg_tls.get();
89 if (!ms) {
90 ms = new MsgStreamTC(m_name);
91 m_msg_tls.reset(ms);
92 }
93 return *ms;
94 }
boost::thread_specific_ptr< MsgStreamTC > m_msg_tls
MsgStreamTC instance (a std::cout like with print-out levels)

◆ msg() [2/2]

MsgStreamTC & TrigConf::TrigConfMessaging::msg ( const MSGTC::Level lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 96 of file TrigConfMessaging.h.

97 {
98 return msg() << lvl;
99 }

◆ msgLvl()

bool TrigConf::TrigConfMessaging::msgLvl ( const MSGTC::Level lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicting if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 75 of file TrigConfMessaging.h.

76 {
77 if (msg().level() <= lvl) {
78 msg() << lvl;
79 return true;
80 }
81 else {
82 return false;
83 }
84 }

◆ outputLevel()

virtual MSGTC::Level TrigConf::DBLoader::outputLevel ( ) const
inlineoverridevirtualinherited

Implements TrigConf::ILoader.

Definition at line 39 of file DBLoader.h.

39{ return msg().level(); }

◆ setLevel()

void DBLoader::setLevel ( MSGTC::Level lvl)
overridevirtualinherited

Load the configuration data from the configuration source.

Parameters
ctpcreference to the data object to be filled
Returns
true if the loading was successful, false otherwise

Implements TrigConf::ILoader.

Definition at line 60 of file DBLoader.cxx.

◆ setVerbose()

virtual void TrigConf::DBLoader::setVerbose ( int v)
inlineoverridevirtualinherited

Implements TrigConf::ILoader.

Definition at line 57 of file DBLoader.h.

◆ startSession()

void TrigConf::DBLoader::startSession ( )
inherited

start session if not already active

Definition at line 36 of file DBLoader.cxx.

37{
38 if ( ! m_session.transaction().isActive() ) {
39 bool readOnly = true;
40 m_session.transaction().start(readOnly);
41 m_sessionOwner = true;
42 }
43}

◆ triggerDBSchemaVersion()

unsigned int DBLoader::triggerDBSchemaVersion ( )
inherited

Definition at line 76 of file DBLoader.cxx.

76 {
77 return std::get<0>(loadSchemaVersion());
78}

◆ verbose()

virtual int TrigConf::DBLoader::verbose ( ) const
inlineoverridevirtualinherited

Implements TrigConf::ILoader.

Definition at line 56 of file DBLoader.h.

56{ return m_verbose; }

Member Data Documentation

◆ m_msg_tls

boost::thread_specific_ptr<MsgStreamTC> TrigConf::TrigConfMessaging::m_msg_tls
mutableprivateinherited

MsgStreamTC instance (a std::cout like with print-out levels)

Definition at line 71 of file TrigConfMessaging.h.

◆ m_name

std::string TrigConf::TrigConfMessaging::m_name
privateinherited

Definition at line 72 of file TrigConfMessaging.h.

◆ m_session

coral::ISessionProxy& TrigConf::DBLoader::m_session
protectedinherited

CORAL interface to database session.

Definition at line 67 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 68 of file DBLoader.h.

68{false};

◆ m_storageMgr

StorageMgr& TrigConf::DBLoader::m_storageMgr
protectedinherited

reference to the storage manager

Definition at line 66 of file DBLoader.h.

◆ m_verbose

int TrigConf::DBLoader::m_verbose {1}
privateinherited

Definition at line 63 of file DBLoader.h.

63{1};

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