/[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.3 by kusanagi, Tue May 23 13:48:05 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    #include <fstream>
39    
40  #define TRUE  1  #define TRUE  1
41  #define FALSE 0  #define FALSE 0
# Line 43  Line 45 
45   * @param outDirectory   * @param outDirectory
46   * @param xslPath   * @param xslPath
47   */   */
48    using namespace std;
49    
50  void InitStyle() {  void InitStyle() {
51    gROOT->SetStyle("Plain");    gROOT->SetStyle("Plain");
# Line 102  void InitStyle() { Line 105  void InitStyle() {
105    
106  }  }
107    
108  void Rate(TString base, TString outDirectory = "", TString format = "jpg"){  void Rate(TString base, TString outDirectory = "", TString format = "jpg", TString mapFile = "", TString tleFile = ""){
109          TTree                  *tr         = 0;          TTree                  *tr         = 0;
110          pamela::McmdEvent      *mcmdev     = 0;          pamela::McmdEvent      *mcmdev     = 0;
111          pamela::McmdRecord     *mcmdrc     = 0;          pamela::McmdRecord     *mcmdrc     = 0;
# Line 116  void Rate(TString base, TString outDirec Line 119  void Rate(TString base, TString outDirec
119          double absTime;          double absTime;
120          UInt_t i = 0;          UInt_t i = 0;
121          UInt_t j = 0;          UInt_t j = 0;
122            struct stat buf;
123                    
124            i = stat (mapFile.Data(), &buf );
125            // If the file does not exists
126            if (i != 0){
127                    printf("The %s file does not exists.", mapFile.Data());
128                    exit(0);
129            }
130                    
131          TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString();          TString filename = ((TObjString*)base.Tokenize('/')->Last())->GetString();
132          filename = ((TObjString*)filename.Tokenize('.')->First())->GetString();          filename = ((TObjString*)filename.Tokenize('.')->First())->GetString();
133          // Test SGP4          // Test SGP4
134          string str1 = "SGP4 Test";          string str1 = "SGP4 Test";
135          string str2 = "1 25544U 98067A   06117.32388940  .00009459  00000-0  64427-4 0  8131";          string str2 = "1 25544U 98067A   06117.32388940  .00009459  00000-0  64427-4 0  8131";
136          string str3 = "2 25544  51.6388  89.2928 0009043 155.3293 354.6512 15.75673697425143";          string str3 = "2 25544  51.6388  89.2928 0009043 155.3293 354.6512 15.75673697425143";
137            if (tleFile != ""){
138                    fstream fileTle(tleFile.Data(),ios::in);
139                    if (fileTle.is_open()) {
140                            getline (fileTle,str1);
141                            getline (fileTle,str2);
142                            getline (fileTle,str3);
143                    }
144                    fileTle.close();
145            }
146    
147          cTle tle1(str1, str2, str3);          cTle tle1(str1, str2, str3);
148          cOrbit       orbit(tle1);          cOrbit       orbit(tle1);
# Line 191  void Rate(TString base, TString outDirec Line 210  void Rate(TString base, TString outDirec
210          TLine *tli=NULL;          TLine *tli=NULL;
211          double step=0;          double step=0;
212    
213          TImage *tImage=TImage::Open("Data/terra4.png");  
214            TImage *tImage=TImage::Open(mapFile);
215          int width=(int)(tImage->GetWidth()*0.80);          int width=(int)(tImage->GetWidth()*0.80);
216          int height=(int)(tImage->GetHeight()*0.80);          int height=(int)(tImage->GetHeight()*0.80);
217          InitStyle();          InitStyle();
# Line 216  void Rate(TString base, TString outDirec Line 236  void Rate(TString base, TString outDirec
236          forpal->SetAxisColor(kBlack); //Delete the stat box          forpal->SetAxisColor(kBlack); //Delete the stat box
237          forpal->SetStats(0); //Delete the stat box          forpal->SetStats(0); //Delete the stat box
238          forpal->SetMinimum(0.1);          forpal->SetMinimum(0.1);
239          forpal->SetMaximum(200);          forpal->SetMaximum(15);
240          forpal->SetBinContent(5,1);    // just to initialize the histo          forpal->SetBinContent(5,1);    // just to initialize the histo
241          forpal->SetContour(50);          forpal->SetContour(50);
242          TPaletteAxis *tpp=(TPaletteAxis*)((forpal->GetListOfFunctions())->FindObject("palette"));          TPaletteAxis *tpp=(TPaletteAxis*)((forpal->GetListOfFunctions())->FindObject("palette"));
# Line 268  void Rate(TString base, TString outDirec Line 288  void Rate(TString base, TString outDirec
288  }  }
289    
290  int main(int argc, char* argv[]){  int main(int argc, char* argv[]){
291      TString outDir = "./";      TString outDir  = "./";
292      TString format = "jpg";      TString mapFile = "";
293        TString tleFile = "";
294        TString format  = "jpg";
295            
296   if (argc < 2){   if (argc < 2){
297      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");
298      printf("Try '--help' for more information. \n");      printf("Try '--help' for more information. \n");
299      exit(1);      exit(1);
300    }      }  
301    
302    if (!strcmp(argv[1], "--help")){    if (!strcmp(argv[1], "--help")){
303          printf( "Usage: LogToXML FILE [OPTION] \n");          printf( "Usage: OrbitRate FILE -map mapFile [OPTION] \n");
304            printf( "mapFile have to be a mercator map image [gif|jpg|png] \n");
305          printf( "\t --help                 Print this help and exit \n");          printf( "\t --help                 Print this help and exit \n");
306            printf( "\t -tleFile[path]         Path where to find the tle infos [default dummyOrbit] \n");
307            printf( "\t\tThe tle file have to satisfy a 3-line structure like (this is the included dummyOrbit)\n ");
308            printf( "\t\t\tGP4 Test\n");
309            printf( "\t\t\t1 25544U 98067A   06117.32388940  .00009459  00000-0  64427-4 0  8131\n");
310            printf( "\t\t\t2 25544  51.6388  89.2928 0009043 155.3293 354.6512 15.75673697425143\n");
311          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");
312          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");
313          exit(1);          exit(1);
# Line 297  int main(int argc, char* argv[]){ Line 325  int main(int argc, char* argv[]){
325          }          }
326      }      }
327    
328      if (!strcmp(argv[i], "-format"))     if (!strcmp(argv[i], "-tle")){
329            if (++i >= argc){
330                printf( "-tle needs arguments. \n");
331                printf( "Try '--help' for more information. \n");
332                exit(1);
333            } else {
334                tleFile = argv[i];
335                continue;
336            }
337        }
338    
339        if (!strcmp(argv[i], "-map")){
340            if (++i >= argc){
341                printf( "-map needs arguments. \n");
342                printf( "Try '--help' for more information. \n");
343                exit(1);
344            } else {
345                mapFile = argv[i];
346                continue;
347            }
348        }
349    
350        if (!strcmp(argv[i], "-format")) {
351          if (++i >= argc){          if (++i >= argc){
352              printf( "-format needs arguments. \n");              printf( "-format needs arguments. \n");
353              printf( "Try '--help' for more information. \n");              printf( "Try '--help' for more information. \n");
# Line 307  int main(int argc, char* argv[]){ Line 357  int main(int argc, char* argv[]){
357                  continue;                  continue;
358          }          }
359      }      }
         Rate(argv[1], outDir, format);  
360  }  }
361    if (mapFile != ""){
362            Rate(argv[1], outDir, format, mapFile);
363    } else {
364            printf("You have to insert at least the file to analyze and the mapFile \n");
365            printf("Try '--help' for more information. \n");
366        }
367    }
368    
369    
370    
371        

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

  ViewVC Help
Powered by ViewVC 1.1.23