CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/IOMC/EventVertexGenerators/src/BeamProfile2DB.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    BeamProfile2DB
00004 // Class:      BeamProfile2DB
00005 // 
00013 //
00014 // Original Author:  Jean-Roch Vlimant,40 3-A28,+41227671209,
00015 //         Created:  Fri Jan  6 14:49:42 CET 2012
00016 // $Id: BeamProfile2DB.cc,v 1.2 2013/02/27 18:41:07 wmtan Exp $
00017 //
00018 //
00019 
00020 
00021 // system include files
00022 #include <memory>
00023 
00024 // user include files
00025 #include "FWCore/Framework/interface/Frameworkfwd.h"
00026 #include "FWCore/Framework/interface/EDAnalyzer.h"
00027 
00028 #include "FWCore/Framework/interface/Event.h"
00029 #include "FWCore/Framework/interface/MakerMacros.h"
00030 
00031 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00032 
00033 #include "FWCore/ServiceRegistry/interface/Service.h"
00034 #include "CondCore/DBOutputService/interface/PoolDBOutputService.h"
00035 #include "CondFormats/BeamSpotObjects/interface/SimBeamSpotObjects.h"
00036 
00037 
00038 //
00039 // class declaration
00040 //
00041 
00042 class BeamProfile2DB : public edm::EDAnalyzer {
00043    public:
00044       explicit BeamProfile2DB(const edm::ParameterSet&);
00045       ~BeamProfile2DB();
00046 
00047       static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
00048 
00049 
00050    private:
00051       virtual void beginJob() ;
00052       virtual void analyze(const edm::Event&, const edm::EventSetup&) override;
00053       virtual void endJob() ;
00054 
00055       // ----------member data ---------------------------
00056   edm::ParameterSet config_;
00057 };
00058 
00059 //
00060 // constants, enums and typedefs
00061 //
00062 
00063 //
00064 // static data member definitions
00065 //
00066 
00067 //
00068 // constructors and destructor
00069 //
00070 BeamProfile2DB::BeamProfile2DB(const edm::ParameterSet& iConfig)
00071 
00072 {
00073   config_=iConfig;  
00074 }
00075 
00076 
00077 BeamProfile2DB::~BeamProfile2DB()
00078 {
00079  
00080    // do anything here that needs to be done at desctruction time
00081    // (e.g. close files, deallocate resources etc.)
00082 
00083 }
00084 
00085 
00086 //
00087 // member functions
00088 //
00089 
00090 // ------------ method called for each event  ------------
00091 void
00092 BeamProfile2DB::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00093 {
00094 }
00095 
00096 
00097 // ------------ method called once each job just before starting event loop  ------------
00098 void 
00099 BeamProfile2DB::beginJob()
00100 {
00101 }
00102 
00103 // ------------ method called once each job just after ending the event loop  ------------
00104 void 
00105 BeamProfile2DB::endJob() 
00106 {
00107   edm::Service<cond::service::PoolDBOutputService> poolDbService;
00108   SimBeamSpotObjects * beam = new SimBeamSpotObjects();
00109   
00110   beam->read(config_);
00111   
00112   poolDbService->createNewIOV<SimBeamSpotObjects>(beam,
00113                                                   poolDbService->beginOfTime(),poolDbService->endOfTime(),
00114                                                   "SimBeamSpotObjectsRcd"  );
00115 
00116 }
00117 
00118 // ------------ method fills 'descriptions' with the allowed parameters for the module  ------------
00119 void
00120 BeamProfile2DB::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
00121   //The following says we do not know what parameters are allowed so do no validation
00122   // Please change this to state exactly what you do use, even if it is no parameters
00123   edm::ParameterSetDescription desc;
00124   desc.setUnknown();
00125   descriptions.addDefault(desc);
00126 }
00127 
00128 //define this as a plug-in
00129 DEFINE_FWK_MODULE(BeamProfile2DB);