10 |
// |
// |
11 |
#include <TSystem.h> |
#include <TSystem.h> |
12 |
#include <iostream> |
#include <iostream> |
13 |
|
#include <sstream> |
14 |
|
#include <cstdlib> |
15 |
#include <sys/types.h> |
#include <sys/types.h> |
16 |
#include <unistd.h> |
#include <unistd.h> |
17 |
#include <stdio.h> |
#include <stdio.h> |
18 |
|
#include <sys/stat.h> |
19 |
|
#include <cstdlib> |
20 |
// |
// |
21 |
extern void FCaloQLOOK(TString, int, int, TString, TString, Bool_t, Bool_t); |
extern void FCaloQLOOK(TString, int, int, TString, TString, Bool_t, Bool_t); |
22 |
extern void info(); |
extern void info(); |
23 |
|
extern void stringcopy(TString& , const TString& , Int_t , Int_t ); |
24 |
using namespace std; |
using namespace std; |
25 |
// |
// |
26 |
void usage(){ |
void usage(){ |
33 |
printf( " -toev to_event last event to analyze [default = 0] \n"); |
printf( " -toev to_event last event to analyze [default = 0] \n"); |
34 |
printf( " -oudDir output_dir path of the output directory [default = ./] (with or without final '/') \n"); |
printf( " -oudDir output_dir path of the output directory [default = ./] (with or without final '/') \n"); |
35 |
printf( " -format format format for output file (without . )[default = png] \n"); |
printf( " -format format format for output file (without . )[default = png] \n"); |
36 |
|
printf( " -interactive shows figures on the screen [default = non-interactive] \n"); |
37 |
|
printf( " -wait wait for canvas to be closed before going on [default = don't wait] \n"); |
38 |
printf("\nExamples: "); |
printf("\nExamples: "); |
39 |
printf("\n\nFCaloQLOOK /home/pamela/filesfromyoda/dw_050301_00100.root \n"); |
printf("\n\nFCaloQLOOK /home/pamela/filesfromyoda/dw_050301_00100.root \n"); |
40 |
printf("\nFCaloQLOOK -v -name /home/pamela/filesfromyoda/dw_050301_00100.root \n"); |
printf("\nFCaloQLOOK -v -name /home/pamela/filesfromyoda/dw_050301_00100.root \n"); |
43 |
|
|
44 |
int main(int numinp, char *inps[]){ |
int main(int numinp, char *inps[]){ |
45 |
TString name; |
TString name; |
46 |
TString outdir = ""; |
TString outdir = "./"; |
47 |
TString format = "png"; |
TString format = "png"; |
48 |
int fromev = 0; |
int fromev = 0; |
49 |
int toev = 0; |
int toev = 0; |
116 |
return(0); |
return(0); |
117 |
}; |
}; |
118 |
// |
// |
119 |
|
stringstream figsave; |
120 |
if ( !beverbose ){ |
if ( !beverbose ){ |
121 |
// |
// |
122 |
|
const string fil = gSystem->BaseName(name.Data()); |
123 |
|
Int_t posiz = fil.find(".root"); |
124 |
|
// |
125 |
|
TString file2; |
126 |
|
if ( posiz == -1 ){ |
127 |
|
file2 = gSystem->BaseName(name.Data()); |
128 |
|
} else { |
129 |
|
Int_t posiz2 = 0; |
130 |
|
stringcopy(file2,gSystem->BaseName(name.Data()),posiz2,posiz); |
131 |
|
}; |
132 |
|
const char *figrec = file2; |
133 |
|
// |
134 |
|
const char *outDir = outdir; |
135 |
|
figsave.str(""); |
136 |
|
figsave << outDir << "/" ; |
137 |
|
figsave << figrec << "_CaloQLOOK.txt"; |
138 |
|
// |
139 |
// redirect to /dev/null the stdout and stderr |
// redirect to /dev/null the stdout and stderr |
140 |
// |
// |
141 |
nul = open("/dev/null", O_CREAT | O_RDWR,S_IREAD | S_IWRITE); |
nul = open(figsave.str().c_str(), O_CREAT | O_RDWR,S_IREAD | S_IWRITE | S_IRGRP | S_IWGRP | S_IROTH); |
142 |
dup2(nul,1); |
dup2(nul,1); |
143 |
dup2(nul,2); |
dup2(nul,2); |
144 |
}; |
}; |
145 |
printf("\n Welcome to FCaloQLOOK! \n"); |
printf("\n Welcome to FCaloQLOOK! v1r23 \n"); |
146 |
// |
// |
147 |
FCaloQLOOK(name,fromev,toev,outdir,format,iactive,w4i); |
FCaloQLOOK(name,fromev,toev,outdir,format,iactive,w4i); |
148 |
// |
// |