1 // Author: Mihai Niculescu 2013
3 /**************************************************************************
4 * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *
5 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
6 * full copyright notice. *
7 **************************************************************************/
10 #include <TObjString.h>
18 #include <TGTextEntry.h>
20 #include <AliReconstruction.h>
22 #include "AliEventServerUtil.h"
23 #include "AliEventServerPreferencesWindow.h"
25 //_________________________________________________________
26 ClassImp(AliEventServerPreferencesWindow)
27 AliEventServerPreferencesWindow::AliEventServerPreferencesWindow(const TGWindow* p, const char* window_title)
28 : TGTransientFrame(gClient->GetRoot(), p),
32 fEntryCDBDefaultStorage(0),
33 fEntryCDBSpecStoragePath1(0),
34 fEntryCDBSpecStorageValue1(0),
35 fEntryCDBSpecStoragePath2(0),
36 fEntryCDBSpecStorageValue2(0),
37 fEntryCDBSpecStoragePath3(0),
38 fEntryCDBSpecStorageValue3(0),
40 fEntryRecoQARefDefStorage(0),
41 fChkRecoRunGlobalQA(0),
42 fChkRecoRunPlaneEff(0),
44 fChkRecoWriteAlignment(0),
53 SetCleanup(kDeepCleanup);
54 SetWindowName(window_title);
57 fTab = new TGTab(this);
58 TGCompositeFrame* tab1 = fTab->AddTab("Server");
59 TGCompositeFrame* tab2 = fTab->AddTab("Reconstruction");
60 TGCompositeFrame* tab3 = fTab->AddTab("Logbook");
64 SetupLogbookTab(tab3);
67 TGHorizontalFrame* hf = new TGHorizontalFrame(this);
68 TGTextButton* btDefaults = new TGTextButton(hf, "Restore Defaults");
69 TGTextButton* btCancel = new TGTextButton(hf, "Cancel");
70 TGTextButton* btApply = new TGTextButton(hf, "Apply");
72 btDefaults->Connect("Clicked()", "AliEventServerPreferencesWindow", this, "onRestoreDefaults()");
73 btCancel->Connect("Clicked()", "AliEventServerPreferencesWindow", this, "onCancel()");
74 btApply->Connect("Clicked()", "AliEventServerPreferencesWindow", this, "onApply()");
76 hf->AddFrame(btDefaults, new TGLayoutHints(kLHintsNormal) );
77 hf->AddFrame(btApply, new TGLayoutHints(kLHintsRight) );
78 hf->AddFrame(btCancel, new TGLayoutHints(kLHintsRight) );
81 // Add Tab Widget and Dialog buttons to Main Window
82 AddFrame(fTab, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY));
83 AddFrame(hf, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
85 if(ReadSettings()!=0) Info("AliEventServerPreferencesWindow::AliEventServerPreferencesWindow", "Problems while reading settings from file!\n");
87 SetMWMHints(kMWMDecorAll | kMWMDecorResizeH | kMWMDecorMaximize |
88 kMWMDecorMinimize | kMWMDecorMenu,
89 kMWMFuncAll | kMWMFuncResize | kMWMFuncMaximize |
97 gClient->WaitFor(this);
100 AliEventServerPreferencesWindow::~AliEventServerPreferencesWindow()
106 /*********************/
107 /* Server Settings Tab */
108 /*********************/
109 void AliEventServerPreferencesWindow::SetupServerTab(TGCompositeFrame* tab)
111 TGHorizontalFrame *t2hf = new TGHorizontalFrame(tab, 1, 20);
112 TGLabel* lbServerHost = new TGLabel(t2hf, "Host:");
113 t2hf->AddFrame(lbServerHost, new TGLayoutHints(kLHintsCenterY));
115 fEntryServerHost = new TGTextEntry(t2hf, "tcp://*");
116 t2hf->AddFrame(fEntryServerHost, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
118 TGLabel* lbServerPort = new TGLabel(t2hf, "Port:");
119 t2hf->AddFrame(lbServerPort, new TGLayoutHints(kLHintsCenterY));
121 fEntryServerPort = new TGTextEntry(t2hf, "5024");
122 fEntryServerPort->SetMaxLength(5);
123 t2hf->AddFrame(fEntryServerPort, new TGLayoutHints(kLHintsNormal));
125 tab->AddFrame(t2hf, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
128 /*******************/
129 /* Reco Settings Tab */
130 /*******************/
131 void AliEventServerPreferencesWindow::SetupRecoTab(TGCompositeFrame* tab)
133 /* CDB Manager Group Frame */
134 TGGroupFrame* grCDBMan = new TGGroupFrame(tab, "CDB Manager");
135 // Default Storage Frame
136 TGHorizontalFrame *hfCDBDefaultStorage = new TGHorizontalFrame(grCDBMan, 1, 20);
137 TGLabel* lbCDBDefaultStorage = new TGLabel(hfCDBDefaultStorage, "Default Storage:");
138 fEntryCDBDefaultStorage = new TGTextEntry(hfCDBDefaultStorage, "local:///local/cdb");
140 hfCDBDefaultStorage->AddFrame(lbCDBDefaultStorage, new TGLayoutHints(kLHintsCenterY));
141 hfCDBDefaultStorage->AddFrame(fEntryCDBDefaultStorage, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
143 // Specific Storage 1 Frame
144 TGHorizontalFrame *hfCDBSpecStorage1 = new TGHorizontalFrame(grCDBMan, 1, 20);
145 TGLabel* lbCDBSpecStorage1 = new TGLabel(hfCDBSpecStorage1, "Specific Storage:");
146 fEntryCDBSpecStoragePath1 = new TGTextEntry(hfCDBSpecStorage1, "GRP/GRP/Data");
147 fEntryCDBSpecStorageValue1 = new TGTextEntry(hfCDBSpecStorage1, "");
149 hfCDBSpecStorage1->AddFrame(lbCDBSpecStorage1, new TGLayoutHints(kLHintsCenterY));
150 hfCDBSpecStorage1->AddFrame(fEntryCDBSpecStoragePath1, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
151 hfCDBSpecStorage1->AddFrame(fEntryCDBSpecStorageValue1, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
153 // Specific Storage 2 Frame
154 TGHorizontalFrame *hfCDBSpecStorage2 = new TGHorizontalFrame(grCDBMan, 1, 20);
155 TGLabel* lbCDBSpecStorage2 = new TGLabel(hfCDBSpecStorage2, "Specific Storage:");
156 fEntryCDBSpecStoragePath2 = new TGTextEntry(hfCDBSpecStorage2, "GRP/CTP/Config");
157 fEntryCDBSpecStorageValue2 = new TGTextEntry(hfCDBSpecStorage2, "");
159 hfCDBSpecStorage2->AddFrame(lbCDBSpecStorage2, new TGLayoutHints(kLHintsCenterY));
160 hfCDBSpecStorage2->AddFrame(fEntryCDBSpecStoragePath2, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
161 hfCDBSpecStorage2->AddFrame(fEntryCDBSpecStorageValue2, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
163 // Specific Storage 3 Frame
164 TGHorizontalFrame *hfCDBSpecStorage3 = new TGHorizontalFrame(grCDBMan, 1, 20);
165 TGLabel* lbCDBSpecStorage3 = new TGLabel(hfCDBSpecStorage3, "Specific Storage:");
166 fEntryCDBSpecStoragePath3 = new TGTextEntry(hfCDBSpecStorage3, "");
167 fEntryCDBSpecStorageValue3 = new TGTextEntry(hfCDBSpecStorage3, "");
169 hfCDBSpecStorage3->AddFrame(lbCDBSpecStorage3, new TGLayoutHints(kLHintsCenterY));
170 hfCDBSpecStorage3->AddFrame(fEntryCDBSpecStoragePath3, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
171 hfCDBSpecStorage3->AddFrame(fEntryCDBSpecStorageValue3, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
173 grCDBMan->AddFrame(hfCDBDefaultStorage, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
174 grCDBMan->AddFrame(hfCDBSpecStorage1, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
175 grCDBMan->AddFrame(hfCDBSpecStorage2, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
176 grCDBMan->AddFrame(hfCDBSpecStorage3, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
178 tab->AddFrame(grCDBMan, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
181 /* Reconstruction Settings Group Frame */
182 TGGroupFrame* grRecoFrame = new TGGroupFrame(tab, "Reconstruction");
184 TGHorizontalFrame *hfRecoRunQA = new TGHorizontalFrame(grRecoFrame, 1, 20);
185 TGLabel* lbRecoRunQA = new TGLabel(hfRecoRunQA, "Run QA:");
186 fEntryRecoRunQA = new TGTextEntry(hfRecoRunQA, ":");
188 hfRecoRunQA->AddFrame( lbRecoRunQA, new TGLayoutHints(kLHintsCenterY));
189 hfRecoRunQA->AddFrame( fEntryRecoRunQA, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
191 // QARef Default Storage
192 TGHorizontalFrame *hfRecoQARefDefStorage = new TGHorizontalFrame(grRecoFrame, 1, 20);
193 TGLabel* lbRecoQARefDefStorage= new TGLabel(hfRecoQARefDefStorage, "QARef Default Storage:");
194 fEntryRecoQARefDefStorage = new TGTextEntry(hfRecoQARefDefStorage, "local://$ALICE_ROOT/QAref");
196 hfRecoQARefDefStorage->AddFrame( lbRecoQARefDefStorage, new TGLayoutHints(kLHintsCenterY));
197 hfRecoQARefDefStorage->AddFrame( fEntryRecoQARefDefStorage, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
200 fChkRecoRunGlobalQA = new TGCheckButton(grRecoFrame, "Run Global QA");
202 // Plane Efficiency Evalution
203 fChkRecoRunPlaneEff= new TGCheckButton(grRecoFrame, "Plane Efficiency Evaluation");
206 fChkRecoWriteESDf= new TGCheckButton(grRecoFrame, "Write ESD friend");
208 // Write Alignement Data
209 fChkRecoWriteAlignment= new TGCheckButton(grRecoFrame, "Write Alignment Data");
212 fChkRecoCleanESD= new TGCheckButton(grRecoFrame, "Clean ESD");
214 // Participating Detectors
215 TGGroupFrame* grRecoDetFrame = new TGGroupFrame(grRecoFrame, "Participating Detectors");
216 TGHorizontalFrame *hfRecoDets = new TGHorizontalFrame(grRecoDetFrame, 1, 20);
217 TGTextButton* btRecoCheckAll = new TGTextButton(hfRecoDets, "Check All");
218 TGTextButton* btRecoUnCheckAll = new TGTextButton(hfRecoDets, "Uncheck All");
220 btRecoCheckAll->Connect("Clicked()", "AliEventServerPreferencesWindow", this, "onCheckAllDetectors()");
221 btRecoUnCheckAll->Connect("Clicked()", "AliEventServerPreferencesWindow", this, "onUnCheckAllDetectors()");
223 hfRecoDets->AddFrame( btRecoCheckAll, new TGLayoutHints(kLHintsNormal));
224 hfRecoDets->AddFrame( btRecoUnCheckAll, new TGLayoutHints(kLHintsNormal));
226 grRecoDetFrame->AddFrame(hfRecoDets, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
228 // get detectors names from AliReconstruction
229 const char** detnames= AliReconstruction::GetDetectorNames();
230 TGCompositeFrame* cfDetectors = new TGCompositeFrame(grRecoDetFrame);
231 cfDetectors->SetLayoutManager(new TGMatrixLayout(cfDetectors, 0, 4, 10));
233 fDetectors = new TObjArray;
234 for(int i=0; i< AliReconstruction::kNDetectors; i++){
235 TGCheckButton* chkRecoDet = new TGCheckButton(cfDetectors, detnames[i]);
236 cfDetectors->AddFrame(chkRecoDet, new TGLayoutHints(kLHintsNormal));
237 fDetectors->Add(chkRecoDet);
240 grRecoDetFrame->AddFrame(cfDetectors, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
241 grRecoDetFrame->Resize();
243 grRecoFrame->AddFrame(hfRecoRunQA, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
244 grRecoFrame->AddFrame(hfRecoQARefDefStorage, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
245 grRecoFrame->AddFrame(fChkRecoRunGlobalQA, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
246 grRecoFrame->AddFrame(fChkRecoRunPlaneEff, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
247 grRecoFrame->AddFrame(fChkRecoWriteESDf, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
248 grRecoFrame->AddFrame(fChkRecoWriteAlignment, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
249 grRecoFrame->AddFrame(fChkRecoCleanESD, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
250 grRecoFrame->AddFrame(grRecoDetFrame, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
252 tab->AddFrame(grRecoFrame, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY));
253 grRecoFrame->Resize();
257 /***********************/
258 /* Logbook Settings Tab */
259 /***********************/
260 void AliEventServerPreferencesWindow::SetupLogbookTab(TGCompositeFrame* tab)
263 TGCompositeFrame* cfLogbook = new TGCompositeFrame(tab);
264 cfLogbook->SetLayoutManager(new TGMatrixLayout(cfLogbook, 0, 2));
266 TGLabel* lbLogbookHost = new TGLabel(cfLogbook, "Host:");
267 fEntryLogbookHost = new TGTextEntry(cfLogbook, "pcaldbl501");
268 fEntryLogbookHost->Resize(150,0);
269 TGLabel* lbLogbookPort = new TGLabel(cfLogbook, "Port:");
270 fEntryLogbookPort = new TGTextEntry(cfLogbook, "3306");
271 fEntryLogbookPort->SetMaxLength(5);
274 TGLabel* lbLogbookDB = new TGLabel(cfLogbook, "Database:");
275 fEntryLogbookDB = new TGTextEntry(cfLogbook, "logbook");
276 fEntryLogbookDB->Resize(150,0);
279 TGLabel* lbLogbookUser = new TGLabel(cfLogbook, "User:");
280 fEntryLogbookUser = new TGTextEntry(cfLogbook, "dqm");
281 fEntryLogbookUser->Resize(150,0);
284 TGLabel* lbLogbookPass = new TGLabel(cfLogbook, "Password:");
285 fEntryLogbookPass = new TGTextEntry(cfLogbook, "dqm123");
286 fEntryLogbookPass->SetEchoMode(TGTextEntry::kPassword);
287 fEntryLogbookPass->Resize(150,0);
289 cfLogbook->AddFrame(lbLogbookHost, new TGLayoutHints(kLHintsCenterY));
290 cfLogbook->AddFrame(fEntryLogbookHost, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
291 cfLogbook->AddFrame(lbLogbookPort, new TGLayoutHints(kLHintsCenterY));
292 cfLogbook->AddFrame(fEntryLogbookPort, new TGLayoutHints(kLHintsNormal));
293 cfLogbook->AddFrame(lbLogbookDB, new TGLayoutHints(kLHintsCenterY));
294 cfLogbook->AddFrame(fEntryLogbookDB, new TGLayoutHints(kLHintsNormal));
295 cfLogbook->AddFrame(lbLogbookUser, new TGLayoutHints(kLHintsCenterY));
296 cfLogbook->AddFrame(fEntryLogbookUser, new TGLayoutHints(kLHintsNormal));
297 cfLogbook->AddFrame(lbLogbookPass, new TGLayoutHints(kLHintsCenterY));
298 cfLogbook->AddFrame(fEntryLogbookPass, new TGLayoutHints(kLHintsNormal));
300 tab->AddFrame(cfLogbook, new TGLayoutHints(kLHintsNormal));
303 void AliEventServerPreferencesWindow::onRestoreDefaults()
306 const char* messageInfo = "Are you sure you want to restore the default settings?\n";
308 new TGMsgBox(gClient->GetRoot(), this, "Restore Default Settings?", messageInfo, kMBIconQuestion, kMBNo|kMBYes, &retCode);
310 if(retCode==kMBNo) return;
314 void AliEventServerPreferencesWindow::onCancel()
319 void AliEventServerPreferencesWindow::onApply()
321 if(WriteSettings()==0){// success!
322 const char* messageInfo = "The changes were saved.\n"
323 "Notice: They will take effect when a new run starts or\n"
324 "after the reconstruction is restarted (if it is already running)";
326 new TGMsgBox(gClient->GetRoot(), this, "New Settings Notice", messageInfo, kMBIconExclamation, kMBOk);
331 const char* messageInfo = "The changes could not be saved!\n"
332 "Check if you have permissions to write to that location.";
334 new TGMsgBox(gClient->GetRoot(), this, "New Settings Notice", messageInfo, kMBIconExclamation, kMBOk);
339 void AliEventServerPreferencesWindow::onCheckAllDetectors()
341 for(int i=0; i<fDetectors->GetEntries(); ++i){
342 TGCheckButton* bt = (TGCheckButton*)fDetectors->At(i);
347 void AliEventServerPreferencesWindow::onUnCheckAllDetectors()
349 for(int i=0; i<fDetectors->GetEntries(); ++i){
350 TGCheckButton* bt = (TGCheckButton*)fDetectors->At(i);
355 Int_t AliEventServerPreferencesWindow::ReadSettings()
358 int readStatus = settings.ReadFile(Form("%s/MONITOR/%s", gSystem->Getenv("ALICE_ROOT"), ALIEVENTSERVER_CONF), kEnvLocal);
359 //check if there was an error reading the file
360 if(readStatus!=0) return readStatus;
363 fEntryServerHost->SetText( settings.GetValue("server.host", DEFAULT_SERVER_HOST), kFALSE);
364 fEntryServerPort->SetText( Form("%d", settings.GetValue("server.port", DEFAULT_SERVER_PORT)), kFALSE);
367 fEntryCDBDefaultStorage->SetText( settings.GetValue( "cdb.defaultStorage", DEFAULT_CDB_STORAGE), kFALSE);
368 fEntryCDBSpecStoragePath1->SetText( settings.GetValue( "cdb.specificStoragePath1", DEFAULT_CDB_SPEC_STORAGE_PATH1), kFALSE);
369 fEntryCDBSpecStorageValue1->SetText( settings.GetValue( "cdb.specificStorageValue1", DEFAULT_CDB_SPEC_STORAGE_VALUE1), kFALSE);
370 fEntryCDBSpecStoragePath2->SetText( settings.GetValue( "cdb.specificStoragePath2", DEFAULT_CDB_SPEC_STORAGE_PATH2), kFALSE);
371 fEntryCDBSpecStorageValue2->SetText(settings.GetValue( "cdb.specificStorageValue2", DEFAULT_CDB_SPEC_STORAGE_VALUE2), kFALSE);
372 fEntryCDBSpecStoragePath3->SetText( settings.GetValue( "cdb.specificStoragePath3", DEFAULT_CDB_SPEC_STORAGE_PATH3), kFALSE);
373 fEntryCDBSpecStorageValue3->SetText(settings.GetValue( "cdb.specificStorageValue3", DEFAULT_CDB_SPEC_STORAGE_VALUE3), kFALSE);
374 fEntryRecoRunQA->SetText( settings.GetValue( "qa.runDetectors", DEFAULT_QA_RUN), kFALSE );
375 fEntryRecoQARefDefStorage->SetText(settings.GetValue( "qa.defaultStorage",DEFAULT_QAREF_STORAGE), kFALSE);
376 fChkRecoRunGlobalQA->SetOn(settings.GetValue( "qa.runGlobal", DEFAULT_QA_RUN_GLOBAL), kFALSE);
377 fChkRecoRunPlaneEff->SetOn(settings.GetValue( "reco.runPlaneEff", DEFAULT_RECO_RUN_PLANE_EFF), kFALSE);
378 fChkRecoWriteESDf->SetOn(settings.GetValue( "reco.writeESDfriend", DEFAULT_RECO_WRITE_ESDF), kFALSE);
379 fChkRecoWriteAlignment->SetOn(settings.GetValue( "reco.writeAlignment",DEFAULT_RECO_WRITE_ALIGN), kFALSE);
380 fChkRecoCleanESD->SetOn(settings.GetValue( "reco.cleanESD",DEFAULT_RECO_CLEAN_ESD), kFALSE);
382 // parse reco run detectors from string
383 TString strRunDetectors(settings.GetValue( "reco.detectors", DEFAULT_RECO_DETECTORS) );
384 TObjArray* arrRecoDets = strRunDetectors.Tokenize(" ");
386 for(int i=0; i<arrRecoDets->GetEntries(); ++i){
387 TObjString* objStr = (TObjString*)arrRecoDets->At(i);
388 if(objStr->GetString().BeginsWith("-")){ // detector is disabled
389 for(int j=0; j<fDetectors->GetEntries();++j){
390 TGCheckButton* bt = (TGCheckButton*)fDetectors->At(j);
391 TString btTitle(Form("-%s",bt->GetTitle()));
392 if(btTitle.CompareTo(objStr->GetString())==0) {// match
393 bt->SetOn(kFALSE); // uncheck detector button
398 else if(objStr->GetString().CompareTo("ALL")==0){
399 onCheckAllDetectors();
401 else{ // detector is enabled
402 for(int j=0; j<fDetectors->GetEntries();++j){
403 TGCheckButton* bt = (TGCheckButton*)fDetectors->At(j);
404 TString btTitle(bt->GetTitle());
405 if(btTitle.CompareTo(objStr->GetString())==0) {// match
406 bt->SetOn(kTRUE); // check detector
414 fEntryLogbookHost->SetText( settings.GetValue("logbook.host", DEFAULT_LOGBOOK_HOST), kFALSE);
415 fEntryLogbookPort->SetText( Form("%d", settings.GetValue("logbook.port", DEFAULT_LOGBOOK_PORT)), kFALSE);
416 fEntryLogbookDB->SetText( settings.GetValue("logbook.db", DEFAULT_LOGBOOK_DB), kFALSE);
417 fEntryLogbookUser->SetText( settings.GetValue("logbook.user", DEFAULT_LOGBOOK_USER), kFALSE);
418 fEntryLogbookPass->SetText( settings.GetValue("logbook.pass", DEFAULT_LOGBOOK_PASS), kFALSE);
423 // write settings to a rootrc file
424 // returns 0 in case of success, -1 in case of error
425 Int_t AliEventServerPreferencesWindow::WriteSettings()
429 settings.SetValue("server.host", fEntryServerHost->GetText());
430 settings.SetValue("server.port", TString(fEntryServerPort->GetText()).Atoi());
433 settings.SetValue( "cdb.defaultStorage", fEntryCDBDefaultStorage->GetText());
434 settings.SetValue( "cdb.specificStoragePath1", fEntryCDBSpecStoragePath1->GetText());
435 settings.SetValue( "cdb.specificStorageValue1", fEntryCDBSpecStorageValue1->GetText());
436 settings.SetValue( "cdb.specificStoragePath2", fEntryCDBSpecStoragePath2->GetText());
437 settings.SetValue( "cdb.specificStorageValue2", fEntryCDBSpecStorageValue2->GetText());
438 settings.SetValue( "cdb.specificStoragePath3", fEntryCDBSpecStoragePath3->GetText());
439 settings.SetValue( "cdb.specificStorageValue3", fEntryCDBSpecStorageValue3->GetText());
440 settings.SetValue( "qa.runDetectors", fEntryRecoRunQA->GetText());
441 settings.SetValue( "qa.defaultStorage", fEntryRecoQARefDefStorage->GetText());
442 settings.SetValue( "qa.runGlobal", fChkRecoRunGlobalQA->IsOn());
443 settings.SetValue( "reco.runPlaneEff", fChkRecoRunPlaneEff->IsOn());
444 settings.SetValue( "reco.writeESDfriend", fChkRecoWriteESDf->IsOn());
445 settings.SetValue( "reco.writeAlignment", fChkRecoWriteAlignment->IsOn());
446 settings.SetValue( "reco.cleanESD", fChkRecoCleanESD->IsOn());
448 // will write reco run detectors as a single string
449 TObjArray checkedDetectors;
450 TObjArray uncheckedDetectors;
451 TString strRunDetectors;
453 for(int i=0; i<fDetectors->GetEntries(); ++i){
454 TGCheckButton* bt = (TGCheckButton*)fDetectors->At(i);
456 checkedDetectors.Add(bt);
459 uncheckedDetectors.Add(bt);
463 int nChkDets = checkedDetectors.GetEntries();
464 int nUnChkDets = uncheckedDetectors.GetEntries();
465 if(nChkDets>=nUnChkDets){
466 strRunDetectors="ALL ";
467 for(int i=0; i<nUnChkDets; ++i ){
468 strRunDetectors.Append( Form(" -%s",uncheckedDetectors.At(i)->GetTitle()) );
472 for(int i=0; i<nChkDets; ++i ){
473 strRunDetectors.Append( Form(" %s",checkedDetectors.At(i)->GetTitle()) );
477 settings.SetValue( "reco.detectors", strRunDetectors.Data());
480 settings.SetValue("logbook.host", fEntryLogbookHost->GetText());
481 settings.SetValue("logbook.port", TString(fEntryLogbookPort->GetText()).Atoi());
482 settings.SetValue("logbook.db", fEntryLogbookDB->GetText());
483 settings.SetValue("logbook.user", fEntryLogbookUser->GetText());
484 settings.SetValue("logbook.pass", fEntryLogbookPass->GetText());
486 return settings.WriteFile(Form("%s/MONITOR/%s", gSystem->Getenv("ALICE_ROOT"), ALIEVENTSERVER_CONF));
489 void AliEventServerPreferencesWindow::RestoreDefaults()
492 fEntryServerHost->SetText( DEFAULT_SERVER_HOST, kFALSE);
493 fEntryServerPort->SetText( Form("%d", DEFAULT_SERVER_PORT), kFALSE);
496 fEntryCDBDefaultStorage->SetText( DEFAULT_CDB_STORAGE, kFALSE);
497 fEntryCDBSpecStoragePath1->SetText( DEFAULT_CDB_SPEC_STORAGE_PATH1, kFALSE);
498 fEntryCDBSpecStorageValue1->SetText( DEFAULT_CDB_SPEC_STORAGE_VALUE1, kFALSE);
499 fEntryCDBSpecStoragePath2->SetText( DEFAULT_CDB_SPEC_STORAGE_PATH2, kFALSE);
500 fEntryCDBSpecStorageValue2->SetText(DEFAULT_CDB_SPEC_STORAGE_VALUE2, kFALSE);
501 fEntryCDBSpecStoragePath3->SetText( DEFAULT_CDB_SPEC_STORAGE_PATH3, kFALSE);
502 fEntryCDBSpecStorageValue3->SetText( DEFAULT_CDB_SPEC_STORAGE_VALUE3, kFALSE);
503 fEntryRecoRunQA->SetText( DEFAULT_QA_RUN, kFALSE );
504 fEntryRecoQARefDefStorage->SetText(DEFAULT_QAREF_STORAGE, kFALSE);
505 fChkRecoRunGlobalQA->SetOn(DEFAULT_QA_RUN_GLOBAL, kFALSE);
506 fChkRecoRunPlaneEff->SetOn(DEFAULT_RECO_RUN_PLANE_EFF, kFALSE);
507 fChkRecoWriteESDf->SetOn(DEFAULT_RECO_WRITE_ESDF, kFALSE);
508 fChkRecoWriteAlignment->SetOn(DEFAULT_RECO_WRITE_ALIGN, kFALSE);
509 fChkRecoCleanESD->SetOn(DEFAULT_RECO_CLEAN_ESD, kFALSE);
511 // parse reco run detectors from string
512 TString strRunDetectors( DEFAULT_RECO_DETECTORS );
513 TObjArray* arrRecoDets = strRunDetectors.Tokenize(" ");
515 for(int i=0; i<arrRecoDets->GetEntries(); ++i){
516 TObjString* objStr = (TObjString*)arrRecoDets->At(i);
517 if(objStr->GetString().BeginsWith("-")){ // detector is disabled
518 for(int j=0; j<fDetectors->GetEntries();++j){
519 TGCheckButton* bt = (TGCheckButton*)fDetectors->At(j);
520 TString btTitle(Form("-%s",bt->GetTitle()));
521 if(btTitle.CompareTo(objStr->GetString())==0) {// match
522 bt->SetOn(kFALSE); // uncheck detector button
527 else if(objStr->GetString().CompareTo("ALL")==0){
528 onCheckAllDetectors();
530 else{ // detector is enabled
531 for(int j=0; j<fDetectors->GetEntries();++j){
532 TGCheckButton* bt = (TGCheckButton*)fDetectors->At(j);
533 TString btTitle(bt->GetTitle());
534 if(btTitle.CompareTo(objStr->GetString())==0) {// match
535 bt->SetOn(kTRUE); // check detector
543 fEntryLogbookHost->SetText( DEFAULT_LOGBOOK_HOST, kFALSE);
544 fEntryLogbookPort->SetText( Form("%d", DEFAULT_LOGBOOK_PORT), kFALSE);
545 fEntryLogbookDB->SetText( DEFAULT_LOGBOOK_DB, kFALSE);
546 fEntryLogbookUser->SetText( DEFAULT_LOGBOOK_USER, kFALSE);
547 fEntryLogbookPass->SetText( DEFAULT_LOGBOOK_PASS, kFALSE);