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

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

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

revision 1.1 by mocchiut, Fri Jul 14 14:18:06 2006 UTC revision 1.3 by mocchiut, Tue May 11 09:13:50 2010 UTC
# Line 18  Line 18 
18  #include <FEVVerl2.h>  #include <FEVVerl2.h>
19  //  //
20  using namespace std;  using namespace std;
21    Bool_t NODB;
22    //
23    
24    void usage(){
25      printf("\nUsage:\n\n EventViewer [-v] file selection_file output_dir \n");
26      printf("\n -v                        be verbose and do not fork after launching the GUI\n");
27      printf(  " -file file                must be in the form: /path/to/filesfromyoda/dw_000000_00000/  \n");
28      printf(  " -selfile selection_file   selection file, empty if no selection is required \n");
29      printf(  " -outputDir outDir         directory where to save figures\n");
30      printf(  " -noDB                     do not DB connection in PamLevel2 (RUNINFO WILL NOT WORK!)\n");
31      printf("\nExamples: \n\nEventViewer /home/pamela/filesfromyoda/dw_050301_00100/ \"\" /home/pamela/\n");
32      printf(                "EventViewer -v /home/pamela/filesfromyoda/dw_050301_00100/ muselection.c \"\"\n\n");
33      printf(                "EventViewer \n\n");
34      printf(                "EventViewer -v \n\n");
35    }
36    
37  //  //
38  int main(int numinp, char *inps[]){  int main(int numinp, char *inps[]){
39    TString name = "";    TString name = "";
40    TString selfile = "";    TString selfile = "";
41    TString outdir = "";    TString outdir = "";
42    bool beverbose = false;    bool beverbose = false;
43    if ( numinp > 1 ){    
44      if ( !strcmp(inps[1],"--version") ){    
45        FEVInfo(true);    for (int i = 1; i < numinp; i++){            
46        // -----------------------------------------------------//
47        if (!strcmp(inps[i], "-file")){
48          name = (TString)inps[++i];
49          cout << "file "<<name.Data()<<endl;
50          continue;
51        }
52        // -----------------------------------------------------//
53        else if (!strcmp(inps[i], "-outputDir")){
54          outdir = (TString)inps[++i];
55          cout << "outputDir "<<outdir.Data()<<endl;
56          continue;
57        }  
58        // -----------------------------------------------------//
59        else if (!strcmp(inps[i], "-v")){
60          beverbose = true;
61          continue;
62        }
63        // -----------------------------------------------------//
64        else if (!strcmp(inps[i], "-h")){
65          beverbose = true;
66          usage();
67        return(0);        return(0);
68      };      }
69      if ( !strcmp(inps[1],"-h") || !strcmp(inps[1],"--help") || numinp>7 ){      else if (!strcmp(inps[i], "-noDB")){
70        printf("\nUsage:\n\n EventViewer [-v] file selection_file output_dir \n");        NODB = true;
71        printf("\n -v                be verbose and do not fork after launching the GUI\n");        continue;
72        printf(  "  file             must be in the form: /path/to/filesfromyoda/dw_000000_00000/  \n");      }
73        printf(  "  selection_file   selection file, empty if no selection is required \n");      else if (!strcmp(inps[i], "--version")){
74        printf(  "  outDir           directory where to save figures\n");        FEVInfo(true);
       printf("\nExamples: \n\nEventViewer /home/pamela/filesfromyoda/dw_050301_00100/ \"\" /home/pamela/\n");  
       printf(                "EventViewer -v /home/pamela/filesfromyoda/dw_050301_00100/ muselection.c \"\"\n\n");  
       printf(                "EventViewer \n\n");  
       printf(                "EventViewer -v \n\n");  
75        return(0);        return(0);
76      };      }
77      if ( !strcmp(inps[1],"-v") || !strcmp(inps[1],"--verbose") ){    };
78        beverbose = true;    //
79        if ( numinp >= 3 ) name = (TString)inps[2];    if ( !strcmp(name.Data(),"") ){
80        if ( numinp >= 4 ) selfile = (TString)inps[3];      if ( numinp > 1 ){
81        if ( numinp == 5 ) outdir = (TString)inps[4];        if ( !strcmp(inps[1],"--version") ){
82      } else {          FEVInfo(true);
83        name = (TString)inps[1];          return(0);
84        if ( numinp >= 3 ) selfile = (TString)inps[2];        };
85        if ( numinp >= 4 ) outdir = (TString)inps[3];        if ( !strcmp(inps[1],"-h") || !strcmp(inps[1],"--help") || numinp>7 ){
86            usage();
87            return(0);
88          };
89          if ( !strcmp(inps[1],"-v") || !strcmp(inps[1],"--verbose") ){
90            beverbose = true;
91            if ( numinp >= 3 ) name = (TString)inps[2];
92            if ( numinp >= 4 ) selfile = (TString)inps[3];
93            if ( numinp == 5 ) outdir = (TString)inps[4];
94          } else {
95            name = (TString)inps[1];
96            if ( numinp >= 3 ) selfile = (TString)inps[2];
97            if ( numinp >= 4 ) outdir = (TString)inps[3];
98          };
99      };      };
100    };    };
101      //
102      //
103      //
104    if ( beverbose ){    if ( beverbose ){
105      ShowEvent(name,selfile,outdir);      ShowEvent(name,selfile,outdir);
106    } else {    } else {
# Line 71  int main(int numinp, char *inps[]){ Line 120  int main(int numinp, char *inps[]){
120      pid_t pid;      pid_t pid;
121      if( (pid=fork()) == -1 ){      if( (pid=fork()) == -1 ){
122        fprintf(stderr," Fork error. Exiting.\n");        fprintf(stderr," Fork error. Exiting.\n");
123        exit(1);                return(1);        
124      };      };
125      if( !pid ) {      if( !pid ) {
126        ShowEvent(name,selfile,outdir);        ShowEvent(name,selfile,outdir);

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

  ViewVC Help
Powered by ViewVC 1.1.23