16 template <
typename Config >
18 const std::string_view &title )
23 template <
typename Config >
32 template <
typename Config >
41 template <
typename Config >
44 return EntryData< types::HistT<Config>,
50 template<
typename Config>
54 static_assert(D == 1,
"This is no 1D Hist, therefor it can't be constructed with 1 axis.");
55 this->axis(0) = std::make_unique<typename types::HistT<Config>::AxisConfig_t>(axis) ;
60 template <
typename Config >
61 EntryData< types::HistT<Config>, 0 >::EntryData(
64 static_assert(D == 1,
"This is no 1D Hist, therefor it can't be constructed with 1 axis.");
65 this->axis(0) = std::make_unique<typename types::HistT<Config>::AxisConfig_t>(axis) ;
70 template <
typename Config >
71 EntryData< types::HistT<Config>, 0 >::EntryData(
75 static_assert(D == 2,
"This is no 2D Hist, therefor it can't be constructed with 2 axis.");
76 this->axis(0) = std::make_unique<typename types::HistT<Config>::AxisConfig_t>(x_axis) ;
77 this->axis(1) = std::make_unique<typename types::HistT<Config>::AxisConfig_t>(y_axis) ;
82 template <
typename Config >
83 EntryData< types::HistT<Config>, 0 >::EntryData(
84 const std::string_view &title,
88 static_assert(D == 2,
"This is no 2D Hist, therefor it can't be constructed with 2 axis.");
89 this->axis(0) = std::make_unique<typename types::HistT<Config>::AxisConfig_t>(x_axis) ;
90 this->axis(1) = std::make_unique<typename types::HistT<Config>::AxisConfig_t>(y_axis) ;
95 template <
typename Config >
96 EntryData< types::HistT<Config>, 0 >::EntryData(
101 static_assert(D == 3,
"This is no 3D Hist, therefor it can't be constructed with 3 axis.");
102 this->axis(0) = std::make_unique<typename types::HistT<Config>::AxisConfig_t>(x_axis) ;
103 this->axis(1) = std::make_unique<typename types::HistT<Config>::AxisConfig_t>(y_axis) ;
104 this->axis(2) = std::make_unique<typename types::HistT<Config>::AxisConfig_t>(z_axis) ;
109 template <
typename Config >
110 EntryData< types::HistT<Config>, 0 >::EntryData(
111 const std::string_view &title,
116 static_assert(D == 3,
"This is no 3D Hist, therefor it can't be constructed with 3 axis.");
117 this->axis(0) = std::make_unique<typename types::HistT<Config>::AxisConfig_t>(x_axis) ;
118 this->axis(1) = std::make_unique<typename types::HistT<Config>::AxisConfig_t>(y_axis) ;
119 this->axis(2) = std::make_unique<typename types::HistT<Config>::AxisConfig_t>(z_axis) ;
124 template <
typename Config >
125 EntryData< types::HistT<Config>, 0 >::EntryData(
126 const std::string_view& title,
129 Config::Dimension>& axes)
131 for (
int i = 0; i < D; ++i) {
132 this->axis(i) = std::make_unique<typename Type::AxisConfig_t>(*(axes[i]));
138 template <
typename Config >
140 const std::shared_ptr< MemLayout > & mem,
142 std::shared_ptr<void> data,
154 template <
typename Config >
163 template <
typename Config >
164 template <
typename Po
intContainer,
typename WeightContainer>
166 const PointContainer &points,
167 const WeightContainer &weights ) {
170 &(*points.begin()), &(*points.end()),
171 &(*weights.begin()), &(*weights.end()));
176 template <
typename Config >
184 template <
typename Config >
186 : _context{std::move(context)} {}
188 template <
typename Config >
190 auto hist = _context.mem->at< Type >( 0 ) ;
201 template <
typename Config >
204 : _context{std::move(context)} {}
206 template <
typename Config >
210 auto pHist = _context.mem->at< Type >( idx ) ;
221 template <
typename Config >
224 if (
auto ptr = filler.lock() ) {
233 template <
typename Config >
236 : _context{std::move(context)},
238 std::make_shared< types::HistConcurrentFillManager< Config > >(
239 *_context.mem->at< Type >( 0 ) )},
242 for ( std::size_t i = 0; i < context.
nInstances; ++i) {
243 _staticFiller.push_back(
247 _fillers.push_back(_staticFiller.back());
253 template <
typename Config >
260 template <
typename Config >
265 = std::make_shared< types::HistConcurrentFiller< Config > >(
268 std::lock_guard<std::mutex> lock(_fillersExtend);
269 std::size_t capacity =
_fillers.capacity();
276 [](
auto& ptr){
return ptr.expired();}),
278 if (
_fillers.size() > capacity * 0.8f) {
286 _context.mem->at<
Type >( 0 ),
289 [
this]() { this->flush(); } ) ;
294 template <
typename Config >
300 _context.mem->at<
Type > ( 0 ),
303 [
this](){this->flush();});
308 template <
typename Config >
309 template <
typename... Args_t,
int d >
310 std::enable_if_t< d == 1, std::shared_ptr<details::Entry> >
312 ::book(
BookStore &store,
const Args_t &... args )
const {
314 const std::string_view &,
321 template <
typename Config >
322 template <
typename... Args_t,
int d >
323 std::enable_if_t< d == 2, std::shared_ptr<details::Entry>>
325 ::book(
BookStore &store,
const Args_t &... args )
const {
327 const std::string_view &,
329 const typename types::HistT<Config>::AxisConfig_t & >(
335 template <
typename Config >
336 template <
typename... Args_t,
int d >
337 std::enable_if_t< d == 3, std::shared_ptr<details::Entry> >
339 ::book(
BookStore &store,
const Args_t &... args )
const {
341 const std::string_view &,
343 const typename types::HistT<Config>::AxisConfig_t &,
344 const typename types::HistT<Config>::AxisConfig_t & >(
354 template <
typename Config >
355 template <
typename... Args_t,
int d >
356 std::enable_if_t< d == 1, std::shared_ptr<details::Entry> >
358 ::book(
BookStore &store,
const Args_t &... args )
const {
361 const std::string_view &,
363 _n, args...,
_data.title(), *
_data.axis(0) ) ;
368 template <
typename Config >
369 template <
typename... Args_t,
int d >
370 std::enable_if_t< d == 2, std::shared_ptr<details::Entry> >
372 ::book(
BookStore &store,
const Args_t &... args )
const {
375 const std::string_view &,
377 const typename types::HistT<Config>::AxisConfig_t & >(
383 template <
typename Config >
384 template <
typename... Args_t,
int d >
385 std::enable_if_t< d == 3, std::shared_ptr<details::Entry> >
387 ::book(
BookStore &store,
const Args_t &... args )
const {
390 const std::string_view &,
392 const typename types::HistT<Config>::AxisConfig_t &,
393 const typename types::HistT<Config>::AxisConfig_t & >(
404 template <
typename Config >
405 template <
typename... Args_t,
int d >
406 std::enable_if_t< d == 1, std::shared_ptr<details::Entry> >
408 ::book(
BookStore &store,
const Args_t &... args )
const {
410 const std::string_view &,
412 _n, args...,
_data.title(), *
_data.axis(0) ) ;
417 template <
typename Config >
418 template <
typename... Args_t,
int d >
419 std::enable_if_t< d == 2, std::shared_ptr<details::Entry> >
421 ::book(
BookStore &store,
const Args_t &... args )
const {
423 const std::string_view &,
425 const typename types::HistT<Config>::AxisConfig_t & >(
431 template <
typename Config >
432 template <
typename... Args_t,
int d >
433 std::enable_if_t< d == 3, std::shared_ptr<details::Entry> >
435 ::book(
BookStore &store,
const Args_t &... args )
const {
437 const std::string_view &,
439 const typename types::HistT<Config>::AxisConfig_t &,
440 const typename types::HistT<Config>::AxisConfig_t & >(
451 template <
typename Config >
452 template < std::
size_t I >
457 using EntryType = std::tuple_element_t<I, EntryTypes<Type>>;
458 if(
_type == EntryType::Flag) {
459 EntryType::fill(
_data, x, w);
467 template <
typename Config >
468 template < std::
size_t I >
475 using EntryType = std::tuple_element_t<I, EntryTypes<Type>>;
476 if(
_type == EntryType::Flag) {
477 EntryType::fillN(
_data, pFirst, pLast, wFirst, wLast);
480 fillNImp<I + 1>(pFirst, pLast, wFirst, wLast);
486 template <
typename Config >
488 const std::shared_ptr<void>& data,
492 static_cast<Type*
>(data.get())->Fill(x,w);
497 template <
typename Config >
499 const std::shared_ptr<void>& data,
505 static_cast<Type*
>(data.get())->FillN(
506 pFirst, pLast, wFirst, wLast);
511 template <
typename Config >
513 const std::shared_ptr<void>& data,
517 static_cast<Type*
>(data.get())->Fill(x,w);
522 template <
typename Config >
524 const std::shared_ptr<void>& data,
530 static_cast<Type*
>(data.get())->FillN(
531 pFirst, pLast, wFirst, wLast);
536 template <
typename Config >
538 const std::shared_ptr<void>& data,
547 template <
typename Config >
549 const std::shared_ptr<void>& data,
556 pFirst, pLast, wFirst, wLast);
std::tuple< EntrySingle< Type >, EntryMultiCopy< Type >, EntryMultiShared< Type > > EntryTypes
Managed Access and creation of Objects.
Container for data to construct and setup booked object.
entry for object to be used Multithreaded.
constexpr unsigned long long value(const Flag_t &flag)
std::shared_ptr< details::Entry > bookMultiShared(std::size_t n, std::filesystem::path path, Args_t... ctor_p)
creates an Entry for parallel access.
std::shared_ptr< details::Entry > bookSingle(std::filesystem::path path, Args_t... ctor_p)
creates an Entry for a default Object.
std::function< void() > FinalizeFn_t
Function signature called when close Handle.
Flag type for flags in marlinmt::book.
Generalized histogram class.
constexpr Flag_t MultiShared(1U<< 1U)
create one instance witch concurrent access.
Base Class for Entry Data, for similar behavior.
collection for Axis Description
entry for object to be used Multithreaded.
minimal entry for Object.
constexpr Flag_t MultiCopy(1U<< 2U)
create multiple instances of booked object (if possible) to avoid sync points
HistT< Config > & add(HistT< Config > &to, const HistT< Config > &from)
add weights from one Histogram to an other.
class which basic functionality for every handle.
std::shared_ptr< details::Entry > bookMultiCopy(std::size_t n, std::filesystem::path path, Args_t... ctor_p)
creates an Entry for parallel access.
const T & merged()
get final object.
std::array< Precision_t, Dimension > Point_t
type used for Entry Points
class managing parallel filling to one histogram.
Data selection for the Entry to work properly.
typename Config::Weight_t Weight_t
type used for bin weight
constexpr Flag_t Single(1U<< 0U)
vanilla object.