KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVDBSystemDialog.cpp
1/*
2$Id: KVDBSystemDialog.cpp,v 1.8 2009/01/16 14:55:20 franklan Exp $
3$Revision: 1.8 $
4$Date: 2009/01/16 14:55:20 $
5*/
6
7//Created by KVClassFactory on Wed Apr 4 12:10:28 2007
8//Author: franklan
9
10#include "KVDBSystemDialog.h"
11#include "TSystem.h"
12#include "TTimer.h"
13#ifndef ROOT_TGDockableFrame
14#include "TGDockableFrame.h"
15#endif
16#ifndef ROOT_TGMenu
17#include "TGMenu.h"
18#endif
19#ifndef ROOT_TGMdiDecorFrame
20#include "TGMdiDecorFrame.h"
21#endif
22#ifndef ROOT_TG3DLine
23#include "TG3DLine.h"
24#endif
25#ifndef ROOT_TGMdiFrame
26#include "TGMdiFrame.h"
27#endif
28#ifndef ROOT_TGMdiMainFrame
29#include "TGMdiMainFrame.h"
30#endif
31#ifndef ROOT_TGMdiMenu
32#include "TGMdiMenu.h"
33#endif
34#ifndef ROOT_TGListBox
35#include "TGListBox.h"
36#endif
37#ifndef ROOT_TGNumberEntry
38#include "TGNumberEntry.h"
39#endif
40#ifndef ROOT_TGScrollBar
41#include "TGScrollBar.h"
42#endif
43#ifndef ROOT_TRootBrowser
44#include "TRootBrowser.h"
45#endif
46#ifndef ROOT_TGFrame
47#include "TGFrame.h"
48#endif
49#ifndef ROOT_TGFileDialog
50#include "TGFileDialog.h"
51#endif
52#ifndef ROOT_TGShutter
53#include "TGShutter.h"
54#endif
55#ifndef ROOT_TGButtonGroup
56#include "TGButtonGroup.h"
57#endif
58#ifndef ROOT_TGCanvas
59#include "TGCanvas.h"
60#endif
61#ifndef ROOT_TGFSContainer
62#include "TGFSContainer.h"
63#endif
64#ifndef ROOT_TGFSComboBox
65#include "TGFSComboBox.h"
66#endif
67#ifndef ROOT_TGLabel
68#include "TGLabel.h"
69#endif
70#ifndef ROOT_TGMsgBox
71#include "TGMsgBox.h"
72#endif
73#ifndef ROOT_TGTab
74#include "TGTab.h"
75#endif
76#ifndef ROOT_TGListView
77#include "TGListView.h"
78#endif
79#ifndef ROOT_TGSplitter
80#include "TGSplitter.h"
81#endif
82#ifndef ROOT_TGStatusBar
83#include "TGStatusBar.h"
84#endif
85#ifndef ROOT_TGListTree
86#include "TGListTree.h"
87#endif
88#ifndef ROOT_TGToolTip
89#include "TGToolTip.h"
90#endif
91#ifndef ROOT_TGToolBar
92#include "TGToolBar.h"
93#endif
94
95#include "Riostream.h"
96#include "KVDataSet.h"
97#include "KVDBSystem.h"
98#include "KVExpDB.h"
99#include "KVNucleus.h"
100#include "KVMaterial.h"
101#include "KVTarget.h"
102#include "KVInputDialog.h"
103#include "KVConfig.h"
104#include "KVUnits.h"
105#include "KVIonRangeTable.h"
106
107using namespace std;
108
110
111
112
115
117 KVDBSystem* init_sys, const KVNumberList& runs,
118 UInt_t w, UInt_t h)
119{
120 //Default constructor
121 //init_sys = initial system corresponding to chosen runs
122
123 fTarget = 0;
124 fLayer = 0;
125 fSystem = init_sys;
126 fRuns = runs;
127 //'undo' manager
128 fUndo = new KVDatedFileManager(gDataSet->GetDataSetEnv("INDRADB.Systems"), gDataSet->GetDataSetDir());
129 fCurrentSystemsFile = gDataSet->GetDataSetEnv("INDRADB.Systems");
130 CreateMainWindow(p, main, w, h);
131 SetNeedSave(0);
132 if (runs.IsEmpty()) fSetRuns->SetEnabled(kFALSE);
133 FillSystemList();
134 Connect("UpdateRunlist()", "KVINDRARunSheetGUI", const_cast<TGWindow*>(main), "UpdateListOfRuns()");
135 //nothing happens until window closes
136 gClient->WaitFor(fMainFrame1475);
137}
138
139
140
143
145{
146 //Destructor
147 if (fMainFrame1475) {
148 delete fMainFrame1475;
149 fMainFrame1475 = 0;
150 }
151 delete fUndo;
152}
153
154
155
157
159{
160 TTimer::SingleShot(150, "KVDBSystemDialog", this,
161 "CloseWindow()");
162}
163
164
165
167
169{
170 delete this;
171}
172
173
174
175
176
179
181{
182 //Delete the currently selected system
183 if (!fSystem) return;
184 TString answer(fSystem->GetName());
185 Bool_t ok = kFALSE;
186 new KVInputDialog(fMainFrame1475, "Do you really want to delete this system ?", &answer, &ok,
187 "Click OK to delete, Cancel to leave");
188 if (!ok) return;
189 //unassociate all runs from system
191 //remove system from database
192 gExpDB->RemoveSystem(fSystem);
193 //delete system
194 delete fSystem;
195 fSystem = 0;
196 //update list of systems
198 SaveSystems();
200}
201
202
203
204
209
211{
212 //Use current values of all fields in dialog box to create a new KVDBSystem
213 //We open a dialog to ask for the title of the new system, and for the target
214 //Z and A if a target is defined.
215
216 TString sys_name;
217
218 //If a projectile and target are defined, we suggest a standard name
220 sys_name.Form("%ld%s + %s %.3g MeV/A",
221 fNumberEntry1499->GetIntNumber(), // proj A
222 fTextEntry1490->GetText(), // proj symbol
223 fTarget->GetName(), // target symbol
224 fNumberEntry1509->GetNumber() //projectile energy
225 );
226 }
227
228 Bool_t ok_pressed;
229 new KVInputDialog(
231 "Enter name for new system",
232 &sys_name,
233 &ok_pressed
234 );
235 if (ok_pressed) {
236 cout << "Creating system : " << sys_name.Data() << endl;
237 fSystem = new KVDBSystem(sys_name.Data());
238 if (IsProjectileDefined()) {
240 fSystem->SetZbeam(Z);
242 fSystem->SetAbeam(A);
245 }
246 if (IsTargetDefined()) {
248 sys_name.Form("%d", (Int_t)fTarget->GetLayerByIndex(1)->GetZ());
249 new KVInputDialog(
251 "Enter Z of target nucleus",
252 &sys_name,
253 &ok_pressed
254 );
255 fSystem->SetZtarget(sys_name.Atoi());
256 sys_name.Form("%d", (Int_t)fTarget->GetLayerByIndex(1)->GetMass());
257 new KVInputDialog(
259 "Enter A of target nucleus",
260 &sys_name,
261 &ok_pressed
262 );
263 fSystem->SetAtarget(sys_name.Atoi());
264 }
265 //add system to database
266 gExpDB->AddSystem(fSystem);
267 //update list of systems
269 //select the new system
271 SaveSystems();
273 }
274}
275
276
277
278
282
284{
285 //Write new Systems.dat file.
286 //The list of file versions for the 'Undo' is updated
287 gExpDB->Save("Systems");
288 SetNeedSave(0);
289 fUndo->Update();
290 fCurrentSystemsFile = gDataSet->GetDataSetEnv("INDRADB.Systems");
291}
292
293
294
295
303
305{
306 //Revert unsaved changes to system (if fNeedSave=kTRUE), or
307 //revert to previously saved version of Systems.dat file
308
309 //to remove unsaved changes, we simply rebuild the database from
310 //the existing files
311 //if there are no unsaved changes, we replace the current Systems.dat
312 //with the previous version
313 if (!NeedSave()) {
314 //is their a previous version of the Systems.dat ?
316 if (old_vers == "") return; // no older version : cannot undo
317 //get full path to previous version
318 KVString fullpath_backup;
319 KVBase::SearchKVFile(old_vers.Data(), fullpath_backup, gDataSet->GetDataSetDir());
320 //get full path to Systems.dat file
321 KVString fullpath_systemsdat;
322 KVBase::SearchKVFile(gDataSet->GetDataSetEnv("INDRADB.Systems"), fullpath_systemsdat, gDataSet->GetDataSetDir());
323 //save current Systems.dat with timestamp if it was not already an old version
324 if (fCurrentSystemsFile == gDataSet->GetDataSetEnv("INDRADB.Systems")) {
325 KVBase::BackupFileWithDate(fullpath_systemsdat.Data());
326 }
327 //now make a copy of the previous version, with the name Systems.dat
328 gSystem->CopyFile(fullpath_backup.Data(), fullpath_systemsdat.Data(), kTRUE);
329 fCurrentSystemsFile = old_vers;
330 }
331 //now rebuild the database
332 gDataSet->GetDataBase("update")->cd();
333 SetNeedSave(0);
334 //update list of systems
337}
338
339
340
341
345
347{
348 //Fill combo box with list of all systems for the current dataset
349
350 //clear list of systems
351#ifdef __WITHOUT_TGCOMBOBOX_REMOVEALL
353#else
355#endif
357
358 Int_t index_selected = 0;
359 KVSeqCollection* syslist = gExpDB->GetSystems();
360 syslist->ls();
361 TIter itsys(syslist);
362 TObject* o;
363 Int_t index = 0;
364 while ((o = itsys())) {
365 if ((KVDBSystem*)o == fSystem) index_selected = index;
367 }
368 //Add entry "New system" at end of list
369 fComboBox1476->AddEntry("NEW SYSTEM", index++);
370 fComboBox1476->Select(index_selected);
371}
372
373
374
377
379{
380 //Called when a new system is selected in fComboBox1476
381 if (index < fComboBox1476->GetNumberOfEntries() - 1) {
382 fSystem = (KVDBSystem*)gExpDB->GetSystems()->At(index);
385 }
386 else {
389 fSystem = 0;
390 fTarget = 0;
391 }
393}
394
395
396
399
401{
402 //Update displayed system properties, e.g. when a new system is selected in fComboBox1476
405}
406
407
408
411
413{
414 //Called when "Projectile" check box is checked (on=kTRUE) or unchecked (on=kFALSE)
419}
420
421
422
426
428{
429 //Update displayed projectile properties
430 //Called by UpdateSystemProperties().
431
432 if (!fSystem) {
435 return;
436 }
438 //if no projectile is defined, the entire "Projectile" part is "greyed out"
439 if (proj.GetZ() == 0) {
442 }
443 else {
446 }
447 //update projectile symbol
448 fTextEntry1490->SetText(proj.GetSymbol("EL"));
449 //update projectile Z
451 //update projectile A
453 //update projectile E/A
455}
456
457
458
463
465{
466 //Update displayed target properties
467 //Called by UpdateSystemProperties().
468
469 //clear list of target layers
470#ifdef __WITHOUT_TGCOMBOBOX_REMOVEALL
472#else
474#endif
477 if (!fTarget) {
480 return;
481 }
482 //update target angle
484 Int_t index = 0;
485 TIter next(fTarget->GetLayers());
486 TObject* obj;
487 while ((obj = next())) {
489 }
491}
492
493
494
498
500{
501 //Update displayed target layer properties
502 //Called when a new layer is selected in fComboBox1515
503
504 if (ind == -1) {
507 fLayer = 0;
509 return;
510 }
511 fLayer = (KVMaterial*)fTarget->GetLayers()->At(ind);
512 //update thickness - actually area density in mg/cm2
514 //update atomic mass
516 //update thickness units
517 fLabel1530->SetText("mg/cm2");
518 //enable button to remove layer
520}
521
522
523
527
529{
530 //Called when projectile symbol is changed and the user presses "Return"
531 //Changes Z and A of projectile for system
532
534 if (!r.GetZ()) {
535 //give warning that symbol is not valid
536 new TGMsgBox(gClient->GetRoot(), fMainFrame1475, "KVDBSystemDialog",
537 "Give a valid atomic symbol for the projectile", kMBIconExclamation);
538 return;
539 }
540 //update projectile Z
542 //update projectile A
544 if (fSystem) {
545 fSystem->SetZbeam(r.GetZ());
546 fSystem->SetAbeam(r.GetA());
547 }
548 SetNeedSave(1);
549}
550
551
552
556
558{
559 //Called when projectile Z is changed
560 //Changes Z and symbol of projectile for system
561
563 KVNucleus r(Z);
564 fTextEntry1490->SetText(r.GetSymbol("EL"));
565 Int_t A = r.GetA();
567 if (fSystem) {
568 fSystem->SetZbeam(r.GetZ());
569 fSystem->SetAbeam(r.GetA());
570 }
571 SetNeedSave(1);
572}
573
574
575
579
581{
582 //Called when projectile A is changed
583 //Changes A of projectile for system
584
586 if (fSystem) fSystem->SetAbeam(A);
587 SetNeedSave(1);
588}
589
590
591
595
597{
598 //Called when projectile E is changed
599 //Changes E of projectile for system
600
602 if (fSystem) fSystem->SetEbeam(E);
603 SetNeedSave(1);
604}
605
606
607
611
613{
614 // Called when target layer "thickness" is changed
615 // Note that this is in fact the area density in mg/cm**2
616
619 SetNeedSave(1);
620}
621
622
623
626
628{
629 //Called when target layer A is changed
630
632 fLayer->SetMass(A);
633 SetNeedSave(1);
634}
635
636
637
640
642{
643 //Called when target angle is changed
644
647 SetNeedSave(1);
648}
649
650
651
658
660{
661 //Called when "Add" button is clicked.
662 //Add a new target layer. Creates target if none exists.
663 //The currently selected material in the list will be used
664 //The new layer will be added after any existing layers in the target.
665
666 //get selected material
668 KVMaterial bidon;
669 KVIonRangeTable* RT = bidon.GetRangeTable();
670 //add to target of current system
671 //if no target is defined, we create a new one
672 if (!fTarget) {
673 fTarget = new KVTarget;
674 if (fSystem) {
676 cout << "Created target for system : " << fSystem->GetName() << endl;
677 fSystem->SetZtarget((UInt_t)RT->GetZ(mat->GetName()));
679 }
680 }
681 //add layer with default area density 0.1 mg/cm2
682 fTarget->AddLayer(mat->GetTitle(), 0.1);
683 //update list of layers in target
685 fComboBox1515->AddEntry(mat->GetName(), nlay);
686 fComboBox1515->Select(nlay + 1);
687 cout << "Added layer " << mat->GetTitle() << " to target" << endl;
688 SetNeedSave(1);
689}
690
691
692
696
698{
699 //Removes currently selected layer from target.
700 //In fact we create a new target which does not have the offending layer
701
702 cout << "Removing layer : " << fLayer->GetName() << " from target !" << endl;
703 if (fTarget->NumberOfLayers() == 1) {
704 //last layer in target - destroy target
705 delete fTarget;
706 fTarget = 0;
707 if (fSystem) fSystem->SetTarget(0);
708 fLayer = 0;
709 }
710 else {
711 KVTarget* new_target = new KVTarget;
712 TIter next(fTarget->GetLayers());
713 KVMaterial* mat;
714 while ((mat = (KVMaterial*)next())) {
715 if (mat != fLayer) {
716 new_target->AddLayer(mat->GetType(), mat->GetAreaDensity());
717 }
718 }
719 new_target->SetAngleToBeam(fTarget->GetAngleToBeam());
720 delete fTarget;
721 fTarget = 0;
722 if (fSystem) fSystem->SetTarget(new_target);
723 fLayer = 0;
724 }
726 SetNeedSave(1);
727}
728
729
730
740
742{
743 //Called when "SetRuns" button is clicked.
744 //The selected system is associated with the runlist passed to the constructor.
745 //The Systems.dat file is updated
746 //Any previous association run<->system is removed
747
748// KVNumberList tmp;
749// fSystem->GetRunList(tmp);
750// tmp.Add(fRuns);
751// fSystem->SetRuns(tmp);
752 fRuns.Begin();
753 while (!fRuns.End()) fSystem->AddRun(fRuns.Next());
754 SaveSystems();
756}
757
758
759
760#ifdef __WITHOUT_TGCOMBOBOX_REMOVEALL
761
764
766{
767 //replaces functionality of TGComboBox::RemoveAll for ROOT versions < 5.11/02
768
769 Int_t n = box->GetListBox()->GetNumberOfEntries();
770 if (n) box->RemoveEntries(0, n - 1);
771 if (box->GetSelectedEntry()) {
772 ((TGTextLBEntry*)box->GetSelectedEntry())->SetTitle("");
773 gClient->NeedRedraw(box->GetSelectedEntry());
774 }
775 else {
776 box->GetTextEntry()->SetTitle("");
777 gClient->NeedRedraw(box->GetTextEntry());
778 }
779}
780
782
783
785
786{
787 //replaces functionality of TGListBox::RemoveAll for ROOT versions < 5.11/02
788
789 Int_t n = box->GetNumberOfEntries();
790 if (n) box->RemoveEntries(0, n - 1);
791 if (box->GetSelectedEntry()) {
792 ((TGTextLBEntry*)box->GetSelectedEntry())->SetTitle("");
793 gClient->NeedRedraw(box->GetSelectedEntry());
794 }
795}
796
797#endif
798
799
802
804 UInt_t w, UInt_t h)
805{
806
807 //Creates main window and displays it
808
811 fMainFrame1475->Connect("CloseWindow()", "KVDBSystemDialog", this,
812 "DoClose()");
813 fMainFrame1475->DontCallClose(); // to avoid double deletions.
814 // use hierarchical cleaning
816
817 ULong_t red, cyan, green, yellow, magenta; // will reflect user color changes
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);
823
824 // combo box displaying list of systems for current dataset
828 fComboBox1476->MoveResize(88, 8, 296, 22);
829 fComboBox1476->Connect("Selected(Int_t)",
830 "KVDBSystemDialog", this,
831 "SelectSystem(Int_t)");
832
833 TGLabel* fLabel1487 = new TGLabel(fMainFrame1475, "System");
834 fLabel1487->SetTextJustify(36);
835 fMainFrame1475->AddFrame(fLabel1487, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
836 fLabel1487->MoveResize(8, 8, 64, 18);
837
838 // "System properties" group frame
839 TGGroupFrame* fGroupFrame1488 = new TGGroupFrame(fMainFrame1475, "System properties");
840 fGroupFrame1488->SetLayoutBroken(kTRUE);
841
842 fCheckButton1376 = new TGCheckButton(fGroupFrame1488, "Projectile");
843 fCheckButton1376->SetToolTipText("Define projectile for system");
844 fGroupFrame1488->AddFrame(fCheckButton1376, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
845 fCheckButton1376->MoveResize(18, 24, 72, 19);
846 fCheckButton1376->Connect("Toggled(Bool_t)",
847 "KVDBSystemDialog", this,
848 "EnableProjectileProperties(Bool_t)");
849
850 TGFont* ufont; // will reflect user font changes
851 ufont = gClient->GetFont("-adobe-helvetica-medium-r-*-*-12-*-*-*-*-*-iso8859-1");
852
853 TGGC* uGC; // will reflect user GC changes
854 // graphics context changes
855 GCValues_t valEntry1490;
857 gClient->GetColorByName("#000000", valEntry1490.fForeground);
858 gClient->GetColorByName("#c6c3c6", valEntry1490.fBackground);
859 valEntry1490.fFillStyle = kFillSolid;
860 valEntry1490.fFont = ufont->GetFontHandle();
861 valEntry1490.fGraphicsExposures = kFALSE;
862 uGC = gClient->GetGC(&valEntry1490, kTRUE);
863 fTextEntry1490 = new TGTextEntry(fGroupFrame1488, new TGTextBuffer(15), -1, uGC->GetGC(), ufont->GetFontStruct(), kSunkenFrame | kDoubleBorder | kOwnBackground);
868 fTextEntry1490->SetToolTipText("Chemical symbol for projectile nuclei");
869 fTextEntry1490->Connect("ReturnPressed()",
870 "KVDBSystemDialog", this, "ProjectileSymbolChanged()");
871
872 fGroupFrame1488->AddFrame(fTextEntry1490, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
873 fTextEntry1490->MoveResize(100, 24, 24, 22);
875 fGroupFrame1488->AddFrame(fNumberEntry1493, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
876 fNumberEntry1493->MoveResize(158, 24, 43, 22);
877 fNumberEntry1493->Connect("ValueSet(Long_t)",
878 "KVDBSystemDialog", this, "ProjectileZChanged(Long_t)");
879
880 TGLabel* fLabel1497 = new TGLabel(fGroupFrame1488, "Z=");
881 fLabel1497->SetTextJustify(36);
882 fGroupFrame1488->AddFrame(fLabel1497, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
883 fLabel1497->MoveResize(130, 24, 24, 18);
884 TGLabel* fLabel1498 = new TGLabel(fGroupFrame1488, "A=");
885 fLabel1498->SetTextJustify(36);
886 fGroupFrame1488->AddFrame(fLabel1498, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
887 fLabel1498->MoveResize(206, 24, 24, 18);
889 fGroupFrame1488->AddFrame(fNumberEntry1499, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
890 fNumberEntry1499->MoveResize(232, 24, 43, 22);
891 fNumberEntry1499->Connect("ValueSet(Long_t)",
892 "KVDBSystemDialog", this, "ProjectileAChanged(Long_t)");
893
894 TGLabel* fLabel1503 = new TGLabel(fGroupFrame1488, "Q=");
895 fLabel1503->SetTextJustify(36);
896 fGroupFrame1488->AddFrame(fLabel1503, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
897 fLabel1503->MoveResize(280, 24, 24, 18);
898 //the "Q" field is inactive for the moment
899 fLabel1503->Disable();
900 TGNumberEntry* fNumberEntry1504 = new TGNumberEntry(fGroupFrame1488, (Double_t) 0, 3, -1, (TGNumberFormat::EStyle) 0);
901 fGroupFrame1488->AddFrame(fNumberEntry1504, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
902 fNumberEntry1504->MoveResize(312, 24, 43, 22);
903 //the "Q" field is inactive for the moment
904 fNumberEntry1504->SetState(kFALSE);
905 TGLabel* fLabel1508 = new TGLabel(fGroupFrame1488, "Energy=");
906 fLabel1508->SetTextJustify(36);
907 fGroupFrame1488->AddFrame(fLabel1508, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
908 fLabel1508->MoveResize(96, 56, 48, 18);
909 fNumberEntry1509 = new TGNumberEntry(fGroupFrame1488, (Double_t) 0, 9, -1, (TGNumberFormat::EStyle) 5);
910 fGroupFrame1488->AddFrame(fNumberEntry1509, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
911 fNumberEntry1509->MoveResize(152, 56, 80, 22);
912 fNumberEntry1509->Connect("ValueSet(Long_t)",
913 "KVDBSystemDialog", this, "ProjectileEChanged(Long_t)");
914
915 TGLabel* fLabel1513 = new TGLabel(fGroupFrame1488, "MeV/nucleon");
916 fLabel1513->SetTextJustify(36);
917 fGroupFrame1488->AddFrame(fLabel1513, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
918 fLabel1513->MoveResize(240, 56, 80, 18);
919
920 // "Target" group frame
921 TGGroupFrame* fGroupFrame1514 = new TGGroupFrame(fGroupFrame1488, "Target");
922 fGroupFrame1514->SetLayoutBroken(kTRUE);
923
924
925 // combo box with layers of target
927 fComboBox1515->Resize(104, 22);
929 fComboBox1515->Connect("Selected(Int_t)",
930 "KVDBSystemDialog", this, "UpdateTargetLayerProperties(Int_t)");
931
932 fGroupFrame1514->AddFrame(fComboBox1515, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
933 fComboBox1515->MoveResize(80, 48, 104, 22);
935 fGroupFrame1514->AddFrame(fNumberEntry1526, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
936 fNumberEntry1526->MoveResize(8, 80, 59, 22);
937 fNumberEntry1526->Connect("ValueSet(Long_t)",
938 "KVDBSystemDialog", this, "TargetLayerThicknessChanged(Long_t)");
939
940 fLabel1530 = new TGLabel(fGroupFrame1514, "mg/cm2");
942 fGroupFrame1514->AddFrame(fLabel1530, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
943 fLabel1530->MoveResize(72, 80, 46, 18);
944 TGLabel* fLabel1531 = new TGLabel(fGroupFrame1514, "Angle=");
945 fLabel1531->SetTextJustify(36);
946 fGroupFrame1514->AddFrame(fLabel1531, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
947 fLabel1531->MoveResize(104, 16, 40, 18);
948 fNumberEntry1532 = new TGNumberEntry(fGroupFrame1514, (Double_t) 0, 8, -1, (TGNumberFormat::EStyle) 5);
949 fGroupFrame1514->AddFrame(fNumberEntry1532, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
950 fNumberEntry1532->MoveResize(152, 16, 75, 22);
951 fNumberEntry1532->Connect("ValueSet(Long_t)",
952 "KVDBSystemDialog", this, "TargetAngleChanged(Long_t)");
953
954 TGLabel* fLabel1536 = new TGLabel(fGroupFrame1514, "A=");
955 fLabel1536->SetTextJustify(36);
956 fGroupFrame1514->AddFrame(fLabel1536, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
957 fLabel1536->MoveResize(136, 80, 16, 18);
959 fGroupFrame1514->AddFrame(fNumberEntry1537, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
960 fNumberEntry1537->MoveResize(160, 80, 64, 22);
961 fNumberEntry1537->Connect("ValueSet(Long_t)",
962 "KVDBSystemDialog", this, "TargetLayerAChanged(Long_t)");
963
964 // "Add new layer" group frame
965 TGGroupFrame* fGroupFrame1541 = new TGGroupFrame(fGroupFrame1514, "Add new layer");
966 fGroupFrame1541->SetLayoutBroken(kTRUE);
967
968
969 // combo box for choosing new layer for target
971 fComboBox1542->Resize(80, 22);
972 //fill list of all available materials
973 KVMaterial bidon;
975 TIter it_mat(fMaterialsList.get());
976 TObject* obj;
977 Int_t ind = 0;
978 while ((obj = it_mat())) {
979 fComboBox1542->AddEntry(obj->GetName(), ind++);
980 }
982 fGroupFrame1541->AddFrame(fComboBox1542, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
983 fComboBox1542->MoveResize(16, 24, 80, 22);
984 fTextButton1553 = new TGTextButton(fGroupFrame1541, "Add");
986 fTextButton1553->Resize(56, 24);
987 fGroupFrame1541->AddFrame(fTextButton1553, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
988 fTextButton1553->MoveResize(24, 56, 56, 24);
989 fTextButton1553->Connect("Clicked()",
990 "KVDBSystemDialog", this, "AddNewTargetLayer()");
991
992 fGroupFrame1541->SetLayoutManager(new TGVerticalLayout(fGroupFrame1541));
993 fGroupFrame1541->Resize(112, 104);
994 fGroupFrame1514->AddFrame(fGroupFrame1541, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
995 fGroupFrame1541->MoveResize(232, 40, 112, 104);
996 fTextButton1554 = new TGTextButton(fGroupFrame1514, "Remove");
998 fTextButton1554->Resize(56, 24);
999 fGroupFrame1514->AddFrame(fTextButton1554, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1000 fTextButton1554->MoveResize(80, 112, 56, 24);
1002 fTextButton1554->Connect("Clicked()",
1003 "KVDBSystemDialog", this, "RemoveTargetLayer()");
1004
1005 TGLabel* fLabel1555 = new TGLabel(fGroupFrame1514, "Layer:");
1006 fLabel1555->SetTextJustify(36);
1007 fGroupFrame1514->AddFrame(fLabel1555, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1008 fLabel1555->MoveResize(24, 48, 40, 18);
1009
1010 fGroupFrame1514->SetLayoutManager(new TGVerticalLayout(fGroupFrame1514));
1011 fGroupFrame1514->Resize(360, 168);
1012 fGroupFrame1488->AddFrame(fGroupFrame1514, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1013 fGroupFrame1514->MoveResize(8, 80, 360, 168);
1014
1015 //___________________________________________________________//
1016 // Bottom row buttons
1017 //___________________________________________________________//
1018
1019 fCreateSystem = new TGTextButton(fGroupFrame1488, "Create");
1021 fCreateSystem->Resize(48, 24);
1023 fCreateSystem->SetToolTipText("Create new system with current properties");
1024 fGroupFrame1488->AddFrame(fCreateSystem, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1025 fCreateSystem->MoveResize(36, 280, 60, 24);
1026 fCreateSystem->Connect("Clicked()",
1027 "KVDBSystemDialog", this, "CreateNewSystem()");
1029
1030 TGTextButton* fTextButton1573 = new TGTextButton(fGroupFrame1488, "Delete");
1031 fTextButton1573->SetTextJustify(36);
1032 fTextButton1573->Resize(48, 24);
1033 fTextButton1573->ChangeBackground(red);
1034 fGroupFrame1488->AddFrame(fTextButton1573, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1035 fTextButton1573->MoveResize(100, 280, 60, 24);
1036 fTextButton1573->SetToolTipText("Delete the currently selected system");
1037 fTextButton1573->Connect("Clicked()",
1038 "KVDBSystemDialog", this, "DeleteSystem()");
1039
1040 fSetRuns = new TGTextButton(fGroupFrame1488, "Set Runs");
1042 fSetRuns->Resize(48, 24);
1043 fSetRuns->ChangeBackground(yellow);
1044 fGroupFrame1488->AddFrame(fSetRuns, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1045 fSetRuns->MoveResize(164, 280, 60, 24);
1046 fSetRuns->SetToolTipText("Set runs for selected system");
1047 fSetRuns->Connect("Clicked()",
1048 "KVDBSystemDialog", this, "SetRuns()");
1049
1050 fSaveButton = new TGTextButton(fGroupFrame1488, "Save");
1052 fSaveButton->Resize(48, 24);
1053 //fSaveButton->ChangeBackground(yellow);
1054 fGroupFrame1488->AddFrame(fSaveButton, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1055 fSaveButton->MoveResize(228, 280, 60, 24);
1056 fSaveButton->SetToolTipText("Save changes to systems");
1057 fSaveButton->Connect("Clicked()",
1058 "KVDBSystemDialog", this, "SaveSystems()");
1059
1060 TGTextButton* fcloseButton = new TGTextButton(fGroupFrame1488, "Close");
1061 fcloseButton->SetTextJustify(36);
1062 fcloseButton->Resize(48, 24);
1063// fcloseButton->ChangeBackground(cyan);
1064 fGroupFrame1488->AddFrame(fcloseButton, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1065 fcloseButton->MoveResize(292, 280, 60, 24);
1066 fcloseButton->SetToolTipText("Return to main window");
1067 fcloseButton->Connect("Clicked()",
1068 "KVDBSystemDialog", this, "DoClose()");
1069
1070 fGroupFrame1488->SetLayoutManager(new TGVerticalLayout(fGroupFrame1488));
1071 fGroupFrame1488->Resize(376, 320);
1072 fMainFrame1475->AddFrame(fGroupFrame1488, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));
1073 fGroupFrame1488->MoveResize(8, 32, 376, 320);
1074
1078 fMainFrame1475->SetWindowName("Set system properties for runs");
1080 fMainFrame1475->Resize(394, 358);
1081}
1082
1083
1084
int Int_t
unsigned int UInt_t
unsigned long ULong_t
long Long_t
const Mask_t kGCBackground
const Mask_t kGCForeground
const Mask_t kGCFillStyle
const Mask_t kGCFont
kSunkenFrame
kDoubleBorder
kHorizontalFrame
kOwnBackground
kFillSolid
const Mask_t kGCGraphicsExposures
ROOT::R::TRInterface & r
bool Bool_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
kButtonDown
kButtonUp
#define gClient
kDeepCleanup
kLHintsLeft
kLHintsTop
kMBIconExclamation
kTextLeft
winID w
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
static void BackupFileWithDate(const Char_t *path)
Definition KVBase.cpp:753
static Bool_t SearchKVFile(const Char_t *name, TString &fullpath, const Char_t *kvsubdir="")
Definition KVBase.cpp:538
virtual const Char_t * GetType() const
Definition KVBase.h:177
Dialog box for setting system parameters associated to runs.
void DeleteSystem()
Delete the currently selected system.
KVNumberList fRuns
runs selected by user
void TargetAngleChanged(Long_t)
Called when target angle is changed.
KVDatedFileManager * fUndo
allows to undo changes to Systems.dat
TGLabel * fLabel1530
units for thickness
void ProjectileZChanged(Long_t)
TGComboBox * fComboBox1515
layers in current target
void SetNeedSave(Bool_t k=kTRUE)
TGComboBox * fComboBox1542
list of materials for creating target layers
TGTextButton * fTextButton1553
add new layer to target
void RemoveAll(TGComboBox *)
KVString fCurrentSystemsFile
name (including timestamp) of currently used Systems.dat
KVTarget * fTarget
current target
void ProjectileEChanged(Long_t)
void UpdateSystemProperties()
Update displayed system properties, e.g. when a new system is selected in fComboBox1476.
void UpdateTargetLayerProperties(Int_t)
TGNumberEntry * fNumberEntry1493
Z of projectile.
TGTextButton * fSetRuns
associate runs with selected system
KVMaterial * fLayer
current target layer
TGTextEntry * fTextEntry1490
symbol of projectile
TGNumberEntry * fNumberEntry1499
A of projectile.
TGNumberEntry * fNumberEntry1537
atomic mass of current layer
KVDBSystem * fSystem
currently selected system in combo box fComboBox1476
TGNumberEntry * fNumberEntry1509
E/A of projectile.
TGNumberEntry * fNumberEntry1526
thickness of current layer
TGComboBox * fComboBox1476
combo box displaying list of systems for current dataset
void CreateMainWindow(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h)
Creates main window and displays it.
TGTransientFrame * fMainFrame1475
the main window
void TargetLayerAChanged(Long_t)
Called when target layer A is changed.
virtual ~KVDBSystemDialog()
Destructor.
void TargetLayerThicknessChanged(Long_t)
TGTextButton * fCreateSystem
button to create new system
TGTextButton * fSaveButton
save changes
void UpdateRunlist()
Signal emitted to tell KVINDRARunSheetGUI to update the runlist.
TGTextButton * fTextButton1554
remove current layer from target
void SelectSystem(Int_t)
Called when a new system is selected in fComboBox1476.
Bool_t NeedSave() const
std::unique_ptr< TObjArray > fMaterialsList
list of all available materials
void ProjectileAChanged(Long_t)
void EnableProjectileProperties(Bool_t)
Called when "Projectile" check box is checked (on=kTRUE) or unchecked (on=kFALSE)
TGNumberEntry * fNumberEntry1532
target angle to beam
TGCheckButton * fCheckButton1376
check button to define projectile
Database class used to store information on different colliding systems studied during an experiment....
Definition KVDBSystem.h:52
void SetZtarget(UInt_t z)
Definition KVDBSystem.h:214
void SetAtarget(UInt_t a)
Definition KVDBSystem.h:219
void SetZbeam(UInt_t z)
Definition KVDBSystem.h:224
void AddRun(KVDBRecord *)
void SetTarget(KVTarget *targ)
Definition KVDBSystem.h:83
UInt_t GetZproj() const
Definition KVDBSystem.h:189
void SetAbeam(UInt_t a)
Definition KVDBSystem.h:229
void SetEbeam(Float_t energy)
Definition KVDBSystem.h:234
KVTarget * GetTarget() const
Definition KVDBSystem.h:79
UInt_t GetAproj() const
Definition KVDBSystem.h:194
Float_t GetEproj() const
Definition KVDBSystem.h:204
void RemoveAllRuns()
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.
const Char_t * GetPreviousVersion(const Char_t *name)
void Update()
Updates list of files.
void AddSystem(KVDBSystem *r)
Definition KVExpDB.h:94
virtual void cd()
Definition KVExpDB.cpp:577
virtual KVSeqCollection * GetSystems() const
Definition KVExpDB.h:89
void RemoveSystem(KVDBSystem *s)
Definition KVExpDB.h:98
virtual void Save(const Char_t *)
Definition KVExpDB.cpp:362
General purpose dialog box asking for some input in the form of a string.
Abstract base class for calculation of range & energy loss of charged particles in matter.
virtual TObjArray * GetListOfMaterials()=0
virtual Double_t GetAtomicMass(const Char_t *)
Returns atomic mass of a material in the range tables.
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.
Definition KVMaterial.h:94
Double_t GetZ() const
static KVIonRangeTable * GetRangeTable()
void SetMass(Int_t a)
void SetAreaDensity(Double_t dens)
Double_t GetAreaDensity() const
Double_t GetMass() const
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 GetA() const
Int_t GetZ() const
Return the number of proton / atomic number.
Strings used to represent a set of ranges of values.
Bool_t End(void) const
void Begin(void) const
Bool_t IsEmpty() const
Int_t Next(void) const
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....
Definition KVString.h:73
Calculation/correction of energy losses of particles through an experimental target.
Definition KVTarget.h:127
void SetAngleToBeam(Double_t a)
Definition KVTarget.cpp:178
Int_t NumberOfLayers() const
Definition KVTarget.h:166
KVMaterial * GetLayerByIndex(Int_t ilayer) const
Definition KVTarget.h:174
void AddLayer(const Char_t *material, Double_t thick)
Definition KVTarget.cpp:111
Double_t GetAngleToBeam()
Gives angle of target to incident beam direction in degrees.
Definition KVTarget.cpp:193
KVList * GetLayers() const
Definition KVTarget.h:170
void ls(Option_t *option="") const override
virtual void SetToolTipText(const char *text, Long_t delayms=400)
virtual void SetEnabled(Bool_t e=kTRUE)
void SetState(EButtonState state, Bool_t emit=kFALSE) override
virtual Int_t GetSelected() const
void RemoveAll() override
virtual void Select(Int_t id, Bool_t emit=kTRUE)
virtual void AddEntry(const char *s, Int_t id)
virtual Int_t GetNumberOfEntries() const
TGDimension GetDefaultSize() const override
virtual void SetLayoutManager(TGLayoutManager *l)
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
void MapSubwindows() override
void SetCleanup(Int_t mode=kLocalCleanup) override
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 UInt_t GetDefaultHeight() const
virtual void Resize(TGDimension size)
void MapWindow() override
virtual void ChangeBackground(Pixel_t back)
GContext_t GetGC() const
void SetTextJustify(Int_t tmode)
void SetText(const char *newText)
virtual void Disable(Bool_t on=kTRUE)
void DontCallClose()
void SetWindowName(const char *name=nullptr) override
virtual void SetState(Bool_t enable=kTRUE)
virtual Long_t GetIntNumber() const
virtual Double_t GetNumber() const
virtual void SetNumber(Double_t val, Bool_t emit=kTRUE)
virtual void SetTextJustify(Int_t tmode)
virtual void SetMaxLength(Int_t maxlen)
const char * GetText() const
void SetEnabled(Bool_t flag=kTRUE)
virtual void SetAlignment(ETextJustification mode=kTextLeft)
virtual void SetToolTipText(const char *text, Long_t delayms=500)
virtual void SetText(const char *text, Bool_t emit=kTRUE)
virtual void CenterOnParent(Bool_t croot=kTRUE, EPlacement pos=kCenter)
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)
Int_t Atoi() const
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()
RVec< PromoteTypes< T0, T1 > > pow(const RVec< T0 > &v, const T1 &y)
const Int_t n
TH1 * h
const long double mg
Definition KVUnits.h:74
const long double cm
Definition KVUnits.h:66
constexpr Double_t E()
ULong_t fBackground
Mask_t fMask
Bool_t fGraphicsExposures
ULong_t fForeground
Int_t fFillStyle
FontH_t fFont
ClassImp(TPyArg)