Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 07:59:40

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