GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TCal.h
Go to the documentation of this file.
1#ifndef TCAL_H
2#define TCAL_H
3
4/** \addtogroup Calibration
5 * @{
6 */
7
8/////////////////////////////////////////////////////////////////
9///
10/// \class TCal
11///
12/// This is an abstract 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 <vector>
20
21#include "TH1.h"
22#include "TF1.h"
23#include "TSpectrum.h"
24#include "TMultiGraph.h"
25#include "TGraphErrors.h"
26#include "TRef.h"
27
28#include "TChannel.h"
29#include "TNucleus.h"
30
31class TCal : public TGraphErrors {
32public:
33 TCal();
34 TCal(const char* name, const char* title);
35 TCal(const TCal&);
36 TCal(TCal&&) noexcept = default;
37 TCal& operator=(const TCal&) = default;
38 TCal& operator=(TCal&&) noexcept = default;
39 ~TCal() = default;
40
41 // pure virtual functions
42 virtual Bool_t IsGroupable() const = 0;
43
44 void Copy(TObject& obj) const override;
45 virtual void WriteToChannel() const { Error("WriteToChannel", "Not defined for %s", ClassName()); }
46 virtual TF1* GetFitFunction() const { return fFitFunc; }
47 virtual void SetFitFunction(TF1* func) { fFitFunc = func; }
48 virtual std::vector<Double_t> GetParameters() const;
49 virtual Double_t GetParameter(size_t parameter) const;
50
51 TChannel* GetChannel() const;
52 Bool_t SetChannel(TChannel* chan);
53 Bool_t SetChannel(UInt_t chanNum);
54 void Print(Option_t* opt = "") const override;
55 void Clear(Option_t* opt = "") override;
56 // virtual void Draw(Option_t* chopt = "");
57
58 virtual void WriteToAllChannels(const std::string& mnemonic = "");
59
60 virtual void SetHist(TH1* hist);
61 TH1* GetHist() const { return fHist; }
62 virtual void SetNucleus(TNucleus* nuc, Option_t* opt = "");
63 virtual TNucleus* GetNucleus() const { return fNuc; }
64
65protected:
66 void InitTCal();
67
68private:
69 TRef fChan{nullptr}; ///< This points at the TChannel
70 TF1* fFitFunc{nullptr}; ///< Fit function representing calibration
71 TH1* fHist{nullptr}; ///< Histogram that was fit by the TPeak.
72 TNucleus* fNuc{nullptr}; ///< Nucleus that we are calibrating against
73
74 /// \cond CLASSIMP
75 ClassDefOverride(TCal, 2) // NOLINT(readability-else-after-return)
76 /// \endcond
77};
78/*! @} */
79#endif
TH1D * hist
Definition UserFillObj.h:3
Definition TCal.h:31
void Print(Option_t *opt="") const override
Definition TCal.cxx:145
virtual void SetFitFunction(TF1 *func)
Definition TCal.h:47
virtual Double_t GetParameter(size_t parameter) const
Definition TCal.cxx:99
TH1 * fHist
Histogram that was fit by the TPeak.
Definition TCal.h:71
void InitTCal()
Definition TCal.cxx:172
TH1 * GetHist() const
Definition TCal.h:61
virtual void WriteToChannel() const
Definition TCal.h:45
TF1 * fFitFunc
Fit function representing calibration.
Definition TCal.h:70
void Clear(Option_t *opt="") override
Definition TCal.cxx:137
TRef fChan
This points at the TChannel.
Definition TCal.h:69
Bool_t SetChannel(TChannel *chan)
Definition TCal.cxx:51
void Copy(TObject &obj) const override
Definition TCal.cxx:37
TNucleus * fNuc
Nucleus that we are calibrating against.
Definition TCal.h:72
TCal()
Definition TCal.cxx:3
virtual TF1 * GetFitFunction() const
Definition TCal.h:46
virtual void SetNucleus(TNucleus *nuc, Option_t *opt="")
Definition TCal.cxx:24
virtual void WriteToAllChannels(const std::string &mnemonic="")
Definition TCal.cxx:63
virtual Bool_t IsGroupable() const =0
TChannel * GetChannel() const
Definition TCal.cxx:121
TCal(TCal &&) noexcept=default
virtual void SetHist(TH1 *hist)
Definition TCal.cxx:129
virtual std::vector< Double_t > GetParameters() const
Definition TCal.cxx:81
virtual TNucleus * GetNucleus() const
Definition TCal.h:63