/[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.2 by mocchiut, Tue Aug 11 13:03:42 2009 UTC revision 1.6 by mocchiut, Thu Jan 16 15:52:36 2014 UTC
# Line 8  Line 8 
8  //  //
9  // 0.00 - 1.00 : working.  // 0.00 - 1.00 : working.
10  //  //
11    #include <sys/stat.h>
12  #include <TSystem.h>  #include <TSystem.h>
13  #include <iostream>  #include <iostream>
14  #include <sys/types.h>  #include <sys/types.h>
# Line 18  Line 19 
19  #include <FEVVerl2.h>  #include <FEVVerl2.h>
20  //  //
21  using namespace std;  using namespace std;
22    Bool_t NODB;
23    //
24    
25    void usage(){
26      printf("\nUsage:\n\n EventViewer [-v] file selection_file output_dir \n");
27      printf("\n -v                        be verbose and do not fork after launching the GUI\n");
28      printf(  " -file file                must be in the form: /path/to/filesfromyoda/dw_000000_00000/  \n");
29      printf(  " -selfile selection_file   selection file, empty if no selection is required \n");
30      printf(  " -outputDir outDir         directory where to save figures\n");
31      printf(  " -noDB                     do not DB connection in PamLevel2 (RUNINFO WILL NOT WORK!)\n");
32      printf("\nExamples: \n\nEventViewer /home/pamela/filesfromyoda/dw_050301_00100/ \"\" /home/pamela/\n");
33      printf(                "EventViewer -v /home/pamela/filesfromyoda/dw_050301_00100/ muselection.c \"\"\n\n");
34      printf(                "EventViewer \n\n");
35      printf(                "EventViewer -v \n\n");
36    }
37    
38  //  //
39  int main(int numinp, char *inps[]){  int main(int numinp, char *inps[]){
40    TString name = "";    TString name = "";
41    TString selfile = "";    TString selfile = "";
42    TString outdir = "";    TString outdir = "";
43    bool beverbose = false;    bool beverbose = false;
44    if ( numinp > 1 ){    
45      if ( !strcmp(inps[1],"--version") ){    
46        FEVInfo(true);    for (int i = 1; i < numinp; i++){            
47        // -----------------------------------------------------//
48        if (!strcmp(inps[i], "-file")){
49          name = (TString)inps[++i];
50          cout << "file "<<name.Data()<<endl;
51          continue;
52        }
53        // -----------------------------------------------------//
54        else if (!strcmp(inps[i], "-outputDir")){
55          outdir = (TString)inps[++i];
56          cout << "outputDir "<<outdir.Data()<<endl;
57          continue;
58        }  
59        // -----------------------------------------------------//
60        else if (!strcmp(inps[i], "-selfile")){
61          selfile = (TString)inps[++i];
62          cout << "selfile "<<selfile.Data()<<endl;
63          continue;
64        }  
65        // -----------------------------------------------------//
66        else if (!strcmp(inps[i], "-v")){
67          beverbose = true;
68          continue;
69        }
70        // -----------------------------------------------------//
71        else if (!strcmp(inps[i], "-h")){
72          beverbose = true;
73          usage();
74        return(0);        return(0);
75      };      }
76      if ( !strcmp(inps[1],"-h") || !strcmp(inps[1],"--help") || numinp>7 ){      else if (!strcmp(inps[i], "-noDB")){
77        printf("\nUsage:\n\n EventViewer [-v] file selection_file output_dir \n");        NODB = true;
78        printf("\n -v                be verbose and do not fork after launching the GUI\n");        continue;
79        printf(  "  file             must be in the form: /path/to/filesfromyoda/dw_000000_00000/  \n");      }
80        printf(  "  selection_file   selection file, empty if no selection is required \n");      else if (!strcmp(inps[i], "--version")){
81        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");  
82        return(0);        return(0);
83      };      }
84      if ( !strcmp(inps[1],"-v") || !strcmp(inps[1],"--verbose") ){    };
85        beverbose = true;    //
86        if ( numinp >= 3 ) name = (TString)inps[2];    if ( !strcmp(name.Data(),"") ){
87        if ( numinp >= 4 ) selfile = (TString)inps[3];      if ( numinp > 1 ){
88        if ( numinp == 5 ) outdir = (TString)inps[4];        if ( !strcmp(inps[1],"--version") ){
89      } else {          FEVInfo(true);
90        name = (TString)inps[1];          return(0);
91        if ( numinp >= 3 ) selfile = (TString)inps[2];        };
92        if ( numinp >= 4 ) outdir = (TString)inps[3];        if ( !strcmp(inps[1],"-h") || !strcmp(inps[1],"--help") || numinp>7 ){
93            usage();
94            return(0);
95          };
96          if ( !strcmp(inps[1],"-v") || !strcmp(inps[1],"--verbose") ){
97            beverbose = true;
98            if ( numinp >= 3 ) name = (TString)inps[2];
99            if ( numinp >= 4 ) selfile = (TString)inps[3];
100            if ( numinp == 5 ) outdir = (TString)inps[4];
101          } else {
102            name = (TString)inps[1];
103            if ( numinp >= 3 ) selfile = (TString)inps[2];
104            if ( numinp >= 4 ) outdir = (TString)inps[3];
105          };
106      };      };
107    };    };
108      //
109      //
110      //
111    if ( beverbose ){    if ( beverbose ){
112      ShowEvent(name,selfile,outdir);      ShowEvent(name,selfile,outdir);
113    } else {    } else {
# Line 59  int main(int numinp, char *inps[]){ Line 115  int main(int numinp, char *inps[]){
115      // redirect to dev/null the stdout      // redirect to dev/null the stdout
116      //      //
117      int nul;      int nul;
118      nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);      nul = open("/dev/null", O_CREAT | O_RDWR,S_IRUSR | S_IWUSR);
119      dup2(nul,1);      dup2(nul,1);
120      dup2(nul,2);      dup2(nul,2);
121      close(nul);      close(nul);

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.23