File indexing completed on 2024-04-06 12:07:53
0001
0002
0003
0004
0005
0006
0007 #include "DQM/L1TMonitor/interface/L1TPUM.h"
0008
0009 #include "FWCore/Framework/interface/ESHandle.h"
0010 #include "DataFormats/Provenance/interface/EventAuxiliary.h"
0011
0012 #include "CondFormats/RunInfo/interface/RunInfo.h"
0013 #include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
0014
0015
0016 namespace {
0017 const unsigned int R10BINS = 1024;
0018 const float R10MIN = -0.5;
0019 const float R10MAX = 1023.5;
0020
0021 const unsigned int PUMETABINS = 22;
0022 const unsigned int PUMNORMALIZE = 22;
0023
0024 const unsigned int PUMBINS = 18;
0025 const float PUMMIN = -0.5;
0026 const float PUMMAX = 17.5;
0027 }
0028
0029 L1TPUM::L1TPUM(const edm::ParameterSet& ps)
0030 : regionSource_(consumes<L1CaloRegionCollection>(ps.getParameter<edm::InputTag>("regionSource"))),
0031 histFolder_(ps.getParameter<std::string>("histFolder")) {}
0032
0033 L1TPUM::~L1TPUM() {}
0034
0035 void L1TPUM::analyze(const edm::Event& event, const edm::EventSetup& es) {
0036 edm::Handle<L1CaloRegionCollection> regionCollection;
0037 event.getByToken(regionSource_, regionCollection);
0038
0039 int nonzeroRegionsBxP2{0};
0040 int nonzeroRegionsBx0{0};
0041 int nonzeroRegionsBxM2{0};
0042
0043 float regionsTotalEtBxP2{0.};
0044 float regionsTotalEtBx0{0.};
0045 float regionsTotalEtBxM2{0.};
0046
0047 for (const auto& region : *regionCollection) {
0048 if (region.et() > 0) {
0049 if (region.bx() == 0) {
0050 nonzeroRegionsBx0++;
0051 regionsTotalEtBx0 += region.et();
0052 } else if (region.bx() == 2) {
0053 nonzeroRegionsBxP2++;
0054 regionsTotalEtBxP2 += region.et();
0055 } else if (region.bx() == -2) {
0056 nonzeroRegionsBxM2++;
0057 regionsTotalEtBxM2 += region.et();
0058 }
0059 }
0060 }
0061
0062 regionsTotalEtBxP2_->Fill(regionsTotalEtBxP2);
0063 regionsTotalEtBx0_->Fill(regionsTotalEtBx0);
0064 regionsTotalEtBxM2_->Fill(regionsTotalEtBxM2);
0065
0066 regionsAvgEtBxP2_->Fill(regionsTotalEtBxP2 / 396.);
0067 regionsAvgEtBx0_->Fill(regionsTotalEtBx0 / 396.);
0068 regionsAvgEtBxM2_->Fill(regionsTotalEtBxM2 / 396.);
0069
0070 regionsAvgNonZeroEtBxP2_->Fill(regionsTotalEtBxP2 / nonzeroRegionsBxP2);
0071 regionsAvgNonZeroEtBx0_->Fill(regionsTotalEtBx0 / nonzeroRegionsBx0);
0072 regionsAvgNonZeroEtBxM2_->Fill(regionsTotalEtBxM2 / nonzeroRegionsBxM2);
0073
0074 nonZeroRegionsBxP2_->Fill(nonzeroRegionsBxP2);
0075 nonZeroRegionsBx0_->Fill(nonzeroRegionsBx0);
0076 nonZeroRegionsBxM2_->Fill(nonzeroRegionsBxM2);
0077
0078 for (const auto& region : *regionCollection) {
0079 size_t etaBin = region.gctEta();
0080 regionBxPopulation_->Fill(etaBin * 18 + region.gctPhi(), region.bx());
0081 regionBxEtSum_->Fill(etaBin * 18 + region.gctPhi(), region.bx(), region.et());
0082 if (region.bx() == 0)
0083 regionsPUMEtaBx0_[etaBin]->Fill(nonzeroRegionsBx0 / PUMNORMALIZE, region.et());
0084 else if (region.bx() == 2)
0085 regionsPUMEtaBxP2_[etaBin]->Fill(nonzeroRegionsBxP2 / PUMNORMALIZE, region.et());
0086 else if (region.bx() == -2)
0087 regionsPUMEtaBxM2_[etaBin]->Fill(nonzeroRegionsBxM2 / PUMNORMALIZE, region.et());
0088 }
0089 }
0090
0091 void L1TPUM::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& run, const edm::EventSetup& es) {
0092 ibooker.setCurrentFolder(histFolder_ + "/BX0");
0093 regionsPUMEtaBx0_.resize(PUMETABINS);
0094 for (size_t ieta = 0; ieta < PUMETABINS; ++ieta) {
0095 regionsTotalEtBx0_ = ibooker.book1D("regionsTotalEt", "Total ET distribution;Sum Rank;Counts", 200, 0, 2000);
0096 regionsAvgEtBx0_ = ibooker.book1D("regionsAvgEt", "Average Rank;Average Rank;Counts", R10BINS, R10MIN, R10MAX);
0097 regionsAvgNonZeroEtBx0_ =
0098 ibooker.book1D("regionsAvgNonZeroEt", "Average Rank >0;Average Rank Regions>0;Counts", R10BINS, R10MIN, R10MAX);
0099 nonZeroRegionsBx0_ = ibooker.book1D("nonZeroRegions", "Nonzero regions;Number Regions >0;Counts", 397, -0.5, 396.5);
0100 regionsPUMEtaBx0_[ieta] = ibooker.book2D("regionsPUMEta" + std::to_string(ieta),
0101 "PUM Bin rank distribution;PU bin;Rank",
0102 PUMBINS,
0103 PUMMIN,
0104 PUMMAX,
0105 R10BINS,
0106 R10MIN,
0107 R10MAX);
0108 }
0109
0110 ibooker.setCurrentFolder(histFolder_ + "/BXP2");
0111 regionsPUMEtaBxP2_.resize(PUMETABINS);
0112 for (size_t ieta = 0; ieta < PUMETABINS; ++ieta) {
0113 regionsTotalEtBxP2_ = ibooker.book1D("regionsTotalEt", "Total ET distribution;Sum Rank;Counts", 200, 0, 2000);
0114 regionsAvgEtBxP2_ = ibooker.book1D("regionsAvgEt", "Average Rank;Average Rank;Counts", R10BINS, R10MIN, R10MAX);
0115 regionsAvgNonZeroEtBxP2_ =
0116 ibooker.book1D("regionsAvgNonZeroEt", "Average Rank >0;Average Rank Regions>0;Counts", R10BINS, R10MIN, R10MAX);
0117 nonZeroRegionsBxP2_ =
0118 ibooker.book1D("nonZeroRegions", "Nonzero regions;Number Regions >0;Counts", 397, -0.5, 396.5);
0119 regionsPUMEtaBxP2_[ieta] = ibooker.book2D("regionsPUMEta" + std::to_string(ieta),
0120 "PUM Bin rank distribution;PU bin;Rank",
0121 PUMBINS,
0122 PUMMIN,
0123 PUMMAX,
0124 R10BINS,
0125 R10MIN,
0126 R10MAX);
0127 }
0128
0129 ibooker.setCurrentFolder(histFolder_ + "/BXM2");
0130 regionsPUMEtaBxM2_.resize(PUMETABINS);
0131 for (size_t ieta = 0; ieta < PUMETABINS; ++ieta) {
0132 regionsTotalEtBxM2_ = ibooker.book1D("regionsTotalEt", "Total ET distribution;Sum Rank;Counts", 200, 0, 2000);
0133 regionsAvgEtBxM2_ = ibooker.book1D("regionsAvgEt", "Average Rank;Average Rank;Counts", R10BINS, R10MIN, R10MAX);
0134 regionsAvgNonZeroEtBxM2_ =
0135 ibooker.book1D("regionsAvgNonZeroEt", "Average Rank >0;Average Rank Regions>0;Counts", R10BINS, R10MIN, R10MAX);
0136 nonZeroRegionsBxM2_ =
0137 ibooker.book1D("nonZeroRegions", "Nonzero regions;Number Regions >0;Counts", 397, -0.5, 396.5);
0138 regionsPUMEtaBxM2_[ieta] = ibooker.book2D("regionsPUMEta" + std::to_string(ieta),
0139 "PUM Bin rank distribution;PU bin;Rank",
0140 PUMBINS,
0141 PUMMIN,
0142 PUMMAX,
0143 R10BINS,
0144 R10MIN,
0145 R10MAX);
0146 }
0147
0148 ibooker.setCurrentFolder(histFolder_ + "/RegionBxInfo");
0149 regionBxPopulation_ =
0150 ibooker.book2D("regionBxPopulation",
0151 "Event counts per region per bunch crossing;Region index (18*eta+phi);BX index;Counts",
0152 396,
0153 -0.5,
0154 395.5,
0155 5,
0156 -2.5,
0157 2.5);
0158 regionBxEtSum_ = ibooker.book2D("regionBxEtSum",
0159 "Et per region per bunch crossing;Region index (18*eta+phi);BX index;Counts*et",
0160 396,
0161 -0.5,
0162 395.5,
0163 5,
0164 -2.5,
0165 2.5);
0166 }