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 202 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 220 of file Scatter.h. 222 for (size_t i = 0; i < positions.size(); ++i) {
223 addPoint(PointND<N>(std::forward<containedType<ValRange>>(positions[i])));
224 }
225 }
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 230 of file Scatter.h. 232 if (positions.size() != errors.size()) throw RangeError("Number of errors doesn't match number of positions");
233 for (size_t i = 0; i < positions.size(); ++i) {
234 addPoint(PointND<N>(std::forward<containedType<ValRange>>(positions[i]),
235 std::forward<containedType<ValRange>>(errors[i])));
236 }
237 }
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 243 of file Scatter.h. 245 if (positions.size() != errors.size()) throw RangeError("Number of error pairs doesn't match number of positions");
246 for (size_t i = 0; i < positions.size(); ++i) {
247 addPoint(PointND<N>(std::forward<containedType<ValRange>>(positions[i]),
248 std::forward<containedType<PairRange>>(errors[i])));
249 }
250 }
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 445 of file Scatter.h. 446 {
447 return addPoint_aux(std::make_tuple(std::forward<Args>(args)...), std::make_index_sequence<N>{});
448 }
auto addPoint_aux(std::tuple< Args... > &&t, std::index_sequence< Is... >) -> std::enable_if_t<(isAllVals< Args... >::value), ScatterND< N > > & Definition Scatter.h:468 References YODA::ScatterND< N >::addPoint_aux(). ◆ addPoint() [2/7]
template<size_t N>
Insert a new point. Definition at line 378 of file Scatter.h. 378 {
379 _points.push_back(pt);
380 return *this;
381 }
Referenced by YODA::ScatterND< N >::addPoints(), YODA::ScatterND< N >::deserializeContent(), YODA::Counter::mkScatter(), YODA::Estimate0D::mkScatter(), YODA::EstimateStorage< AxisT >::mkScatter(), YODA::ScatterND< N >::ScatterND(), YODA::ScatterND< N >::ScatterND(), YODA::ScatterND< N >::ScatterND(), and YODA::zipProfiles(). ◆ 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 468 of file Scatter.h. 469 {
470 if constexpr(sizeof...(Args) == 2*N) { // Case 1: symmetric errors
471 _points.push_back(
474 static_cast<double>(std::get<N+Is>(t))}...} ));
475 }
476 else { // Case 2: asymmetric errors
479 static_cast<double>(std::get<N+2*Is+1>(t))}...} ));
480 }
481 return *this;
482 }
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 499 of file Scatter.h. 500 {
503 return *this;
504 }
◆ addPoints()
template<size_t N>
Insert a collection of new points. Definition at line 510 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 283 of file Scatter.h. 283 {
284 return ScatterND<N>(*this);
285 }
Referenced by YODA::WriterYODA1::writeScatter1D(), YODA::WriterYODA1::writeScatter2D(), and YODA::WriterYODA1::writeScatter3D(). ◆ combineWith() [1/4]
template<size_t N>
Definition at line 567 of file Scatter.h. 567 {
568 addPoints(other.points());
569 return *this;
570 }
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 579 of file Scatter.h. 579 {
581 return *this;
582 }
ScatterND< N > & combineWith(const ScatterND< N > &other) Definition Scatter.h:567 References YODA::ScatterND< N >::combineWith(). ◆ combineWith() [3/4]
template<size_t N>
Definition at line 573 of file Scatter.h. References YODA::ScatterND< N >::addPoints(). ◆ combineWith() [4/4]
template<size_t N>
Definition at line 585 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 544 of file Scatter.h. 544 {
545
546 if (data.size() % Point::DataSize::value)
547 throw UserError("Length of serialized data should be a multiple of "+std::to_string(Point::DataSize::value)+"!");
548
549 const size_t nPoints = data.size()/Point::DataSize::value;
550 const auto itr = data.cbegin();
551 reset();
552 for (size_t i = 0; i < nPoints; ++i) {
554 auto first = itr + i*Point::DataSize::value;
555 auto last = first + Point::DataSize::value;
556 point(i)._deserializeContent(std::vector<double>{first, last});
557 }
558
559 }
PointND< N > & point(size_t index) Get a reference to the point with index index. Definition Scatter.h:361 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 295 of file Scatter.h. 295{ return N; }
◆ edges()
template<size_t N>
Definition at line 765 of file Scatter.h. 765 {
766 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
767 std::vector<Pair> rtn;
768 rtn.resize(numPoints());
769 size_t j = 0;
771 rtn[j++] = std::make_pair(p.min(i), p.max(i));
772 }
773 std::sort(rtn.begin(), rtn.end());
774 rtn.erase(std::unique(rtn.begin(), rtn.end()), rtn.end());
775 return rtn;
776 }
References YODA::ScatterND< N >::numPoints(), and YODA::ScatterND< N >::points(). ◆ errAvgs()
template<size_t N>
Get the average error along axis i. Definition at line 650 of file Scatter.h. 650 {
651 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
652 ValVec rtn; rtn.reserve(_points.size());
653 for (const auto& pt : _points) {
654 rtn.push_back( pt.errAvg(i) );
655 }
656 return rtn;
657 }
Referenced by YODA::ScatterND< N >::xErrAvgs(), YODA::ScatterND< N >::yErrAvgs(), and YODA::ScatterND< N >::zErrAvgs(). ◆ errs()
template<size_t N>
Get the error pairs along axis i. Definition at line 640 of file Scatter.h. 640 {
641 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
642 PairVec rtn; rtn.reserve(_points.size());
643 for (const auto& pt : _points) {
644 rtn.push_back( pt.errs(i) );
645 }
646 return rtn;
647 }
Referenced by YODA::ScatterND< N >::xErrs(), YODA::ScatterND< N >::yErrs(), and YODA::ScatterND< N >::zErrs(). ◆ lengthContent()
template<size_t N>
Length of serialized content vector for MPI reduce operations. Implements YODA::AnalysisObject. Definition at line 524 of file Scatter.h. References YODA::ScatterND< N >::numPoints(). Referenced by YODA::ScatterND< N >::serializeContent(). ◆ max()
template<size_t N>
Get the largest central value along axis i. Definition at line 633 of file Scatter.h. 633 {
634 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
636 return *std::max_element(cvals.begin(), cvals.end());
637 }
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 616 of file Scatter.h. 616 {
617 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
618 ValVec rtn; rtn.reserve(_points.size());
619 for (const auto& pt : _points) {
620 rtn.push_back( pt.max(i) );
621 }
622 return rtn;
623 }
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 626 of file Scatter.h. 626 {
627 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
629 return *std::min_element(cvals.begin(), cvals.end());
630 }
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 606 of file Scatter.h. 606 {
607 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
608 ValVec rtn; rtn.reserve(_points.size());
609 for (const auto& pt : _points) {
610 rtn.push_back( pt.min(i) );
611 }
612 return rtn;
613 }
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 288 of file Scatter.h. 288 {
289 return new ScatterND<N>(*this);
290 }
◆ numPoints()
template<size_t N>
Number of points in the scatter. Implements YODA::Scatter. Definition at line 343 of file Scatter.h. 343 {
344 return _points.size();
345 }
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 265 of file Scatter.h. 265 {
266 if (this != &s) {
267 AnalysisObject::operator = (s);
268 _points = s._points;
269 }
270 return *this;
271 }
virtual AnalysisObject & operator=(const AnalysisObject &ao) noexcept Default copy assignment operator. Definition AnalysisObject.h:66 References YODA::AnalysisObject::operator=(). ◆ operator=() [2/2]
template<size_t N>
Move operator. Definition at line 274 of file Scatter.h. 274 {
275 if (this != &s) {
276 AnalysisObject::operator = (s);
277 _points = std::move(s._points);
278 }
279 return *this;
280 }
References YODA::AnalysisObject::operator=(). ◆ point() [1/2]
template<size_t N>
Get a reference to the point with index index. Definition at line 361 of file Scatter.h. 361 {
362 return _points.at(index);
363 }
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 349 of file Scatter.h. 349 {
350 return _points;
351 }
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 301 of file Scatter.h. 301 {
302 _points.clear();
303 }
Referenced by YODA::ScatterND< N >::deserializeContent(). ◆ rmPoint()
template<size_t N>
Remove the point with index index. Implements YODA::Scatter. Definition at line 515 of file Scatter.h. 515 {
516 _points.erase(_points.begin()+index);
517 }
◆ scale() [1/3]
template<size_t N>
◆ scale() [2/3]
template<size_t N>
◆ scale() [3/3]
template<size_t N>
◆ scaleErr()
template<size_t N>
Scale error along direction i. Definition at line 328 of file Scatter.h. 328 {
329 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
331 }
◆ scaleVal()
template<size_t N>
Scale value along direction i. Definition at line 322 of file Scatter.h. 322 {
323 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
325 }
◆ serializeContent()
template<size_t N>
Content serialisation for MPI reduce operations. Implements YODA::AnalysisObject. Definition at line 529 of file Scatter.h. 529 {
530
531 if (fixed_length) return { }; // cannot guarantee fixed length
532
533 std::vector<double> rtn;
534 rtn.reserve(lengthContent());
536 std::vector<double> pdata = point(i)._serializeContent();
537 rtn.insert(std::end(rtn),
538 std::make_move_iterator(std::begin(pdata)),
539 std::make_move_iterator(std::end(pdata)));
540 }
541 return rtn;
542 }
size_t lengthContent(bool fixed_length=false) const noexcept Length of serialized content vector for MPI reduce operations. Definition Scatter.h:524 References YODA::ScatterND< N >::lengthContent(), YODA::ScatterND< N >::numPoints(), and YODA::ScatterND< N >::point(). ◆ vals()
template<size_t N>
Get the coordinate vector along axis i. Definition at line 596 of file Scatter.h. 596 {
597 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
598 ValVec rtn; rtn.reserve(_points.size());
599 for (const auto& pt : _points) {
600 rtn.push_back( pt.val(i) );
601 }
602 return rtn;
603 }
Referenced by YODA::ScatterND< N >::max(), YODA::ScatterND< N >::min(), YODA::ScatterND< N >::xVals(), YODA::ScatterND< N >::yVals(), and YODA::ScatterND< N >::zVals(). ◆ xErrAvgs()
template<size_t N>
Axis-specific alias. Definition at line 726 of file Scatter.h. References YODA::ScatterND< N >::errAvgs(). ◆ xErrs()
template<size_t N>
Axis-specific alias. Definition at line 715 of file Scatter.h. References YODA::ScatterND< N >::errs(). ◆ xMax()
template<size_t N>
Axis-specific alias. Definition at line 704 of file Scatter.h. References YODA::ScatterND< N >::max(). ◆ xMaxs()
template<size_t N>
Axis-specific alias. Definition at line 682 of file Scatter.h. ValVec maxs(const size_t i) const Get the positive error vector along axis i. Definition Scatter.h:616 References YODA::ScatterND< N >::maxs(). ◆ xMin()
template<size_t N>
Axis-specific alias. Definition at line 693 of file Scatter.h. double min(const size_t i) const Get the smallest central value along axis i. Definition Scatter.h:626 References YODA::ScatterND< N >::min(). ◆ xMins()
template<size_t N>
Axis-specific alias. Definition at line 671 of file Scatter.h. References YODA::ScatterND< N >::mins(). ◆ xVals()
template<size_t N>
Axis-specific alias. Definition at line 660 of file Scatter.h. References YODA::ScatterND< N >::vals(). ◆ yErrAvgs()
template<size_t N>
template<size_t axisN = N, typename = std::enable_if_t<(axisN >= 2)>>
Axis-specific alias. Definition at line 730 of file Scatter.h. References YODA::ScatterND< N >::errAvgs(). ◆ yErrs()
template<size_t N>
template<size_t axisN = N, typename = std::enable_if_t<(axisN >= 2)>>
Axis-specific alias. Definition at line 719 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 708 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 686 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 697 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 675 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 664 of file Scatter.h. References YODA::ScatterND< N >::vals(). ◆ zErrAvgs()
template<size_t N>
template<size_t axisN = N, typename = std::enable_if_t<(axisN >= 3)>>
Axis-specific alias. Definition at line 734 of file Scatter.h. References YODA::ScatterND< N >::errAvgs(). ◆ zErrs()
template<size_t N>
template<size_t axisN = N, typename = std::enable_if_t<(axisN >= 3)>>
Axis-specific alias. Definition at line 723 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 712 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 690 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 701 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 679 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 668 of file Scatter.h. References YODA::ScatterND< N >::vals(). The documentation for this class was generated from the following file:
Generated on Fri Mar 7 2025 09:06:41 for YODA - Yet more Objects for Data Analysis by |