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 <caloclasses.h> |
13 |
|
|
#include <iostream> |
14 |
|
|
// |
15 |
|
|
extern void ShowEvent(TString, TString, Int_t, Int_t, Int_t, Int_t, TString); |
16 |
|
|
extern void info(); |
17 |
|
|
using namespace std; |
18 |
|
|
// |
19 |
|
|
int main(int numinp, char *inps[]){ |
20 |
|
|
TString name; |
21 |
|
|
TString selfile; |
22 |
|
|
TString outdir; |
23 |
|
|
int dl; |
24 |
|
|
int figlay; |
25 |
|
|
if ( numinp < 6 ){ |
26 |
|
|
if ( numinp > 1 ){ |
27 |
|
|
if ( !strcmp(inps[1],"--version") ){ |
28 |
|
|
info(); |
29 |
|
|
return(0); |
30 |
|
|
}; |
31 |
|
|
if ( !strcmp(inps[1],"-h") || !strcmp(inps[1],"--help") ){ |
32 |
|
|
printf("\nUsage:\n\n EventViewer file selection_file figure_layout data_level output_dir \n"); |
33 |
|
|
printf("\n - file must be in the form: /path/to/filesfromyoda/dw_000000_00000/ \n"); |
34 |
|
|
printf( " - selection_file selection file, empty if no selection is required \n"); |
35 |
|
|
printf( " - figure_layout 10 bit integer to control the figure layout. Each bit \n"); |
36 |
|
|
printf( " set to 1 activate the visualization of a detector or \n"); |
37 |
|
|
printf( " a part of the figure. This is the association scheme: \n"); |
38 |
|
|
printf( " 10 9 8 7 6 5 4 3 2 1 \n"); |
39 |
|
|
printf( " special TOF AC TRK CALO S4 ND infos names legenda \n"); |
40 |
|
|
printf( " The default value is 509 = 0111111101 that is all detectors\n"); |
41 |
|
|
printf( " and infos are shown, names are hidden. \n"); |
42 |
|
|
printf( " When the \"special\" bit is set NO SIGNAL will be shown in \n"); |
43 |
|
|
printf( " the detectors. It can be used to draw a draft of the PAMELA\n"); |
44 |
|
|
printf( " apparatus without any event.\n"); |
45 |
|
|
printf( " Other examples: \n"); |
46 |
|
|
printf( " 505 = 0111111001 : don't print infos on figure \n"); |
47 |
|
|
printf( " 507 = 0111111011 : show detector names+legenda (no infos) \n"); |
48 |
|
|
printf( " 8 = 0000001000 : show only ND. \n"); |
49 |
|
|
printf( " - data_level by default the program will try to display the highest level\n"); |
50 |
|
|
printf( " data available. This flag force the level0 visualization\n"); |
51 |
|
|
printf( " when it is set to 0. Default value is -1. \n"); |
52 |
|
|
printf( " - outDir directory where to save figures\n"); |
53 |
|
|
printf("\nExamples: \n\nEventViewer /home/pamela/filesfromyoda/dw_050301_00100/ \"\" 509 -1 /home/pamela/\n"); |
54 |
|
|
printf( "EventViewer /home/pamela/filesfromyoda/dw_050301_00100/ muselection.c 509 -1 \"\"\n\n"); |
55 |
|
|
return(0); |
56 |
|
|
}; |
57 |
|
|
}; |
58 |
|
|
printf("\n Welcome to the PAMELA event viewer! \n\n"); |
59 |
|
|
// |
60 |
|
|
printf("\n You must provide the following input parameters: \n\n"); |
61 |
|
|
// |
62 |
|
|
char input[256]; |
63 |
|
|
// |
64 |
|
|
printf(" Path to YODA unpacked directory: \n "); |
65 |
|
|
cin.getline(input,256); |
66 |
|
|
name = (TString)input; |
67 |
|
|
printf(" Selection file to use?: \n "); |
68 |
|
|
cin.getline(input,256); |
69 |
|
|
if ( !strcmp(input,"") ){ |
70 |
|
|
selfile = ""; |
71 |
|
|
} else { |
72 |
|
|
selfile = (TString)input; |
73 |
|
|
}; |
74 |
|
|
printf(" Figure layout (default 509)?: \n "); |
75 |
|
|
cin.getline(input,256); |
76 |
|
|
if ( !strcmp(input,"") ){ |
77 |
|
|
figlay = 509; |
78 |
|
|
} else { |
79 |
|
|
figlay = atoi(input); |
80 |
|
|
}; |
81 |
|
|
printf(" Data level (default -1 = as high as possible)?: \n "); |
82 |
|
|
cin.getline(input,256); |
83 |
|
|
if ( !strcmp(input,"0") ){ |
84 |
|
|
dl = 0; |
85 |
|
|
} else { |
86 |
|
|
dl = -1; |
87 |
|
|
}; |
88 |
|
|
printf(" Output directory: \n "); |
89 |
|
|
cin.getline(input,256); |
90 |
|
|
outdir = (TString)input; |
91 |
|
|
// |
92 |
|
|
} else { |
93 |
|
|
printf("\n Welcome to the PAMELA event viewer! \n\n"); |
94 |
|
|
name = (TString)inps[1]; |
95 |
|
|
selfile = (TString)inps[2]; |
96 |
|
|
figlay = atoi(inps[3]); |
97 |
|
|
dl = atoi(inps[4]); |
98 |
|
|
outdir = (TString)inps[5]; |
99 |
|
|
}; |
100 |
|
|
// |
101 |
|
|
ShowEvent(name,selfile,figlay,dl,0,0,outdir); |
102 |
|
|
// |
103 |
|
|
return(0); |
104 |
|
|
} |