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 
18 
20 {
21  public:
22  explicit GBRForestGetterFromDB( const edm::ParameterSet & ) ;
23  virtual ~GBRForestGetterFromDB() ;
24  virtual void analyze( const edm::Event &, const edm::EventSetup & ) override ;
25 
26  private:
31 };
32 
34  theGBRForestName(conf.getParameter<std::string>("grbForestName")),
35  theOutputFileName(conf.getUntrackedParameter<std::string>("outputFileName")),
36  theOutputObjectName(conf.getUntrackedParameter<std::string>("outputObjectName", theGBRForestName.empty() ? "GBRForest" : theGBRForestName))
37 {
38 }
39 
41 {
42 }
43 
44 void
46 {
48  TFile *fOut = TFile::Open(theOutputFileName.c_str(), "RECREATE");
49  fOut->WriteObject(theGBRForestHandle.product(), theOutputObjectName.c_str());
50  fOut->Close();
51  std::cout << "Wrote output to " << theOutputFileName << std::endl;
52 }
53 
56 
57 #endif
edm::ESHandle< GBRForest > theGBRForestHandle
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
int iEvent
Definition: GenABIO.cc:230
GBRForestGetterFromDB(const edm::ParameterSet &)
const T & get() const
Definition: EventSetup.h:55
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
T const * product() const
Definition: ESHandle.h:86