1 #ifndef MARLINMT_BOOK_CONFIG 2 #define MARLINMT_BOOK_CONFIG 4 #error No mutiple binding of MarlinConfig. 13 #include "ROOT/RDirectory.hxx" 14 #include "ROOT/RFile.hxx" 17 #include "ROOT/RHist.hxx" 18 #include "ROOT/RHistConcurrentFill.hxx" 19 #include "ROOT/RHistData.hxx" 20 #include "ROOT/RSpan.hxx" 30 template<
typename T =
double>
33 #ifndef MARLIN_HIST_FILLER_BUFFER_SIZE 34 # define MARLIN_HIST_FILLER_BUFFER_SIZE 1024 46 #define HistConfig_ROOT(Alias, Impl, Weight, Dim) \ 48 struct HistConfig<double, Weight, Dim> {\ 49 using Weight_t = Weight;\ 50 using Precision_t = double;\ 52 using ConcurrentFiller_t \ 53 = ROOT::Experimental::RHistConcurrentFiller<Impl, HistogramFillerBufferSize>;\ 54 using ConcurrentManager_t \ 55 = ROOT::Experimental::RHistConcurrentFillManager<Impl, HistogramFillerBufferSize>;\ 56 static constexpr std::size_t Dimension = static_cast<std::size_t>(Dim);\ 58 using Alias = HistT<HistConfig<double, Weight, (Dim)>> 71 template<
typename Config>
73 const std::string_view& title,
74 const AxisConfig<typename Config::Precision_t>& axis)
77 ROOT::Experimental::RAxisConfig(
83 static_assert(std::is_same_v<typename Config::Precision_t, double>);
84 static_assert(Dimension == 1);
87 template<
typename Config>
89 const std::string_view& title,
90 const AxisConfig<typename Config::Precision_t>& axisA,
91 const AxisConfig<typename Config::Precision_t>& axisB)
94 ROOT::Experimental::RAxisConfig(
99 ROOT::Experimental::RAxisConfig(
106 static_assert(std::is_same_v<typename Config::Precision_t, double>);
107 static_assert(Dimension == 2);
110 template<
typename Config>
112 const std::string_view& title,
113 const AxisConfig<typename Config::Precision_t>& axisA,
114 const AxisConfig<typename Config::Precision_t>& axisB,
115 const AxisConfig<typename Config::Precision_t>& axisC)
118 ROOT::Experimental::RAxisConfig(
123 ROOT::Experimental::RAxisConfig(
128 ROOT::Experimental::RAxisConfig(
135 static_assert(std::is_same_v<typename Config::Precision_t, double>);
136 static_assert(Dimension == 3);
140 template<
typename Config>
141 void HistT<Config>::Fill(
142 const typename HistT<Config>::Point_t& p,
143 const typename HistT<Config>::Weight_t& w) {
145 static_assert(std::is_same_v<typename Config::Precision_t, double>);
148 template<
typename Config>
149 void HistT<Config>::FillN(
150 const typename HistT<Config>::Point_t* pFirst,
151 const typename HistT<Config>::Point_t* pLast,
152 const typename HistT<Config>::Weight_t* wFirst,
153 const typename HistT<Config>::Weight_t* wLast
158 for(;p != pLast && w != wLast; ++p,++w) {
161 static_assert(std::is_same_v<typename Config::Precision_t, double>);
164 template<
typename Config>
165 void HistT<Config>::FillN(
166 const typename HistT<Config>::Point_t* first,
167 const typename HistT<Config>::Point_t* last ) {
168 _impl.FillN({first, last});
169 static_assert(std::is_same_v<typename Config::Precision_t, double>);
172 template<
typename Config>
173 HistT<Config>&
add(HistT<Config>& to,
const HistT<Config>& from) {
174 ROOT::Experimental::Add(to.impl(), from.impl());
179 template<
typename Config>
180 auto toRoot6(
const HistT<Config>& hist,
const std::string_view& name) {
184 template<
typename Config>
186 const std::shared_ptr<HistT<Config>>& to,
187 const std::shared_ptr<HistT<Config>>& from) {
188 ROOT::Experimental::Add(to->impl(), from->impl());
191 template<
typename Config>
192 HistConcurrentFillManager<Config>::HistConcurrentFillManager(
194 : _impl(hist.impl()){}
196 template<
typename Config>
197 HistConcurrentFiller<Config>::HistConcurrentFiller(
198 HistConcurrentFillManager<Config>& manager
199 ) : _impl(manager.impl()){}
201 template<
typename Config>
202 void HistConcurrentFiller<Config>::Fill(
203 const typename HistT<Config>::Point_t& p,
204 const typename HistT<Config>::Weight_t& w) {
206 static_assert(std::is_same_v<typename Config::Precision_t, double>);
210 template<
typename Config>
211 void HistConcurrentFiller<Config>::FillN(
212 const typename HistT<Config>::Point_t* pFirst,
213 const typename HistT<Config>::Point_t* pLast,
214 const typename HistT<Config>::Weight_t* wFirst,
215 const typename HistT<Config>::Weight_t* wLast
220 for(;p != pLast && w != wLast; ++p,++w) {
223 static_assert(std::is_same_v<typename Config::Precision_t, double>);
226 template<
typename Config>
227 void HistConcurrentFiller<Config>::Flush() {
HistT(const AxisConfig_t &axis)
non-title 1D-histogram constructor.
HistT< HistConfig< double, double, 1 > > H1D
constexpr std::size_t HistogramFillerBufferSize
Buffer size for Histograms used in Shared mode.
HistT< HistConfig< double, double, 3 > > H3D
HistConfig_ROOT(H1F, ROOT::Experimental::RH1F, float, 1)
book::types::HistT< HistConfig< P, W, D > > HistT
HistT< HistConfig< double, float, 1 > > H1F
HistT< HistConfig< double, float, 3 > > H3F
auto into_root6_hist(const Root7Hist &src, const char *name)
book::types::AxisConfig< P > AxisConfig
#define MARLIN_HIST_FILLER_BUFFER_SIZE
HistT< HistConfig< double, int, 3 > > H3I
HistT< HistConfig< double, int, 2 > > H2I
constexpr O safe_cast(const I &input)
caste integral types with domain check.
auto toRoot6(const HistT< Config > &hist, const std::string_view &name)
convert histogram to Root-6 Object for serialization
HistT< Config > & add(HistT< Config > &to, const HistT< Config > &from)
add weights from one Histogram to an other.
HistT< HistConfig< double, float, 2 > > H2F
HistT< HistConfig< double, int, 1 > > H1I
HistT< HistConfig< double, double, 2 > > H2D