1 #include "KVINDRARunSheetGUI.h"
11 #include "KVINDRADB.h"
12 #include "KVINDRADBRun.h"
13 #include "KVInputDialog.h"
15 #include "KVDataSet.h"
18 #include "KVDataSetManager.h"
19 #include "KVDataRepositoryManager.h"
20 #include "KVDBSystemDialog.h"
138 #ifdef __WITHOUT_TGBUTTON_SETENABLED
139 #define SetEnabled(flag) \
140 SetState( flag ? kButtonUp : kButtonDisabled )
150 GUIenv =
new TEnv(
".KVDataBaseGUIrc");
155 fSelectedEntries = 0;
156 fButList =
new TList;
163 tb->
SetToolTipText(
"Set path to directory containing run sheets");
164 tb->
Connect(
"Clicked()",
"KVINDRARunSheetGUI",
this,
170 fDirLabel =
new TGLabel(fHframe,
"./");
177 tb->
Connect(
"Clicked()",
"KVINDRARunSheetGUI",
this,
"SetFileFormat()");
188 fFormLabel =
new TGLabel(fHframe,
"************");
197 cb->
Connect(
"Toggled(Bool_t)",
"KVINDRARunSheetReader", &fReader,
198 "SetMakeTree(Bool_t)");
200 (
"Check this to fill a TTree with all infos read from runsheet");
207 tb->
Connect(
"Clicked()",
"KVINDRARunSheetGUI",
this,
208 "StartTreeViewer()");
210 #ifdef __WITHOUT_TGBUTTON_SETENABLED
211 cb->
Connect(
"Toggled(Bool_t)",
"KVINDRARunSheetGUI",
this,
"SetViewTreeEnabled(Bool_t)");
212 fViewTreeButton = tb;
214 cb->
Connect(
"Toggled(Bool_t)",
"TGTextButton", tb,
"SetEnabled(Bool_t)");
224 ULong_t red, cyan, green, yellow, magenta;
225 gClient->GetColorByName(
"#ff00ff", magenta);
226 gClient->GetColorByName(
"#ff0000", red);
227 gClient->GetColorByName(
"#00ff00", green);
228 gClient->GetColorByName(
"#00ffff", cyan);
229 gClient->GetColorByName(
"#ffff00", yellow);
235 fChangeDataSet =
new TGTextButton(fButtonsFrame,
"Change dataset");
236 fChangeDataSet->
SetToolTipText(
"Select set of experimental data to work on");
237 fChangeDataSet->
Connect(
"Clicked()",
"KVINDRARunSheetGUI",
this,
239 fButList->
Add(fChangeDataSet);
241 fUpdate =
new TGTextButton(fButtonsFrame,
"Read runsheets");
242 fUpdate->
SetToolTipText(
"Read all runsheets in directory, adding informations to database");
243 fUpdate->
Connect(
"Clicked()",
"KVINDRARunSheetGUI",
this,
246 fButList->
Add(fUpdate);
250 SetToolTipText(
"Save all informations in database");
251 fSaveDB->
Connect(
"Clicked()",
"KVINDRARunSheetGUI",
this,
"SaveAll()");
252 fButList->
Add(fSaveDB);
256 SetToolTipText(
"Exit the application");
257 fButList->
Add(fQuit);
259 fQuit->
Connect(
"Clicked()",
"KVINDRARunSheetGUI",
this,
"CloseWindow()");
265 fButtonsFrame->
Show();
273 fSetSystem =
new TGTextButton(fButtonsFrame,
"Systems");
274 fSetSystem->
SetToolTipText(
"Modify reaction systems or set system for the selected run(s)");
275 fSetSystem->
Connect(
"Clicked()",
"KVINDRARunSheetGUI",
this,
278 fButList->
Add(fSetSystem);
279 fUnSetSystem =
new TGTextButton(fButtonsFrame,
"Unset System");
280 fUnSetSystem->
SetToolTipText(
"Unset the reaction system for the selected run(s)");
282 fUnSetSystem->
Connect(
"Clicked()",
"KVINDRARunSheetGUI",
this,
284 fButList->
Add(fUnSetSystem);
285 fAddComment =
new TGTextButton(fButtonsFrame,
"Add comment");
287 fAddComment->
Connect(
"Clicked()",
"KVINDRARunSheetGUI",
this,
290 fButList->
Add(fAddComment);
291 fAddCahier =
new TGTextButton(fButtonsFrame,
"Logbook");
294 (
"Add a reference to the experiment logbook for selected run");
295 fAddCahier->
Connect(
"Clicked()",
"KVINDRARunSheetGUI",
this,
298 fButList->
Add(fAddCahier);
299 fSetTrigger =
new TGTextButton(fButtonsFrame,
"Set Trigger");
302 (
"Set the multiplicity trigger for the selected run(s)");
303 fSetTrigger->
Connect(
"Clicked()",
"KVINDRARunSheetGUI",
this,
306 fButList->
Add(fSetTrigger);
307 fPrintRun =
new TGTextButton(fButtonsFrame,
"Print run");
308 fPrintRun->
SetToolTipText(
"Print all informations on selected run");
309 fPrintRun->
Connect(
"Clicked()",
"KVINDRARunSheetGUI",
this,
312 fButList->
Add(fPrintRun);
318 fButtonsFrame->
Show();
351 fRunList->
Connect(
"SelectionChanged()",
"KVINDRARunSheetGUI",
this,
352 "SelectionChanged()");
372 if (!gDataRepositoryManager) {
374 gDataRepositoryManager->
Init();
430 KVINDRARunSheetGUI::~KVINDRARunSheetGUI()
434 if (fSelectedEntries)
delete fSelectedEntries;
437 if (GUIenv)
delete GUIenv;
483 if (fLastRun >= fFirstRun) {
517 cout <<
"directory = " << dir.
Data() << endl;
520 Form(
"KVDataBaseGUI.RunSheetDir.%s", gDataSet->
GetName()),
548 if (fFirstRun > fLastRun) {
570 if (fSelectedEntries) {
571 delete fSelectedEntries;
572 fSelectedEntries = 0;
610 cout <<
"Read " << read <<
" runsheets" << endl;
611 cout <<
"fReader.IsMakeTree()=" << fReader.
IsMakeTree() << endl;
612 gExpDB->
Save(
"Runlist");
638 if (fSelectedEntries) {
639 delete fSelectedEntries;
640 fSelectedEntries = 0;
645 else fSelectedRun = 0;
658 return (fSelectedEntries ? fSelectedEntries->
GetSize() : 0);
671 gIndraDB->
Save(
"Systems");
672 gIndraDB->
Save(
"Runlist");
688 new KVInputDialog(
this,
"Enter comment for run(s)", &fInputString, &ok);
694 TIter next(fSelectedEntries);
709 fInputString = fSelectedRun->
GetCahier();
711 new KVInputDialog(
this,
"Enter log-book reference for run(s)",
718 TIter next(fSelectedEntries);
735 new KVInputDialog(
this,
"Enter multiplicity trigger for run(s)",
737 "Enter minimum multiplicity, i.e. for M>=4 type '4'");
738 if (ok && fInputString.
IsDigit()) {
744 TIter next(fSelectedEntries);
764 new KVInputDialog(
this,
"Enter format string for runsheet filenames",
766 "e.g. RUN_%04d.TXT for filenames such as RUN_0123.TXT");
769 GUIenv->
SetValue(
"KVDataBaseGUI.FileFormat", fInputString.
Data());
793 fSelectedRun->
Print();
805 if (fSelectedRun) run_system = fSelectedRun->
GetSystem();
811 TIter next(fSelectedEntries);
830 cout <<
"Unsetting system (" << fSelectedRun->
GetSystem()->
GetName() <<
" for run " << fSelectedRun->
GetNumber() << endl;
836 TIter next(fSelectedEntries);
845 gExpDB->
Save(
"Systems");
863 fMain->SetLayoutBroken(
kTRUE);
864 fMain->Connect(
"CloseWindow()",
"KVIRSGChooseDataSetDialog",
this,
866 fMain->DontCallClose();
870 fLabel =
new TGLabel(fMain,
"Choose dataset:");
871 fLabel->SetTextJustify(36);
872 fMain->AddFrame(fLabel,
875 fLabel->MoveResize(8, 8, 208, 24);
877 gClient->GetColorByName(
"#ffffff", ucolor);
883 if (gDataSetManager) {
884 for (
int i = 0; i < gDataSetManager->
GetNtotal(); i++) {
889 fComboBox->Connect(
"Selected(Int_t)",
"KVIRSGChooseDataSetDialog",
this,
890 "SetDataSet(Int_t)");
891 fComboBox->Resize(208, 22);
892 fComboBox->Select(0);
894 fMain->AddFrame(fComboBox,
897 fComboBox->MoveResize(8, 40, 208, 22);
901 fTextButton->
Resize(80, 24);
902 fMain->AddFrame(fTextButton,
907 fTextButton->
Connect(
"Clicked()",
"KVIRSGChooseDataSetDialog",
this,
910 fMain->MapSubwindows();
912 fMain->Resize(fMain->GetDefaultSize());
913 fMain->CenterOnParent();
914 fMain->SetWindowName(
"Choose dataset dialog box");
916 fMain->Resize(223, 110);
926 KVIRSGChooseDataSetDialog::~KVIRSGChooseDataSetDialog()
963 if (fDataSetIndex > -1) gDataSetManager->
GetDataSet(fDataSetIndex)->
cd();
967 #ifdef __WITHOUT_TGBUTTON_SETENABLED
R__EXTERN TApplication * gApplication
winID h TVirtualViewer3D TVirtualGLPainter p
char * Form(const char *fmt,...)
char * StrDup(const char *str)
virtual Int_t GetNumber() const
void Print(Option_t *option="") const override
void SetComments(const KVString &comments)
KVDBSystem * GetSystem() const
void BlockSignals(Bool_t yes=kTRUE)
void SetTrigger(Int_t trig)
const Char_t * GetComments() const
Dialog box for setting system parameters associated to runs.
Database class used to store information on different colliding systems studied during an experiment....
Manages access to one or more data repositories.
KVDataSet * GetDataSet(Int_t) const
Return pointer to DataSet using index in list of all datasets, index>=0.
Manage an experimental dataset corresponding to a given experiment or campaign.
KVExpDB * GetDataBase(const TString &opt="") const
void UpdateAvailableRuns(const KVString &type)
virtual KVSeqCollection * GetRuns() const
virtual void Save(const Char_t *)
Database entry for each run of an INDRA experiment.
void SetCahier(const Char_t *log)
void UnsetSystem() override
const Char_t * GetCahier() const
_________________________________________________//
void CloseWindow() override
close viewer
void ChangeDataSet()
open dialog to choose dataset
void DisableButtons()
Disable all buttons.
void SetSystem()
Open dialog box for setting system properties for runs.
void ClearListOfRuns()
remove all entries from grid list box
Int_t GetNSelected()
returns current number of selected items in grid list
const Char_t * GetRunSheetDir()
Int_t ReadAllRunSheets(Int_t first=1, Int_t last=9999)
void StartTreeViewer() const
Bool_t IsMakeTree() const
void SetFileFormat(const Char_t *fmt)
const Char_t * GetFileFormat()
void SetRunSheetDir(const Char_t *dir)
_________________________________________________//
void YouPressedOK()
Called when OK button is pressed.
virtual void SetIsDateTime(KVDatime::EKVDateFormat fmt=KVDatime::kCTIME, Bool_t with_reference=kTRUE)
Enhanced version of ROOT TGListView widget.
virtual void ActivateSortButtons()
virtual void SetDataColumns(Int_t ncolumns)
virtual void Sort(Int_t column)
TObject * GetLastInList() const
void AllowBrowse(Bool_t on=kTRUE)
virtual KVLVColumnData * GetDataColumn(Int_t index) const
virtual void Display(const TCollection *l)
KVUnownedList GetSelectedObjects() const
TObject * GetLastSelectedObject() const
TObject * GetFirstInList() const
void AllowContextMenu(Bool_t on=kTRUE)
virtual void SetDataColumn(Int_t index, const Char_t *name, const Char_t *method="", Int_t mode=kTextCenterX)
Strings used to represent a set of ranges of values.
void Add(Int_t)
Add value 'n' to the list.
Int_t GetSize() const override
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
virtual void Terminate(Int_t status=0)
virtual Int_t GetEntries() const
virtual Int_t GetSize() const
virtual const char * GetValue(const char *name, const char *dflt) const
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=nullptr)
virtual void SaveLevel(EEnvLevel level)
TGDimension GetDefaultSize() const override
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
UInt_t GetDefaultWidth() const override
void MapSubwindows() override
UInt_t GetDefaultHeight() const override
void MoveResize(Int_t x, Int_t y, UInt_t w=0, UInt_t h=0) override
virtual void Resize(TGDimension size)
void MapWindow() override
virtual void ChangeBackground(Pixel_t back)
void UnmapWindow() override
void SetText(const char *newText)
void SetWMSize(UInt_t w, UInt_t h)
void SetWindowName(const char *name=nullptr) override
virtual void SetTextJustify(Int_t tmode)
void Add(TObject *obj) override
const char * GetName() const override
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
const char * Data() const
void Form(const char *fmt,...)
static void SingleShot(Int_t milliSec, const char *receiver_class, void *receiver, const char *method)
int main(int argc, char **argv)