YODA::ScatterND< N > Class Template Reference A generic data type which is just a collection of n-dim data points with errors. More...
Inheritance diagram for YODA::ScatterND< N >:
Detailed Descriptiontemplate<size_t N> class YODA::ScatterND< N > A generic data type which is just a collection of n-dim data points with errors. Member Typedef Documentation◆ containedType
template<size_t N>
template<typename Arr >
◆ containsPair
template<size_t N>
template<typename Arr >
◆ enableIfNestedArrayWithPair
template<size_t N>
template<typename T , typename U >
◆ isAllVals
template<size_t N>
template<typename... Args>
◆ isHalfValsHalfPairs
template<size_t N>
template<typename... Args>
◆ NdVal
template<size_t N>
◆ NdValPair
template<size_t N>
◆ Pair
template<size_t N>
◆ PairList
template<size_t N>
◆ PairVec
template<size_t N>
◆ Point
template<size_t N>
◆ Points
template<size_t N>
◆ Ptr
template<size_t N>
◆ ValList
template<size_t N>
◆ ValVec
template<size_t N>
Constructor & Destructor Documentation◆ ScatterND() [1/8]
template<size_t N>
Empty constructor. Definition at line 203 of file Scatter.h. ◆ ScatterND() [2/8]
template<size_t N>
◆ ScatterND() [3/8]
template<size_t N>
◆ ScatterND() [4/8]
template<size_t N>
template<typename ValRange = std::initializer_list<ValList>, typename = std::enable_if_t<isIterable<ValRange, containedType<ValRange>>>>
Constructor from a vector of position values with no errors. Definition at line 221 of file Scatter.h. 223 for (size_t i = 0; i < positions.size(); ++i) {
224 addPoint(PointND<N>(std::forward<containedType<ValRange>>(positions[i])));
225 }
226 }
References YODA::ScatterND< N >::addPoint(). ◆ ScatterND() [5/8]
template<size_t N>
template<typename ValRange = std::initializer_list<ValList>, typename = std::enable_if_t<isIterable<ValRange, containedType<ValRange>>>>
Constructor from vectors of values for positions and a single set of symmetric errors. Definition at line 231 of file Scatter.h. 233 if (positions.size() != errors.size()) throw RangeError("Number of errors doesn't match number of positions");
234 for (size_t i = 0; i < positions.size(); ++i) {
235 addPoint(PointND<N>(std::forward<containedType<ValRange>>(positions[i]),
236 std::forward<containedType<ValRange>>(errors[i])));
237 }
238 }
References YODA::ScatterND< N >::addPoint(). ◆ ScatterND() [6/8]
template<size_t N>
template<typename ValRange = std::initializer_list<ValList>, typename PairRange = std::initializer_list<PairList>, typename = enableIfNestedArrayWithPair<ValRange,PairRange>>
Constructor from vectors of values for positions and a single set of symmetric errors. Definition at line 244 of file Scatter.h. 246 if (positions.size() != errors.size()) throw RangeError("Number of error pairs doesn't match number of positions");
247 for (size_t i = 0; i < positions.size(); ++i) {
248 addPoint(PointND<N>(std::forward<containedType<ValRange>>(positions[i]),
249 std::forward<containedType<PairRange>>(errors[i])));
250 }
251 }
References YODA::ScatterND< N >::addPoint(). ◆ ScatterND() [7/8]
template<size_t N>
◆ ScatterND() [8/8]
template<size_t N>
Member Function Documentation◆ addPoint() [1/7]
template<size_t N>
template<typename... Args>
Insert a new point from a parameter pack The deduction guide on the parameter pack asks that its length be 2N or 3N for dimension N. If accepted, the parameter pack is then forwarded as a tuple to the helper method addPoint_aux, which is overloaded to deal with the following three cases: Case 1: position and symmetric errors: Scatter1D::addPoint(x, ex); Scatter2D::addPoint(x,y, ex,ey); ... Case 2: position and asymmetric errors: Scatter1D::addPoint(x, exdn,exup); Scatter2D::addPoint(x,y, exdn,eydn, exup,eyup); ... Case 3: position and error pairs Scatter1D::addPoint(x, make_pair(exdn,exup)); Scatter2D::addPoint(x,y, make_pair(exdn,eydn), make_pair(exup,eyup)); ... Definition at line 436 of file Scatter.h. 437 {
438 return addPoint_aux(std::make_tuple(std::forward<Args>(args)...), std::make_index_sequence<N>{});
439 }
auto addPoint_aux(std::tuple< Args... > &&t, std::index_sequence< Is... >) -> std::enable_if_t<(isAllVals< Args... >::value), ScatterND< N > > & Definition Scatter.h:459 References YODA::ScatterND< N >::addPoint_aux(). ◆ addPoint() [2/7]
template<size_t N>
Insert a new point. Definition at line 369 of file Scatter.h. 369 {
370 _points.insert(pt);
371 return *this;
372 }
Referenced by YODA::ScatterND< N >::addPoints(), YODA::ScatterND< N >::deserializeContent(), YODA::mkScatter(), YODA::Counter::mkScatter(), YODA::Estimate0D::mkScatter(), YODA::EstimateStorage< AxisT >::mkScatter(), YODA::ScatterND< N >::ScatterND(), YODA::ScatterND< N >::ScatterND(), and YODA::ScatterND< N >::ScatterND(). ◆ addPoint() [3/7]
template<size_t N>
◆ addPoint() [4/7]
template<size_t N>
template<typename ValRange = ValList, typename = std::enable_if_t<isIterable<ValRange>>>
◆ addPoint() [5/7]
template<size_t N>
template<typename ValRange = ValList, typename PairRange = PairList>
◆ addPoint() [6/7]
template<size_t N>
template<typename ValRange = ValList, typename = std::enable_if_t<isIterable<ValRange>>>
◆ addPoint() [7/7]
template<size_t N>
template<typename ValRange = ValList, typename = std::enable_if_t<isIterable<ValRange>>>
◆ addPoint_aux() [1/2]
template<size_t N>
template<typename... Args, size_t... Is>
Helper method to deal with parameter pack that has been forwarded as a tuple from addPoints. The deduction guide on the parameter pack asks that all arguments can be cast to double, thereby covering the following two cases: Case 1: position and symmetric errors: Scatter1D::addPoint(x, ex); Scatter2D::addPoint(x,y, ex,ey); ... Case 2: position and asymmetric errors: Scatter1D::addPoint(x, exdn,exup); Scatter2D::addPoint(x,y, exdn,eydn, exup,eyup); ... Definition at line 459 of file Scatter.h. 460 {
461 if constexpr(sizeof...(Args) == 2*N) { // Case 1: symmetric errors
462 _points.insert(
465 static_cast<double>(std::get<N+Is>(t))}...} ));
466 }
467 else { // Case 2: asymmetric errors
470 static_cast<double>(std::get<N+2*Is+1>(t))}...} ));
471 }
472 return *this;
473 }
Referenced by YODA::ScatterND< N >::addPoint(). ◆ addPoint_aux() [2/2]
template<size_t N>
template<typename... Args, size_t... Is>
Helper method to deal with parameter pack that has been forwarded as a tuple from addPoints. The deduction guide on the parameter pack asks that its length be 2N for dimension N, that the first half of the arguments can be cast to double, and that the second half can be cast to Pair, thereby covering the following case: Case 3: position and error pairs Scatter1D::addPoint(x, make_pair(exdn,exup)); Scatter2D::addPoint(x,y, make_pair(exdn,eydn), make_pair(exup,eyup)); ... Definition at line 490 of file Scatter.h. 491 {
494 return *this;
495 }
◆ addPoints()
template<size_t N>
Insert a collection of new points. Definition at line 501 of file Scatter.h. References YODA::ScatterND< N >::addPoint(). Referenced by YODA::ScatterND< N >::combineWith(), and YODA::ScatterND< N >::combineWith(). ◆ clone()
template<size_t N>
Make a copy on the stack. Definition at line 284 of file Scatter.h. 284 {
285 return ScatterND<N>(*this);
286 }
Referenced by YODA::WriterYODA1::writeScatter1D(), YODA::WriterYODA1::writeScatter2D(), and YODA::WriterYODA1::writeScatter3D(). ◆ combineWith() [1/4]
template<size_t N>
Definition at line 558 of file Scatter.h. 558 {
559 addPoints(other.points());
560 return *this;
561 }
References YODA::ScatterND< N >::addPoints(), and YODA::ScatterND< N >::points(). Referenced by YODA::combine(), YODA::combine(), YODA::combine(), YODA::combine(), YODA::ScatterND< N >::combineWith(), and YODA::ScatterND< N >::combineWith(). ◆ combineWith() [2/4]
template<size_t N>
Definition at line 570 of file Scatter.h. 570 {
572 return *this;
573 }
ScatterND< N > & combineWith(const ScatterND< N > &other) Definition Scatter.h:558 References YODA::ScatterND< N >::combineWith(). ◆ combineWith() [3/4]
template<size_t N>
Definition at line 564 of file Scatter.h. References YODA::ScatterND< N >::addPoints(). ◆ combineWith() [4/4]
template<size_t N>
Definition at line 576 of file Scatter.h. References YODA::ScatterND< N >::combineWith(). ◆ deserializeContent()
template<size_t N>
Content deserialisation for MPI reduce operations. Implements YODA::AnalysisObject. Definition at line 535 of file Scatter.h. 535 {
536
537 if (data.size() % Point::DataSize::value)
538 throw UserError("Length of serialized data should be a multiple of "+std::to_string(Point::DataSize::value)+"!");
539
540 const size_t nPoints = data.size()/Point::DataSize::value;
541 const auto itr = data.cbegin();
542 reset();
543 for (size_t i = 0; i < nPoints; ++i) {
545 auto first = itr + i*Point::DataSize::value;
546 auto last = first + Point::DataSize::value;
547 point(i)._deserializeContent(std::vector<double>{first, last});
548 }
549
550 }
PointND< N > & point(size_t index) Get a reference to the point with index index. Definition Scatter.h:352 References YODA::ScatterND< N >::addPoint(), YODA::ScatterND< N >::point(), and YODA::ScatterND< N >::reset(). ◆ dim()
template<size_t N>
Dimension of this data object. Implements YODA::AnalysisObject. Definition at line 296 of file Scatter.h. 296{ return N; }
◆ edges()
template<size_t N>
Definition at line 745 of file Scatter.h. 745 {
746 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
747 std::vector<Pair> rtn;
748 rtn.resize(numPoints());
749 size_t j = 0;
751 rtn[j++] = std::make_pair(p.min(i), p.max(i));
752 }
753 std::sort(rtn.begin(), rtn.end());
754 rtn.erase(std::unique(rtn.begin(), rtn.end()), rtn.end());
755 return rtn;
756 }
References YODA::ScatterND< N >::numPoints(), and YODA::ScatterND< N >::points(). ◆ errs()
template<size_t N>
Get the error pairs along axis i. Definition at line 631 of file Scatter.h. 631 {
632 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
633 PairVec rtn; rtn.reserve(_points.size());
634 for (const auto& pt : _points) {
635 rtn.push_back( pt.errs(i) );
636 }
637 return rtn;
638 }
Referenced by YODA::ScatterND< N >::xErrs(), YODA::ScatterND< N >::yErrs(), and YODA::ScatterND< N >::zErrs(). ◆ errsAvg()
template<size_t N>
Get the average error along axis i. Definition at line 641 of file Scatter.h. 641 {
642 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
643 ValVec rtn; rtn.reserve(_points.size());
644 for (const auto& pt : _points) {
645 rtn.push_back( pt.errAvg(i) );
646 }
647 return rtn;
648 }
◆ lengthContent()
template<size_t N>
Length of serialized content vector for MPI reduce operations. Implements YODA::AnalysisObject. Definition at line 515 of file Scatter.h. References YODA::ScatterND< N >::numPoints(). ◆ max()
template<size_t N>
Get the largest central value along axis i. Definition at line 624 of file Scatter.h. 624 {
625 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
627 return *std::max_element(cvals.begin(), cvals.end());
628 }
References YODA::ScatterND< N >::vals(). Referenced by YODA::ScatterND< N >::xMax(), YODA::ScatterND< N >::yMax(), and YODA::ScatterND< N >::zMax(). ◆ maxs()
template<size_t N>
Get the positive error vector along axis i. Definition at line 607 of file Scatter.h. 607 {
608 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
609 ValVec rtn; rtn.reserve(_points.size());
610 for (const auto& pt : _points) {
611 rtn.push_back( pt.max(i) );
612 }
613 return rtn;
614 }
Referenced by YODA::ScatterND< N >::xMaxs(), YODA::ScatterND< N >::yMaxs(), and YODA::ScatterND< N >::zMaxs(). ◆ min()
template<size_t N>
Get the smallest central value along axis i. Definition at line 617 of file Scatter.h. 617 {
618 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
620 return *std::min_element(cvals.begin(), cvals.end());
621 }
References YODA::ScatterND< N >::vals(). Referenced by YODA::ScatterND< N >::xMin(), YODA::ScatterND< N >::yMin(), and YODA::ScatterND< N >::zMin(). ◆ mins()
template<size_t N>
Get the lowest value vector along axis i. Definition at line 597 of file Scatter.h. 597 {
598 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
599 ValVec rtn; rtn.reserve(_points.size());
600 for (const auto& pt : _points) {
601 rtn.push_back( pt.min(i) );
602 }
603 return rtn;
604 }
Referenced by YODA::ScatterND< N >::xMins(), YODA::ScatterND< N >::yMins(), and YODA::ScatterND< N >::zMins(). ◆ newclone()
template<size_t N>
Make a copy on the heap, via 'new'. Implements YODA::AnalysisObject. Definition at line 289 of file Scatter.h. 289 {
290 return new ScatterND<N>(*this);
291 }
◆ numPoints()
template<size_t N>
Number of points in the scatter. Implements YODA::Scatter. Definition at line 334 of file Scatter.h. 334 {
335 return _points.size();
336 }
Referenced by YODA::ScatterND< N >::edges(), YODA::ScatterND< N >::lengthContent(), and YODA::ScatterND< N >::serializeContent(). ◆ operator=() [1/2]
template<size_t N>
Assignment operator. Definition at line 266 of file Scatter.h. 266 {
267 if (this != &s) {
268 AnalysisObject::operator = (s);
269 _points = s._points;
270 }
271 return *this;
272 }
virtual AnalysisObject & operator=(const AnalysisObject &ao) noexcept Default copy assignment operator. Definition AnalysisObject.h:61 References YODA::AnalysisObject::operator=(). ◆ operator=() [2/2]
template<size_t N>
Move operator. Definition at line 275 of file Scatter.h. 275 {
276 if (this != &s) {
277 AnalysisObject::operator = (s);
278 _points = std::move(s._points);
279 }
280 return *this;
281 }
References YODA::AnalysisObject::operator=(). ◆ point() [1/2]
template<size_t N>
Get a reference to the point with index index. Definition at line 352 of file Scatter.h. 352 {
353 return _points.at(index);
354 }
Referenced by YODA::ScatterND< N >::deserializeContent(), YODA::DbnStorage< DbnN, AxisT >::mkScatter(), and YODA::ScatterND< N >::serializeContent(). ◆ point() [2/2]
template<size_t N>
◆ points() [1/2]
template<size_t N>
Get the collection of points. Definition at line 340 of file Scatter.h. 340 {
341 return _points;
342 }
Referenced by YODA::ScatterND< N >::combineWith(), YODA::ScatterND< N >::edges(), YODA::transform(), YODA::WriterYODA1::writeScatter1D(), YODA::WriterYODA1::writeScatter2D(), and YODA::WriterYODA1::writeScatter3D(). ◆ points() [2/2]
template<size_t N>
◆ reset()
template<size_t N>
Clear all points. Implements YODA::AnalysisObject. Definition at line 302 of file Scatter.h. 302 {
303 _points.clear();
304 }
Referenced by YODA::ScatterND< N >::deserializeContent(). ◆ rmPoint()
template<size_t N>
Remove the point with index index. Implements YODA::Scatter. Definition at line 506 of file Scatter.h. 506 {
507 _points.erase(_points.begin()+index);
508 }
◆ scale() [1/3]
template<size_t N>
◆ scale() [2/3]
template<size_t N>
◆ scale() [3/3]
template<size_t N>
◆ serializeContent()
template<size_t N>
Content serialisation for MPI reduce operations. Implements YODA::AnalysisObject. Definition at line 520 of file Scatter.h. 520 {
521
522 if (fixed_length) return { }; // cannot guarantee fixed length
523
524 std::vector<double> rtn;
525 rtn.reserve(numPoints() * Point::DataSize::value);
527 std::vector<double> pdata = point(i)._serializeContent();
528 rtn.insert(std::end(rtn),
529 std::make_move_iterator(std::begin(pdata)),
530 std::make_move_iterator(std::end(pdata)));
531 }
532 return rtn;
533 }
References YODA::ScatterND< N >::numPoints(), and YODA::ScatterND< N >::point(). ◆ vals()
template<size_t N>
Get the coordinate vector along axis i. Definition at line 587 of file Scatter.h. 587 {
588 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
589 ValVec rtn; rtn.reserve(_points.size());
590 for (const auto& pt : _points) {
591 rtn.push_back( pt.val(i) );
592 }
593 return rtn;
594 }
Referenced by YODA::ScatterND< N >::max(), YODA::ScatterND< N >::min(), YODA::ScatterND< N >::xVals(), YODA::ScatterND< N >::yVals(), and YODA::ScatterND< N >::zVals(). ◆ xErrs()
template<size_t N>
Axis-specific alias. Definition at line 706 of file Scatter.h. References YODA::ScatterND< N >::errs(). ◆ xMax()
template<size_t N>
Axis-specific alias. Definition at line 695 of file Scatter.h. References YODA::ScatterND< N >::max(). ◆ xMaxs()
template<size_t N>
Axis-specific alias. Definition at line 673 of file Scatter.h. ValVec maxs(const size_t i) const Get the positive error vector along axis i. Definition Scatter.h:607 References YODA::ScatterND< N >::maxs(). ◆ xMin()
template<size_t N>
Axis-specific alias. Definition at line 684 of file Scatter.h. double min(const size_t i) const Get the smallest central value along axis i. Definition Scatter.h:617 References YODA::ScatterND< N >::min(). ◆ xMins()
template<size_t N>
Axis-specific alias. Definition at line 662 of file Scatter.h. References YODA::ScatterND< N >::mins(). ◆ xVals()
template<size_t N>
Axis-specific alias. Definition at line 651 of file Scatter.h. References YODA::ScatterND< N >::vals(). ◆ yErrs()
template<size_t N>
template<size_t axisN = N, typename = std::enable_if_t<(axisN >= 2)>>
Axis-specific alias. Definition at line 710 of file Scatter.h. References YODA::ScatterND< N >::errs(). ◆ yMax()
template<size_t N>
template<size_t axisN = N, typename = std::enable_if_t<(axisN >= 2)>>
Axis-specific alias. Definition at line 699 of file Scatter.h. References YODA::ScatterND< N >::max(). ◆ yMaxs()
template<size_t N>
template<size_t axisN = N, typename = std::enable_if_t<(axisN >= 2)>>
Axis-specific alias. Definition at line 677 of file Scatter.h. References YODA::ScatterND< N >::maxs(). ◆ yMin()
template<size_t N>
template<size_t axisN = N, typename = std::enable_if_t<(axisN >= 2)>>
Axis-specific alias. Definition at line 688 of file Scatter.h. References YODA::ScatterND< N >::min(). ◆ yMins()
template<size_t N>
template<size_t axisN = N, typename = std::enable_if_t<(axisN >= 2)>>
Axis-specific alias. Definition at line 666 of file Scatter.h. References YODA::ScatterND< N >::mins(). ◆ yVals()
template<size_t N>
template<size_t axisN = N, typename = std::enable_if_t<(axisN >= 2)>>
Axis-specific alias. Definition at line 655 of file Scatter.h. References YODA::ScatterND< N >::vals(). ◆ zErrs()
template<size_t N>
template<size_t axisN = N, typename = std::enable_if_t<(axisN >= 3)>>
Axis-specific alias. Definition at line 714 of file Scatter.h. References YODA::ScatterND< N >::errs(). ◆ zMax()
template<size_t N>
template<size_t axisN = N, typename = std::enable_if_t<(axisN >= 3)>>
Axis-specific alias. Definition at line 703 of file Scatter.h. References YODA::ScatterND< N >::max(). ◆ zMaxs()
template<size_t N>
template<size_t axisN = N, typename = std::enable_if_t<(axisN >= 3)>>
Axis-specific alias. Definition at line 681 of file Scatter.h. References YODA::ScatterND< N >::maxs(). ◆ zMin()
template<size_t N>
template<size_t axisN = N, typename = std::enable_if_t<(axisN >= 3)>>
Axis-specific alias. Definition at line 692 of file Scatter.h. References YODA::ScatterND< N >::min(). ◆ zMins()
template<size_t N>
template<size_t axisN = N, typename = std::enable_if_t<(axisN >= 3)>>
Axis-specific alias. Definition at line 670 of file Scatter.h. References YODA::ScatterND< N >::mins(). ◆ zVals()
template<size_t N>
template<size_t axisN = N, typename = std::enable_if_t<(axisN >= 3)>>
Axis-specific alias. Definition at line 659 of file Scatter.h. References YODA::ScatterND< N >::vals(). The documentation for this class was generated from the following file:
Generated on Thu Feb 29 2024 12:47:16 for YODA - Yet more Objects for Data Analysis by 1.9.8 |