GamR  0.0.0
GammaROOT
Loading...
Searching...
No Matches
LevelSchemeFitter.hh
Go to the documentation of this file.
1#ifndef GAMR_NUCLEUS_LEVELSCHEME_HH
2#define GAMR_NUCLEUS_LEVELSCHEME_HH
3
4#include <map>
5
6#include <TArrow.h>
7#include <TText.h>
8#include <TGaxis.h>
9
10namespace GamR {
11 namespace Nucleus {
12 namespace LevelSchemeFitter {
13 class State : public TNamed, public TAttLine {
14 public:
15 int index;
16 Double_t fEnergy;
17 Double_t fUncertainty;
18 Double_t fDrawPos;
19 Double_t fLabelPos;
20 TText *fLabel = NULL;
21 State() : fEnergy(0), fUncertainty(0), fDrawPos(0), fLabelPos(0) { SetLineColor(kBlack); fLabel = new TText(); }
22 State(std::string name, double energy, EColor color=kBlack) : TNamed(name, name), fEnergy(energy), fUncertainty(0.01*energy), fDrawPos(energy), fLabelPos(energy) { SetLineColor(color); fLabel = new TText(); }
23 ~State() { }
24 Int_t DistancetoPrimitive(Int_t px, Int_t py);
25 void ExecuteEvent(Int_t event, Int_t px, Int_t py);
26 void Paint(Option_t *option="");
27 bool operator<(const State &rhs) const { return fEnergy < rhs.fEnergy; }
28 bool operator==(const State &rhs) const { return fEnergy == rhs.fEnergy; }
30 };
31 class Transition : public TArrow {
32 public:
35 //these are experimentally observed things
36 Double_t fEnergy;
37 Double_t fUncertainty;
38 TText *fLabel = NULL;
39 Transition() : fInitial(NULL), fFinal(NULL), fEnergy(0), fUncertainty(0), TArrow() { SetLineColor(kBlack); SetFillColor(kBlack); SetArrowSize(0.02); SetOption("|>"); fLabel = new TText(); }
40 Transition(State *initial, State *final, double energy, double uncertainty, EColor color) :
41 fInitial(initial),
42 fFinal(final),
43 fEnergy(energy),
44 fUncertainty(uncertainty)
45 { SetLineColor(color); SetFillColor(color); SetArrowSize(0.01); SetOption("|>"); fLabel = new TText(); }
47 void Paint(Option_t *option = "");
48 Int_t DistancetoPrimitive(Int_t px, Int_t py);
49 void ExecuteEvent(Int_t event, Int_t px, Int_t py);
50 void Draw(Option_t *option = "") { TArrow::Draw(option); }
51
52 bool operator<(const Transition &rhs) const { return fEnergy < rhs.fEnergy; }
53
55 };
56 class Scheme : public TNamed {
57 public:
58 std::map<std::string, State> fStates;
59 std::vector<Transition> fTransitions;
60 double drawLow = 0;
61 double drawHigh = 1e9;
62 TH2F *fDrawHist = NULL;
63 TGaxis *fAxis = NULL;
64 Scheme() { fDrawHist = new TH2F("", "", 100, 0.0, 1.0, 100, drawLow, drawHigh); }
65 Scheme(std::string name) : TNamed(name, name) { fDrawHist = new TH2F(name.c_str(), name.c_str(), 100, 0.0, 1.0, 100, drawLow, drawHigh); }
66 State* GetStateByIndex(int i);
67 void AddState(std::string name, double energy, EColor color=kBlack) { State state(name, energy, color); fStates[name]=state; }
68 void SetIndices();
69 void AddTransition(std::string initState, std::string finState, double energy, double uncertainty, EColor color=kBlack) {
70 Transition transition(&fStates[initState], &fStates[finState], energy, uncertainty, color);
71 fTransitions.push_back(transition);
72
73 }
74 void SetDrawRange(double eLow, double eHigh) { drawLow = eLow; drawHigh = eHigh; }
75 double GetChiSquared();
76 void Fit();
77 void PrintStates();
78 void PrintTransitions();
79 void Print();
80 void SaveTable(std::string filename);
81 void PrintState(std::string name);
82 void Paint(Option_t *option="");
83
85 private:
86 class GlobalChiSquare;
87
88 };
89 }
90 }
91}
92
93
94#endif
void py(TVirtualPad *canvas)
void px(TVirtualPad *canvas)
std::map< std::string, State > fStates
void AddState(std::string name, double energy, EColor color=kBlack)
void SetDrawRange(double eLow, double eHigh)
void AddTransition(std::string initState, std::string finState, double energy, double uncertainty, EColor color=kBlack)
Int_t DistancetoPrimitive(Int_t px, Int_t py)
State(std::string name, double energy, EColor color=kBlack)
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
bool operator==(const State &rhs) const
bool operator<(const State &rhs) const
Transition(State *initial, State *final, double energy, double uncertainty, EColor color)
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
bool operator<(const Transition &rhs) const
Definition Gain.cc:19