Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:03:48

0001 // -*- C++ -*-
0002 //
0003 // Package:     FWCore/Sources
0004 // Class  :     PuttableSourceBase
0005 //
0006 // Implementation:
0007 //     [Notes on implementation]
0008 //
0009 // Original Author:  root
0010 //         Created:  Tue, 26 Sep 2017 20:52:26 GMT
0011 //
0012 
0013 // system include files
0014 
0015 // user include files
0016 #include "FWCore/Sources/interface/PuttableSourceBase.h"
0017 
0018 #include "DataFormats/Provenance/interface/ProductRegistry.h"
0019 #include "DataFormats/Provenance/interface/ProductResolverIndexHelper.h"
0020 
0021 #include "FWCore/Framework/interface/LuminosityBlock.h"
0022 #include "FWCore/Framework/interface/Run.h"
0023 #include "FWCore/Framework/interface/Event.h"
0024 #include "FWCore/Framework/interface/ExceptionHelpers.h"
0025 
0026 using namespace edm;
0027 //
0028 // constants, enums and typedefs
0029 //
0030 
0031 //
0032 // static data member definitions
0033 //
0034 
0035 //
0036 // constructors and destructor
0037 //
0038 PuttableSourceBase::PuttableSourceBase(ParameterSet const& iPSet, InputSourceDescription const& iISD)
0039     : InputSource(iPSet, iISD) {}
0040 
0041 void PuttableSourceBase::registerProducts() { registerProducts(this, &productRegistryUpdate(), moduleDescription()); }
0042 
0043 void PuttableSourceBase::beginJob() {
0044   auto r = productRegistry();
0045   auto const runLookup = r->productLookup(InRun);
0046   auto const lumiLookup = r->productLookup(InLumi);
0047   auto const eventLookup = r->productLookup(InEvent);
0048   auto const& processName = moduleDescription().processName();
0049   auto const& moduleLabel = moduleDescription().moduleLabel();
0050 
0051   auto const& runModuleToIndicies = runLookup->indiciesForModulesInProcess(processName);
0052   auto const& lumiModuleToIndicies = lumiLookup->indiciesForModulesInProcess(processName);
0053   auto const& eventModuleToIndicies = eventLookup->indiciesForModulesInProcess(processName);
0054   resolvePutIndicies(InRun, runModuleToIndicies, moduleLabel);
0055   resolvePutIndicies(InLumi, lumiModuleToIndicies, moduleLabel);
0056   resolvePutIndicies(InEvent, eventModuleToIndicies, moduleLabel);
0057 }
0058 
0059 void PuttableSourceBase::doBeginRun(RunPrincipal& rp, ProcessContext const*) {
0060   Run run(rp, moduleDescription(), nullptr, false);
0061   run.setProducer(this);
0062   callWithTryCatchAndPrint<void>([this, &run]() { beginRun(run); }, "Calling Source::beginRun");
0063   commit_(run);
0064 }
0065 
0066 void PuttableSourceBase::doBeginLumi(LuminosityBlockPrincipal& lbp, ProcessContext const*) {
0067   LuminosityBlock lb(lbp, moduleDescription(), nullptr, false);
0068   lb.setProducer(this);
0069   callWithTryCatchAndPrint<void>([this, &lb]() { beginLuminosityBlock(lb); }, "Calling Source::beginLuminosityBlock");
0070   commit_(lb);
0071 }
0072 
0073 void PuttableSourceBase::beginRun(Run&) {}
0074 
0075 void PuttableSourceBase::beginLuminosityBlock(LuminosityBlock&) {}