Skip to content

Commit 1e7d49d

Browse files
authored
Merge pull request cms-sw#36366 from tvami/GBRWrapperMakerModern
Modernize / DB output migration of GBRWrapperMaker.cc
2 parents c76398a + 3b52651 commit 1e7d49d

File tree

1 file changed

+10
-56
lines changed

1 file changed

+10
-56
lines changed

RecoEgamma/EgammaTools/test/GBRWrapperMaker.cc

Lines changed: 10 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
// -*- C++ -*-
32
//
43
// Package: GBRWrapperMaker
@@ -22,7 +21,7 @@
2221

2322
// user include files
2423
#include "FWCore/Framework/interface/Frameworkfwd.h"
25-
#include "FWCore/Framework/interface/EDAnalyzer.h"
24+
#include "FWCore/Framework/interface/one/EDAnalyzer.h"
2625

2726
#include "FWCore/Framework/interface/Event.h"
2827
#include "FWCore/Framework/interface/MakerMacros.h"
@@ -41,47 +40,20 @@
4140
// class declaration
4241
//
4342

44-
class GBRWrapperMaker : public edm::EDAnalyzer {
43+
class GBRWrapperMaker : public edm::one::EDAnalyzer<> {
4544
public:
4645
explicit GBRWrapperMaker(const edm::ParameterSet&);
47-
~GBRWrapperMaker();
46+
~GBRWrapperMaker() = default;
4847

4948
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
5049

5150
private:
5251
virtual void beginJob() override;
5352
virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
5453
virtual void endJob() override;
55-
56-
virtual void beginRun(edm::Run const&, edm::EventSetup const&) override;
57-
virtual void endRun(edm::Run const&, edm::EventSetup const&) override;
58-
virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
59-
virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) override;
60-
61-
// ----------member data ---------------------------
6254
};
6355

64-
//
65-
// constants, enums and typedefs
66-
//
67-
68-
//
69-
// static data member definitions
70-
//
71-
72-
//
73-
// constructors and destructor
74-
//
75-
GBRWrapperMaker::GBRWrapperMaker(const edm::ParameterSet& iConfig)
76-
77-
{
78-
//now do what ever initialization is needed
79-
}
80-
81-
GBRWrapperMaker::~GBRWrapperMaker() {
82-
// do anything here that needs to be done at desctruction time
83-
// (e.g. close files, deallocate resources etc.)
84-
}
56+
GBRWrapperMaker::GBRWrapperMaker(const edm::ParameterSet& iConfig) {}
8557

8658
//
8759
// member functions
@@ -91,26 +63,20 @@ GBRWrapperMaker::~GBRWrapperMaker() {
9163
void GBRWrapperMaker::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
9264
using namespace edm;
9365

94-
//from Josh:
95-
//TFile *infile = new TFile("../data/GBRLikelihood_Clustering_746_bx25_Electrons_NoPosition_standardShapes_NoPS_PFMustache_results_PROD.root","READ");
9666
TFile* infile = new TFile("../data/GBRLikelihood_Clustering_746_bx25_HLT.root", "READ");
97-
printf("load forest\n");
98-
99-
//GBRForestD *p4comb = (GBRForest*)infile->Get("CombinationWeight");
67+
edm::LogPrint("GBRWrapperMaker") << "Load forest";
10068
GBRForestD* gbreb = (GBRForestD*)infile->Get("EBCorrection");
10169
GBRForestD* gbrebvar = (GBRForestD*)infile->Get("EBUncertainty");
10270
GBRForestD* gbree = (GBRForestD*)infile->Get("EECorrection");
10371
GBRForestD* gbreevar = (GBRForestD*)infile->Get("EEUncertainty");
10472

105-
printf("made objects\n");
73+
edm::LogPrint("GBRWrapperMaker") << "Make objects";
10674
edm::Service<cond::service::PoolDBOutputService> poolDbService;
10775
if (poolDbService.isAvailable()) {
108-
//poolDbService->writeOne( p4comb, poolDbService->beginOfTime(),
109-
// "gedelectron_p4combination" );
110-
poolDbService->writeOne(gbreb, poolDbService->beginOfTime(), "mustacheSC_online_EBCorrection");
111-
poolDbService->writeOne(gbrebvar, poolDbService->beginOfTime(), "mustacheSC_online_EBUncertainty");
112-
poolDbService->writeOne(gbree, poolDbService->beginOfTime(), "mustacheSC_online_EECorrection");
113-
poolDbService->writeOne(gbreevar, poolDbService->beginOfTime(), "mustacheSC_online_EEUncertainty");
76+
poolDbService->writeOneIOV(*gbreb, poolDbService->beginOfTime(), "mustacheSC_online_EBCorrection");
77+
poolDbService->writeOneIOV(*gbrebvar, poolDbService->beginOfTime(), "mustacheSC_online_EBUncertainty");
78+
poolDbService->writeOneIOV(*gbree, poolDbService->beginOfTime(), "mustacheSC_online_EECorrection");
79+
poolDbService->writeOneIOV(*gbreevar, poolDbService->beginOfTime(), "mustacheSC_online_EEUncertainty");
11480
}
11581
}
11682

@@ -120,18 +86,6 @@ void GBRWrapperMaker::beginJob() {}
12086
// ------------ method called once each job just after ending the event loop ------------
12187
void GBRWrapperMaker::endJob() {}
12288

123-
// ------------ method called when starting to processes a run ------------
124-
void GBRWrapperMaker::beginRun(edm::Run const&, edm::EventSetup const&) {}
125-
126-
// ------------ method called when ending the processing of a run ------------
127-
void GBRWrapperMaker::endRun(edm::Run const&, edm::EventSetup const&) {}
128-
129-
// ------------ method called when starting to processes a luminosity block ------------
130-
void GBRWrapperMaker::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) {}
131-
132-
// ------------ method called when ending the processing of a luminosity block ------------
133-
void GBRWrapperMaker::endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&) {}
134-
13589
// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
13690
void GBRWrapperMaker::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
13791
//The following says we do not know what parameters are allowed so do no validation

0 commit comments

Comments
 (0)