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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Fri Jul 14 14:18:06 2006 UTC (18 years, 5 months ago) by mocchiut
Branch: MAIN
CVS Tags: v3r00, v4r00, v2r01, v2r00beta, v2r02
New _BETA_ and buggy version

1 mocchiut 1.1 //
2     // EventViewer.cc -- standalone program to call the EventViewer macro.
3     // by Emiliano Mocchiutti
4     //
5     // Version 1.00 (2005/11/07)
6     //
7     // Changelog:
8     //
9     // 0.00 - 1.00 : working.
10     //
11     #include <TSystem.h>
12     #include <iostream>
13     #include <sys/types.h>
14     #include <unistd.h>
15     #include <stdio.h>
16     //
17     #include <FEventViewerCore.h>
18     #include <FEVVerl2.h>
19     //
20     using namespace std;
21     //
22     int main(int numinp, char *inps[]){
23     TString name = "";
24     TString selfile = "";
25     TString outdir = "";
26     bool beverbose = false;
27     if ( numinp > 1 ){
28     if ( !strcmp(inps[1],"--version") ){
29     FEVInfo(true);
30     return(0);
31     };
32     if ( !strcmp(inps[1],"-h") || !strcmp(inps[1],"--help") || numinp>7 ){
33     printf("\nUsage:\n\n EventViewer [-v] file selection_file output_dir \n");
34     printf("\n -v be verbose and do not fork after launching the GUI\n");
35     printf( " file must be in the form: /path/to/filesfromyoda/dw_000000_00000/ \n");
36     printf( " selection_file selection file, empty if no selection is required \n");
37     printf( " outDir directory where to save figures\n");
38     printf("\nExamples: \n\nEventViewer /home/pamela/filesfromyoda/dw_050301_00100/ \"\" /home/pamela/\n");
39     printf( "EventViewer -v /home/pamela/filesfromyoda/dw_050301_00100/ muselection.c \"\"\n\n");
40     printf( "EventViewer \n\n");
41     printf( "EventViewer -v \n\n");
42     return(0);
43     };
44     if ( !strcmp(inps[1],"-v") || !strcmp(inps[1],"--verbose") ){
45     beverbose = true;
46     if ( numinp >= 3 ) name = (TString)inps[2];
47     if ( numinp >= 4 ) selfile = (TString)inps[3];
48     if ( numinp == 5 ) outdir = (TString)inps[4];
49     } else {
50     name = (TString)inps[1];
51     if ( numinp >= 3 ) selfile = (TString)inps[2];
52     if ( numinp >= 4 ) outdir = (TString)inps[3];
53     };
54     };
55     if ( beverbose ){
56     ShowEvent(name,selfile,outdir);
57     } else {
58     //
59     // redirect to dev/null the stdout
60     //
61     int nul;
62     nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE);
63     dup2(nul,1);
64     dup2(nul,2);
65     close(nul);
66     //
67     printf("\n Welcome to the PAMELA event viewer! \n\n");
68     //
69     // fork process
70     //
71     pid_t pid;
72     if( (pid=fork()) == -1 ){
73     fprintf(stderr," Fork error. Exiting.\n");
74     exit(1);
75     };
76     if( !pid ) {
77     ShowEvent(name,selfile,outdir);
78     };
79     };
80     //
81     return(0);
82     }

  ViewVC Help
Powered by ViewVC 1.1.23