Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-07-16 08:07: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 "Acts/Utilities/Histogram.hpp"
0010 
0011 namespace Acts::Experimental {
0012 
0013 // Projection free functions
0014 Histogram1 projectionX(const Histogram2& hist2d) {
0015   auto projectedHist = boost::histogram::algorithm::project(
0016       hist2d.histogram(), std::integral_constant<unsigned, 0>{});
0017 
0018   // Extract single axis from projected histogram
0019   std::array<AxisVariant, 1> axes = {projectedHist.axis(0)};
0020 
0021   return Histogram1(hist2d.name() + "_projX", hist2d.title() + " projection X",
0022                     axes);
0023 }
0024 
0025 Histogram1 projectionY(const Histogram2& hist2d) {
0026   auto projectedHist = boost::histogram::algorithm::project(
0027       hist2d.histogram(), std::integral_constant<unsigned, 1>{});
0028 
0029   // Extract single axis from projected histogram
0030   std::array<AxisVariant, 1> axes = {projectedHist.axis(0)};
0031 
0032   return Histogram1(hist2d.name() + "_projY", hist2d.title() + " projection Y",
0033                     axes);
0034 }
0035 
0036 }  // namespace Acts::Experimental