--- eventviewer/ground/inc/eventviewer.h 2005/12/06 10:12:55 1.1 +++ eventviewer/ground/inc/eventviewer.h 2006/03/09 15:50:52 1.2 @@ -10,6 +10,15 @@ } level; typedef struct Variables { + Bool_t selex; + Bool_t alrforc; + Bool_t jumprog; + Bool_t waitforever; + Bool_t restart; + Bool_t goon; + Bool_t refresh; + Bool_t fl0; + Bool_t jumpen; Float_t sfx; // scale factor x Float_t sfy; // scale factor y Float_t xxvc; // x coordinate of the x-view @@ -45,189 +54,19 @@ Int_t jumpto; // event number to jump to Int_t lastevno; // last event number Int_t firstevno; // first event number + Int_t SHOWDEC; + Int_t TOF; + Int_t AC; + Int_t TRK; + Int_t CALO; + Int_t S4; + Int_t ND; + Int_t INFOS; + Int_t VINFOS; + Int_t PALETTE; Long64_t nevents; // number of events in the ntuple + TString thefilename; + TString thefilter; + TString svas; } var; -Int_t WhatToDoEV(Variables & var, const char *file, TString outDir, TString figty, TCanvas &figure) { - char *bw; - if ( var.bw ){ - bw = "bw"; - } else { - bw = ""; - }; - var.jumpto = 0; - stringstream input; - stringstream input2; - stringstream input3; - char tellme[256]; - char tellme2[256]; - char tellme3[256]; - stringstream out; - out.str("x"); - input2.str("zzzzzzzzzzzzzz"); - input3.str("z"); - input << out.str().c_str(); - stringstream stc; - stringstream stc2; - while ( !strcmp(input.str().c_str(),out.str().c_str()) ) { - printf("\nPress to continue, b to go backward, j to jump,\np to save the figure, o for more options, q to quit: \n"); - cin.getline(tellme,256); - // - input.str(""); - input << tellme; - out << "y"; - // - stc.str("o"); - // - if ( !strcmp(input.str().c_str(),stc.str().c_str()) ) { - stringstream input4; - char tellme4[256]; - stringstream out4; - out4.str("a"); - input4 << out4.str().c_str(); - while ( !strcmp(input4.str().c_str(),out4.str().c_str()) ) { - printf("\nPress to go back to previous menu, c to toggle B/W visualization,\nt to toggle track visualization in S4 and ND: \n"); - cin.getline(tellme4,256); - input4.str(""); - input4 << tellme4; - out4.str("1"); - out.str(""); - out << input.str().c_str(); - // - stc2.str("c"); - if ( !strcmp(input4.str().c_str(),stc2.str().c_str()) ) { - if ( !var.bw ){ - printf("\n --> B/W visualization\n"); - var.bw = 1; - } else { - printf("\n --> colour visualization\n"); - var.bw = 0; - }; - var.i--; - out.str("1"); - }; - // - stc2.str("t"); - if ( !strcmp(input4.str().c_str(),stc2.str().c_str()) ) { - if ( !var.tracknds4 ){ - printf("\n --> track visualization in S4 and ND\n"); - var.tracknds4 = 1; - } else { - printf("\n --> no track visualization in S4 and ND\n"); - var.tracknds4 = 0; - }; - var.i--; - out.str("1"); - }; - }; - }; - // - stc.str("b"); - // - if ( !strcmp(input.str().c_str(),stc.str().c_str()) ) { - if ( var.i > 0 ) { - printf("WARNING: going backward!\n\n"); - var.doflag = 2; - } else { - printf("This is the first event, you can't go backward! \n"); - out.str(""); - out << input.str().c_str(); - }; - }; - // - stc.str("j"); - // - if ( !strcmp(input.str().c_str(),stc.str().c_str()) ) { - printf("\n Do you want to jump to a progressive number [p] or to an event number [e]? "); - cin.getline(tellme3,256); - input3.str(""); - input3 << tellme3; - // - stc2.str("p"); - if ( !strcmp(input3.str().c_str(),stc2.str().c_str()) ) { - printf("\n Enter the progressive number you want to jump to: "); - cin.getline(tellme2,256); - input2.str(""); - input2 << tellme2; - Int_t j; - j = atoi(input2.str().c_str()); - if ( j < 1 || j > var.nevents+1 ) { - printf("\n You can choose between 1 and %i \n",(int)var.nevents+1); - out.str(""); - out << input.str().c_str(); - } else { - printf("\n Jumping to progressive number %i\n\n",j); - var.i = j-2; - }; - }; - // - stc2.str("e"); - if ( !strcmp(input3.str().c_str(),stc2.str().c_str()) ) { - printf("\n Enter the event number you want to jump to: "); - cin.getline(tellme2,256); - input2.str(""); - input2 << tellme2; - Int_t j; - j = atoi(input2.str().c_str()); - if ( j < var.firstevno || j > var.lastevno ) { - printf("\n You can choose between %i and %i \n",var.firstevno,var.lastevno); - out.str(""); - out << input.str().c_str(); - } else { - printf("\n Jumping to event number %i\n\n",j); - var.jumpto = j; - var.i = -1; - }; - }; - // - stc.str("p"); - stc2.str("e"); - if ( strcmp(input3.str().c_str(),stc2.str().c_str()) && strcmp(input3.str().c_str(),stc.str().c_str()) ) { - printf(" You must type or \"p\" or \"e\"\n"); - out.str(""); - out << input.str().c_str(); - }; - }; - // - stc.str("q"); - stc2.str(".q"); - // - if ( !strcmp(input.str().c_str(),stc.str().c_str()) || !strcmp(input.str().c_str(),stc2.str().c_str()) ) { - printf("Exiting...\n"); - return(1); - }; - // - stc.str("p"); - // - if ( !strcmp(input.str().c_str(),stc.str().c_str()) ) { - printf("Enter a file extension recognized by ROOT (ps, eps, gif,...):\n"); - cin.getline(tellme2,256); - input2.str(""); - input2 << tellme2; - out.str(""); - out << input.str().c_str(); - // - TString filename = file; - const string fil = (const char*)filename; - Int_t posiz = fil.find("dw_"); - if ( posiz == -1 ) posiz = fil.find("DW_"); - Int_t posiz2 = posiz+13; - TString file2; - stringcopy(file2,filename,posiz,posiz2); - const char *figrec = file2; - const char *outdir = outDir; - stringstream figsave; - const char *ty = figty; - figsave.str(""); - figsave << outdir << "/"; - figsave << ty << "_"; - figsave << (var.i+1) << "_"; - figsave << figrec; - figsave << bw << "."; - figsave << input2.str().c_str(); - figure.SaveAs(figsave.str().c_str()); - printf("\n"); - }; - }; - return(0); -}