ATLAS Offline Software
Loading...
Searching...
No Matches
HLTSequenceList.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
9
10#include <iostream>
11#include <stdexcept>
12
13using namespace std;
14
16
17TrigConf::HLTSequenceList::HLTSequenceList( vector<HLTSequence*>& sequenceList ) {
18 copy( sequenceList.begin(), sequenceList.end(), std::inserter(*this, begin()));
19}
20
24
26 for(HLTSequence* seq : *this) delete seq;
27 HLTSequenceContainer::clear();
28}
29
31 if(sequence==0) return;
32 pair<iterator, bool> ins = insert(sequence);
33 if(!ins.second) {
34 throw runtime_error("Can't insert sequence '" + sequence->name() + "', because a uniqueness constraint is violated");
35 }
36}
37
38
39bool TrigConf::HLTSequenceList::hasTE(const std::string& name) {
40 return getSequence(name)!=0;
41}
42
43
48 if(seq == byid.end()) return 0;
49 return *seq;
50}
51
56 if(seq == byname.end()) return 0;
57 return *seq;
58}
59
60
61bool
62TrigConf::HLTSequenceList::getLabel(unsigned int id, std::string & label) {
65 if(seq != byid.end()) {
66 label = (*seq)->name();
67 return true;
68 } else {
69 label = "";
70 return false;
71 }
72}
73
74
75bool
76TrigConf::HLTSequenceList::getHashIdFromLabel(const char * label, unsigned int & id) {
79 if(seq != byname.end()) {
80 id = (*seq)->hashId();
81 return true;
82 } else {
83 id = 0;
84 return false;
85 }
86}
87
90 DiffStruct * ds = new DiffStruct("SEQUENCE_LIST");
91 for(HLTSequence* seq : *this) {
92 const HLTSequence *o_seq = o->getSequence(seq->name());
93 if(o_seq) {
94 ds->addSub( seq->compareTo(o_seq) );
95 } else {
96 ds->addLeftOnlySub( "SEQUENCE", seq->name() );
97 }
98 }
99 for(HLTSequence* o_seq : *o) {
100 const HLTSequence *seq = getSequence(o_seq->name());
101 if(!seq)
102 ds->addRightOnlySub( "SEQUENCE", o_seq->name() );
103 }
104 if(ds->empty()) {
105 delete ds; ds=0;
106 }
107 return ds;
108}
109
110
111void
112TrigConf::HLTSequenceList::print(const std::string& indent, unsigned int detail) const {
113 if(detail>=1) {
114 cout << indent << "HLTSequenceList has " << size() << " sequences" << endl;
115 if(detail>=4) {
116 cout << indent << "--------------------------------------------------------------------------------" << endl;
117 for(HLTSequence* seq : *this)
118 seq->print(indent + " ", detail);
119 cout << indent << "================================================================================" << endl;
120 }
121 }
122}
123
124std::ostream &
125TrigConf::operator<<(std::ostream & o, const TrigConf::HLTSequenceList & sl) {
126 o << "- -- HLTSequenceList printout ------------------------------ " << std::endl;
127 for(TrigConf::HLTSequence* seq : sl) o << *seq;
128 o << "- ---------------------------------------------------------- " << std::endl;
129 return o;
130}
131
list of HLT sequences
DiffStruct * compareTo(const HLTSequenceList *o) const
bool hasTE(const std::string &name)
HLTSequence * getSequence(unsigned int id) const
counts the number of sequences in the menu
HLTSequenceList()
default constructor
void addHLTSequence(HLTSequence *sequence)
adds an HLTSequence to the menu
void print(const std::string &indent="", unsigned int detail=1) const
print the sequence list
bool getLabel(unsigned int hashId, std::string &label)
find name from ID in the map m_IdToLabel
bool getHashIdFromLabel(const char *label, unsigned int &hashId)
find ID from name in the map m_IdToLabel
HLT sequence configuration information.
Definition HLTSequence.h:28
const std::string & name() const
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130
std::string label(const std::string &format, int i)
Definition label.h:19
std::ostream & operator<<(std::ostream &os, const TrigConf::IsolationLegacy &iso)
Definition index.py:1
STL namespace.