CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DQM/CSCMonitorModule/interface/CSCDQM_Dispatcher.h

Go to the documentation of this file.
00001 /*
00002  * =====================================================================================
00003  *
00004  *       Filename:  CSCDQM_Dispatcher.h
00005  *
00006  *    Description:  CSCDQM Framework frontend and Histogram Cache controller
00007  *
00008  *        Version:  1.0
00009  *        Created:  10/03/2008 10:26:04 AM
00010  *       Revision:  none
00011  *       Compiler:  gcc
00012  *
00013  *         Author:  Valdas Rapsevicius, valdas.rapsevicius@cern.ch
00014  *        Company:  CERN, CH
00015  *
00016  * =====================================================================================
00017  */
00018 
00019 #ifndef CSCDQM_Dispatcher_H
00020 #define CSCDQM_Dispatcher_H
00021 
00022 #include <typeinfo>
00023 
00024 #ifdef DQMMT      
00025 #include <boost/thread.hpp>
00026 #endif
00027 
00028 #include "DQM/CSCMonitorModule/interface/CSCDQM_Configuration.h"
00029 #include "DQM/CSCMonitorModule/interface/CSCDQM_EventProcessor.h"
00030 #include "DQM/CSCMonitorModule/interface/CSCDQM_Collection.h"
00031 #include "DQM/CSCMonitorModule/interface/CSCDQM_Cache.h"
00032 #include "DQM/CSCMonitorModule/interface/CSCDQM_Logger.h"
00033 #include "DQM/CSCMonitorModule/interface/CSCDQM_Lock.h"
00034 
00035 namespace cscdqm {
00036 
00042   class EventProcessorMutex : public Lock {
00043 
00044     private:
00045 
00047       EventProcessor processor;
00048 
00050       Configuration *config;
00051 
00053       bool fullStandbyProcessed;
00054 
00056       HWStandbyType lastStandby;
00057 
00058     public:
00059 
00064       EventProcessorMutex(Configuration* const p_config) : processor(p_config) {
00065         config = p_config;
00066         fullStandbyProcessed = false;
00067       }
00068 
00073       void updateFractionAndEfficiencyHistos() {
00074         LockType lock(mutex);
00075         config->updateFraTimer(true);
00076         processor.updateFractionHistos();
00077         config->updateFraTimer(false);
00078         if (config->getPROCESS_EFF_HISTOS()) {
00079           config->updateEffTimer(true);
00080           processor.updateEfficiencyHistos();
00081           config->updateEffTimer(false);
00082         }
00083       }
00084 
00090       unsigned int maskHWElements(std::vector<std::string>& tokens) {
00091         return processor.maskHWElements(tokens);
00092       }
00093 
00094       
00099       void processStandby(HWStandbyType& standby) {
00100         if (lastStandby != standby) {
00101           processor.standbyEfficiencyHistos(standby);
00102           if (config->getIN_FULL_STANDBY()) {
00103             // Lets mark CSCs as BAD - have not ever ever been in !STANDBY 
00104             if (!fullStandbyProcessed) {
00105               processor.standbyEfficiencyHistos(standby);
00106               processor.writeShifterHistograms();
00107               fullStandbyProcessed = true;
00108             }
00109           }
00110           lastStandby = standby;
00111         }
00112       }
00113 
00114   };
00115 
00120   class Dispatcher {
00121 
00122     public:
00123 
00124       Dispatcher(Configuration* const p_config, MonitorObjectProvider* const p_provider);
00125 
00129       ~Dispatcher() { 
00130 #ifdef DQMMT      
00131         threads.join_all(); 
00132 #endif      
00133       }
00134 
00135       void init();
00136       void updateFractionAndEfficiencyHistos();
00137       const bool getHisto(const HistoDef& histoD, MonitorObject*& me);
00138       unsigned int maskHWElements(std::vector<std::string>& tokens);
00139       void processStandby(HWStandbyType& standby);
00140 
00141     private:
00142 
00143       void updateFractionAndEfficiencyHistosAuto();
00144 
00146       Configuration         *config;
00147 
00149       MonitorObjectProvider *provider;
00150 
00152       Collection            collection;
00153 
00155       EventProcessor        processor;
00156 
00158       Cache                 cache;
00159 
00161       EventProcessorMutex processorFract;
00162 
00163 #ifdef DQMMT      
00164 
00166       boost::thread_group threads;
00167 
00168 #endif      
00169 
00170 #ifdef DQMLOCAL
00171 
00172     public:
00173 
00174       void processEvent(const char* data, const int32_t dataSize, const uint32_t errorStat, const int32_t nodeNumber);
00175 
00176 #endif      
00177 
00178 #ifdef DQMGLOBAL
00179 
00180     public:
00181 
00182       void processEvent(const edm::Event& e, const edm::InputTag& inputTag, HWStandbyType& standby);
00183 
00184 #endif      
00185 
00186   };
00187 
00188 }
00189 
00190 #endif