| 10 | } level; | } level; | 
| 11 |  |  | 
| 12 | typedef struct Variables { | typedef struct Variables { | 
| 13 |  | Bool_t selex; | 
| 14 |  | Bool_t alrforc; | 
| 15 |  | Bool_t jumprog; | 
| 16 |  | Bool_t waitforever; | 
| 17 |  | Bool_t restart; | 
| 18 |  | Bool_t goon; | 
| 19 |  | Bool_t refresh; | 
| 20 |  | Bool_t fl0; | 
| 21 |  | Bool_t jumpen; | 
| 22 | Float_t sfx;  // scale factor x | Float_t sfx;  // scale factor x | 
| 23 | Float_t sfy;  // scale factor y | Float_t sfy;  // scale factor y | 
| 24 | Float_t xxvc; // x coordinate of the x-view | Float_t xxvc; // x coordinate of the x-view | 
| 54 | Int_t jumpto; // event number to jump to | Int_t jumpto; // event number to jump to | 
| 55 | Int_t lastevno; // last event number | Int_t lastevno; // last event number | 
| 56 | Int_t firstevno; // first event number | Int_t firstevno; // first event number | 
| 57 |  | Int_t SHOWDEC; | 
| 58 |  | Int_t TOF; | 
| 59 |  | Int_t AC; | 
| 60 |  | Int_t TRK; | 
| 61 |  | Int_t CALO; | 
| 62 |  | Int_t S4; | 
| 63 |  | Int_t ND; | 
| 64 |  | Int_t INFOS; | 
| 65 |  | Int_t VINFOS; | 
| 66 |  | Int_t PALETTE; | 
| 67 | Long64_t nevents; // number of events in the ntuple | Long64_t nevents; // number of events in the ntuple | 
| 68 |  | TString thefilename; | 
| 69 |  | TString thefilter; | 
| 70 |  | TString svas; | 
| 71 | } var; | } var; | 
| 72 |  |  | 
|  | 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 <enter> to continue, b<enter> to go backward, j<enter> to jump,\np<enter> to save the figure, o<enter> for more options, q<enter> 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 <enter> to go back to previous menu, c<enter> to toggle B/W visualization,\nt<enter> 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); |  | 
|  | } |  |