File indexing completed on 2024-04-06 12:06:55
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef CSCDQM_Dispatcher_H
0021 #define CSCDQM_Dispatcher_H
0022
0023 #include <typeinfo>
0024
0025 #ifdef DQMMT
0026 #include <boost/thread.hpp>
0027 #endif
0028
0029 #include "CSCDQM_Configuration.h"
0030 #include "CSCDQM_EventProcessor.h"
0031 #include "CSCDQM_Collection.h"
0032 #include "CSCDQM_HistoDef.h"
0033 #include "CSCDQM_Cache.h"
0034 #include "CSCDQM_Logger.h"
0035 #include "CSCDQM_Lock.h"
0036
0037 namespace cscdqm {
0038
0039
0040
0041
0042
0043
0044 class EventProcessorMutex : public Lock {
0045 private:
0046
0047 EventProcessor processor;
0048
0049
0050 Configuration* config;
0051
0052
0053 bool fullStandbyProcessed;
0054
0055
0056 HWStandbyType lastStandby;
0057
0058 public:
0059
0060
0061
0062
0063 EventProcessorMutex(Configuration* const p_config) : processor(p_config) {
0064 config = p_config;
0065 fullStandbyProcessed = false;
0066 }
0067
0068
0069
0070
0071
0072 void updateFractionAndEfficiencyHistos() {
0073 LockType lock(mutex);
0074 config->updateFraTimer(true);
0075 processor.updateFractionHistos();
0076 config->updateFraTimer(false);
0077 if (config->getPROCESS_EFF_HISTOS()) {
0078 config->updateEffTimer(true);
0079 processor.updateEfficiencyHistos();
0080 config->updateEffTimer(false);
0081 }
0082 }
0083
0084
0085
0086
0087
0088
0089 unsigned int maskHWElements(std::vector<std::string>& tokens) { return processor.maskHWElements(tokens); }
0090
0091
0092
0093
0094
0095 void processStandby(HWStandbyType& standby) {
0096 if (lastStandby != standby) {
0097 processor.standbyEfficiencyHistos(standby);
0098 if (config->getIN_FULL_STANDBY()) {
0099
0100 if (!fullStandbyProcessed) {
0101 processor.standbyEfficiencyHistos(standby);
0102 processor.writeShifterHistograms();
0103 fullStandbyProcessed = true;
0104 }
0105 }
0106 lastStandby = standby;
0107 }
0108 }
0109 };
0110
0111
0112
0113
0114
0115 class Dispatcher {
0116 public:
0117 Dispatcher(Configuration* const p_config, MonitorObjectProvider* const p_provider);
0118
0119 #ifdef DQMGLOBAL
0120 Dispatcher(Configuration* const p_config,
0121 MonitorObjectProvider* const p_provider,
0122 const edm::InputTag& itag,
0123 edm::ConsumesCollector&& coco);
0124 #endif
0125
0126
0127
0128
0129 ~Dispatcher() {
0130 #ifdef DQMMT
0131 threads.join_all();
0132 #endif
0133 }
0134
0135 void init();
0136 void book();
0137 void updateFractionAndEfficiencyHistos();
0138 const bool getHisto(const HistoDef& histoD, MonitorObject*& me);
0139 unsigned int maskHWElements(std::vector<std::string>& tokens);
0140 void processStandby(HWStandbyType& standby);
0141
0142 private:
0143
0144 void commonConstruct(Configuration* const p_config, MonitorObjectProvider* const p_provider);
0145
0146 void updateFractionAndEfficiencyHistosAuto();
0147
0148
0149 Configuration* config;
0150
0151
0152 MonitorObjectProvider* provider;
0153
0154
0155 Collection collection;
0156
0157
0158 EventProcessor processor;
0159
0160
0161 Cache cache;
0162
0163
0164 EventProcessorMutex processorFract;
0165
0166 #ifdef DQMMT
0167
0168
0169 boost::thread_group threads;
0170
0171 #endif
0172
0173 #ifdef DQMLOCAL
0174
0175 public:
0176 void processEvent(const char* data, const int32_t dataSize, const uint32_t errorStat, const int32_t nodeNumber);
0177
0178 #endif
0179
0180 #ifdef DQMGLOBAL
0181
0182 public:
0183 void processEvent(const edm::Event& e, const edm::InputTag& inputTag, HWStandbyType& standby);
0184
0185 #endif
0186 };
0187
0188 }
0189
0190 #endif