/[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.5 by mbongi, Mon Sep 23 08:23:46 2013 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 71  int main(int numinp, char *inps[]){ Line 127  int main(int numinp, char *inps[]){
127      pid_t pid;      pid_t pid;
128      if( (pid=fork()) == -1 ){      if( (pid=fork()) == -1 ){
129        fprintf(stderr," Fork error. Exiting.\n");        fprintf(stderr," Fork error. Exiting.\n");
130        exit(1);                return(1);        
131      };      };
132      if( !pid ) {      if( !pid ) {
133        ShowEvent(name,selfile,outdir);        ShowEvent(name,selfile,outdir);

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

  ViewVC Help
Powered by ViewVC 1.1.23