File indexing completed on 2024-09-11 04:32:31
0001 #ifndef L1TdeStage2CaloLayer1_H
0002 #define L1TdeStage2CaloLayer1_H
0003
0004
0005 #include <memory>
0006 #include <string>
0007 #include <array>
0008
0009
0010 #include "FWCore/Framework/interface/Frameworkfwd.h"
0011
0012 #include "FWCore/Framework/interface/Event.h"
0013 #include "FWCore/Framework/interface/MakerMacros.h"
0014
0015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0016
0017 #include "FWCore/ServiceRegistry/interface/Service.h"
0018 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0019
0020 #include "DQMServices/Core/interface/DQMStore.h"
0021 #include "DQMServices/Core/interface/DQMOneEDAnalyzer.h"
0022
0023 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
0024 #include "DataFormats/L1TCalorimeter/interface/CaloTower.h"
0025
0026 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
0027
0028 class L1TdeStage2CaloLayer1 : public DQMOneEDAnalyzer<edm::one::WatchLuminosityBlocks> {
0029 public:
0030 L1TdeStage2CaloLayer1(const edm::ParameterSet &ps);
0031 ~L1TdeStage2CaloLayer1() override;
0032
0033 protected:
0034 void analyze(const edm::Event &e, const edm::EventSetup &c) override;
0035 void bookHistograms(DQMStore::IBooker &ibooker, const edm::Run &, const edm::EventSetup &) override;
0036 void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override;
0037 void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override;
0038
0039 private:
0040 void updateMismatch(const edm::Event &e, int mismatchType);
0041
0042 edm::InputTag dataLabel_;
0043 edm::EDGetTokenT<l1t::CaloTowerBxCollection> dataSource_;
0044 edm::InputTag emulLabel_;
0045 edm::EDGetTokenT<l1t::CaloTowerBxCollection> emulSource_;
0046 edm::EDGetTokenT<HcalTrigPrimDigiCollection> hcalTowers_;
0047 edm::EDGetTokenT<FEDRawDataCollection> fedRawData_;
0048 std::string histFolder_;
0049 int tpFillThreshold_;
0050
0051
0052 class SimpleTower {
0053 public:
0054 int ieta_;
0055 int iphi_;
0056 int data_;
0057 bool compareLeft_;
0058 SimpleTower(int ieta, int iphi, int data, bool compareLeft = true)
0059 : ieta_(ieta), iphi_(iphi), data_(data), compareLeft_(compareLeft) {}
0060 inline int et() const { return (data_ & 0x01ff) >> 0; };
0061 inline int er() const { return (data_ & 0x0e00) >> 9; };
0062 inline int fb() const { return (data_ & 0xf000) >> 12; };
0063
0064
0065
0066 bool operator<(const SimpleTower &b) const {
0067 if (ieta_ < b.ieta_)
0068 return true;
0069 if (ieta_ == b.ieta_ && iphi_ < b.iphi_)
0070 return true;
0071 if (ieta_ == b.ieta_ && iphi_ == b.iphi_ && data_ < b.data_)
0072 return true;
0073 return false;
0074 };
0075 };
0076 typedef std::set<SimpleTower> SimpleTowerSet;
0077
0078 enum SummaryColumn {
0079 EtMismatch,
0080 ErMismatch,
0081 FbMismatch,
0082 TowerCountMismatch,
0083 NSummaryColumns,
0084 };
0085 MonitorElement *dataEmulSummary_;
0086 std::array<double, NSummaryColumns> dataEmulNumerator_;
0087 double dataEmulDenominator_;
0088 MonitorElement *mismatchesPerBxMod9_;
0089
0090 MonitorElement *dataOcc_;
0091 MonitorElement *emulOcc_;
0092 MonitorElement *matchOcc_;
0093 MonitorElement *failureOccEtMismatch_;
0094 MonitorElement *failureOccEtDataZero_;
0095 MonitorElement *failureOccEtEmulZero_;
0096 MonitorElement *failureOccErMismatch_;
0097 MonitorElement *failureOccFbMismatch_;
0098
0099 MonitorElement *dataEtDistribution_;
0100 MonitorElement *dataEtDistributionFBMismatch_;
0101 MonitorElement *emulEtDistribution_;
0102 MonitorElement *etCorrelation_;
0103 MonitorElement *matchEtDistribution_;
0104 MonitorElement *etMismatchDiff_;
0105 MonitorElement *fbCorrelation_;
0106 MonitorElement *fbCorrelationHF_;
0107
0108 MonitorElement *etMismatchByLumi_;
0109 MonitorElement *erMismatchByLumi_;
0110 MonitorElement *fbMismatchByLumi_;
0111
0112 MonitorElement *etMismatchesPerBx_;
0113 MonitorElement *erMismatchesPerBx_;
0114 MonitorElement *fbMismatchesPerBx_;
0115 MonitorElement *towerCountMismatchesPerBx_;
0116
0117 MonitorElement *last20Mismatches_;
0118 std::array<std::pair<std::string, int>, 20> last20MismatchArray_;
0119 size_t lastMismatchIndex_{0};
0120 };
0121
0122 #endif