10 #include "KVDBSystemDialog.h"
13 #ifndef ROOT_TGDockableFrame
19 #ifndef ROOT_TGMdiDecorFrame
25 #ifndef ROOT_TGMdiFrame
28 #ifndef ROOT_TGMdiMainFrame
31 #ifndef ROOT_TGMdiMenu
34 #ifndef ROOT_TGListBox
37 #ifndef ROOT_TGNumberEntry
40 #ifndef ROOT_TGScrollBar
43 #ifndef ROOT_TRootBrowser
49 #ifndef ROOT_TGFileDialog
52 #ifndef ROOT_TGShutter
55 #ifndef ROOT_TGButtonGroup
61 #ifndef ROOT_TGFSContainer
64 #ifndef ROOT_TGFSComboBox
76 #ifndef ROOT_TGListView
79 #ifndef ROOT_TGSplitter
82 #ifndef ROOT_TGStatusBar
85 #ifndef ROOT_TGListTree
88 #ifndef ROOT_TGToolTip
91 #ifndef ROOT_TGToolBar
96 #include "KVDataSet.h"
97 #include "KVDBSystem.h"
99 #include "KVNucleus.h"
100 #include "KVMaterial.h"
101 #include "KVTarget.h"
102 #include "KVInputDialog.h"
103 #include "KVConfig.h"
105 #include "KVIonRangeTable.h"
129 fCurrentSystemsFile = gDataSet->
GetDataSetEnv(
"INDRADB.Systems");
130 CreateMainWindow(
p,
main,
w,
h);
132 if (runs.IsEmpty()) fSetRuns->SetEnabled(
kFALSE);
134 Connect(
"UpdateRunlist()",
"KVINDRARunSheetGUI",
const_cast<TGWindow*
>(
main),
"UpdateListOfRuns()");
136 gClient->WaitFor(fMainFrame1475);
147 if (fMainFrame1475) {
148 delete fMainFrame1475;
183 if (!fSystem)
return;
184 TString answer(fSystem->GetName());
186 new KVInputDialog(fMainFrame1475,
"Do you really want to delete this system ?", &answer, &ok,
187 "Click OK to delete, Cancel to leave");
190 fSystem->RemoveAllRuns();
219 if (IsProjectileDefined() && IsTargetDefined()) {
220 sys_name.
Form(
"%ld%s + %s %.3g MeV/A",
221 fNumberEntry1499->GetIntNumber(),
222 fTextEntry1490->GetText(),
224 fNumberEntry1509->GetNumber()
231 "Enter name for new system",
236 cout <<
"Creating system : " << sys_name.
Data() << endl;
238 if (IsProjectileDefined()) {
239 Int_t Z = (
Int_t)fNumberEntry1493->GetIntNumber();
240 fSystem->SetZbeam(Z);
241 Int_t A = (
Int_t)fNumberEntry1499->GetIntNumber();
242 fSystem->SetAbeam(A);
243 Double_t E = fNumberEntry1509->GetNumber();
244 fSystem->SetEbeam(
E);
246 if (IsTargetDefined()) {
247 fSystem->SetTarget(fTarget);
248 sys_name.
Form(
"%d", (
Int_t)fTarget->GetLayerByIndex(1)->GetZ());
251 "Enter Z of target nucleus",
255 fSystem->SetZtarget(sys_name.
Atoi());
256 sys_name.
Form(
"%d", (
Int_t)fTarget->GetLayerByIndex(1)->GetMass());
259 "Enter A of target nucleus",
263 fSystem->SetAtarget(sys_name.
Atoi());
270 fComboBox1476->Select(fComboBox1476->GetNumberOfEntries() - 2);
272 fCreateSystem->SetEnabled(
kFALSE);
287 gExpDB->
Save(
"Systems");
290 fCurrentSystemsFile = gDataSet->
GetDataSetEnv(
"INDRADB.Systems");
315 KVString old_vers = fUndo->GetPreviousVersion(fCurrentSystemsFile.Data());
316 if (old_vers ==
"")
return;
324 if (fCurrentSystemsFile == gDataSet->
GetDataSetEnv(
"INDRADB.Systems")) {
329 fCurrentSystemsFile = old_vers;
351 #ifdef __WITHOUT_TGCOMBOBOX_REMOVEALL
352 RemoveAll(fComboBox1476);
354 fComboBox1476->RemoveAll();
356 fComboBox1476->Select(-1);
358 Int_t index_selected = 0;
361 TIter itsys(syslist);
364 while ((o = itsys())) {
369 fComboBox1476->AddEntry(
"NEW SYSTEM",
index++);
370 fComboBox1476->Select(index_selected);
381 if (index < fComboBox1476->GetNumberOfEntries() - 1) {
383 fCreateSystem->SetEnabled(
kFALSE);
384 fSetRuns->SetEnabled(!fRuns.IsEmpty());
387 fCreateSystem->SetEnabled(
kTRUE);
388 fSetRuns->SetEnabled(
kFALSE);
392 UpdateSystemProperties();
403 UpdateProjectileProperties();
404 UpdateTargetProperties();
415 fTextEntry1490->SetEnabled(
on);
416 fNumberEntry1493->SetState(
on);
417 fNumberEntry1499->SetState(
on);
418 fNumberEntry1509->SetState(
on);
434 EnableProjectileProperties(
kFALSE);
437 KVNucleus proj(fSystem->GetZproj(), fSystem->GetAproj());
439 if (proj.
GetZ() == 0) {
441 EnableProjectileProperties(
kFALSE);
445 EnableProjectileProperties(
kTRUE);
448 fTextEntry1490->SetText(proj.
GetSymbol(
"EL"));
450 fNumberEntry1493->SetNumber(proj.
GetZ());
452 fNumberEntry1499->SetNumber(proj.
GetA());
454 fNumberEntry1509->SetNumber(fSystem->GetEproj());
470 #ifdef __WITHOUT_TGCOMBOBOX_REMOVEALL
471 RemoveAll(fComboBox1515);
473 fComboBox1515->RemoveAll();
475 fComboBox1515->Select(-1);
476 if (fSystem) fTarget = fSystem->GetTarget();
478 fNumberEntry1532->SetNumber(0);
479 UpdateTargetLayerProperties(-1);
483 fNumberEntry1532->SetNumber(fTarget->GetAngleToBeam());
485 TIter next(fTarget->GetLayers());
487 while ((obj = next())) {
490 fComboBox1515->Select(0);
505 fNumberEntry1526->SetNumber(0);
506 fNumberEntry1537->SetNumber(0);
508 fTextButton1554->SetEnabled(
kFALSE);
511 fLayer = (
KVMaterial*)fTarget->GetLayers()->At(ind);
515 fNumberEntry1537->SetNumber(fLayer->GetMass());
517 fLabel1530->SetText(
"mg/cm2");
519 fTextButton1554->SetEnabled(
kTRUE);
541 fNumberEntry1493->SetNumber(
r.GetZ());
543 fNumberEntry1499->SetNumber(
r.GetA());
545 fSystem->SetZbeam(
r.GetZ());
546 fSystem->SetAbeam(
r.GetA());
562 Int_t Z = (
Int_t)fNumberEntry1493->GetIntNumber();
564 fTextEntry1490->SetText(
r.GetSymbol(
"EL"));
566 fNumberEntry1499->SetNumber(A);
568 fSystem->SetZbeam(
r.GetZ());
569 fSystem->SetAbeam(
r.GetA());
585 Int_t A = (
Int_t)fNumberEntry1499->GetIntNumber();
586 if (fSystem) fSystem->SetAbeam(A);
601 Double_t E = fNumberEntry1509->GetNumber();
602 if (fSystem) fSystem->SetEbeam(
E);
617 Double_t t = fNumberEntry1526->GetNumber();
631 Double_t A = fNumberEntry1537->GetNumber();
645 Double_t A = fNumberEntry1532->GetNumber();
646 fTarget->SetAngleToBeam(A);
667 TNamed* mat = (
TNamed*)fMaterialsList->At(fComboBox1542->GetSelected());
675 fSystem->SetTarget(fTarget);
676 cout <<
"Created target for system : " << fSystem->
GetName() << endl;
682 fTarget->AddLayer(mat->
GetTitle(), 0.1);
684 Int_t nlay = fComboBox1515->GetNumberOfEntries();
685 fComboBox1515->AddEntry(mat->
GetName(), nlay);
686 fComboBox1515->Select(nlay + 1);
687 cout <<
"Added layer " << mat->
GetTitle() <<
" to target" << endl;
702 cout <<
"Removing layer : " << fLayer->GetName() <<
" from target !" << endl;
703 if (fTarget->NumberOfLayers() == 1) {
707 if (fSystem) fSystem->SetTarget(0);
712 TIter next(fTarget->GetLayers());
722 if (fSystem) fSystem->SetTarget(new_target);
725 UpdateTargetProperties();
753 while (!fRuns.End()) fSystem->AddRun(fRuns.Next());
760 #ifdef __WITHOUT_TGCOMBOBOX_REMOVEALL
769 Int_t n =
box->GetListBox()->GetNumberOfEntries();
770 if (n)
box->RemoveEntries(0, n - 1);
771 if (
box->GetSelectedEntry()) {
776 box->GetTextEntry()->SetTitle(
"");
790 if (n)
box->RemoveEntries(0, n - 1);
791 if (
box->GetSelectedEntry()) {
810 fMainFrame1475->SetLayoutBroken(
kTRUE);
811 fMainFrame1475->Connect(
"CloseWindow()",
"KVDBSystemDialog",
this,
813 fMainFrame1475->DontCallClose();
817 ULong_t red, cyan, green, yellow, magenta;
818 gClient->GetColorByName(
"#ff00ff", magenta);
819 gClient->GetColorByName(
"#ff0000", red);
820 gClient->GetColorByName(
"#00ff00", green);
821 gClient->GetColorByName(
"#00ffff", cyan);
822 gClient->GetColorByName(
"#ffff00", yellow);
826 fComboBox1476->Select(-1);
828 fComboBox1476->MoveResize(88, 8, 296, 22);
829 fComboBox1476->Connect(
"Selected(Int_t)",
830 "KVDBSystemDialog",
this,
831 "SelectSystem(Int_t)");
842 fCheckButton1376 =
new TGCheckButton(fGroupFrame1488,
"Projectile");
843 fCheckButton1376->SetToolTipText(
"Define projectile for system");
845 fCheckButton1376->MoveResize(18, 24, 72, 19);
846 fCheckButton1376->Connect(
"Toggled(Bool_t)",
847 "KVDBSystemDialog",
this,
848 "EnableProjectileProperties(Bool_t)");
851 ufont =
gClient->GetFont(
"-adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-iso8859-1");
864 fTextEntry1490->SetMaxLength(3);
866 fTextEntry1490->SetText(
"p");
867 fTextEntry1490->Resize(24, fTextEntry1490->GetDefaultHeight());
868 fTextEntry1490->SetToolTipText(
"Chemical symbol for projectile nuclei");
869 fTextEntry1490->Connect(
"ReturnPressed()",
870 "KVDBSystemDialog",
this,
"ProjectileSymbolChanged()");
873 fTextEntry1490->MoveResize(100, 24, 24, 22);
876 fNumberEntry1493->MoveResize(158, 24, 43, 22);
877 fNumberEntry1493->Connect(
"ValueSet(Long_t)",
878 "KVDBSystemDialog",
this,
"ProjectileZChanged(Long_t)");
890 fNumberEntry1499->MoveResize(232, 24, 43, 22);
891 fNumberEntry1499->Connect(
"ValueSet(Long_t)",
892 "KVDBSystemDialog",
this,
"ProjectileAChanged(Long_t)");
902 fNumberEntry1504->
MoveResize(312, 24, 43, 22);
911 fNumberEntry1509->MoveResize(152, 56, 80, 22);
912 fNumberEntry1509->Connect(
"ValueSet(Long_t)",
913 "KVDBSystemDialog",
this,
"ProjectileEChanged(Long_t)");
915 TGLabel* fLabel1513 =
new TGLabel(fGroupFrame1488,
"MeV/nucleon");
927 fComboBox1515->Resize(104, 22);
928 fComboBox1515->Select(-1);
929 fComboBox1515->Connect(
"Selected(Int_t)",
930 "KVDBSystemDialog",
this,
"UpdateTargetLayerProperties(Int_t)");
933 fComboBox1515->MoveResize(80, 48, 104, 22);
936 fNumberEntry1526->MoveResize(8, 80, 59, 22);
937 fNumberEntry1526->Connect(
"ValueSet(Long_t)",
938 "KVDBSystemDialog",
this,
"TargetLayerThicknessChanged(Long_t)");
940 fLabel1530 =
new TGLabel(fGroupFrame1514,
"mg/cm2");
941 fLabel1530->SetTextJustify(36);
943 fLabel1530->MoveResize(72, 80, 46, 18);
950 fNumberEntry1532->MoveResize(152, 16, 75, 22);
951 fNumberEntry1532->Connect(
"ValueSet(Long_t)",
952 "KVDBSystemDialog",
this,
"TargetAngleChanged(Long_t)");
960 fNumberEntry1537->MoveResize(160, 80, 64, 22);
961 fNumberEntry1537->Connect(
"ValueSet(Long_t)",
962 "KVDBSystemDialog",
this,
"TargetLayerAChanged(Long_t)");
971 fComboBox1542->Resize(80, 22);
975 TIter it_mat(fMaterialsList.get());
978 while ((obj = it_mat())) {
979 fComboBox1542->AddEntry(obj->
GetName(), ind++);
981 fComboBox1542->Select(0);
983 fComboBox1542->MoveResize(16, 24, 80, 22);
984 fTextButton1553 =
new TGTextButton(fGroupFrame1541,
"Add");
985 fTextButton1553->SetTextJustify(36);
986 fTextButton1553->Resize(56, 24);
988 fTextButton1553->MoveResize(24, 56, 56, 24);
989 fTextButton1553->Connect(
"Clicked()",
990 "KVDBSystemDialog",
this,
"AddNewTargetLayer()");
993 fGroupFrame1541->
Resize(112, 104);
995 fGroupFrame1541->
MoveResize(232, 40, 112, 104);
996 fTextButton1554 =
new TGTextButton(fGroupFrame1514,
"Remove");
997 fTextButton1554->SetTextJustify(36);
998 fTextButton1554->Resize(56, 24);
1000 fTextButton1554->MoveResize(80, 112, 56, 24);
1001 fTextButton1554->SetEnabled(
kFALSE);
1002 fTextButton1554->Connect(
"Clicked()",
1003 "KVDBSystemDialog",
this,
"RemoveTargetLayer()");
1011 fGroupFrame1514->
Resize(360, 168);
1013 fGroupFrame1514->
MoveResize(8, 80, 360, 168);
1019 fCreateSystem =
new TGTextButton(fGroupFrame1488,
"Create");
1020 fCreateSystem->SetTextJustify(36);
1021 fCreateSystem->Resize(48, 24);
1022 fCreateSystem->ChangeBackground(green);
1023 fCreateSystem->SetToolTipText(
"Create new system with current properties");
1025 fCreateSystem->MoveResize(36, 280, 60, 24);
1026 fCreateSystem->Connect(
"Clicked()",
1027 "KVDBSystemDialog",
this,
"CreateNewSystem()");
1028 fCreateSystem->SetEnabled(
kFALSE);
1032 fTextButton1573->
Resize(48, 24);
1035 fTextButton1573->
MoveResize(100, 280, 60, 24);
1036 fTextButton1573->
SetToolTipText(
"Delete the currently selected system");
1037 fTextButton1573->
Connect(
"Clicked()",
1038 "KVDBSystemDialog",
this,
"DeleteSystem()");
1040 fSetRuns =
new TGTextButton(fGroupFrame1488,
"Set Runs");
1041 fSetRuns->SetTextJustify(36);
1042 fSetRuns->Resize(48, 24);
1043 fSetRuns->ChangeBackground(yellow);
1045 fSetRuns->MoveResize(164, 280, 60, 24);
1046 fSetRuns->SetToolTipText(
"Set runs for selected system");
1047 fSetRuns->Connect(
"Clicked()",
1048 "KVDBSystemDialog",
this,
"SetRuns()");
1050 fSaveButton =
new TGTextButton(fGroupFrame1488,
"Save");
1051 fSaveButton->SetTextJustify(36);
1052 fSaveButton->Resize(48, 24);
1055 fSaveButton->MoveResize(228, 280, 60, 24);
1056 fSaveButton->SetToolTipText(
"Save changes to systems");
1057 fSaveButton->Connect(
"Clicked()",
1058 "KVDBSystemDialog",
this,
"SaveSystems()");
1062 fcloseButton->
Resize(48, 24);
1067 fcloseButton->
Connect(
"Clicked()",
1068 "KVDBSystemDialog",
this,
"DoClose()");
1071 fGroupFrame1488->
Resize(376, 320);
1073 fGroupFrame1488->
MoveResize(8, 32, 376, 320);
1075 fMainFrame1475->MapSubwindows();
1076 fMainFrame1475->Resize(fMainFrame1475->GetDefaultSize());
1077 fMainFrame1475->CenterOnParent();
1078 fMainFrame1475->SetWindowName(
"Set system properties for runs");
1079 fMainFrame1475->MapWindow();
1080 fMainFrame1475->Resize(394, 358);
const Mask_t kGCBackground
const Mask_t kGCForeground
const Mask_t kGCFillStyle
const Mask_t kGCGraphicsExposures
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
R__EXTERN TSystem * gSystem
virtual const Char_t * GetType() const
static void BackupFileWithDate(const Char_t *path)
static Bool_t SearchKVFile(const Char_t *name, TString &fullpath, const Char_t *kvsubdir="")
Dialog box for setting system parameters associated to runs.
void DeleteSystem()
Delete the currently selected system.
void TargetAngleChanged(Long_t)
Called when target angle is changed.
void ProjectileZChanged(Long_t)
void RemoveAll(TGComboBox *)
void ProjectileEChanged(Long_t)
void UpdateSystemProperties()
Update displayed system properties, e.g. when a new system is selected in fComboBox1476.
void UpdateTargetLayerProperties(Int_t)
void UpdateProjectileProperties()
void ProjectileSymbolChanged()
void CreateMainWindow(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h)
Creates main window and displays it.
void TargetLayerAChanged(Long_t)
Called when target layer A is changed.
virtual ~KVDBSystemDialog()
Destructor.
void TargetLayerThicknessChanged(Long_t)
void UpdateTargetProperties()
void SelectSystem(Int_t)
Called when a new system is selected in fComboBox1476.
void ProjectileAChanged(Long_t)
void EnableProjectileProperties(Bool_t)
Called when "Projectile" check box is checked (on=kTRUE) or unchecked (on=kFALSE)
Database class used to store information on different colliding systems studied during an experiment....
const Char_t * GetDataSetDir() const
const Char_t * GetDataSetEnv(const Char_t *type, const Char_t *defval="") const
KVExpDB * GetDataBase(Option_t *opt="") const
Handles a set of different versions of files with the same base name and a timestamp.
void AddSystem(KVDBSystem *r)
void RemoveSystem(KVDBSystem *s)
virtual KVSeqCollection * GetSystems() const
virtual void Save(const Char_t *)
Abstract base class for calculation of range & energy loss of charged particles in matter.
virtual Double_t GetAtomicMass(const Char_t *)
Returns atomic mass of a material in the range tables.
virtual TObjArray * GetListOfMaterials()=0
virtual Double_t GetZ(const Char_t *)
Returns atomic number of a material in the range tables.
Description of physical materials used to construct detectors & targets; interface to range tables.
static KVIonRangeTable * GetRangeTable()
Double_t GetAreaDensity() const
Description of properties and kinematics of atomic nuclei.
const Char_t * GetSymbol(Option_t *opt="") const
Int_t GetZ() const
Return the number of proton / atomic number.
Strings used to represent a set of ranges of values.
KaliVeda extensions to ROOT collection classes.
virtual TObject * At(Int_t idx) const
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Calculation/correction of energy losses of particles through an experimental target.
void SetAngleToBeam(Double_t a)
void AddLayer(const Char_t *material, Double_t thick)
void ls(Option_t *option="") const override
virtual void SetLayoutManager(TGLayoutManager *l)
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
void SetLayoutBroken(Bool_t on=kTRUE) override
FontStruct_t GetFontStruct() const
FontH_t GetFontHandle() const
void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0) override
virtual void Resize(TGDimension size)
virtual void ChangeBackground(Pixel_t back)
void SetTextJustify(Int_t tmode)
virtual void Disable(Bool_t on=kTRUE)
virtual void SetState(Bool_t enable=kTRUE)
virtual void SetTextJustify(Int_t tmode)
const char * GetName() const override
const char * GetTitle() const override
virtual const char * GetName() const
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
const char * Data() const
void Form(const char *fmt,...)
virtual int CopyFile(const char *from, const char *to, Bool_t overwrite=kFALSE)
static void SingleShot(Int_t milliSec, const char *receiver_class, void *receiver, const char *method)
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
int main(int argc, char **argv)
RVec< PromoteTypes< T0, T1 > > pow(const T0 &x, const RVec< T1 > &v)
Bool_t fGraphicsExposures