Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /acts/Alignment/src/Alignment.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 "ActsAlignment/Kernel/Alignment.hpp"
0010 
0011 #include "Acts/Utilities/detail/OstreamStateGuard.hpp"
0012 
0013 #include <fstream>
0014 #include <stdexcept>
0015 
0016 namespace ActsAlignment {
0017 void dumpResultAsMP2(const ActsAlignment::AlignmentResult& result,
0018                      std::ostream& out) {
0019   // protect stream from leaking modifiers
0020   Acts::detail::OstreamStateGuard g(out);
0021   for (auto [surface, index] : result.idxedAlignSurfaces) {
0022     for (std::size_t i = 0; i < Acts::eAlignmentSize; ++i) {
0023       std::size_t row = Acts::eAlignmentSize * index + i;
0024       out << std::setw(8)
0025           << row + 1
0026           // column 2: parameter delta from fit
0027           << "   " << std::setw(12)
0028           << result.deltaAlignmentParameters(row)
0029           // column 3: optional pre-sigma for parameter delta
0030           << "   " << std::setw(4)
0031           << 0.
0032           // column 4: change of parameter delta w.r.t start value
0033           << "   " << std::setw(12)
0034           << result.deltaAlignmentParameters(row)
0035           // column 5: uncertainty of parameter delta from the fit
0036           << "   " << std::setw(12)
0037           << std::sqrt(result.alignmentCovariance(row, row))
0038           // column 6: count of measurements seeing this parameter.
0039           // Not available in ACTS solver, write a placeholder of 99
0040           << "    99 " << std::endl;
0041     }
0042   }
0043 }
0044 void dumpResultAsMP2(const ActsAlignment::AlignmentResult& result,
0045                      const std::filesystem::path& fname) {
0046   std::ofstream of(fname);
0047   if (!of.is_open()) {
0048     throw std::runtime_error("Unable to open the output file");
0049   }
0050   dumpResultAsMP2(result, of);
0051 }
0052 }  // namespace ActsAlignment