--- eventviewer/flight/src/FEventViewer.cpp 2009/08/11 13:03:42 1.2 +++ eventviewer/flight/src/FEventViewer.cpp 2013/09/23 08:23:46 1.5 @@ -8,6 +8,7 @@ // // 0.00 - 1.00 : working. // +#include #include #include #include @@ -18,40 +19,95 @@ #include // using namespace std; +Bool_t NODB; +// + +void usage(){ + printf("\nUsage:\n\n EventViewer [-v] file selection_file output_dir \n"); + printf("\n -v be verbose and do not fork after launching the GUI\n"); + printf( " -file file must be in the form: /path/to/filesfromyoda/dw_000000_00000/ \n"); + printf( " -selfile selection_file selection file, empty if no selection is required \n"); + printf( " -outputDir outDir directory where to save figures\n"); + printf( " -noDB do not DB connection in PamLevel2 (RUNINFO WILL NOT WORK!)\n"); + 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"); +} + // int main(int numinp, char *inps[]){ TString name = ""; TString selfile = ""; TString outdir = ""; bool beverbose = false; - if ( numinp > 1 ){ - if ( !strcmp(inps[1],"--version") ){ - FEVInfo(true); + + + for (int i = 1; i < numinp; i++){ + // -----------------------------------------------------// + if (!strcmp(inps[i], "-file")){ + name = (TString)inps[++i]; + cout << "file "<7 ){ - printf("\nUsage:\n\n EventViewer [-v] file selection_file output_dir \n"); - printf("\n -v be verbose and do not fork after launching the GUI\n"); - printf( " file must be in the form: /path/to/filesfromyoda/dw_000000_00000/ \n"); - printf( " selection_file selection file, empty if no selection is required \n"); - printf( " outDir directory where to save figures\n"); - 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"); + } + else if (!strcmp(inps[i], "-noDB")){ + NODB = true; + continue; + } + else if (!strcmp(inps[i], "--version")){ + FEVInfo(true); return(0); - }; - if ( !strcmp(inps[1],"-v") || !strcmp(inps[1],"--verbose") ){ - beverbose = true; - if ( numinp >= 3 ) name = (TString)inps[2]; - if ( numinp >= 4 ) selfile = (TString)inps[3]; - if ( numinp == 5 ) outdir = (TString)inps[4]; - } else { - name = (TString)inps[1]; - if ( numinp >= 3 ) selfile = (TString)inps[2]; - if ( numinp >= 4 ) outdir = (TString)inps[3]; + } + }; + // + if ( !strcmp(name.Data(),"") ){ + if ( numinp > 1 ){ + if ( !strcmp(inps[1],"--version") ){ + FEVInfo(true); + return(0); + }; + if ( !strcmp(inps[1],"-h") || !strcmp(inps[1],"--help") || numinp>7 ){ + usage(); + return(0); + }; + if ( !strcmp(inps[1],"-v") || !strcmp(inps[1],"--verbose") ){ + beverbose = true; + if ( numinp >= 3 ) name = (TString)inps[2]; + if ( numinp >= 4 ) selfile = (TString)inps[3]; + if ( numinp == 5 ) outdir = (TString)inps[4]; + } else { + name = (TString)inps[1]; + if ( numinp >= 3 ) selfile = (TString)inps[2]; + if ( numinp >= 4 ) outdir = (TString)inps[3]; + }; }; }; + // + // + // if ( beverbose ){ ShowEvent(name,selfile,outdir); } else {