yoda is hosted by Hepforge, IPPP Durham
YODA - Yet more Objects for Data Analysis 2.0.0
YODA::AOReader< BinnedDbn< DbnN, AxisT... > > Class Template Reference

#include <ReaderUtils.h>

Inheritance diagram for YODA::AOReader< BinnedDbn< DbnN, AxisT... > >:
YODA::AOReaderBase

Public Member Functions

void parse (const string &line)
 
AnalysisObjectassemble (const string &path="")
 
- Public Member Functions inherited from YODA::AOReaderBase
 AOReaderBase ()
 Default constructor.
 
virtual ~AOReaderBase ()
 Default destructor.
 
template<typename T >
void extractVector (const std::string &line, std::vector< T > &vec)
 

Additional Inherited Members

- Protected Attributes inherited from YODA::AOReaderBase
aistringstream aiss
 

Detailed Description

template<size_t DbnN, typename... AxisT>
class YODA::AOReader< BinnedDbn< DbnN, AxisT... > >

Definition at line 275 of file ReaderUtils.h.

Member Function Documentation

◆ assemble()

template<size_t DbnN, typename... AxisT>
AnalysisObject * YODA::AOReader< BinnedDbn< DbnN, AxisT... > >::assemble ( const string &  path = "")
inlinevirtual

Implements YODA::AOReaderBase.

Definition at line 415 of file ReaderUtils.h.

415 {
416
417 auto args = std::tuple_cat(edges, std::make_tuple(path));
418 BaseT* ao = make_from_tuple(std::move(args));
419
420 size_t global_index = 0;
421 if (isYODA1 && sizeof...(AxisT) == 2) ++global_index; // no 2D overflow in Y1
422 for (auto&& d : dbns) {
423 ao->bin(global_index++).set(std::move(d));
424 }
425
426 if constexpr (sizeof...(AxisT) == 1) { // YODA1-style overflows
427 if (isYODA1) ao->bin(global_index).set(yoda1Overflow);
428 yoda1Overflow = Dbn<DbnN>();
429 }
430
431 crossTerms.fill(0);
432 maskedBins.clear();
433 isYODA1 = false;
434 clearEdges<0>();
435 dbns.clear();
436 axisCheck = 0;
437 return ao;
438 }

References YODA::BinnedStorage< BinContentT, AxisT >::bin().

◆ parse()

template<size_t DbnN, typename... AxisT>
void YODA::AOReader< BinnedDbn< DbnN, AxisT... > >::parse ( const string &  line)
inlinevirtual

Implements YODA::AOReaderBase.

Definition at line 365 of file ReaderUtils.h.

365 {
366 if (line.find("Total") != string::npos) {
367 isYODA1 = true;
368 return; // YODA1 backwards compatibility
369 }
370 if (!line.rfind("Edges(A", 0)) { // parse binning
371 readEdges<0>(line);
372 ++axisCheck;
373 return;
374 }
375 if (!line.rfind("MaskedBins: ", 0)) { // parse indices of masked bins
376 extractVector<size_t>(line, maskedBins);
377 return;
378 }
379 aiss.reset(line);
380 if (line.find("Underflow") != string::npos || line.find("Overflow") != string::npos) {
381 // This must be the YODA1-style format ...
382 if constexpr (sizeof...(AxisT) == 1) {
383 string tmp1, tmp2;
384 aiss >> tmp1 >> tmp2; // not needed
385 }
386 }
387 else if (isYODA1) readEdges<0>();
388 std::array<double,DbnN+1> sumW, sumW2;
389 readDbn<0>(sumW, sumW2);
390 for (size_t i = 0; i < crossTerms.size(); ++i) {
391 double tmp(0.);
392 aiss >> tmp;
393 crossTerms.at(i) = tmp;
394 }
395 double numEntries(0);
396 aiss >> numEntries;
397 if (line.find("Overflow") != string::npos) {
398 if constexpr (sizeof...(AxisT) == 1) {
399 if constexpr (DbnN < 2)
400 yoda1Overflow = Dbn<DbnN>(numEntries, sumW, sumW2);
401 else
402 yoda1Overflow = Dbn<DbnN>(numEntries, sumW, sumW2, crossTerms);
403 }
404 }
405 else {
406 if constexpr (DbnN < 2) {
407 dbns.emplace_back(numEntries, sumW, sumW2);
408 }
409 else {
410 dbns.emplace_back(numEntries, sumW, sumW2, crossTerms);
411 }
412 }
413 }
aistringstream aiss

The documentation for this class was generated from the following file: