Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-15 08:27:39

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,
0028   /// std::numeric_limits<std::size_t>::max()) if undefined.
0029   ///
0030   /// The upper limit is exclusive, i.e. [0,3) means events 0, 1, and 2.
0031   virtual std::pair<std::size_t, std::size_t> availableEvents() const = 0;
0032 
0033   /// Read data for the requested event and write it into the event store.
0034   ///
0035   /// As a result of the parallelization and/or skipping events, this method
0036   /// will most likely not be called in order. Implementations must use the
0037   /// event number provided to select the proper data to be read.
0038   virtual ProcessCode read(const AlgorithmContext& context) = 0;
0039 
0040   /// Internal execute method forwards to the read method as mutable
0041   /// @param context The algorithm context
0042   ProcessCode internalExecute(const AlgorithmContext& context) final {
0043     return read(context);
0044   }
0045 
0046   /// Fulfill the algorithm interface
0047   ProcessCode initialize() override { return ProcessCode::SUCCESS; }
0048 
0049   /// Fulfill the algorithm interface
0050   ProcessCode finalize() override { return ProcessCode::SUCCESS; }
0051 };
0052 
0053 }  // namespace ActsExamples