File indexing completed on 2024-09-07 04:35:45
0001 #include <memory>
0002 #include "FWCore/Framework/interface/Frameworkfwd.h"
0003 #include "FWCore/Framework/interface/one/EDAnalyzer.h"
0004 #include "FWCore/Framework/interface/Event.h"
0005 #include "FWCore/Framework/interface/MakerMacros.h"
0006 #include "FWCore/Framework/interface/EventSetup.h"
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 #include "FWCore/Framework/interface/ESHandle.h"
0009 #include "CondFormats/JetMETObjects/interface/QGLikelihoodObject.h"
0010 #include "JetMETCorrections/Objects/interface/JetCorrectionsRecord.h"
0011 #include "CondFormats/DataRecord/interface/QGLikelihoodSystematicsRcd.h"
0012
0013 class QGLikelihoodSystematicsDBReader : public edm::one::EDAnalyzer<> {
0014 public:
0015 explicit QGLikelihoodSystematicsDBReader(const edm::ParameterSet&);
0016 ~QGLikelihoodSystematicsDBReader() override {}
0017
0018 private:
0019 void beginJob() override {}
0020 void analyze(const edm::Event&, const edm::EventSetup&) override;
0021 void endJob() override {}
0022
0023 std::string mPayloadName;
0024 edm::ESGetToken<QGLikelihoodSystematicsObject, QGLikelihoodSystematicsRcd> mPayloadToken;
0025 bool mCreateTextFile, mPrintScreen;
0026 };
0027
0028 QGLikelihoodSystematicsDBReader::QGLikelihoodSystematicsDBReader(const edm::ParameterSet& iConfig) {
0029 mPayloadName = iConfig.getUntrackedParameter<std::string>("payloadName");
0030 mPayloadToken = esConsumes(edm::ESInputTag("", mPayloadName));
0031 mPrintScreen = iConfig.getUntrackedParameter<bool>("printScreen");
0032 mCreateTextFile = iConfig.getUntrackedParameter<bool>("createTextFile");
0033 }
0034
0035 void QGLikelihoodSystematicsDBReader::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
0036 edm::LogInfo("UserOutput") << "Inspecting QGLikelihood payload with label:" << mPayloadName << std::endl;
0037 edm::ESHandle<QGLikelihoodSystematicsObject> QGLSysPar = iSetup.getHandle(mPayloadToken);
0038
0039 std::vector<QGLikelihoodSystematicsObject::Entry> const& data = QGLSysPar->data;
0040 edm::LogInfo("UserOutput") << "There are " << data.size()
0041 << " entries (categories with parameters for smearing):" << std::endl;
0042 for (auto idata = data.begin(); idata != data.end(); ++idata) {
0043 int qgBin = idata->systCategory.QGIndex;
0044 double etaMin = idata->systCategory.EtaMin;
0045 double etaMax = idata->systCategory.EtaMax;
0046 double rhoMin = idata->systCategory.RhoMin;
0047 double rhoMax = idata->systCategory.RhoMax;
0048 double ptMin = idata->systCategory.PtMin;
0049 double ptMax = idata->systCategory.PtMax;
0050 double a = idata->a;
0051 double b = idata->b;
0052 double lmin = idata->lmin;
0053 double lmax = idata->lmax;
0054
0055 char buff[1000];
0056 sprintf(buff,
0057 "qg=%1d, ptMin=%8.2f, ptMax=%8.2f, etaMin=%3.1f, etaMax=%3.1f, rhoMin=%6.2f, rhoMax=%6.2f, a=%7.3f, "
0058 "b=%7.3f, lmin=%6.2f, lmax=%6.2f",
0059 qgBin,
0060 ptMin,
0061 ptMax,
0062 etaMin,
0063 etaMax,
0064 rhoMin,
0065 rhoMax,
0066 a,
0067 b,
0068 lmin,
0069 lmax);
0070 edm::LogVerbatim("UserOutput") << buff << std::endl;
0071 }
0072 }
0073
0074 DEFINE_FWK_MODULE(QGLikelihoodSystematicsDBReader);