| 1 |
// |
| 2 |
// GroundDataConvert.cc -- standalone program to call the GroundDataConvert macro. |
| 3 |
// by Emiliano Mocchiutti |
| 4 |
// |
| 5 |
// Version 1.00 (2005/11/29) |
| 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 int GroundDataConvert(TString, TString, TString, TString, Int_t); |
| 16 |
extern void info(); |
| 17 |
using namespace std; |
| 18 |
// |
| 19 |
int main(int numinp, char *inps[]){ |
| 20 |
TString name; |
| 21 |
TString outdir; |
| 22 |
TString det; |
| 23 |
TString lev; |
| 24 |
int force; |
| 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 GroundDataConvert file detector level outDir force \n"); |
| 33 |
printf("\n - file can be in the form: /path/to/filesfromyoda/dw_000000_00000/ or, for \n"); |
| 34 |
printf( " TOF and tracker, can be the full path and name of the rz file\n"); |
| 35 |
printf( " - detector can be tracker, tof or anticounter \n"); |
| 36 |
printf( " - level can be 1 or 2 for tracker, 1 for AC and TOF\n"); |
| 37 |
printf( " - outDir output directory\n"); |
| 38 |
printf( " - force force flag (1 = force, 0 do not force) \n"); |
| 39 |
printf("\nExample: \n\nGroundDataConvert /home/pamela/filesfromyoda/dw_050301_00100/ anticounter 1 /home/pamela/ 1 \n\n"); |
| 40 |
return(0); |
| 41 |
}; |
| 42 |
}; |
| 43 |
printf("\n Welcome to the PAMELA ground data converter! \n"); |
| 44 |
// |
| 45 |
printf("\n You must provide the following input parameters: \n\n"); |
| 46 |
// |
| 47 |
char input[256]; |
| 48 |
// |
| 49 |
printf(" Path to YODA unpacked directory (if files are in Physics/LevelX/...)\n or full path and name of the rz file: \n "); |
| 50 |
cin.getline(input,256); |
| 51 |
name = (TString)input; |
| 52 |
printf(" Detector (tracker/tof/anticounter)?: \n "); |
| 53 |
cin.getline(input,256); |
| 54 |
det = (TString)input; |
| 55 |
printf(" Data level (1/2)?: \n "); |
| 56 |
cin.getline(input,256); |
| 57 |
lev = (TString)input; |
| 58 |
printf(" Output directory?: \n "); |
| 59 |
cin.getline(input,256); |
| 60 |
outdir = (TString)input; |
| 61 |
printf(" Force processing (1=yes, 0=no)?: \n "); |
| 62 |
cin.getline(input,256); |
| 63 |
force = atoi(input); |
| 64 |
// |
| 65 |
} else { |
| 66 |
printf("\n Welcome to the PAMELA ground data converter! \n"); |
| 67 |
name = (TString)inps[1]; |
| 68 |
det = (TString)inps[2]; |
| 69 |
lev = (TString)inps[3]; |
| 70 |
outdir = (TString)inps[4]; |
| 71 |
force = atoi(inps[5]); |
| 72 |
}; |
| 73 |
// |
| 74 |
Int_t ERR=GroundDataConvert(name,det,lev,outdir,force); |
| 75 |
// |
| 76 |
return(ERR); |
| 77 |
} |