56 static const std::string typelabel[] = {
"OBJ",
"NOT",
"AND",
"OR",
"UNDEF"};
57 return typelabel[
type];
73 if(thr->isInternal()) {
86 unsigned int thresholdNumber) {
96 string::size_type pos =
name.find_first_of(
"0123456789");
101 cerr <<
"TriggerItemNode::setInternalTrigger: type " <<
name <<
" is not an internal trigger" << endl;
102 throw runtime_error(
"TriggerItemNode::setInternalTrigger: type is not an internal trigger");
114 throw std::runtime_error(
"TriggerItemNode::addChild: trying to add child to leaf node");
144 if(
vec.size() < max_bgrp)
vec.resize( max_bgrp );
164 node->getBunchGroupsMask(bgmask);
186 node->getAllRandomTriggers(
vec);
197 node->getAllPrescaledClockTriggers(
vec);
219 indent(
xmlfile, indentLevel, indentWidth) <<
"<" << logic <<
">" << endl;
221 node->writeXML(
xmlfile, indentLevel+1, indentWidth);
222 indent(
xmlfile, indentLevel, indentWidth) <<
"</"<<logic<<
">" << endl;
226 indent(
xmlfile, indentLevel, indentWidth) <<
"<NOT>" << endl;
228 indent(
xmlfile, indentLevel, indentWidth) <<
"</NOT>" << endl;
236 std::string & logic)
const {
239 std::string condition(
"");
247 condition +=
"," +
name;
255 uint32_t pos = conditionList.size()+1;
256 if(pos>9) logic +=
'0'+pos/10;
258 conditionList.push_back(std::move(condition));
263 if(!first) { logic += (
m_NodeType==
AND?
"&":
"|"); }
else { first=
false; }
264 node->buildLogic(conditionList, logic);
269 children()[0]->buildLogic(conditionList, logic);
277 cout <<
indent <<
"TriggerItemNode: " << endl;
287 cout <<
indent <<
" InternalTrigger: "
295 cout <<
indent <<
" subnode : " << endl;
302 if(lvl*size==0)
return o;
303 o << std::setw(lvl*size) <<
" ";
310 o <<
" TriggerItemNode: " << endl;
312 o <<
" position : " <<
node.position() << endl;
315 o <<
" multiplicity: " <<
node.multiplicity() << endl;
316 if (
node.triggerThreshold() ) {
317 o <<
" threshold : " <<
node.thresholdName() << endl
318 <<
node.triggerThreshold();
319 }
else if(
node.isInternalTrigger() ) {
320 o <<
" InternalTrigger: " <<
node.thresholdName() << endl;
322 o <<
node.thresholdName() << endl;
327 o <<
" subnodes : " << *
subnode << endl;
std::vector< size_t > vec
node * subnode(node *np, const std::string &name)
check whether a subnode with this name already exists
static TriggerType stringAsType(const std::string &type)
static TriggerTypeConfig & typeConfig(TriggerType tt)
static NodeType typeFromChar(const char &c)
std::ostream & indent(std::ostream &o, int lvl, int size) const
const std::vector< TriggerItemNode * > & children() const
TriggerItemNode(NodeType)
std::pair< L1DataDef::TriggerType, unsigned int > InternalType_t
static NodeType typeFromString(const std::string &)
std::vector< TriggerItemNode * > m_Children
L1DataDef::TriggerType internalTriggerType() const
void getAllPrescaledClockTriggers(std::vector< unsigned int > &) const
const std::string & thresholdName() const
void getAllBunchGroups(std::vector< bool > &) const
static std::string typeAsString(NodeType)
void setInternalTrigger(L1DataDef::TriggerType x, unsigned int thresholdNumber)
void getAllRandomTriggers(std::vector< unsigned int > &) const
virtual std::string __str__() const
void getAllFinalNodes(std::vector< const TriggerItemNode * > &) const
InternalType_t m_InternalTrigger
void getBunchGroupsMask(uint16_t &bgmask) const
void addChild(TriggerItemNode *node)
TriggerThreshold * m_Threshold
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 ~TriggerItemNode()
std::string m_ThresholdName
void getAllThresholds(std::vector< const TriggerThreshold * > &) const
void setTriggerThreshold(TriggerThreshold *thr)
void print(const std::string &indent="", unsigned int detail=1) const
bool isInternalTrigger() const
static std::vector< std::string > xmlfile
Forward iterator to traverse the main components of the trigger configuration.
std::ostream & operator<<(std::ostream &os, const TrigConf::IsolationLegacy &iso)