ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
TrigConf::TriggerItemNode Class Reference

#include <TriggerItemNode.h>

Collaboration diagram for TrigConf::TriggerItemNode:

Public Types

enum  NodeType {
  OBJ, NOT, AND, OR,
  UNDEF
}
 
typedef std::pair< L1DataDef::TriggerType, unsigned int > InternalType_t
 

Public Member Functions

 TriggerItemNode (NodeType)
 
virtual ~TriggerItemNode ()
 
bool isThreshold () const
 
bool isInternalTrigger () const
 
void addChild (TriggerItemNode *node)
 
const std::vector< TriggerItemNode * > & children () const
 
void setThresholdName (const std::string &thrname)
 
void setPosition (int pos)
 
void setMultiplicity (int mult)
 
void setTriggerThreshold (TriggerThreshold *thr)
 
void setInternalTrigger (L1DataDef::TriggerType x, unsigned int thresholdNumber)
 
void setInternalTrigger (const std::string &name)
 
NodeType type () const
 
const std::string & thresholdName () const
 
int position () const
 
int multiplicity () const
 
const TriggerThresholdtriggerThreshold () const
 
L1DataDef::TriggerType internalTriggerType () const
 
unsigned int internalTriggerNumber () const
 
void getAllFinalNodes (std::vector< const TriggerItemNode * > &) const
 
void getAllThresholds (std::vector< const TriggerThreshold * > &) const
 
void getAllBunchGroups (std::vector< bool > &) const
 
void getBunchGroupsMask (uint16_t &bgmask) const
 
void getAllBunchGroups (std::vector< unsigned int > &) const
 
void getAllRandomTriggers (std::vector< unsigned int > &) const
 
void getAllPrescaledClockTriggers (std::vector< unsigned int > &) const
 
void print (const std::string &indent="", unsigned int detail=1) const
 
void writeXML (std::ostream &xmlfile, int indentLevel=0, int indentWidth=2, bool omitDelimiter=false) const
 
void buildLogic (std::vector< std::string > &conditionList, std::string &logic) const
 
virtual std::string __str__ () const
 

Static Public Member Functions

static NodeType typeFromString (const std::string &)
 
static NodeType typeFromChar (const char &c)
 
static std::string typeAsString (NodeType)
 

Private Member Functions

std::ostream & indent (std::ostream &o, int lvl, int size) const
 

Private Attributes

NodeType m_NodeType
 
std::vector< TriggerItemNode * > m_Children
 
std::string m_ThresholdName
 
int m_Position
 
int m_Multiplicity
 
TriggerThresholdm_Threshold
 
InternalType_t m_InternalTrigger
 

Detailed Description

Definition at line 22 of file TriggerItemNode.h.

Member Typedef Documentation

◆ InternalType_t

Definition at line 32 of file TriggerItemNode.h.

Member Enumeration Documentation

◆ NodeType

Enumerator
OBJ 
NOT 
AND 
OR 
UNDEF 

Definition at line 24 of file TriggerItemNode.h.

24 {OBJ, NOT, AND, OR, UNDEF};

Constructor & Destructor Documentation

◆ TriggerItemNode()

TrigConf::TriggerItemNode::TriggerItemNode ( NodeType  type)

Definition at line 22 of file TriggerItemNode.cxx.

22  :
23  m_NodeType(type),
24  m_ThresholdName(""),
25  m_Position(0),
26  m_Multiplicity(0),
27  m_Threshold(0),
29 {}

◆ ~TriggerItemNode()

TrigConf::TriggerItemNode::~TriggerItemNode ( )
virtual

Definition at line 32 of file TriggerItemNode.cxx.

32  {
34  delete node;
35 }

Member Function Documentation

◆ __str__()

string TriggerItemNode::__str__ ( ) const
virtual

Definition at line 336 of file TriggerItemNode.cxx.

336  {
337  stringstream s;
338  s << *this;
339  return s.str();
340 }

◆ addChild()

void TrigConf::TriggerItemNode::addChild ( TriggerItemNode node)

Definition at line 114 of file TriggerItemNode.cxx.

114  {
115  if(type() == OBJ)
116  throw std::runtime_error("TriggerItemNode::addChild: trying to add child to leaf node");
117  m_Children.push_back(node);
118 }

◆ buildLogic()

void TrigConf::TriggerItemNode::buildLogic ( std::vector< std::string > &  conditionList,
std::string &  logic 
) const

Definition at line 237 of file TriggerItemNode.cxx.

238  {
239 
240  if (m_NodeType == OBJ) {
241  std::string condition("");
242  if (m_Threshold) {
243  if( m_Threshold->type() != L1DataDef::rndmType() &&
244  m_Threshold->type() != L1DataDef::pclkType() &&
245  m_Threshold->type() != L1DataDef::bgrpType()) {
246  std::string name = m_Threshold->name();
248  condition += '0' + m_Multiplicity;
249  condition += "," + name;
250  condition += "," + m_Threshold->name();
251  } else {
253  }
254  } else {
256  }
257  uint32_t pos = conditionList.size()+1;
258  if(pos>9) logic += '0'+pos/10;
259  logic += '0'+pos%10;
260  conditionList.push_back(condition);
261  } else if (m_NodeType == AND || m_NodeType == OR) {
262  logic += "(";
263  bool first = true;
264  for(TriggerItemNode *node : children()) {
265  if(!first) { logic += (m_NodeType==AND?"&":"|"); } else { first=false; }
266  node->buildLogic(conditionList, logic);
267  }
268  logic += ")";
269  } else if (m_NodeType == NOT) {
270  logic += "!";
271  children()[0]->buildLogic(conditionList, logic);
272  }
273 
274 }

◆ children()

const std::vector<TriggerItemNode*>& TrigConf::TriggerItemNode::children ( ) const
inline

Definition at line 39 of file TriggerItemNode.h.

39 { return m_Children; }

◆ getAllBunchGroups() [1/2]

void TrigConf::TriggerItemNode::getAllBunchGroups ( std::vector< bool > &  vec) const

Definition at line 144 of file TriggerItemNode.cxx.

144  {
145  unsigned int max_bgrp = L1DataDef::typeConfig(L1DataDef::BGRP).max;
146  if(vec.size() < max_bgrp) vec.resize( max_bgrp );
147  if(type() == OBJ) {
149  vec[m_InternalTrigger.second] = true;
150  } else {
152  node->getAllBunchGroups(vec);
153  }
154 }

◆ getAllBunchGroups() [2/2]

void TrigConf::TriggerItemNode::getAllBunchGroups ( std::vector< unsigned int > &  vec) const

Definition at line 171 of file TriggerItemNode.cxx.

171  {
172  if(type() == OBJ) {
174  vec.push_back(m_InternalTrigger.second);
175  } else {
177  node->getAllBunchGroups(vec);
178  }
179 }

◆ getAllFinalNodes()

void TrigConf::TriggerItemNode::getAllFinalNodes ( std::vector< const TriggerItemNode * > &  vec) const

Definition at line 121 of file TriggerItemNode.cxx.

121  {
122  if(type() == OBJ) {
123  vec.push_back(this);
124  } else {
126  node->getAllFinalNodes(vec);
127  }
128 }

◆ getAllPrescaledClockTriggers()

void TrigConf::TriggerItemNode::getAllPrescaledClockTriggers ( std::vector< unsigned int > &  vec) const

Definition at line 193 of file TriggerItemNode.cxx.

193  {
194  if(type() == OBJ) {
196  vec.push_back(m_InternalTrigger.second);
197  } else {
199  node->getAllPrescaledClockTriggers(vec);
200  }
201  return;
202 }

◆ getAllRandomTriggers()

void TrigConf::TriggerItemNode::getAllRandomTriggers ( std::vector< unsigned int > &  vec) const

Definition at line 182 of file TriggerItemNode.cxx.

182  {
183  if(type() == OBJ) {
185  vec.push_back(m_InternalTrigger.second);
186  } else {
188  node->getAllRandomTriggers(vec);
189  }
190 }

◆ getAllThresholds()

void TrigConf::TriggerItemNode::getAllThresholds ( std::vector< const TriggerThreshold * > &  vec) const

Definition at line 131 of file TriggerItemNode.cxx.

131  {
132  if(type() == OBJ) {
133  if(!isInternalTrigger()) {
134  if(m_Threshold) vec.push_back(m_Threshold);
135  }
136  } else {
138  node->getAllThresholds(vec);
139  }
140 }

◆ getBunchGroupsMask()

void TrigConf::TriggerItemNode::getBunchGroupsMask ( uint16_t &  bgmask) const

Definition at line 158 of file TriggerItemNode.cxx.

158  {
159  if(type() == OBJ) {
161  uint16_t mask(0x1);
162  bgmask |= (mask << m_InternalTrigger.second);
163  }
164  } else {
166  node->getBunchGroupsMask(bgmask);
167  }
168 }

◆ indent()

std::ostream & TrigConf::TriggerItemNode::indent ( std::ostream &  o,
int  lvl,
int  size 
) const
private

Definition at line 303 of file TriggerItemNode.cxx.

303  {
304  if(lvl*size==0) return o;
305  o << std::setw(lvl*size) << " ";
306  return o;
307 }

◆ internalTriggerNumber()

unsigned int TrigConf::TriggerItemNode::internalTriggerNumber ( ) const
inline

Definition at line 56 of file TriggerItemNode.h.

56 { return m_InternalTrigger.second; }

◆ internalTriggerType()

L1DataDef::TriggerType TrigConf::TriggerItemNode::internalTriggerType ( ) const
inline

Definition at line 55 of file TriggerItemNode.h.

55 { return m_InternalTrigger.first; }

◆ isInternalTrigger()

bool TrigConf::TriggerItemNode::isInternalTrigger ( ) const

Definition at line 69 of file TriggerItemNode.cxx.

69  {
70  return m_InternalTrigger.first != L1DataDef::UNDEF;
71 }

◆ isThreshold()

bool TrigConf::TriggerItemNode::isThreshold ( ) const

Definition at line 64 of file TriggerItemNode.cxx.

64  {
65  return m_InternalTrigger.first == L1DataDef::UNDEF;
66 }

◆ multiplicity()

int TrigConf::TriggerItemNode::multiplicity ( ) const
inline

Definition at line 53 of file TriggerItemNode.h.

53 { return m_Multiplicity; }

◆ position()

int TrigConf::TriggerItemNode::position ( ) const
inline

Definition at line 52 of file TriggerItemNode.h.

52 { return m_Position; }

◆ print()

void TrigConf::TriggerItemNode::print ( const std::string &  indent = "",
unsigned int  detail = 1 
) const

Definition at line 278 of file TriggerItemNode.cxx.

278  {
279  cout << indent << "TriggerItemNode: " << endl;
280  cout << indent << " type : " << (type()==OBJ?"OBJ":(type()==AND?"AND":(type()==OR?"OR":"NOT"))) << endl;
281  cout << indent << " position : " << m_Position << endl;
282 
283  if (m_NodeType == OBJ) {
284  cout << indent << " multiplicity: " << m_Multiplicity << endl;
285  if (m_Threshold) {
286  cout << indent << " threshold : " << m_Threshold->name() << endl;
288  } else if(isInternalTrigger()) {
289  cout << indent << " InternalTrigger: "
290  << thresholdName() << endl;
291  } else {
292  cout << indent << thresholdName() << endl;
293  }
294  }
295  else {
296  for(TriggerItemNode * node : m_Children) {
297  cout << indent << " subnode : " << endl;
298  node->print(indent + indent);
299  }
300  }
301 }

◆ setInternalTrigger() [1/2]

void TrigConf::TriggerItemNode::setInternalTrigger ( const std::string &  name)

Definition at line 96 of file TriggerItemNode.cxx.

96  {
97 
98  string::size_type pos = name.find_first_of("0123456789");
99 
101 
102  if( ! L1DataDef::typeConfig(tt).internal ) {
103  cerr << "TriggerItemNode::setInternalTrigger: type " << name << " is not an internal trigger" << endl;
104  throw runtime_error("TriggerItemNode::setInternalTrigger: type is not an internal trigger");
105  }
106  m_InternalTrigger.first = tt;
107  m_InternalTrigger.second = boost::lexical_cast<unsigned int,string>(name.substr(pos));
109  m_Threshold = 0;
110 }

◆ setInternalTrigger() [2/2]

void TrigConf::TriggerItemNode::setInternalTrigger ( L1DataDef::TriggerType  x,
unsigned int  thresholdNumber 
)

Definition at line 87 of file TriggerItemNode.cxx.

88  {
89  m_InternalTrigger.first = x;
90  m_InternalTrigger.second = thresholdNumber;
91  m_ThresholdName = L1DataDef::typeConfig(x).name + boost::lexical_cast<string,unsigned int>(thresholdNumber);
92  m_Threshold = 0;
93 }

◆ setMultiplicity()

void TrigConf::TriggerItemNode::setMultiplicity ( int  mult)
inline

Definition at line 44 of file TriggerItemNode.h.

44 { m_Multiplicity = mult; }

◆ setPosition()

void TrigConf::TriggerItemNode::setPosition ( int  pos)
inline

Definition at line 43 of file TriggerItemNode.h.

43 { m_Position = pos; }

◆ setThresholdName()

void TrigConf::TriggerItemNode::setThresholdName ( const std::string &  thrname)
inline

Definition at line 42 of file TriggerItemNode.h.

42 { m_ThresholdName = thrname; }

◆ setTriggerThreshold()

void TrigConf::TriggerItemNode::setTriggerThreshold ( TriggerThreshold thr)

Definition at line 74 of file TriggerItemNode.cxx.

74  {
75  if(thr->isInternal()) {
76  // from the database internal triggers are also loaded as TriggerThresholds
77  setInternalTrigger(thr->name());
78  } else {
80  m_InternalTrigger.second = 0;
81  }
82  m_Threshold = thr;
83  m_ThresholdName = thr->name();
84 }

◆ thresholdName()

const std::string& TrigConf::TriggerItemNode::thresholdName ( ) const
inline

Definition at line 51 of file TriggerItemNode.h.

51 { return m_ThresholdName; }

◆ triggerThreshold()

const TriggerThreshold* TrigConf::TriggerItemNode::triggerThreshold ( ) const
inline

Definition at line 54 of file TriggerItemNode.h.

54 { return m_Threshold; }

◆ type()

NodeType TrigConf::TriggerItemNode::type ( ) const
inline

Definition at line 50 of file TriggerItemNode.h.

50 { return m_NodeType; };

◆ typeAsString()

std::string TrigConf::TriggerItemNode::typeAsString ( NodeType  type)
static

Definition at line 57 of file TriggerItemNode.cxx.

57  {
58  static const std::string typelabel[] = {"OBJ", "NOT", "AND", "OR", "UNDEF"};
59  return typelabel[type];
60 }

◆ typeFromChar()

TriggerItemNode::NodeType TriggerItemNode::typeFromChar ( const char &  c)
static

Definition at line 49 of file TriggerItemNode.cxx.

49  {
50  if(c=='&') return TriggerItemNode::AND;
51  if(c=='|') return TriggerItemNode::OR;
52  if(c=='!') return TriggerItemNode::NOT;
54 }

◆ typeFromString()

TrigConf::TriggerItemNode::NodeType TrigConf::TriggerItemNode::typeFromString ( const std::string &  type)
static

Definition at line 38 of file TriggerItemNode.cxx.

38  {
39  if(type=="AND") return TriggerItemNode::AND;
40  if(type=="OR") return TriggerItemNode::OR;
41  if(type=="NOT") return TriggerItemNode::NOT;
42  if(type=="OBJ") return TriggerItemNode::OBJ;
43  if(type=="TriggerCondition") return TriggerItemNode::OBJ;
44  if(type=="InternalTrigger") return TriggerItemNode::OBJ;
46 }

◆ writeXML()

void TrigConf::TriggerItemNode::writeXML ( std::ostream &  xmlfile,
int  indentLevel = 0,
int  indentWidth = 2,
bool  omitDelimiter = false 
) const

Definition at line 205 of file TriggerItemNode.cxx.

205  {
206  if (m_NodeType == OBJ) {
207 
208  if(isInternalTrigger()) {
209  indent(xmlfile, indentLevel, indentWidth)
210  << "<InternalTrigger name=\"" << m_ThresholdName << "\"/>" << endl;
211  } else {
212  indent(xmlfile, indentLevel, indentWidth)
213  << "<TriggerCondition multi=\"" << m_Multiplicity
214  << "\" name=\"" << m_ThresholdName << "_x" << m_Multiplicity
215  << "\" triggerthreshold=\"" << m_ThresholdName << "\"/>" << endl;
216  }
217 
218  } else if (m_NodeType == AND || m_NodeType == OR) {
219 
220  std::string logic = (m_NodeType==AND?"AND":"OR");
221  indent(xmlfile, indentLevel, indentWidth) << "<" << logic << ">" << endl;
222  for(TriggerItemNode *node : children())
223  node->writeXML(xmlfile, indentLevel+1, indentWidth);
224  indent(xmlfile, indentLevel, indentWidth) << "</"<<logic<<">" << endl;
225 
226  } else if (m_NodeType == NOT) {
227 
228  indent(xmlfile, indentLevel, indentWidth) << "<NOT>" << endl;
229  children()[0]->writeXML(xmlfile, indentLevel+1, indentWidth);
230  indent(xmlfile, indentLevel, indentWidth) << "</NOT>" << endl;
231 
232  }
233 }

Member Data Documentation

◆ m_Children

std::vector<TriggerItemNode*> TrigConf::TriggerItemNode::m_Children
private

Definition at line 78 of file TriggerItemNode.h.

◆ m_InternalTrigger

InternalType_t TrigConf::TriggerItemNode::m_InternalTrigger
private

Definition at line 87 of file TriggerItemNode.h.

◆ m_Multiplicity

int TrigConf::TriggerItemNode::m_Multiplicity
private

Definition at line 83 of file TriggerItemNode.h.

◆ m_NodeType

NodeType TrigConf::TriggerItemNode::m_NodeType
private

Definition at line 75 of file TriggerItemNode.h.

◆ m_Position

int TrigConf::TriggerItemNode::m_Position
private

Definition at line 82 of file TriggerItemNode.h.

◆ m_Threshold

TriggerThreshold* TrigConf::TriggerItemNode::m_Threshold
private

Definition at line 84 of file TriggerItemNode.h.

◆ m_ThresholdName

std::string TrigConf::TriggerItemNode::m_ThresholdName
private

Definition at line 81 of file TriggerItemNode.h.


The documentation for this class was generated from the following files:
TrigConf::TriggerItemNode::setInternalTrigger
void setInternalTrigger(L1DataDef::TriggerType x, unsigned int thresholdNumber)
Definition: TriggerItemNode.cxx:87
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
TrigConf::TriggerItemNode::m_ThresholdName
std::string m_ThresholdName
Definition: TriggerItemNode.h:81
TrigConf::L1DataDef::typeConfig
static TriggerTypeConfig & typeConfig(TriggerType tt)
Definition: L1DataDef.cxx:145
TrigConf::TriggerItemNode::m_Position
int m_Position
Definition: TriggerItemNode.h:82
TrigConf::TriggerItemNode::InternalType_t
std::pair< L1DataDef::TriggerType, unsigned int > InternalType_t
Definition: TriggerItemNode.h:32
TrigConf::TrigConfData::name
const std::string & name() const
Definition: TrigConfData.h:22
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
TrigConf::TriggerItemNode::indent
std::ostream & indent(std::ostream &o, int lvl, int size) const
Definition: TriggerItemNode.cxx:303
TrigConf::L1DataDef::PCLK
@ PCLK
Definition: L1DataDef.h:38
TrigConf::TriggerItemNode::OBJ
@ OBJ
Definition: TriggerItemNode.h:24
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
TrigConf::TriggerThreshold::isInternal
bool isInternal() const
Definition: TriggerThreshold.cxx:77
TrigConf::TriggerItemNode::type
NodeType type() const
Definition: TriggerItemNode.h:50
TrigConf::TriggerThreshold::print
virtual void print(const std::string &indent="", unsigned int detail=1) const override
Definition: TriggerThreshold.cxx:169
detail
Definition: extract_histogram_tag.cxx:14
LArG4GenerateShowerLib.condition
condition
Definition: LArG4GenerateShowerLib.py:19
TrigConf::TriggerItemNode::OR
@ OR
Definition: TriggerItemNode.h:24
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
TrigConf::TriggerItemNode
Definition: TriggerItemNode.h:22
TrigConf::L1DataDef::TriggerTypeConfig::name
std::string name
Definition: L1DataDef.h:46
x
#define x
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
TrigConf::L1DataDef::stringAsType
static TriggerType stringAsType(const std::string &type)
Definition: L1DataDef.h:62
TrigConf::TriggerThreshold::type
const std::string & type() const
Definition: TriggerThreshold.h:31
TrigConf::L1DataDef::RNDM
@ RNDM
Definition: L1DataDef.h:38
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
TrigConf::TriggerItemNode::m_Multiplicity
int m_Multiplicity
Definition: TriggerItemNode.h:83
TrigConf::TriggerItemNode::isInternalTrigger
bool isInternalTrigger() const
Definition: TriggerItemNode.cxx:69
TrigConf::TriggerItemNode::m_NodeType
NodeType m_NodeType
Definition: TriggerItemNode.h:75
TrigConf::TriggerItemNode::children
const std::vector< TriggerItemNode * > & children() const
Definition: TriggerItemNode.h:39
TrigConf::TriggerItemNode::UNDEF
@ UNDEF
Definition: TriggerItemNode.h:24
TrigConf::TriggerItemNode::AND
@ AND
Definition: TriggerItemNode.h:24
PyPoolBrowser.node
node
Definition: PyPoolBrowser.py:131
TrigConf::name
Definition: HLTChainList.h:35
TrigConf::TriggerItemNode::m_Children
std::vector< TriggerItemNode * > m_Children
Definition: TriggerItemNode.h:78
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
ActsTrk::to_string
std::string to_string(const DetectorType &type)
Definition: GeometryDefs.h:34
TrigConf::L1DataDef::UNDEF
@ UNDEF
Definition: L1DataDef.h:39
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
TrigConf::TriggerItemNode::m_InternalTrigger
InternalType_t m_InternalTrigger
Definition: TriggerItemNode.h:87
TrigConf::TriggerItemNode::m_Threshold
TriggerThreshold * m_Threshold
Definition: TriggerItemNode.h:84
TrigConf::L1DataDef::TriggerTypeConfig::max
unsigned int max
Definition: L1DataDef.h:47
TrigConf::L1DataDef::TriggerType
TriggerType
Definition: L1DataDef.h:30
TrigConf::TriggerItemNode::internalTriggerType
L1DataDef::TriggerType internalTriggerType() const
Definition: TriggerItemNode.h:55
DeMoScan.first
bool first
Definition: DeMoScan.py:536
TrigConf::TriggerItemNode::thresholdName
const std::string & thresholdName() const
Definition: TriggerItemNode.h:51
TileDCSDataPlotter.tt
tt
Definition: TileDCSDataPlotter.py:874
python.compressB64.c
def c
Definition: compressB64.py:93
node
Definition: memory_hooks-stdcmalloc.h:74
TrigConf::TriggerItemNode::NOT
@ NOT
Definition: TriggerItemNode.h:24
TrigConf::L1DataDef::BGRP
@ BGRP
Definition: L1DataDef.h:38