Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <memory>
00024
00025
00026 #include "FWCore/Framework/interface/Frameworkfwd.h"
00027 #include "FWCore/Framework/interface/EDAnalyzer.h"
00028
00029 #include "FWCore/Framework/interface/Event.h"
00030 #include "FWCore/Framework/interface/MakerMacros.h"
00031
00032 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00033 #include "TFile.h"
00034 #include "CondFormats/EgammaObjects/interface/GBRForest.h"
00035 #include "FWCore/ServiceRegistry/interface/Service.h"
00036
00037
00038
00039 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
00040 #include "FWCore/Framework/interface/ESHandle.h"
00041 #include "FWCore/Framework/interface/EventSetup.h"
00042 #include "CondFormats/DataRecord/interface/GBRWrapperRcd.h"
00043
00044
00045
00046
00047
00048
00049 class GBRWrapperMaker : public edm::EDAnalyzer {
00050 public:
00051 explicit GBRWrapperMaker(const edm::ParameterSet&);
00052 ~GBRWrapperMaker();
00053
00054 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
00055
00056
00057 private:
00058 virtual void beginJob() ;
00059 virtual void analyze(const edm::Event&, const edm::EventSetup&);
00060 virtual void endJob() ;
00061
00062 virtual void beginRun(edm::Run const&, edm::EventSetup const&);
00063 virtual void endRun(edm::Run const&, edm::EventSetup const&);
00064 virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&);
00065 virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&);
00066
00067
00068 };
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081 GBRWrapperMaker::GBRWrapperMaker(const edm::ParameterSet& iConfig)
00082
00083 {
00084
00085
00086 }
00087
00088
00089 GBRWrapperMaker::~GBRWrapperMaker()
00090 {
00091
00092
00093
00094
00095 }
00096
00097
00098
00099
00100
00101
00102
00103 void
00104 GBRWrapperMaker::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00105 {
00106 using namespace edm;
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120 TFile *infile = new TFile("/afs/cern.ch/user/b/bendavid/cmspublic/gbrv3ph.root","READ");
00121
00122 printf("load forest\n");
00123
00124
00125 GBRForest *gbreb = (GBRForest*)infile->Get("EBCorrection");
00126 GBRForest *gbrebvar = (GBRForest*)infile->Get("EBUncertainty");
00127 GBRForest *gbree = (GBRForest*)infile->Get("EECorrection");
00128 GBRForest *gbreevar = (GBRForest*)infile->Get("EEUncertainty");
00129
00130
00131
00132
00133
00134
00135 TFile *infile_PFLC = new TFile("/afs/cern.ch/user/r/rpatel/ConvXml/TMVARegression_BDTG_PFClusterCorr.root","READ");
00136 TFile *infile_PFGC = new TFile("/afs/cern.ch/user/r/rpatel/ConvXml/TMVARegression_BDTG_PFGlobalCorr.root","READ");
00137 TFile *infile_PFRes = new TFile("/afs/cern.ch/user/r/rpatel/ConvXml/TMVARegression_BDTG_PFRes.root ","READ");
00138
00139 GBRForest *gbrLC = (GBRForest*)infile_PFLC->Get("GBRForest");
00140 GBRForest *gbrGC = (GBRForest*)infile_PFGC->Get("GBRForest");
00141 GBRForest *gbrRes = (GBRForest*)infile_PFRes->Get("GBRForest");
00142
00143
00144
00145
00146 printf("made objects\n");
00147 edm::Service<cond::service::PoolDBOutputService> poolDbService;
00148 if (poolDbService.isAvailable()) {
00149
00150 poolDbService->writeOne( gbreb, poolDbService->beginOfTime(),
00151 "wgbrph_EBCorrection" );
00152 poolDbService->writeOne( gbrebvar, poolDbService->beginOfTime(),
00153 "wgbrph_EBUncertainty" );
00154 poolDbService->writeOne( gbree, poolDbService->beginOfTime(),
00155 "wgbrph_EECorrection" );
00156 poolDbService->writeOne( gbreevar, poolDbService->beginOfTime(),
00157 "wgbrph_EEUncertainty" );
00158
00159 poolDbService->writeOne( gbrLC, poolDbService->beginOfTime(),
00160 "wgbrph_PFLCCorrection" );
00161 poolDbService->writeOne( gbrGC, poolDbService->beginOfTime(),
00162 "wgbrph_PFGlobalCorrection" );
00163 poolDbService->writeOne( gbrRes, poolDbService->beginOfTime(),
00164 "wgbrph_PFResolution" );
00165
00166 }
00167
00168
00169 }
00170
00171
00172
00173 void
00174 GBRWrapperMaker::beginJob()
00175 {
00176 }
00177
00178
00179 void
00180 GBRWrapperMaker::endJob()
00181 {
00182 }
00183
00184
00185 void
00186 GBRWrapperMaker::beginRun(edm::Run const&, edm::EventSetup const&)
00187 {
00188 }
00189
00190
00191 void
00192 GBRWrapperMaker::endRun(edm::Run const&, edm::EventSetup const&)
00193 {
00194 }
00195
00196
00197 void
00198 GBRWrapperMaker::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&)
00199 {
00200 }
00201
00202
00203 void
00204 GBRWrapperMaker::endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&)
00205 {
00206 }
00207
00208
00209 void
00210 GBRWrapperMaker::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
00211
00212
00213 edm::ParameterSetDescription desc;
00214 desc.setUnknown();
00215 descriptions.addDefault(desc);
00216 }
00217
00218
00219 DEFINE_FWK_MODULE(GBRWrapperMaker);