ATLAS Offline Software
CTPTriggerItem.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "./CTPTriggerItem.h"
8 
9 #include <exception>
10 
12 {}
13 
15 {}
16 
17 void
19  m_prescale = prescale;
20 }
21 
22 
23 int
25  return m_prescale;
26 }
27 
28 void
29 LVL1CTP::CTPTriggerItem::setName( const std::string & name ) {
30  m_name = name;
31 }
32 
33 
34 const std::string &
36  return m_name;
37 }
38 
39 unsigned int
41  return m_ctpid;
42 }
43 
44 void
45 LVL1CTP::CTPTriggerItem::setCtpId( unsigned int ctpid ) {
46  m_ctpid = ctpid;
47 }
48 
49 void
51  m_TriggerType = (triggerType & 0xff);
52 }
53 
54 unsigned char
56  return m_TriggerType;
57 }
58 
59 void
60 LVL1CTP::CTPTriggerItem::setLogic(const std::string & logicExpr) {
61  TrigConf::LogicParser p;
62  m_logic = p.parse(logicExpr);
63 }
64 
65 
66 const std::shared_ptr<TrigConf::Logic> &
68  return m_logic;
69 }
70 
71 void
72 LVL1CTP::CTPTriggerItem::setBunchGroups(const std::vector<std::string> & bunchGroups) {
73  m_bunchGroups = bunchGroups;
74 }
75 
76 const std::vector<std::string> &
78  return m_bunchGroups;
79 }
80 
81 
82 bool
83 LVL1CTP::CTPTriggerItem::evaluate( const std::map<std::string, unsigned int> & thrDecMap ) const
84 {
85  if(m_logic) {
86  bool dec = m_logic->evaluate(thrDecMap);
87  if( dec && (! m_bunchGroups.empty()) ) {
88  // apply bunchgroups, if set (if not set, it is part of the logic)
89  for( auto & bgName : m_bunchGroups ) {
90  try {
91  if( thrDecMap.at(bgName) == 0 ) {
92  dec = false; break;
93  }
94  }
95  catch(std::exception &) {
96  throw std::runtime_error( "Problem accessing decision for bunchgroup " + bgName);
97  }
98  }
99  }
100  return dec;
101  } else {
102  std::cerr << "No logic set for this ctpItem " << name() << std::endl;
103  return false;
104  }
105 }
TriggerItem.h
LVL1CTP::CTPTriggerItem::~CTPTriggerItem
~CTPTriggerItem()
default destructor
Definition: CTPTriggerItem.cxx:14
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
LVL1CTP::CTPTriggerItem::setLogic
void setLogic(const std::string &logicExpr)
Definition: CTPTriggerItem.cxx:60
CTPTriggerItem.h
LVL1CTP::CTPTriggerItem::setName
void setName(const std::string &name)
Definition: CTPTriggerItem.cxx:29
LVL1CTP::CTPTriggerItem::evaluate
bool evaluate(const std::map< std::string, unsigned int > &thrDecMap) const
Definition: CTPTriggerItem.cxx:83
LVL1CTP::CTPTriggerItem::prescale
int prescale() const
Definition: CTPTriggerItem.cxx:24
LVL1CTP::CTPTriggerItem::triggerType
unsigned char triggerType() const
Definition: CTPTriggerItem.cxx:55
LVL1CTP::CTPTriggerItem::setBunchGroups
void setBunchGroups(const std::vector< std::string > &bunchGroups)
Definition: CTPTriggerItem.cxx:72
LVL1CTP::CTPTriggerItem::bunchGroups
const std::vector< std::string > & bunchGroups() const
Definition: CTPTriggerItem.cxx:77
calibdata.exception
exception
Definition: calibdata.py:496
LVL1CTP::CTPTriggerItem::setTriggerType
void setTriggerType(unsigned char triggerType)
Definition: CTPTriggerItem.cxx:50
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
LVL1CTP::CTPTriggerItem::name
const std::string & name() const
Definition: CTPTriggerItem.cxx:35
LVL1CTP::CTPTriggerItem::setPrescale
void setPrescale(int prescale)
Definition: CTPTriggerItem.cxx:18
LVL1CTP::CTPTriggerItem::setCtpId
void setCtpId(unsigned int ctpid)
Definition: CTPTriggerItem.cxx:45
LogicParser.h
RunTileMonitoring.triggerType
triggerType
Definition: RunTileMonitoring.py:162
LVL1CTP::CTPTriggerItem::ctpId
unsigned int ctpId() const
Definition: CTPTriggerItem.cxx:40
LVL1CTP::CTPTriggerItem::logic
const std::shared_ptr< TrigConf::Logic > & logic() const
Definition: CTPTriggerItem.cxx:67
LVL1CTP::CTPTriggerItem::CTPTriggerItem
CTPTriggerItem()
constructor setting trigger item and corresponding prescale
Definition: CTPTriggerItem.cxx:11