CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/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.1 2012/01/17 11:59:18 vlimant 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&);
00053       virtual void endJob() ;
00054 
00055       virtual void beginRun(edm::Run const&, edm::EventSetup const&);
00056       virtual void endRun(edm::Run const&, edm::EventSetup const&);
00057       virtual void beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&);
00058       virtual void endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&);
00059 
00060       // ----------member data ---------------------------
00061   edm::ParameterSet config_;
00062 };
00063 
00064 //
00065 // constants, enums and typedefs
00066 //
00067 
00068 //
00069 // static data member definitions
00070 //
00071 
00072 //
00073 // constructors and destructor
00074 //
00075 BeamProfile2DB::BeamProfile2DB(const edm::ParameterSet& iConfig)
00076 
00077 {
00078   config_=iConfig;  
00079 }
00080 
00081 
00082 BeamProfile2DB::~BeamProfile2DB()
00083 {
00084  
00085    // do anything here that needs to be done at desctruction time
00086    // (e.g. close files, deallocate resources etc.)
00087 
00088 }
00089 
00090 
00091 //
00092 // member functions
00093 //
00094 
00095 // ------------ method called for each event  ------------
00096 void
00097 BeamProfile2DB::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00098 {
00099 }
00100 
00101 
00102 // ------------ method called once each job just before starting event loop  ------------
00103 void 
00104 BeamProfile2DB::beginJob()
00105 {
00106 }
00107 
00108 // ------------ method called once each job just after ending the event loop  ------------
00109 void 
00110 BeamProfile2DB::endJob() 
00111 {
00112   edm::Service<cond::service::PoolDBOutputService> poolDbService;
00113   SimBeamSpotObjects * beam = new SimBeamSpotObjects();
00114   
00115   beam->read(config_);
00116   
00117   poolDbService->createNewIOV<SimBeamSpotObjects>(beam,
00118                                                   poolDbService->beginOfTime(),poolDbService->endOfTime(),
00119                                                   "SimBeamSpotObjectsRcd"  );
00120 
00121 }
00122 
00123 // ------------ method called when starting to processes a run  ------------
00124 void 
00125 BeamProfile2DB::beginRun(edm::Run const&, edm::EventSetup const&)
00126 {
00127 }
00128 
00129 // ------------ method called when ending the processing of a run  ------------
00130 void 
00131 BeamProfile2DB::endRun(edm::Run const&, edm::EventSetup const&)
00132 {
00133 }
00134 
00135 // ------------ method called when starting to processes a luminosity block  ------------
00136 void 
00137 BeamProfile2DB::beginLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&)
00138 {
00139 }
00140 
00141 // ------------ method called when ending the processing of a luminosity block  ------------
00142 void 
00143 BeamProfile2DB::endLuminosityBlock(edm::LuminosityBlock const&, edm::EventSetup const&)
00144 {
00145 }
00146 
00147 // ------------ method fills 'descriptions' with the allowed parameters for the module  ------------
00148 void
00149 BeamProfile2DB::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
00150   //The following says we do not know what parameters are allowed so do no validation
00151   // Please change this to state exactly what you do use, even if it is no parameters
00152   edm::ParameterSetDescription desc;
00153   desc.setUnknown();
00154   descriptions.addDefault(desc);
00155 }
00156 
00157 //define this as a plug-in
00158 DEFINE_FWK_MODULE(BeamProfile2DB);