diff --git a/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py index a5e72197ddc4a..f9864256684af 100644 --- a/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py @@ -29,8 +29,8 @@ process.load("DQM.Integration.config.environment_cfi") -process.dqmEnv.subSystemFolder = "L1T2016EMU" -process.dqmSaver.tag = "L1T2016EMU" +process.dqmEnv.subSystemFolder = "L1TEMU" +process.dqmSaver.tag = "L1TEMU" process.DQMStore.referenceFileName = "/dqmdata/dqm/reference/l1temu_reference.root" process.dqmEndPath = cms.EndPath( diff --git a/DQM/L1TMonitor/interface/L1TStage2CaloLayer2.h b/DQM/L1TMonitor/interface/L1TStage2CaloLayer2.h index 1f148ea1461a6..49d28cf138766 100644 --- a/DQM/L1TMonitor/interface/L1TStage2CaloLayer2.h +++ b/DQM/L1TMonitor/interface/L1TStage2CaloLayer2.h @@ -28,9 +28,9 @@ class L1TStage2CaloLayer2 : public DQMEDAnalyzer { protected: void analyze(const edm::Event& e, const edm::EventSetup& c) override; - virtual void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override; - virtual void bookHistograms(DQMStore::IBooker&, const edm::Run&, const edm::EventSetup&) override ; - virtual void beginLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&) override; + void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override; + void bookHistograms(DQMStore::IBooker&, const edm::Run&, const edm::EventSetup&) override ; + void beginLuminosityBlock(const edm::LuminosityBlock&, const edm::EventSetup&) override; private: @@ -102,6 +102,18 @@ class L1TStage2CaloLayer2 : public DQMEDAnalyzer { MonitorElement* stage2CaloLayer2MHTRank_; MonitorElement* stage2CaloLayer2MHTPhi_; MonitorElement* stage2CaloLayer2HTTRank_; + MonitorElement* stage2CaloLayer2METHFRank_; + MonitorElement* stage2CaloLayer2METHFPhi_; + // MonitorElement* stage2CaloLayer2ETTHFRank_; + MonitorElement* stage2CaloLayer2MHTHFRank_; + MonitorElement* stage2CaloLayer2MHTHFPhi_; + // MonitorElement* stage2CaloLayer2HTTHFRank_; + MonitorElement* stage2CaloLayer2MinBiasHFP0_; + MonitorElement* stage2CaloLayer2MinBiasHFM0_; + MonitorElement* stage2CaloLayer2MinBiasHFP1_; + MonitorElement* stage2CaloLayer2MinBiasHFM1_; + MonitorElement* stage2CaloLayer2ETTEMRank_; + MonitorElement* stage2CaloLayer2TowCount_; MonitorElement* timingStage2CaloLayer2CenJetBxOcc_; MonitorElement* timingStage2CaloLayer2ForJetBxOcc_; diff --git a/DQM/L1TMonitor/interface/L1TdeStage2CaloLayer2.h b/DQM/L1TMonitor/interface/L1TdeStage2CaloLayer2.h new file mode 100644 index 0000000000000..7c744a4167e32 --- /dev/null +++ b/DQM/L1TMonitor/interface/L1TdeStage2CaloLayer2.h @@ -0,0 +1,369 @@ +#ifndef DQM_L1TMonitor_L1TdeStage2CaloLayer2 +#define DQM_L1TMonitor_L1TdeStage2CaloLayer2 + +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" +#include "DQMServices/Core/interface/MonitorElement.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "DataFormats/L1Trigger/interface/EGamma.h" +#include "DataFormats/L1Trigger/interface/Jet.h" +#include "DataFormats/L1Trigger/interface/EtSum.h" +#include "DataFormats/L1Trigger/interface/Tau.h" + +/** + * Short class description. + * + * Longer class description... + * ... desc continued. + */ +class L1TdeStage2CaloLayer2 : public DQMEDAnalyzer { + + public: + /** + * Class constructor + * + * Receives the set of parameters, specified by the python configuration file + * used to initialise the module as a part of a sequence. The contents of the + * set is used to configure the internal state of the objects of this class. + * Values from the parameter set are extracted and used to initialise + * bxcollections for jet, e/g, tau and sum objects reconstructed by firmware + * (data) and emulator. These collections are the basis of the comparisons + * performed by this module. + * + * @param edm::ParamterSet & ps A pointer to the parameter set used + */ + L1TdeStage2CaloLayer2 (const edm::ParameterSet & ps); + + + protected: + + /** + * Method to declare or "book" all histograms that will be part of module + * + * Histograms that are to be visualised as part of the DQM module should be + * registered with the IBooker object any additional configuration such as + * title or axis labels and ranges. A good rule of thumb for the amount of + * configuration is that it should be possible to understnand the contents of + * the histogram using the configuration received from this method since the + * plots generated by this module would later be stored into ROOT files for + * transfer to the DQM system and it should be possible to ... + * + * @param DQMStore::IBooker& ibooker Object that handles the creation of plots + * @param edm::Run const & Reference to run object + * @param edm::EventSetup const & Reference to event configuration object + * + * @return void + */ + void bookHistograms (DQMStore::IBooker&, + const edm::Run&, + const edm::EventSetup&) override; + + /** + * Main method where the analysis code resides, executed once for each run + * + * The main body of the module code is contained in this method. The different + * object collections are extracted from the run and are passed to the + * respective comparison methods for processing of each object type. + * + * @param edm::Event const & Reference to event object + * @param edm::EventSetup const & Reference to event configuration object + * + * @return void + */ + void analyze (const edm::Event&, const edm::EventSetup&) override; + + private: + + /** + * Encapsulates the code required for performing a comparison of + * the jets contained in a given event. + * + * Method is called once per each event with the jet collections associated + * with the event being extracted for bx = 0 as the RAW information required + * to run the emulator is only available for bx 0. The implementation checks + * if the size of collections is the same and when so, compares the jets in + * the same positions within the data/emul collections. When a discrepancy is + * found, the properties (Et, eta, phi) of the problematic data/emul objects + * are stored in dedicated histograms. In cases of differences, a distinction + * is made between objects whose energy or position are in disagremeent.When + * the length of data/emul collections is different, all of the objects are + * "stored" in the histograms dedicated to problematic objects. + * + * @param edm::Handle& dataCol Reference to jet + * collection from data + * @param edm::Handle& emulCol Reference to jet + * collection from emulation + * + * @return bool Flag of whether the agreement was perfect + */ + bool compareJets(const edm::Handle & dataCol, + const edm::Handle & emulCol); + + /** + * Encapsulates the code required for performing a comparison of + * the e/gs contained in a given event. + * + * Method is called once per each event with the e/g collections associated + * with the event being extracted for bx = 0 as the RAW information required + * to run the emulator is only available for bx 0. The implementation checks + * if the size of collections is the same and when so, compares the e/gs in + * the same positions within the data/emul collections. When a discrepancy is + * found, the properties (Et, eta, phi) of the problematic data/emul objects + * are stored in dedicated histograms. In cases of differences, a distinction + * is made between objects whose energy or position are in disagremeent. + * Another distinction is made between isolated and non-isolated e/g + * candidates and problematic objects are handled accordingly. When the length + * of data/emul collections is different, all of the objects are "stored" in + * the histograms dedicated to problematic objects. + * + * @param edm::Handle& dataCol Reference to e/gamma + * collection from data + * @param edm::Handle& emulCol Reference to e/gamma + * collection from emulation + * + * @return bool Flag of whether the agreement was perfect + */ + bool compareEGs(const edm::Handle & dataCol, + const edm::Handle & emulCol); + + /** + * Encapsulates the code required for performing a comparison of + * the taus contained in a given event. + * + * Method is called once per each event with the tau collections associated + * with the event being extracted for bx = 0 as the RAW information required + * to run the emulator is only available for bx 0. The implementation checks + * if the size of collections is the same and when so, compares the taus in + * the same positions within the data/emul collections. When a discrepancy is + * found, the properties (Et, eta, phi) of the problematic data/emul objects + * are stored in dedicated histograms. In cases of differences, a distinction + * is made between objects whose energy or position are in disagremeent. + * Another distinction is made between isolated and non-isolated tau + * candidates and problematic objects are handled accordingly. When the length + * of data/emul collections is different, all of the objects are "stored" in + * the histograms dedicated to problematic objects. + * + * @param edm::Handle& dataCol Reference to tau + * collection from data + * @param edm::Handle& emulCol Reference to tau + * collection from emulation + * + * @return bool Flag of whether the agreement was perfect + */ + bool compareTaus(const edm::Handle & dataCol, + const edm::Handle & emulCol); + + /** + * Encapsulates the code required for performing a comparison of + * the taus contained in a given event. + * + * Method is called once per each event with the sum collections associated + * with the event being extracted for bx = 0 as the RAW information required + * to run the emulator is only available for bx 0. The implementation loops + * over the collection and depending of the sum type, each variant is compared + * independently. If any disagreement is found, the event is marked a bad and + * the properties of the sum are stored in the data/emulator problematic + * histograms. + * + * @param edm::Handle& dataCol Reference to tau + * collection from data + * @param edm::Handle& emulCol Reference to tau + * collection from emulation + * + * @return bool Flag of whether the agreement was perfect + */ + bool compareSums(const edm::Handle & dataCol, + const edm::Handle & emulCol); + + // Holds the name of directory in DQM where module hostograms will be shown. + // Value is taken from python configuration file (passed in class constructor) + std::string monitorDir; + + // collections to hold entities reconstructed from data and emulation + edm::EDGetTokenT calol2JetCollectionData; + edm::EDGetTokenT calol2JetCollectionEmul; + edm::EDGetTokenT calol2EGammaCollectionData; + edm::EDGetTokenT calol2EGammaCollectionEmul; + edm::EDGetTokenT calol2TauCollectionData; + edm::EDGetTokenT calol2TauCollectionEmul; + edm::EDGetTokenT calol2EtSumCollectionData; + edm::EDGetTokenT calol2EtSumCollectionEmul; + + enum summaryBins { + NEVENTS = 1, // total number of events + EVENTGOOD, // number of good events (100% agreement) + NJETS_S, // total number of jets objects found + JETGOOD_S, // number of jets in agreement (energy and pos) + NEGS_S, // total number of e/g objects found + EGGOOD_S, // number of e/g in agremeent (energy and pos) + NTAUS_S, // total number of tau objects found + TAUGOOD_S, // number of taus in agremenet (energy and pos) + NSUMS_S, // total number of sums + SUMGOOD_S // number of good sums across all events + }; + + enum problemCauses { + NEVENTS_P = 1, // total number of events + JETCOLLSIZE, // no. events with different data/emul obj. in jet coll. + EGCOLLSIZE, // no. events with different data/emul obj. in eg coll. + TAUCOLLSIZE, // no. events with different data/emul obj. in tau coll. + JETMISMATCH, // no. events failed due to a jet mismatch + EGMISMATCH, // no. events failed due to an e/g mismatch + TAUMISMATCH, // no. events failed due to a tau mismatch + SUMMISMATCH // no. events failed due to a sum mismatch + }; + + enum jetVars { + NJETS = 1, + JETGOOD, + JETPOSOFF, + JETETOFF + }; + + enum egVars { + NEGS = 1, + EGGOOD, + EGPOSOFF, + EGETOFF, + NISOEGS, + ISOEGGOOD, + ISOEGPOSOFF, + ISOEGETOFF + }; + + enum tauVars { + NTAUS = 1, + TAUGOOD, + TAUPOSOFF, + TAUETOFF, + NISOTAUS, + ISOTAUGOOD, + ISOTAUPOSOFF, + ISOTAUETOFF + }; + + enum sumVars { + NSUMS = 1, + SUMGOOD, + NETTSUMS, + ETTSUMGOOD, + NHTTSUMS, + HTTSUMGOOD, + NMETSUMS, + METSUMGOOD, + NMHTSUMS, + MHTSUMGOOD, + NMBHFSUMS, + MBHFSUMGOOD, + NTOWCOUNTS, + TOWCOUNTGOOD + }; + + // objects to represent individual plots shown in DQM + MonitorElement * agreementSummary; + MonitorElement * jetSummary; + MonitorElement * tauSummary; + MonitorElement * egSummary; + MonitorElement * sumSummary; + MonitorElement * problemSummary; + + // histograms to store the properties of mismatched jets + MonitorElement * jetEtData; + MonitorElement * jetEtaData; + MonitorElement * jetPhiData; + MonitorElement * jetEtEmul; + MonitorElement * jetEtaEmul; + MonitorElement * jetPhiEmul; + + // histograms to store the properties of mismatched non-isolated e/g + MonitorElement * egEtData; + MonitorElement * egEtaData; + MonitorElement * egPhiData; + MonitorElement * egEtEmul; + MonitorElement * egEtaEmul; + MonitorElement * egPhiEmul; + + // histograms to store the properties of mismatched isolated e/g + MonitorElement * isoEgEtData; + MonitorElement * isoEgEtaData; + MonitorElement * isoEgPhiData; + MonitorElement * isoEgEtEmul; + MonitorElement * isoEgEtaEmul; + MonitorElement * isoEgPhiEmul; + + // histograms to store the properties of mismatched non-isolated taus + MonitorElement * tauEtData; + MonitorElement * tauEtaData; + MonitorElement * tauPhiData; + MonitorElement * tauEtEmul; + MonitorElement * tauEtaEmul; + MonitorElement * tauPhiEmul; + + // histograms to store the properties of mismatched isolated taus + MonitorElement * isoTauEtData; + MonitorElement * isoTauEtaData; + MonitorElement * isoTauPhiData; + MonitorElement * isoTauEtEmul; + MonitorElement * isoTauEtaEmul; + MonitorElement * isoTauPhiEmul; + + // histograms for mismatched ett sums + MonitorElement * ettData; + MonitorElement * ettEmul; + MonitorElement * ettHFData; + MonitorElement * ettHFEmul; + MonitorElement * ettEmData; + MonitorElement * ettEmEmul; + + // mismatched htt sums + MonitorElement * httData; + MonitorElement * httEmul; + MonitorElement * httHFData; + MonitorElement * httHFEmul; + + // mismatched met sums + MonitorElement * metEtData; + MonitorElement * metEtEmul; + MonitorElement * metPhiData; + MonitorElement * metPhiEmul; + MonitorElement * metHFEtData; + MonitorElement * metHFEtEmul; + MonitorElement * metHFPhiData; + MonitorElement * metHFPhiEmul; + + // mismatched mht sums + MonitorElement * mhtEtData; + MonitorElement * mhtEtEmul; + MonitorElement * mhtPhiData; + MonitorElement * mhtPhiEmul; + MonitorElement * mhtHFEtData; + MonitorElement * mhtHFEtEmul; + MonitorElement * mhtHFPhiData; + MonitorElement * mhtHFPhiEmul; + + // mismatched min bias sums + MonitorElement * mbhfp0Data; + MonitorElement * mbhfp0Emul; + MonitorElement * mbhfm0Data; + MonitorElement * mbhfm0Emul; + MonitorElement * mbhfp1Data; + MonitorElement * mbhfp1Emul; + MonitorElement * mbhfm1Data; + MonitorElement * mbhfm1Emul; + + // mismatched towercount sum + MonitorElement * towCountData; + MonitorElement * towCountEmul; + + bool verbose; + + // use only bx = 0 since it only contains RAW data (needed for emulator) + const unsigned int currBx = 0; +}; + +#endif diff --git a/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py b/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py index 83b52db517e5d..d555e5b6d019e 100644 --- a/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py +++ b/DQM/L1TMonitor/python/L1TStage2Emulator_cff.py @@ -113,6 +113,7 @@ from DQM.L1TMonitor.L1TdeStage2CaloLayer1_cfi import * # CaloLayer2 +from DQM.L1TMonitor.L1TdeStage2CaloLayer2_cfi import * from DQM.L1TMonitor.L1TStage2CaloLayer2_cfi import * from DQM.L1TMonitor.L1TStage2CaloLayer2Emul_cfi import * @@ -138,6 +139,7 @@ l1tdeStage2CaloLayer1 + # We process both layer2 and layer2emu in same sourceclient # to be able to divide them in the MonitorClient + l1tdeStage2CaloLayer2 + l1tStage2CaloLayer2 + l1tStage2CaloLayer2Emul + l1tdeStage2Bmtf + l1tdeStage2Omtf + diff --git a/DQM/L1TMonitor/python/L1TdeStage2CaloLayer2_cfi.py b/DQM/L1TMonitor/python/L1TdeStage2CaloLayer2_cfi.py new file mode 100644 index 0000000000000..7eb14d2b7f4ef --- /dev/null +++ b/DQM/L1TMonitor/python/L1TdeStage2CaloLayer2_cfi.py @@ -0,0 +1,13 @@ +import FWCore.ParameterSet.Config as cms + +l1tdeStage2CaloLayer2 = cms.EDAnalyzer("L1TdeStage2CaloLayer2", + calol2JetCollectionData = cms.InputTag("caloStage2Digis", "Jet"), + calol2JetCollectionEmul = cms.InputTag("valCaloStage2Layer2Digis"), + calol2EGammaCollectionData = cms.InputTag("caloStage2Digis", "EGamma"), + calol2EGammaCollectionEmul = cms.InputTag("valCaloStage2Layer2Digis"), + calol2TauCollectionData = cms.InputTag("caloStage2Digis", "Tau"), + calol2TauCollectionEmul = cms.InputTag("valCaloStage2Layer2Digis"), + calol2EtSumCollectionData = cms.InputTag("caloStage2Digis", "EtSum"), + calol2EtSumCollectionEmul = cms.InputTag("valCaloStage2Layer2Digis"), + monitorDir = cms.untracked.string("L1TEMU/L1TdeStage2CaloLayer2") +) diff --git a/DQM/L1TMonitor/src/L1TStage2CaloLayer2.cc b/DQM/L1TMonitor/src/L1TStage2CaloLayer2.cc index 1060c9c795fe6..4417d0104fa98 100644 --- a/DQM/L1TMonitor/src/L1TStage2CaloLayer2.cc +++ b/DQM/L1TMonitor/src/L1TStage2CaloLayer2.cc @@ -19,83 +19,96 @@ void L1TStage2CaloLayer2::bookHistograms(DQMStore::IBooker &ibooker, edm::Run co //central jet ibooker.setCurrentFolder(monitorDir_+"/Central-Jets"); - stage2CaloLayer2CenJetEtEtaPhi_ = ibooker.book2D("CenJetsEtEtaPhi", "CENTRAL JET E_{T} ETA PHI", 229, -114.5, 114.5, 144, -0.5, 143.5); - stage2CaloLayer2CenJetEta_ = ibooker.book1D("CenJetsEta", "CENTRAL JET ETA", 229, -114.5, 114.5); - stage2CaloLayer2CenJetPhi_ = ibooker.book1D("CenJetsPhi", "CENTRAL JET PHI", 144, -0.5, 143.5); - stage2CaloLayer2CenJetRank_ = ibooker.book1D("CenJetsRank", "CENTRAL JET E_{T}", 2048, -0.5, 2047.5); - stage2CaloLayer2CenJetOcc_ = ibooker.book2D("CenJetsOcc", "CENTRAL JET OCCUPANCY", 229, -114.5, 114.5, 144, -0.5, 143.5); - stage2CaloLayer2CenJetBxOcc_ = ibooker.book2D("CenJetsBxOcc", "CENTRAL JET BX OCCUPANCY", 5,-2.5, 2.5, 512, -0.5, 2047.5); - stage2CaloLayer2CenJetQual_ = ibooker.book1D("CenJetsQual", "CENTRAL JET QUALITY", 32, -0.5, 31.5); + stage2CaloLayer2CenJetEtEtaPhi_ = ibooker.book2D("CenJetsEtEtaPhi", "CENTRAL JET E_{T} ETA PHI; Jet i#eta; Jet i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5); + stage2CaloLayer2CenJetEta_ = ibooker.book1D("CenJetsEta", "CENTRAL JET ETA; Jet i#eta; Counts", 229, -114.5, 114.5); + stage2CaloLayer2CenJetPhi_ = ibooker.book1D("CenJetsPhi", "CENTRAL JET PHI; Jet i#phi; Counts", 144, -0.5, 143.5); + stage2CaloLayer2CenJetRank_ = ibooker.book1D("CenJetsRank", "CENTRAL JET E_{T}; Jet iE_{T}; Counts", 2048, -0.5, 2047.5); + stage2CaloLayer2CenJetOcc_ = ibooker.book2D("CenJetsOcc", "CENTRAL JET OCCUPANCY; i#eta; i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5); + stage2CaloLayer2CenJetBxOcc_ = ibooker.book2D("CenJetsBxOcc", "CENTRAL JET BX OCCUPANCY; BX; Counts", 5,-2.5, 2.5, 512, -0.5, 2047.5); + stage2CaloLayer2CenJetQual_ = ibooker.book1D("CenJetsQual", "CENTRAL JET QUALITY; Quality; Counts", 32, -0.5, 31.5); //forward jet ibooker.setCurrentFolder(monitorDir_+"/Forward-Jets"); - stage2CaloLayer2ForJetEtEtaPhi_ = ibooker.book2D("ForJetsEtEtaPhi", "FORWARD JET E_{T} ETA PHI", 229, -114.5, 114.5, 144, -0.5, 143.5); - stage2CaloLayer2ForJetEta_ = ibooker.book1D("ForJetsEta", "FORWARD JET ETA", 229, -114.5, 114.5); - stage2CaloLayer2ForJetPhi_ = ibooker.book1D("ForJetsPhi", "FORWARD JET PHI", 144, -0.5, 143.5); - stage2CaloLayer2ForJetRank_ = ibooker.book1D("ForJetsRank", "FORWARD JET E_{T}", 2048, -0.5, 2047.5); - stage2CaloLayer2ForJetOcc_ = ibooker.book2D("ForJetsOcc", "FORWARD JET OCCUPANCy", 229, -114.5, 114.5, 144, -0.5, 143.5); - stage2CaloLayer2ForJetBxOcc_ = ibooker.book2D("ForJetsBxOcc", "FORWARD JET BX OCCUPANCY", 5,-2.5, 2.5, 512, -0.5, 2047.5); - stage2CaloLayer2ForJetQual_ = ibooker.book1D("ForJetsQual", "FORWARD JET QUALITY", 32, -0.5, 31.5); + stage2CaloLayer2ForJetEtEtaPhi_ = ibooker.book2D("ForJetsEtEtaPhi", "FORWARD JET E_{T} ETA PHI; Jet i#eta; Jet i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5); + stage2CaloLayer2ForJetEta_ = ibooker.book1D("ForJetsEta", "FORWARD JET ETA; Jet i#eta; Counts", 229, -114.5, 114.5); + stage2CaloLayer2ForJetPhi_ = ibooker.book1D("ForJetsPhi", "FORWARD JET PHI; Jet i#phi; Counts", 144, -0.5, 143.5); + stage2CaloLayer2ForJetRank_ = ibooker.book1D("ForJetsRank", "FORWARD JET E_{T}; Jet iE_{T}; Counts", 2048, -0.5, 2047.5); + stage2CaloLayer2ForJetOcc_ = ibooker.book2D("ForJetsOcc", "FORWARD JET OCCUPANCY; Jet i#eta; Jet i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5); + stage2CaloLayer2ForJetBxOcc_ = ibooker.book2D("ForJetsBxOcc", "FORWARD JET BX OCCUPANCY; BX; Counts", 5,-2.5, 2.5, 512, -0.5, 2047.5); + stage2CaloLayer2ForJetQual_ = ibooker.book1D("ForJetsQual", "FORWARD JET QUALITY; Quality; Counts", 32, -0.5, 31.5); //IsoEG ibooker.setCurrentFolder(monitorDir_+"/Isolated-EG"); - stage2CaloLayer2EGIso_ = ibooker.book1D("EGIso", "EG ISO", 4, -0.5, 3.5); - stage2CaloLayer2IsoEGEtEtaPhi_ = ibooker.book2D("IsoEGsEtEtaPhi", "ISO EG E_{T} ETA PHI", 229, -114.5, 114.5, 144, -0.5, 143.5); - stage2CaloLayer2IsoEGEta_ = ibooker.book1D("IsoEGsEta", "ISO EG ETA", 229, -114.5, 114.5); - stage2CaloLayer2IsoEGPhi_ = ibooker.book1D("IsoEGsPhi", "ISO EG PHI", 144, -0.5, 143.5); - stage2CaloLayer2IsoEGRank_ = ibooker.book1D("IsoEGsRank", "ISO EG E_{T}", 512, -0.5, 511.5); - stage2CaloLayer2IsoEGOcc_ = ibooker.book2D("IsoEGsOcc", "ISO EG OCCUPANCY", 229, -114.5, 114.5, 144, -0.5, 143.5); - stage2CaloLayer2IsoEGBxOcc_ = ibooker.book2D("IsoEGsBxOcc", "ISO EG BX OCCUPANCY", 5,-2.5, 2.5, 128, -0.5, 511.5); - stage2CaloLayer2IsoEGQual_ = ibooker.book1D("IsoEGsQual", "ISO EG QUALITY", 32, -0.5, 31.5); + stage2CaloLayer2EGIso_ = ibooker.book1D("EGIso", "EG ISO; Iso Flag; Counts", 4, -0.5, 3.5); + stage2CaloLayer2IsoEGEtEtaPhi_ = ibooker.book2D("IsoEGsEtEtaPhi", "ISO EG E_{T} ETA PHI; i#eta; i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5); + stage2CaloLayer2IsoEGEta_ = ibooker.book1D("IsoEGsEta", "ISO EG ETA; EG i#eta; Counts", 229, -114.5, 114.5); + stage2CaloLayer2IsoEGPhi_ = ibooker.book1D("IsoEGsPhi", "ISO EG PHI; EG i#phi; Counts", 144, -0.5, 143.5); + stage2CaloLayer2IsoEGRank_ = ibooker.book1D("IsoEGsRank", "ISO EG E_{T}; EG iE_{T}; Counts", 512, -0.5, 511.5); + stage2CaloLayer2IsoEGOcc_ = ibooker.book2D("IsoEGsOcc", "ISO EG OCCUPANCY; i#eta; i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5); + stage2CaloLayer2IsoEGBxOcc_ = ibooker.book2D("IsoEGsBxOcc", "ISO EG BX OCCUPANCY; BX; Counts", 5,-2.5, 2.5, 128, -0.5, 511.5); + stage2CaloLayer2IsoEGQual_ = ibooker.book1D("IsoEGsQual", "ISO EG QUALITY; Quality; Counts", 32, -0.5, 31.5); //NonIsoEG ibooker.setCurrentFolder(monitorDir_+"/NonIsolated-EG"); - stage2CaloLayer2NonIsoEGEtEtaPhi_ = ibooker.book2D("NonIsoEGsEtEtaPhi", "NonISO EG E_{T} ETA PHI", 229, -114.5, 114.5, 144, -0.5, 143.5); - stage2CaloLayer2NonIsoEGEta_ = ibooker.book1D("NonIsoEGsEta", "NonISO EG ETA", 229, -114.5, 114.5); - stage2CaloLayer2NonIsoEGPhi_ = ibooker.book1D("NonIsoEGsPhi", "NonISO EG PHI", 144, -0.5, 143.5); - stage2CaloLayer2NonIsoEGRank_ = ibooker.book1D("NonIsoEGsRank", "NonISO EG E_{T}", 512, -0.5, 511.5); - stage2CaloLayer2NonIsoEGOcc_ = ibooker.book2D("NonIsoEGsOcc", "NonISO EG OCCUPANCY", 229, -114.5, 114.5, 144, -0.5, 143.5); - stage2CaloLayer2NonIsoEGBxOcc_ = ibooker.book2D("NonIsoEGsBxOcc", "NonISO EG BX OCCUPANCY", 5,-2.5, 2.5, 128, -0.5, 511.5); - stage2CaloLayer2NonIsoEGQual_ = ibooker.book1D("NonIsoEGsQual", "NonISO EG QUALITY", 32, -0.5, 31.5); + stage2CaloLayer2NonIsoEGEtEtaPhi_ = ibooker.book2D("NonIsoEGsEtEtaPhi", "NonISO EG E_{T} ETA PHI; i#eta; i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5); + stage2CaloLayer2NonIsoEGEta_ = ibooker.book1D("NonIsoEGsEta", "NonISO EG ETA; NonISO EG i#eta; Counts", 229, -114.5, 114.5); + stage2CaloLayer2NonIsoEGPhi_ = ibooker.book1D("NonIsoEGsPhi", "NonISO EG PHI; NonISO EG i#phi; Counts", 144, -0.5, 143.5); + stage2CaloLayer2NonIsoEGRank_ = ibooker.book1D("NonIsoEGsRank", "NonISO EG E_{T}; NonISO EG iE_{T}; Counts", 512, -0.5, 511.5); + stage2CaloLayer2NonIsoEGOcc_ = ibooker.book2D("NonIsoEGsOcc", "NonISO EG OCCUPANCY; i#eta; i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5); + stage2CaloLayer2NonIsoEGBxOcc_ = ibooker.book2D("NonIsoEGsBxOcc", "NonISO EG BX OCCUPANCY; BX; Counts", 5,-2.5, 2.5, 128, -0.5, 511.5); + stage2CaloLayer2NonIsoEGQual_ = ibooker.book1D("NonIsoEGsQual", "NonISO EG QUALITY; Quality; Counts", 32, -0.5, 31.5); //IsoTau ibooker.setCurrentFolder(monitorDir_+"/Isolated-Tau"); - stage2CaloLayer2TauIso_ = ibooker.book1D("TauIso", "Tau ISO", 4, -0.5, 3.5); - stage2CaloLayer2IsoTauEtEtaPhi_ = ibooker.book2D("IsoTausEtEtaPhi", "ISO Tau E_{T} ETA PHI", 229, -114.5, 114.5, 144, -0.5, 143.5); - stage2CaloLayer2IsoTauEta_ = ibooker.book1D("IsoTausEta", "ISO Tau ETA", 229, -114.5, 114.5); - stage2CaloLayer2IsoTauPhi_ = ibooker.book1D("IsoTausPhi", "ISO Tau PHI", 144, -0.5, 143.5); - stage2CaloLayer2IsoTauRank_ = ibooker.book1D("IsoTausRank", "ISO Tau E_{T}", 512, -0.5, 511.5); - stage2CaloLayer2IsoTauOcc_ = ibooker.book2D("IsoTausOcc", "ISO Tau OCCUPANCY", 229, -114.5, 114.5, 144, -0.5, 143.5); - stage2CaloLayer2IsoTauBxOcc_ = ibooker.book2D("IsoTausBxOcc", "ISO Tau BX OCCUPANCY", 5,-2.5, 2.5, 128, -0.5, 511.5); - stage2CaloLayer2IsoTauQual_ = ibooker.book1D("IsoTausQual", "ISO Tau QUALITY", 32, -0.5, 31.5); + stage2CaloLayer2TauIso_ = ibooker.book1D("TauIso", "Tau ISO; Iso Flag; Counts", 4, -0.5, 3.5); + stage2CaloLayer2IsoTauEtEtaPhi_ = ibooker.book2D("IsoTausEtEtaPhi", "ISO Tau E_{T} ETA PHI; i#eta; i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5); + stage2CaloLayer2IsoTauEta_ = ibooker.book1D("IsoTausEta", "ISO Tau ETA; ISO Tau i#eta; Counts", 229, -114.5, 114.5); + stage2CaloLayer2IsoTauPhi_ = ibooker.book1D("IsoTausPhi", "ISO Tau PHI; ISO Tau i#phi; Counts", 144, -0.5, 143.5); + stage2CaloLayer2IsoTauRank_ = ibooker.book1D("IsoTausRank", "ISO Tau E_{T}; ISO Tau iE_{T}; Counts", 512, -0.5, 511.5); + stage2CaloLayer2IsoTauOcc_ = ibooker.book2D("IsoTausOcc", "ISO Tau OCCUPANCY; i#eta; i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5); + stage2CaloLayer2IsoTauBxOcc_ = ibooker.book2D("IsoTausBxOcc", "ISO Tau BX OCCUPANCY; BX; Counts", 5,-2.5, 2.5, 128, -0.5, 511.5); + stage2CaloLayer2IsoTauQual_ = ibooker.book1D("IsoTausQual", "ISO Tau QUALITY; Quality; Counts", 32, -0.5, 31.5); //NonIsoTau ibooker.setCurrentFolder(monitorDir_+"/NonIsolated-Tau"); - stage2CaloLayer2TauEtEtaPhi_ = ibooker.book2D("TausEtEtaPhi", "Tau E_{T} ETA PHI", 229, -114.5, 114.5, 144, -0.5, 143.5); - stage2CaloLayer2TauEta_ = ibooker.book1D("TausEta", "NonISO Tau ETA", 229, -114.5, 114.5); - stage2CaloLayer2TauPhi_ = ibooker.book1D("TausPhi", "NonISO Tau PHI", 144, -0.5, 143.5); - stage2CaloLayer2TauRank_ = ibooker.book1D("TausRank", "NonISO Tau E_{T}", 512, -0.5, 511.5); - stage2CaloLayer2TauOcc_ = ibooker.book2D("TausOcc", "NonISO Tau OCCUPANCY", 229, -114.5, 114.5, 144, -0.5, 143.5); - stage2CaloLayer2TauBxOcc_ = ibooker.book2D("TausBxOcc", "NonISO Tau BX OCCUPANCY", 5,-2.5, 2.5, 128, -0.5, 511.5); - stage2CaloLayer2TauQual_ = ibooker.book1D("TausQual", "NonISO Tau QUALITY", 32, -0.5, 31.5); + stage2CaloLayer2TauEtEtaPhi_ = ibooker.book2D("TausEtEtaPhi", "Tau E_{T} ETA PHI; i#eta; i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5); + stage2CaloLayer2TauEta_ = ibooker.book1D("TausEta", "NonISO Tau ETA; Tau i#eta; Counts", 229, -114.5, 114.5); + stage2CaloLayer2TauPhi_ = ibooker.book1D("TausPhi", "NonISO Tau PHI; Tau i#phi; Counts", 144, -0.5, 143.5); + stage2CaloLayer2TauRank_ = ibooker.book1D("TausRank", "NonISO Tau E_{T}; Tau iE_{T}; Counts", 512, -0.5, 511.5); + stage2CaloLayer2TauOcc_ = ibooker.book2D("TausOcc", "NonISO Tau OCCUPANCY; i#eta; i#phi", 229, -114.5, 114.5, 144, -0.5, 143.5); + stage2CaloLayer2TauBxOcc_ = ibooker.book2D("TausBxOcc", "NonISO Tau BX OCCUPANCY; BX; Counts", 5,-2.5, 2.5, 128, -0.5, 511.5); + stage2CaloLayer2TauQual_ = ibooker.book1D("TausQual", "NonISO Tau QUALITY; Quality; Counts", 32, -0.5, 31.5); //EtSums ibooker.setCurrentFolder(monitorDir_+"/Energy-Sums"); - stage2CaloLayer2EtSumBxOcc_ = ibooker.book2D("EtSumBxOcc", "EtSum BX OCCUPANCY", 5,-2.5, 2.5, 1024, -0.5, 4095.5); - stage2CaloLayer2METRank_ = ibooker.book1D("METRank", "MET E_{T}", 4096, -0.5, 4095.5); - stage2CaloLayer2METPhi_ = ibooker.book1D("METPhi", "MET Phi", 144, -0.5, 143.5); - stage2CaloLayer2ETTRank_ = ibooker.book1D("ETTRank", "ETT E_{T}", 4096, -0.5, 4095.5); - stage2CaloLayer2MHTRank_ = ibooker.book1D("MHTRank", "MHT E_{T}", 4096, -0.5, 4095.5); - stage2CaloLayer2MHTPhi_ = ibooker.book1D("MHTPhi", "MHT Phi", 144, -0.5, 143.5); - stage2CaloLayer2HTTRank_ = ibooker.book1D("HTTRank", "HTT E_{T}", 4096, -0.5, 4095.5); + stage2CaloLayer2EtSumBxOcc_ = ibooker.book2D("EtSumBxOcc", "EtSum BX OCCUPANCY; BX; Counts", 5,-2.5, 2.5, 1024, -0.5, 4095.5); + stage2CaloLayer2METRank_ = ibooker.book1D("METRank", "MET E_{T}; iE_{T}; Counts", 4096, -0.5, 4095.5); + stage2CaloLayer2METPhi_ = ibooker.book1D("METPhi", "MET Phi; MET i#Phi; Counts", 144, -0.5, 143.5); + stage2CaloLayer2ETTRank_ = ibooker.book1D("ETTRank", "ETT E_{T}; ETT iE_{T}; Counts", 4096, -0.5, 4095.5); + stage2CaloLayer2MHTRank_ = ibooker.book1D("MHTRank", "MHT E_{T}; MHT iE_{T}; Counts", 4096, -0.5, 4095.5); + stage2CaloLayer2MHTPhi_ = ibooker.book1D("MHTPhi", "MHT Phi; MHT i#phi; Counts", 144, -0.5, 143.5); + stage2CaloLayer2HTTRank_ = ibooker.book1D("HTTRank", "HTT E_{T}; HTT iE_{T}; Counts", 4096, -0.5, 4095.5); + stage2CaloLayer2METHFRank_ = ibooker.book1D("METHFRank", "METHF E_{T}; METHF iE_{T}; Counts", 4096, -0.5, 4095.5); + stage2CaloLayer2METHFPhi_ = ibooker.book1D("METHFPhi", "METHF Phi; METHF i#phi; Counts", 144, -0.5, 143.5); + // stage2CaloLayer2ETTHFRank_ = ibooker.book1D("ETTHFRank", "ETTHF E_{T}", 4096, -0.5, 4095.5); + stage2CaloLayer2MHTHFRank_ = ibooker.book1D("MHTHFRank", "MHTHF E_{T}; MHTHF iE_{T}; Counts", 4096, -0.5, 4095.5); + stage2CaloLayer2MHTHFPhi_ = ibooker.book1D("MHTHFPhi", "MHTHF Phi; MHTHF i#phi; Counts", 144, -0.5, 143.5); + // stage2CaloLayer2HTTHFRank_ = ibooker.book1D("HTTHFRank", "HTTHF E_{T}", 4096, -0.5, 4095.5); + stage2CaloLayer2ETTEMRank_ = ibooker.book1D("ETTEMRank", "ETTEM E_{T}; ETTEM iE_{T}; Counts", 4096, -0.5, 4095.5); + stage2CaloLayer2MinBiasHFP0_ = ibooker.book1D("MinBiasHFP0", "HF Min Bias Sum Threshold 0, Positive #eta; N_{towers}; Events", 16, -0.5, 15.5); + stage2CaloLayer2MinBiasHFM0_ = ibooker.book1D("MinBiasHFM0", "HF Min Bias Sum Threshold 1, Nevagive #eta; N_{towers}; Events", 16, -0.5, 15.5); + stage2CaloLayer2MinBiasHFP1_ = ibooker.book1D("MinBiasHFP1", "HF Min Bias Sum Threshold 1, Positive #eta; N_{towers}; Events", 16, -0.5, 15.5); + stage2CaloLayer2MinBiasHFM1_ = ibooker.book1D("MinBiasHFM1", "HF Min Bias Sum Threshold 1, Negative #eta; N_{towers}; Events", 16, -0.5, 15.5); + + stage2CaloLayer2TowCount_ = ibooker.book1D("TowCount", "Count of Trigger towers above threshold; N_{towers}; Events", 5904, -0.5, 5903.5); ibooker.setCurrentFolder(monitorDir_+"/Timing"); timingStage2CaloLayer2CenJetBxOcc_ = stage2CaloLayer2CenJetBxOcc_; @@ -232,14 +245,36 @@ void L1TStage2CaloLayer2::analyze(const edm::Event & e, const edm::EventSetup & stage2CaloLayer2EtSumBxOcc_->Fill(itBX, itEtSum->hwPt()); if (itBX==0){ - if(l1t::EtSum::EtSumType::kMissingEt == itEtSum->getType()){; + if(l1t::EtSum::EtSumType::kMissingEt == itEtSum->getType()){; // MET stage2CaloLayer2METRank_->Fill(itEtSum->hwPt()); stage2CaloLayer2METPhi_->Fill(itEtSum->hwPhi()); - } else if(l1t::EtSum::EtSumType::kTotalEt == itEtSum->getType()){ + } else if(l1t::EtSum::EtSumType::kMissingEtHF == itEtSum->getType()){ // METHF + stage2CaloLayer2METHFRank_->Fill(itEtSum->hwPt()); + stage2CaloLayer2METHFPhi_->Fill(itEtSum->hwPhi()); + } else if(l1t::EtSum::EtSumType::kTotalEt == itEtSum->getType()){ // ETT stage2CaloLayer2ETTRank_->Fill(itEtSum->hwPt()); - } else if(l1t::EtSum::EtSumType::kMissingHt == itEtSum->getType()){ + //} else if(l1t::EtSum::EtSumType::kTotalEtHF == itEtSum->getType()){ // ETTHF + // stage2CaloLayer2ETTHFRank_->Fill(itEtSum->hwPt()); + } else if(l1t::EtSum::EtSumType::kMissingHt == itEtSum->getType()){ // MHT stage2CaloLayer2MHTRank_->Fill(itEtSum->hwPt()); stage2CaloLayer2MHTPhi_->Fill(itEtSum->hwPhi()); + } else if(l1t::EtSum::EtSumType::kMissingHtHF == itEtSum->getType()){ // MHTHF + stage2CaloLayer2MHTHFRank_->Fill(itEtSum->hwPt()); + stage2CaloLayer2MHTHFPhi_->Fill(itEtSum->hwPhi()); + } else if(l1t::EtSum::EtSumType::kMinBiasHFP0 == itEtSum->getType()){ // MBHFP0 + stage2CaloLayer2MinBiasHFP0_->Fill(itEtSum->hwPt()); + } else if(l1t::EtSum::EtSumType::kMinBiasHFM0 == itEtSum->getType()){ // MBHFM0 + stage2CaloLayer2MinBiasHFM0_->Fill(itEtSum->hwPt()); + } else if(l1t::EtSum::EtSumType::kMinBiasHFP1 == itEtSum->getType()){ // MBHFP1 + stage2CaloLayer2MinBiasHFP1_->Fill(itEtSum->hwPt()); + } else if(l1t::EtSum::EtSumType::kMinBiasHFM1 == itEtSum->getType()){ // MBHFM1 + stage2CaloLayer2MinBiasHFM1_->Fill(itEtSum->hwPt()); + //} else if(l1t::EtSum::EtSumType::kTotalHtHF == itEtSum->getType()){ // HTTHF + //stage2CaloLayer2HTTHFRank_->Fill(itEtSum->hwPt()); + } else if(l1t::EtSum::EtSumType::kTotalEtEm == itEtSum->getType()){ // ETTEM + stage2CaloLayer2ETTEMRank_->Fill(itEtSum->hwPt()); + } else if (l1t::EtSum::EtSumType::kTowerCount == itEtSum->getType()) { + stage2CaloLayer2TowCount_->Fill(itEtSum->hwPt()); } else{ stage2CaloLayer2HTTRank_->Fill(itEtSum->hwPt()); } diff --git a/DQM/L1TMonitor/src/L1TdeStage2CaloLayer2.cc b/DQM/L1TMonitor/src/L1TdeStage2CaloLayer2.cc new file mode 100644 index 0000000000000..ef02c1c4faf58 --- /dev/null +++ b/DQM/L1TMonitor/src/L1TdeStage2CaloLayer2.cc @@ -0,0 +1,1429 @@ +#include "DQM/L1TMonitor/interface/L1TdeStage2CaloLayer2.h" + +L1TdeStage2CaloLayer2::L1TdeStage2CaloLayer2 (const edm::ParameterSet& ps) + : monitorDir(ps.getUntrackedParameter("monitorDir", "")), + calol2JetCollectionData(consumes ( + ps.getParameter( + "calol2JetCollectionData"))), + calol2JetCollectionEmul(consumes ( + ps.getParameter( + "calol2JetCollectionEmul"))), + calol2EGammaCollectionData(consumes ( + ps.getParameter( + "calol2EGammaCollectionData"))), + calol2EGammaCollectionEmul(consumes ( + ps.getParameter( + "calol2EGammaCollectionEmul"))), + calol2TauCollectionData(consumes ( + ps.getParameter( + "calol2TauCollectionData"))), + calol2TauCollectionEmul(consumes ( + ps.getParameter( + "calol2TauCollectionEmul"))), + calol2EtSumCollectionData(consumes ( + ps.getParameter( + "calol2EtSumCollectionData"))), + calol2EtSumCollectionEmul(consumes ( + ps.getParameter( + "calol2EtSumCollectionEmul"))), + verbose(ps.getUntrackedParameter ("verbose", false)) +{} + +void L1TdeStage2CaloLayer2::bookHistograms( + DQMStore::IBooker &ibooker, + edm::Run const &, + edm::EventSetup const&) { + + // DQM directory to store histograms with problematic jets + ibooker.setCurrentFolder(monitorDir + "/Problematic Jets candidates"); + + jetEtData = ibooker.book1D("Problematic Data Jet iEt", "Jet iE_{T}", + 1400, 0, 1399); + jetEtaData = ibooker.book1D("Problematic Data Jet iEta", "Jet i#eta", + 227, -113.5, 113.5); + jetPhiData = ibooker.book1D("Problematic Data Jet iPhi", "Jet i#phi", + 288, -0.5, 143.5); + jetEtEmul = ibooker.book1D("Problematic Emul Jet iEt", "Jet iE_{T}", + 1400, 0, 1399); + jetEtaEmul = ibooker.book1D("Problematic Emul Jet iEta", "Jet i#eta", + 227, -113.5, 113.5); + jetPhiEmul = ibooker.book1D("Problematic Emul Jet iPhi", "Jet i#phi", + 288, -0.5, 143.5); + + // DQM directory to store histograms with problematic e/gs + ibooker.setCurrentFolder(monitorDir + "/Problematic EG candidtes"); + + egEtData = ibooker.book1D("Problematic Data Eg iEt", "Eg iE_{T}", + 1400, 0, 1399); + egEtaData = ibooker.book1D("Problematic Data Eg iEta", "Eg i#eta", + 227, -113.5, 113.5); + egPhiData = ibooker.book1D("Problematic Data Eg iPhi", "Eg i#phi", + 288, -0.5, 143.5); + egEtEmul = ibooker.book1D("Problematic Emul Eg iEt", "Eg iE_{T}", + 1400, 0, 1399); + egEtaEmul = ibooker.book1D("Problematic Emul Eg iEta", "Eg i#eta", + 227, -113.5, 113.5); + egPhiEmul = ibooker.book1D("Problematic Emul Eg iPhi", "Eg i#phi", + 288, -0.5, 143.5); + + isoEgEtData = ibooker.book1D("Problematic Isolated Data Eg iEt", + "Iso Eg iE_{T}", 1400, 0, 1399); + isoEgEtaData = ibooker.book1D("Problematic Isolated Data Eg iEta", + "Iso Eg i#eta", 227, -113.5, 113.5); + isoEgPhiData = ibooker.book1D("Problematic Isolated Data Eg iPhi", + "Iso Eg i#phi", 288, -0.5, 143.5); + isoEgEtEmul = ibooker.book1D("Problematic Isolated Emul Eg iEt", + "Iso Eg iE_{T}", 1400, 0, 1399); + isoEgEtaEmul = ibooker.book1D("Problematic Isolated Emul Eg iEta", + "Iso Eg i#eta", 227, -113.5, 113.5); + isoEgPhiEmul = ibooker.book1D("Problematic Isolated Emul Eg iPhi", + "Iso Eg i#phi", 288, -0.5, 143.5); + + // DQM directory to store histograms with problematic taus + ibooker.setCurrentFolder(monitorDir + "/Problematic Tau candidtes"); + + tauEtData = ibooker.book1D("Problematic Data Tau iEt", "Tau iE_{T}", + 1400, 0, 1399); + tauEtaData = ibooker.book1D("Problematic Data Tau iEta", "Tau i#eta", + 227, -113.5, 113.5); + tauPhiData = ibooker.book1D("Problematic Data Tau iPhi", "Tau i#phi", + 288, -0.5, 143.5); + tauEtEmul = ibooker.book1D("Problematic Emul Tau iEt", "Tau iE_{T}", + 1400, 0, 1399); + tauEtaEmul = ibooker.book1D("Problematic Emul Tau iEta", "Tau i#eta", + 227, -113.5, 113.5); + tauPhiEmul = ibooker.book1D("Problematic Emul Tau iPhi", "Tau i#phi", + 288, -0.5, 143.5); + + isoTauEtData = ibooker.book1D("Problematic Isolated Data Tau iEt", + "Iso Tau iE_{T}", 1400, 0, 1399); + isoTauEtaData = ibooker.book1D("Problematic Isolated Data Tau iEta", + "Iso Tau i#eta", 227, -113.5, 113.5); + isoTauPhiData = ibooker.book1D("Problematic Isolated Data Tau iPhi", + "Iso Tau i#phi", 288, -0.5, 143.5); + isoTauEtEmul = ibooker.book1D("Problematic Isolated Emul Tau iEt", + "Iso Tau iE_{T}", 1400, 0, 1399); + isoTauEtaEmul = ibooker.book1D("Problematic Isolated Emul Tau iEta", + "Iso Tau i#eta", 227, -113.5, 113.5); + isoTauPhiEmul = ibooker.book1D("Problematic Isolated Emul Tau iPhi", + "Iso Tau i#phi", 288, -0.5, 143.5); + + // DQM directory to store histograms with problematic sums + ibooker.setCurrentFolder(monitorDir + "/Problematic Sums"); + + // book ETT type sums + ettData = ibooker.book1D("Problematic ETT Sum - Data", "ETT iE_{T}", + 7000, -0.5, 6999.5); + ettEmul = ibooker.book1D("Problematic ETT Sum - Emulator", "ETT iE_{T}", + 7000, -0.5, 6999.5); + ettHFData = ibooker.book1D("Problematic ETTHF Sum - Data", "ETTHF iE_{T}", + 7000, -0.5, 6999.5); + ettHFEmul = ibooker.book1D("Problematic ETTHF Sum - Emulator", "ETTHF iE_{T}", + 7000, -0.5, 6999.5); + ettEmData = ibooker.book1D("Problematic ETTEM Sum - Data", "ETTEM iE_{T}", + 7000, -0.5, 6999.5); + ettEmEmul = ibooker.book1D("Problematic ETTEM Sum - Emulator", "ETTEM iE_{T}", + 7000, -0.5, 6999.5); + + // book HTT type sums + httData = ibooker.book1D("Problematic HTT Sum - Data", "HTT iE_{T}", + 7000, -0.5, 6999.5); + httEmul = ibooker.book1D("Problematic HTT Sum - Emulator", "HTT iE_{T}", + 7000, -0.5, 6999.5); + httHFData = ibooker.book1D("Problematic HTTHF Sum - Data", "HTTHF iE_{T}", + 7000, -0.5, 6999.5); + httHFEmul = ibooker.book1D("Problematic HTTHF Sum - Emulator", "HTTHF iE_{T}", + 7000, -0.5, 6999.5); + + // book MET type sums + metEtData = ibooker.book1D("Problematic MET Sum Et - Data", "MET iE_{T}", + 7000, -0.5, 6999.5); + metEtEmul = ibooker.book1D("Problematic MET Sum Et - Emulator", "MET iE_{T}", + 7000, -0.5, 6999.5); + metPhiData = ibooker.book1D("Problematic MET Sum phi - Data", "MET i#phi", + 1008, -0.5, 1007.5); + metPhiEmul = ibooker.book1D("Problematic MET Sum phi - Emulator", "MET i#phi", + 1008, -0.5, 1007.5); + + metHFEtData = ibooker.book1D("Problematic METHF Sum Et - Data", + "METHF iE_{T}", 7000, -0.5, 6999.5); + metHFEtEmul = ibooker.book1D("Problematic METHF Sum Et - Emulator", + "METHF iE_{T}", 7000, -0.5, 6999.5); + metHFPhiData = ibooker.book1D("Problematic METHF Sum phi - Data", + "METHF i#phi", 1008, -0.5, 1007.5); + metHFPhiEmul = ibooker.book1D("Problematic METHF Sum phi - Emulator", + "METHF i#phi", 1008, -0.5, 1007.5); + + // book MHT type sums + mhtEtData = ibooker.book1D("Problematic MHT Sum Et - Data", "MHT iE_{T}", + 7000, -0.5, 6999.5); + mhtEtEmul = ibooker.book1D("Problematic MHT Sum Et - Emulator", "MHT iE_{T}", + 7000, -0.5, 6999.5); + mhtPhiData = ibooker.book1D("Problematic MHT Sum phi - Data", "MHT i#phi", + 1008, -0.5, 1007.5); + mhtPhiEmul = ibooker.book1D("Problematic MHT Sum phi - Emulator", "MHT i#phi", + 1008, -0.5, 1007.5); + + mhtHFEtData = ibooker.book1D("Problematic MHTHF Sum Et - Data", + "MHTHF iE_{T}", 7000, -0.5, 6999.5); + mhtHFEtEmul = ibooker.book1D("Problematic MHTHF Sum Et - Emulator", + "MHTHF iE_{T}", 7000, -0.5, 6999.5); + mhtHFPhiData = ibooker.book1D("Problematic MHTHF Sum phi - Data", + "MHTHF i#phi", 1008, -0.5, 1007.5); + mhtHFPhiEmul = ibooker.book1D("Problematic MHTHF Sum phi - Emulator", + "MHTHF i#phi", 1008, -0.5, 1007.5); + + // book minimum bias sums + mbhfp0Data = ibooker.book1D("Problematic MBHFP0 Sum - Data", + "", 16, -0.5, 15.5); + mbhfp0Emul = ibooker.book1D("Problematic MBHFP0 Sum - Emulator", + "", 16, -0.5, 15.5); + mbhfm0Data = ibooker.book1D("Problematic MBHFM0 Sum - Data", + "", 16, -0.5, 15.5); + mbhfm0Emul = ibooker.book1D("Problematic MBHFM0 Sum - Emulator", + "", 16, -0.5, 15.5); + mbhfm1Data = ibooker.book1D("Problematic MBHFM1 Sum - Data", + "", 16, -0.5, 15.5); + mbhfm1Emul = ibooker.book1D("Problematic MBHFM1 Sum - Emulator", + "", 16, -0.5, 15.5); + mbhfp1Data = ibooker.book1D("Problematic MBHFP1 Sum - Data", + "", 16, -0.5, 15.5); + mbhfp1Emul = ibooker.book1D("Problematic MBHFP1 Sum - Emulator", + "", 16, -0.5, 15.5); + + // book tower count sums + towCountData = ibooker.book1D("Problematic Tower Count Sum - Data", + "", 5904, -0.5, 5903.5); + towCountEmul = ibooker.book1D("Problematic Tower Count Sum - Emulator", + "", 5904, -0.5, 5903.5); + // for reference on arguments of book2D, see + // https://cmssdt.cern.ch/SDT/doxygen/CMSSW_8_0_24/doc/html/df/d26/DQMStore_8cc_source.html#l01070 + + + // setup the directory where the histograms are to be visualised, value is set + // in constructor and taken from python configuration file for module + ibooker.setCurrentFolder(monitorDir + "/expert"); + + + // Jet energy in MP firmware is stored in 16 bits which sets the range of + // jet energy to 2^16 * 0.5 GeV = 32768 GeV (65536 hardware units) + // --- this is only for MP jets, the demux jets have much decreased precision + // --- and this should be replaced + + // the index of the first bin in histogram should match value of first enum + agreementSummary = ibooker.book1D( + "CaloL2 Object Agreement Summary", + "CaloL2 event-by-event object agreement fractions", 10, 1, 11); + + agreementSummary->setBinLabel(EVENTGOOD, "good events"); + agreementSummary->setBinLabel(NEVENTS, "total events"); + agreementSummary->setBinLabel(NJETS_S, "total jets"); + agreementSummary->setBinLabel(JETGOOD_S, "good jets"); + agreementSummary->setBinLabel(NEGS_S, "total e/gs"); + agreementSummary->setBinLabel(EGGOOD_S, "good e/gs"); + agreementSummary->setBinLabel(NTAUS_S, "total taus"); + agreementSummary->setBinLabel(TAUGOOD_S, "good taus"); + agreementSummary->setBinLabel(NSUMS_S, "total sums"); + agreementSummary->setBinLabel(SUMGOOD_S, "good sums"); + + jetSummary = ibooker.book1D( + "Jet Agreement Summary", "Jet Agreement Summary", 4, 1, 5); + jetSummary->setBinLabel(NJETS, "total jets"); + jetSummary->setBinLabel(JETGOOD, "good jets"); + jetSummary->setBinLabel(JETPOSOFF, "jets pos off only"); + jetSummary->setBinLabel(JETETOFF, "jets Et off only "); + + egSummary = ibooker.book1D( + "EG Agreement Summary", "EG Agreement Summary", 8, 1, 9); + egSummary->setBinLabel(NEGS, "total non-iso e/gs"); + egSummary->setBinLabel(EGGOOD, "good non-iso e/gs"); + egSummary->setBinLabel(EGPOSOFF, "non-iso e/gs pos off"); + egSummary->setBinLabel(EGETOFF, "non-iso e/gs Et off"); + egSummary->setBinLabel(NISOEGS, "total iso e/gs"); + egSummary->setBinLabel(ISOEGGOOD, "good iso e/gs"); + egSummary->setBinLabel(ISOEGPOSOFF, "iso e/gs pos off"); + egSummary->setBinLabel(ISOEGETOFF, "iso e/gs Et off"); + + tauSummary = ibooker.book1D( + "Tau Agreement Summary", "Tau Agreement Summary", 8, 1, 9); + tauSummary->setBinLabel(NTAUS, "total taus"); + tauSummary->setBinLabel(TAUGOOD, "good non-iso taus"); + tauSummary->setBinLabel(TAUPOSOFF, "non-iso taus pos off"); + tauSummary->setBinLabel(TAUETOFF, "non-iso taus Et off"); + tauSummary->setBinLabel(NISOTAUS, "total iso taus"); + tauSummary->setBinLabel(ISOTAUGOOD, "good iso taus"); + tauSummary->setBinLabel(ISOTAUPOSOFF, "iso taus pos off"); + tauSummary->setBinLabel(ISOTAUETOFF, "iso taus Et off"); + + sumSummary = ibooker.book1D( + "Energy Sum Agreement Summary", "Sum Agreement Summary", 14, 1, 15); + sumSummary->setBinLabel(NSUMS, "total sums"); + sumSummary->setBinLabel(SUMGOOD, "good sums"); + sumSummary->setBinLabel(NETTSUMS, "total ETT sums"); + sumSummary->setBinLabel(ETTSUMGOOD, "good ETT sums"); + sumSummary->setBinLabel(NHTTSUMS, "total HTT sums"); + sumSummary->setBinLabel(HTTSUMGOOD, "good HTT sums"); + sumSummary->setBinLabel(NMETSUMS, "total MET sums"); + sumSummary->setBinLabel(METSUMGOOD, "good MET sums"); + sumSummary->setBinLabel(NMHTSUMS, "total MHT sums"); + sumSummary->setBinLabel(MHTSUMGOOD, "good MHT sums"); + sumSummary->setBinLabel(NMBHFSUMS, "total MBHF sums"); + sumSummary->setBinLabel(MBHFSUMGOOD, "good MBHF sums"); + sumSummary->setBinLabel(NTOWCOUNTS, "total TowCount sums"); + sumSummary->setBinLabel(TOWCOUNTGOOD, "good TowCount sums"); + + // high level directory + ibooker.setCurrentFolder(monitorDir); + + problemSummary = ibooker.book1D( + "Problem Summary", "Problematic Event Summary", 8, 1, 9); + problemSummary->setBinLabel(NEVENTS_P, "total events"); + problemSummary->setBinLabel(JETCOLLSIZE, "jet collection size"); + problemSummary->setBinLabel(EGCOLLSIZE, "eg collection size"); + problemSummary->setBinLabel(TAUCOLLSIZE, "tau collection size"); + problemSummary->setBinLabel(JETMISMATCH, "jet mismatch"); + problemSummary->setBinLabel(EGMISMATCH, "eg mismatch"); + problemSummary->setBinLabel(TAUMISMATCH, "tau mismatch"); + problemSummary->setBinLabel(SUMMISMATCH, "sum mismatch"); +} +void L1TdeStage2CaloLayer2::analyze ( + const edm::Event& e, + const edm::EventSetup & c) { + + if (verbose) + edm::LogInfo("L1TdeStage2CaloLayer2") << "L1TdeStage2CaloLayer2: analyse " + << std::endl; + + // define collections to hold lists of objects in event + edm::Handle jetDataCol; + edm::Handle jetEmulCol; + edm::Handle egDataCol; + edm::Handle egEmulCol; + edm::Handle tauDataCol; + edm::Handle tauEmulCol; + edm::Handle sumDataCol; + edm::Handle sumEmulCol; + + // map event contents to above collections + e.getByToken(calol2JetCollectionData, jetDataCol); + e.getByToken(calol2JetCollectionEmul, jetEmulCol); + e.getByToken(calol2EGammaCollectionData, egDataCol); + e.getByToken(calol2EGammaCollectionEmul, egEmulCol); + e.getByToken(calol2TauCollectionData, tauDataCol); + e.getByToken(calol2TauCollectionEmul, tauEmulCol); + e.getByToken(calol2EtSumCollectionData, sumDataCol); + e.getByToken(calol2EtSumCollectionEmul, sumEmulCol); + + bool eventGood = true; + + // we assume that the first and last bx of the emulator data is 0 since it is + // very unlikely to have received RAW data from more than just the triggered + // bx + + /** + Notes: + - The hardware can send up to 12 jets due to bandwidth limitation so it + will sort the jets it has found in order of decreasing pT and will send + only the top 12. The emulator does not have similar constraint but can be + configured to truncate the list of jets it has found. In the case that a + small number of jets is found (less than 12), the full list will be sent. + - Currently, the edge case where the number of jets/objects in data and + emulator are different is being skipped but would need to be addressed + before the module can be declared complete. + + Edge cases to consider: + - there are more emulator jets than data jets + - there are more data jets than emulator jets + - missing jet is at beginning/end + - missing jet is in the middle + */ + + l1t::EGammaBxCollection::const_iterator dataEGIt = egDataCol->begin(currBx); + l1t::EGammaBxCollection::const_iterator emulEGIt = egEmulCol->begin(currBx); + + l1t::TauBxCollection::const_iterator dataTauIt = tauDataCol->begin(currBx); + l1t::TauBxCollection::const_iterator emulTauIt = tauEmulCol->begin(currBx); + + l1t::EtSumBxCollection::const_iterator dataSumIt = sumDataCol->begin(currBx); + l1t::EtSumBxCollection::const_iterator emulSumIt = sumEmulCol->begin(currBx); + + if (!compareJets(jetDataCol, jetEmulCol)) { + if (verbose) + edm::LogInfo("L1TdeStage2CaloLayer2") << "l1t calol2 dqm: jet problem " + << std::endl; + problemSummary->Fill(JETMISMATCH); + eventGood = false; + } + + if (!compareEGs(egDataCol, egEmulCol)) { + if (verbose) + edm::LogInfo("L1TdeStage2CaloLayer2") << "l1t calol2 dqm: eg problem " + << std::endl; + problemSummary->Fill(EGMISMATCH); + eventGood = false; + } + + if (!compareTaus(tauDataCol, tauEmulCol)) { + if (verbose) + edm::LogInfo("L1TdeStage2CaloLayer2") << "l1t calol2 dqm: tau problem " + << std::endl; + problemSummary->Fill(TAUMISMATCH); + eventGood = false; + } + + if (!compareSums(sumDataCol, sumEmulCol)) { + if (verbose) + edm::LogInfo("L1TdeStage2CaloLayer2") << "l1t calol2 dqm: sum problem " + << std::endl; + problemSummary->Fill(SUMMISMATCH); + eventGood = false; + } + + /** + Questions: + - what could make the data and emul bx ranges to be different? + - how can I confirm that the emulator data is being filled? + */ + + if (eventGood) { + agreementSummary->Fill(EVENTGOOD); + } + + agreementSummary->Fill(NEVENTS); + problemSummary->Fill(NEVENTS_P); +} + +// comparison method for jets +bool L1TdeStage2CaloLayer2::compareJets( + const edm::Handle & dataCol, + const edm::Handle & emulCol) +{ + bool eventGood = true; + + l1t::JetBxCollection::const_iterator dataIt = dataCol->begin(currBx); + l1t::JetBxCollection::const_iterator emulIt = emulCol->begin(currBx); + + // process jets + if (dataCol->size(currBx) != emulCol->size(currBx)) { + + if (dataCol->size(currBx) < emulCol->size(currBx)) { + + // if only the data collection is empty, declare event as bad + if (dataCol->isEmpty(currBx)) return false; + + while (true) { + jetEtData->Fill(dataIt->hwPt()); + jetEtaData->Fill(dataIt->hwEta()); + jetPhiData->Fill(dataIt->hwPhi()); + + ++dataIt; + + if (dataIt == dataCol->end(currBx)) + break; + } + } else { + + // if only the emul collection is empty, declare event as bad + if (emulCol->isEmpty(currBx)) return false; + + while (true) { + + jetEtEmul->Fill(emulIt->hwPt()); + jetEtaEmul->Fill(emulIt->hwEta()); + jetPhiEmul->Fill(emulIt->hwPhi()); + + ++emulIt; + + if (emulIt == emulCol->end(currBx)) + break; + } + + while (true) { + + jetEtEmul->Fill(dataIt->hwPt()); + jetEtaEmul->Fill(dataIt->hwEta()); + jetPhiEmul->Fill(dataIt->hwPhi()); + + ++dataIt; + + if (dataIt == dataCol->end(currBx)) + break; + } + } + + problemSummary->Fill(JETCOLLSIZE); + return false; + } + + int nJets = 0; + if (dataIt != dataCol->end(currBx) || + emulIt != emulCol->end(currBx)) { + while(true) { + + ++nJets; + + bool posGood = true; + bool etGood = true; + + // object pt mismatch + if (dataIt->hwPt() != emulIt->hwPt()) { + etGood = false; + eventGood = false; + } + + // object position mismatch (phi) + if (dataIt->hwPhi() != emulIt->hwPhi()){ + posGood = false; + eventGood = false; + + } + + // object position mismatch (eta) + if (dataIt->hwEta() != emulIt->hwEta()) { + posGood = false; + eventGood = false; + } + + // if both position and energy agree, jet is good + if (etGood && posGood) { + agreementSummary->Fill(JETGOOD_S); + jetSummary->Fill(JETGOOD); + } else { + jetEtData->Fill(dataIt->hwPt()); + jetEtaData->Fill(dataIt->hwEta()); + jetPhiData->Fill(dataIt->hwPhi()); + + jetEtEmul->Fill(emulIt->hwPt()); + jetEtaEmul->Fill(emulIt->hwEta()); + jetPhiEmul->Fill(emulIt->hwPhi()); + + if (verbose) { + edm::LogInfo("L1TdeStage2CaloLayer2") << "--- jet ---"<< std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "data jet Et = " + << dataIt->hwPt() << std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "emul jet Et = " + << emulIt->hwPt() << std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "data jet phi = " + << dataIt->hwPhi() << std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "emul jet phi = " + << emulIt->hwPhi() << std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "data jet eta = " + << dataIt->hwEta() << std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "emul jet eta = " + << emulIt->hwEta() << std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "---"<< std::endl; + } + } + + // if only position agrees + if (posGood && !etGood) { + jetSummary->Fill(JETETOFF); + } + + // if only energy agrees + if (!posGood && etGood) { + jetSummary->Fill(JETPOSOFF); + } + + // keep track of jets + agreementSummary->Fill(NJETS_S); + jetSummary->Fill(NJETS); + + // increment position of pointers + ++dataIt; + ++emulIt; + + if (dataIt == dataCol->end(currBx) || + emulIt == emulCol->end(currBx)) + break; + } + } else { + if (dataCol->size(currBx) != 0 || emulCol->size(currBx) != 0) + return false; + } + + // return a boolean that states whether the jet data in the event is in + // agreement + return eventGood; +} + +// comparison method for e/gammas +bool L1TdeStage2CaloLayer2::compareEGs( + const edm::Handle & dataCol, + const edm::Handle & emulCol) +{ + bool eventGood = true; + + l1t::EGammaBxCollection::const_iterator dataIt = dataCol->begin(currBx); + l1t::EGammaBxCollection::const_iterator emulIt = emulCol->begin(currBx); + + // check length of collections + if (dataCol->size(currBx) != emulCol->size(currBx)) { + + if (dataCol->size(currBx) < emulCol->size(currBx)) { + + // if only the data collection is empty, declare event as bad + if (dataCol->isEmpty(currBx)) return false; + + // if there are more events in data loop over the data collection + while (true) { + if (dataIt->hwIso()) { + isoEgEtData->Fill(dataIt->hwPt()); + isoEgEtaData->Fill(dataIt->hwEta()); + isoEgPhiData->Fill(dataIt->hwPhi()); + } else { + egEtData->Fill(dataIt->hwPt()); + egEtaData->Fill(dataIt->hwEta()); + egPhiData->Fill(dataIt->hwPhi()); + } + + ++dataIt; + + if (dataIt == dataCol->end(currBx)) + break; + } + } else { + + // if only the emul collection is empty, declare event as bad + if (emulCol->isEmpty(currBx)) return false; + + while (true) { + if(emulIt->hwIso()) { + isoEgEtEmul->Fill(emulIt->hwPt()); + isoEgEtaEmul->Fill(emulIt->hwEta()); + isoEgPhiEmul->Fill(emulIt->hwPhi()); + } else { + egEtEmul->Fill(emulIt->hwPt()); + egEtaEmul->Fill(emulIt->hwEta()); + egPhiEmul->Fill(emulIt->hwPhi()); + } + + ++emulIt; + + if (emulIt == emulCol->end(currBx)) + break; + } + } + + problemSummary->Fill(EGCOLLSIZE); + return false; + } + + // processing continues only of length of data collections is the same + if (dataIt != dataCol->end(currBx) || + emulIt != emulCol->end(currBx)) { + + while(true) { + + bool posGood = true; + bool etGood = true; + bool iso = dataIt->hwIso(); + + // object pt mismatch + if (dataIt->hwPt() != emulIt->hwPt()) { + etGood = false; + eventGood = false; + } + + // object position mismatch (phi) + if (dataIt->hwPhi() != emulIt->hwPhi()) { + posGood = false; + eventGood = false; + } + + // object position mismatch (eta) + if (dataIt->hwEta() != emulIt->hwEta()) { + posGood = false; + eventGood = false; + } + + // if both position and energy agree, object is good + if (posGood && etGood) { + agreementSummary->Fill(EGGOOD_S); + + if (iso) { + egSummary->Fill(ISOEGGOOD); + } else { + egSummary->Fill(EGGOOD); + } + + } else { + + if (iso) { + isoEgEtData->Fill(dataIt->hwPt()); + isoEgEtaData->Fill(dataIt->hwEta()); + isoEgPhiData->Fill(dataIt->hwPhi()); + + isoEgEtEmul->Fill(emulIt->hwPt()); + isoEgEtaEmul->Fill(emulIt->hwEta()); + isoEgPhiEmul->Fill(emulIt->hwPhi()); + } else { + egEtData->Fill(dataIt->hwPt()); + egEtaData->Fill(dataIt->hwEta()); + egPhiData->Fill(dataIt->hwPhi()); + + egEtEmul->Fill(emulIt->hwPt()); + egEtaEmul->Fill(emulIt->hwEta()); + egPhiEmul->Fill(emulIt->hwPhi()); + } + + if (verbose) { + edm::LogInfo("L1TdeStage2CaloLayer2") << "--- eg ---"<< std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "data eg Et = " + << dataIt->hwPt() << std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "emul eg Et = " + << emulIt->hwPt() << std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "data eg phi = " + << dataIt->hwPhi() << std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "emul eg phi = " + << emulIt->hwPhi() << std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "data eg eta = " + << dataIt->hwEta() << std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "emul eg eta = " + << emulIt->hwEta() << std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "---"<< std::endl; + } + } + + // if only position agrees + if (posGood && !etGood) { + if (iso) { + egSummary->Fill(ISOEGETOFF); + } else { + egSummary->Fill(EGETOFF); + } + } + + // if only energy agrees + if (!posGood && etGood) { + if (iso) { + egSummary->Fill(ISOEGPOSOFF); + } else { + egSummary->Fill(EGPOSOFF); + } + } + + // keep track of number of objects + if (iso) { + egSummary->Fill(NISOEGS); + } else { + egSummary->Fill(NEGS); + } + agreementSummary->Fill(NEGS_S); + + // increment position of pointers + ++dataIt; + ++emulIt; + + if (dataIt == dataCol->end(currBx) || + emulIt == emulCol->end(currBx)) + break; + } + } else { + if (dataCol->size(currBx) != 0 || emulCol->size(currBx) != 0) + return false; + } + + // return a boolean that states whether the jet data in the event is in + // agreement + return eventGood; +} + +// comparison method for taus +bool L1TdeStage2CaloLayer2::compareTaus( + const edm::Handle & dataCol, + const edm::Handle & emulCol) +{ + bool eventGood = true; + + l1t::TauBxCollection::const_iterator dataIt = dataCol->begin(currBx); + l1t::TauBxCollection::const_iterator emulIt = emulCol->begin(currBx); + + // check length of collections + if (dataCol->size(currBx) != emulCol->size(currBx)) { + + if (dataCol->size(currBx) < emulCol->size(currBx)) { + + // if only the data collection is empty, declare event as bad + if (dataCol->isEmpty(currBx)) return false; + + // if there are more events in data loop over the data collection + while (true) { + + // Populate different set of histograms if object is solated + + if (dataIt->hwIso()) { + isoTauEtData->Fill(dataIt->hwPt()); + isoTauEtaData->Fill(dataIt->hwEta()); + isoTauPhiData->Fill(dataIt->hwPhi()); + } else { + tauEtData->Fill(dataIt->hwPt()); + tauEtaData->Fill(dataIt->hwEta()); + tauPhiData->Fill(dataIt->hwPhi()); + } + + ++dataIt; + + if (dataIt == dataCol->end(currBx)) + break; + } + } else { + + // if only the emul collection is bad, declare the event as bad + if (emulCol->isEmpty(currBx)) return false; + + while (true) { + + // Populate different set of histograms if object is solated + + if(emulIt->hwIso()) { + isoTauEtEmul->Fill(emulIt->hwPt()); + isoTauEtaEmul->Fill(emulIt->hwEta()); + isoTauPhiEmul->Fill(emulIt->hwPhi()); + } else { + tauEtEmul->Fill(emulIt->hwPt()); + tauEtaEmul->Fill(emulIt->hwEta()); + tauPhiEmul->Fill(emulIt->hwPhi()); + } + + ++emulIt; + + if (emulIt == emulCol->end(currBx)) + break; + } + } + + problemSummary->Fill(TAUCOLLSIZE); + return false; + } + + // processing continues only of length of data collections is the same + if (dataIt != dataCol->end(currBx) || + emulIt != emulCol->end(currBx)) { + + while(true) { + + bool posGood = true; + bool etGood = true; + bool iso = dataIt->hwIso(); + + // object Et mismatch + if (dataIt->hwPt() != emulIt->hwPt()) { + etGood = false; + eventGood = false; + } + + // object position mismatch (phi) + if (dataIt->hwPhi() != emulIt->hwPhi()) { + posGood = false; + eventGood = false; + } + + // object position mismatch (eta) + if (dataIt->hwEta() != emulIt->hwEta()) { + posGood = false; + eventGood = false; + } + + // if both position and energy agree, object is good + if (posGood && etGood) { + agreementSummary->Fill(TAUGOOD_S); + + if (iso) { + tauSummary->Fill(ISOTAUGOOD); + } else { + tauSummary->Fill(TAUGOOD); + } + } else { + + if (iso) { + isoTauEtData->Fill(dataIt->hwPt()); + isoTauEtaData->Fill(dataIt->hwEta()); + isoTauPhiData->Fill(dataIt->hwPhi()); + + isoTauEtEmul->Fill(emulIt->hwPt()); + isoTauEtaEmul->Fill(emulIt->hwEta()); + isoTauPhiEmul->Fill(emulIt->hwPhi()); + + } else { + tauEtData->Fill(dataIt->hwPt()); + tauEtaData->Fill(dataIt->hwEta()); + tauPhiData->Fill(dataIt->hwPhi()); + + tauEtEmul->Fill(emulIt->hwPt()); + tauEtaEmul->Fill(emulIt->hwEta()); + tauPhiEmul->Fill(emulIt->hwPhi()); + } + + if (verbose) { + edm::LogInfo("L1TdeStage2CaloLayer2") << "--- tau ---"<< std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "data tau Et = " + << dataIt->hwPt() << std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "emul tau Et = " + << emulIt->hwPt() << std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "data tau phi = " + << dataIt->hwPhi() << std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "emul tau phi = " + << emulIt->hwPhi() << std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "data tau eta = " + << dataIt->hwEta() << std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "emul tau eta = " + << emulIt->hwEta() << std::endl; + edm::LogInfo("L1TdeStage2CaloLayer2") << "---"<< std::endl; + } + } + + // if only position agrees + if (posGood && !etGood) { + if (iso) { + tauSummary->Fill(ISOTAUETOFF); + } else { + tauSummary->Fill(TAUETOFF); + } + } + + // if only energy agrees + if (!posGood && etGood) { + if (iso) { + tauSummary->Fill(ISOTAUPOSOFF); + } else { + tauSummary->Fill(TAUPOSOFF); + } + } + + // keep track of number of objects + if (iso) { + tauSummary->Fill(NISOTAUS); + } else { + tauSummary->Fill(NTAUS); + } + + agreementSummary->Fill(NTAUS_S); + + // increment position of pointers + ++dataIt; + ++emulIt; + + if (dataIt == dataCol->end(currBx) || + emulIt == emulCol->end(currBx)) + break; + } + } else { + if (dataCol->size(currBx) != 0 || emulCol->size(currBx) != 0) + return false; + } + + // return a boolean that states whether the jet data in the event is in + // agreement + return eventGood; +} + +// comparison method for sums +bool L1TdeStage2CaloLayer2::compareSums( + const edm::Handle & dataCol, + const edm::Handle & emulCol) +{ + bool eventGood = true; + + bool etGood = true; + bool phiGood = true; + + double dataEt = 0; + double emulEt = 0; + double dataPhi = 0; + double emulPhi = 0; + + l1t::EtSumBxCollection::const_iterator dataIt = dataCol->begin(currBx); + l1t::EtSumBxCollection::const_iterator emulIt = emulCol->begin(currBx); + + while(true) { + + // It should be possible to implement this with a switch statement + etGood = true; + phiGood = true; + + // ETT + if (l1t::EtSum::EtSumType::kTotalEt == dataIt->getType()) { + + dataEt = dataIt->hwPt(); + emulEt = emulIt->hwPt(); + + if (dataEt != emulEt) { + eventGood = false; + + ettData->Fill(dataEt); + ettEmul->Fill(emulEt); + } else { + agreementSummary->Fill(SUMGOOD_S); + sumSummary->Fill(SUMGOOD); + sumSummary->Fill(ETTSUMGOOD); + } + + if (verbose) { + edm::LogInfo("L1TdeStage2CaloLayer2") << "ETT | "; + if (dataEt != emulEt) + edm::LogInfo("L1TdeStage2CaloLayer2") << "x "; + else + edm::LogInfo("L1TdeStage2CaloLayer2") << " "; + edm::LogInfo("L1TdeStage2CaloLayer2") << dataEt << "\t" << emulEt; + edm::LogInfo("L1TdeStage2CaloLayer2") << std::endl; + } + + // update sum counters + agreementSummary->Fill(NSUMS_S); + sumSummary->Fill(NETTSUMS); + sumSummary->Fill(NSUMS); + } + + // ETTEM + if (l1t::EtSum::EtSumType::kTotalEtEm == dataIt->getType()) { + + dataEt = dataIt->hwPt(); + emulEt = emulIt->hwPt(); + + if (dataEt != emulEt) { + eventGood = false; + ettEmData->Fill(dataEt); + ettEmEmul->Fill(emulEt); + + } else { + agreementSummary->Fill(SUMGOOD_S); + sumSummary->Fill(SUMGOOD); + sumSummary->Fill(ETTSUMGOOD); + } + + if (verbose) { + edm::LogInfo("L1TdeStage2CaloLayer2") << "ETTEM | "; + if (dataEt != emulEt) + edm::LogInfo("L1TdeStage2CaloLayer2") << "x "; + else + edm::LogInfo("L1TdeStage2CaloLayer2") << " "; + edm::LogInfo("L1TdeStage2CaloLayer2") << dataEt << "\t" << emulEt; + edm::LogInfo("L1TdeStage2CaloLayer2") << std::endl; + } + + // update sum counters + agreementSummary->Fill(NSUMS_S); + sumSummary->Fill(NETTSUMS); + sumSummary->Fill(NSUMS); + } + + // HTT + if (l1t::EtSum::EtSumType::kTotalHt == dataIt->getType()) { + + dataEt = dataIt->hwPt(); + emulEt = emulIt->hwPt(); + + if (dataEt != emulEt) { + eventGood = false; + httData->Fill(dataEt); + httEmul->Fill(emulEt); + } else { + agreementSummary->Fill(SUMGOOD_S); + sumSummary->Fill(SUMGOOD); + sumSummary->Fill(HTTSUMGOOD); + } + + if (verbose) { + edm::LogInfo("L1TdeStage2CaloLayer2") << "HTT | "; + if (dataEt != emulEt) + edm::LogInfo("L1TdeStage2CaloLayer2") << "x "; + else + edm::LogInfo("L1TdeStage2CaloLayer2") << " "; + edm::LogInfo("L1TdeStage2CaloLayer2") << dataEt << "\t" << emulEt; + edm::LogInfo("L1TdeStage2CaloLayer2") << std::endl; + } + + // update sum counters + agreementSummary->Fill(NSUMS_S); + sumSummary->Fill(NHTTSUMS); + sumSummary->Fill(NSUMS); + } + + // MET + if (l1t::EtSum::EtSumType::kMissingEt == dataIt->getType() + && dataIt->hwPt() != 0) { + + dataEt = dataIt->hwPt(); + emulEt = emulIt->hwPt(); + + dataPhi = dataIt->hwPhi(); + emulPhi = emulIt->hwPhi(); + + if (dataEt != emulEt) { + etGood = false; + eventGood = false; + } + + if (dataPhi != emulPhi) { + phiGood = false; + eventGood = false; + } + + if (etGood && phiGood) { + agreementSummary->Fill(SUMGOOD_S); + sumSummary->Fill(SUMGOOD); + sumSummary->Fill(METSUMGOOD); + } else { + metEtData->Fill(dataEt); + metPhiData->Fill(dataPhi); + metEtEmul->Fill(emulEt); + metPhiEmul->Fill(emulPhi); + } + + if (verbose) { + edm::LogInfo("L1TdeStage2CaloLayer2") << "MET | "; + if (dataEt != emulEt) + edm::LogInfo("L1TdeStage2CaloLayer2") << "x "; + else + edm::LogInfo("L1TdeStage2CaloLayer2") << " "; + edm::LogInfo("L1TdeStage2CaloLayer2") << dataEt << "\t" << emulEt; + edm::LogInfo("L1TdeStage2CaloLayer2") << std::endl; + + edm::LogInfo("L1TdeStage2CaloLayer2") << "MET phi | "; + if (dataPhi != emulPhi) + edm::LogInfo("L1TdeStage2CaloLayer2") << "x "; + else + edm::LogInfo("L1TdeStage2CaloLayer2") << " "; + edm::LogInfo("L1TdeStage2CaloLayer2") << dataPhi << "\t" << emulPhi; + edm::LogInfo("L1TdeStage2CaloLayer2") << std::endl; + } + + // update sum counters + agreementSummary->Fill(NSUMS_S); + sumSummary->Fill(NMETSUMS); + sumSummary->Fill(NSUMS); + } + + // METHF + if (l1t::EtSum::EtSumType::kMissingEtHF == dataIt->getType() + && dataIt->hwPt() != 0) { + + dataEt = dataIt->hwPt(); + emulEt = emulIt->hwPt(); + + dataPhi = dataIt->hwPhi(); + emulPhi = emulIt->hwPhi(); + + if (dataEt != emulEt) { + etGood = false; + eventGood = false; + } + + if (dataPhi != emulPhi) { + phiGood = false; + eventGood = false; + } + + if (etGood && phiGood) { + agreementSummary->Fill(SUMGOOD_S); + sumSummary->Fill(SUMGOOD); + sumSummary->Fill(METSUMGOOD); + } else { + metHFEtData->Fill(dataEt); + metHFPhiData->Fill(dataPhi); + metHFEtEmul->Fill(emulEt); + metHFPhiEmul->Fill(emulPhi); + } + + if (verbose) { + edm::LogInfo("L1TdeStage2CaloLayer2") << "METHF | "; + if (dataEt != emulEt) + edm::LogInfo("L1TdeStage2CaloLayer2") << "x "; + else + edm::LogInfo("L1TdeStage2CaloLayer2") << " "; + edm::LogInfo("L1TdeStage2CaloLayer2") << dataEt << "\t" << emulEt; + edm::LogInfo("L1TdeStage2CaloLayer2") << std::endl; + + edm::LogInfo("L1TdeStage2CaloLayer2") << "METHF phi | "; + if (dataPhi != emulPhi) + edm::LogInfo("L1TdeStage2CaloLayer2") << "x "; + else + edm::LogInfo("L1TdeStage2CaloLayer2") << " "; + edm::LogInfo("L1TdeStage2CaloLayer2") << dataPhi << "\t" << emulPhi; + edm::LogInfo("L1TdeStage2CaloLayer2") << std::endl; + } + + // update sum counters + agreementSummary->Fill(NSUMS_S); + sumSummary->Fill(NMETSUMS); + sumSummary->Fill(NSUMS); + } + + // MHT + if (l1t::EtSum::EtSumType::kMissingHt == dataIt->getType() + && dataIt->hwPt() != 0) { + + dataEt = dataIt->hwPt(); + emulEt = emulIt->hwPt(); + + dataPhi = dataIt->hwPhi(); + emulPhi = emulIt->hwPhi(); + + if (dataEt != emulEt) { + etGood = false; + eventGood = false; + } + + if (!(etGood && dataEt == 0)) { + if (dataPhi != emulPhi) { + phiGood = false; + eventGood = false; + } + } + + if (etGood && phiGood) { + agreementSummary->Fill(SUMGOOD_S); + sumSummary->Fill(SUMGOOD); + sumSummary->Fill(MHTSUMGOOD); + } else { + mhtEtData->Fill(dataEt); + mhtPhiData->Fill(dataPhi); + mhtEtEmul->Fill(emulEt); + mhtPhiEmul->Fill(emulPhi); + } + + if (verbose) { + edm::LogInfo("L1TdeStage2CaloLayer2") << "MHT | "; + if (dataEt != emulEt) + edm::LogInfo("L1TdeStage2CaloLayer2") << "x "; + else + edm::LogInfo("L1TdeStage2CaloLayer2") << " "; + edm::LogInfo("L1TdeStage2CaloLayer2") << dataEt << "\t" << emulEt; + edm::LogInfo("L1TdeStage2CaloLayer2") << std::endl; + + edm::LogInfo("L1TdeStage2CaloLayer2") << "MHT phi | "; + if (dataPhi != emulPhi) + edm::LogInfo("L1TdeStage2CaloLayer2") << "x "; + else + edm::LogInfo("L1TdeStage2CaloLayer2") << " "; + edm::LogInfo("L1TdeStage2CaloLayer2") << dataPhi << "\t" << emulPhi; + edm::LogInfo("L1TdeStage2CaloLayer2") << std::endl; + } + + // update sum counters + agreementSummary->Fill(NSUMS_S); + sumSummary->Fill(NMHTSUMS); + sumSummary->Fill(NSUMS); + } + + // MHTHF + if (l1t::EtSum::EtSumType::kMissingHtHF == dataIt->getType() + && dataIt->hwPt() != 0) { + + dataEt = dataIt->hwPt(); + emulEt = emulIt->hwPt(); + + dataPhi = dataIt->hwPhi(); + emulPhi = emulIt->hwPhi(); + + if (dataEt != emulEt) { + phiGood = false; + eventGood = false; + } + + if (!(etGood && dataEt == 0)) { + if (dataPhi != emulPhi) { + phiGood = false; + eventGood = false; + } + } + + if (etGood && phiGood) { + agreementSummary->Fill(SUMGOOD_S); + sumSummary->Fill(SUMGOOD); + sumSummary->Fill(MHTSUMGOOD); + } else { + mhtHFEtData->Fill(dataEt); + mhtHFPhiData->Fill(dataPhi); + mhtHFEtEmul->Fill(emulEt); + mhtHFPhiEmul->Fill(emulPhi); + } + + if (verbose) { + edm::LogInfo("L1TdeStage2CaloLayer2") << "MHTHF | "; + if (dataEt != emulEt) + edm::LogInfo("L1TdeStage2CaloLayer2") << "x "; + else + edm::LogInfo("L1TdeStage2CaloLayer2") << " "; + edm::LogInfo("L1TdeStage2CaloLayer2") << dataEt << "\t" << emulEt; + edm::LogInfo("L1TdeStage2CaloLayer2") << std::endl; + + edm::LogInfo("L1TdeStage2CaloLayer2") << "MHTHF phi | "; + if (dataPhi != emulPhi) + edm::LogInfo("L1TdeStage2CaloLayer2") << "x "; + else + edm::LogInfo("L1TdeStage2CaloLayer2") << " "; + edm::LogInfo("L1TdeStage2CaloLayer2") << dataPhi << "\t" << emulPhi; + edm::LogInfo("L1TdeStage2CaloLayer2") << std::endl; + } + + // update sum counters + agreementSummary->Fill(NSUMS_S); + sumSummary->Fill(NMHTSUMS); + sumSummary->Fill(NSUMS); + } + + // MBHFP0 + if (l1t::EtSum::EtSumType::kMinBiasHFP0 == dataIt->getType()) { + + dataEt = dataIt->hwPt(); + emulEt = emulIt->hwPt(); + + if (dataEt != emulEt) { + eventGood = false; + mbhfp0Data->Fill(dataEt); + mbhfp0Emul->Fill(emulEt); + } else { + agreementSummary->Fill(SUMGOOD_S); + sumSummary->Fill(SUMGOOD); + sumSummary->Fill(MBHFSUMGOOD); + } + + if (verbose) { + edm::LogInfo("L1TdeStage2CaloLayer2") << "MBHFP0 | "; + if (dataEt != emulEt) + edm::LogInfo("L1TdeStage2CaloLayer2") << "x "; + else + edm::LogInfo("L1TdeStage2CaloLayer2") << " "; + edm::LogInfo("L1TdeStage2CaloLayer2") << dataEt << "\t" << emulEt; + edm::LogInfo("L1TdeStage2CaloLayer2") << std::endl; + } + + // update sum counters + agreementSummary->Fill(NSUMS_S); + sumSummary->Fill(NMBHFSUMS); + sumSummary->Fill(NSUMS); + } + + // MBHFM0 + if (l1t::EtSum::EtSumType::kMinBiasHFM0 == dataIt->getType()) { + + dataEt = dataIt->hwPt(); + emulEt = emulIt->hwPt(); + + if (dataEt != emulEt) { + eventGood = false; + mbhfm0Data->Fill(dataEt); + mbhfm0Emul->Fill(emulEt); + } else { + agreementSummary->Fill(SUMGOOD_S); + sumSummary->Fill(SUMGOOD); + sumSummary->Fill(MBHFSUMGOOD); + } + + // update sum counters + agreementSummary->Fill(NSUMS_S); + sumSummary->Fill(NMBHFSUMS); + sumSummary->Fill(NSUMS); + } + + // MBHFP1 + if (l1t::EtSum::EtSumType::kMinBiasHFP1 == dataIt->getType()) { + + dataEt = dataIt->hwPt(); + emulEt = emulIt->hwPt(); + + if (dataEt != emulEt) { + eventGood = false; + mbhfp1Data->Fill(dataEt); + mbhfp1Emul->Fill(emulEt); + } else { + agreementSummary->Fill(SUMGOOD_S); + sumSummary->Fill(SUMGOOD); + sumSummary->Fill(MBHFSUMGOOD); + } + + if (verbose) { + edm::LogInfo("L1TdeStage2CaloLayer2") << "MBHFP1 | "; + if (dataEt != emulEt) + edm::LogInfo("L1TdeStage2CaloLayer2") << "x "; + else + edm::LogInfo("L1TdeStage2CaloLayer2") << " "; + edm::LogInfo("L1TdeStage2CaloLayer2") << dataEt << "\t" << emulEt; + edm::LogInfo("L1TdeStage2CaloLayer2") << std::endl; + } + + // update sum counters + agreementSummary->Fill(NSUMS_S); + sumSummary->Fill(NMBHFSUMS); + sumSummary->Fill(NSUMS); + } + + // MBHFM1 + if (l1t::EtSum::EtSumType::kMinBiasHFM1 == dataIt->getType()) { + + dataEt = dataIt->hwPt(); + emulEt = emulIt->hwPt(); + + sumSummary->Fill(NMBHFSUMS); + + if (dataEt != emulEt) { + eventGood = false; + mbhfm1Data->Fill(dataEt); + mbhfm1Emul->Fill(emulEt); + } else { + agreementSummary->Fill(SUMGOOD_S); + sumSummary->Fill(SUMGOOD); + sumSummary->Fill(MBHFSUMGOOD); + } + + if (verbose) { + edm::LogInfo("L1TdeStage2CaloLayer2") << "MBHFM1 | "; + if (dataEt != emulEt) + edm::LogInfo("L1TdeStage2CaloLayer2") << "x "; + else + edm::LogInfo("L1TdeStage2CaloLayer2") << " "; + edm::LogInfo("L1TdeStage2CaloLayer2") << dataEt << "\t" << emulEt; + edm::LogInfo("L1TdeStage2CaloLayer2") << std::endl; + } + + agreementSummary->Fill(NSUMS_S); + sumSummary->Fill(NSUMS); + } + + // TowerCount + if (l1t::EtSum::EtSumType::kTowerCount == dataIt->getType()) { + + dataEt = dataIt->hwPt(); + emulEt = emulIt->hwPt(); + + if (dataEt != emulEt) { + eventGood = false; + towCountData->Fill(dataEt); + towCountEmul->Fill(emulEt); + } else { + agreementSummary->Fill(SUMGOOD_S); + sumSummary->Fill(SUMGOOD); + sumSummary->Fill(TOWCOUNTGOOD); + } + + if (verbose) { + edm::LogInfo("L1TdeStage2CaloLayer2") << "TowCount | "; + if (dataEt != emulEt) + edm::LogInfo("L1TdeStage2CaloLayer2") << "x "; + else + edm::LogInfo("L1TdeStage2CaloLayer2") << " "; + edm::LogInfo("L1TdeStage2CaloLayer2") << dataEt << "\t" << emulEt; + edm::LogInfo("L1TdeStage2CaloLayer2") << std::endl; + } + + // update sum counters + agreementSummary->Fill(NSUMS_S); + sumSummary->Fill(NTOWCOUNTS); + sumSummary->Fill(NSUMS); + } + + ++dataIt; + ++emulIt; + + if (dataIt == dataCol->end(currBx) || emulIt == emulCol->end(currBx)) + break; + } + + // return a boolean that states whether the jet data in the event is in + // agreement + return eventGood; +} + +DEFINE_FWK_MODULE (L1TdeStage2CaloLayer2); diff --git a/DQM/L1TMonitorClient/interface/L1TStage2CaloLayer2DEClient.h b/DQM/L1TMonitorClient/interface/L1TStage2CaloLayer2DEClient.h index 6eb65f3c3c15e..717710176c1e6 100644 --- a/DQM/L1TMonitorClient/interface/L1TStage2CaloLayer2DEClient.h +++ b/DQM/L1TMonitorClient/interface/L1TStage2CaloLayer2DEClient.h @@ -6,27 +6,31 @@ #include "DQMServices/Core/interface/DQMEDHarvester.h" class L1TStage2CaloLayer2DEClient: public DQMEDHarvester { - + public: - + L1TStage2CaloLayer2DEClient(const edm::ParameterSet&); - - virtual ~L1TStage2CaloLayer2DEClient(); - + + ~L1TStage2CaloLayer2DEClient() override; + protected: - - virtual void dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter)override; - virtual void dqmEndLuminosityBlock(DQMStore::IBooker &ibooker,DQMStore::IGetter &igetter,const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c) override; - + + void dqmEndJob(DQMStore::IBooker &ibooker, + DQMStore::IGetter &igetter) override; + void dqmEndLuminosityBlock(DQMStore::IBooker &ibooker, + DQMStore::IGetter &igetter, + const edm::LuminosityBlock& lumiSeg, + const edm::EventSetup& c) override; + private: - + void book(DQMStore::IBooker &ibooker); void processHistograms(DQMStore::IGetter &igetter); - + std::string monitor_dir_; std::string input_dir_data_; std::string input_dir_emul_; - + MonitorElement* CenJetRankComp_; MonitorElement* CenJetEtaComp_; MonitorElement* CenJetPhiComp_; @@ -46,12 +50,29 @@ class L1TStage2CaloLayer2DEClient: public DQMEDHarvester { MonitorElement* TauEtaComp_; MonitorElement* TauPhiComp_; MonitorElement* METComp_; + MonitorElement* METPhiComp_; + MonitorElement* METHFComp_; + MonitorElement* METHFPhiComp_; MonitorElement* MHTComp_; + MonitorElement* MHTPhiComp_; + MonitorElement* MHTHFComp_; + MonitorElement* MHTHFPhiComp_; MonitorElement* ETTComp_; MonitorElement* HTTComp_; + + MonitorElement* MinBiasHFP0Comp_; + MonitorElement* MinBiasHFM0Comp_; + MonitorElement* MinBiasHFP1Comp_; + MonitorElement* MinBiasHFM1Comp_; + MonitorElement* ETTEMComp_; + MonitorElement* TowerCountComp_; + + MonitorElement * hlSummary; + MonitorElement * jetSummary; + MonitorElement * egSummary; + MonitorElement * tauSummary; + MonitorElement * sumSummary; + MonitorElement * problemSummary; }; #endif - - - diff --git a/DQM/L1TMonitorClient/src/L1TStage2CaloLayer2DEClient.cc b/DQM/L1TMonitorClient/src/L1TStage2CaloLayer2DEClient.cc index 2d2f29550f705..68dedd9f4f7b9 100644 --- a/DQM/L1TMonitorClient/src/L1TStage2CaloLayer2DEClient.cc +++ b/DQM/L1TMonitorClient/src/L1TStage2CaloLayer2DEClient.cc @@ -1,6 +1,7 @@ #include "DQM/L1TMonitorClient/interface/L1TStage2CaloLayer2DEClient.h" -L1TStage2CaloLayer2DEClient::L1TStage2CaloLayer2DEClient(const edm::ParameterSet& ps): +L1TStage2CaloLayer2DEClient::L1TStage2CaloLayer2DEClient( + const edm::ParameterSet& ps): monitor_dir_(ps.getUntrackedParameter("monitorDir","")), input_dir_data_(ps.getUntrackedParameter("inputDataDir","")), input_dir_emul_(ps.getUntrackedParameter("inputEmulDir","")) @@ -8,41 +9,417 @@ L1TStage2CaloLayer2DEClient::L1TStage2CaloLayer2DEClient(const edm::ParameterSet L1TStage2CaloLayer2DEClient::~L1TStage2CaloLayer2DEClient(){} -void L1TStage2CaloLayer2DEClient::dqmEndLuminosityBlock(DQMStore::IBooker &ibooker,DQMStore::IGetter &igetter,const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c) { +void L1TStage2CaloLayer2DEClient::dqmEndLuminosityBlock( + DQMStore::IBooker &ibooker, + DQMStore::IGetter &igetter, + const edm::LuminosityBlock& lumiSeg, + const edm::EventSetup& c) { + + book(ibooker); + processHistograms(igetter); +} + +void L1TStage2CaloLayer2DEClient::dqmEndJob( + DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) { + book(ibooker); processHistograms(igetter); } -void L1TStage2CaloLayer2DEClient::book(DQMStore::IBooker &ibooker){ - +void L1TStage2CaloLayer2DEClient::book(DQMStore::IBooker &ibooker) { + + ibooker.setCurrentFolder("L1TEMU/L1TdeStage2CaloLayer2"); + hlSummary = ibooker.book1D( + "High level summary", "Event by event comparison summary", 5, 1, 6); + hlSummary->setBinLabel(1, "good events"); + hlSummary->setBinLabel(2, "good jets"); + hlSummary->setBinLabel(3, "good e/gs"); + hlSummary->setBinLabel(4, "good taus"); + hlSummary->setBinLabel(5, "good sums"); + + jetSummary = ibooker.book1D( + "Jet Agreement Summary", "Jet Agreement Summary", 3, 1, 4); + jetSummary->setBinLabel(1, "good jets"); + jetSummary->setBinLabel(2, "jets pos off only"); + jetSummary->setBinLabel(3, "jets Et off only "); + + egSummary = ibooker.book1D( + "EG Agreement Summary", "EG Agreement Summary", 6, 1, 7); + egSummary->setBinLabel(1, "good non-iso e/gs"); + egSummary->setBinLabel(2, "non-iso e/gs pos off"); + egSummary->setBinLabel(3, "non-iso e/gs Et off"); + egSummary->setBinLabel(4, "good iso e/gs"); + egSummary->setBinLabel(5, "iso e/gs pos off"); + egSummary->setBinLabel(6, "iso e/gs Et off"); + + tauSummary = ibooker.book1D( + "Tau Agreement Summary", "Tau Agremeent Summary", 6, 1, 7); + tauSummary->setBinLabel(1, "good non-iso taus"); + tauSummary->setBinLabel(2, "non-iso taus pos off"); + tauSummary->setBinLabel(3, "non-iso taus Et off"); + tauSummary->setBinLabel(4, "good iso taus"); + tauSummary->setBinLabel(5, "iso taus pos off"); + tauSummary->setBinLabel(6, "iso taus Et off"); + + sumSummary = ibooker.book1D( + "Energy Sum Agreement Summary", "Sum Agreement Summary", 7, 1, 8); + sumSummary->setBinLabel(1, "good sums"); + sumSummary->setBinLabel(2, "good ETT sums"); + sumSummary->setBinLabel(3, "good HTT sums"); + sumSummary->setBinLabel(4, "good MET sums"); + sumSummary->setBinLabel(5, "good MHT sums"); + sumSummary->setBinLabel(6, "good MBHF sums"); + sumSummary->setBinLabel(7, "good TowCount sums"); + + // problemSummary; + ibooker.setCurrentFolder(monitor_dir_); - - CenJetRankComp_=ibooker.book1D("CenJetsRankDERatio","Data/Emul of central jet E_{T}", 2048, -0.5, 2047.5); - CenJetEtaComp_=ibooker.book1D("CenJetsEtaDERatio","Data/Emul of central jet Eta", 229, -114.5, 114.5); - CenJetPhiComp_=ibooker.book1D("CenJetsPhiDERatio","Data/Emul of central jet Phi", 144, -0.5, 143.5); - ForJetRankComp_=ibooker.book1D("ForJetsRankDERatio","Data/Emul of forward jet E_{T}", 2048, -0.5, 2047.5); - ForJetEtaComp_=ibooker.book1D("ForJetsEtaDERatio","Data/Emul of forward jet Eta", 229, -114.5, 114.5); - ForJetPhiComp_=ibooker.book1D("ForJetsPhiDERatio","Data/Emul of forward jet Phi", 144, -0.5, 143.5); - IsoEGRankComp_=ibooker.book1D("IsoEGRankDERatio","Data/Emul of isolated eg E_{T}", 512, -0.5, 511.5); - IsoEGEtaComp_=ibooker.book1D("IsoEGEtaDERatio","Data/Emul of isolated eg Eta", 229, -114.5, 114.5); - IsoEGPhiComp_=ibooker.book1D("IsoEGPhiDERatio","Data/Emul of isolated eg Phi", 144, -0.5, 143.5); - NonIsoEGRankComp_=ibooker.book1D("NonIsoEGRankDERatio","Data/Emul of non-isolated eg E_{T}", 512, -0.5, 511.5); - NonIsoEGEtaComp_=ibooker.book1D("NonIsoEGEtaDERatio","Data/Emul of non-isolated eg Eta", 229, -114.5, 114.5); - NonIsoEGPhiComp_=ibooker.book1D("NonIsoEGPhiDERatio","Data/Emul of non-isolated eg Phi", 144, -0.5, 143.5); - TauRankComp_=ibooker.book1D("TauRankDERatio","Data/Emul of relax tau E_{T}", 512, -0.5, 511.5); - TauEtaComp_=ibooker.book1D("TauEtaDERatio","Data/Emul of relax tau Eta", 229, -114.5, 114.5); - TauPhiComp_=ibooker.book1D("TauPhiDERatio","Data/Emul of relax tau eg Phi", 144, -0.5, 143.5); - IsoTauRankComp_=ibooker.book1D("IsoTauRankDERatio","Data/Emul of iso tau E_{T}", 512, -0.5, 511.5); - IsoTauEtaComp_=ibooker.book1D("IsoTauEtaDERatio","Data/Emul of iso tau Eta", 229, -114.5, 114.5); - IsoTauPhiComp_=ibooker.book1D("IsoTauPhiDERatio","Data/Emul of iso tau eg Phi", 144, -0.5, 143.5); - METComp_=ibooker.book1D("METRatio","Data/Emul of MET", 4096, -0.5, 4095.5); - MHTComp_=ibooker.book1D("MHTRatio","Data/Emul of MHT", 4096, -0.5, 4095.5); - ETTComp_=ibooker.book1D("ETTRatio","Data/Emul of ET Total", 4096, -0.5, 4095.5); - HTTComp_=ibooker.book1D("HTTRatio","Data/Emul of HT Total", 4096, -0.5, 4095.5); + + CenJetRankComp_ = ibooker.book1D( + "CenJetsRankDERatio","Data/Emul of Central Jet E_{T}; Jet iE_{T}; Counts", + 2048, -0.5, 2047.5); + CenJetEtaComp_ = ibooker.book1D( + "CenJetsEtaDERatio","Data/Emul of Central Jet #eta; Jet i#eta; Counts", + 229, -114.5, 114.5); + CenJetPhiComp_ = ibooker.book1D( + "CenJetsPhiDERatio","Data/Emul of Central Jet #phi; Jet i#phi; Counts", + 144, -0.5, 143.5); + ForJetRankComp_ = ibooker.book1D( + "ForJetsRankDERatio","Data/Emul of Forward Jet E_{T}; Jet iE_{T}; Counts", + 2048, -0.5, 2047.5); + ForJetEtaComp_ = ibooker.book1D( + "ForJetsEtaDERatio","Data/Emul of Forward Jet #eta; Jet i#eta; Counts", + 229, -114.5, 114.5); + ForJetPhiComp_ = ibooker.book1D( + "ForJetsPhiDERatio","Data/Emul of Forward Jet #phi; Jet i#phi; Counts", + 144, -0.5, 143.5); + IsoEGRankComp_ = ibooker.book1D( + "IsoEGRankDERatio","Data/Emul of isolated eg E_{T}; EG iE_{T}; Counts", + 512, -0.5, 511.5); + IsoEGEtaComp_ = ibooker.book1D( + "IsoEGEtaDERatio","Data/Emul of isolated eg #eta; EG i#eta; Counts", + 229, -114.5, 114.5); + IsoEGPhiComp_ = ibooker.book1D( + "IsoEGPhiDERatio","Data/Emul of isolated eg #phi; EG i#eta; Counts", + 144, -0.5, 143.5); + NonIsoEGRankComp_ = ibooker.book1D( + "NonIsoEGRankDERatio", + "Data/Emul of non-isolated eg E_{T}; EG iE_{T}; Counts", + 512, -0.5, 511.5); + NonIsoEGEtaComp_ = ibooker.book1D( + "NonIsoEGEtaDERatio","Data/Emul of non-isolated eg #eta; EG i#eta; Counts", + 229, -114.5, 114.5); + NonIsoEGPhiComp_ = ibooker.book1D( + "NonIsoEGPhiDERatio","Data/Emul of non-isolated eg #phi; EG i#phi; Counts", + 144, -0.5, 143.5); + TauRankComp_ = ibooker.book1D( + "TauRankDERatio","Data/Emul of relax tau E_{T}; Tau iE_{T}; Counts", + 512, -0.5, 511.5); + TauEtaComp_ = ibooker.book1D( + "TauEtaDERatio","Data/Emul of relax tau #eta; Tau i#eta; Counts", + 229, -114.5, 114.5); + TauPhiComp_ = ibooker.book1D( + "TauPhiDERatio","Data/Emul of relax tau eg #phi; Tau i#phi; Counts", + 144, -0.5, 143.5); + IsoTauRankComp_ = ibooker.book1D( + "IsoTauRankDERatio","Data/Emul of iso tau E_{T}; ISO Tau iE_{T}; Counts", + 512, -0.5, 511.5); + IsoTauEtaComp_ = ibooker.book1D( + "IsoTauEtaDERatio","Data/Emul of iso tau #eta; ISO Tau i#eta; Counts", + 229, -114.5, 114.5); + IsoTauPhiComp_ = ibooker.book1D( + "IsoTauPhiDERatio","Data/Emul of iso tau #phi; ISO Tau i#phi; Counts", + 144, -0.5, 143.5); + METComp_ = ibooker.book1D( + "METRatio","Data/Emul of MET; iE_{T}; Events", + 4096, -0.5, 4095.5); + METPhiComp_ = ibooker.book1D( + "METPhiRatio","Data/Emul of MET #phi; MET i#phi; Events", + 1008, -0.5, 1007.5); + METHFComp_ = ibooker.book1D( + "METHFRatio","Data/Emul of METHF; METHF iE_{T}; Events", + 4096, -0.5, 4095.5); + METHFPhiComp_ = ibooker.book1D( + "METHFPhiRatio","Data/Emul of METHF #phi; METHF i#phi; Events", + 1008, -0.5, 1007.5); + MHTComp_ = ibooker.book1D( + "MHTRatio","Data/Emul of MHT; MHT iE_{T}; Events", + 4096, -0.5, 4095.5); + METPhiComp_ = ibooker.book1D( + "MHTPhiRatio","Data/Emul of MHT #phi; MHTHF i#phi; Events", + 1008, -0.5, 1007.5); + MHTHFComp_ = ibooker.book1D( + "MHTHFRatio","Data/Emul of MHTHF; MHTHF iE_{T}; Events", + 4096, -0.5, 4095.5); + MHTPhiComp_ = ibooker.book1D( + "MHTHFPhiRatio","Data/Emul of MHTHF #phi; MHTHF i#phi; Events", + 1008, -0.5, 1007.5); + ETTComp_ = ibooker.book1D( + "ETTRatio","Data/Emul of ET Total; ETT iE_{T}; Events", + 4096, -0.5, 4095.5); + ETTEMComp_ = ibooker.book1D( + "ETTEMRatio","Data/Emul of ET Total EM; ETTEM iE_{T}; Events", + 4096, -0.5, 4095.5); + HTTComp_ = ibooker.book1D( + "HTTRatio","Data/Emul of HT Total; HT iE_{T}; Events", + 4096, -0.5, 4095.5); + + MinBiasHFP0Comp_ = ibooker.book1D( + "MinBiasHFP0Ratio", "Data/Emul MinBiasHFP0; N_{towers}; Events", + 16, -0.5, 15.5); + MinBiasHFM0Comp_ = ibooker.book1D( + "MinBiasHFM0Ratio", "Data/Emul MinBiasHFM0; N_{towers}; Events", + 16, -0.5, 15.5); + MinBiasHFP1Comp_ = ibooker.book1D( + "MinBiasHFP1Ratio", "Data/Emul MinBiasHFP1; N_{towers}; Events", + 16, -0.5, 15.5); + MinBiasHFM1Comp_ = ibooker.book1D( + "MinBiasHFM1Ratio", "Data/Emul MinBiasHFM1; N_{towers}; Events", + 16, -0.5, 15.5); + + TowerCountComp_ = ibooker.book1D( + "TowCountRatio", "Data/Emul Tower Count; N_{towers}; Events", + 5904, -0.5, 5903.5); } void L1TStage2CaloLayer2DEClient::processHistograms(DQMStore::IGetter &igetter){ - + + // get reference to relevant summary MonitorElement instances + // - high level summary + // - eg agreement summary + // - energy sum agreement summary + // - jet agreement summary + // - tau agreement summary + + // TH1F * hist; + // TH1F * newHist; + + MonitorElement * hlSummary_ = igetter.get( + "L1TEMU/L1TdeStage2CaloLayer2/expert/CaloL2 Object Agreement Summary"); + MonitorElement * jetSummary_ = igetter.get( + "L1TEMU/L1TdeStage2CaloLayer2/expert/Jet Agreement Summary"); + MonitorElement * egSummary_ = igetter.get( + "L1TEMU/L1TdeStage2CaloLayer2/expert/EG Agreement Summary"); + MonitorElement * tauSummary_ = igetter.get( + "L1TEMU/L1TdeStage2CaloLayer2/expert/Tau Agreement Summary"); + MonitorElement * sumSummary_ = igetter.get( + "L1TEMU/L1TdeStage2CaloLayer2/expert/Energy Sum Agreement Summary"); + + // check for existance of object + if (hlSummary_) { + + // reference the histogram in MonitorElement + // hist = hlSummary_->getTH1F(); + // newHist = hlSummary->getTH1F(); + + // double totalEvents = 0, goodEvents = 0, totalJets = 0, goodJets = 0, + // totalEg = 0, goodEg = 0, totalTau = 0, goodTau = 0, totalSums = 0, + // goodSums = 0; + + // by default show 100% agreement (for edge case when no objects are found) + double evtRatio = 1, jetRatio = 1, egRatio = 1, tauRatio = 1, sumRatio = 1; + + double totalEvents = hlSummary_->getBinContent(1); + double goodEvents = hlSummary_->getBinContent(2); + double totalJets = hlSummary_->getBinContent(3); + double goodJets = hlSummary_->getBinContent(4); + double totalEg = hlSummary_->getBinContent(5); + double goodEg = hlSummary_->getBinContent(6); + double totalTau = hlSummary_->getBinContent(7); + double goodTau = hlSummary_->getBinContent(8); + double totalSums = hlSummary_->getBinContent(9); + double goodSums = hlSummary_->getBinContent(10); + + if (totalEvents != 0) + evtRatio = goodEvents / totalEvents; + + if (totalJets != 0) + jetRatio = goodJets / totalJets; + + if (totalEg != 0) + egRatio = goodEg / totalEg; + + if (totalTau != 0) + tauRatio = goodTau / totalTau; + + if (totalSums != 0) + sumRatio = goodSums / totalSums; + + hlSummary->setBinContent(1, evtRatio); + hlSummary->setBinContent(2, jetRatio); + hlSummary->setBinContent(3, egRatio); + hlSummary->setBinContent(4, tauRatio); + hlSummary->setBinContent(5, sumRatio); + } + + if (jetSummary_) { + + // double totalJets = 0, goodJets = 0, jetPosOff = 0, jetEtOff = 0; + + // by default show 100% agreement (for edge case when no objects are found) + double goodRatio = 1, posOffRatio = 0, etOffRatio = 0; + + // hist = jetSummary_->getTH1F(); + // newHist = jetSummary->getTH1F(); + + double totalJets = jetSummary_->getBinContent(1); + double goodJets = jetSummary_->getBinContent(2); + double jetPosOff = jetSummary_->getBinContent(3); + double jetEtOff = jetSummary_->getBinContent(4); + + if (totalJets != 0) { + goodRatio = goodJets / totalJets; + posOffRatio = jetPosOff / totalJets; + etOffRatio = jetEtOff / totalJets; + } + + jetSummary->setBinContent(1, goodRatio); + jetSummary->setBinContent(2, posOffRatio); + jetSummary->setBinContent(3, etOffRatio); + } + + if (egSummary_) { + + // double totalEgs = 0, goodEgs = 0, egPosOff = 0, egEtOff = 0, + // totalIsoEgs = 0, goodIsoEgs = 0, isoEgPosOff = 0, isoEgEtOff = 0; + + // by default show 100% agreement (for edge case when no objects are found) + double goodEgRatio = 1, egPosOffRatio = 0, egEtOffRatio = 0, + goodIsoEgRatio = 1, isoEgPosOffRatio = 0, isoEgEtOffRatio = 0; + + // hist = egSummary_->getTH1F(); + // newHist = egSummary->getTH1F(); + + double totalEgs = egSummary_->getBinContent(1); + double goodEgs = egSummary_->getBinContent(2); + double egPosOff = egSummary_->getBinContent(3); + double egEtOff = egSummary_->getBinContent(4); + + double totalIsoEgs = egSummary_->getBinContent(5); + double goodIsoEgs = egSummary_->getBinContent(6); + double isoEgPosOff = egSummary_->getBinContent(7); + double isoEgEtOff = egSummary_->getBinContent(8); + + if (totalEgs != 0) { + goodEgRatio = goodEgs / totalEgs; + egPosOffRatio = egPosOff / totalEgs; + egEtOffRatio = egEtOff / totalEgs; + } + + if (totalIsoEgs != 0) { + goodIsoEgRatio = goodIsoEgs / totalIsoEgs; + isoEgPosOffRatio = isoEgPosOff / totalIsoEgs; + isoEgEtOffRatio = isoEgEtOff / totalIsoEgs; + } + + egSummary->setBinContent(1, goodEgRatio); + egSummary->setBinContent(2, egPosOffRatio); + egSummary->setBinContent(3, egEtOffRatio); + + egSummary->setBinContent(4, goodIsoEgRatio); + egSummary->setBinContent(5, isoEgPosOffRatio); + egSummary->setBinContent(6, isoEgEtOffRatio); + } + + if (tauSummary_) { + + // double totalTaus = 0, goodTaus = 0, tauPosOff = 0, tauEtOff = 0, + // totalIsoTaus = 0, goodIsoTaus = 0, isoTauPosOff = 0, isoTauEtOff = 0; + + // by default show 100% agreement (for edge case when no objects are found) + double goodTauRatio = 1, tauPosOffRatio = 0, tauEtOffRatio = 0, + goodIsoTauRatio = 1, isoTauPosOffRatio= 0, isoTauEtOffRatio = 0; + + // hist = tauSummary_->getTH1F(); + // newHist = tauSummary->getTH1F(); + + double totalTaus = tauSummary_->getBinContent(1); + double goodTaus = tauSummary_->getBinContent(2); + double tauPosOff = tauSummary_->getBinContent(3); + double tauEtOff = tauSummary_->getBinContent(4); + + double totalIsoTaus = tauSummary_->getBinContent(5); + double goodIsoTaus = tauSummary_->getBinContent(6); + double isoTauPosOff = tauSummary_->getBinContent(7); + double isoTauEtOff = tauSummary_->getBinContent(8); + + if (totalTaus != 0) { + goodTauRatio = goodTaus / totalTaus; + tauPosOffRatio = tauPosOff / totalTaus; + tauEtOffRatio = tauEtOff / totalTaus; + } + + if (totalIsoTaus != 0) { + goodIsoTauRatio = goodIsoTaus / totalIsoTaus; + isoTauPosOffRatio = isoTauPosOff / totalIsoTaus; + isoTauEtOffRatio = isoTauEtOff / totalIsoTaus; + } + + tauSummary->setBinContent(1, goodTauRatio); + tauSummary->setBinContent(2, tauPosOffRatio); + tauSummary->setBinContent(3, tauEtOffRatio); + + tauSummary->setBinContent(4, goodIsoTauRatio); + tauSummary->setBinContent(5, isoTauPosOffRatio); + tauSummary->setBinContent(6, isoTauEtOffRatio); + } + + if (sumSummary_) { + + // double totalSums = 0, goodSums = 0, totalETT = 0, goodETT = 0, totalHTT = 0, + // goodHTT = 0, totalMET = 0, goodMET = 0, totalMHT = 0, goodMHT = 0, + // totalMBHF = 0, goodMBHF = 0, totalTowCount = 0, goodTowCount = 0 + + // by default show 100% agreement (for edge case when no objects are found) + double goodSumRatio = 1, goodETTRatio = 1, goodHTTRatio = 1, + goodMETRatio = 1, goodMHTRatio = 1, goodMBHFRatio = 1, + goodTowCountRatio = 1; + + double totalSums = sumSummary_->getBinContent(1); + double goodSums = sumSummary_->getBinContent(2); + double totalETT = sumSummary_->getBinContent(3); + double goodETT = sumSummary_->getBinContent(4); + double totalHTT = sumSummary_->getBinContent(5); + double goodHTT = sumSummary_->getBinContent(6); + double totalMET = sumSummary_->getBinContent(7); + double goodMET = sumSummary_->getBinContent(8); + double totalMHT = sumSummary_->getBinContent(9); + double goodMHT = sumSummary_->getBinContent(10); + double totalMBHF = sumSummary_->getBinContent(11); + double goodMBHF = sumSummary_->getBinContent(12); + double totalTowCount = sumSummary_->getBinContent(13); + double goodTowCount = sumSummary_->getBinContent(14); + + if (totalSums) + goodSumRatio = goodSums / totalSums; + + if (totalETT) + goodETTRatio = goodETT / totalETT; + + if (totalHTT) + goodHTTRatio = goodHTT / totalHTT; + + if (totalMET) + goodMETRatio = goodMET / totalMET; + + if (totalMHT) + goodMHTRatio = goodMHT / totalMHT; + + if (totalMBHF) + goodMBHFRatio = goodMBHF / totalMBHF; + + if (totalTowCount) + goodTowCountRatio = goodTowCount / totalTowCount; + + sumSummary->setBinContent(1, goodSumRatio); + sumSummary->setBinContent(2, goodETTRatio); + sumSummary->setBinContent(3, goodHTTRatio); + sumSummary->setBinContent(4, goodMETRatio); + sumSummary->setBinContent(5, goodMHTRatio); + sumSummary->setBinContent(6, goodMBHFRatio); + sumSummary->setBinContent(7, goodTowCountRatio); + } + MonitorElement* dataHist_; MonitorElement* emulHist_; @@ -53,34 +430,33 @@ void L1TStage2CaloLayer2DEClient::processHistograms(DQMStore::IGetter &igetter){ if (dataHist_ && emulHist_){ TH1F *cjrNum = dataHist_->getTH1F(); TH1F *cjrDen = emulHist_->getTH1F(); - + TH1F *CenJetRankRatio = CenJetRankComp_->getTH1F(); CenJetRankRatio->Divide(cjrNum, cjrDen); } - - + dataHist_ = igetter.get(input_dir_data_+"/Central-Jets/"+"CenJetsEta"); emulHist_ = igetter.get(input_dir_emul_+"/Central-Jets/"+"CenJetsEta"); - if (dataHist_ && emulHist_){ + if (dataHist_ && emulHist_){ TH1F *cjeNum = dataHist_->getTH1F(); TH1F *cjeDen = emulHist_->getTH1F(); TH1F *CenJetEtaRatio = CenJetEtaComp_->getTH1F(); - + CenJetEtaRatio->Divide(cjeNum, cjeDen); } dataHist_ = igetter.get(input_dir_data_+"/Central-Jets/"+"CenJetsPhi"); emulHist_ = igetter.get(input_dir_emul_+"/Central-Jets/"+"CenJetsPhi"); - if (dataHist_ && emulHist_){ + if (dataHist_ && emulHist_){ TH1F *cjpNum = dataHist_->getTH1F(); TH1F *cjpDen = emulHist_->getTH1F(); - + TH1F *CenJetPhiRatio = CenJetPhiComp_->getTH1F(); - + CenJetPhiRatio->Divide(cjpNum, cjpDen); } @@ -88,76 +464,76 @@ void L1TStage2CaloLayer2DEClient::processHistograms(DQMStore::IGetter &igetter){ // forward jets dataHist_ = igetter.get(input_dir_data_+"/Forward-Jets/"+"ForJetsRank"); emulHist_ = igetter.get(input_dir_emul_+"/Forward-Jets/"+"ForJetsRank"); - - if (dataHist_ && emulHist_){ - + + if (dataHist_ && emulHist_){ + TH1F *fjrNum = dataHist_->getTH1F(); TH1F *fjrDen = emulHist_->getTH1F(); - + TH1F *ForJetRankRatio = ForJetRankComp_->getTH1F(); - + ForJetRankRatio->Divide(fjrNum, fjrDen); } - + dataHist_ = igetter.get(input_dir_data_+"/Forward-Jets/"+"ForJetsEta"); emulHist_ = igetter.get(input_dir_emul_+"/Forward-Jets/"+"ForJetsEta"); if (dataHist_ && emulHist_){ TH1F *fjeNum = dataHist_->getTH1F(); TH1F *fjeDen = emulHist_->getTH1F(); - + TH1F *ForJetEtaRatio = ForJetEtaComp_->getTH1F(); - + ForJetEtaRatio->Divide(fjeNum, fjeDen); } - + dataHist_ = igetter.get(input_dir_data_+"/Forward-Jets/"+"ForJetsPhi"); emulHist_ = igetter.get(input_dir_emul_+"/Forward-Jets/"+"ForJetsPhi"); if (dataHist_ && emulHist_){ TH1F *fjpNum = dataHist_->getTH1F(); TH1F *fjpDen = emulHist_->getTH1F(); - + TH1F *ForJetPhiRatio = ForJetPhiComp_->getTH1F(); - + ForJetPhiRatio->Divide(fjpNum, fjpDen); } // isolated eg - + dataHist_ = igetter.get(input_dir_data_+"/Isolated-EG/"+"IsoEGsRank"); emulHist_ = igetter.get(input_dir_emul_+"/Isolated-EG/"+"IsoEGsRank"); - if (dataHist_ && emulHist_){ + if (dataHist_ && emulHist_){ TH1F *ierNum = dataHist_->getTH1F(); TH1F *ierDen = emulHist_->getTH1F(); - + TH1F *IsoEGRankRatio = IsoEGRankComp_->getTH1F(); - + IsoEGRankRatio->Divide(ierNum, ierDen); } - + dataHist_ = igetter.get(input_dir_data_+"/Isolated-EG/"+"IsoEGsEta"); emulHist_ = igetter.get(input_dir_emul_+"/Isolated-EG/"+"IsoEGsEta"); if (dataHist_ && emulHist_){ TH1F *ieeNum = dataHist_->getTH1F(); TH1F *ieeDen = emulHist_->getTH1F(); - + TH1F *IsoEGEtaRatio = IsoEGEtaComp_->getTH1F(); - + IsoEGEtaRatio->Divide(ieeNum, ieeDen); } - + dataHist_ = igetter.get(input_dir_data_+"/Isolated-EG/"+"IsoEGsPhi"); emulHist_ = igetter.get(input_dir_emul_+"/Isolated-EG/"+"IsoEGsPhi"); if (dataHist_ && emulHist_){ TH1F *iepNum = dataHist_->getTH1F(); TH1F *iepDen = emulHist_->getTH1F(); - + TH1F *IsoEGPhiRatio = IsoEGPhiComp_->getTH1F(); - + IsoEGPhiRatio->Divide(iepNum, iepDen); } @@ -165,113 +541,113 @@ void L1TStage2CaloLayer2DEClient::processHistograms(DQMStore::IGetter &igetter){ dataHist_ = igetter.get(input_dir_data_+"/NonIsolated-EG/"+"NonIsoEGsRank"); emulHist_ = igetter.get(input_dir_emul_+"/NonIsolated-EG/"+"NonIsoEGsRank"); - if (dataHist_ && emulHist_){ + if (dataHist_ && emulHist_){ TH1F *nerNum = dataHist_->getTH1F(); TH1F *nerDen = emulHist_->getTH1F(); - + TH1F *NonIsoEGRankRatio = NonIsoEGRankComp_->getTH1F(); - + NonIsoEGRankRatio->Divide(nerNum, nerDen); } - + dataHist_ = igetter.get(input_dir_data_+"/NonIsolated-EG/"+"NonIsoEGsEta"); emulHist_ = igetter.get(input_dir_emul_+"/NonIsolated-EG/"+"NonIsoEGsEta"); if (dataHist_ && emulHist_){ TH1F *neeNum = dataHist_->getTH1F(); TH1F *neeDen = emulHist_->getTH1F(); - + TH1F *NonIsoEGEtaRatio = NonIsoEGEtaComp_->getTH1F(); - + NonIsoEGEtaRatio->Divide(neeNum, neeDen); } - + dataHist_ = igetter.get(input_dir_data_+"/NonIsolated-EG/"+"NonIsoEGsPhi"); emulHist_ = igetter.get(input_dir_emul_+"/NonIsolated-EG/"+"NonIsoEGsPhi"); if (dataHist_ && emulHist_){ TH1F *nepNum = dataHist_->getTH1F(); TH1F *nepDen = emulHist_->getTH1F(); - + TH1F *NonIsoEGPhiRatio = NonIsoEGPhiComp_->getTH1F(); - + NonIsoEGPhiRatio->Divide(nepNum, nepDen); } // rlx tau dataHist_ = igetter.get(input_dir_data_+"/NonIsolated-Tau/"+"TausRank"); emulHist_ = igetter.get(input_dir_emul_+"/NonIsolated-Tau/"+"TausRank"); - - if (dataHist_ && emulHist_){ + + if (dataHist_ && emulHist_){ TH1F *trNum = dataHist_->getTH1F(); TH1F *trDen = emulHist_->getTH1F(); - + TH1F *TauRankRatio = TauRankComp_->getTH1F(); - + TauRankRatio->Divide(trNum, trDen); } - + dataHist_ = igetter.get(input_dir_data_+"/NonIsolated-Tau/"+"TausEta"); emulHist_ = igetter.get(input_dir_emul_+"/NonIsolated-Tau/"+"TausEta"); if (dataHist_ && emulHist_){ TH1F *teNum = dataHist_->getTH1F(); TH1F *teDen = emulHist_->getTH1F(); - + TH1F *TauEtaRatio = TauEtaComp_->getTH1F(); - + TauEtaRatio->Divide(teNum, teDen); } - + dataHist_ = igetter.get(input_dir_data_+"/NonIsolated-Tau/"+"TausPhi"); emulHist_ = igetter.get(input_dir_emul_+"/NonIsolated-Tau/"+"TausPhi"); if (dataHist_ && emulHist_){ TH1F *tpNum = dataHist_->getTH1F(); TH1F *tpDen = emulHist_->getTH1F(); - + TH1F *TauPhiRatio = TauPhiComp_->getTH1F(); - - TauPhiRatio->Divide(tpNum, tpDen); + + TauPhiRatio->Divide(tpNum, tpDen); } - + // iso tau dataHist_ = igetter.get(input_dir_data_+"/Isolated-Tau/"+"IsoTausRank"); emulHist_ = igetter.get(input_dir_emul_+"/Isolated-Tau/"+"IsoTausRank"); - if (dataHist_ && emulHist_){ + if (dataHist_ && emulHist_){ TH1F *itrNum = dataHist_->getTH1F(); TH1F *itrDen = emulHist_->getTH1F(); - + TH1F *IsoTauRankRatio = IsoTauRankComp_->getTH1F(); - + IsoTauRankRatio->Divide(itrNum, itrDen); } - + dataHist_ = igetter.get(input_dir_data_+"/Isolated-Tau/"+"IsoTausEta"); emulHist_ = igetter.get(input_dir_emul_+"/Isolated-Tau/"+"IsoTausEta"); - - if (dataHist_ && emulHist_){ + + if (dataHist_ && emulHist_){ TH1F *iteNum = dataHist_->getTH1F(); TH1F *iteDen = emulHist_->getTH1F(); - + TH1F *IsoTauEtaRatio = IsoTauEtaComp_->getTH1F(); - + IsoTauEtaRatio->Divide(iteNum, iteDen); } - + dataHist_ = igetter.get(input_dir_data_+"/Isolated-Tau/"+"IsoTausPhi"); emulHist_ = igetter.get(input_dir_emul_+"/Isolated-Tau/"+"IsoTausPhi"); if (dataHist_ && emulHist_){ TH1F *itpNum = dataHist_->getTH1F(); TH1F *itpDen = emulHist_->getTH1F(); - + TH1F *IsoTauPhiRatio = IsoTauPhiComp_->getTH1F(); - + IsoTauPhiRatio->Divide(itpNum, itpDen); } - + // MET dataHist_ = igetter.get(input_dir_data_+"/Energy-Sums/"+"METRank"); emulHist_ = igetter.get(input_dir_emul_+"/Energy-Sums/"+"METRank"); @@ -279,25 +655,114 @@ void L1TStage2CaloLayer2DEClient::processHistograms(DQMStore::IGetter &igetter){ if (dataHist_ && emulHist_){ TH1F *metNum = dataHist_->getTH1F(); TH1F *metDen = emulHist_->getTH1F(); - + TH1F *METRatio = METComp_->getTH1F(); - + METRatio->Divide(metNum, metDen); } + // This causes CMSSW to segfault with a complaint that ROOT cannot divide two + // histograms with different number of bins. Checking the contents of the data + // and emulator histograms, using both GetNbinsX() and GetSize(), it can be + // seen that the reported number of bins is the same. This needs more + // investigation. + + // MET Phi + // dataHist_ = igetter.get(input_dir_data_+"/Energy-Sums/"+"METPhi"); + // emulHist_ = igetter.get(input_dir_emul_+"/Energy-Sums/"+"METPhi"); + + // if (dataHist_ && emulHist_){ + // TH1F * metphiNum = dataHist_->getTH1F(); + // TH1F * metphiDen = emulHist_->getTH1F(); + + // TH1F * METPhiRatio = METPhiComp_->getTH1F(); + + // std::cout << "data met " << metphiNum->GetNbinsX() << std::endl; + // std::cout << "emul met " << metphiDen->GetNbinsX() << std::endl; + + // METPhiRatio->Divide(metphiNum, metphiDen); + // } + + // METHF + dataHist_ = igetter.get(input_dir_data_+"/Energy-Sums/"+"METHFRank"); + emulHist_ = igetter.get(input_dir_emul_+"/Energy-Sums/"+"METHFRank"); + + if (dataHist_ && emulHist_){ + TH1F *methfNum = dataHist_->getTH1F(); + TH1F *methfDen = emulHist_->getTH1F(); + + TH1F *METHFRatio = METHFComp_->getTH1F(); + + METHFRatio->Divide(methfNum, methfDen); + } + + // // METHF Phi + // dataHist_ = igetter.get(input_dir_data_+"/Energy-Sums/"+"METHFPhi"); + // emulHist_ = igetter.get(input_dir_emul_+"/Energy-Sums/"+"METHFPhi"); + + // if (dataHist_ && emulHist_){ + // TH1F *methfphiNum = dataHist_->getTH1F(); + // TH1F *methfphiDen = emulHist_->getTH1F(); + + // TH1F *METHFPhiRatio = METHFPhiComp_->getTH1F(); + + // METHFPhiRatio->Divide(methfphiNum, methfphiDen); + // } + // MHT dataHist_ = igetter.get(input_dir_data_+"/Energy-Sums/"+"MHTRank"); emulHist_ = igetter.get(input_dir_emul_+"/Energy-Sums/"+"MHTRank"); + if (dataHist_ && emulHist_){ TH1F *mhtNum = dataHist_->getTH1F(); TH1F *mhtDen = emulHist_->getTH1F(); TH1F *MHTRatio = MHTComp_->getTH1F(); - + MHTRatio->Divide(mhtNum, mhtDen); } + // // MHT Phi + // dataHist_ = igetter.get(input_dir_data_+"/Energy-Sums/"+"MHTPhi"); + // emulHist_ = igetter.get(input_dir_emul_+"/Energy-Sums/"+"MHTPhi"); + + // if (dataHist_ && emulHist_){ + // TH1F * mhtphiNum = dataHist_->getTH1F(); + // TH1F * mhtphiDen = emulHist_->getTH1F(); + + // TH1F * MHTPhiRatio = METHFPhiComp_->getTH1F(); + + // MHTPhiRatio->Divide(mhtphiNum, mhtphiDen); + // } + + // MHTHF + dataHist_ = igetter.get(input_dir_data_+"/Energy-Sums/"+"MHTHFRank"); + emulHist_ = igetter.get(input_dir_emul_+"/Energy-Sums/"+"MHTHFRank"); + + if (dataHist_ && emulHist_){ + TH1F *mhthfNum = dataHist_->getTH1F(); + TH1F *mhthfDen = emulHist_->getTH1F(); + + TH1F *MHTHFRatio = MHTHFComp_->getTH1F(); + + MHTHFRatio->Divide(mhthfNum, mhthfDen); + } + + // // MHTHF Phi + // dataHist_ = igetter.get(input_dir_data_+"/Energy-Sums/"+"MHTHFPhi"); + // emulHist_ = igetter.get(input_dir_emul_+"/Energy-Sums/"+"MHTHFPhi"); + + // if (dataHist_ && emulHist_){ + // TH1F *mhthfphiNum = dataHist_->getTH1F(); + // TH1F *mhthfphiDen = emulHist_->getTH1F(); + + // TH1F *MHTHFPhiRatio = MHTHFPhiComp_->getTH1F(); + + // std::cout << "dividing mhthf phi" << std::endl; + // MHTHFPhiRatio->Divide(mhthfphiNum, mhthfphiDen); + // } + // ETT dataHist_ = igetter.get(input_dir_data_+"/Energy-Sums/"+"ETTRank"); emulHist_ = igetter.get(input_dir_emul_+"/Energy-Sums/"+"ETTRank"); @@ -305,12 +770,25 @@ void L1TStage2CaloLayer2DEClient::processHistograms(DQMStore::IGetter &igetter){ if (dataHist_ && emulHist_){ TH1F *ettNum = dataHist_->getTH1F(); TH1F *ettDen = emulHist_->getTH1F(); - + TH1F *ETTRatio = ETTComp_->getTH1F(); - + ETTRatio->Divide(ettNum, ettDen); } + // ETTEM + dataHist_ = igetter.get(input_dir_data_+"/Energy-Sums/"+"ETTEMRank"); + emulHist_ = igetter.get(input_dir_emul_+"/Energy-Sums/"+"ETTEMRank"); + + if (dataHist_ && emulHist_){ + TH1F *ettemNum = dataHist_->getTH1F(); + TH1F *ettemDen = emulHist_->getTH1F(); + + TH1F *ETTEMRatio = ETTEMComp_->getTH1F(); + + ETTEMRatio->Divide(ettemNum, ettemDen); + } + // HTT dataHist_ = igetter.get(input_dir_data_+"/Energy-Sums/"+"HTTRank"); emulHist_ = igetter.get(input_dir_emul_+"/Energy-Sums/"+"HTTRank"); @@ -318,17 +796,74 @@ void L1TStage2CaloLayer2DEClient::processHistograms(DQMStore::IGetter &igetter){ if (dataHist_ && emulHist_){ TH1F *httNum = dataHist_->getTH1F(); TH1F *httDen = emulHist_->getTH1F(); - + TH1F *HTTRatio = HTTComp_->getTH1F(); - + HTTRatio->Divide(httNum, httDen); } -} - -void L1TStage2CaloLayer2DEClient::dqmEndJob(DQMStore::IBooker &ibooker, DQMStore::IGetter &igetter) { - book(ibooker); - processHistograms(igetter); -} + // MBHFP0 + dataHist_ = igetter.get(input_dir_data_+"/Energy-Sums/"+"MinBiasHFP0"); + emulHist_ = igetter.get(input_dir_emul_+"/Energy-Sums/"+"MinBiasHFP0"); + + if (dataHist_ && emulHist_){ + TH1F *mbhfp0Num = dataHist_->getTH1F(); + TH1F *mbhfp0Den = emulHist_->getTH1F(); - + TH1F *MBHFP0Ratio = MinBiasHFP0Comp_->getTH1F(); + + MBHFP0Ratio->Divide(mbhfp0Num, mbhfp0Den); + } + + // MBHFM0 + dataHist_ = igetter.get(input_dir_data_+"/Energy-Sums/"+"MinBiasHFM0"); + emulHist_ = igetter.get(input_dir_emul_+"/Energy-Sums/"+"MinBiasHFM0"); + + if (dataHist_ && emulHist_){ + TH1F *mbhfm0Num = dataHist_->getTH1F(); + TH1F *mbhfm0Den = emulHist_->getTH1F(); + + TH1F *MBHFM0Ratio = MinBiasHFM0Comp_->getTH1F(); + + MBHFM0Ratio->Divide(mbhfm0Num, mbhfm0Den); + } + + // MBHFP1 + dataHist_ = igetter.get(input_dir_data_+"/Energy-Sums/"+"MinBiasHFP1"); + emulHist_ = igetter.get(input_dir_emul_+"/Energy-Sums/"+"MinBiasHFP1"); + + if (dataHist_ && emulHist_){ + TH1F *mbhfp1Num = dataHist_->getTH1F(); + TH1F *mbhfp1Den = emulHist_->getTH1F(); + + TH1F *MBHFP1Ratio = MinBiasHFP1Comp_->getTH1F(); + + MBHFP1Ratio->Divide(mbhfp1Num, mbhfp1Den); + } + + // MBHFM1 + dataHist_ = igetter.get(input_dir_data_+"/Energy-Sums/"+"MinBiasHFM1"); + emulHist_ = igetter.get(input_dir_emul_+"/Energy-Sums/"+"MinBiasHFM1"); + + if (dataHist_ && emulHist_){ + TH1F *mbhfm1Num = dataHist_->getTH1F(); + TH1F *mbhfm1Den = emulHist_->getTH1F(); + + TH1F *MBHFM1Ratio = MinBiasHFM1Comp_->getTH1F(); + + MBHFM1Ratio->Divide(mbhfm1Num, mbhfm1Den); + } + + // TowerCount + dataHist_ = igetter.get(input_dir_data_+"/Energy-Sums/"+"TowCount"); + emulHist_ = igetter.get(input_dir_emul_+"/Energy-Sums/"+"TowCount"); + + if (dataHist_ && emulHist_){ + TH1F *towCountNum = dataHist_->getTH1F(); + TH1F *towCountDen = emulHist_->getTH1F(); + + TH1F *TowCountRatio = TowerCountComp_->getTH1F(); + + TowCountRatio->Divide(towCountNum, towCountDen); + } +}