Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:01:42

0001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0002 
0003 #include "CondCore/Utilities/interface/PayloadInspectorModule.h"
0004 #include "CondCore/CondDB/interface/Time.h"
0005 
0006 #include <iostream>
0007 #include <sstream>
0008 #include "CondCore/Utilities/interface/PayloadInspector.h"
0009 #include "CondCore/JetMETPlugins/plugins/JetResolution_PayloadInspector.cc"
0010 
0011 #include "FWCore/PluginManager/interface/PluginManager.h"
0012 #include "FWCore/PluginManager/interface/standard.h"
0013 #include "FWCore/ServiceRegistry/interface/ServiceRegistry.h"
0014 
0015 int main(int argc, char** argv) {
0016   Py_Initialize();
0017   edmplugin::PluginManager::Config config;
0018   edmplugin::PluginManager::configure(edmplugin::standard::config());
0019 
0020   std::vector<edm::ParameterSet> psets;
0021   edm::ParameterSet pSet;
0022   pSet.addParameter("@service_type", std::string("SiteLocalConfigService"));
0023   psets.push_back(pSet);
0024   edm::ServiceToken servToken(edm::ServiceRegistry::createSet(psets));
0025   edm::ServiceRegistry::Operate operate(servToken);
0026 
0027   std::string connectionString("frontier://FrontierProd/CMS_CONDITIONS");
0028 
0029   std::string tag_pt = "JR_Fall17_V3_106X_MC_PtResolution_AK4PF";
0030   std::string tag_eta = "JR_Fall17_V3_106X_MC_EtaResolution_AK4PF";
0031   std::string tag_sf = "JR_Fall17_V3_106X_MC_SF_AK4PF";
0032   cond::Time_t start = static_cast<unsigned long long>(1);
0033   cond::Time_t end = static_cast<unsigned long long>(1);
0034   py::dict inputs;
0035 
0036   inputs["Jet_Pt"] = "120.";
0037   inputs["Jet_Eta"] = "0.";
0038   inputs["Jet_Rho"] = "30.";
0039 
0040   edm::LogPrint("JER_PI") << "## Jet Pt Resolution Histograms" << std::endl;
0041 
0042   JME::JetResolutionVsEta histo1;
0043   histo1.setInputParamValues(inputs);
0044   histo1.process(connectionString, PI::mk_input(tag_pt, start, end));
0045   edm::LogPrint("JER_PI") << histo1.data() << std::endl;
0046 
0047   JME::JetResolutionVsPt histo2;
0048   histo2.setInputParamValues(inputs);
0049   histo2.process(connectionString, PI::mk_input(tag_pt, start, end));
0050   edm::LogPrint("JER_PI") << histo2.data() << std::endl;
0051 
0052   edm::LogPrint("JER_PI") << "## Jet Eta Resolution Histograms" << std::endl;
0053 
0054   JME::JetResolutionVsEta histo3;
0055   histo3.setInputParamValues(inputs);
0056   histo3.process(connectionString, PI::mk_input(tag_eta, start, end));
0057   edm::LogPrint("JER_PI") << histo3.data() << std::endl;
0058 
0059   JME::JetResolutionVsPt histo4;
0060   histo4.setInputParamValues(inputs);
0061   histo4.process(connectionString, PI::mk_input(tag_eta, start, end));
0062   edm::LogPrint("JER_PI") << histo4.data() << std::endl;
0063 
0064   edm::LogPrint("JER_PI") << "## Jet SF vs. Eta Histograms" << std::endl;
0065 
0066   JME::JetScaleFactorVsEtaNORM histo5;
0067   histo5.setInputParamValues(inputs);
0068   histo5.process(connectionString, PI::mk_input(tag_sf, start, end));
0069   edm::LogPrint("JER_PI") << histo5.data() << std::endl;
0070 
0071   JME::JetScaleFactorVsEtaDOWN histo6;
0072   histo6.setInputParamValues(inputs);
0073   histo6.process(connectionString, PI::mk_input(tag_sf, start, end));
0074   edm::LogPrint("JER_PI") << histo6.data() << std::endl;
0075 
0076   JME::JetScaleFactorVsEtaUP histo7;
0077   histo7.setInputParamValues(inputs);
0078   histo7.process(connectionString, PI::mk_input(tag_sf, start, end));
0079   edm::LogPrint("JER_PI") << histo7.data() << std::endl;
0080 
0081   tag_sf = "JR_Autumn18_V7_MC_SF_AK4PF";
0082 
0083   edm::LogPrint("JER_PI") << "## Jet SF vs. Pt Histograms" << std::endl;
0084 
0085   JME::JetScaleFactorVsPtNORM histo8;
0086   histo8.setInputParamValues(inputs);
0087   histo8.process(connectionString, PI::mk_input(tag_sf, start, end));
0088   edm::LogPrint("JER_PI") << histo8.data() << std::endl;
0089 
0090   JME::JetScaleFactorVsPtDOWN histo9;
0091   histo9.setInputParamValues(inputs);
0092   histo9.process(connectionString, PI::mk_input(tag_sf, start, end));
0093   edm::LogPrint("JER_PI") << histo9.data() << std::endl;
0094 
0095   JME::JetScaleFactorVsPtUP histo10;
0096   histo10.setInputParamValues(inputs);
0097   histo10.process(connectionString, PI::mk_input(tag_sf, start, end));
0098   edm::LogPrint("JER_PI") << histo10.data() << std::endl;
0099 
0100   inputs.clear();
0101 #if PY_MAJOR_VERSION >= 3
0102   // TODO check why this Py_INCREF is necessary...
0103   Py_INCREF(inputs.ptr());
0104 #endif
0105 
0106   Py_Finalize();
0107 }