CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/FWCore/Framework/src/EDAnalyzer.cc

Go to the documentation of this file.
00001 /*----------------------------------------------------------------------
00002   
00003 
00004 ----------------------------------------------------------------------*/
00005 
00006 #include "FWCore/Framework/interface/EDAnalyzer.h"
00007 #include "FWCore/Framework/src/CPCSentry.h"
00008 #include "FWCore/Framework/interface/Event.h"
00009 #include "FWCore/Framework/interface/LuminosityBlock.h"
00010 #include "FWCore/Framework/interface/Run.h"
00011 #include "FWCore/Framework/src/edmodule_mightGet_config.h"
00012 
00013 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
00014 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
00015 
00016 #include "DataFormats/Provenance/interface/ProductRegistry.h"
00017 
00018 #include "FWCore/ServiceRegistry/interface/Service.h"
00019 #include "FWCore/Framework/interface/ConstProductRegistry.h"
00020 
00021 namespace edm {
00022   EDAnalyzer::~EDAnalyzer() {
00023   }
00024 
00025   bool
00026   EDAnalyzer::doEvent(EventPrincipal const& ep, EventSetup const& c,
00027                         CurrentProcessingContext const* cpc) {
00028     detail::CPCSentry sentry(current_context_, cpc);
00029     Event e(const_cast<EventPrincipal&>(ep), moduleDescription_);
00030     this->analyze(e, c);
00031     return true;
00032   }
00033 
00034   void
00035   EDAnalyzer::doBeginJob() {
00036     this->beginJob();
00037   }
00038 
00039   void 
00040   EDAnalyzer::doEndJob() {
00041     this->endJob();
00042   }
00043 
00044   bool
00045   EDAnalyzer::doBeginRun(RunPrincipal const& rp, EventSetup const& c,
00046                         CurrentProcessingContext const* cpc) {
00047     detail::CPCSentry sentry(current_context_, cpc);
00048     Run r(const_cast<RunPrincipal&>(rp), moduleDescription_);
00049     this->beginRun(r, c);
00050     return true;
00051   }
00052 
00053   bool
00054   EDAnalyzer::doEndRun(RunPrincipal const& rp, EventSetup const& c,
00055                         CurrentProcessingContext const* cpc) {
00056     detail::CPCSentry sentry(current_context_, cpc);
00057     Run r(const_cast<RunPrincipal&>(rp), moduleDescription_);
00058     this->endRun(r, c);
00059     return true;
00060   }
00061 
00062   bool
00063   EDAnalyzer::doBeginLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
00064                         CurrentProcessingContext const* cpc) {
00065     detail::CPCSentry sentry(current_context_, cpc);
00066     LuminosityBlock lb(const_cast<LuminosityBlockPrincipal&>(lbp), moduleDescription_);
00067     this->beginLuminosityBlock(lb, c);
00068     return true;
00069   }
00070 
00071   bool
00072   EDAnalyzer::doEndLuminosityBlock(LuminosityBlockPrincipal const& lbp, EventSetup const& c,
00073                         CurrentProcessingContext const* cpc) {
00074     detail::CPCSentry sentry(current_context_, cpc);
00075     LuminosityBlock lb(const_cast<LuminosityBlockPrincipal&>(lbp), moduleDescription_);
00076     this->endLuminosityBlock(lb, c);
00077     return true;
00078   }
00079 
00080   void
00081   EDAnalyzer::doRespondToOpenInputFile(FileBlock const& fb) {
00082     respondToOpenInputFile(fb);
00083   }
00084 
00085   void
00086   EDAnalyzer::doRespondToCloseInputFile(FileBlock const& fb) {
00087     respondToCloseInputFile(fb);
00088   }
00089 
00090   void
00091   EDAnalyzer::doRespondToOpenOutputFiles(FileBlock const& fb) {
00092     respondToOpenOutputFiles(fb);
00093   }
00094 
00095   void
00096   EDAnalyzer::doRespondToCloseOutputFiles(FileBlock const& fb) {
00097     respondToCloseOutputFiles(fb);
00098   }
00099 
00100   void 
00101   EDAnalyzer::doPreForkReleaseResources() {
00102     preForkReleaseResources();
00103   }
00104   
00105   void 
00106   EDAnalyzer::doPostForkReacquireResources(unsigned int iChildIndex, unsigned int iNumberOfChildren) {
00107     postForkReacquireResources(iChildIndex, iNumberOfChildren);
00108   }
00109    
00110   CurrentProcessingContext const*
00111   EDAnalyzer::currentContext() const {
00112     return current_context_;
00113   }
00114 
00115   void
00116   EDAnalyzer::callWhenNewProductsRegistered(std::function<void(BranchDescription const&)> const& func) {
00117     callWhenNewProductsRegistered_ = func;
00118   }
00119 
00120   void
00121   EDAnalyzer::fillDescriptions(ConfigurationDescriptions& descriptions) {
00122     ParameterSetDescription desc;
00123     desc.setUnknown();
00124     descriptions.addDefault(desc);
00125   }
00126   
00127   void
00128   EDAnalyzer::prevalidate(ConfigurationDescriptions& iConfig) {
00129     edmodule_mightGet_config(iConfig);
00130   }
00131 
00132   void
00133   EDAnalyzer::registerProductsAndCallbacks(EDAnalyzer const*, ProductRegistry* reg) {
00134 
00135     if (callWhenNewProductsRegistered_) {
00136 
00137        reg->callForEachBranch(callWhenNewProductsRegistered_);
00138 
00139        Service<ConstProductRegistry> regService;
00140        regService->watchProductAdditions(callWhenNewProductsRegistered_);
00141     }
00142   }
00143 
00144   static const std::string kBaseType("EDAnalyzer");
00145   const std::string&
00146   EDAnalyzer::baseType() {
00147     return kBaseType;
00148   }
00149 }