Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:53:11

0001 // Copyright 2018 Hans Dembinski
0002 //
0003 // Distributed under the Boost Software License, Version 1.0.
0004 // (See accompanying file LICENSE_1_0.txt
0005 // or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 
0007 #ifndef BOOST_HISTOGRAM_MAKE_PROFILE_HPP
0008 #define BOOST_HISTOGRAM_MAKE_PROFILE_HPP
0009 
0010 #include <boost/histogram/accumulators/mean.hpp>
0011 #include <boost/histogram/accumulators/weighted_mean.hpp>
0012 #include <boost/histogram/fwd.hpp>
0013 #include <boost/histogram/make_histogram.hpp>
0014 
0015 /**
0016   \file boost/histogram/make_profile.hpp
0017   Collection of factory functions to conveniently create profiles.
0018 
0019   Profiles are histograms which accept an additional sample and compute the mean of the
0020   sample in each cell.
0021 */
0022 
0023 namespace boost {
0024 namespace histogram {
0025 
0026 /**
0027   Make profle from compile-time axis configuration.
0028   @param axis First axis instance.
0029   @param axes Other axis instances.
0030 */
0031 template <class Axis, class... Axes, class = detail::requires_axis<Axis>>
0032 auto make_profile(Axis&& axis, Axes&&... axes) {
0033   return make_histogram_with(profile_storage(), std::forward<Axis>(axis),
0034                              std::forward<Axes>(axes)...);
0035 }
0036 
0037 /**
0038   Make profle from compile-time axis configuration which accepts weights.
0039   @param axis First axis instance.
0040   @param axes Other axis instances.
0041 */
0042 template <class Axis, class... Axes, class = detail::requires_axis<Axis>>
0043 auto make_weighted_profile(Axis&& axis, Axes&&... axes) {
0044   return make_histogram_with(weighted_profile_storage(), std::forward<Axis>(axis),
0045                              std::forward<Axes>(axes)...);
0046 }
0047 
0048 /**
0049   Make profile from iterable range.
0050   @param iterable Iterable range of axis objects.
0051 */
0052 template <class Iterable, class = detail::requires_sequence_of_any_axis<Iterable>>
0053 auto make_profile(Iterable&& iterable) {
0054   return make_histogram_with(profile_storage(), std::forward<Iterable>(iterable));
0055 }
0056 
0057 /**
0058   Make profile from iterable range which accepts weights.
0059   @param iterable Iterable range of axis objects.
0060 */
0061 template <class Iterable, class = detail::requires_sequence_of_any_axis<Iterable>>
0062 auto make_weighted_profile(Iterable&& iterable) {
0063   return make_histogram_with(weighted_profile_storage(),
0064                              std::forward<Iterable>(iterable));
0065 }
0066 
0067 /**
0068   Make profile from iterator interval.
0069   @param begin Iterator to range of axis objects.
0070   @param end   Iterator to range of axis objects.
0071 */
0072 template <class Iterator, class = detail::requires_iterator<Iterator>>
0073 auto make_profile(Iterator begin, Iterator end) {
0074   return make_histogram_with(profile_storage(), begin, end);
0075 }
0076 
0077 /**
0078   Make profile from iterator interval which accepts weights.
0079   @param begin Iterator to range of axis objects.
0080   @param end   Iterator to range of axis objects.
0081 */
0082 template <class Iterator, class = detail::requires_iterator<Iterator>>
0083 auto make_weighted_profile(Iterator begin, Iterator end) {
0084   return make_histogram_with(weighted_profile_storage(), begin, end);
0085 }
0086 
0087 } // namespace histogram
0088 } // namespace boost
0089 
0090 #endif