34 |
#include "TStyle.h" |
#include "TStyle.h" |
35 |
#include "TPaletteAxis.h" |
#include "TPaletteAxis.h" |
36 |
#include "TROOT.h" |
#include "TROOT.h" |
37 |
|
#include <sys/stat.h> |
38 |
|
|
39 |
#define TRUE 1 |
#define TRUE 1 |
40 |
#define FALSE 0 |
#define FALSE 0 |
44 |
* @param outDirectory |
* @param outDirectory |
45 |
* @param xslPath |
* @param xslPath |
46 |
*/ |
*/ |
47 |
|
using namespace std; |
48 |
|
|
49 |
void InitStyle() { |
void InitStyle() { |
50 |
gROOT->SetStyle("Plain"); |
gROOT->SetStyle("Plain"); |
104 |
|
|
105 |
} |
} |
106 |
|
|
107 |
void Rate(TString base, TString outDirectory = "", TString format = "jpg"){ |
void Rate(TString base, TString outDirectory = "", TString format = "jpg", TString mapFile = ""){ |
108 |
TTree *tr = 0; |
TTree *tr = 0; |
109 |
pamela::McmdEvent *mcmdev = 0; |
pamela::McmdEvent *mcmdev = 0; |
110 |
pamela::McmdRecord *mcmdrc = 0; |
pamela::McmdRecord *mcmdrc = 0; |
118 |
double absTime; |
double absTime; |
119 |
UInt_t i = 0; |
UInt_t i = 0; |
120 |
UInt_t j = 0; |
UInt_t j = 0; |
121 |
|
struct stat buf; |
122 |
|
|
123 |
|
i = stat (mapFile.Data(), &buf ); |
124 |
|
// If the file does not exists |
125 |
|
if (i != 0){ |
126 |
|
printf("The %s file does not exists.", mapFile.Data()); |
127 |
|
exit(0); |
128 |
|
} |
129 |
|
|
130 |
TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString(); |
TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString(); |
131 |
filename = ((TObjString*)filename.Tokenize('.')->First())->GetString(); |
filename = ((TObjString*)filename.Tokenize('.')->First())->GetString(); |
200 |
TLine *tli=NULL; |
TLine *tli=NULL; |
201 |
double step=0; |
double step=0; |
202 |
|
|
203 |
TImage *tImage=TImage::Open("Data/terra4.png"); |
|
204 |
|
TImage *tImage=TImage::Open(mapFile); |
205 |
int width=(int)(tImage->GetWidth()*0.80); |
int width=(int)(tImage->GetWidth()*0.80); |
206 |
int height=(int)(tImage->GetHeight()*0.80); |
int height=(int)(tImage->GetHeight()*0.80); |
207 |
InitStyle(); |
InitStyle(); |
278 |
} |
} |
279 |
|
|
280 |
int main(int argc, char* argv[]){ |
int main(int argc, char* argv[]){ |
281 |
TString outDir = "./"; |
TString outDir = "./"; |
282 |
TString format = "jpg"; |
TString mapFile = ""; |
283 |
|
TString format = "jpg"; |
284 |
|
|
285 |
if (argc < 2){ |
if (argc < 2){ |
286 |
printf("You have to insert at least the file to analyze \n"); |
printf("You have to insert at least the file to analyze and the mapFile \n"); |
287 |
printf("Try '--help' for more information. \n"); |
printf("Try '--help' for more information. \n"); |
288 |
exit(1); |
exit(1); |
289 |
} |
} |
290 |
|
|
291 |
if (!strcmp(argv[1], "--help")){ |
if (!strcmp(argv[1], "--help")){ |
292 |
printf( "Usage: LogToXML FILE [OPTION] \n"); |
printf( "Usage: OrbitRate FILE -map mapFile [OPTION] \n"); |
293 |
|
printf( "mapFile have to be a mercator map image [gif|jpg|png] \n"); |
294 |
printf( "\t --help Print this help and exit \n"); |
printf( "\t --help Print this help and exit \n"); |
295 |
printf( "\t -outDir[path] Path where to put the output [default ~/tmp] \n"); |
printf( "\t -outDir[path] Path where to put the output [default ~/tmp] \n"); |
296 |
printf( "\t -format[jpg|gif|ps] Format for output files [default 'jpg'] \n"); |
printf( "\t -format[jpg|gif|ps] Format for output files [default 'jpg'] \n"); |
309 |
} |
} |
310 |
} |
} |
311 |
|
|
312 |
if (!strcmp(argv[i], "-format")) |
if (!strcmp(argv[i], "-map")){ |
313 |
|
if (++i >= argc){ |
314 |
|
printf( "-map needs arguments. \n"); |
315 |
|
printf( "Try '--help' for more information. \n"); |
316 |
|
exit(1); |
317 |
|
} else { |
318 |
|
mapFile = argv[i]; |
319 |
|
continue; |
320 |
|
} |
321 |
|
} |
322 |
|
|
323 |
|
if (!strcmp(argv[i], "-format")) { |
324 |
if (++i >= argc){ |
if (++i >= argc){ |
325 |
printf( "-format needs arguments. \n"); |
printf( "-format needs arguments. \n"); |
326 |
printf( "Try '--help' for more information. \n"); |
printf( "Try '--help' for more information. \n"); |
330 |
continue; |
continue; |
331 |
} |
} |
332 |
} |
} |
|
Rate(argv[1], outDir, format); |
|
333 |
} |
} |
334 |
|
if (mapFile != ""){ |
335 |
|
Rate(argv[1], outDir, format, mapFile); |
336 |
|
} else { |
337 |
|
printf("You have to insert at least the file to analyze and the mapFile \n"); |
338 |
|
printf("Try '--help' for more information. \n"); |
339 |
|
} |
340 |
|
} |
341 |
|
|
342 |
|
|
343 |
|
|
344 |
|
|