TestSourceProcessor

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
#ifndef FWCore_TestProcessor_TestSourceProcessor_h
#define FWCore_TestProcessor_TestSourceProcessor_h
// -*- C++ -*-
//
// Package:     FWCore/TestProcessor
// Class  :     TestSourceProcessor
//
/**\class TestSourceProcessor TestSourceProcessor.h "TestSourceProcessor.h"

 Description: Used for testing InputSources

 Usage:
    <usage>

*/
//
// Original Author:  Chris Jones
//         Created:  Mon, 30 Apr 2018 18:51:00 GMT
//
#include <string>
#include <utility>
#include <memory>
#include "oneapi/tbb/global_control.h"
#include "oneapi/tbb/task_arena.h"
#include "oneapi/tbb/task_group.h"

#include "DataFormats/Provenance/interface/ProcessHistoryRegistry.h"

#include "FWCore/Common/interface/FWCoreCommonFwd.h"

#include "FWCore/Framework/interface/HistoryAppender.h"
#include "FWCore/Framework/interface/InputSource.h"
#include "FWCore/Framework/interface/SharedResourcesAcquirer.h"
#include "FWCore/Framework/interface/PrincipalCache.h"
#include "FWCore/Framework/interface/SignallingProductRegistryFiller.h"
#include "FWCore/Framework/interface/PreallocationConfiguration.h"
#include "FWCore/Framework/interface/MergeableRunProductProcesses.h"

#include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"
#include "FWCore/ServiceRegistry/interface/ProcessContext.h"
#include "FWCore/ServiceRegistry/interface/ServiceLegacy.h"
#include "FWCore/ServiceRegistry/interface/ServiceToken.h"

#include "FWCore/TestProcessor/interface/EventFromSource.h"
#include "FWCore/TestProcessor/interface/LuminosityBlockFromSource.h"
#include "FWCore/TestProcessor/interface/ProcessBlock.h"
#include "FWCore/TestProcessor/interface/RunFromSource.h"

namespace edm::test {

  class TestSourceProcessor {
  public:
    TestSourceProcessor(std::string const& iConfig, ServiceToken iToken = ServiceToken());
    ~TestSourceProcessor();

    InputSource::ItemTypeInfo findNextTransition();

    std::shared_ptr<FileBlock> openFile();
    void closeFile(std::shared_ptr<FileBlock>);

    edm::test::RunFromSource readRun();

    edm::test::LuminosityBlockFromSource readLuminosityBlock();

    edm::test::EventFromSource readEvent();

  private:
    edm::InputSource::ItemTypeInfo lastTransition_;

    oneapi::tbb::global_control globalControl_;
    oneapi::tbb::task_group taskGroup_;
    oneapi::tbb::task_arena arena_;
    std::shared_ptr<ActivityRegistry> actReg_;  // We do not use propagate_const because the registry itself is mutable.
    std::shared_ptr<ProductRegistry> preg_;
    std::shared_ptr<BranchIDListHelper> branchIDListHelper_;
    std::shared_ptr<ProcessBlockHelper> processBlockHelper_;
    std::shared_ptr<ThinnedAssociationsHelper> thinnedAssociationsHelper_;
    ServiceToken serviceToken_;

    std::shared_ptr<ProcessConfiguration const> processConfiguration_;
    ProcessContext processContext_;
    MergeableRunProductProcesses mergeableRunProductProcesses_;

    ProcessHistoryRegistry processHistoryRegistry_;
    std::unique_ptr<HistoryAppender> historyAppender_;

    PrincipalCache principalCache_;
    PreallocationConfiguration preallocations_;

    std::unique_ptr<edm::InputSource> source_;

    std::shared_ptr<RunPrincipal> runPrincipal_;
    std::shared_ptr<LuminosityBlockPrincipal> lumiPrincipal_;

    std::shared_ptr<FileBlock> fb_;
  };
}  // namespace edm::test

#endif