00001 #ifndef TrigConf_Menu
00002 #define TrigConf_Menu
00003
00004 #include "TrigConfL1Data/L1DataBaseclass.h"
00005 #include "TrigConfL1Data/TriggerItem.h"
00006 #include "TrigConfL1Data/ThresholdConfig.h"
00007 #include "TrigConfL1Data/ThresholdMonitor.h"
00008 #include "TrigConfL1Data/PIT.h"
00009 #include "TrigConfL1Data/TIP.h"
00010
00011 #include <boost/multi_index_container.hpp>
00012 #include <boost/multi_index/mem_fun.hpp>
00013 #include <boost/multi_index/hashed_index.hpp>
00014 #include <boost/multi_index/ordered_index.hpp>
00015 #include <boost/multi_index/sequenced_index.hpp>
00016 #include <boost/multi_index/random_access_index.hpp>
00017
00018 #include <iosfwd>
00019 #include <vector>
00020 #include <string>
00021
00022
00023 namespace TrigConf {
00024
00025
00026 struct tag_ctpid{};
00027 struct tag_name_hash{};
00028
00029 typedef boost::multi_index::multi_index_container<TriggerItem*, boost::multi_index::indexed_by<
00030 boost::multi_index::random_access<>,
00031 boost::multi_index::ordered_unique< boost::multi_index::identity<TriggerItem> >,
00032 boost::multi_index::ordered_unique< boost::multi_index::tag<tag_ctpid>, boost::multi_index::const_mem_fun<TriggerItem, int, &TriggerItem::ctpId> >,
00033 boost::multi_index::hashed_unique < boost::multi_index::tag<tag_name_hash>, boost::multi_index::const_mem_fun<TrigConfData, const std::string&, &TrigConfData::name> >
00034 >
00035 > ItemContainer;
00036
00037 typedef ItemContainer::index<tag_ctpid>::type item_by_ctpid_t;
00038 typedef item_by_ctpid_t::iterator item_by_ctpid_iterator;
00039
00040 typedef ItemContainer::index<tag_name_hash>::type item_by_name_t;
00041 typedef ItemContainer::index<tag_name_hash>::type::iterator item_by_name_iterator;
00042
00043 class DiffStruct;
00044
00045 class Menu : public L1DataBaseclass {
00046 public:
00047 Menu();
00048 ~Menu();
00049
00050 item_by_ctpid_t& item_by_ctpid();
00051 const item_by_ctpid_t& item_by_ctpid() const;
00052
00053 item_by_name_t& item_by_name();
00054 const item_by_name_t& item_by_name() const;
00055
00056
00057 void addTriggerItem(TriggerItem* ti);
00058 const ItemContainer& itemVector() const;
00059 const ItemContainer& items() const;
00060 TriggerItem* findTriggerItem(int ctpid) const { return item(ctpid); }
00061 TriggerItem* item(int ctpid) const;
00062 TriggerItem* item(const std::string& name) const;
00063
00064
00065 const std::vector<ThresholdMonitor*>& moncountVector() const { return m_ThresholdMonitorVector; }
00066 const std::vector<PIT*>& pitVector() const { return m_PITs; }
00067 const std::vector<TIP*>& tipVector() const { return m_TIPs; }
00068 const std::map<unsigned int, std::string>& lutOutputNames() const { return m_LUT; }
00069 const ThresholdConfig& thresholdConfig() const { return m_ThresholdConfig; }
00070 const CaloInfo& caloInfo() const { return m_ThresholdConfig.caloInfo(); }
00071
00072 ThresholdConfig& thresholdConfig() { return m_ThresholdConfig; }
00073
00074 std::vector<uint16_t> bunchgroupMask() const;
00075
00076
00077 void setThresholdConfig( const TrigConf::ThresholdConfig& tc ) { m_ThresholdConfig = tc; }
00078 void setCaloInfo( const CaloInfo& ci ) { m_ThresholdConfig.setCaloInfo(ci); }
00079
00080
00081 const std::vector<TriggerThreshold*>& thresholdVector() const;
00082 void addTriggerThreshold(TriggerThreshold* tt);
00083
00084 void addThresholdMonitor(ThresholdMonitor* thrm);
00085 ThresholdMonitor* findThresholdMonitor(unsigned int id);
00086
00087 void addLutOutputName(unsigned int, const std::string &);
00088 void setLutOutputNames(const std::map<unsigned int, std::string>& lut) { m_LUT = lut; }
00089
00090 void addPit(PIT* pit);
00091 PIT* findPIT(unsigned int id);
00092
00093 void addTip(TIP* tip);
00094 TIP* findTIP(unsigned int id);
00095
00096 int size() const;
00097
00098 virtual void print(const std::string& indent="", unsigned int detail=1) const;
00099
00100 void writeXMLItems(std::ostream & xmlfile, int indentLevel=0, int indentWidth=2) const;
00101 void writeXMLThresholds(std::ostream & xmlfile, int indentLevel=0, int indentWidth=2) const;
00102 void writeXMLMonCounters(std::ostream & xmlfile, int indentLevel=0, int indentWidth=2) const;
00103
00104 DiffStruct* compareTo(const Menu* o) const;
00105
00106 void clear();
00107
00108 std::vector<TrigConf::TriggerItem*> itemsV() const;
00109
00110 private:
00111 ThresholdConfig m_ThresholdConfig;
00112 #ifndef __COVERITY__
00113 ItemContainer m_TriggerItemVector;
00114 #endif
00115 std::vector<ThresholdMonitor*> m_ThresholdMonitorVector;
00116 std::vector<PIT*> m_PITs;
00117 std::vector<TIP*> m_TIPs;
00118 std::map<unsigned int, std::string> m_LUT;
00119
00120 };
00121
00122
00123 #ifndef __COVERITY__
00124 inline
00125 item_by_ctpid_t& Menu::item_by_ctpid() { return m_TriggerItemVector.get<tag_ctpid>(); }
00126 inline
00127 const item_by_ctpid_t& Menu::item_by_ctpid() const { return m_TriggerItemVector.get<tag_ctpid>(); }
00128
00129 inline
00130 item_by_name_t& Menu::item_by_name() { return m_TriggerItemVector.get<tag_name_hash>(); }
00131 inline
00132 const item_by_name_t& Menu::item_by_name() const { return m_TriggerItemVector.get<tag_name_hash>(); }
00133
00134 inline
00135 const ItemContainer& Menu::itemVector() const { return m_TriggerItemVector; }
00136 inline
00137 const ItemContainer& Menu::items() const { return m_TriggerItemVector; }
00138
00139 inline
00140 int Menu::size() const { return m_TriggerItemVector.size(); }
00141 #endif
00142
00143 }
00144
00145 #endif