00001 #ifndef TRIGNAVSTRUCTURE_ComboIterator_H 00002 #define TRIGNAVSTRUCTURE_ComboIterator_H 00003 00004 #include <vector> 00005 #include <set> 00006 #include "TrigNavStructure/Types.h" 00007 00008 namespace HLT { 00009 class TriggerElement; 00010 typedef std::vector<HLT::TriggerElement*> TEVec; 00011 00012 class TrigNavStructure; 00013 00014 00024 class ComboIteratorBase { 00025 00026 public: 00027 00029 ComboIteratorBase() {} 00030 00032 virtual ~ComboIteratorBase() {} 00033 00035 virtual bool rewind() = 0; 00036 00038 virtual TEVec& operator*() = 0; 00039 00043 virtual bool isValid() const = 0; 00044 00046 virtual TEVec& combination() = 0; 00047 00049 virtual ComboIteratorBase& operator++(int) = 0; 00050 00052 virtual ComboIteratorBase& operator++() = 0; 00053 00054 }; 00055 00056 00070 class ComboIterator : public ComboIteratorBase { 00071 00072 public: 00080 ComboIterator(const std::vector<TEVec>& tes, const TrigNavStructure* nav); 00081 00083 bool rewind(); 00084 00086 TEVec& operator*() { return combination(); } 00087 00091 bool isValid() const { return m_valid; } 00092 00094 TEVec& combination() { return m_comb; } 00095 00097 ComboIterator& operator++(int) { return operator++(); } 00098 00100 ComboIterator& operator++(); 00101 00102 protected: 00103 00109 virtual bool overlaps(const TriggerElement* t1, const TriggerElement* t2) const; 00110 00117 bool overlaps(const TriggerElement* t1, 00118 const TEVec& teVec, int idx = -1) const; 00119 00121 bool incrementByOne(int pos, bool& ok); 00122 00124 bool increment (int pos); 00125 00127 bool reset (int pos); 00128 00130 void invalidate(); 00131 00133 void print() const; 00134 00136 TEVec m_comb; 00137 00139 std::vector<int> m_idx; 00140 00142 std::vector<TEVec> m_tes; 00143 00145 bool m_valid; 00146 00148 const TrigNavStructure* m_nav; 00149 }; 00150 00151 00152 00153 00169 class ComboIteratorTopo : public ComboIterator { 00170 public: 00171 ComboIteratorTopo(const std::vector<TEVec>& tes, const TrigNavStructure* nav, HLT::te_id_type topoSpan); 00172 00173 protected: 00174 // on top of same RoI adds check if TEs are span by the topological TE of give id 00175 // think ... is not combination which was ever (sucesfullly) considered by topo algorithm 00176 virtual bool overlaps(const TriggerElement* t1, const TriggerElement* t2) const; 00177 private: 00178 void traverseUntilSeedsTopo(const TriggerElement* start, std::set<const TriggerElement*>& topos) const; 00179 HLT::te_id_type m_spanId; 00180 00181 }; 00182 00183 } // eof namespace 00184 00185 #endif //#ifndef 00186 00187