/[PAMELA software]/eventviewer/flight/src/FEVpamevcontrol.cpp
ViewVC logotype

Diff of /eventviewer/flight/src/FEVpamevcontrol.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by mocchiut, Tue Mar 20 12:49:56 2007 UTC revision 1.12 by mocchiut, Wed Jan 11 16:27:33 2012 UTC
# Line 46  char* operator+( std::streampos&, char* Line 46  char* operator+( std::streampos&, char*
46  #include <TArrow.h>  #include <TArrow.h>
47  #include <TStyle.h>  #include <TStyle.h>
48  //  //
49    #include <PamLevel2.h>
50    //
51  #include <FEVpamevcontrol.h>  #include <FEVpamevcontrol.h>
52  //  //
53  ClassImp(PAMevcontrol);  ClassImp(PAMevcontrol);
# Line 102  PAMevcontrol::PAMevcontrol(const TGWindo Line 104  PAMevcontrol::PAMevcontrol(const TGWindo
104    cvar = &var;    cvar = &var;
105    thefigure = &figure;    thefigure = &figure;
106    //    //
107    cframe1 = new TGCompositeFrame(this, 280, 40, kVerticalFrame);    cframe1 = new TGCompositeFrame(this, 280, 60, kVerticalFrame);
108    TGCompositeFrame *cframe2 = new TGCompositeFrame(this, 280, 60, kVerticalFrame);    TGCompositeFrame *cframe2 = new TGCompositeFrame(this, 280, 60, kVerticalFrame);
109    TGCompositeFrame *cframe3 = new TGCompositeFrame(this, 280, 60, kVerticalFrame);    TGCompositeFrame *cframe3 = new TGCompositeFrame(this, 280, 60, kVerticalFrame);
110    TGCompositeFrame *cframe4 = new TGCompositeFrame(this, 280, 60, kVerticalFrame);    TGCompositeFrame *cframe4 = new TGCompositeFrame(this, 280, 60, kVerticalFrame);
# Line 121  PAMevcontrol::PAMevcontrol(const TGWindo Line 123  PAMevcontrol::PAMevcontrol(const TGWindo
123    TGHorizontalFrame *htext4 = new TGHorizontalFrame(jumpf,400,80);    TGHorizontalFrame *htext4 = new TGHorizontalFrame(jumpf,400,80);
124    TGHorizontalFrame *hframe = new TGHorizontalFrame(this,400,800);    TGHorizontalFrame *hframe = new TGHorizontalFrame(this,400,800);
125    for (Int_t fr=0; fr<12; fr++) hframedec[fr] = new TGHorizontalFrame(gf, 7, 7);    for (Int_t fr=0; fr<12; fr++) hframedec[fr] = new TGHorizontalFrame(gf, 7, 7);
126    TGHorizontalFrame *hframe3 = new TGHorizontalFrame(gf2, 280, 40);    TGHorizontalFrame *hframe3 = new TGHorizontalFrame(gf2, 280, 60);
127    TGHorizontalFrame *hframe4 = new TGHorizontalFrame(gf2,280,10);    TGHorizontalFrame *hframe4 = new TGHorizontalFrame(gf2,280,10);
128    TGVerticalFrame *hframe5 = new TGVerticalFrame(hframe4, 280, 40);    TGVerticalFrame *hframe5 = new TGVerticalFrame(hframe4, 280, 60);
129    TGHorizontalFrame *hfrprog = new TGHorizontalFrame(this,400,800);    TGHorizontalFrame *hfrprog = new TGHorizontalFrame(this,400,800);
130    //    //
131    TGTextEntry *fText = new TGTextEntry(htext, new TGTextBuffer(20),-1);    TGTextEntry *fText = new TGTextEntry(htext, new TGTextBuffer(20),-1);
# Line 265  PAMevcontrol::PAMevcontrol(const TGWindo Line 267  PAMevcontrol::PAMevcontrol(const TGWindo
267    // Software infos    // Software infos
268    //    //
269    fshowsi = new TGTextButton(hframedec[9], "Show Data");      fshowsi = new TGTextButton(hframedec[9], "Show Data");  
270    fshowsi->Connect("Clicked()","PAMevcontrol", this,"showorbdata()");    fshowsi->Connect("Clicked()","PAMevcontrol", this,"showsidata()");
271    if ( !cvar->RUN ) fshoworb->SetState(kButtonDisabled);    if ( !cvar->RUN ) fshoworb->SetState(kButtonDisabled);
272    hframedec[9]->AddFrame(fshoworb, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5));    hframedec[9]->AddFrame(fshoworb, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5));
273    //    //
274    // All data    // All data
275    //    //
276    fshowall = new TGTextButton(hframedec[10], "Show Data");      fshowall = new TGTextButton(hframedec[10], "Show Data");  
277    fshowall->Connect("Clicked()","PAMevcontrol", this,"showorbdata()");    fshowall->Connect("Clicked()","PAMevcontrol", this,"showalldata()");
278    hframedec[10]->AddFrame(fshowall, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,5,5,5));    hframedec[10]->AddFrame(fshowall, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,5,5,5));
279    //    //
280    //  for (Int_t fr=0; fr<11; fr++) gf->AddFrame(hframedec[fr], new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,1,1,1,1));    //  for (Int_t fr=0; fr<11; fr++) gf->AddFrame(hframedec[fr], new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,1,1,1,1));
# Line 286  PAMevcontrol::PAMevcontrol(const TGWindo Line 288  PAMevcontrol::PAMevcontrol(const TGWindo
288    fchkinfo = new TGCheckButton(hframe3, "Infos");      fchkinfo = new TGCheckButton(hframe3, "Infos");  
289    fchkinfo->Connect("Clicked()","PAMevcontrol",this,"chkinfo()");      fchkinfo->Connect("Clicked()","PAMevcontrol",this,"chkinfo()");  
290    if ( cvar->INFOS ) fchkinfo->SetState(kButtonDown);    if ( cvar->INFOS ) fchkinfo->SetState(kButtonDown);
291    hframe3->AddFrame(fchkinfo, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,0,5,5,5));    hframe3->AddFrame(fchkinfo, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,0,1,5,5));
292    //    //
293    fchknames = new TGCheckButton(hframe3, "Names");      fchknames = new TGCheckButton(hframe3, "Names");  
294    fchknames->Connect("Clicked()","PAMevcontrol",this,"chknames()");      fchknames->Connect("Clicked()","PAMevcontrol",this,"chknames()");  
295    if ( cvar->VINFOS ) fchknames->SetState(kButtonDown);    if ( cvar->VINFOS ) fchknames->SetState(kButtonDown);
296    hframe3->AddFrame(fchknames, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,5,5,5));    hframe3->AddFrame(fchknames, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,0,1,5,5));
297    
298    fchkpalette = new TGCheckButton(hframe3, "Palette");      fchkpalette = new TGCheckButton(hframe3, "Palette");  
299    fchkpalette->Connect("Clicked()","PAMevcontrol",this,"chkpalette()");      fchkpalette->Connect("Clicked()","PAMevcontrol",this,"chkpalette()");  
300    if ( cvar->PALETTE) fchkpalette->SetState(kButtonDown);    if ( cvar->PALETTE) fchkpalette->SetState(kButtonDown);
301    hframe3->AddFrame(fchkpalette, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,10,5,5,5));    hframe3->AddFrame(fchkpalette, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,0,2,5,5));
302    
303      fchktrigger = new TGCheckButton(hframe3, "Trigger");  
304      fchktrigger->Connect("Clicked()","PAMevcontrol",this,"chktrigger()");  
305      if ( cvar->PATTRIG) fchktrigger->SetState(kButtonDown);
306      hframe3->AddFrame(fchktrigger, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,1,2,5,5));
307    
308    gf2->AddFrame(hframe3, new TGLayoutHints(kLHintsExpandX));    gf2->AddFrame(hframe3, new TGLayoutHints(kLHintsExpandX));
309    //    //
310    TGVButtonGroup *group = new TGVButtonGroup(hframe4);    TGVButtonGroup *group = new TGVButtonGroup(hframe4);
# Line 308  PAMevcontrol::PAMevcontrol(const TGWindo Line 317  PAMevcontrol::PAMevcontrol(const TGWindo
317    };    };
318    bwc0->Connect("Pressed()", "PAMevcontrol",this,"radiocolor()");    bwc0->Connect("Pressed()", "PAMevcontrol",this,"radiocolor()");
319    bwc1->Connect("Pressed()", "PAMevcontrol",this,"radiobw()");    bwc1->Connect("Pressed()", "PAMevcontrol",this,"radiobw()");
320    hframe4->AddFrame(group,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,1,5,5,5));    hframe4->AddFrame(group,new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5));
321    //    //
322    //    //
323    ftrks4 = new TGCheckButton(hframe5, "Track in S4/ND");      //  ftrks4 = new TGCheckButton(hframe5, "Track in S4/ND");  
324    ftrks4->Connect("Clicked()","PAMevcontrol",this,"radiotrack()");      //  ftrks4->Connect("Clicked()","PAMevcontrol",this,"radiotrack()");  
325    if ( cvar->tracknds4) ftrks4->SetState(kButtonDown);    //  if ( cvar->tracknds4) ftrks4->SetState(kButtonDown);
326    hframe5->AddFrame(ftrks4, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5));    //  hframe5->AddFrame(ftrks4, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5));
327    ffl0 = new TGCheckButton(hframe5, "Force LEVEL0");  
328      fgetl0 = new TGTextButton(hframe5, "Get L0 file");  
329      fgetl0->Connect("Clicked()","PAMevcontrol", this,"getl0file()");
330      hframe5->AddFrame(fgetl0, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,5,5,5));
331    
332      ffl0 = new TGCheckButton(hframe5, "Force RAW");
333    ffl0->Connect("Clicked()","PAMevcontrol",this,"forcel0()");    ffl0->Connect("Clicked()","PAMevcontrol",this,"forcel0()");
334    if ( cvar->fl0 ) ffl0->SetState(kButtonDown);    if ( cvar->fl0 ) ffl0->SetState(kButtonDown);
335    if ( !cvar->fl0 ) ffl0->SetState(kButtonUp);    if ( !cvar->fl0 ) ffl0->SetState(kButtonUp);
336    hframe5->AddFrame(ffl0, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,2,5,5));    hframe5->AddFrame(ffl0, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,2,5,5,5));
337    //    //
338    hframe4->AddFrame(hframe5, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,10,5,5,5));    hframe4->AddFrame(hframe5, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,10,5,5,5));
339    gf2->AddFrame(hframe4, new TGLayoutHints(kLHintsExpandX));    gf2->AddFrame(hframe4, new TGLayoutHints(kLHintsExpandX));
# Line 434  PAMevcontrol::PAMevcontrol(const TGWindo Line 448  PAMevcontrol::PAMevcontrol(const TGWindo
448    //    //
449  }  }
450    
451    void PAMevcontrol::Refresh(){
452      // bah
453      return;
454      this->Clear();
455      MapSubwindows();
456      // Initialize the layout algorithm
457      Resize(GetDefaultSize());
458      // Map main frame
459      MapWindow();  
460    }
461    
462  void PAMevcontrol::DIALOG(Int_t ty, TString warn){      void PAMevcontrol::DIALOG(Int_t ty, TString warn){    
463      //      //
464      // ty = 0 -> INFO, ty = 1 -> WARNING, ty = 3 -> ERROR      // ty = 0 -> INFO, ty = 1 -> WARNING, ty = 2 -> ERROR
465      //      //
466      Int_t retval;      Int_t retval;
467      TString title;      TString title;
468      EMsgBoxIcon mb_icon = kMBIconStop;      EMsgBoxIcon mb_icon = kMBIconStop;
469      if ( ty == 0 ){      if ( ty == 2 || ty == 3 ){
470          if ( ty == 2 ){
471            title="ERROR!!";
472            mb_icon = kMBIconStop;
473            new TGMsgBox(gClient->GetRoot(), this, title.Data(), warn.Data(), mb_icon, kMBOk, &retval);
474          } else {
475            title="HELP";
476            mb_icon = kMBIconQuestion;
477            new TGMsgBox(gClient->GetRoot(), this, title.Data(), warn.Data(), mb_icon, kMBOk, &retval);
478          };
479        } else {
480          if ( ty == 0 ){
481          title="INFO";          title="INFO";
482          mb_icon = kMBIconAsterisk;          mb_icon = kMBIconAsterisk;
483      };        };
484      if ( ty == 1 ){        if ( ty == 1 ){
485          title="WARNING!";          title="WARNING!";
486          mb_icon = kMBIconExclamation;          mb_icon = kMBIconExclamation;
487          };      
488          if ( ty == 4 ){
489            title="DATA";
490            mb_icon = kMBIconExclamation;
491          };
492          const TGPicture *icon_pic;
493          switch (mb_icon) {
494          case kMBIconStop:
495            icon_pic = gClient->GetPicture("mb_stop_s.xpm");
496            if (!icon_pic) Error("TGMsgBox", "mb_stop_s.xpm not found");
497            break;
498            
499          case kMBIconQuestion:
500            icon_pic = gClient->GetPicture("mb_question_s.xpm");
501            if (!icon_pic) Error("TGMsgBox", "mb_question_s.xpm not found");
502            break;
503            
504          case kMBIconExclamation:
505            icon_pic = gClient->GetPicture("mb_exclamation_s.xpm");
506            if (!icon_pic) Error("TGMsgBox", "mb_exclamation_s.xpm not found");
507            break;
508            
509          case kMBIconAsterisk:
510            icon_pic = gClient->GetPicture("mb_asterisk_s.xpm");
511            if (!icon_pic) Error("TGMsgBox", "mb_asterisk_s.xpm not found");
512            break;
513            
514          default:
515            icon_pic = 0;
516            break;
517          }
518          //
519          if ( ty == 4 ){// non funziona il recupero dei puntatori a questi oggetti come e` possibile?
520            //      gObjectTable->Print();
521            TGLabel *la=dynamic_cast<TGLabel*>(gDirectory->FindObject("la"));
522            TGHorizontalFrame *fLabelFrame=dynamic_cast<TGHorizontalFrame*>(gDirectory->FindObject("fLabelFrame"));
523            TGTransientFrame *compofra=dynamic_cast<TGTransientFrame*>(gDirectory->FindObject("compofra"));
524            if ( la ) la->Delete();
525            if ( fLabelFrame ) fLabelFrame->Delete();
526            if ( compofra ){
527              compofra->DestroyWindow();
528              compofra->Delete();  
529            };
530          };
531          TGTransientFrame *compofra = new TGTransientFrame(gClient->GetRoot(), 0, 200, 80, kHorizontalFrame);      
532          TGHorizontalFrame *fIconFrame = NULL;
533          TGIcon *fIcon = NULL;
534          if ( ty != 4 ){
535            compofra->DontCallClose();      
536            fIconFrame = new TGHorizontalFrame(compofra, 98, 78);
537            fIcon = new TGIcon(fIconFrame, icon_pic, icon_pic->GetWidth(), icon_pic->GetHeight());
538            fIconFrame->AddFrame(fIcon, new TGLayoutHints(kLHintsCenterX|kLHintsCenterY, 1, 1, 1, 1));
539            compofra->AddFrame(fIconFrame, new TGLayoutHints(kLHintsCenterX|kLHintsCenterY, 1, 1, 1, 1));
540          };
541          //
542          TGHorizontalFrame *fLabelFrame = new TGHorizontalFrame(compofra, 98, 78);
543          TGLabel *la=new TGLabel(fLabelFrame,warn.Data());
544          la->SetTextJustify(kLHintsCenterX);
545          fLabelFrame->AddFrame(la, new TGLayoutHints(kLHintsCenterX|kLHintsCenterY, 1, 1, 1, 1));
546          compofra->AddFrame(fLabelFrame, new TGLayoutHints(kLHintsCenterX|kLHintsCenterY, 1, 1, 1, 1));
547          //                
548          compofra->SetWindowName(title.Data());
549          compofra->MapSubwindows();
550          if ( ty != 4 ){
551            compofra->Resize(compofra->GetDefaultWidth(),80);
552          } else {
553            compofra->Resize(compofra->GetDefaultSize());
554          };
555          compofra->CenterOnParent();
556          compofra->MapWindow();
557          //
558          if ( ty != 4 ){
559            Int_t kkk = 0;
560            while ( kkk < 200 ){
561              gSystem->ProcessEvents();
562              gSystem->Sleep(10);
563              kkk++;
564            };
565          };
566          if ( compofra && ty != 4 ){
567            la->Delete();
568            fLabelFrame->Delete();
569            if ( fIcon ) fIcon->Delete();
570            if ( fIconFrame ) fIconFrame->Delete();
571            compofra->DestroyWindow();
572            compofra->Delete();    
573          };
574      };      };
575      if ( ty == 2 ){      //
         title="ERROR!!";  
         mb_icon = kMBIconStop;  
     };  
     new TGMsgBox(gClient->GetRoot(), this, title.Data(), warn.Data(), mb_icon, kMBOk, &retval);  
576  }  }
577    
578  void PAMevcontrol::refreshdec(Int_t n){  void PAMevcontrol::refreshdec(Int_t n){
# Line 469  void PAMevcontrol::refreshdec(Int_t n){ Line 588  void PAMevcontrol::refreshdec(Int_t n){
588    
589    
590  void PAMevcontrol::showorbdata(){  void PAMevcontrol::showorbdata(){
591    printf("orb \n");    cvar->showorb = !cvar->showorb;
592      if ( !cvar->showorb ) fshoworb->SetText("Show Data");
593      if ( cvar->showorb ) fshoworb->SetText("Hide Data");
594      //  printf("orb \n");
595  };  };
596    
597  void PAMevcontrol::showtrgdata(){  void PAMevcontrol::showtrgdata(){
598    printf("trg \n");    cvar->showtrg = !cvar->showtrg;
599      if ( !cvar->showtrg ) fshowtrg->SetText("Show Data");
600      if ( cvar->showtrg ) fshowtrg->SetText("Hide Data");
601      //  printf("trg \n");
602  };  };
603    
604  void PAMevcontrol::showrundata(){  void PAMevcontrol::showrundata(){
605    printf("run \n");    cvar->showrun = !cvar->showrun;
606      if ( !cvar->showrun ) fshowrun->SetText("Show Data");
607      if ( cvar->showrun ) fshowrun->SetText("Hide Data");
608      //  printf("run \n");
609  };  };
610    
611  void PAMevcontrol::showcaldata(){  void PAMevcontrol::showcaldata(){
612    printf("cal \n");    cvar->showcal = !cvar->showcal;
613      if ( !cvar->showcal ) fshowcal->SetText("Show Data");
614      if ( cvar->showcal ) fshowcal->SetText("Hide Data");
615      //  printf("cal \n");
616  };  };
617    
618  void PAMevcontrol::chkcalost(){  void PAMevcontrol::chkcalost(){
619    if ( cvar->CALO ) {    if ( cvar->CALOT ) {
620      cvar->CALO = 0;      cvar->CALOT = 0;
621    } else {    } else {
622      cvar->CALO = 1;      cvar->CALOT = 1;
623    };    };
624    cvar->i--;    cvar->i--;
625    cvar->nevents = 0;    cvar->nevents = 0;
# Line 498  void PAMevcontrol::chkcalost(){ Line 629  void PAMevcontrol::chkcalost(){
629  };  };
630    
631  void PAMevcontrol::showtrkdata(){  void PAMevcontrol::showtrkdata(){
632    printf("trk \n");    cvar->showtrk = !cvar->showtrk;
633      if ( !cvar->showtrk ) fshowtrk->SetText("Show Data");
634      if ( cvar->showtrk ) fshowtrk->SetText("Hide Data");
635      //  printf("trk \n");
636  };  };
637    
638  void PAMevcontrol::showtofdata(){  void PAMevcontrol::showtofdata(){
639    printf("tof \n");    cvar->showtof = !cvar->showtof;
640      if ( !cvar->showtof ) fshowtof->SetText("Show Data");
641      if ( cvar->showtof ) fshowtof->SetText("Hide Data");
642      //  printf("tof \n");
643  };  };
644    
645  void PAMevcontrol::showacdata(){  void PAMevcontrol::showacdata(){
646    printf("ac \n");    cvar->showac = !cvar->showac;
647      if ( !cvar->showac ) fshowac->SetText("Show Data");
648      if ( cvar->showac ) fshowac->SetText("Hide Data");
649      //  printf("ac \n");
650  };  };
651    
652  void PAMevcontrol::shownddata(){  void PAMevcontrol::shownddata(){
653    printf("nd \n");    cvar->shownd = !cvar->shownd;
654      if ( !cvar->shownd ) fshownd->SetText("Show Data");
655      if ( cvar->shownd ) fshownd->SetText("Hide Data");
656      //  printf("nd \n");
657  };  };
658    
659  void PAMevcontrol::shows4data(){  void PAMevcontrol::shows4data(){
660    printf("s4 \n");    cvar->shows4 = !cvar->shows4;
661      if ( !cvar->shows4 ) fshows4->SetText("Show Data");
662      if ( cvar->shows4 ) fshows4->SetText("Hide Data");
663      //  printf("s4 \n");
664  };  };
665    
666  void PAMevcontrol::showsidata(){  void PAMevcontrol::showsidata(){
667    printf("si \n");    cvar->showsi = !cvar->showsi;
668      if ( !cvar->showsi ) fshowsi->SetText("Show Data");
669      if ( cvar->showsi ) fshowsi->SetText("Hide Data");
670      //  printf("si \n");
671  };  };
672    
673  void PAMevcontrol::showalldata(){  void PAMevcontrol::showalldata(){
674    printf("all \n");    cvar->showall = !cvar->showall;
675      if ( !cvar->showall ) fshowall->SetText("Show Data");
676      if ( cvar->showall ) fshowall->SetText("Hide Data");
677      //  printf("all \n");
678  };  };
679    
680  void PAMevcontrol::SetFilename() {  void PAMevcontrol::SetFilename() {
681      TGTextEntry *entry = (TGTextEntry*)gTQSender;      TGTextEntry *entry = (TGTextEntry*)gTQSender;
682      TString text = entry->GetText();      TString text = entry->GetText();
683      cvar->thefilename=text.Data();      cvar->thefilename=text.Data();
684        cvar->i = 0;
685      cvar->nevents = 0;      cvar->nevents = 0;
686      cvar->firstevno = 0;      cvar->firstevno = 0;
687      cvar->lastevno = 0;      cvar->lastevno = 0;
# Line 540  void PAMevcontrol::SetFilename() { Line 693  void PAMevcontrol::SetFilename() {
693      cvar->waitforever = false;      cvar->waitforever = false;
694  }  }
695    
696    void PAMevcontrol::getl0file() {
697      //
698      TString host = "mysql://localhost/pamelaprod";
699      TString user = "anonymous";
700      TString psw = "";
701      const char *pamdbhost=gSystem->Getenv("PAM_DBHOST");
702      const char *pamdbuser=gSystem->Getenv("PAM_DBUSER");
703      const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW");
704      if ( !pamdbhost ) pamdbhost = "";
705      if ( !pamdbuser ) pamdbuser = "";
706      if ( !pamdbpsw ) pamdbpsw = "";
707      if ( strcmp(pamdbhost,"") ) host = pamdbhost;
708      if ( strcmp(pamdbuser,"") ) user = pamdbuser;
709      if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw;
710      cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
711      cout<<"Connecting to DB"<<endl;
712      cout<<"HOST "<<host<<endl;
713      cout<<"USER "<<user<<endl;
714      cout<<"PSW  "<<psw<<endl;
715      cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
716      TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());
717      //
718      TSQLResult *pResult;
719      TSQLRow *Row;
720      //
721      if( dbc && dbc->IsConnected() ){
722        //
723        // Retrieve the file
724        //
725        if ( clev->file == 2 ){
726          //
727          // Starting from level2
728          //
729          GL_ROOT glroot = GL_ROOT();
730          if( !glroot.Query_GL_ROOT(cvar->idroot,dbc) ){
731            //
732            cvar->thefilename= glroot.PATH + glroot.NAME;
733            cvar->nevents = 0;
734            cvar->firstevno = 0;
735            cvar->lastevno = 0;
736            if ( cvar->fl0 ) {
737              cvar->fl0 = false;
738              ffl0->SetState(kButtonUp);
739            };
740            cvar->restart = true;
741            cvar->waitforever = false;
742            //
743            if ( cvar->thefilter != "" ){
744              cvar->thefilter="";
745              cvar->selex = true;
746            };
747            cvar->i = cvar->EVF + cvar->i ;
748            //cvar->refresh = true;
749            //      cvar->file = 0;
750            //
751          } else {  
752            stringstream warning;
753            warning.str("");
754            warning << " Problems getting Level0 file ";
755            DIALOG(2,warning.str().c_str());
756          };
757        } else {      
758          //
759          // starting from L0
760          //
761          stringstream query;
762          query.str("");
763          query << " SELECT ID FROM GL_ROOT WHERE NAME='"<< gSystem->BaseName(cvar->thefilename.Data()) <<"' order by INSERT_TIME desc limit 1;";
764          //      printf(" query is %s \n",query.str().c_str());
765          pResult = dbc->Query(query.str().c_str());
766          Row = pResult->Next();      
767          UInt_t idrl0 = 0;
768          if ( Row ){
769            idrl0 = (UInt_t)atoll(Row->GetField(0));
770          };
771          //
772          query.str("");
773          query << " SELECT ID,ID_ROOT_L2,EV_FROM FROM GL_RUN WHERE EV_FROM<="<<cvar->i<<" AND EV_TO>="<< cvar->i<<" AND ID_ROOT_L0="<< idrl0 <<";";
774          //      printf(" query is %s \n",query.str().c_str());
775          pResult = dbc->Query(query.str().c_str());
776          Row = pResult->Next();      
777          UInt_t idrl2 = 0;
778          UInt_t idrlun = 0;
779          UInt_t evfrom = 0;
780          if ( Row ){
781            idrlun = (UInt_t)atoll(Row->GetField(0));
782            idrl2 = (UInt_t)atoll(Row->GetField(1));
783            evfrom = (UInt_t)atoll(Row->GetField(2));
784          };
785          //
786          query.str("");
787          query << " SELECT ID,NEVENTS FROM GL_RUN WHERE ID_ROOT_L2="<< idrl2 <<" order by RUNHEADER_TIME asc;";
788          //      printf(" query is %s \n",query.str().c_str());
789          pResult = dbc->Query(query.str().c_str());
790          Row = pResult->Next();      
791          UInt_t coren = 0;
792          while ( Row ){
793            if ( (UInt_t)atoll(Row->GetField(0)) == idrlun ) break;
794            coren += (UInt_t)atoll(Row->GetField(1));
795            Row = pResult->Next();      
796          };
797          coren += cvar->i - evfrom;
798          //
799          GL_ROOT glroot = GL_ROOT();
800          if( !glroot.Query_GL_ROOT(idrl2,dbc) ){
801            //
802            cvar->i = coren;
803            //
804            cvar->thefilename= glroot.PATH + glroot.NAME;
805            cvar->nevents = 0;
806            cvar->firstevno = 0;
807            cvar->lastevno = 0;
808            if ( cvar->fl0 ) {
809              cvar->fl0 = false;
810              ffl0->SetState(kButtonUp);
811            };
812            cvar->restart = true;
813            cvar->waitforever = false;
814            //
815            if ( cvar->thefilter != "" ){
816              cvar->thefilter="";
817              cvar->selex = true;
818            };
819            //
820          } else {  
821            stringstream warning;
822            warning.str("");
823            warning << " Problems getting Level2 file ";
824            DIALOG(2,warning.str().c_str());
825          };
826          //      stringstream warning;
827          //      warning.str("");
828          //      warning << " Not yet implemented ";
829          //      DIALOG(2,warning.str().c_str());
830        };
831        //
832      } else {
833        stringstream warning;
834        warning.str("");
835        warning << " Problems connectiong to DB! ";
836        DIALOG(2,warning.str().c_str());
837      };
838      dbc->Close();
839    };
840    
841  void PAMevcontrol::CheckLevel() {  void PAMevcontrol::CheckLevel() {
842    if ( clev->file == 2 ){    if ( clev->file == 2 ){
843      ffl0->SetState(kButtonDisabled);      ffl0->SetState(kButtonDisabled);
844      if ( !cvar->tracknds4 ) {  //     if ( !cvar->tracknds4 ) {
845        ftrks4->SetState(kButtonUp);  //       ftrks4->SetState(kButtonUp);
846      } else {  //     } else {
847        ftrks4->SetState(kButtonDown);  //       ftrks4->SetState(kButtonDown);
848      };  //     };
849    } else {        } else {    
850      ftrks4->SetState(kButtonDisabled);      //ftrks4->SetState(kButtonDisabled);
851      if ( !cvar->fl0 ) {      if ( !cvar->fl0 ) {
852        ffl0->SetState(kButtonUp);        ffl0->SetState(kButtonUp);
853      } else {      } else {
854        ffl0->SetState(kButtonDown);            ffl0->SetState(kButtonDown);    
855      };      };
856    };    };
857      if ( clev->file == 2 ){
858        fgetl0->SetText("Get L0 file");
859      } else {
860        fgetl0->SetText("Get L2 file");
861      };
862  }  }
863    
864  void PAMevcontrol::SetSearching() {  void PAMevcontrol::SetSearching() {
# Line 569  void PAMevcontrol::StopSearching() { Line 872  void PAMevcontrol::StopSearching() {
872  void PAMevcontrol::RefreshButtons() {  void PAMevcontrol::RefreshButtons() {
873    if ( cvar->jumprog ){    if ( cvar->jumprog ){
874      jbwc1->SetState(kButtonDown);      jbwc1->SetState(kButtonDown);
875        jbwc0->SetState(kButtonUp);
876    } else {    } else {
877        jbwc1->SetState(kButtonUp);
878      jbwc0->SetState(kButtonDown);      jbwc0->SetState(kButtonDown);
879    };    };
880    if ( cvar->fl0 ){    if ( cvar->fl0 ){
# Line 577  void PAMevcontrol::RefreshButtons() { Line 882  void PAMevcontrol::RefreshButtons() {
882    } else {    } else {
883      ffl0->SetState(kButtonUp);      ffl0->SetState(kButtonUp);
884    };    };
885    if ( cvar->tracknds4) ftrks4->SetState(kButtonDown);    //  if ( cvar->tracknds4) ftrks4->SetState(kButtonDown);
886    if ( cvar->bw ){    if ( cvar->bw ){
887      bwc1->SetState(kButtonDown);      bwc1->SetState(kButtonDown);
888        bwc0->SetState(kButtonUp);
889    } else {    } else {
890      bwc0->SetState(kButtonDown);      bwc0->SetState(kButtonDown);
891        bwc1->SetState(kButtonUp);
892    };    };
893      if ( cvar->PATTRIG) fchktrigger->SetState(kButtonDown); else fchktrigger->SetState(kButtonUp);
894    if ( cvar->PALETTE) fchkpalette->SetState(kButtonDown); else fchkpalette->SetState(kButtonUp);    if ( cvar->PALETTE) fchkpalette->SetState(kButtonDown); else fchkpalette->SetState(kButtonUp);
895    if ( cvar->VINFOS ) fchknames->SetState(kButtonDown); else fchknames->SetState(kButtonUp);    if ( cvar->VINFOS ) fchknames->SetState(kButtonDown); else fchknames->SetState(kButtonUp);
896    if ( cvar->INFOS ) fchkinfo->SetState(kButtonDown); else fchkinfo->SetState(kButtonUp);    if ( cvar->INFOS ) fchkinfo->SetState(kButtonDown); else fchkinfo->SetState(kButtonUp);
897    if ( cvar->CALO ) fchkcalo->SetState(kButtonDown); else fchkcalo->SetState(kButtonUp);    //
898    if ( cvar->CALOT ) fchkcalost->SetState(kButtonDown); else fchkcalost->SetState(kButtonUp);    if ( cvar->CALOT ) fchkcalost->SetState(kButtonDown); else fchkcalost->SetState(kButtonUp);
899    if ( cvar->ND ) fchknd->SetState(kButtonDown); else fchknd->SetState(kButtonUp);    if ( cvar->CALO ){
900    if ( cvar->S4 ) fchks4->SetState(kButtonDown); else fchks4->SetState(kButtonUp);      fchkcalo->SetState(kButtonDown);
901    if ( cvar->TRK ) fchktrk->SetState(kButtonDown); else fchktrk->SetState(kButtonUp);      fshowcal->SetState(kButtonUp);    
902    if ( cvar->AC ) fchkac->SetState(kButtonDown); else fchkac->SetState(kButtonUp);    } else {
903    if ( cvar->TOF ) fchktof->SetState(kButtonDown); else fchktof->SetState(kButtonUp);      fchkcalo->SetState(kButtonUp);
904        fchkcalost->SetState(kButtonDisabled);
905        fshowcal->SetState(kButtonDisabled);    
906      };
907      //
908      if ( cvar->ND ){
909        fchknd->SetState(kButtonDown);
910        fshownd->SetState(kButtonUp);
911      } else {
912        fchknd->SetState(kButtonUp);
913        fshownd->SetState(kButtonDisabled);
914      };
915      //
916      if ( cvar->S4 ){
917        fchks4->SetState(kButtonDown);
918        fshows4->SetState(kButtonUp);
919      } else {
920        fchks4->SetState(kButtonUp);
921        fshows4->SetState(kButtonDisabled);
922      };
923      //
924      if ( cvar->TRK ){
925        fchktrk->SetState(kButtonDown);
926        fshowtrk->SetState(kButtonUp);
927      } else {
928        fchktrk->SetState(kButtonUp);
929        fshowtrk->SetState(kButtonDisabled);
930      }
931      //
932      if ( cvar->AC ){
933        fchkac->SetState(kButtonDown);
934        fshowac->SetState(kButtonUp);
935      } else {
936        fchkac->SetState(kButtonUp);
937        fshowac->SetState(kButtonDisabled);
938      };
939      //
940      if ( cvar->TOF ){
941        fchktof->SetState(kButtonDown);
942        fshowtof->SetState(kButtonUp);
943      } else {
944        fchktof->SetState(kButtonUp);
945        fshowtof->SetState(kButtonDisabled);
946      };
947      //
948      CheckLevel();
949      //
950  };  };
951    
952  void PAMevcontrol::SetFilter() {  void PAMevcontrol::SetFilter() {
# Line 775  void PAMevcontrol::increment(float val) Line 1129  void PAMevcontrol::increment(float val)
1129  }  }
1130    
1131  void PAMevcontrol::forcel0() {  void PAMevcontrol::forcel0() {
1132      if ( cvar->fl0 ) {    cvar->fl0 = !cvar->fl0;
1133          cvar->fl0 = false;    cvar->alrforc = false;
1134      } else {    cvar->i--;
1135          cvar->fl0 = true;    cvar->nevents = 0;
1136      };    cvar->firstevno = 0;
1137      cvar->alrforc = false;    cvar->lastevno = 0;
1138      cvar->i--;    cvar->refresh = true;
     cvar->nevents = 0;  
     cvar->firstevno = 0;  
     cvar->lastevno = 0;  
     cvar->refresh = true;  
1139  }  }
1140    
1141  void PAMevcontrol::clearselfi(){  void PAMevcontrol::clearselfi(){
# Line 993  void PAMevcontrol::chkpalette() { Line 1343  void PAMevcontrol::chkpalette() {
1343    cvar->goon = true;    cvar->goon = true;
1344  }  }
1345    
1346    void PAMevcontrol::chktrigger() {
1347      if ( cvar->PATTRIG ) {
1348        cvar->PATTRIG = 0;
1349      } else {
1350        cvar->PATTRIG = 1;
1351      };
1352      cvar->i--;
1353      cvar->goon = true;
1354    }
1355    
1356  void PAMevcontrol::next() {  void PAMevcontrol::next() {
1357    SetSearching();    SetSearching();
1358    if ( cvar->i == cvar->nevents-1  ) {    if ( cvar->i == cvar->nevents-1  ) {

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.23