Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:32:32

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2017-2018 CERN for the benefit of the Acts project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "ActsExamples/Framework/AlgorithmContext.hpp"
0012 #include "ActsExamples/Framework/ProcessCode.hpp"
0013 #include "ActsExamples/Framework/SequenceElement.hpp"
0014 
0015 #include <string>
0016 #include <utility>
0017 
0018 namespace ActsExamples {
0019 
0020 /// Event data reader interface.
0021 ///
0022 /// Read data from disk and add it to the event store. The reader can have
0023 /// internal state and implementations are responsible to handle concurrent
0024 /// calls.
0025 class IReader : public SequenceElement {
0026  public:
0027   /// Provide range of available events or [0, SIZE_MAX) if undefined.
0028   ///
0029   /// The upper limit is exclusive, i.e. [0,3) means events 0, 1, and 2.
0030   virtual std::pair<std::size_t, std::size_t> availableEvents() const = 0;
0031 
0032   /// Read data for the requested event and write it into the event store.
0033   ///
0034   /// As a result of the parallelization and/or skipping events, this method
0035   /// will most likely not be called in order. Implementations must use the
0036   /// event number provided to select the proper data to be read.
0037   virtual ProcessCode read(const AlgorithmContext& context) = 0;
0038 
0039   /// Internal execute method forwards to the read method as mutable
0040   /// @param context The algorithm context
0041   ProcessCode internalExecute(const AlgorithmContext& context) final {
0042     return read(context);
0043   }
0044 
0045   /// Fulfill the algorithm interface
0046   ProcessCode initialize() override { return ProcessCode::SUCCESS; }
0047 
0048   /// Fulfill the algorithm interface
0049   ProcessCode finalize() override { return ProcessCode::SUCCESS; }
0050 };
0051 
0052 }  // namespace ActsExamples