00001 // $Id: RunMonitorCollection.h,v 1.14 2011/11/08 10:48:40 mommsen Exp $ 00003 00004 #ifndef EventFilter_StorageManager_RunMonitorCollection_h 00005 #define EventFilter_StorageManager_RunMonitorCollection_h 00006 00007 #include <boost/thread/mutex.hpp> 00008 00009 #include "xdata/UnsignedInteger32.h" 00010 00011 #include "EventFilter/StorageManager/interface/Configuration.h" 00012 #include "EventFilter/StorageManager/interface/I2OChain.h" 00013 #include "EventFilter/StorageManager/interface/MonitorCollection.h" 00014 #include "EventFilter/StorageManager/interface/SharedResources.h" 00015 00016 00017 namespace stor { 00018 00028 class RunMonitorCollection : public MonitorCollection 00029 { 00030 public: 00031 00032 RunMonitorCollection 00033 ( 00034 const utils::Duration_t& updateInterval, 00035 SharedResourcesPtr 00036 ); 00037 00038 void configureAlarms(AlarmParams const&); 00039 00040 const MonitoredQuantity& getEventIDsReceivedMQ() const { 00041 return eventIDsReceived_; 00042 } 00043 MonitoredQuantity& getEventIDsReceivedMQ() { 00044 return eventIDsReceived_; 00045 } 00046 00047 const MonitoredQuantity& getErrorEventIDsReceivedMQ() const { 00048 return errorEventIDsReceived_; 00049 } 00050 MonitoredQuantity& getErrorEventIDsReceivedMQ() { 00051 return errorEventIDsReceived_; 00052 } 00053 00054 const MonitoredQuantity& getUnwantedEventIDsReceivedMQ() const { 00055 return unwantedEventIDsReceived_; 00056 } 00057 MonitoredQuantity& getUnwantedEventIDsReceivedMQ() { 00058 return unwantedEventIDsReceived_; 00059 } 00060 00061 const MonitoredQuantity& getRunNumbersSeenMQ() const { 00062 return runNumbersSeen_; 00063 } 00064 MonitoredQuantity& getRunNumbersSeenMQ() { 00065 return runNumbersSeen_; 00066 } 00067 00068 const MonitoredQuantity& getLumiSectionsSeenMQ() const { 00069 return lumiSectionsSeen_; 00070 } 00071 MonitoredQuantity& getLumiSectionsSeenMQ() { 00072 return lumiSectionsSeen_; 00073 } 00074 00075 const MonitoredQuantity& getEoLSSeenMQ() const { 00076 return eolsSeen_; 00077 } 00078 MonitoredQuantity& getEoLSSeenMQ() { 00079 return eolsSeen_; 00080 } 00081 00082 void addUnwantedEvent(const I2OChain&); 00083 00084 00085 private: 00086 00087 //Prevent copying of the RunMonitorCollection 00088 RunMonitorCollection(RunMonitorCollection const&); 00089 RunMonitorCollection& operator=(RunMonitorCollection const&); 00090 00091 MonitoredQuantity eventIDsReceived_; 00092 MonitoredQuantity errorEventIDsReceived_; 00093 MonitoredQuantity unwantedEventIDsReceived_; 00094 MonitoredQuantity runNumbersSeen_; // Does this make sense? 00095 MonitoredQuantity lumiSectionsSeen_; 00096 MonitoredQuantity eolsSeen_; 00097 00098 SharedResourcesPtr sharedResources_; 00099 00100 virtual void do_calculateStatistics(); 00101 virtual void do_reset(); 00102 virtual void do_appendInfoSpaceItems(InfoSpaceItems&); 00103 virtual void do_updateInfoSpaceItems(); 00104 00105 struct UnwantedEvent 00106 { 00107 uint32_t count; 00108 uint32_t previousCount; 00109 std::string alarmName; 00110 uint32_t hltTriggerCount; 00111 std::vector<unsigned char> bitList; 00112 00113 UnwantedEvent(const I2OChain&); 00114 00115 static uint32_t nextId; 00116 }; 00117 typedef std::map<uint32_t, UnwantedEvent> UnwantedEventsMap; 00118 UnwantedEventsMap unwantedEventsMap_; 00119 mutable boost::mutex unwantedEventMapLock_; 00120 00121 void checkForBadEvents(); 00122 void alarmErrorEvents(); 00123 void alarmUnwantedEvents(UnwantedEventsMap::value_type&); 00124 00125 xdata::UnsignedInteger32 runNumber_; // The current run number 00126 xdata::UnsignedInteger32 dataEvents_; // Number of data events received 00127 xdata::UnsignedInteger32 errorEvents_; // Number of error events received 00128 xdata::UnsignedInteger32 unwantedEvents_; // Number of events not consumed 00129 00130 AlarmParams alarmParams_; 00131 }; 00132 00133 } // namespace stor 00134 00135 #endif // EventFilter_StorageManager_RunMonitorCollection_h 00136 00137