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 446 of file Scatter.h. 447 {
448 return addPoint_aux(std::make_tuple(std::forward<Args>(args)...), std::make_index_sequence<N>{});
449 }
auto addPoint_aux(std::tuple< Args... > &&t, std::index_sequence< Is... >) -> std::enable_if_t<(isAllVals< Args... >::value), ScatterND< N > > & Definition Scatter.h:469 References YODA::ScatterND< N >::addPoint_aux(). ◆ addPoint() [2/7]
template<size_t N>
Insert a new point. Definition at line 379 of file Scatter.h. 379 {
380 _points.insert(pt);
381 return *this;
382 }
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(), 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 469 of file Scatter.h. 470 {
471 if constexpr(sizeof...(Args) == 2*N) { // Case 1: symmetric errors
472 _points.insert(
475 static_cast<double>(std::get<N+Is>(t))}...} ));
476 }
477 else { // Case 2: asymmetric errors
480 static_cast<double>(std::get<N+2*Is+1>(t))}...} ));
481 }
482 return *this;
483 }
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 500 of file Scatter.h. 501 {
504 return *this;
505 }
◆ addPoints()
template<size_t N>
Insert a collection of new points. Definition at line 511 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 568 of file Scatter.h. 568 {
569 addPoints(other.points());
570 return *this;
571 }
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 580 of file Scatter.h. 580 {
582 return *this;
583 }
ScatterND< N > & combineWith(const ScatterND< N > &other) Definition Scatter.h:568 References YODA::ScatterND< N >::combineWith(). ◆ combineWith() [3/4]
template<size_t N>
Definition at line 574 of file Scatter.h. References YODA::ScatterND< N >::addPoints(). ◆ combineWith() [4/4]
template<size_t N>
Definition at line 586 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 545 of file Scatter.h. 545 {
546
547 if (data.size() % Point::DataSize::value)
548 throw UserError("Length of serialized data should be a multiple of "+std::to_string(Point::DataSize::value)+"!");
549
550 const size_t nPoints = data.size()/Point::DataSize::value;
551 const auto itr = data.cbegin();
552 reset();
553 for (size_t i = 0; i < nPoints; ++i) {
555 auto first = itr + i*Point::DataSize::value;
556 auto last = first + Point::DataSize::value;
557 point(i)._deserializeContent(std::vector<double>{first, last});
558 }
559
560 }
PointND< N > & point(size_t index) Get a reference to the point with index index. Definition Scatter.h:362 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 766 of file Scatter.h. 766 {
767 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
768 std::vector<Pair> rtn;
769 rtn.resize(numPoints());
770 size_t j = 0;
772 rtn[j++] = std::make_pair(p.min(i), p.max(i));
773 }
774 std::sort(rtn.begin(), rtn.end());
775 rtn.erase(std::unique(rtn.begin(), rtn.end()), rtn.end());
776 return rtn;
777 }
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 651 of file Scatter.h. 651 {
652 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
653 ValVec rtn; rtn.reserve(_points.size());
654 for (const auto& pt : _points) {
655 rtn.push_back( pt.errAvg(i) );
656 }
657 return rtn;
658 }
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 641 of file Scatter.h. 641 {
642 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
643 PairVec rtn; rtn.reserve(_points.size());
644 for (const auto& pt : _points) {
645 rtn.push_back( pt.errs(i) );
646 }
647 return rtn;
648 }
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 525 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 634 of file Scatter.h. 634 {
635 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
637 return *std::max_element(cvals.begin(), cvals.end());
638 }
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 617 of file Scatter.h. 617 {
618 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
619 ValVec rtn; rtn.reserve(_points.size());
620 for (const auto& pt : _points) {
621 rtn.push_back( pt.max(i) );
622 }
623 return rtn;
624 }
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 627 of file Scatter.h. 627 {
628 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
630 return *std::min_element(cvals.begin(), cvals.end());
631 }
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 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.min(i) );
612 }
613 return rtn;
614 }
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 344 of file Scatter.h. 344 {
345 return _points.size();
346 }
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 362 of file Scatter.h. 362 {
363 return _points.at(index);
364 }
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 350 of file Scatter.h. 350 {
351 return _points;
352 }
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 516 of file Scatter.h. 516 {
517 _points.erase(_points.begin()+index);
518 }
◆ 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 329 of file Scatter.h. 329 {
330 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
332 }
◆ scaleVal()
template<size_t N>
Scale value along direction i. Definition at line 323 of file Scatter.h. 323 {
324 if (i >= N) throw RangeError("Invalid axis int, must be in range 0..dim-1");
326 }
◆ serializeContent()
template<size_t N>
Content serialisation for MPI reduce operations. Implements YODA::AnalysisObject. Definition at line 530 of file Scatter.h. 530 {
531
532 if (fixed_length) return { }; // cannot guarantee fixed length
533
534 std::vector<double> rtn;
535 rtn.reserve(numPoints() * Point::DataSize::value);
537 std::vector<double> pdata = point(i)._serializeContent();
538 rtn.insert(std::end(rtn),
539 std::make_move_iterator(std::begin(pdata)),
540 std::make_move_iterator(std::end(pdata)));
541 }
542 return rtn;
543 }
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 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.val(i) );
602 }
603 return rtn;
604 }
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 727 of file Scatter.h. References YODA::ScatterND< N >::errAvgs(). ◆ xErrs()
template<size_t N>
Axis-specific alias. Definition at line 716 of file Scatter.h. References YODA::ScatterND< N >::errs(). ◆ xMax()
template<size_t N>
Axis-specific alias. Definition at line 705 of file Scatter.h. References YODA::ScatterND< N >::max(). ◆ xMaxs()
template<size_t N>
Axis-specific alias. Definition at line 683 of file Scatter.h. ValVec maxs(const size_t i) const Get the positive error vector along axis i. Definition Scatter.h:617 References YODA::ScatterND< N >::maxs(). ◆ xMin()
template<size_t N>
Axis-specific alias. Definition at line 694 of file Scatter.h. double min(const size_t i) const Get the smallest central value along axis i. Definition Scatter.h:627 References YODA::ScatterND< N >::min(). ◆ xMins()
template<size_t N>
Axis-specific alias. Definition at line 672 of file Scatter.h. References YODA::ScatterND< N >::mins(). ◆ xVals()
template<size_t N>
Axis-specific alias. Definition at line 661 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 731 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 720 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 709 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 687 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 698 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 676 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 665 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 735 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 724 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 713 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 691 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 702 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 680 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 669 of file Scatter.h. References YODA::ScatterND< N >::vals(). The documentation for this class was generated from the following file:
Generated on Mon Oct 28 2024 13:47:24 for YODA - Yet more Objects for Data Analysis by 1.9.8 |