00001 #ifndef FUEVENTPROCESSOR_H
00002 #define FUEVENTPROCESSOR_H 1
00003
00004 #include "EventFilter/Processor/src/TriggerReportHelpers.h"
00005
00006 #include "EventFilter/Utilities/interface/StateMachine.h"
00007 #include "EventFilter/Utilities/interface/RunBase.h"
00008 #include "EventFilter/Utilities/interface/Css.h"
00009 #include "EventFilter/Utilities/interface/Exception.h"
00010 #include "EventFilter/Utilities/interface/SquidNet.h"
00011
00012 #include "DataFormats/Provenance/interface/ModuleDescription.h"
00013 #include "FWCore/Framework/interface/TriggerReport.h"
00014 #include "FWCore/PrescaleService/interface/PrescaleService.h"
00015
00016 #include "xdaq/Application.h"
00017 #include "xdaq/NamespaceURI.h"
00018
00019 #include "xdata/String.h"
00020 #include "xdata/Integer.h"
00021 #include "xdata/Boolean.h"
00022 #include "xdata/UnsignedInteger32.h"
00023 #include "xdata/ActionListener.h"
00024 #include "xdata/InfoSpaceFactory.h"
00025
00026 #include "xgi/Input.h"
00027 #include "xgi/Output.h"
00028 #include "xgi/exception/Exception.h"
00029
00030 #include <sys/time.h>
00031
00032 #include <list>
00033 #include <vector>
00034 #include <map>
00035
00036 namespace edm {
00037 class EventProcessor;
00038 }
00039
00040 namespace evf
00041 {
00042
00043 struct filter {
00044
00045 };
00046
00047
00048 class FUEventProcessor : public xdaq::Application,
00049 public xdata::ActionListener
00050 {
00051 public:
00052
00053
00054
00055 XDAQ_INSTANTIATOR();
00056 FUEventProcessor(xdaq::ApplicationStub *s);
00057 virtual ~FUEventProcessor();
00058
00059
00060
00061
00062
00063
00064
00065 bool getTriggerReport(bool useLock)
00066 throw (toolbox::fsm::exception::Exception);
00067
00068
00069 bool configuring(toolbox::task::WorkLoop* wl);
00070 bool enabling(toolbox::task::WorkLoop* wl);
00071 bool stopping(toolbox::task::WorkLoop* wl);
00072 bool halting(toolbox::task::WorkLoop* wl);
00073
00074
00075 xoap::MessageReference fsmCallback(xoap::MessageReference msg)
00076 throw (xoap::exception::Exception);
00077
00078
00079 void initEventProcessor();
00080 edm::EventProcessor::StatusCode stopEventProcessor();
00081
00082
00083 void actionPerformed(xdata::Event& e);
00084
00085
00086
00087
00088
00089
00090
00091 void defaultWebPage(xgi::Input *in,xgi::Output *out)
00092 throw(xgi::exception::Exception);
00093 void taskWebPage(xgi::Input *,xgi::Output *,const std::string &);
00094 void spotlightWebPage(xgi::Input *,xgi::Output *)
00095 throw(xgi::exception::Exception);
00096 void moduleWeb(xgi::Input *in,xgi::Output *out) throw(xgi::exception::Exception);
00097 void serviceWeb(xgi::Input *in,xgi::Output *out) throw(xgi::exception::Exception);
00098 void modulePs(xgi::Input *in, xgi::Output *out)throw(xgi::exception::Exception);
00099 void microState(xgi::Input *in,xgi::Output *out)throw(xgi::exception::Exception);
00100 void css(xgi::Input *in,xgi::Output *out) throw (xgi::exception::Exception)
00101 {
00102 css_.css(in,out);
00103 }
00104
00105 private:
00106
00107 void attachDqmToShm() throw (evf::Exception);
00108 void detachDqmFromShm() throw (evf::Exception);
00109
00110
00111 void startMonitoringWorkLoop() throw (evf::Exception);
00112 bool monitoring(toolbox::task::WorkLoop* wl);
00113
00114 void startScalersWorkLoop() throw (evf::Exception);
00115 bool scalers(toolbox::task::WorkLoop* wl);
00116
00117
00118 bool fireScalersUpdate();
00119
00120
00121 std::string logsAsString();
00122 void localLog(std::string);
00123
00124
00125
00126
00127
00128
00129
00130 evf::StateMachine fsm_;
00131
00132
00133 edm::EventProcessor *evtProcessor_;
00134 edm::ServiceToken serviceToken_;
00135 bool servicesDone_;
00136 bool inRecovery_;
00137 unsigned int recoveryCount_;
00138 bool triggerReportIncomplete_;
00139
00140
00141 edm::service::PrescaleService* prescaleSvc_;
00142
00143
00144 xdata::String url_;
00145 xdata::String class_;
00146 xdata::UnsignedInteger32 instance_;
00147 xdata::UnsignedInteger32 runNumber_;
00148 xdata::Boolean epInitialized_;
00149 xdata::String configString_;
00150 std::string configuration_;
00151 xdata::String sealPluginPath_;
00152 xdata::Boolean outPut_;
00153 xdata::UnsignedInteger32 inputPrescale_;
00154 xdata::UnsignedInteger32 outputPrescale_;
00155 xdata::UnsignedInteger32 timeoutOnStop_;
00156 xdata::Boolean hasShMem_;
00157 xdata::Boolean hasPrescaleService_;
00158 xdata::Boolean hasModuleWebRegistry_;
00159 xdata::Boolean hasServiceWebRegistry_;
00160 xdata::Boolean isRunNumberSetter_;
00161 xdata::Boolean isPython_;
00162 bool outprev_;
00163 std::vector<edm::ModuleDescription const*> descs_;
00164 std::map<std::string,int> modmap_;
00165
00166
00167
00168 xdata::String prescalerAsString_;
00169
00170
00171 xdata::UnsignedInteger32 monSleepSec_;
00172 struct timeval monStartTime_;
00173
00174
00175 toolbox::task::WorkLoop *wlMonitoring_;
00176 toolbox::task::ActionSignature *asMonitoring_;
00177 bool watching_;
00178
00179
00180 toolbox::task::WorkLoop *wlScalers_;
00181 toolbox::task::ActionSignature *asScalers_;
00182
00183
00184 std::string sourceId_;
00185
00186
00187 xdata::String epMState_;
00188 xdata::String epmState_;
00189 xdata::UnsignedInteger32 nbProcessed_;
00190 xdata::UnsignedInteger32 nbAccepted_;
00191 xdata::InfoSpace *monitorInfoSpace_;
00192
00193
00194 xdata::Integer epMAltState_;
00195 xdata::Integer epmAltState_;
00196 xdata::InfoSpace *monitorInfoSpaceAlt_;
00197
00198
00199 xdata::String macro_state_legend_;
00200 xdata::String micro_state_legend_;
00201 xdata::InfoSpace *monitorInfoSpaceLegend_;
00202
00203
00204 xdata::InfoSpace *scalersInfoSpace_;
00205 xdata::Table scalersComplete_;
00206 xdata::UnsignedInteger32 localLsIncludingTimeOuts_;
00207 xdata::UnsignedInteger32 lsTimeOut_;
00208 unsigned int firstLsTimeOut_;
00209 unsigned int residualTimeOut_;
00210 bool lastLsTimedOut_;
00211 unsigned int lastLsWithEvents_;
00212 unsigned int lastLsWithTimeOut_;
00213
00214 xdata::Boolean squidPresent_;
00215
00216
00217
00218 Css css_;
00219
00220
00221 std::string reasonForFailedState_;
00222 fuep::TriggerReportHelpers trh_;
00223 std::list<std::string> names_;
00224 bool wlMonitoringActive_;
00225 bool wlScalersActive_;
00226 unsigned int scalersUpdateAttempted_;
00227 unsigned int scalersUpdateCounter_;
00228 std::vector<std::pair<unsigned int, unsigned int> > lumiSectionsCtr_;
00229 std::vector<bool> lumiSectionsTo_;
00230 unsigned int allPastLumiProcessed_;
00231 unsigned int rollingLsIndex_;
00232 bool rollingLsWrap_;
00233 static const unsigned int lsRollSize_ = 20;
00234 SquidNet squidnet_;
00235 std::vector<std::string> logRing_;
00236 unsigned int logRingIndex_;
00237 static const unsigned int logRingSize_ = 50;
00238 bool logWrap_;
00239 std::string lsidAsString_;
00240 std::string lsidTimedOutAsString_;
00241 std::string psidAsString_;
00242 };
00243
00244 }
00245
00246
00247 #endif