CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/FWCore/Framework/src/one/EDProducerBase.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     FWCore/Framework
00004 // Class  :     one::EDProducerBase
00005 // 
00006 // Implementation:
00007 //     [Notes on implementation]
00008 //
00009 // Original Author:  Chris Jones
00010 //         Created:  Thu, 02 May 2013 21:56:04 GMT
00011 // $Id: EDProducerBase.cc,v 1.1 2013/05/17 14:49:45 chrjones Exp $
00012 //
00013 
00014 // system include files
00015 
00016 // user include files
00017 #include "FWCore/Framework/interface/one/EDProducerBase.h"
00018 #include "FWCore/Framework/src/CPCSentry.h"
00019 #include "FWCore/Framework/interface/Event.h"
00020 #include "FWCore/Framework/interface/LuminosityBlock.h"
00021 #include "FWCore/Framework/interface/Run.h"
00022 #include "FWCore/Framework/src/edmodule_mightGet_config.h"
00023 
00024 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
00025 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
00026 
00027 
00028 //
00029 // constants, enums and typedefs
00030 //
00031 namespace edm {
00032   namespace one {
00033     //
00034     // static data member definitions
00035     //
00036     
00037     //
00038     // constructors and destructor
00039     //
00040     EDProducerBase::EDProducerBase():
00041     ProducerBase(),
00042     moduleDescription_(),
00043     current_context_(nullptr),
00044     previousParentage_(),
00045     previousParentageId_() { }
00046     
00047     EDProducerBase::~EDProducerBase()
00048     {
00049     }
00050     
00051     bool
00052     EDProducerBase::doEvent(EventPrincipal& ep, EventSetup const& c,
00053                         CurrentProcessingContext const* cpc) {
00054       detail::CPCSentry sentry(current_context_, cpc);
00055       Event e(ep, moduleDescription_);
00056       e.setConsumer(this);
00057       this->produce(e, c);
00058       commit_(e,&previousParentage_, &previousParentageId_);
00059       return true;
00060     }
00061     
00062     void
00063     EDProducerBase::doBeginJob() {
00064       this->beginJob();
00065     }
00066     
00067     void
00068     EDProducerBase::doEndJob() {
00069       this->endJob();
00070     }
00071     
00072     void
00073     EDProducerBase::doBeginRun(RunPrincipal& rp, EventSetup const& c,
00074                            CurrentProcessingContext const* cpc) {
00075       
00076       detail::CPCSentry sentry(current_context_, cpc);
00077       Run r(rp, moduleDescription_);
00078       r.setConsumer(this);
00079       Run const& cnstR = r;
00080       this->doBeginRun_(cnstR, c);
00081       this->doBeginRunProduce_(r,c);
00082       commit_(r);
00083     }
00084     
00085     void
00086     EDProducerBase::doEndRun(RunPrincipal& rp, EventSetup const& c,
00087                          CurrentProcessingContext const* cpc) {
00088       detail::CPCSentry sentry(current_context_, cpc);
00089       Run r(rp, moduleDescription_);
00090       r.setConsumer(this);
00091       Run const& cnstR = r;
00092       this->doEndRun_(cnstR, c);
00093       this->doEndRunProduce_(r, c);
00094       commit_(r);
00095     }
00096     
00097     void
00098     EDProducerBase::doBeginLuminosityBlock(LuminosityBlockPrincipal& lbp, EventSetup const& c,
00099                                        CurrentProcessingContext const* cpc) {
00100       detail::CPCSentry sentry(current_context_, cpc);
00101       LuminosityBlock lb(lbp, moduleDescription_);
00102       lb.setConsumer(this);
00103       LuminosityBlock const& cnstLb = lb;
00104       this->doBeginLuminosityBlock_(cnstLb, c);
00105       this->doBeginLuminosityBlockProduce_(lb, c);
00106       commit_(lb);
00107     }
00108     
00109     void
00110     EDProducerBase::doEndLuminosityBlock(LuminosityBlockPrincipal& lbp, EventSetup const& c,
00111                                      CurrentProcessingContext const* cpc) {
00112       detail::CPCSentry sentry(current_context_, cpc);
00113       LuminosityBlock lb(lbp, moduleDescription_);
00114       lb.setConsumer(this);
00115       LuminosityBlock const& cnstLb = lb;
00116       this->doEndLuminosityBlock_(cnstLb, c);
00117       this->doEndLuminosityBlockProduce_(lb, c);
00118       commit_(lb);
00119     }
00120     
00121     void
00122     EDProducerBase::doRespondToOpenInputFile(FileBlock const& fb) {
00123       //respondToOpenInputFile(fb);
00124     }
00125     
00126     void
00127     EDProducerBase::doRespondToCloseInputFile(FileBlock const& fb) {
00128       //respondToCloseInputFile(fb);
00129     }
00130     
00131     void
00132     EDProducerBase::doRespondToOpenOutputFiles(FileBlock const& fb) {
00133       //respondToOpenOutputFiles(fb);
00134     }
00135     
00136     void
00137     EDProducerBase::doRespondToCloseOutputFiles(FileBlock const& fb) {
00138       //respondToCloseOutputFiles(fb);
00139     }
00140     
00141     void
00142     EDProducerBase::doPreForkReleaseResources() {
00143       //preForkReleaseResources();
00144     }
00145     
00146     void
00147     EDProducerBase::doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren) {
00148       //postForkReacquireResources(iChildIndex, iNumberOfChildren);
00149     }
00150     
00151     void EDProducerBase::doBeginRun_(Run const& rp, EventSetup const& c) {}
00152     void EDProducerBase::doEndRun_(Run const& rp, EventSetup const& c) {}
00153     void EDProducerBase::doBeginLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c) {}
00154     void EDProducerBase::doEndLuminosityBlock_(LuminosityBlock const& lbp, EventSetup const& c) {}
00155 
00156     void EDProducerBase::doBeginRunProduce_(Run& rp, EventSetup const& c) {}
00157     void EDProducerBase::doEndRunProduce_(Run& rp, EventSetup const& c) {}
00158     void EDProducerBase::doBeginLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c) {}
00159     void EDProducerBase::doEndLuminosityBlockProduce_(LuminosityBlock& lbp, EventSetup const& c) {}
00160     
00161     CurrentProcessingContext const*
00162     EDProducerBase::currentContext() const {
00163       return current_context_;
00164     }
00165     
00166     void
00167     EDProducerBase::fillDescriptions(ConfigurationDescriptions& descriptions) {
00168       ParameterSetDescription desc;
00169       desc.setUnknown();
00170       descriptions.addDefault(desc);
00171     }
00172     
00173     void
00174     EDProducerBase::prevalidate(ConfigurationDescriptions& iConfig) {
00175       edmodule_mightGet_config(iConfig);
00176     }
00177     
00178     static const std::string kBaseType("EDProducer");
00179     
00180     const std::string&
00181     EDProducerBase::baseType() {
00182       return kBaseType;
00183     }
00184 
00185   }
00186 }