Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:10:42

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2019-2020 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 #include "ActsExamples/MagneticField/ScalableBFieldService.hpp"
0010 
0011 #include "Acts/MagneticField/MagneticFieldContext.hpp"
0012 #include "ActsExamples/Framework/AlgorithmContext.hpp"
0013 #include "ActsExamples/MagneticField/ScalableBField.hpp"
0014 
0015 #include <any>
0016 #include <cmath>
0017 
0018 namespace {
0019 const std::string s_name = "ScalableBFieldService";
0020 }
0021 
0022 ActsExamples::ScalableBFieldService::ScalableBFieldService(
0023     const Config& cfg, Acts::Logging::Level lvl)
0024     : m_cfg(cfg), m_logger(Acts::getDefaultLogger(s_name, lvl)) {}
0025 
0026 const std::string& ActsExamples::ScalableBFieldService::name() const {
0027   return s_name;
0028 }
0029 
0030 ActsExamples::ProcessCode ActsExamples::ScalableBFieldService::decorate(
0031     AlgorithmContext& ctx) {
0032   ScalableBFieldContext magCtx;
0033   magCtx.scalor = std::pow(m_cfg.scalor, ctx.eventNumber);
0034   ctx.magFieldContext = std::make_any<ScalableBFieldContext>(magCtx);
0035   return ProcessCode::SUCCESS;
0036 }