File indexing completed on 2024-04-06 12:06:56
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #ifndef CSCDQM_EventProcessor_H
0021 #define CSCDQM_EventProcessor_H
0022
0023 #include <set>
0024 #include <string>
0025 #include <cmath>
0026
0027 #include <TString.h>
0028
0029 #ifdef DQMGLOBAL
0030
0031 #include "FWCore/Framework/interface/ConsumesCollector.h"
0032 #include "FWCore/Framework/interface/Event.h"
0033 #include "FWCore/Utilities/interface/InputTag.h"
0034 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
0035 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
0036 #include "EventFilter/CSCRawToDigi/interface/CSCDCCEventData.h"
0037
0038 #endif
0039
0040 #include "CSCDQM_Logger.h"
0041 #include "CSCDQM_Summary.h"
0042 #include "CSCDQM_StripClusterFinder.h"
0043 #include "CSCDQM_Configuration.h"
0044 #include "CSCDQM_Configuration.h"
0045
0046 #include "EventFilter/CSCRawToDigi/interface/CSCDCCExaminer.h"
0047 #include "EventFilter/CSCRawToDigi/interface/CSCDDUEventData.h"
0048 #include "EventFilter/CSCRawToDigi/interface/CSCCFEBTimeSlice.h"
0049 #include "EventFilter/CSCRawToDigi/interface/CSCCFEBData.h"
0050
0051 #include "DataFormats/CSCDigi/interface/CSCDCCFormatStatusDigi.h"
0052 #include "DataFormats/CSCDigi/interface/CSCDCCFormatStatusDigiCollection.h"
0053
0054 namespace cscdqm {
0055
0056
0057
0058
0059 struct HWStandbyType {
0060
0061
0062 bool process;
0063
0064
0065 bool MeP;
0066
0067
0068 bool MeM;
0069
0070 HWStandbyType() { process = MeP = MeM = false; }
0071
0072 void applyMeP(bool ready) { MeP = MeP || !ready; }
0073
0074 void applyMeM(bool ready) { MeM = MeM || !ready; }
0075
0076 bool fullStandby() const { return (MeM && MeP); }
0077
0078 bool operator==(const HWStandbyType& t) const { return (t.MeP == MeP && t.MeM == MeM && t.process == process); }
0079
0080 bool operator!=(const HWStandbyType& t) const { return !(*this == t); }
0081
0082 const HWStandbyType& operator=(const HWStandbyType& t) {
0083 MeP = t.MeP;
0084 MeM = t.MeM;
0085 process = t.process;
0086 return *this;
0087 }
0088 };
0089
0090 typedef std::map<CSCIdType, ExaminerStatusType> CSCExaminerMapType;
0091 typedef std::vector<DDUIdType> DDUExaminerVectorType;
0092
0093
0094
0095
0096
0097
0098
0099 class EventProcessor {
0100
0101
0102
0103
0104 public:
0105 EventProcessor(Configuration* const p_config);
0106
0107 #ifdef DQMGLOBAL
0108
0109 EventProcessor(Configuration* const p_config, const edm::InputTag& itag, edm::ConsumesCollector& coco);
0110
0111 #endif
0112
0113
0114
0115
0116 ~EventProcessor() {}
0117
0118 void init();
0119
0120 void updateFractionHistos();
0121 void updateEfficiencyHistos();
0122 void standbyEfficiencyHistos(HWStandbyType& standby);
0123 void writeShifterHistograms();
0124
0125 unsigned int maskHWElements(std::vector<std::string>& tokens);
0126
0127 private:
0128 bool processExaminer(const CSCDCCExaminer& binChecker);
0129 bool processExaminer(const CSCDCCExaminer& binChecker, const CSCDCCFormatStatusDigi& digi);
0130 void processDDU(const CSCDDUEventData& data, const CSCDCCExaminer& binChecker);
0131 void processCSC(const CSCEventData& data, const int dduID, const CSCDCCExaminer& binChecker);
0132
0133 void calcEMUFractionHisto(const HistoId& result, const HistoId& set, const HistoId& subset);
0134
0135 const bool getEMUHisto(const HistoId& histo, MonitorObject*& me);
0136 const bool getFEDHisto(const HistoId& histo, const HwId& fedID, MonitorObject*& me);
0137 const bool getDDUHisto(const HistoId& histo, const HwId& dduID, MonitorObject*& me);
0138 const bool getCSCHisto(const HistoId& histo, const HwId& crateID, const HwId& dmbSlot, MonitorObject*& me);
0139 const bool getCSCHisto(
0140 const HistoId& histo, const HwId& crateID, const HwId& dmbSlot, const HwId& adId, MonitorObject*& me);
0141 const bool getParHisto(const HistoId& histo, MonitorObject*& me);
0142 void preProcessEvent();
0143
0144 const bool getCSCFromMap(const unsigned int& crateId,
0145 const unsigned int& dmbId,
0146 unsigned int& cscType,
0147 unsigned int& cscPosition) const;
0148 void setEmuEventDisplayBit(MonitorObject*& mo, const unsigned int x, const unsigned int y, const unsigned int bit);
0149 void resetEmuEventDisplays();
0150
0151
0152 Configuration* config;
0153
0154
0155 Summary summary;
0156
0157 std::map<uint32_t, uint32_t> L1ANumbers;
0158 std::map<uint32_t, bool> fNotFirstEvent;
0159 uint32_t L1ANumber;
0160 uint32_t BXN;
0161 uint32_t cntDMBs;
0162 uint32_t cntCFEBs;
0163 uint32_t cntALCTs;
0164 uint32_t cntTMBs;
0165
0166 uint16_t theFormatVersion;
0167
0168
0169 bool fCloseL1As;
0170 bool EmuEventDisplayWasReset;
0171
0172
0173 edm::EDGetTokenT<FEDRawDataCollection> frdtoken;
0174
0175
0176
0177
0178
0179 #ifdef DQMLOCAL
0180
0181 public:
0182 void processEvent(const char* data, const int32_t dataSize, const uint32_t errorStat, const int32_t nodeNumber);
0183
0184 #endif
0185
0186
0187
0188
0189
0190 #ifdef DQMGLOBAL
0191
0192 private:
0193 bool bCSCEventCounted;
0194
0195 public:
0196 void processEvent(const edm::Event& e, const edm::InputTag& inputTag);
0197
0198 #endif
0199 };
0200
0201 }
0202
0203 #endif