ATLAS Offline Software
MenuLoader.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "./MenuLoader.h"
6 #include "./DBHelper.h"
10 #include "./LogicExpression.h"
11 
13 
14 #include "TrigConfL1Data/Menu.h"
19 #include "TrigConfL1Data/PIT.h"
20 #include "TrigConfL1Data/TIP.h"
22 
23 #include "boost/lexical_cast.hpp"
24 #include "boost/algorithm/string.hpp"
25 
26 #include <iostream>
27 #include <sstream>
28 #include <stdexcept>
29 #include <typeinfo>
30 #include <list>
31 
32 using namespace std;
33 
34 bool
36 
37  if(menu.smk()<=0) return false;
38  try {
39  startSession();
40 
41  loadMenuAttributes(menu);
42 
43  loadCaloInfo(menu);
44 
45  loadThresholds(menu);
46 
47  loadItems(menu);
48 
49  loadMonitoring(menu);
50 
51  commitSession();
52  }
53  catch( const coral::Exception& e ) {
54  TRG_MSG_ERROR("Caught coral exception: " << e.what());
55  commitSession();
56  throw;
57  }
58  catch( const std::exception& e ) {
59  TRG_MSG_ERROR("Caught std exception: " << e.what());
60  commitSession();
61  throw;
62  }
63  return true;
64 }
65 
66 
67 void
69  TRG_MSG_INFO("Loading CTP Items");
70 
71  // to later load internal triggers
72  TriggerThresholdLoader& ttldr = dynamic_cast<TriggerThresholdLoader&>( (dynamic_cast<StorageMgr&>(m_storageMgr))
73  .triggerThresholdLoader() );
74  ttldr.setMenuId(menu.id());
75  ttldr.setLoadCableInfo(false);
76 
77  // at this point the internal triggers are not found via the
78  // TM->TT link, hence load them when needed, and cache them
79  std::map<int,TriggerThreshold*> thresholdNotFoundCache;
80 
81  unique_ptr< coral::IQuery > query( m_session.nominalSchema().newQuery() );
82  query->addToTableList ( "L1_TM_TO_TI", "TM2TI" );
83  query->addToTableList ( "L1_TRIGGER_ITEM", "TI" );
84  query->addToTableList ( "L1_TI_TO_TT", "TI2TT" );
85 
86  // bind list
87  coral::AttributeList bindList;
88  bindList.extend<int>("menuId");
89  bindList[0].data<int>() = menu.id();
90 
91  std::string theCondition = "";
92  theCondition += std::string( " TM2TI.L1TM2TI_TRIGGER_MENU_ID = :menuId" );
93  theCondition += std::string( " AND TM2TI.L1TM2TI_TRIGGER_ITEM_ID = TI.L1TI_ID" );
94  theCondition += std::string( " AND TI2TT.L1TI2TT_TRIGGER_ITEM_ID = TI.L1TI_ID" );
95 
96  query->setCondition( theCondition, bindList );
97 
98  // output data and types
99  coral::AttributeList attList;
100  attList.extend<int> ( "TI.L1TI_ID" );
101  attList.extend<std::string>( "TI.L1TI_NAME" );
102  attList.extend<int> ( "TI.L1TI_VERSION" );
103  if(isRun2()) {
104  attList.extend<int> ( "TI.L1TI_PARTITION" );
105  attList.extend<string> ( "TI.L1TI_MONITOR" );
106  }
107  attList.extend<int> ( "TI.L1TI_CTP_ID" );
108  attList.extend<std::string>( "TI.L1TI_PRIORITY" );
109  attList.extend<std::string>( "TI.L1TI_DEFINITION" );
110  attList.extend<int> ( "TI.L1TI_TRIGGER_TYPE" );
111  attList.extend<int> ( "TI2TT.L1TI2TT_TRIGGER_THRESHOLD_ID" );
112  attList.extend<int> ( "TI2TT.L1TI2TT_POSITION" );
113  attList.extend<int> ( "TI2TT.L1TI2TT_MULTIPLICITY" );
114  fillQuery(query.get(), attList);
115 
116  // the ordering
117  std::string theOrder = "";
118  // to get the correct number of items
119  theOrder += " TI.L1TI_CTP_ID ASC";
120  // to get the correct TI definition
121  theOrder += ", TI2TT.L1TI2TT_POSITION ASC";
122  query->addToOrderList( theOrder );
123 
124  //query->setRowCacheSize(1000);
125  query->setRowCacheSize(500);
126 
127  query->setDistinct();
128 
129  coral::ICursor& cursor = query->execute();
130 
131  // lists to store <ctpId, vector> for later use
132  vector<int> ctpIDs;
133  map<int,vector<ThrInfo> > item_thrInfo;
134 
135  // create the items
136  while (cursor.next()) {
137 
138  const coral::AttributeList& row = cursor.currentRow();
139  int ctpid = row["TI.L1TI_CTP_ID"].data<int>();
140  TriggerItem* item = menu.item(ctpid);
141  if(! item) {
142  item = new TriggerItem();
143  item->setCtpId (ctpid);
144  item->setId (row["TI.L1TI_ID"].data<int>());
145  item->setName (row["TI.L1TI_NAME"].data<string>());
146  item->setVersion (row["TI.L1TI_VERSION"].data<int>());
147  if(isRun2()) {
148  item->setPartition (row["TI.L1TI_PARTITION"].data<int>());
149  string mon = row["TI.L1TI_MONITOR"].data<string>();
150  unsigned short monMask = 0;
151 
152  const short TBP = 0x1;
153  const short TAP = 0x2;
154  const short TAV = 0x4;
155 
156  vector<string> monLfHf;
157  boost::split(monLfHf, mon, boost::is_any_of(":|"));
158  //copy(monLfHf.begin(),monLfHf.end(), ostream_iterator<string>(cout,"\n") );
159 
160  if(monLfHf.size()==4 && monLfHf[0]=="LF" && monLfHf[2]=="HF" && monLfHf[1].size()==3 && monLfHf[3].size()==3) {
161  // LF
162  if( monLfHf[1][2]=='1' ) monMask |= TBP;
163  if( monLfHf[1][1]=='1' ) monMask |= TAP;
164  if( monLfHf[1][0]=='1' ) monMask |= TAV;
165  // HF
166  if( monLfHf[3][2]=='1' ) monMask |= TBP << 3;
167  if( monLfHf[3][1]=='1' ) monMask |= TAP << 3;
168  if( monLfHf[3][0]=='1' ) monMask |= TAV << 3;
169  } else {
170  // this is for the temporary solution
171  if(mon.find("TBP") != string::npos) monMask |= TBP;
172  if(mon.find("TAP") != string::npos) monMask |= TAP;
173  if(mon.find("TAV") != string::npos) monMask |= TAV;
174  }
175  item->setMonitor( monMask );
176  }
177 
178  string priority = row["TI.L1TI_PRIORITY"].data<string>();
179  if(priority=="0" || priority=="HIGH") {
180  item->setComplexDeadtime(0);
181  } else if(priority=="1" || priority=="LOW") {
182  item->setComplexDeadtime(1);
183  }
184  item->setDefinition (row["TI.L1TI_DEFINITION"].data<string>());
185  item->setTriggerType(row["TI.L1TI_TRIGGER_TYPE"].data<int>());
186  menu.addTriggerItem(item);
187  if(verbose()>1)
188  msg() << "MenuLoader: Created Item " << item->name() << " with CTPID " << item->ctpId() << endl;
189  item_thrInfo[ctpid] = vector<ThrInfo>();
190  ctpIDs.push_back(ctpid);
191  }
192 
193  ThrInfo thr_info;
194  thr_info.thrId = row["TI2TT.L1TI2TT_TRIGGER_THRESHOLD_ID"].data<int>();
195  thr_info.thrPos = row["TI2TT.L1TI2TT_POSITION"].data<int>();
196  thr_info.thrMult = row["TI2TT.L1TI2TT_MULTIPLICITY"].data<int>();
197  thr_info.thr = menu.thresholdConfig().findTriggerThreshold(thr_info.thrId);
198  if(thr_info.thr==0) {
199  // load threshold (internal thresholds)
200  thr_info.thr = new TriggerThreshold();
201  thr_info.thr->setId(thr_info.thrId);
202  if ( ! ttldr.load( *thr_info.thr ) ) {
203  msg() << "MenuLoader: Error loading TriggerThreshold " << thr_info.thrId << endl;
204  throw runtime_error( "MenuLoader::loadItems: error loading TriggerThreshold " );
205  }
206  menu.thresholdConfig().addTriggerThreshold(thr_info.thr);
207  }
208  item_thrInfo[ctpid].push_back(thr_info);
209  }
210 
211  // build the item node tree
212  for(int ctpid : ctpIDs) {
213  TriggerItem* titem = menu.findTriggerItem( ctpid );
214  if(verbose()>2) {
215  msg() << "MenuLoader: Number of thresholds for item " << titem->name()
216  << ": " << item_thrInfo[ctpid].size() << " - definition: " << titem->definition() << endl;
217  }
218  // construct the tree of TriggerItemNodes according to
219  // definition and set the thresholds and multiplicities in each
220  // leaf node
221  titem->setTopNode( constructTree(titem->definition(), item_thrInfo[ctpid]) );
222  }
223 }
224 
225 
227 TrigConf::MenuLoader::constructTree(const std::string& definition, const std::vector<ThrInfo>& thr_infos) {
228  LogicExpression logic(msg());
229  unsigned int n = logic.parse(definition);
230  if ( n <= 0 ) {
231  msg() << "Error parsing item definition : " << definition << std::endl;
232  return 0;
233  }
234  unsigned int size = thr_infos.size();
235  if (size != (n = logic.totalNumberOfElements()) ) {
236  msg() << "Total number of elements are different: "
237  << " input=" << size << ", parsed=" << n << endl;
238  }
239 
240  logic.normalize();
241 
242  return constructTree(logic, thr_infos);
243 }
244 
245 
247 TrigConf::MenuLoader::constructTree(const LogicExpression& def, const std::vector<ThrInfo>& thr_infos) {
248  TriggerItemNode* top_node=0;
249  const std::vector<std::shared_ptr<LogicExpression>> & sub_logics = def.subLogics();
250 
251  switch (def.state()) {
252  case LogicExpression::kELEMENT: {
253  top_node = new TriggerItemNode(TriggerItemNode::OBJ);
254  unsigned int pos = boost::lexical_cast<unsigned int,std::string>(def.element());
255  // find all related information
256  for(ThrInfo ti : thr_infos) {
257  if(ti.thrPos==pos) {
258  top_node->setPosition( pos );
259  top_node->setMultiplicity( ti.thrMult );
260  top_node->setTriggerThreshold( ti.thr );
261  break;
262  }
263  }
264  break;
265  }
266  case LogicExpression::kAND:
267  case LogicExpression::kOPEN:
268  top_node = new TriggerItemNode(TriggerItemNode::AND);
269  for(auto sl : sub_logics)
270  top_node->addChild( constructTree(*sl, thr_infos) );
271  break;
272  case LogicExpression::kOR:
273  if(sub_logics.size()>0) {
274  top_node = new TriggerItemNode(TriggerItemNode::OR);
275  for(auto sl : sub_logics)
276  top_node->addChild( constructTree(*sl, thr_infos) );
277  }
278  break;
279  case LogicExpression::kNOT:
280  top_node = new TriggerItemNode(TriggerItemNode::NOT);
281  for(auto sl : sub_logics)
282  top_node->addChild( constructTree(*sl, thr_infos) );
283  break;
284  }
285 
286  return top_node;
287 }
288 
289 
290 /*********************************************
291  * get monitoring counter
292  *********************************************/
293 void
295  if( ! (m_env == MenuLoader::ALL ||
296  m_env == MenuLoader::CTP ||
297  m_env == MenuLoader::CTPOnl ||
298  m_env == MenuLoader::COOLL1) ) return;
299 
300  TRG_MSG_DEBUG("Load monitoring counter mapping ");
301 
302  unique_ptr< coral::IQuery > q(m_session.nominalSchema().newQuery());
303  q->addToTableList ( "L1_TM_TO_TT_MON", "TM2TTM" );
304  q->addToTableList ( "L1_TRIGGER_THRESHOLD", "TT" );
305  q->addToTableList ( "L1_TM_TO_TT", "TM2TT" );
306 
307  //Bind list
308  coral::AttributeList bindings;
309  bindings.extend<int>("menuId");
310  bindings[0].data<int>() = menu.id();
311 
312  string cond = "";
313  cond += " TM2TTM.L1TM2TTM_TRIGGER_MENU_ID = :menuId";
314  cond += " AND TM2TT.L1TM2TT_TRIGGER_MENU_ID = :menuId";
315  cond += " AND TM2TTM.L1TM2TTM_TRIGGER_THRESHOLD_ID = TM2TT.L1TM2TT_TRIGGER_THRESHOLD_ID";
316  cond += " AND TM2TT.L1TM2TT_TRIGGER_THRESHOLD_ID = TT.L1TT_ID";
317 
318  q->setCondition( cond, bindings );
319 
320  // Output data and types
322  output.extend<std::string>( "TM2TTM.L1TM2TTM_NAME" );
323  output.extend<int> ( "TM2TTM.L1TM2TTM_TRIGGER_THRESHOLD_ID" );
324  output.extend<int> ( "TM2TTM.L1TM2TTM_INTERNAL_COUNTER" );
325  output.extend<int> ( "TM2TTM.L1TM2TTM_MULTIPLICITY" );
326  output.extend<long> ( "TM2TTM.L1TM2TTM_BUNCH_GROUP_ID" );
327  output.extend<std::string>( "TM2TTM.L1TM2TTM_COUNTER_TYPE" );
328  output.extend<std::string>( "TT.L1TT_NAME" );
329  output.extend<int> ( "TT.L1TT_ACTIVE" );
330  output.extend<std::string>( "TM2TT.L1TM2TT_CABLE_CTPIN" );
331  output.extend<std::string>( "TM2TT.L1TM2TT_CABLE_CONNECTOR" );
332  output.extend<int> ( "TM2TT.L1TM2TT_CABLE_START" );
333  output.extend<int> ( "TM2TT.L1TM2TT_CABLE_END" );
334  fillQuery(q.get(), output);
335 
336  q->setRowCacheSize(500);
337 
338  coral::ICursor& cursor = q->execute();
339  ThresholdMonitor* tm = 0;
340 
341  while (cursor.next()) {
342  const coral::AttributeList& row = cursor.currentRow();
343  tm = new ThresholdMonitor();
344 
345  tm->setName ( row["TM2TTM.L1TM2TTM_NAME"].data<string>());
346  tm->setThresholdId ( row["TM2TTM.L1TM2TTM_TRIGGER_THRESHOLD_ID"].data<int>());
347  tm->setInternalCounter( row["TM2TTM.L1TM2TTM_INTERNAL_COUNTER"].data<int>());
348  tm->setMultiplicity ( row["TM2TTM.L1TM2TTM_MULTIPLICITY"].data<int>());
349  tm->setBunchGroupId ( row["TM2TTM.L1TM2TTM_BUNCH_GROUP_ID"].data<long>());
350  tm->setCounterType ( row["TM2TTM.L1TM2TTM_COUNTER_TYPE"].data<string>());
351  tm->setThresholdName ( row["TT.L1TT_NAME"].data<string>());
352  tm->setThresholdActive( row["TT.L1TT_ACTIVE"].data<int>());
353 
354  string slotString = row["TM2TT.L1TM2TT_CABLE_CTPIN"].data<std::string>();
355  uint16_t slot = slotString[4]-'0'; // "SLOT7" -> 7
356  if(slot<7 || slot>9) {
357  TRG_MSG_ERROR("Unknown CTPIN string '" << slotString << "'");
358  throw runtime_error( "MenuLoader (ThresholdMonitor): Error loading Monitoring counters " );
359  }
360  tm->setCtpinSlot(slot);
361 
362  string conString = row["TM2TT.L1TM2TT_CABLE_CONNECTOR"].data<std::string>();
363  uint16_t con = conString[3]-'0'; // "CON2" -> 2
364  if(con>3) {
365  TRG_MSG_ERROR("Unknown CTPIN connector string '" << conString << "'");
366  throw runtime_error( "MenuLoader (ThresholdMonitor): Error loading Monitoring counters " );
367  }
368  tm->setCtpinConnector(con);
369  tm->setThresholdStartBit(row["TM2TT.L1TM2TT_CABLE_START"].data<int>());
370  tm->setThresholdEndBit (row["TM2TT.L1TM2TT_CABLE_END"].data<int>());
371  menu.addThresholdMonitor(tm);
372  }
373 
374 }
375 
376 
377 
378 
379 
380 
381 
382 
383 /***************************************
384  * get Thresholds
385  ***************************************/
386 void
388  TRG_MSG_INFO("Loading L1 trigger thresholds");
389 
390  ThresholdConfigLoader* thrldr = new ThresholdConfigLoader(m_storageMgr, m_session);
391  thrldr->setLevel(outputLevel());
392  if ( !thrldr->load( menu.thresholdConfig() ) ) {
393  TRG_MSG_ERROR("Error loading ThresholdConfig " << menu.thresholdConfig().id());
394  throw runtime_error( "MenuLoader: Error loading ThresholdConfig " );
395  }
396 
397  loadPIT(menu);
398 
399  if( menu.pitVector().size() == menu.tipVector().size() ) {
400  // this is the case when we
401  // a) have either no direct inputs in the menu (unlikely, but then the next call doesn't matter), or
402  // b) the direct inputs were not filled in the TIP map: this is not the case since TriggerTool-04-01-06
403  createTipFromDirectThresholds(menu);
404  }
405 
406 }
407 
408 
409 
410 void
412  if( ! (m_env == MenuLoader::ALL ||
413  m_env == MenuLoader::CTPOnl ||
414  m_env == MenuLoader::COOLL1) ) return;
415 
416  set<int> tipNumbersUsed;
417 
418 
419  unique_ptr< coral::IQuery > q( m_session.nominalSchema().newQuery() );
420  q->addToTableList ( "L1_TM_TO_TT", "TM2TT" );
421  q->addToTableList ( "L1_PITS", "PITS" );
422 
423  //Bind list
424  coral::AttributeList bindings;
425  bindings.extend<int>("menuId");
426  bindings[0].data<int>() = menu.id();
427 
428  std::string cond("TM2TT.L1TM2TT_TRIGGER_MENU_ID = :menuId");
429  cond += " AND PITS.L1PIT_TM_TO_TT_ID = TM2TT.L1TM2TT_ID";
430  q->setCondition( cond, bindings );
431 
432  // should not be necessary, however currently the TriggerTool uploads identical copies in some cases
433  q->setDistinct();
434 
435  // Output data and types
436  coral::AttributeList attList;
437  attList.extend<int>( "TM2TT.L1TM2TT_TRIGGER_THRESHOLD_ID" );
438  attList.extend<int>( "TM2TT.L1TM2TT_ID" );
439  attList.extend<int>( "PITS.L1PIT_PIT_NUMBER" );
440  attList.extend<int>( "PITS.L1PIT_THRESHOLD_BIT" );
441  fillQuery(q.get(), attList);
442 
443  uint npits(0), ntips(0);
444 
445  coral::ICursor& cursor = q->execute();
446  while (cursor.next()) {
447  const coral::AttributeList& row = cursor.currentRow();
448 
449  int ttid = row["TM2TT.L1TM2TT_TRIGGER_THRESHOLD_ID"].data<int>();
450  int tmtott = row["TM2TT.L1TM2TT_ID"].data<int>();
451  int tipnum = row["PITS.L1PIT_PIT_NUMBER"].data<int>();
452  int bitnum = row["PITS.L1PIT_THRESHOLD_BIT"].data<int>();
453 
454  TriggerThreshold* tt = menu.thresholdConfig().findTriggerThreshold(ttid);
455 
456 
457  string slotString = tt->cableCtpin();
458  uint16_t slot = 0;
459  if( boost::iequals( slotString, "CTPCORE" ) ) {
460  slot = 10;
461  } else {
462  slot = slotString[4]-'0'; // "SLOT7" -> (uint)7
463  }
464  if(slot<7 || slot>10) {
465  TRG_MSG_ERROR("Unknown CTPIN SLOT '" << slotString << "'");
466  throw runtime_error( "MenuLoader: Error loading PITs " );
467  }
468 
469  string conString = tt->cableConnector();
470  uint16_t con = conString[3]-'0'; // "CON2" -> (uint)2
471  uint16_t conMax = slot==10 ? 2 : 3;
472  if( con > conMax ) {
473  TRG_MSG_ERROR("Unknown CTPIN CONNECTOR '" << conString << "'");
474  throw runtime_error( "MenuLoader: Error loading PITs " );
475  }
476 
477  if(slot!=10) {
478  PIT* pit = new PIT();
479  pit->setThresholdName(tt->name());
480  pit->setCtpinSlot(slot);
481  pit->setCtpinConnector( con );
482  pit->setPitNumber(tipnum);
483  pit->setThresholdBit(bitnum);
484  pit->setCableBit( tt->cableStart() + bitnum );
485  pit->setTmToTtId(tmtott);
486  pit->setTriggerThresholdId(ttid);
487  pit->setThresholdActive(tt->active());
488  pit->setThresholdMapping(tt->mapping());
489  menu.addPit(pit);
490  npits++;
491  }
492 
493  // this is for early menus
494  if(tipNumbersUsed.count(tipnum) > 0) {
495  tipnum = tipnum + 160;
496  } else {
497  tipNumbersUsed.insert(tipnum);
498  }
499 
500  TIP* tip = new TIP();
501  tip->setThresholdName(tt->name());
502  tip->setSlot(slot);
503  tip->setConnector( con );
504  tip->setTipNumber(tipnum);
505  tip->setClock( tipnum % 2 );
506  tip->setThresholdBit(bitnum);
507  tip->setCableBit( tt->cableStart() + bitnum );
508  tip->setTmToTtId(tmtott);
509  tip->setTriggerThresholdId(ttid);
510  tip->setThresholdActive(tt->active());
511  tip->setThresholdMapping(tt->mapping());
512  if(slot==10) tip->setIsDirect(true);
513  else tip->setIsDirect(false);
514  menu.addTip(tip);
515  ntips++;
516 
517  TRG_MSG_DEBUG("TIP " << tip->tipNumber() << " --> " << tt->name());
518  }
519 
520  TRG_MSG_INFO("Loaded " << npits << " PITs and " << ntips << " TIPs");
521  TRG_MSG_INFO("Menu has " << menu.pitVector().size() << " PITs and " << menu.tipVector().size() << " TIPs");
522 
523 
524 }
525 
526 
527 void
529 
530  // this is only needed as long as the TIPs from the direct input are not in the database
531 
532  unsigned int ntips(0);
533 
534  for(TriggerThreshold * thr : menu.thresholdConfig().getThresholdVector() ) {
535  if(thr->ttype()==L1DataDef::TOPO || thr->ttype()==L1DataDef::ALFA) {
536 
537  const string & conn = thr->cableConnector(); // "CON0", "CON1", "CON2"
538 
539  unsigned int connector = conn[3]-'0';
540  unsigned int cableOffset = 320 + connector * 64;
541  unsigned int cableBit = (unsigned int) thr->cableStart();
542  unsigned int clock = thr->clock();
543  unsigned int tipNumber = 2*cableBit + clock + cableOffset;
544 
545  TIP* tip = new TIP();
546  tip->setThresholdName(thr->name());
547  tip->setSlot(10);
548  tip->setConnector( connector );
549  tip->setTipNumber( tipNumber );
550  tip->setThresholdBit( thr->clock() );
551  tip->setCableBit( thr->cableStart() );
552  tip->setTriggerThresholdId(thr->id() );
553  tip->setThresholdActive(thr->active());
554  tip->setThresholdMapping(thr->mapping());
555  tip->setIsDirect(true);
556  menu.addTip(tip);
557 
558  TRG_MSG_DEBUG("TIP from direct input thresholds " << tip->tipNumber() << " --> " << thr->name());
559 
560  ntips++;
561 
562  }
563  }
564 
565  TRG_MSG_INFO( "Number of TIPs from direct input thresholds " << ntips );
566 
567 }
568 
569 
570 
571 void
573  // load the CaloInfo
575  ci.setSMK(menu.smk());
576  m_storageMgr.caloInfoLoader().setLevel(outputLevel());
577  m_storageMgr.caloInfoLoader().load(ci);
578  menu.setCaloInfo(ci);
579 }
580 
581 /***********************************
582  * retrieve menu name and version
583  ***********************************/
584 void
586 
587  TRG_MSG_DEBUG("Loading menu data for SMK " << menu.smk());
588 
589  unique_ptr< coral::IQuery > q( m_session.nominalSchema().newQuery() );
590  q->addToTableList ( "SUPER_MASTER_TABLE", "SM" );
591  q->addToTableList ( "L1_MASTER_TABLE", "MT" );
592  q->addToTableList ( "L1_TRIGGER_MENU", "TM" );
593 
594  //Bind list
595  coral::AttributeList bindings;
596  bindings.extend<int>("smk");
597  bindings[0].data<int>() = menu.smk();
598 
599  string condition("");
600  condition += "SM.SMT_ID = :smk";
601  condition += " AND SM.SMT_L1_MASTER_TABLE_ID = MT.L1MT_ID";
602  condition += " AND MT.L1MT_TRIGGER_MENU_ID = TM.L1TM_ID";
603  q->setCondition( condition , bindings );
604 
605  //Define the data types
606  coral::AttributeList attList;
607  attList.extend<int>("TM.L1TM_ID");
608  attList.extend<string>("TM.L1TM_NAME");
609  attList.extend<int>("TM.L1TM_VERSION");
610  attList.extend<int>("MT.L1MT_ID" );
611  fillQuery(q.get(), attList);
612 
613  coral::ICursor& cursor = q->execute();
614  if ( ! cursor.next() ) {
615  TRG_MSG_ERROR("No trigger menu in SMK " << menu.smk());
616  throw runtime_error( "MenuLoader: ERROR trigger menu not available" );
617  }
618 
619  // fill the object with data
620  const coral::AttributeList& row = cursor.currentRow();
621  menu.setId ( row["TM.L1TM_ID"].data<int>() );
622  menu.setName ( row["TM.L1TM_NAME"].data<string>() );
623  menu.setVersion( row["TM.L1TM_VERSION"].data<int>() );
624  menu.thresholdConfig().setLvl1MasterTableId( row["MT.L1MT_ID"].data<int>() );
625 }
TrigConf::MenuLoader::load
virtual bool load(Menu &data) override
Definition: MenuLoader.cxx:35
TrigConf::TrigConfData::setName
void setName(const std::string &name)
Definition: TrigConfData.h:30
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
TRG_MSG_ERROR
#define TRG_MSG_ERROR(x)
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:29
query_example.row
row
Definition: query_example.py:24
TrigConf::ThresholdConfigLoader::load
virtual bool load(ThresholdConfig &data) override
Definition: ThresholdConfigLoader.cxx:43
TriggerItem.h
TrigConf::ThresholdMonitor::setCounterType
void setCounterType(const std::string &countertype)
Definition: ThresholdMonitor.h:44
checkCorrelInHIST.conn
conn
Definition: checkCorrelInHIST.py:25
TrigConf::TrigConfData::name
const std::string & name() const
Definition: TrigConfData.h:22
TrigConf::PIT
Definition: PIT.h:13
TrigConf::TIP::tipNumber
uint16_t tipNumber() const
Definition: TIP.h:29
TrigConf::PIT::setThresholdName
void setThresholdName(const std::string &name)
Definition: PIT.h:21
TrigConf::MenuLoader::constructTree
TriggerItemNode * constructTree(const std::string &def, const std::vector< ThrInfo > &)
New versions for item definition in string.
Definition: MenuLoader.cxx:227
TrigConf::TIP::setIsDirect
void setIsDirect(const bool &a)
Definition: TIP.h:51
TrigConf::MenuLoader::ThrInfo
Definition: MenuLoader.h:41
TrigConf::TIP::setThresholdMapping
void setThresholdMapping(const int16_t &m)
Definition: TIP.h:45
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
TrigConf::TIP::setThresholdName
void setThresholdName(const std::string &name)
Definition: TIP.h:21
ThresholdConfigLoader.h
TrigConf::MenuLoader::loadCaloInfo
void loadCaloInfo(TrigConf::Menu &menu)
Definition: MenuLoader.cxx:572
TrigConf::TIP
Definition: TIP.h:13
TrigConf::LogicExpression::parse
virtual int parse(const std::string &expr, bool enclosed=false)
Definition: LogicExpression.cxx:51
TrigConf::TriggerItemNode::setTriggerThreshold
void setTriggerThreshold(TriggerThreshold *thr)
Definition: TriggerItemNode.cxx:74
TrigConf::MenuLoader::ThrInfo::thrMult
short thrMult
Definition: MenuLoader.h:44
MenuLoader.h
DBHelper.h
TrigConf::MenuLoader::ThrInfo::thrId
int thrId
Definition: MenuLoader.h:42
TrigConf::PIT::setTmToTtId
void setTmToTtId(const int &tmtottid)
Definition: PIT.h:39
TrigConf::TriggerThresholdLoader::load
virtual bool load(TriggerThreshold &data) override
Definition: TriggerThresholdLoader.cxx:30
TrigConf::LogicExpression::subLogics
const LogicV_t & subLogics() const
Definition: LogicExpression.h:62
TrigConf::PIT::setTriggerThresholdId
void setTriggerThresholdId(const int &id)
Definition: PIT.h:42
Root::AND
@ AND
Definition: TGRLCollection.h:32
TrigConf::fillQuery
void fillQuery(coral::IQuery *q, coral::AttributeList &attList)
Definition: DBHelper.cxx:13
LArG4GenerateShowerLib.condition
condition
Definition: LArG4GenerateShowerLib.py:19
Menu.h
ALL
@ ALL
Definition: sTGCenumeration.h:14
TrigConf::TriggerItemNode::addChild
void addChild(TriggerItemNode *node)
Definition: TriggerItemNode.cxx:114
python.selector.AtlRunQuerySelectorLhcOlc.priority
priority
Definition: AtlRunQuerySelectorLhcOlc.py:611
TrigConf::MenuLoader::loadItems
void loadItems(TrigConf::Menu &menu)
Definition: MenuLoader.cxx:68
TrigConf::TriggerItemNode
Definition: TriggerItemNode.h:22
ThresholdMonitor.h
python.PyKernel.AttributeList
AttributeList
Definition: PyKernel.py:36
LogicExpression.h
TrigConf::TIP::setTriggerThresholdId
void setTriggerThresholdId(const int &id)
Definition: TIP.h:42
TrigConf::DBLoader::setLevel
virtual void setLevel(MSGTC::Level lvl) override
access to output stream
Definition: DBLoader.cxx:60
TrigConf::PIT::setPitNumber
void setPitNumber(const uint16_t &pitnumber)
Definition: PIT.h:30
TrigConf::MenuLoader::ThrInfo::thr
TriggerThreshold * thr
Definition: MenuLoader.h:45
TrigConf::LogicExpression
Definition: LogicExpression.h:27
TrigConf::StorageMgr
Database Storage Manager, controls the database session and the different loader classes for DB acces...
Definition: StorageMgr.h:23
TrigConf::ThresholdMonitor
Definition: ThresholdMonitor.h:18
TrigConf::TIP::setConnector
void setConnector(const uint16_t &id)
Definition: TIP.h:27
query
Definition: query.py:1
TrigConf::TriggerItemNode::setPosition
void setPosition(int pos)
Definition: TriggerItemNode.h:43
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
TrigConf::TIP::setClock
void setClock(const int &clock)
Definition: TIP.h:54
menu
make the sidebar many part of the config
Definition: hcg.cxx:551
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
TrigConf::ThresholdConfigLoader
TriggerDB loader of the LVL1 trigger threshold configuration.
Definition: ThresholdConfigLoader.h:26
TrigConf::MenuLoader::loadThresholds
void loadThresholds(TrigConf::Menu &menu)
Definition: MenuLoader.cxx:387
TrigConf::MenuLoader::loadPIT
void loadPIT(TrigConf::Menu &menu)
Definition: MenuLoader.cxx:411
TrigConf::PIT::setThresholdMapping
void setThresholdMapping(const int16_t &m)
Definition: PIT.h:45
TrigConf::PIT::setCableBit
void setCableBit(const uint16_t &num)
Definition: PIT.h:36
TrigConf::Menu
Definition: Menu.h:49
TrigConf::MenuLoader::loadMenuAttributes
void loadMenuAttributes(TrigConf::Menu &menu)
Definition: MenuLoader.cxx:585
TrigConf::TriggerThresholdLoader::setMenuId
void setMenuId(const int &id)
Definition: TriggerThresholdLoader.cxx:270
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
StorageMgr.h
TrigConf::ThresholdMonitor::setThresholdId
void setThresholdId(const int &id)
Definition: ThresholdMonitor.h:40
TrigConf::TrigConfData::setSMK
void setSMK(int id)
Definition: TrigConfData.h:28
beamspotman.n
n
Definition: beamspotman.py:731
TrigConf::CaloInfo
Definition: CaloInfo.h:35
TrigConf::LogicExpression::normalize
void normalize()
Definition: LogicExpression.cxx:204
calibdata.exception
exception
Definition: calibdata.py:496
TriggerThresholdLoader.h
TrigConf::ThresholdMonitor::setThresholdEndBit
void setThresholdEndBit(const int &bit)
Definition: ThresholdMonitor.h:49
TrigConf::TIP::setTmToTtId
void setTmToTtId(const int &tmtottid)
Definition: TIP.h:39
TriggerThreshold.h
TrigConf::TrigConfData::setId
void setId(unsigned int id)
Definition: TrigConfData.h:29
TrigConf::PIT::setThresholdBit
void setThresholdBit(const uint16_t &num)
Definition: PIT.h:33
TrigConf::ThresholdMonitor::setInternalCounter
void setInternalCounter(const int &internalcounter)
Definition: ThresholdMonitor.h:42
query_example.query
query
Definition: query_example.py:15
TRG_MSG_INFO
#define TRG_MSG_INFO(x)
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:27
TrigConf::LogicExpression::state
char state() const
Definition: LogicExpression.h:60
merge.output
output
Definition: merge.py:17
python.TrigConfigSvcUtils.isRun2
def isRun2(cursor, schemaname)
Definition: TrigConfigSvcUtils.py:290
TrigConf::MenuLoader::loadMonitoring
void loadMonitoring(TrigConf::Menu &menu)
Definition: MenuLoader.cxx:294
TrigConf::TIP::setThresholdActive
void setThresholdActive(const bool &a)
Definition: TIP.h:48
TrigConf::ThresholdMonitor::setCtpinConnector
void setCtpinConnector(const uint16_t &con)
Definition: ThresholdMonitor.h:47
TrigConf::ThresholdMonitor::setBunchGroupId
void setBunchGroupId(const int &bunchgroupid)
Definition: ThresholdMonitor.h:43
TrigConf::MenuLoader::createTipFromDirectThresholds
void createTipFromDirectThresholds(TrigConf::Menu &menu)
Definition: MenuLoader.cxx:528
TIP.h
TrigConf::TIP::setTipNumber
void setTipNumber(const uint16_t &tipnumber)
Definition: TIP.h:30
item
Definition: ItemListSvc.h:43
TrigConf::TriggerItemNode::setMultiplicity
void setMultiplicity(int mult)
Definition: TriggerItemNode.h:44
TrigConf::PIT::setCtpinSlot
void setCtpinSlot(const uint16_t &id)
Definition: PIT.h:24
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
python.TrigPSCPythonDbSetup.outputLevel
outputLevel
Definition: TrigPSCPythonDbSetup.py:30
L1DataDef.h
TrigConf::MenuLoader::ThrInfo::thrPos
unsigned int thrPos
Definition: MenuLoader.h:43
TrigConf::ThresholdMonitor::setMultiplicity
void setMultiplicity(const int &multiplicity)
Definition: ThresholdMonitor.h:41
query_example.cursor
cursor
Definition: query_example.py:21
TrigConf::TIP::setSlot
void setSlot(const uint16_t &id)
Definition: TIP.h:24
PIT.h
TrigConf::LogicExpression::element
const std::string & element() const
Definition: LogicExpression.h:61
python.TriggerHandler.verbose
verbose
Definition: TriggerHandler.py:297
TrigConf::TIP::setCableBit
void setCableBit(const uint16_t &num)
Definition: TIP.h:36
TrigConf::TIP::setThresholdBit
void setThresholdBit(const uint16_t &num)
Definition: TIP.h:33
plotBeamSpotMon.mon
mon
Definition: plotBeamSpotMon.py:67
TrigConf::TriggerItem::definition
const std::string & definition() const
Definition: TriggerItem.h:32
Root::OR
@ OR
Definition: TGRLCollection.h:32
TrigConf::ThresholdMonitor::setThresholdStartBit
void setThresholdStartBit(const int &bit)
Definition: ThresholdMonitor.h:48
TrigConf::TriggerItem::setTopNode
void setTopNode(TriggerItemNode *ptrnode)
Definition: TriggerItem.h:43
extractSporadic.q
list q
Definition: extractSporadic.py:98
TrigConf::PIT::setThresholdActive
void setThresholdActive(const bool &a)
Definition: PIT.h:48
TrigConf::TriggerThresholdLoader
TriggerDB loader of the LVL1 trigger thresholds.
Definition: TriggerThresholdLoader.h:27
ThresholdMonitorLoader.h
TrigConf::LogicExpression::totalNumberOfElements
int totalNumberOfElements() const
Definition: LogicExpression.cxx:224
TrigConf::TriggerThresholdLoader::setLoadCableInfo
void setLoadCableInfo(bool b)
Definition: TriggerThresholdLoader.h:44
TrigConf::ThresholdMonitor::setCtpinSlot
void setCtpinSlot(const uint16_t &slot)
Definition: ThresholdMonitor.h:46
TrigConf::TriggerThreshold
Definition: TriggerThreshold.h:20
TileDCSDataPlotter.tt
tt
Definition: TileDCSDataPlotter.py:874
TrigConf::ThresholdMonitor::setThresholdName
void setThresholdName(const std::string &name)
Definition: ThresholdMonitor.h:45
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
Trk::split
@ split
Definition: LayerMaterialProperties.h:38
TrigConf::TriggerItem
Definition: TriggerItem.h:25
TrigConf::PIT::setCtpinConnector
void setCtpinConnector(const uint16_t &id)
Definition: PIT.h:27
TrigConf::ThresholdMonitor::setThresholdActive
void setThresholdActive(const bool &active)
Definition: ThresholdMonitor.h:50
TRG_MSG_DEBUG
#define TRG_MSG_DEBUG(x)
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:25
TriggerItemNode.h