CMS 3D CMS Logo

GBRForestGetterFromDB.cc
Go to the documentation of this file.
1 #ifndef CalibratedElectronProducer_h
2 #define CalibratedElectronProducer_h
3 
4 #include <iostream>
5 #include <string>
6 
13 
16 #include <TFile.h>
17 
19 public:
20  explicit GBRForestGetterFromDB(const edm::ParameterSet &);
21  ~GBRForestGetterFromDB() override;
22  void analyze(const edm::Event &, const edm::EventSetup &) override;
23 
24 private:
29 };
30 
32  : theGBRForestName(conf.getParameter<std::string>("grbForestName")),
33  theOutputFileName(conf.getUntrackedParameter<std::string>("outputFileName")),
34  theOutputObjectName(conf.getUntrackedParameter<std::string>(
35  "outputObjectName", theGBRForestName.empty() ? "GBRForest" : theGBRForestName)) {}
36 
38 
41  TFile *fOut = TFile::Open(theOutputFileName.c_str(), "RECREATE");
42  fOut->WriteObject(theGBRForestHandle.product(), theOutputObjectName.c_str());
43  fOut->Close();
44  std::cout << "Wrote output to " << theOutputFileName << std::endl;
45 }
46 
49 
50 #endif
edm::ESHandle< GBRForest > theGBRForestHandle
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
GBRForestGetterFromDB(const edm::ParameterSet &)
void analyze(const edm::Event &, const edm::EventSetup &) override
T get() const
Definition: EventSetup.h:73
T const * product() const
Definition: ESHandle.h:86