00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "TGo4ConfigStep.h"
00015
00016 #include <QFileDialog>
00017
00018 #include "TClass.h"
00019 #include "Riostream.h"
00020
00021 #include "TGo4AnalysisStepStatus.h"
00022 #include "TGo4EventStoreParameter.h"
00023 #include "TGo4EventSourceParameter.h"
00024 #include "TGo4UserSourceParameter.h"
00025 #include "TGo4RevServParameter.h"
00026 #include "TGo4FileStoreParameter.h"
00027 #include "TGo4BackStoreParameter.h"
00028 #include "TGo4FileSourceParameter.h"
00029 #include "TGo4MbsFileParameter.h"
00030 #include "TGo4MbsStreamParameter.h"
00031 #include "TGo4MbsTransportParameter.h"
00032 #include "TGo4MbsEventServerParameter.h"
00033 #include "TGo4MbsRandomParameter.h"
00034 #include "Go4EventServerTypes.h"
00035 #include "TGo4AnalysisConfiguration.h"
00036
00037
00038 const char* TGo4MbsFile__fgcNOTAGFILE = "GO4-NOLMDTAG";
00039 const char* TGo4MbsFile__fgcLMDSUF = ".lmd";
00040 const char* TGo4MbsFile__fgcFILELISTSUF = ".lml";
00041
00042 enum SourceComboKinds {
00043 kind_RootFile = 0,
00044 kind_MbsFile = 1,
00045 kind_MbsStream = 2,
00046 kind_MbsTransport = 3,
00047 kind_MbsEvent = 4,
00048 kind_MbsREvent = 5,
00049 kind_MbsRandom = 6,
00050 kind_UserSource = 7
00051 };
00052
00053
00054 TGo4ConfigStep::TGo4ConfigStep( QWidget* parent, const char* name, Qt::WindowFlags fl )
00055 : QWidget( parent, fl )
00056 {
00057 setObjectName( name ? name : "Go4ConfigStep");
00058
00059 setupUi(this);
00060
00061 fxPanel = 0;
00062 fStepStatus = 0;
00063
00064 SpinBoxPortNumber->setVisible(false);
00065 TextLabelPortNumber->setVisible(false);
00066 SpinBoxRetryNumber->setVisible(false);
00067 TextLabelRetryNumber->setVisible(false);
00068 SpinBoxTimeout->setVisible(false);
00069 TextLabelTimeout->setVisible(false);
00070
00071 SpinBoxStartEvent->setVisible(false);
00072 SpinBoxStopEvent->setVisible(false);
00073 SpinBoxInterEvent->setVisible(false);
00074
00075 LineEditArgs->setVisible(false);
00076 TextLabelArgs->setVisible(false);
00077 LineEditTagfile->setVisible(false);
00078 TextLabelTagfile->setVisible(false);
00079
00080 for (int n=0;n<ParsSize;n++)
00081 fPars[n]=0;
00082
00083 fLastSrcKind = -1;
00084 fBlocked = 0;
00085 fExtra = false;
00086 ExtraBtn->setText(fExtra ? "-" : "+");
00087 }
00088
00089 TGo4ConfigStep::~TGo4ConfigStep()
00090 {
00091 for (int n=0;n<ParsSize;n++) {
00092 delete fPars[n];
00093 fPars[n] = 0;
00094 }
00095 }
00096
00097
00098 void TGo4ConfigStep::InputArguments(const QString& Arg)
00099 {
00100 TGo4EventSourceParameter* SourcePar=fStepStatus->GetSourcePar();
00101 int ParId=SourcePar->GetID();
00102 if (ParId==GO4EV_USER){
00103 TGo4UserSourceParameter* usrpar=dynamic_cast<TGo4UserSourceParameter*>(SourcePar);
00104 if (usrpar!=0)
00105 usrpar->SetExpression(Arg.trimmed().toLatin1().constData());
00106 }
00107 }
00108
00109 void TGo4ConfigStep::InputStateChanged(int )
00110 {
00111 bool stepon = EnableStepBox->isChecked();
00112 bool on = EnableSourceBox->isChecked();
00113
00114 fStepStatus->SetSourceEnabled(on);
00115 SourceBox->setEnabled(stepon && on);
00116
00117 fxPanel->ChangeTabTitle(this, fStepNumber);
00118 }
00119
00120 void TGo4ConfigStep::InputPortChanged(int port)
00121 {
00122 if (fBlocked) return;
00123
00124 TGo4EventSourceParameter* SourcePar = fStepStatus->GetSourcePar();
00125
00126 switch (SourcePar->GetID()) {
00127
00128 case GO4EV_MBS_TRANSPORT:
00129 case GO4EV_MBS_STREAM:
00130 case GO4EV_MBS_EVENTSERVER:
00131 case GO4EV_MBS_REVSERV: {
00132 TGo4MbsSourceParameter* par = dynamic_cast<TGo4MbsSourceParameter*>(SourcePar);
00133 if (par!=0)
00134 par->SetPort(port);
00135 break;
00136 }
00137
00138 case GO4EV_USER: {
00139 TGo4UserSourceParameter* usrpar=dynamic_cast<TGo4UserSourceParameter*>(SourcePar);
00140 if (usrpar!=0)
00141 usrpar->SetPort(port);
00142 break;
00143 }
00144
00145 default: {
00146
00147 break;
00148 }
00149 }
00150 }
00151
00152 void TGo4ConfigStep::RetryCntChanged(int cnt)
00153 {
00154 if (fBlocked) return;
00155
00156 TGo4EventSourceParameter* SourcePar = fStepStatus->GetSourcePar();
00157
00158 switch (SourcePar->GetID()) {
00159
00160 case GO4EV_MBS_TRANSPORT:
00161 case GO4EV_MBS_STREAM:
00162 case GO4EV_MBS_EVENTSERVER:
00163 case GO4EV_MBS_REVSERV: {
00164 TGo4MbsSourceParameter* par = dynamic_cast<TGo4MbsSourceParameter*>(SourcePar);
00165 if (par!=0)
00166 par->SetRetryCnt(cnt);
00167 break;
00168 }
00169
00170 default: {
00171
00172 break;
00173 }
00174 }
00175 }
00176
00177 void TGo4ConfigStep::InputSourceText(const QString& name)
00178 {
00179 if (fBlocked) return;
00180
00181 if (fStepStatus && fStepStatus->GetSourcePar())
00182 fStepStatus->GetSourcePar()->SetName(name.trimmed().toLatin1().constData());
00183
00184 if (EventSourceCombo->currentIndex() == kind_MbsFile) {
00185 bool islml = name.contains(TGo4MbsFile__fgcFILELISTSUF);
00186 LineEditTagfile->setVisible(!islml);
00187 TextLabelTagfile->setVisible(!islml);
00188
00189 SpinBoxStartEvent->setEnabled(!islml);
00190 SpinBoxStopEvent->setEnabled(!islml);
00191 SpinBoxInterEvent->setEnabled(!islml);
00192 }
00193 }
00194
00195 void TGo4ConfigStep::OutputStateChanged(int)
00196 {
00197 bool stepon = EnableStepBox->isChecked();
00198 bool on = EnableStoreBox->isChecked();
00199
00200 fStepStatus->SetStoreEnabled(on);
00201 StoreBox->setEnabled(stepon && on);
00202 StoreBox->setVisible(on);
00203
00204 fxPanel->ChangeTabTitle(this, fStepNumber);
00205
00206 adjustSize();
00207 parentWidget()->adjustSize();
00208 parentWidget()->parentWidget()->adjustSize();
00209
00210 fxPanel->adjustSize();
00211 fxPanel->parentWidget()->adjustSize();
00212 }
00213
00214 void TGo4ConfigStep::OutputNameText(const QString& Name)
00215 {
00216 fStepStatus->GetStorePar()->SetName(Name.trimmed().toLatin1().constData());
00217 }
00218
00219 void TGo4ConfigStep::StepStateChanged(int )
00220 {
00221 bool on = EnableStepBox->isChecked();
00222
00223 fStepStatus->SetProcessEnabled(on);
00224 EnableSourceBox->setEnabled(on);
00225 EnableStoreBox->setEnabled(on);
00226
00227 fxPanel->ChangeTabTitle(this, fStepNumber);
00228
00229 InputStateChanged(0);
00230 OutputStateChanged(0);
00231 }
00232
00233 void TGo4ConfigStep::SetStepStatus(TGo4AnalysisConfiguration* panel, TGo4AnalysisStepStatus* StepStatus, int number)
00234 {
00235 if (StepStatus==0) return;
00236
00237
00238 fxPanel = panel;
00239 fStepStatus = StepStatus;
00240 fStepNumber = number;
00241 fLastSrcKind = -1;
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260 int srckind = CurrentSourceKind();
00261 fBlocked++;
00262 EventSourceCombo->setCurrentIndex(srckind);
00263 fBlocked--;
00264
00265
00266
00267
00268
00269 TGo4EventStoreParameter* StorePar = fStepStatus->GetStorePar();
00270
00271 if (StorePar!=0)
00272 switch(StorePar->GetID()) {
00273 case GO4EV_FILE: {
00274 TGo4FileStoreParameter* fstor = dynamic_cast<TGo4FileStoreParameter*>(StorePar);
00275 SetFileStore(fstor->GetName(),
00276 fstor->IsOverwriteMode(),
00277 fstor->GetBufsize(),
00278 fstor->GetSplitlevel(),
00279 fstor->GetCompression());
00280 break;
00281 }
00282 case GO4EV_BACK: {
00283 TGo4BackStoreParameter* bstor = dynamic_cast<TGo4BackStoreParameter*>(StorePar);
00284 SetBackStore(bstor->GetName(),
00285 bstor->GetBufsize(),
00286 bstor->GetSplitlevel());
00287 break;
00288 }
00289 default:
00290 break;
00291 }
00292
00293
00294
00295
00296 SetStepControl(fStepStatus->IsProcessEnabled(),
00297 fStepStatus->IsSourceEnabled(),
00298 fStepStatus->IsStoreEnabled());
00299 }
00300
00301
00302 int TGo4ConfigStep::CurrentSourceKind()
00303 {
00304 if ((fStepStatus==0) || (fStepStatus->GetSourcePar()==0)) return kind_MbsFile;
00305
00306 switch(fStepStatus->GetSourcePar()->GetID()) {
00307 case GO4EV_FILE: return kind_RootFile;
00308 case GO4EV_MBS_FILE: return kind_MbsFile;
00309 case GO4EV_MBS_STREAM: return kind_MbsStream;
00310 case GO4EV_MBS_TRANSPORT: return kind_MbsTransport;
00311 case GO4EV_MBS_EVENTSERVER: return kind_MbsEvent;
00312 case GO4EV_MBS_REVSERV: return kind_MbsREvent;
00313 case GO4EV_MBS_RANDOM: return kind_MbsRandom;
00314 case GO4EV_USER: return kind_UserSource;
00315 }
00316
00317 return kind_MbsFile;
00318 }
00319
00320 void TGo4ConfigStep::ChangeSourceParameter(int kind)
00321 {
00322 if (fStepStatus==0) return;
00323
00324 TGo4EventSourceParameter* srcpar = fStepStatus->TakeSourcePar();
00325 bool delsrcpar(true);
00326 TGo4MbsSourceParameter* mbspar = dynamic_cast<TGo4MbsSourceParameter*> (srcpar);
00327
00328 if (fLastSrcKind >= 0) {
00329 if (fPars[fLastSrcKind]!=0) delete fPars[fLastSrcKind];
00330 fPars[fLastSrcKind] = srcpar;
00331 delsrcpar = false;
00332 }
00333
00334 if (fPars[kind]) {
00335 fStepStatus->SetSourcePar(fPars[kind]);
00336 fLastSrcKind = kind;
00337 if (delsrcpar) delete srcpar;
00338 return;
00339 }
00340
00341 TString filename, hostname;
00342 Int_t port(0);
00343
00344 switch(srcpar->GetID()) {
00345 case GO4EV_FILE:
00346 case GO4EV_MBS_FILE:
00347 filename = srcpar->GetName();
00348 break;
00349
00350 case GO4EV_MBS_STREAM:
00351 case GO4EV_MBS_TRANSPORT:
00352 case GO4EV_MBS_EVENTSERVER:
00353 case GO4EV_MBS_REVSERV:
00354 hostname = srcpar->GetName();
00355 port = mbspar ? mbspar->GetPort() : 0;
00356 break;
00357
00358 case GO4EV_MBS_RANDOM:
00359 break;
00360 case GO4EV_USER:
00361 break;
00362 default:
00363 break;
00364 }
00365
00366 TGo4EventSourceParameter* newpar = 0;
00367
00368 switch (kind) {
00369 case kind_RootFile:
00370 newpar = new TGo4FileSourceParameter(filename);
00371 break;
00372
00373 case kind_MbsFile:
00374 newpar = new TGo4MbsFileParameter(filename);
00375 break;
00376
00377 case kind_MbsStream:
00378 newpar = new TGo4MbsStreamParameter(hostname);
00379 break;
00380
00381 case kind_MbsTransport:
00382 newpar = new TGo4MbsTransportParameter(hostname);
00383 break;
00384
00385 case kind_MbsEvent:
00386 newpar = new TGo4MbsEventServerParameter(hostname);
00387 break;
00388
00389 case kind_MbsREvent:
00390 newpar = new TGo4RevServParameter(hostname);
00391 break;
00392
00393 case kind_MbsRandom:
00394 newpar = new TGo4MbsRandomParameter("random");
00395 break;
00396
00397 case kind_UserSource:
00398 newpar = new TGo4UserSourceParameter(filename,"",port);
00399 break;
00400 }
00401
00402 TGo4MbsSourceParameter* newmbspar = dynamic_cast<TGo4MbsSourceParameter*> (newpar);
00403
00404 if (newmbspar) {
00405 newmbspar->SetPort(port);
00406
00407 if (mbspar) {
00408 newmbspar->SetStartEvent(mbspar->GetStartEvent());
00409 newmbspar->SetStopEvent(mbspar->GetStopEvent());
00410 newmbspar->SetEventInterval(mbspar->GetEventInterval());
00411 }
00412 }
00413
00414 newpar->SetTimeout(srcpar->GetTimeout());
00415
00416 fPars[kind] = newpar;
00417
00418
00419 fStepStatus->SetSourcePar(fPars[kind]);
00420
00421 fLastSrcKind = kind;
00422
00423 if (delsrcpar) delete srcpar;
00424 }
00425
00426 void TGo4ConfigStep::SetSourceWidgets( const QString & name, int timeout)
00427 {
00428 SourceNameEdit->setText(name);
00429 SpinBoxTimeout->setValue(timeout);
00430 }
00431
00432 void TGo4ConfigStep::SetMbsSourceWidgets(int start, int stop, int interval, int port)
00433 {
00434 SpinBoxStartEvent->setValue(start);
00435 SpinBoxStopEvent->setValue(stop);
00436 SpinBoxInterEvent->setValue(interval);
00437 SpinBoxPortNumber->setValue(port);
00438 SpinBoxRetryNumber->setValue(0);
00439 }
00440
00441 void TGo4ConfigStep::SourceComboHighlighted(int kind)
00442 {
00443
00444 if (fBlocked == 0) ChangeSourceParameter(kind);
00445
00446 fBlocked++;
00447
00448
00449
00450 SpinBoxPortNumber->setVisible(false);
00451 TextLabelPortNumber->setVisible(false);
00452 SpinBoxRetryNumber->setVisible(false);
00453 TextLabelRetryNumber->setVisible(false);
00454 LineEditArgs->setVisible(false);
00455 TextLabelArgs->setVisible(false);
00456 LineEditTagfile->setVisible(false);
00457 TextLabelTagfile->setVisible(false);
00458
00459 SpinBoxStartEvent->setVisible(false);
00460 SpinBoxStopEvent->setVisible(false);
00461 SpinBoxInterEvent->setVisible(false);
00462 SpinBoxTimeout->setVisible(false);
00463 TextLabelTimeout->setVisible(false);
00464 FileNameBtn->setEnabled(false);
00465 MbsMonitorBtn->setEnabled(false);
00466
00467
00468
00469 TGo4EventSourceParameter* srcpar = fStepStatus->GetSourcePar();
00470
00471 SourceNameEdit->setText(srcpar->GetName());
00472 SpinBoxTimeout->setValue(srcpar->GetTimeout());
00473
00474 TGo4MbsSourceParameter* mbspar = dynamic_cast<TGo4MbsSourceParameter*> (srcpar);
00475
00476 if (mbspar) {
00477 SpinBoxStartEvent->setValue(mbspar->GetStartEvent());
00478 SpinBoxStopEvent->setValue(mbspar->GetStopEvent());
00479 SpinBoxInterEvent->setValue(mbspar->GetEventInterval());
00480 SpinBoxPortNumber->setValue(mbspar->GetPort());
00481 SpinBoxRetryNumber->setValue(mbspar->GetRetryCnt());
00482
00483
00484
00485 }
00486
00487 TGo4MbsFileParameter* mbsfilpar = dynamic_cast<TGo4MbsFileParameter*>(srcpar);
00488 TGo4UserSourceParameter* userpar = dynamic_cast<TGo4UserSourceParameter*>(srcpar);
00489
00490 switch (kind) {
00491 case kind_RootFile:
00492 FileNameBtn->setEnabled(true);
00493 break;
00494 case kind_MbsFile: {
00495
00496 FileNameBtn->setEnabled(true);
00497
00498 QString tagfile = mbsfilpar->GetTagName();
00499
00500 if(!tagfile.contains(TGo4MbsFile__fgcNOTAGFILE)) {
00501 LineEditTagfile->setText(tagfile);
00502
00503 } else {
00504 LineEditTagfile->setText("");
00505 }
00506
00507 LineEditTagfile->setVisible(fExtra);
00508 TextLabelTagfile->setVisible(fExtra);
00509
00510 SpinBoxStartEvent->setVisible(fExtra);
00511 SpinBoxStopEvent->setVisible(fExtra);
00512 SpinBoxInterEvent->setVisible(fExtra);
00513 break;
00514 }
00515 case kind_MbsStream:
00516 case kind_MbsTransport:
00517 case kind_MbsEvent:
00518 case kind_MbsREvent:
00519 TextLabelTimeout->setVisible(fExtra);
00520 SpinBoxTimeout->setVisible(fExtra);
00521 TextLabelPortNumber->setVisible(fExtra);
00522 SpinBoxPortNumber->setVisible(fExtra);
00523 TextLabelRetryNumber->setVisible(fExtra);
00524 SpinBoxRetryNumber->setVisible(fExtra);
00525 MbsMonitorBtn->setEnabled(kind != kind_MbsREvent);
00526 SpinBoxStartEvent->setVisible(fExtra);
00527 SpinBoxStopEvent->setVisible(fExtra);
00528 SpinBoxInterEvent->setVisible(fExtra);
00529 break;
00530
00531 case kind_MbsRandom:
00532 break;
00533
00534 case kind_UserSource:
00535 FileNameBtn->setEnabled(true);
00536 SpinBoxPortNumber->setValue(userpar->GetPort());
00537 LineEditArgs->setText(userpar->GetExpression());
00538 SpinBoxPortNumber->setVisible(fExtra);
00539 TextLabelPortNumber->setVisible(fExtra);
00540 LineEditArgs->setVisible(fExtra);
00541 TextLabelArgs->setVisible(fExtra);
00542 TextLabelTimeout->setVisible(fExtra);
00543 SpinBoxTimeout->setVisible(fExtra);
00544 break;
00545 }
00546
00547 fBlocked--;
00548
00549 adjustSize();
00550 parentWidget()->adjustSize();
00551 parentWidget()->parentWidget()->adjustSize();
00552
00553 fxPanel->adjustSize();
00554 fxPanel->parentWidget()->adjustSize();
00555 }
00556
00557 void TGo4ConfigStep::StoreComboHighlighted(int k)
00558 {
00559 if(k==0) {
00560 StoreNameEdit->setDisabled(false);
00561 TGo4FileStoreParameter* newpar1 = new TGo4FileStoreParameter(StoreNameEdit->text().toLatin1().constData());
00562 fStepStatus->SetStorePar(newpar1);
00563 delete newpar1;
00564 CompLevel->setDisabled(false);
00565 StoreOverwriteMode->setDisabled(false);
00566 FileNameOutput->setDisabled(false);
00567 } else
00568 if(k==1) {
00569 StoreNameEdit->setDisabled(true);
00570 TGo4BackStoreParameter *newpar3 = new TGo4BackStoreParameter(GetBackStoreName().toLatin1().constData());
00571 fStepStatus->SetStorePar(newpar3);
00572 delete newpar3;
00573 CompLevel->setDisabled(true);
00574 StoreOverwriteMode->setDisabled(true);
00575 FileNameOutput->setDisabled(true);
00576 }
00577 }
00578
00579 void TGo4ConfigStep::OutputFileDialog()
00580 {
00581 QFileDialog fd( this, "Select file name for step output",
00582 fxPanel->GetStorePath(), "Go4FileStore (*.root)");
00583 fd.setFileMode( QFileDialog::AnyFile);
00584 if ( fd.exec() != QDialog::Accepted ) return;
00585
00586 QStringList flst = fd.selectedFiles();
00587 if (flst.isEmpty()) return;
00588
00589 QString fileName = flst[0];
00590 fxPanel->SetStorePath(fd.directory().path());
00591 if(!fileName.endsWith(".root")) fileName.append(".root");
00592 StoreNameEdit->setText(fileName);
00593 }
00594
00595 void TGo4ConfigStep::StoreBufferSize(int t)
00596 {
00597 if(fStepStatus->GetStorePar()->InheritsFrom(TGo4FileStoreParameter::Class())){
00598 TGo4FileStoreParameter *StorePar=(TGo4FileStoreParameter *)fStepStatus->GetStorePar();
00599 StorePar->SetBufsize(1000*t);
00600 } else
00601 if (fStepStatus->GetStorePar()->InheritsFrom(TGo4BackStoreParameter::Class())){
00602 TGo4BackStoreParameter * StorePar = (TGo4BackStoreParameter *)fStepStatus->GetStorePar();
00603 StorePar->SetBufsize(1000*t);
00604 }
00605 }
00606
00607 void TGo4ConfigStep::StoreSplitLevel(int t)
00608 {
00609 if(fStepStatus->GetStorePar()->InheritsFrom(TGo4FileStoreParameter::Class())) {
00610 TGo4FileStoreParameter *StorePar=(TGo4FileStoreParameter *)fStepStatus->GetStorePar();
00611 StorePar->SetSplitlevel(t);
00612 } else
00613 if (fStepStatus->GetStorePar()->InheritsFrom(TGo4BackStoreParameter::Class())) {
00614 TGo4BackStoreParameter * StorePar = (TGo4BackStoreParameter *)fStepStatus->GetStorePar();
00615 StorePar->SetSplitlevel(t);
00616 }
00617 }
00618
00619 void TGo4ConfigStep::StoreCompLevel( int t)
00620 {
00621 if(fStepStatus->GetStorePar()->InheritsFrom(TGo4FileStoreParameter::Class())) {
00622 TGo4FileStoreParameter *StorePar=(TGo4FileStoreParameter *)fStepStatus->GetStorePar();
00623 StorePar->SetCompression(t);
00624 }
00625 }
00626
00627 void TGo4ConfigStep::StoreOverWrite( bool overwrite)
00628 {
00629 if(fStepStatus->GetStorePar()->InheritsFrom(TGo4FileStoreParameter::Class())){
00630 TGo4FileStoreParameter *StorePar=dynamic_cast <TGo4FileStoreParameter *> (fStepStatus->GetStorePar());
00631 if(overwrite)StorePar->SetOverwriteMode(kTRUE);
00632 else StorePar->SetOverwriteMode(kFALSE);
00633 }
00634 }
00635
00636
00637 void TGo4ConfigStep::InputTagfile( const QString & tag )
00638 {
00639 if (fBlocked) return;
00640 TGo4EventSourceParameter* SourcePar=fStepStatus->GetSourcePar();
00641 int ParId=SourcePar->GetID();
00642 if (ParId!=GO4EV_MBS_FILE) return;
00643
00644 TGo4MbsFileParameter* filpar = dynamic_cast<TGo4MbsFileParameter*>(SourcePar);
00645
00646 if (filpar==0) return;
00647
00648 if(tag.isEmpty())
00649 filpar->SetTagName(TGo4MbsFile__fgcNOTAGFILE);
00650 else
00651 filpar->SetTagName(tag.trimmed().toLatin1().constData());
00652 }
00653
00654 void TGo4ConfigStep::ChangeStartEvent( int num )
00655 {
00656 if (fBlocked) return;
00657
00658
00659 TGo4MbsSourceParameter* par =
00660 dynamic_cast<TGo4MbsSourceParameter*>(fStepStatus->GetSourcePar());
00661 if (par!=0) par->SetStartEvent(num);
00662 }
00663
00664 void TGo4ConfigStep::ChangeStopEvent( int num )
00665 {
00666 if (fBlocked) return;
00667
00668
00669 TGo4MbsSourceParameter* par =
00670 dynamic_cast<TGo4MbsSourceParameter*>(fStepStatus->GetSourcePar());
00671 if (par!=0) par->SetStopEvent(num);
00672 }
00673
00674 void TGo4ConfigStep::ChangeEventInterval( int num )
00675 {
00676 if (fBlocked) return;
00677
00678
00679 TGo4MbsSourceParameter* par =
00680 dynamic_cast<TGo4MbsSourceParameter*>(fStepStatus->GetSourcePar());
00681 if (par!=0) par->SetEventInterval(num);
00682 }
00683
00684 void TGo4ConfigStep::ChangeSourceTimeout( int tim )
00685 {
00686 if (fBlocked) return;
00687
00688 TGo4EventSourceParameter* sourcepar = fStepStatus->GetSourcePar();
00689 if (sourcepar!=0)
00690 sourcepar->SetTimeout(tim);
00691 }
00692
00693 void TGo4ConfigStep::InputFileDialog()
00694 {
00695 QString filters;
00696 bool mbsfilemode = false;
00697 if(fStepStatus!=0) {
00698 TGo4EventSourceParameter* sourcepar = fStepStatus->GetSourcePar();
00699 if(sourcepar->InheritsFrom(TGo4FileSourceParameter::Class()))
00700 filters = "Go4FileSource (*.root)";
00701 else
00702 if (sourcepar->InheritsFrom(TGo4MbsFileParameter::Class())) {
00703 mbsfilemode=true;
00704 filters="Go4MbsFile (*";
00705 filters+=TGo4MbsFile__fgcLMDSUF;
00706 filters+=" *";
00707 filters+=QString(TGo4MbsFile__fgcLMDSUF).toUpper();
00708 filters+=");;Go4 list mode list (*";
00709 filters+=TGo4MbsFile__fgcFILELISTSUF;
00710 filters+=")";
00711
00712 }
00713 else
00714 if (sourcepar->InheritsFrom(TGo4UserSourceParameter::Class())) {
00715 filters = "all files (*.*)";
00716 }
00717 else
00718 std::cout <<"Unknown sourcepar " <<sourcepar->ClassName() << std::endl;
00719 }
00720
00721
00722 QFileDialog fd( this, "Select file name for step input",
00723 fxPanel->GetSourcePath(), filters);
00724 fd.setFileMode(QFileDialog::ExistingFile);
00725
00726 if ( fd.exec() != QDialog::Accepted ) return;
00727
00728 QStringList flst = fd.selectedFiles();
00729 if (flst.isEmpty()) return;
00730
00731 QString fileName = flst[0];
00732 fxPanel->SetSourcePath(fd.directory().path());
00733 SourceNameEdit->setText(fileName);
00734 if(mbsfilemode) {
00735 bool islml = fd.selectedNameFilter().contains(TGo4MbsFile__fgcFILELISTSUF);
00736
00737 LineEditTagfile->setVisible(!islml);
00738 TextLabelTagfile->setVisible(!islml);
00739 SpinBoxStartEvent->setEnabled(!islml);
00740 SpinBoxStopEvent->setEnabled(!islml);
00741 SpinBoxInterEvent->setEnabled(!islml);
00742 }
00743 }
00744
00745 QString TGo4ConfigStep::GetStepName()
00746 {
00747 return fStepStatus->GetName();
00748 }
00749
00750 QString TGo4ConfigStep::GetTabTitle()
00751 {
00752 QString res = fStepStatus->GetName();
00753 if (fStepNumber>=0) {
00754 res += " ";
00755 res += EnableStepBox->isChecked() ? "x" : "o";
00756 res += EnableSourceBox->isChecked() ? "x" : "o";
00757 res += EnableStoreBox->isChecked() ? "x" : "o";
00758 }
00759 return res;
00760 }
00761
00762 void TGo4ConfigStep::SetStepControl(bool process, bool source, bool store)
00763 {
00764 EnableStepBox->setChecked(process);
00765 EnableSourceBox->setChecked(source);
00766 EnableStoreBox->setChecked(store);
00767
00768 StepStateChanged(0);
00769 }
00770
00771 void TGo4ConfigStep::GetStepControl(bool& process, bool& source, bool& store)
00772 {
00773 process = EnableStepBox->isChecked();
00774 source = EnableSourceBox->isChecked();
00775 store = EnableStoreBox->isChecked();
00776 }
00777
00778 void TGo4ConfigStep::SetFileSource()
00779 {
00780 EventSourceCombo->setCurrentIndex(kind_RootFile);
00781 }
00782
00783 void TGo4ConfigStep::SetMbsFileSource(const QString& TagFile)
00784 {
00785 EventSourceCombo->setCurrentIndex(kind_MbsFile);
00786
00787 if(!TagFile.contains(TGo4MbsFile__fgcNOTAGFILE))
00788 LineEditTagfile->setText(TagFile);
00789 else
00790 LineEditTagfile->setText("");
00791 }
00792
00793 void TGo4ConfigStep::SetMbsStreamSource()
00794 {
00795 EventSourceCombo->setCurrentIndex(kind_MbsStream);
00796 }
00797
00798 void TGo4ConfigStep::SetMbsTransportSource()
00799 {
00800 EventSourceCombo->setCurrentIndex(kind_MbsTransport);
00801 }
00802
00803 void TGo4ConfigStep::SetMbsEventServerSource()
00804 {
00805 EventSourceCombo->setCurrentIndex(kind_MbsEvent);
00806 }
00807
00808 void TGo4ConfigStep::SetMbsRevServSource(int port)
00809 {
00810 EventSourceCombo->setCurrentIndex(kind_MbsREvent);
00811
00812 SpinBoxPortNumber->setValue(port>0 ? port : 0);
00813 }
00814
00815 void TGo4ConfigStep::SetMbsPort(int port)
00816 {
00817 SpinBoxPortNumber->setValue(port > 0 ? port : 0);
00818 }
00819
00820 void TGo4ConfigStep::SetMbsRetryCnt(int retry)
00821 {
00822 SpinBoxRetryNumber->setValue(retry > 0 ? retry : 0);
00823 }
00824
00825
00826 void TGo4ConfigStep::SetRandomSource()
00827 {
00828 EventSourceCombo->setCurrentIndex(kind_MbsRandom);
00829 }
00830
00831 void TGo4ConfigStep::SetUserSource(int port, QString expr)
00832 {
00833 EventSourceCombo->setCurrentIndex(kind_UserSource);
00834
00835 SpinBoxPortNumber->setValue(port);
00836 LineEditArgs->setText(expr);
00837 }
00838
00839 int TGo4ConfigStep::GetSourceSetup(QString& name, int& timeout, int& start, int& stop, int& interval, int& nport, int & nretry)
00840 {
00841 name = SourceNameEdit->text();
00842 timeout = SpinBoxTimeout->value();
00843 start = SpinBoxStartEvent->value();
00844 stop = SpinBoxStopEvent->value();
00845 interval = SpinBoxInterEvent->value();
00846 nport = -1;
00847 nretry = 0;
00848 switch (fStepStatus->GetSourcePar()->GetID()) {
00849 case GO4EV_MBS_TRANSPORT:
00850 case GO4EV_MBS_STREAM:
00851 case GO4EV_MBS_EVENTSERVER:
00852 case GO4EV_MBS_REVSERV: {
00853 TGo4MbsSourceParameter* par = dynamic_cast<TGo4MbsSourceParameter*>(fStepStatus->GetSourcePar());
00854 if (par!=0) {
00855 nport = SpinBoxPortNumber->value();
00856 nretry = SpinBoxRetryNumber->value();
00857 }
00858 break;
00859 }
00860 }
00861 return EventSourceCombo->currentIndex();
00862 }
00863
00864 void TGo4ConfigStep::GetMbsFileSource(QString& TagFile)
00865 {
00866 TagFile = LineEditTagfile->text();
00867
00868 }
00869
00870 void TGo4ConfigStep::GetUserSource(int& port, QString& expr)
00871 {
00872 port = SpinBoxPortNumber->value();
00873 expr = LineEditArgs->text();
00874 }
00875
00876 void TGo4ConfigStep::SetFileStore(QString name, bool overwrite, int bufsize, int splitlevel, int compression)
00877 {
00878 StoreNameEdit->setEnabled(true);
00879 StoreNameEdit->setText(name);
00880 OutputCombo->setCurrentIndex(0);
00881 StoreOverwriteMode->setChecked(overwrite);
00882 StoreOverwriteMode->setEnabled(true);
00883 BufferSize->setValue(bufsize/1000);
00884 SplitLevel->setValue(splitlevel);
00885 CompLevel->setValue(compression);
00886 CompLevel->setEnabled(true);
00887 FileNameOutput->setEnabled(true);
00888 StoreComboHighlighted(0);
00889 }
00890
00891 void TGo4ConfigStep::SetBackStore(QString name, int bufsize, int splitlevel)
00892 {
00893 StoreNameEdit->setEnabled(false);
00894 StoreNameEdit->setText(GetBackStoreName());
00895 OutputCombo->setCurrentIndex(1);
00896 BufferSize->setValue(bufsize/1000);
00897 SplitLevel->setValue(splitlevel);
00898 StoreOverwriteMode->setEnabled(false);
00899 CompLevel->setEnabled(false);
00900 FileNameOutput->setEnabled(false);
00901 StoreComboHighlighted(1);
00902 }
00903
00904 QString TGo4ConfigStep::GetBackStoreName()
00905 {
00906 QString name = "BackStoreTree_";
00907 name += GetStepName();
00908 return name;
00909 }
00910
00911 int TGo4ConfigStep::GetStoreSetup(QString& name)
00912 {
00913 int typ = OutputCombo->currentIndex();
00914 if (typ==1) name = GetBackStoreName();
00915 else name = StoreNameEdit->text();
00916 return typ;
00917 }
00918
00919 void TGo4ConfigStep::GetFileStore(bool& overwrite, int& bufsize, int& splitlevel, int& compression)
00920 {
00921 overwrite = StoreOverwriteMode->isChecked();
00922 bufsize = BufferSize->value() * 1000;
00923 splitlevel = SplitLevel->value();
00924 compression = CompLevel->value();
00925 }
00926
00927 void TGo4ConfigStep::GetBackStore(int& bufsize, int& splitlevel)
00928 {
00929 bufsize = BufferSize->value() * 1000;
00930 splitlevel = SplitLevel->value();
00931 }
00932
00933 void TGo4ConfigStep::MbsMonitorBtn_clicked()
00934 {
00935 if (fxPanel!=0)
00936 fxPanel->DisplayMbsMonitor(SourceNameEdit->text());
00937 }
00938
00939 void TGo4ConfigStep::ExtraBtn_clicked()
00940 {
00941 fExtra = !fExtra;
00942 ExtraBtn->setText(fExtra ? "-" : "+");
00943
00944 fBlocked++;
00945
00946 SourceComboHighlighted(EventSourceCombo->currentIndex());
00947
00948 fBlocked--;
00949 }