1#ifndef TCALIBRATIONGRAPH_H
2#define TCALIBRATIONGRAPH_H
9#include "TGraphErrors.h"
10#include "TFitResultPtr.h"
36#if ROOT_VERSION_CODE < ROOT_VERSION(6, 26, 0)
37 void Scale(
const double& scale);
59 fGraphs.resize(rhs.fGraphs.size());
60 for(
size_t i = 0; i <
fGraphs.size(); ++i) {
61 fGraphs[i] = rhs.fGraphs[i];
65 fResidualGraphs[i] = rhs.fResidualGraphs[i];
68 fTotalGraph =
static_cast<TGraphErrors*
>(rhs.fTotalGraph->Clone());
79 int Add(TGraphErrors*, const std::
string& label);
84 fGraphs[index].SetLineColor(color);
91 fGraphs[index].SetMarkerColor(color);
97 fGraphs[index].SetMarkerStyle(style);
135 void DrawResidual(Option_t* opt =
"", TLegend* legend =
nullptr);
142 Int_t
RemovePoint(
const Int_t& px,
const Int_t& py);
151 void Scale(
bool useAllPrevious =
true);
153 void Print(Option_t* opt =
"")
const override;
160 void Clear(Option_t* option =
"")
override;
TCalibrationGraphSet * fParent
pointer to the set this graph belongs to
TCalibrationGraph(TCalibrationGraphSet *parent, TGraphErrors *graph)
bool fIsResidual
flag to indicate that this graph is for residuals
TCalibrationGraph(const TCalibrationGraph &)=default
TCalibrationGraph(TCalibrationGraphSet *parent, const int &size, const bool &isResidual=false)
~TCalibrationGraph()=default
TCalibrationGraph(TCalibrationGraph &&) noexcept=default
TCalibrationGraph()=default
Int_t RemovePoint() override
void ResetTotalGraph()
reset the total graph and add the individual ones again (used e.g. after scaling of individual graphs...
void DrawResidual(Option_t *opt="", TLegend *legend=nullptr)
std::vector< size_t > fGraphIndex
Index of the graph this point belongs to.
int GetN()
Returns GetN(), i.e. number of points of the total graph.
void RemoveGraph(int64_t index)
std::vector< size_t > fPointIndex
Index of the point within the graph this point corresponds to.
void SetMarkerColor(int index, Color_t color)
bool SetResidual(const bool &force=false)
TCalibrationGraphSet(TGraphErrors *graph=nullptr, const std::string &label="")
void SetColor(int index, Color_t color)
TCalibrationGraphSet(TCalibrationGraphSet &&) noexcept=delete
std::string fYAxisLabel
The label of the y-axis.
static EVerbosity fVerboseLevel
Changes verbosity.
static void VerboseLevel(EVerbosity val)
std::vector< TCalibrationGraph > fResidualGraphs
These are the graphs used for plotting the residuals per source.
TGraphErrors * fTotalGraph
The sum of the other graphs, used for fitting.
TCalibrationGraph * Graph(size_t index)
double GetMaximumY() const
Return maximum y-value.
void SetLineColor(int index, Color_t color)
double * GetY()
Returns an array of y-values of the total graph.
double fMaximumX
Maximum x-value.
double fMinimumY
Minimum y-value.
void SetColorStyle(int index, int val)
double * GetEX()
Returns an array of x-errors of the total graph.
void Print(Option_t *opt="") const override
void Fit(TF1 *function, Option_t *opt="")
Fits the provided function to the total graph.
void SetMarkerStyle(int index, Style_t style)
TCalibrationGraphSet & operator=(TCalibrationGraphSet &&) noexcept=delete
double GetMinimumY() const
Return minimum y-value.
double GetMinimumX() const
Return minimum x-value.
TGraphErrors * TotalGraph()
double fMaximumY
Maximum y-value.
std::string fXAxisLabel
The label of the x-axis.
void Scale(bool useAllPrevious=true)
double GetMaximumX() const
Return maximum x-value.
int Add(TGraphErrors *, const std::string &label)
Add new graph to set, using the label when creating legends during plotting.
void DrawCalibration(Option_t *opt="", TLegend *legend=nullptr)
TGraphErrors * fTotalResidualGraph
The sum of the residuals. Not really used apart from plotting (but overlayed with the individual grap...
bool fResidualSet
Flag to indicate if the residual has been set correctly.
void Clear(Option_t *option="") override
double fMinimumX
Minimum x-value.
TCalibrationGraph * Residual(size_t index)
Int_t RemovePoint(const Int_t &px, const Int_t &py)
void SetAxisTitle(const char *title)
Set axis title for the graph (form "x-axis title;y-axis title")
std::vector< TCalibrationGraph > fGraphs
These are the graphs used for plotting the calibration points per source.
double * GetEY()
Returns an array of y-errors of the total graph.
double * GetX()
Returns an array of x-values of the total graph.
TF1 * FitFunction()
Gets the calibration from the total graph (might be nullptr!).
void XAxisLabel(const std::string &xAxisLabel)
Int_t RemoveResidualPoint(const Int_t &px, const Int_t &py)
static EVerbosity VerboseLevel()
TCalibrationGraphSet(const TCalibrationGraphSet &)=delete
void YAxisLabel(const std::string &yAxisLabel)
std::vector< std::string > fLabel
The labels for the different graphs.