CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GBRWrapperMaker.cc
Go to the documentation of this file.
1 
2 // -*- C++ -*-
3 //
4 // Package: GBRWrapperMaker
5 // Class: GBRWrapperMaker
6 //
14 //
15 // Original Author: Josh Bendavid
16 // Created: Tue Nov 8 22:26:45 CET 2011
17 // $Id: GBRWrapperMaker.cc,v 1.6 2011/12/14 21:33:00 bendavid Exp $
18 //
19 //
20 
21 
22 // system include files
23 #include <memory>
24 
25 // user include files
28 
31 
33 #include "TFile.h"
36 //#include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
37 //#include "CondCore/DBCommon/interface/CoralServiceManager.h"
38 
43 
44 
45 //
46 // class declaration
47 //
48 
50  public:
51  explicit GBRWrapperMaker(const edm::ParameterSet&);
53 
54  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
55 
56 
57  private:
58  virtual void beginJob() ;
59  virtual void analyze(const edm::Event&, const edm::EventSetup&);
60  virtual void endJob() ;
61 
62  virtual void beginRun(edm::Run const&, edm::EventSetup const&);
63  virtual void endRun(edm::Run const&, edm::EventSetup const&);
64  virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&);
65  virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&);
66 
67  // ----------member data ---------------------------
68 };
69 
70 //
71 // constants, enums and typedefs
72 //
73 
74 //
75 // static data member definitions
76 //
77 
78 //
79 // constructors and destructor
80 //
82 
83 {
84  //now do what ever initialization is needed
85 
86 }
87 
88 
90 {
91 
92  // do anything here that needs to be done at desctruction time
93  // (e.g. close files, deallocate resources etc.)
94 
95 }
96 
97 
98 //
99 // member functions
100 //
101 
102 // ------------ method called for each event ------------
103 void
105 {
106  using namespace edm;
107 
108 
109 
110 // #ifdef THIS_IS_AN_EVENT_EXAMPLE
111 // Handle<ExampleData> pIn;
112 // iEvent.getByLabel("example",pIn);
113 // #endif
114 //
115 // #ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE
116 // ESHandle<SetupData> pSetup;
117 // iSetup.get<SetupRecord>().get(pSetup);
118 // #endif
119 //from Josh:
120  TFile *infile = new TFile("/afs/cern.ch/user/b/bendavid/cmspublic/gbrv3ph.root","READ");
121 
122  printf("load forest\n");
123 
124 
125  GBRForest *gbreb = (GBRForest*)infile->Get("EBCorrection");
126  GBRForest *gbrebvar = (GBRForest*)infile->Get("EBUncertainty");
127  GBRForest *gbree = (GBRForest*)infile->Get("EECorrection");
128  GBRForest *gbreevar = (GBRForest*)infile->Get("EEUncertainty");
129 
130 
131 
132 
133 //from Rishi
134 
135  TFile *infile_PFLC = new TFile("/afs/cern.ch/user/r/rpatel/ConvXml/TMVARegression_BDTG_PFClusterCorr.root","READ");
136  TFile *infile_PFGC = new TFile("/afs/cern.ch/user/r/rpatel/ConvXml/TMVARegression_BDTG_PFGlobalCorr.root","READ");
137  TFile *infile_PFRes = new TFile("/afs/cern.ch/user/r/rpatel/ConvXml/TMVARegression_BDTG_PFRes.root ","READ");
138 
139  GBRForest *gbrLC = (GBRForest*)infile_PFLC->Get("GBRForest");
140  GBRForest *gbrGC = (GBRForest*)infile_PFGC->Get("GBRForest");
141  GBRForest *gbrRes = (GBRForest*)infile_PFRes->Get("GBRForest");
142 
143 
144 
145 
146  printf("made objects\n");
148  if (poolDbService.isAvailable()) {
149 
150  poolDbService->writeOne( gbreb, poolDbService->beginOfTime(),
151  "wgbrph_EBCorrection" );
152  poolDbService->writeOne( gbrebvar, poolDbService->beginOfTime(),
153  "wgbrph_EBUncertainty" );
154  poolDbService->writeOne( gbree, poolDbService->beginOfTime(),
155  "wgbrph_EECorrection" );
156  poolDbService->writeOne( gbreevar, poolDbService->beginOfTime(),
157  "wgbrph_EEUncertainty" );
158 
159  poolDbService->writeOne( gbrLC, poolDbService->beginOfTime(),
160  "wgbrph_PFLCCorrection" );
161  poolDbService->writeOne( gbrGC, poolDbService->beginOfTime(),
162  "wgbrph_PFGlobalCorrection" );
163  poolDbService->writeOne( gbrRes, poolDbService->beginOfTime(),
164  "wgbrph_PFResolution" );
165 
166  }
167 
168 
169 }
170 
171 
172 // ------------ method called once each job just before starting event loop ------------
173 void
175 {
176 }
177 
178 // ------------ method called once each job just after ending the event loop ------------
179 void
181 {
182 }
183 
184 // ------------ method called when starting to processes a run ------------
185 void
187 {
188 }
189 
190 // ------------ method called when ending the processing of a run ------------
191 void
193 {
194 }
195 
196 // ------------ method called when starting to processes a luminosity block ------------
197 void
199 {
200 }
201 
202 // ------------ method called when ending the processing of a luminosity block ------------
203 void
205 {
206 }
207 
208 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
209 void
211  //The following says we do not know what parameters are allowed so do no validation
212  // Please change this to state exactly what you do use, even if it is no parameters
214  desc.setUnknown();
215  descriptions.addDefault(desc);
216 }
217 
218 //define this as a plug-in
virtual void endJob()
virtual void analyze(const edm::Event &, const edm::EventSetup &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
GBRWrapperMaker(const edm::ParameterSet &)
virtual void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
virtual void beginJob()
int iEvent
Definition: GenABIO.cc:243
void addDefault(ParameterSetDescription const &psetDescription)
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
virtual void endRun(edm::Run const &, edm::EventSetup const &)
virtual void beginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
list infile
Definition: EdgesToViz.py:90
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
Definition: Run.h:36