KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVNucleusBox.cpp
1//Created by KVClassFactory on Sat Nov 24 11:07:04 2012
2//Author: gruyer,,,
3
4#include "KVNucleusBox.h"
5#include "TROOT.h"
6#include "TVirtualPad.h"
7#include "TVirtualX.h"
8#include "TClass.h"
9#include "TMath.h"
10#include "TContextMenu.h"
11
12
14
15
16
18
19KVNucleusBox::KVNucleusBox(Int_t Z, Int_t N, Double_t size, Int_t colStable, Int_t colRadio): TBox(N - size, Z - size, N + size, Z + size)
20{
21 // Constructor with Z,N of a Nucleus
22
23 fZ = Z;
24 fN = N;
25 fA = fN + fZ;
26
27 fNucleus = new KVNucleus;
28 fNucleus->SetZandA(fZ, fA);
29 fOwnNucleus = kTRUE;
30 fSymbol.SetText(fN, fZ, fNucleus->GetLatexSymbol());
31 fSymbol.SetTextAlign(22);
32 fSymbol.SetTextSize(.02);
33
34 if (fNucleus->IsStable()) {
36 SetLineWidth(2);
37 SetFillColor(colStable);
38 }
39 else if (fNucleus->GetLifeTime() > 1.e-06) {
41 SetFillColor(colRadio);
42 }
43 else {
45 SetFillColor(colRadio);
46 }
47 // SetToolTipText(Form("%s (Z=%d,N=%d)",fNucleus->GetSymbol(),fZ,fN),250);
48
49 fShowSymbol = kFALSE;
50
51}
52
53
54
56
58{
59 SetToolTipText(Form("%s (Z=%d,N=%d)", fNucleus->GetSymbol(), fZ, fN), 250);
60 return;
61}
62
63
64
65
68
69KVNucleusBox::KVNucleusBox(KVNucleus* nuc, Double_t size, Bool_t owner): TBox(nuc->GetN() - size, nuc->GetZ() - size, nuc->GetN() + size, nuc->GetZ() + size)
70{
71 // Constructor with Z,N of a Nucleus
72
73 fNucleus = nuc;
74 fOwnNucleus = owner;
76
77 fZ = fNucleus->GetZ();
78 fN = fNucleus->GetN();
79 fA = fN + fZ;
83
84 if (fNucleus->IsStable()) {
86 SetLineWidth(2);
88 }
89 else if (fNucleus->GetLifeTime() > 1.e-06) {
92 }
93 else {
96 }
97 SetToolTipText(Form("%s (Z=%d,N=%d)", fNucleus->GetSymbol(), fZ, fN), 250);
99
100}
101
102
103
105
107{
108 fDrawSame = DrawSame;
109 if (fDrawSame) SetFillStyle(0);
110 else SetFillStyle(1);
111}
112
113
114
115
116
123
125{
126 // Copy constructor
127 // This ctor is used to make a copy of an existing object (for example
128 // when a method returns an object), and it is always a good idea to
129 // implement it.
130 // If your class allocates memory in its constructor(s) then it is ESSENTIAL :-)
131
132 obj.Copy(*this);
133}
134
135
136
139
141{
142 // Destructor
143 if (fOwnNucleus) delete fNucleus;
144}
145
146
147
148
156
158{
159 // This method copies the current state of 'this' object into 'obj'
160 // You should add here any member variables, for example:
161 // (supposing a member variable KVNucleusBox::fToto)
162 // CastedObj.fToto = fToto;
163 // or
164 // CastedObj.SetToto( GetToto() );
165
166 TBox::Copy(obj);
167 //KVNucleusBox& CastedObj = (KVNucleusBox&)obj;
168}
169
170
171
173
175{
176 if (event == kButton1Double) {
178 }
179 else if (event == kButton3Down) {
182 cc->GetContextMenu()->Popup(px, py, fNuclearChart, cc, cc->cd());
183 return;
184 }
185 TBox::ExecuteEvent(event, px, py);
186}
187
188
189
191
196
197
198
200
206
207
208
209
kButton3Down
kButton1Double
int Int_t
size_t size(const MatrixT &matrix)
bool Bool_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
const char Option_t
kGray
kBlack
#define N
Option_t Option_t option
Option_t Option_t SetLineWidth
Option_t Option_t SetLineColor
Option_t Option_t SetFillColor
char * Form(const char *fmt,...)
TCanvas with mouse-controlled dynamic zoom and pan & scan.
Definition KVCanvas.h:54
void SetCurrentNuc(KVNucleus *nuc)
void ShowNucleusInfo(KVNucleus *nuc)
KVCanvas * GetCanvas()
A TBox representing a nucleus in a KVNuclearChart.
virtual ~KVNucleusBox()
Destructor.
void SetShowSymbol(Bool_t value=kTRUE)
void SetDrawMode(Bool_t DrawSame)
KVNuclearChart * fNuclearChart
void EnableToolTip()
Bool_t fOwnNucleus
Bool_t fShowSymbol
KVNucleusBox(Int_t Z, Int_t N, Double_t size=0.4, Int_t colStable=kBlack, Int_t colRadio=kGray+1)
Constructor with Z,N of a Nucleus.
void ExecuteEvent(Int_t event, Int_t px, Int_t py)
void Copy(TObject &) const
KVNucleus * fNucleus
void Paint(Option_t *option="")
Bool_t fDrawSame
Description of properties and kinematics of atomic nuclei.
Definition KVNucleus.h:126
const Char_t * GetSymbol(Option_t *opt="") const
Definition KVNucleus.cpp:81
Int_t GetN() const
Return the number of neutron.
void SetZandA(Int_t z, Int_t a)
Set atomic number and mass number.
const Char_t * GetLatexSymbol(Option_t *opt="") const
Bool_t IsStable(Double_t min_lifetime=1.0e+15) const
Int_t GetZ() const
Return the number of proton / atomic number.
Double_t GetLifeTime(Int_t z=-1, Int_t a=-1) const
virtual void SetFillColor(Color_t fcolor)
virtual void SetFillStyle(Style_t fstyle)
virtual void SetLineWidth(Width_t lwidth)
virtual void SetLineColor(Color_t lcolor)
virtual void SetTextAlign(Short_t align=11)
virtual void SetTextSize(Float_t tsize=1)
virtual void SetToolTipText(const char *text, Long_t delayms=1000)
void ExecuteEvent(Int_t event, Int_t px, Int_t py) override
void Paint(Option_t *option="") override
void Copy(TObject &box) const override
void Paint(Option_t *option="") override
virtual void SetText(Double_t x, Double_t y, const char *text)
ClassImp(TPyArg)