KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVNucleusBox.cpp
Go to the documentation of this file.
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 
19 KVNucleusBox::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 
69 KVNucleusBox::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;
75  fDrawSame = kFALSE;
76 
77  fZ = fNucleus->GetZ();
78  fN = fNucleus->GetN();
79  fA = fN + fZ;
82  fSymbol.SetTextSize(.02);
83 
84  if (fNucleus->IsStable()) {
86  SetLineWidth(2);
88  }
89  else if (fNucleus->GetLifeTime() > 1.e-06) {
91  SetFillColor(kGray + 1);
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 
157 void KVNucleusBox::Copy(TObject& obj) const
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 
193 {
194  fShowSymbol = i;
195 }
196 
197 
198 
200 
202 {
203  TBox::Paint(option);
204  if (fShowSymbol) fSymbol.Paint(option);
205 }
206 
207 
208 
209 
kButton3Down
kButton1Double
int Int_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
size_t size(const MatrixT &matrix)
const Bool_t kFALSE
bool Bool_t
double Double_t
const Bool_t kTRUE
const char Option_t
kGray
kBlack
#define N
char * Form(const char *fmt,...)
TCanvas with mouse-controlled dynamic zoom and pan & scan.
Definition: KVCanvas.h:53
void SetCurrentNuc(KVNucleus *nuc)
KVCanvas * GetCanvas()
void ShowNucleusInfo(KVNucleus *nuc)
A TBox representing a nucleus in a KVNuclearChart.
Definition: KVNucleusBox.h:18
TLatex fSymbol
Definition: KVNucleusBox.h:26
virtual ~KVNucleusBox()
Destructor.
void SetShowSymbol(Bool_t value=kTRUE)
void SetDrawMode(Bool_t DrawSame)
KVNuclearChart * fNuclearChart
Definition: KVNucleusBox.h:25
void EnableToolTip()
Bool_t fOwnNucleus
Definition: KVNucleusBox.h:22
Bool_t fShowSymbol
Definition: KVNucleusBox.h:23
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
Definition: KVNucleusBox.h:24
void Paint(Option_t *option="")
Bool_t fDrawSame
Definition: KVNucleusBox.h:21
Description of properties and kinematics of atomic nuclei.
Definition: KVNucleus.h:125
const Char_t * GetSymbol(Option_t *opt="") const
Definition: KVNucleus.cpp:81
Int_t GetN() const
Return the number of neutron.
Definition: KVNucleus.cpp:781
void SetZandA(Int_t z, Int_t a)
Set atomic number and mass number.
Definition: KVNucleus.cpp:721
const Char_t * GetLatexSymbol(Option_t *opt="") const
Definition: KVNucleus.cpp:112
Bool_t IsStable(Double_t min_lifetime=1.0e+15) const
Definition: KVNucleus.cpp:1989
Int_t GetZ() const
Return the number of proton / atomic number.
Definition: KVNucleus.cpp:770
Double_t GetLifeTime(Int_t z=-1, Int_t a=-1) const
Definition: KVNucleus.cpp:1040
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)
virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py)
void Copy(TObject &box) const
virtual void Paint(Option_t *option="")
virtual void Paint(Option_t *option="")
virtual void SetText(Double_t x, Double_t y, const char *text)
h1 SetFillColor(kGreen)
gr SetLineWidth(2)
const long double cc
volumes
Definition: KVUnits.h:83
lv SetLineColor(kBlue)