/[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.2 by kusanagi, Tue May 2 14:32:23 2006 UTC revision 1.4 by kusanagi, Wed May 31 07:11:04 2006 UTC
# Line 35  Line 35 
35  #include "TPaletteAxis.h"  #include "TPaletteAxis.h"
36  #include "TROOT.h"  #include "TROOT.h"
37  #include <sys/stat.h>  #include <sys/stat.h>
38    #include <fstream>
39    
40  #define TRUE  1  #define TRUE  1
41  #define FALSE 0  #define FALSE 0
# Line 104  void InitStyle() { Line 105  void InitStyle() {
105    
106  }  }
107    
108  void Rate(TString base, TString outDirectory = "", TString format = "jpg", TString mapFile = ""){  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 130  void Rate(TString base, TString outDirec Line 131  void Rate(TString base, TString outDirec
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 155  void Rate(TString base, TString outDirec Line 165  void Rate(TString base, TString outDirec
165          nevents = tr->GetEntries();          nevents = tr->GetEntries();
166                    
167          bool timeFound = FALSE;          bool timeFound = FALSE;
168          while ((i < nevents) | !timeFound){          while (i < nevents) {
169                  tr->GetEntry(i);                  tr->GetEntry(i);
170                  recEntries = mcmdev->Records->GetEntries();                  recEntries = mcmdev->Records->GetEntries();
171                  while ((j < recEntries) | !timeFound){                  while (j < recEntries){
172                          mcmdrc = (pamela::McmdRecord*)mcmdev->Records->At(j);                          mcmdrc = (pamela::McmdRecord*)mcmdev->Records->At(j);
173                          if (mcmdrc->ID1 == 0xE0){                          if (not (mcmdrc == NULL) && mcmdrc->ID1 == 0xE0){
174                          mcmddata = mcmdrc->McmdData;                          mcmddata = mcmdrc->McmdData;
175                          timesync = (((ULong64_t)mcmddata->At(0)<<24)&0xFF000000) +                          timesync = (((ULong64_t)mcmddata->At(0)<<24)&0xFF000000) +
176                                          (((ULong64_t)mcmddata->At(1)<<16)&0x00FF0000) +                                          (((ULong64_t)mcmddata->At(1)<<16)&0x00FF0000) +
# Line 174  void Rate(TString base, TString outDirec Line 184  void Rate(TString base, TString outDirec
184          i++;          i++;
185          }          }
186                    
187            if (!timeFound) {
188                    printf("No timesync info have been found in the file %s", base.Data());
189                    exit(0);
190            }
191          tr = (TTree*)rootFile->Get("Physics");          tr = (TTree*)rootFile->Get("Physics");
192          TBranch *headBr = tr->GetBranch("Header");          TBranch *headBr = tr->GetBranch("Header");
193          tr->SetBranchAddress("Header", &eh);          tr->SetBranchAddress("Header", &eh);
# Line 226  void Rate(TString base, TString outDirec Line 240  void Rate(TString base, TString outDirec
240          forpal->SetAxisColor(kBlack); //Delete the stat box          forpal->SetAxisColor(kBlack); //Delete the stat box
241          forpal->SetStats(0); //Delete the stat box          forpal->SetStats(0); //Delete the stat box
242          forpal->SetMinimum(0.1);          forpal->SetMinimum(0.1);
243          forpal->SetMaximum(200);          forpal->SetMaximum(15);
244          forpal->SetBinContent(5,1);    // just to initialize the histo          forpal->SetBinContent(5,1);    // just to initialize the histo
245          forpal->SetContour(50);          forpal->SetContour(50);
246          TPaletteAxis *tpp=(TPaletteAxis*)((forpal->GetListOfFunctions())->FindObject("palette"));          TPaletteAxis *tpp=(TPaletteAxis*)((forpal->GetListOfFunctions())->FindObject("palette"));
# Line 280  void Rate(TString base, TString outDirec Line 294  void Rate(TString base, TString outDirec
294  int main(int argc, char* argv[]){  int main(int argc, char* argv[]){
295      TString outDir  = "./";      TString outDir  = "./";
296      TString mapFile = "";      TString mapFile = "";
297        TString tleFile = "";
298      TString format  = "jpg";      TString format  = "jpg";
299            
300   if (argc < 2){   if (argc < 2){
# Line 292  int main(int argc, char* argv[]){ Line 307  int main(int argc, char* argv[]){
307          printf( "Usage: OrbitRate FILE -map mapFile [OPTION] \n");          printf( "Usage: OrbitRate FILE -map mapFile [OPTION] \n");
308          printf( "mapFile have to be a mercator map image [gif|jpg|png] \n");          printf( "mapFile have to be a mercator map image [gif|jpg|png] \n");
309          printf( "\t --help                 Print this help and exit \n");          printf( "\t --help                 Print this help and exit \n");
310            printf( "\t -tleFile[path]         Path where to find the tle infos [default dummyOrbit] \n");
311            printf( "\t\tThe tle file have to satisfy a 3-line structure like (this is the included dummyOrbit)\n ");
312            printf( "\t\t\tGP4 Test\n");
313            printf( "\t\t\t1 25544U 98067A   06117.32388940  .00009459  00000-0  64427-4 0  8131\n");
314            printf( "\t\t\t2 25544  51.6388  89.2928 0009043 155.3293 354.6512 15.75673697425143\n");
315          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");
316          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");
317          exit(1);          exit(1);
# Line 309  int main(int argc, char* argv[]){ Line 329  int main(int argc, char* argv[]){
329          }          }
330      }      }
331    
332       if (!strcmp(argv[i], "-tle")){
333            if (++i >= argc){
334                printf( "-tle needs arguments. \n");
335                printf( "Try '--help' for more information. \n");
336                exit(1);
337            } else {
338                tleFile = argv[i];
339                continue;
340            }
341        }
342    
343      if (!strcmp(argv[i], "-map")){      if (!strcmp(argv[i], "-map")){
344          if (++i >= argc){          if (++i >= argc){
345              printf( "-map needs arguments. \n");              printf( "-map needs arguments. \n");

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

  ViewVC Help
Powered by ViewVC 1.1.23