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
 access to output stream
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 17 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 25 of file L1TopoMenuLoader.h.

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

◆ ~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:69
coral::ISessionProxy & m_session
CORAL interface to database session.
Definition DBLoader.h:68

◆ 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 60 of file DBLoader.h.

60{ 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

◆ load()

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

Implements TrigConf::IL1TopoMenuLoader.

Definition at line 26 of file L1TopoMenuLoader.cxx.

26 {
27 try {
28 unsigned int schema = triggerDBSchemaVersion();
29 TRG_MSG_DEBUG("L1TopoMenuLoader Run " << (isRun1()? 1 : 2) << ", schema version " << schema);
30 if(isRun1()) {
31 TRG_MSG_INFO("Not loading L1 TopoMenu from a run 1 database");
32 return true;
33 }
34 TRG_MSG_INFO("Loading L1 TopoMenu with SMK " << tcaTarget.getSMK());
36 loadTopoAlgos(tcaTarget);
39 tcaTarget.print();
40 } catch( const std::exception& e ) {
41 TRG_MSG_ERROR("L1TopoMenuLoader::load >> Standard C++ exception: " << e.what());
42 } catch( ... ) {
43 TRG_MSG_ERROR("L1TopoMenuLoader::load >> ... caught ");
44 }
45 TRG_MSG_INFO( "Loaded L1 TopoMenu with " << tcaTarget.getL1TopoConfigAlgs().size() << " algorithms and "
46 << tcaTarget.getL1TopoConfigOutputList().getTriggerLines().size() << " trigger lines");
47 return true;
48}
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:35
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 379 of file L1TopoMenuLoader.cxx.

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

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

◆ loadAllAlgsOutput()

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

Definition at line 225 of file L1TopoMenuLoader.cxx.

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

◆ loadAllAlgsRegister()

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

Definition at line 302 of file L1TopoMenuLoader.cxx.

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

◆ 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" );
195 }
196
197 const coral::AttributeList& row = cursor.currentRow();
198 Lvl1MenuKey = row["L1MT_TRIGGER_MENU_ID"].data<int>();
199
201
202 }
203 catch( const std::exception& e ) {
204 msg() << "DBLoader >> Standard C++ exception: " << e.what() << std::endl;
205 m_session.transaction().rollback();
206 throw;
207 }
208 return true;
209}
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 620 of file L1TopoMenuLoader.cxx.

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

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

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

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

◆ setLevel()

◆ setVerbose()

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

Implements TrigConf::ILoader.

Definition at line 58 of file DBLoader.h.

◆ startSession()

void TrigConf::DBLoader::startSession ( )
inherited

start session if not already active

Definition at line 35 of file DBLoader.cxx.

36{
37 if ( ! m_session.transaction().isActive() ) {
38 //std::cout << "DBLoader: startSession(readonly=true)" << std::endl;
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 57 of file DBLoader.h.

57{ 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 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.

69{false};

◆ m_storageMgr

StorageMgr& TrigConf::DBLoader::m_storageMgr
protectedinherited

reference to the storage manager

Definition at line 67 of file DBLoader.h.

◆ m_verbose

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

Definition at line 64 of file DBLoader.h.

64{1};

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