Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-07-24 04:44:53

0001 #ifndef FWCore_TestProcessor_TestSourceProcessor_h
0002 #define FWCore_TestProcessor_TestSourceProcessor_h
0003 // -*- C++ -*-
0004 //
0005 // Package:     FWCore/TestProcessor
0006 // Class  :     TestSourceProcessor
0007 //
0008 /**\class TestSourceProcessor TestSourceProcessor.h "TestSourceProcessor.h"
0009 
0010  Description: Used for testing InputSources
0011 
0012  Usage:
0013     <usage>
0014 
0015 */
0016 //
0017 // Original Author:  Chris Jones
0018 //         Created:  Mon, 30 Apr 2018 18:51:00 GMT
0019 //
0020 #include <string>
0021 #include <utility>
0022 #include <memory>
0023 #include "oneapi/tbb/global_control.h"
0024 #include "oneapi/tbb/task_arena.h"
0025 #include "oneapi/tbb/task_group.h"
0026 
0027 #include "DataFormats/Provenance/interface/ProcessHistoryRegistry.h"
0028 
0029 #include "FWCore/Common/interface/FWCoreCommonFwd.h"
0030 
0031 #include "FWCore/Framework/interface/HistoryAppender.h"
0032 #include "FWCore/Framework/interface/InputSource.h"
0033 #include "FWCore/Framework/interface/SharedResourcesAcquirer.h"
0034 #include "FWCore/Framework/interface/PrincipalCache.h"
0035 #include "FWCore/Framework/interface/SignallingProductRegistry.h"
0036 #include "FWCore/Framework/interface/PreallocationConfiguration.h"
0037 #include "FWCore/Framework/interface/MergeableRunProductProcesses.h"
0038 
0039 #include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"
0040 #include "FWCore/ServiceRegistry/interface/ProcessContext.h"
0041 #include "FWCore/ServiceRegistry/interface/ServiceLegacy.h"
0042 #include "FWCore/ServiceRegistry/interface/ServiceToken.h"
0043 
0044 #include "FWCore/TestProcessor/interface/EventFromSource.h"
0045 #include "FWCore/TestProcessor/interface/LuminosityBlockFromSource.h"
0046 #include "FWCore/TestProcessor/interface/ProcessBlock.h"
0047 #include "FWCore/TestProcessor/interface/RunFromSource.h"
0048 
0049 namespace edm::test {
0050 
0051   class TestSourceProcessor {
0052   public:
0053     TestSourceProcessor(std::string const& iConfig, ServiceToken iToken = ServiceToken());
0054     ~TestSourceProcessor();
0055 
0056     InputSource::ItemTypeInfo findNextTransition();
0057 
0058     std::shared_ptr<FileBlock> openFile();
0059     void closeFile(std::shared_ptr<FileBlock>);
0060 
0061     edm::test::RunFromSource readRun();
0062 
0063     edm::test::LuminosityBlockFromSource readLuminosityBlock();
0064 
0065     edm::test::EventFromSource readEvent();
0066 
0067   private:
0068     edm::InputSource::ItemTypeInfo lastTransition_;
0069 
0070     oneapi::tbb::global_control globalControl_;
0071     oneapi::tbb::task_group taskGroup_;
0072     oneapi::tbb::task_arena arena_;
0073     std::shared_ptr<ActivityRegistry> actReg_;  // We do not use propagate_const because the registry itself is mutable.
0074     std::shared_ptr<ProductRegistry> preg_;
0075     std::shared_ptr<BranchIDListHelper> branchIDListHelper_;
0076     std::shared_ptr<ProcessBlockHelper> processBlockHelper_;
0077     std::shared_ptr<ThinnedAssociationsHelper> thinnedAssociationsHelper_;
0078     ServiceToken serviceToken_;
0079 
0080     std::shared_ptr<ProcessConfiguration const> processConfiguration_;
0081     ProcessContext processContext_;
0082     MergeableRunProductProcesses mergeableRunProductProcesses_;
0083 
0084     ProcessHistoryRegistry processHistoryRegistry_;
0085     std::unique_ptr<HistoryAppender> historyAppender_;
0086 
0087     PrincipalCache principalCache_;
0088     PreallocationConfiguration preallocations_;
0089 
0090     std::unique_ptr<edm::InputSource> source_;
0091 
0092     std::shared_ptr<RunPrincipal> runPrincipal_;
0093     std::shared_ptr<LuminosityBlockPrincipal> lumiPrincipal_;
0094 
0095     std::shared_ptr<FileBlock> fb_;
0096   };
0097 }  // namespace edm::test
0098 
0099 #endif