/[PAMELA software]/quicklook/dataToXML/OrbitalRate.cpp
ViewVC logotype

Diff of /quicklook/dataToXML/OrbitalRate.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by kusanagi, Mon May 1 10:19:50 2006 UTC revision 1.2 by kusanagi, Tue May 2 14:32:23 2006 UTC
# Line 34  Line 34 
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
# Line 43  Line 44 
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");
# Line 102  void InitStyle() { Line 104  void InitStyle() {
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;
# Line 116  void Rate(TString base, TString outDirec Line 118  void Rate(TString base, TString outDirec
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();
# Line 191  void Rate(TString base, TString outDirec Line 200  void Rate(TString base, TString outDirec
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();
# Line 268  void Rate(TString base, TString outDirec Line 278  void Rate(TString base, TString outDirec
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");
# Line 297  int main(int argc, char* argv[]){ Line 309  int main(int argc, char* argv[]){
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");
# Line 307  int main(int argc, char* argv[]){ Line 330  int main(int argc, char* argv[]){
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        

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.23