Berkeley Nuclear Data Software
WFPlotter.hpp
Go to the documentation of this file.
1 #include "WFPlotter.h"
2 
3 
4 
6 template <class T>
7 void WFPlotter::addGraph(std::vector<T> a_wfYs)
8 {
9  if(m_graphs==nullptr)
10  {
11  m_graphs = new TMultiGraph();
12  }
13  TGraph* tmpGrph = getGraph<T>(a_wfYs);
14  int lineColor = m_lineColors.at(m_currentColor%m_lineColors.size());
15  tmpGrph->SetLineColor(lineColor);
16  m_currentColor++;
17  m_graphs->Add(tmpGrph);
18 }
19 
20 template <class T> TGraph* WFPlotter::getGraph(std::vector<T> a_wfYs)
21 {
22  std::vector<double> xs;
23  std::vector<double> ys;
24  xs.reserve(a_wfYs.size());
25  ys.reserve(a_wfYs.size());
26  for(size_t iP = 0;iP < a_wfYs.size();iP++)
27  {
28  xs.push_back(iP);
29  ys.push_back(a_wfYs[iP]);
30  }
31  TGraph* tmpGrph = new TGraph(xs.size(),&xs[0],&ys[0]);
32  return tmpGrph;
33 }
34 
TGraph * getGraph(std::vector< T > a_wfYs)
Definition: WFPlotter.hpp:20
void addGraph(std::vector< T > a_wfYs)
adds the supplied vector to the graph
Definition: WFPlotter.hpp:7