00001
00002 #ifndef TRIGNAVSTRUCTURE_TRIGGERELEMENTFACTORY_H
00003 #define TRIGNAVSTRUCTURE_TRIGGERELEMENTFACTORY_H
00004
00005 #include <vector>
00006 #include "TrigNavStructure/Types.h"
00007 #include "TrigNavStructure/TriggerElement.h"
00008
00009 namespace HLT {
00023 class TriggerElementFactory {
00024 public:
00025 TriggerElementFactory();
00026 ~TriggerElementFactory();
00027 TriggerElement* produce(unsigned int id, bool ghost=false, bool nofwd=false);
00028 void reset();
00029 bool empty() const;
00030
00031 const std::vector< TriggerElement* >& listOfProduced() const { return m_list; }
00032 std::vector< TriggerElement* >& listOfProduced() { return m_list; }
00033 const std::vector< TriggerElement* >& listOfProduced(unsigned int id) const {
00034 auto found = m_groupedById.find(id);
00035 return (found!=m_groupedById.end()) ? found->second : m_notfound;
00036 }
00037 std::vector< TriggerElement* >& listOfProduced(unsigned int id) {
00038 auto found = m_groupedById.find(id);
00039 return (found!=m_groupedById.end()) ? found->second : m_notfound;
00040 }
00041
00042 private:
00043 std::vector< TriggerElement* > m_list;
00044 std::map<te_id_type, std::vector<TriggerElement*> > m_groupedById;
00045 std::vector< TriggerElement* > m_notfound;
00046 };
00047 }
00048 #endif //