ATLAS Offline Software
Loading...
Searching...
No Matches
GraphShape.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include <algorithm>
7
8using namespace LArSamples;
9
10
11GraphShape::GraphShape(const std::vector<double>& times, const std::vector<double>& values,
12 const std::vector<double>& errors)
13{
14 for (unsigned int k = 0; k < times.size(); k++)
15 m_points.emplace_back(times[k], values[k], errors[k]);
16}
17
18
19GraphShape::GraphShape(const AbsShape& shape, double scale, double shift)
20{
21 for (unsigned int k = 0; k < shape.nPoints(); k++)
22 m_points.emplace_back(shape.time(k) + shift, shape.value(k)*scale, shape.error(k)*scale);
23}
24
25
26bool GraphShape::add(const AbsShape& other)
27{
28 for (unsigned int k = 0; k < other.nPoints(); k++)
29 m_points.emplace_back(other.time(k), other.value(k), other.error(k));
30
31 std::sort(m_points.begin(), m_points.end());
32 return true;
33}
virtual unsigned int nPoints() const =0
virtual double time(unsigned int i) const =0
TVectorD values(int lwb, int upb) const
Definition AbsShape.cxx:135
virtual double error(unsigned int i) const
Definition AbsShape.cxx:24
virtual double value(unsigned int i) const =0
bool add(const AbsShape &other)
GraphShape(const std::vector< double > &times, const std::vector< double > &values, const std::vector< double > &errors)
Constructor.
std::vector< GraphPoint > m_points
Definition GraphShape.h:57
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.