00001 // $Id: RunMonitorCollection.h,v 1.13 2011/03/07 15:31:32 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 AlarmHandlerPtr, 00036 SharedResourcesPtr 00037 ); 00038 00039 void configureAlarms(AlarmParams const&); 00040 00041 const MonitoredQuantity& getEventIDsReceivedMQ() const { 00042 return eventIDsReceived_; 00043 } 00044 MonitoredQuantity& getEventIDsReceivedMQ() { 00045 return eventIDsReceived_; 00046 } 00047 00048 const MonitoredQuantity& getErrorEventIDsReceivedMQ() const { 00049 return errorEventIDsReceived_; 00050 } 00051 MonitoredQuantity& getErrorEventIDsReceivedMQ() { 00052 return errorEventIDsReceived_; 00053 } 00054 00055 const MonitoredQuantity& getUnwantedEventIDsReceivedMQ() const { 00056 return unwantedEventIDsReceived_; 00057 } 00058 MonitoredQuantity& getUnwantedEventIDsReceivedMQ() { 00059 return unwantedEventIDsReceived_; 00060 } 00061 00062 const MonitoredQuantity& getRunNumbersSeenMQ() const { 00063 return runNumbersSeen_; 00064 } 00065 MonitoredQuantity& getRunNumbersSeenMQ() { 00066 return runNumbersSeen_; 00067 } 00068 00069 const MonitoredQuantity& getLumiSectionsSeenMQ() const { 00070 return lumiSectionsSeen_; 00071 } 00072 MonitoredQuantity& getLumiSectionsSeenMQ() { 00073 return lumiSectionsSeen_; 00074 } 00075 00076 const MonitoredQuantity& getEoLSSeenMQ() const { 00077 return eolsSeen_; 00078 } 00079 MonitoredQuantity& getEoLSSeenMQ() { 00080 return eolsSeen_; 00081 } 00082 00083 void addUnwantedEvent(const I2OChain&); 00084 00085 00086 private: 00087 00088 //Prevent copying of the RunMonitorCollection 00089 RunMonitorCollection(RunMonitorCollection const&); 00090 RunMonitorCollection& operator=(RunMonitorCollection const&); 00091 00092 MonitoredQuantity eventIDsReceived_; 00093 MonitoredQuantity errorEventIDsReceived_; 00094 MonitoredQuantity unwantedEventIDsReceived_; 00095 MonitoredQuantity runNumbersSeen_; // Does this make sense? 00096 MonitoredQuantity lumiSectionsSeen_; 00097 MonitoredQuantity eolsSeen_; 00098 00099 AlarmHandlerPtr alarmHandler_; 00100 SharedResourcesPtr sharedResources_; 00101 00102 virtual void do_calculateStatistics(); 00103 virtual void do_reset(); 00104 virtual void do_appendInfoSpaceItems(InfoSpaceItems&); 00105 virtual void do_updateInfoSpaceItems(); 00106 00107 struct UnwantedEvent 00108 { 00109 uint32_t count; 00110 uint32_t previousCount; 00111 std::string alarmName; 00112 uint32_t hltTriggerCount; 00113 std::vector<unsigned char> bitList; 00114 00115 UnwantedEvent(const I2OChain&); 00116 00117 static uint32_t nextId; 00118 }; 00119 typedef std::map<uint32_t, UnwantedEvent> UnwantedEventsMap; 00120 UnwantedEventsMap unwantedEventsMap_; 00121 mutable boost::mutex unwantedEventMapLock_; 00122 00123 void checkForBadEvents(); 00124 void alarmErrorEvents(); 00125 void alarmUnwantedEvents(UnwantedEventsMap::value_type&); 00126 00127 xdata::UnsignedInteger32 runNumber_; // The current run number 00128 xdata::UnsignedInteger32 dataEvents_; // Number of data events received 00129 xdata::UnsignedInteger32 errorEvents_; // Number of error events received 00130 xdata::UnsignedInteger32 unwantedEvents_; // Number of events not consumed 00131 00132 AlarmParams alarmParams_; 00133 }; 00134 00135 } // namespace stor 00136 00137 #endif // EventFilter_StorageManager_RunMonitorCollection_h 00138 00139