Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-06 09:26:57

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 #include "ActsExamples/AlignmentMillePede/MillePedeSolverAlgorithm.hpp"
0010 
0011 #include "Acts/Utilities/Logger.hpp"
0012 #include "ActsExamples/Framework/ProcessCode.hpp"
0013 #include "ActsPlugins/Mille/MillePedeResultReader.hpp"
0014 #include "ActsPlugins/Mille/MillePedeSolver.hpp"
0015 #include "ActsPlugins/Mille/MillePedeSteering.hpp"
0016 
0017 namespace ActsExamples {
0018 
0019 ProcessCode MillePedeSolverAlgorithm::finalize() {
0020   ACTS_INFO("=== Generating alignment steering file for Millepede-II ===");
0021   auto confPath = ActsPlugins::generateMillePedeSteeringFile(
0022       m_cfg.solverConfig.steeringFile, m_cfg.steeringConfig, logger());
0023   if (!confPath.ok()) {
0024     ACTS_ERROR(
0025         "Failed to generate the steering file, aborting alignment attempt");
0026     return ProcessCode::ABORT;
0027   }
0028   ACTS_INFO("=== Proceeding to run Millepede-II alignment fit ===");
0029 
0030   const auto& solverResult =
0031       ActsPlugins::runMillePedeSolver(m_cfg.solverConfig, logger());
0032 
0033   if (!solverResult.ok()) {
0034     ACTS_ERROR("=== Alignment FAILED! ===");
0035     return ProcessCode::ABORT;
0036   }
0037 
0038   const auto& readRes =
0039       ActsPlugins::readMillePedeResult(solverResult->resultsFile, logger());
0040 
0041   if (!readRes.ok()) {
0042     ACTS_ERROR("Failed to read the MP result file!");
0043     return ProcessCode::ABORT;
0044   }
0045   ACTS_INFO("=== Finished alignment and readback with exit code "
0046             << solverResult->exitCode << " (" << solverResult->exitMessage
0047             << "), found " << readRes->size() << " alignment parameters ===");
0048 
0049   // for now, do not further process the alignment results, as we are in
0050   // finalize().
0051 
0052   return ProcessCode::SUCCESS;
0053 }
0054 
0055 }  // namespace ActsExamples