Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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/JetCorrector_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_mc = "JetCorrectorParametersCollection_Autumn18_V19_MC_AK4PF";
0030   std::string tag_data = "JetCorrectorParametersCollection_Autumn18_RunABCD_V19_DATA_AK4PF";
0031   cond::Time_t start = static_cast<unsigned long long>(1);
0032   cond::Time_t end = static_cast<unsigned long long>(1);
0033   py::dict inputs;
0034 
0035   inputs["Jet_Pt"] = "120.";
0036   inputs["Jet_Eta"] = "0.";
0037   inputs["Jet_Rho"] = "30.";
0038 
0039   edm::LogPrint("JEC_PI") << "## Jet Energy Corrector Vs. Eta Histograms MC" << std::endl;
0040 
0041   JetCorrectorVsEtaL1Offset histo1;
0042   histo1.setInputParamValues(inputs);
0043   histo1.process(connectionString, PI::mk_input(tag_mc, start, end));
0044   edm::LogPrint("JEC_PI") << histo1.data() << std::endl;
0045 
0046   JetCorrectorVsEtaL1FastJet histo2;
0047   histo2.setInputParamValues(inputs);
0048   histo2.process(connectionString, PI::mk_input(tag_mc, start, end));
0049   edm::LogPrint("JEC_PI") << histo2.data() << std::endl;
0050 
0051   JetCorrectorVsEtaL2Relative histo3;
0052   histo3.setInputParamValues(inputs);
0053   histo3.process(connectionString, PI::mk_input(tag_mc, start, end));
0054   edm::LogPrint("JEC_PI") << histo3.data() << std::endl;
0055 
0056   JetCorrectorVsEtaL3Absolute histo4;
0057   histo4.setInputParamValues(inputs);
0058   histo4.process(connectionString, PI::mk_input(tag_mc, start, end));
0059   edm::LogPrint("JEC_PI") << histo4.data() << std::endl;
0060 
0061   JetCorrectorVsEtaL2L3Residual histo5;
0062   histo5.setInputParamValues(inputs);
0063   histo5.process(connectionString, PI::mk_input(tag_mc, start, end));
0064   edm::LogPrint("JEC_PI") << histo5.data() << std::endl;
0065 
0066   JetCorrectorVsEtaUncertainty histo6;
0067   histo6.setInputParamValues(inputs);
0068   histo6.process(connectionString, PI::mk_input(tag_mc, start, end));
0069   edm::LogPrint("JEC_PI") << histo6.data() << std::endl;
0070 
0071   JetCorrectorVsEtaL1RC histo7;
0072   histo7.setInputParamValues(inputs);
0073   histo7.process(connectionString, PI::mk_input(tag_mc, start, end));
0074   edm::LogPrint("JEC_PI") << histo7.data() << std::endl;
0075 
0076   inputs.clear();
0077 #if PY_MAJOR_VERSION >= 3
0078   // TODO check why this Py_INCREF is necessary...
0079   Py_INCREF(inputs.ptr());
0080 #endif
0081 
0082   Py_Finalize();
0083 }