/[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.5 by mocchiut, Thu Nov 8 11:05:35 2007 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 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 308  PAMevcontrol::PAMevcontrol(const TGWindo Line 310  PAMevcontrol::PAMevcontrol(const TGWindo
310    };    };
311    bwc0->Connect("Pressed()", "PAMevcontrol",this,"radiocolor()");    bwc0->Connect("Pressed()", "PAMevcontrol",this,"radiocolor()");
312    bwc1->Connect("Pressed()", "PAMevcontrol",this,"radiobw()");    bwc1->Connect("Pressed()", "PAMevcontrol",this,"radiobw()");
313    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));
314    //    //
315    //    //
316    ftrks4 = new TGCheckButton(hframe5, "Track in S4/ND");      //  ftrks4 = new TGCheckButton(hframe5, "Track in S4/ND");  
317    ftrks4->Connect("Clicked()","PAMevcontrol",this,"radiotrack()");      //  ftrks4->Connect("Clicked()","PAMevcontrol",this,"radiotrack()");  
318    if ( cvar->tracknds4) ftrks4->SetState(kButtonDown);    //  if ( cvar->tracknds4) ftrks4->SetState(kButtonDown);
319    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));
320    ffl0 = new TGCheckButton(hframe5, "Force LEVEL0");  
321      fgetl0 = new TGTextButton(hframe5, "Get L0 file");  
322      fgetl0->Connect("Clicked()","PAMevcontrol", this,"getl0file()");
323      hframe5->AddFrame(fgetl0, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsCenterY|kLHintsExpandX,5,5,5,5));
324    
325      ffl0 = new TGCheckButton(hframe5, "Force RAW");
326    ffl0->Connect("Clicked()","PAMevcontrol",this,"forcel0()");    ffl0->Connect("Clicked()","PAMevcontrol",this,"forcel0()");
327    if ( cvar->fl0 ) ffl0->SetState(kButtonDown);    if ( cvar->fl0 ) ffl0->SetState(kButtonDown);
328    if ( !cvar->fl0 ) ffl0->SetState(kButtonUp);    if ( !cvar->fl0 ) ffl0->SetState(kButtonUp);
329    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));
330    //    //
331    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));
332    gf2->AddFrame(hframe4, new TGLayoutHints(kLHintsExpandX));    gf2->AddFrame(hframe4, new TGLayoutHints(kLHintsExpandX));
# Line 469  void PAMevcontrol::refreshdec(Int_t n){ Line 476  void PAMevcontrol::refreshdec(Int_t n){
476    
477    
478  void PAMevcontrol::showorbdata(){  void PAMevcontrol::showorbdata(){
479    printf("orb \n");    cvar->showorb = !cvar->showorb;
480      if ( !cvar->showorb ) fshoworb->SetText("Show Data");
481      if ( cvar->showorb ) fshoworb->SetText("Hide Data");
482      //  printf("orb \n");
483  };  };
484    
485  void PAMevcontrol::showtrgdata(){  void PAMevcontrol::showtrgdata(){
486    printf("trg \n");    cvar->showtrg = !cvar->showtrg;
487      if ( !cvar->showtrg ) fshowtrg->SetText("Show Data");
488      if ( cvar->showtrg ) fshowtrg->SetText("Hide Data");
489      //  printf("trg \n");
490  };  };
491    
492  void PAMevcontrol::showrundata(){  void PAMevcontrol::showrundata(){
493    printf("run \n");    cvar->showrun = !cvar->showrun;
494      if ( !cvar->showrun ) fshowrun->SetText("Show Data");
495      if ( cvar->showrun ) fshowrun->SetText("Hide Data");
496      //  printf("run \n");
497  };  };
498    
499  void PAMevcontrol::showcaldata(){  void PAMevcontrol::showcaldata(){
500    printf("cal \n");    cvar->showcal = !cvar->showcal;
501      if ( !cvar->showcal ) fshowcal->SetText("Show Data");
502      if ( cvar->showcal ) fshowcal->SetText("Hide Data");
503      //  printf("cal \n");
504  };  };
505    
506  void PAMevcontrol::chkcalost(){  void PAMevcontrol::chkcalost(){
507    if ( cvar->CALO ) {    if ( cvar->CALOT ) {
508      cvar->CALO = 0;      cvar->CALOT = 0;
509    } else {    } else {
510      cvar->CALO = 1;      cvar->CALOT = 1;
511    };    };
512    cvar->i--;    cvar->i--;
513    cvar->nevents = 0;    cvar->nevents = 0;
# Line 498  void PAMevcontrol::chkcalost(){ Line 517  void PAMevcontrol::chkcalost(){
517  };  };
518    
519  void PAMevcontrol::showtrkdata(){  void PAMevcontrol::showtrkdata(){
520    printf("trk \n");    cvar->showtrk = !cvar->showtrk;
521      if ( !cvar->showtrk ) fshowtrk->SetText("Show Data");
522      if ( cvar->showtrk ) fshowtrk->SetText("Hide Data");
523      //  printf("trk \n");
524  };  };
525    
526  void PAMevcontrol::showtofdata(){  void PAMevcontrol::showtofdata(){
527    printf("tof \n");    cvar->showtof = !cvar->showtof;
528      if ( !cvar->showtof ) fshowtof->SetText("Show Data");
529      if ( cvar->showtof ) fshowtof->SetText("Hide Data");
530      //  printf("tof \n");
531  };  };
532    
533  void PAMevcontrol::showacdata(){  void PAMevcontrol::showacdata(){
534    printf("ac \n");    cvar->showac = !cvar->showac;
535      if ( !cvar->showac ) fshowac->SetText("Show Data");
536      if ( cvar->showac ) fshowac->SetText("Hide Data");
537      //  printf("ac \n");
538  };  };
539    
540  void PAMevcontrol::shownddata(){  void PAMevcontrol::shownddata(){
541    printf("nd \n");    cvar->shownd = !cvar->shownd;
542      if ( !cvar->shownd ) fshownd->SetText("Show Data");
543      if ( cvar->shownd ) fshownd->SetText("Hide Data");
544      //  printf("nd \n");
545  };  };
546    
547  void PAMevcontrol::shows4data(){  void PAMevcontrol::shows4data(){
548    printf("s4 \n");    cvar->shows4 = !cvar->shows4;
549      if ( !cvar->shows4 ) fshows4->SetText("Show Data");
550      if ( cvar->shows4 ) fshows4->SetText("Hide Data");
551      //  printf("s4 \n");
552  };  };
553    
554  void PAMevcontrol::showsidata(){  void PAMevcontrol::showsidata(){
555    printf("si \n");    cvar->showsi = !cvar->showsi;
556      if ( !cvar->showsi ) fshowsi->SetText("Show Data");
557      if ( cvar->showsi ) fshowsi->SetText("Hide Data");
558      //  printf("si \n");
559  };  };
560    
561  void PAMevcontrol::showalldata(){  void PAMevcontrol::showalldata(){
562    printf("all \n");    cvar->showall = !cvar->showall;
563      if ( !cvar->showall ) fshowall->SetText("Show Data");
564      if ( cvar->showall ) fshowall->SetText("Hide Data");
565      //  printf("all \n");
566  };  };
567    
568  void PAMevcontrol::SetFilename() {  void PAMevcontrol::SetFilename() {
# Line 540  void PAMevcontrol::SetFilename() { Line 580  void PAMevcontrol::SetFilename() {
580      cvar->waitforever = false;      cvar->waitforever = false;
581  }  }
582    
583    void PAMevcontrol::getl0file() {
584      //
585      TString host = "mysql://localhost/pamelaprod";
586      TString user = "anonymous";
587      TString psw = "";
588      const char *pamdbhost=gSystem->Getenv("PAM_DBHOST");
589      const char *pamdbuser=gSystem->Getenv("PAM_DBUSER");
590      const char *pamdbpsw=gSystem->Getenv("PAM_DBPSW");
591      if ( !pamdbhost ) pamdbhost = "";
592      if ( !pamdbuser ) pamdbuser = "";
593      if ( !pamdbpsw ) pamdbpsw = "";
594      if ( strcmp(pamdbhost,"") ) host = pamdbhost;
595      if ( strcmp(pamdbuser,"") ) user = pamdbuser;
596      if ( strcmp(pamdbpsw,"") ) psw = pamdbpsw;
597      cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
598      cout<<"Connecting to DB"<<endl;
599      cout<<"HOST "<<host<<endl;
600      cout<<"USER "<<user<<endl;
601      cout<<"PSW  "<<psw<<endl;
602      cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
603      TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());
604      if( dbc && dbc->IsConnected() ){
605        //
606        // Starting from level2
607        //
608        if ( clev->file == 2 ){
609          GL_ROOT glroot = GL_ROOT();
610          if( !glroot.Query_GL_ROOT(cvar->idroot,dbc) ){
611            //
612            cvar->thefilename= glroot.PATH + glroot.NAME;
613            cvar->nevents = 0;
614            cvar->firstevno = 0;
615            cvar->lastevno = 0;
616            if ( cvar->fl0 ) {
617              cvar->fl0 = false;
618              ffl0->SetState(kButtonUp);
619            };
620            cvar->restart = true;
621            cvar->waitforever = false;
622            //
623            if ( cvar->thefilter != "" ){
624              cvar->thefilter="";
625              cvar->selex = true;
626            };
627            cvar->i = -(cvar->EVF + cvar->i -1);
628            //cvar->refresh = true;
629            //      cvar->file = 0;
630            //
631          } else {
632            stringstream warning;
633            warning.str("");
634            warning << " Problems getting Level0 file ";
635            DIALOG(2,warning.str().c_str());
636          };
637        } else {
638          //
639          // starting from L0
640          //
641          stringstream warning;
642          warning.str("");
643          warning << " Not yet implemented ";
644          DIALOG(2,warning.str().c_str());
645        };
646        //
647      } else {
648        stringstream warning;
649        warning.str("");
650        warning << " Problems connectiong to DB! ";
651        DIALOG(2,warning.str().c_str());
652      };
653      dbc->Close();
654    };
655    
656  void PAMevcontrol::CheckLevel() {  void PAMevcontrol::CheckLevel() {
657    if ( clev->file == 2 ){    if ( clev->file == 2 ){
658      ffl0->SetState(kButtonDisabled);      ffl0->SetState(kButtonDisabled);
659      if ( !cvar->tracknds4 ) {  //     if ( !cvar->tracknds4 ) {
660        ftrks4->SetState(kButtonUp);  //       ftrks4->SetState(kButtonUp);
661      } else {  //     } else {
662        ftrks4->SetState(kButtonDown);  //       ftrks4->SetState(kButtonDown);
663      };  //     };
664    } else {        } else {    
665      ftrks4->SetState(kButtonDisabled);      //ftrks4->SetState(kButtonDisabled);
666      if ( !cvar->fl0 ) {      if ( !cvar->fl0 ) {
667        ffl0->SetState(kButtonUp);        ffl0->SetState(kButtonUp);
668      } else {      } else {
669        ffl0->SetState(kButtonDown);            ffl0->SetState(kButtonDown);    
670      };      };
671    };    };
672      if ( clev->file == 2 ){
673        fgetl0->SetText("Get L0 file");
674      } else {
675        fgetl0->SetText("Get L2 file");
676      };
677  }  }
678    
679  void PAMevcontrol::SetSearching() {  void PAMevcontrol::SetSearching() {
# Line 577  void PAMevcontrol::RefreshButtons() { Line 695  void PAMevcontrol::RefreshButtons() {
695    } else {    } else {
696      ffl0->SetState(kButtonUp);      ffl0->SetState(kButtonUp);
697    };    };
698    if ( cvar->tracknds4) ftrks4->SetState(kButtonDown);    //  if ( cvar->tracknds4) ftrks4->SetState(kButtonDown);
699    if ( cvar->bw ){    if ( cvar->bw ){
700      bwc1->SetState(kButtonDown);      bwc1->SetState(kButtonDown);
701    } else {    } else {
# Line 586  void PAMevcontrol::RefreshButtons() { Line 704  void PAMevcontrol::RefreshButtons() {
704    if ( cvar->PALETTE) fchkpalette->SetState(kButtonDown); else fchkpalette->SetState(kButtonUp);    if ( cvar->PALETTE) fchkpalette->SetState(kButtonDown); else fchkpalette->SetState(kButtonUp);
705    if ( cvar->VINFOS ) fchknames->SetState(kButtonDown); else fchknames->SetState(kButtonUp);    if ( cvar->VINFOS ) fchknames->SetState(kButtonDown); else fchknames->SetState(kButtonUp);
706    if ( cvar->INFOS ) fchkinfo->SetState(kButtonDown); else fchkinfo->SetState(kButtonUp);    if ( cvar->INFOS ) fchkinfo->SetState(kButtonDown); else fchkinfo->SetState(kButtonUp);
707    if ( cvar->CALO ) fchkcalo->SetState(kButtonDown); else fchkcalo->SetState(kButtonUp);    //
708    if ( cvar->CALOT ) fchkcalost->SetState(kButtonDown); else fchkcalost->SetState(kButtonUp);    if ( cvar->CALOT ) fchkcalost->SetState(kButtonDown); else fchkcalost->SetState(kButtonUp);
709    if ( cvar->ND ) fchknd->SetState(kButtonDown); else fchknd->SetState(kButtonUp);    if ( cvar->CALO ){
710    if ( cvar->S4 ) fchks4->SetState(kButtonDown); else fchks4->SetState(kButtonUp);      fchkcalo->SetState(kButtonDown);
711    if ( cvar->TRK ) fchktrk->SetState(kButtonDown); else fchktrk->SetState(kButtonUp);      fshowcal->SetState(kButtonUp);    
712    if ( cvar->AC ) fchkac->SetState(kButtonDown); else fchkac->SetState(kButtonUp);    } else {
713    if ( cvar->TOF ) fchktof->SetState(kButtonDown); else fchktof->SetState(kButtonUp);      fchkcalo->SetState(kButtonUp);
714        fchkcalost->SetState(kButtonDisabled);
715        fshowcal->SetState(kButtonDisabled);    
716      };
717      //
718      if ( cvar->ND ){
719        fchknd->SetState(kButtonDown);
720        fshownd->SetState(kButtonUp);
721      } else {
722        fchknd->SetState(kButtonUp);
723        fshownd->SetState(kButtonDisabled);
724      };
725      //
726      if ( cvar->S4 ){
727        fchks4->SetState(kButtonDown);
728        fshows4->SetState(kButtonUp);
729      } else {
730        fchks4->SetState(kButtonUp);
731        fshows4->SetState(kButtonDisabled);
732      };
733      //
734      if ( cvar->TRK ){
735        fchktrk->SetState(kButtonDown);
736        fshowtrk->SetState(kButtonUp);
737      } else {
738        fchktrk->SetState(kButtonUp);
739        fshowtrk->SetState(kButtonDisabled);
740      }
741      //
742      if ( cvar->AC ){
743        fchkac->SetState(kButtonDown);
744        fshowac->SetState(kButtonUp);
745      } else {
746        fchkac->SetState(kButtonUp);
747        fshowac->SetState(kButtonDisabled);
748      };
749      //
750      if ( cvar->TOF ){
751        fchktof->SetState(kButtonDown);
752        fshowtof->SetState(kButtonUp);
753      } else {
754        fchktof->SetState(kButtonUp);
755        fshowtof->SetState(kButtonDisabled);
756      };
757      //
758      CheckLevel();
759      //
760  };  };
761    
762  void PAMevcontrol::SetFilter() {  void PAMevcontrol::SetFilter() {
# Line 775  void PAMevcontrol::increment(float val) Line 939  void PAMevcontrol::increment(float val)
939  }  }
940    
941  void PAMevcontrol::forcel0() {  void PAMevcontrol::forcel0() {
942      if ( cvar->fl0 ) {    cvar->fl0 = !cvar->fl0;
943          cvar->fl0 = false;    cvar->alrforc = false;
944      } else {    cvar->i--;
945          cvar->fl0 = true;    cvar->nevents = 0;
946      };    cvar->firstevno = 0;
947      cvar->alrforc = false;    cvar->lastevno = 0;
948      cvar->i--;    cvar->refresh = true;
     cvar->nevents = 0;  
     cvar->firstevno = 0;  
     cvar->lastevno = 0;  
     cvar->refresh = true;  
949  }  }
950    
951  void PAMevcontrol::clearselfi(){  void PAMevcontrol::clearselfi(){

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

  ViewVC Help
Powered by ViewVC 1.1.23