ATLAS Offline Software
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 
13 using namespace std;
14 
16 
17 TrigConf::HLTSequenceList::HLTSequenceList( vector<HLTSequence*>& sequenceList ) {
18  copy( sequenceList.begin(), sequenceList.end(), std::inserter(*this, begin()));
19 }
20 
22  clear();
23 }
24 
26  for(HLTSequence* seq : *this) delete seq;
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 
39 bool TrigConf::HLTSequenceList::hasTE(const std::string& name) {
40  return getSequence(name)!=0;
41 }
42 
43 
46  const index<seq_hash_id>::type& byid = get<seq_hash_id>();
47  index<seq_hash_id>::type::const_iterator seq = byid.find(id);
48  if(seq == byid.end()) return 0;
49  return *seq;
50 }
51 
53 TrigConf::HLTSequenceList::getSequence(const std::string& name) const {
54  const index<seq_name_hash>::type& byname = get<seq_name_hash>();
55  index<seq_name_hash>::type::const_iterator seq = byname.find(name);
56  if(seq == byname.end()) return 0;
57  return *seq;
58 }
59 
60 
61 bool
62 TrigConf::HLTSequenceList::getLabel(unsigned int id, std::string & label) {
63  const index<seq_hash_id>::type& byid = get<seq_hash_id>();
64  index<seq_hash_id>::type::const_iterator seq = byid.find(id);
65  if(seq != byid.end()) {
66  label = (*seq)->name();
67  return true;
68  } else {
69  label = "";
70  return false;
71  }
72 }
73 
74 
75 bool
76 TrigConf::HLTSequenceList::getHashIdFromLabel(const char * label, unsigned int & id) {
77  const index<seq_name_hash>::type& byname = get<seq_name_hash>();
78  index<seq_name_hash>::type::const_iterator seq = byname.find(label);
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 
111 void
112 TrigConf::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 
124 std::ostream &
125 TrigConf::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 
test_athena_ntuple_filter.seq
seq
filter configuration ## -> we use the special sequence 'AthMasterSeq' which is run before any other a...
Definition: test_athena_ntuple_filter.py:18
TrigConf::HLTSequenceList::addHLTSequence
void addHLTSequence(HLTSequence *sequence)
adds an HLTSequence to the menu
Definition: HLTSequenceList.cxx:30
TrigConf::HLTSequenceList::hasTE
bool hasTE(const std::string &name)
Definition: HLTSequenceList.cxx:39
checkxAOD.ds
ds
Definition: Tools/PyUtils/bin/checkxAOD.py:257
TrigConf::operator<<
std::ostream & operator<<(std::ostream &os, const TrigConf::IsolationLegacy &iso)
Definition: L1ThresholdBase.cxx:339
TrigConf::TrigConfData::name
const std::string & name() const
Definition: TrigConfData.h:22
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
TrigConf::HLTSequenceList::getSequence
HLTSequence * getSequence(unsigned int id) const
counts the number of sequences in the menu
Definition: HLTSequenceList.cxx:45
TrigConf::DiffStruct
Definition: DiffStruct.h:14
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
TrigConf::HLTSequenceList::getHashIdFromLabel
bool getHashIdFromLabel(const char *label, unsigned int &hashId)
find ID from name in the map m_IdToLabel
Definition: HLTSequenceList.cxx:76
detail
Definition: extract_histogram_tag.cxx:14
DiffStruct.h
TrigConf::HLTSequenceList::print
void print(const std::string &indent="", unsigned int detail=1) const
print the sequence list
Definition: HLTSequenceList.cxx:112
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
geometry_dat_to_json.indent
indent
Definition: geometry_dat_to_json.py:18
TrigConf::HLTSequenceList::clear
void clear()
Definition: HLTSequenceList.cxx:25
TrigConf::HLTSequenceList::~HLTSequenceList
~HLTSequenceList()
destructor
Definition: HLTSequenceList.cxx:21
TrigConf::name
Definition: HLTChainList.h:35
TrigConf::HLTSequenceList::HLTSequenceList
HLTSequenceList()
default constructor
Definition: HLTSequenceList.cxx:15
TrigConf::HLTSequenceList::getLabel
bool getLabel(unsigned int hashId, std::string &label)
find name from ID in the map m_IdToLabel
Definition: HLTSequenceList.cxx:62
HLTTriggerElement.h
HLTSequence.h
VKalVrtAthena::varHolder_detail::clear
void clear(T &var)
Definition: NtupleVars.h:48
HLTSequenceList.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TrigConf::HLTSequenceList::compareTo
DiffStruct * compareTo(const HLTSequenceList *o) const
Definition: HLTSequenceList.cxx:89
calibdata.copy
bool copy
Definition: calibdata.py:27
TrigConf::HLTSequence
HLT sequence configuration information.
Definition: HLTSequence.h:28
TrigConf::HLTSequenceList
list of HLT sequences
Definition: HLTSequenceList.h:40