GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TCalGraph.h
Go to the documentation of this file.
1#ifndef TCALGRAPH_H
2#define TCALGRAPH_H
3
4/** \addtogroup Calibration
5 * @{
6 */
7
8/////////////////////////////////////////////////////////////////
9///
10/// \class TCalGraph
11///
12/// This is a class that contains the basic info
13/// about a calibration. Calibrations here are TGraphErrors
14/// that are fit, with the resulting fit function being the
15/// calibrating function.
16///
17/////////////////////////////////////////////////////////////////
18
19#include <map>
20#include <vector>
21#include <utility>
22
23#include "TGraphErrors.h"
24#include "TCalPoint.h"
25#include "TCalList.h"
26#include "TSourceList.h"
27
28class TCalGraph : public TGraphErrors {
29public:
30 TCalGraph();
31 TCalGraph(const char* name, const char* title) : TGraphErrors(name, title) {};
32 TCalGraph(const TCalGraph&);
33 TCalGraph(TCalGraph&&) noexcept = default;
34 TCalGraph& operator=(const TCalGraph&) = default;
35 TCalGraph& operator=(TCalGraph&&) noexcept = default;
36 ~TCalGraph() = default;
37
38#if ROOT_VERSION_CODE >= ROOT_VERSION(6, 24, 0)
39 using TGraph::AddPoint;
40#endif
41 void AddPoint(const TCalPoint& cal_point);
42 Int_t FindClosestPointX(const Double_t& x_val);
43 Double_t FindDistToClosestPointX(const Double_t& x_val);
44
45 Int_t AddLists(const TCalList& cal_list, const TSourceList& src_list);
46 void Draw(Option_t* opt = "") override
47 {
48 BuildGraph();
49 TGraphErrors::Draw(opt);
50 }
51 void ClearAllPoints(Option_t* opt = "");
52
53 void Print(Option_t* opt = "") const override;
54 void Clear(Option_t* opt = "") override;
55
56protected:
57 std::map<UInt_t, std::pair<TCalPoint, TCalPoint>>& CompareMap() { return fCompareMap; }
58
59private:
60 void CorrectMissingPoints(TCalList& cal_list, TCalList& src_list);
61
62 virtual void BuildGraph() = 0;
63
64 std::map<UInt_t, std::pair<TCalPoint, TCalPoint>> fCompareMap;
65
66 /// \cond CLASSIMP
67 ClassDefOverride(TCalGraph, 1) // NOLINT(readability-else-after-return)
68 /// \endcond
69};
70/*! @} */
71#endif
void Draw(Option_t *opt="") override
Definition TCalGraph.h:46
Int_t AddLists(const TCalList &cal_list, const TSourceList &src_list)
Definition TCalGraph.cxx:63
Int_t FindClosestPointX(const Double_t &x_val)
Definition TCalGraph.cxx:43
TCalGraph(const char *name, const char *title)
Definition TCalGraph.h:31
TCalGraph(TCalGraph &&) noexcept=default
Double_t FindDistToClosestPointX(const Double_t &x_val)
Definition TCalGraph.cxx:57
std::map< UInt_t, std::pair< TCalPoint, TCalPoint > > & CompareMap()
Definition TCalGraph.h:57
void Print(Option_t *opt="") const override
Definition TCalGraph.cxx:16
void AddPoint(const TCalPoint &cal_point)
Definition TCalGraph.cxx:36
void ClearAllPoints(Option_t *opt="")
virtual void BuildGraph()=0
void CorrectMissingPoints(TCalList &cal_list, TCalList &src_list)
std::map< UInt_t, std::pair< TCalPoint, TCalPoint > > fCompareMap
Definition TCalGraph.h:64
void Clear(Option_t *opt="") override
Definition TCalGraph.cxx:30