Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:45

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 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 https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Utilities/Logger.hpp"
0013 #include "ActsExamples/Framework/IContextDecorator.hpp"
0014 #include "ActsExamples/Framework/ProcessCode.hpp"
0015 
0016 #include <memory>
0017 #include <string>
0018 
0019 namespace ActsExamples {
0020 struct AlgorithmContext;
0021 
0022 /// A mock service that changes the magnetic field scale for each event.
0023 ///
0024 /// The magnetic field scaling changes as some function of the event number.
0025 class ScalableBFieldService : public IContextDecorator {
0026  public:
0027   struct Config {
0028     /// Scaling factor. Unit value means the magnetic field is left unchanged.
0029     double scalor = 1.25;
0030   };
0031 
0032   /// Construct the magnetic field service.
0033   ///
0034   /// @param cfg Configuration struct
0035   /// @param lvl Logging level
0036   ScalableBFieldService(const Config& cfg, Acts::Logging::Level lvl);
0037 
0038   /// The service name.
0039   const std::string& name() const override;
0040 
0041   /// Update the magnetic field context.
0042   ///
0043   /// @param ctx The per-event context
0044   ProcessCode decorate(AlgorithmContext& ctx) override;
0045 
0046  private:
0047   Config m_cfg;
0048   std::unique_ptr<const Acts::Logger> m_logger;
0049 
0050   const Acts::Logger& logger() const { return *m_logger; }
0051 };
0052 
0053 }  // namespace ActsExamples