Changeset 7432
- Timestamp:
- 11/28/05 11:15:09 (19 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r7431 r7432 18 18 19 19 -*-*- END OF LINE -*-*- 20 2005/11/28 Thomas Bretz 21 22 * callisto.cc, ganymed.cc, mars.cc, merpp.cc, readdaq.cc, 23 readraw.cc, showlog.cc, showplot.cc, sponde.cc, star.cc: 24 - fixed a bug in displaying the startup message which prevented 25 the compilation date from beeing displayed 26 - added abbreviations for calling some programs (see NEWS) 27 28 * mastro/MAstro.[h,cc]: 29 - added function to calc date of easter 30 31 * mbase/MEnv.[h,cc]: 32 - added function to support some attributes (TAtt*) 33 34 * mbase/MTime.[h,cc]: 35 - added support for locales in Set/GetStringFmt 36 - added function to calc date of easter 37 38 * mjobs/MJCut.cc: 39 - output is called "Hadronness" not "MHadronness" 40 41 42 20 43 2005/11/25 Thomas Bretz 21 44 -
trunk/MagicSoft/Mars/NEWS
r7431 r7432 2 2 3 3 *** Version <cvs> 4 5 - general: Fixed a bug in most of the programs which prevented the 6 compile date in the startup message to be displayed 7 8 - general: Simplified program calls. The following abbreviations 9 are now possible: 10 showlog callisto 55599 11 showplot signal 55599 12 star 55599 13 callisto 55999 14 ganymed 2 15 In this cases the corrsponding root-, log-, sequence- or dataset- 16 filename is automatically compiled using the default datacenter 17 paths ("/magic/*") 4 18 5 19 - general: Fixed a long outstanding bug which made axis tick marks … … 18 32 is useful to perform g/h-separation cuts before training the random 19 33 forest. 34 35 - StatusDisplay: Fixed the algorithm to calculate the size ratio 36 of the display, it gave wrong results espacially for big sizes. 37 Now the embedded canvas should always have a ratio width/height=3/2. 38 The "Size" options have been updated with values fitting the 3/2 39 size ratio. 20 40 21 41 - RanForest: -
trunk/MagicSoft/Mars/callisto.cc
r7349 r7432 33 33 gLog << " Callisto - MARS V" << MARSVER << endl; 34 34 gLog << " MARS -- CALibrate LIght Signals and Time Offsets" << endl; 35 gLog << " Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ ">" << endl;35 gLog << " Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ << ">" << endl; 36 36 gLog << "========================================================" << endl; 37 37 gLog << endl; … … 44 44 gLog << all << endl; 45 45 gLog << "Sorry the usage is:" << endl; 46 gLog << " callisto [-c] [-y] [options] sequence.txt " << endl << endl;46 gLog << " callisto [-c] [-y] [options] sequence.txt|number" << endl << endl; 47 47 gLog << " Arguments:" << endl; 48 48 gLog << " sequence.txt: ASCII file defining a sequence of runs" << endl; 49 gLog << " number: The sequence number (using file in the datacenter)" << endl; 49 50 gLog << " For more details see MSequence" << endl; 50 51 gLog << " Root Options:" << endl; … … 248 249 // Setup sequence file and check for its existance 249 250 // 250 const TString kSequence = arg.GetArgumentStr(0); 251 TString kSequence = arg.GetArgumentStr(0); 252 253 if (kSequence.IsDigit()) 254 { 255 const Int_t numseq = kSequence.Atoi(); 256 kSequence = Form("/magic/sequences/%04d/sequence%08d.txt", numseq/10000, numseq); 257 gLog << inf << "Inflated sequence file: " << kSequence << endl; 258 } 251 259 252 260 if (gSystem->AccessPathName(kSequence, kFileExists)) -
trunk/MagicSoft/Mars/ganymed.cc
r7409 r7432 30 30 gLog << " Ganymed - MARS V" << MARSVER << endl; 31 31 gLog << " MARS -- Gammas Are Now Your Most Exciting Discovery" << endl; 32 gLog << " Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ ">" << endl;32 gLog << " Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ << ">" << endl; 33 33 gLog << "========================================================" << endl; 34 34 gLog << endl; … … 41 41 gLog << all << endl; 42 42 gLog << "Sorry the usage is:" << endl; 43 gLog << " ganymed [options] dataset.txt " << endl << endl;43 gLog << " ganymed [options] dataset.txt|number" << endl << endl; 44 44 gLog << " Arguments:" << endl; 45 45 gLog << " dataset.txt: ASCII file defining a collection of sequences" << endl; 46 gLog << " number: The dataset number (using file in the datacenter)" << endl; 46 47 gLog << " For more details see MDataSet." << endl; 47 48 gLog << " Root Options:" << endl; … … 164 165 // Setup sequence file and check for its existence 165 166 // 166 const TString kSequences = arg.GetArgumentStr(0); 167 TString kSequences = arg.GetArgumentStr(0); 168 169 // 170 // Something special for datacenter access 171 // 172 if (kSequences.IsDigit()) 173 { 174 const Int_t numseq = kSequences.Atoi(); 175 kSequences = Form("/magic/datasets/%04d/dataset%08d.txt", numseq/10000, numseq); 176 gLog << inf << "inflated dataset file: " << kSequences << endl; 177 } 167 178 168 179 if (gSystem->AccessPathName(kSequences, kFileExists)) 169 180 { 170 gLog << err << "Sorry, sequencesfile '" << kSequences << "' doesn't exist." << endl;181 gLog << err << "Sorry, dataset file '" << kSequences << "' doesn't exist." << endl; 171 182 return 2; 172 183 } … … 196 207 if (!seq.IsValid()) 197 208 { 198 gLog << err << " Sequences read but not valid!" << endl << endl;209 gLog << err << "Dataset read but not valid (maybe analysis number not set)!" << endl << endl; 199 210 return 2; 200 211 } -
trunk/MagicSoft/Mars/mars.cc
r7179 r7432 36 36 gLog << " MARS V" << MARSVER << endl; 37 37 gLog << " Magic Analysis and Reconstruction Software" << endl; 38 gLog << " Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ ">" << endl;38 gLog << " Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ << ">" << endl; 39 39 gLog << "==================================================" << endl; 40 40 gLog << endl; -
trunk/MagicSoft/Mars/mastro/MAstro.cc
r7227 r7432 623 623 return TMath::ACos(d)*TMath::RadToDeg(); 624 624 } 625 626 // -------------------------------------------------------------------------- 627 // 628 // Returned is the offset (number of days) which must be added to 629 // March 1st of the given year, eg: 630 // 631 // Int_t offset = GetDayOfEaster(2004); 632 // 633 // MTime t; 634 // t.Set(year, 3, 1); 635 // t.SetMjd(t.GetMjd()+offset); 636 // 637 // cout << t << endl; 638 // 639 // If the date coudn't be calculated -1 is returned. 640 // 641 // The minimum value returned is 21 corresponding to March 22. 642 // The maximum value returned is 55 corresponding to April 25. 643 // 644 // -------------------------------------------------------------------------- 645 // 646 // Gauss'sche Formel zur Berechnung des Osterdatums 647 // Wann wird Ostern gefeiert? Wie erfährt man das Osterdatum für ein 648 // bestimmtes Jahr, ohne in einen Kalender zu schauen? 649 // 650 // Ostern ist ein "bewegliches" Fest. Es wird am ersten Sonntag nach dem 651 // ersten Frühlingsvollmond gefeiert. Damit ist der 22. März der früheste 652 // Termin, der 25. April der letzte, auf den Ostern fallen kann. Von 653 // diesem Termin hängen auch die Feste Christi Himmelfahrt, das 40 Tage 654 // nach Ostern, und Pfingsten, das 50 Tage nach Ostern gefeiert wird, ab. 655 // 656 // Von Carl Friedrich Gauß (Mathematiker, Astronom und Physiker; 657 // 1777-1855) stammt ein Algorithmus, der es erlaubt ohne Kenntnis des 658 // Mondkalenders die Daten der Osterfeste für die Jahre 1700 bis 2199 zu 659 // bestimmen. 660 // 661 // Gib eine Jahreszahl zwischen 1700 und 2199 ein: 662 // 663 // Und so funktioniert der Algorithmus: 664 // 665 // Es sei: 666 // 667 // J die Jahreszahl 668 // a der Divisionsrest von J/19 669 // b der Divisionsrest von J/4 670 // c der Divisionsrest von J/7 671 // d der Divisionsrest von (19*a + M)/30 672 // e der Divisionsrest von (2*b + 4*c + 6*d + N)/7 673 // 674 // wobei M und N folgende Werte annehmen: 675 // 676 // für die Jahre M N 677 // 1700-1799 23 3 678 // 1800-1899 23 4 679 // 1900-2099 24 5 680 // 2100-2199 24 6 681 // 682 // Dann fällt Ostern auf den 683 // (22 + d + e)ten März 684 // 685 // oder den 686 // (d + e - 9)ten April 687 // 688 // Beachte: 689 // Anstelle des 26. Aprils ist immer der 19. April zu setzen, 690 // anstelle des 25. Aprils immer dann der 18. April, wenn d=28 und a>10. 691 // 692 // Literatur: 693 // Schüler-Rechenduden 694 // Bibliographisches Institut 695 // Mannheim, 1966 696 // 697 // -------------------------------------------------------------------------- 698 // 699 // Der Ostersonntag ist ein sog. unregelmäßiger Feiertag. Alle anderen 700 // unregelmäßigen Feiertage eines Jahres leiten sich von diesem Tag ab: 701 // 702 // * Aschermittwoch ist 46 Tage vor Ostern. 703 // * Pfingsten ist 49 Tage nach Ostern. 704 // * Christi Himmelfahrt ist 10 Tage vor Pfingsten. 705 // * Fronleichnam ist 11 Tage nach Pfingsten. 706 // 707 // Man muß also nur den Ostersonntag ermitteln, um alle anderen 708 // unregelmäßigen Feiertage zu berechnen. Doch wie geht das? 709 // 710 // Dazu etwas Geschichte: 711 // 712 // Das 1. Kirchenkonzil im Jahre 325 hat festgelegt: 713 // 714 // * Ostern ist stets am ersten Sonntag nach dem ersten Vollmond des 715 // Frühlings. 716 // * Stichtag ist der 21. März, die "Frühlings-Tagundnachtgleiche". 717 // 718 // Am 15.10.1582 wurde von Papst Gregor XIII. der bis dahin gültige 719 // Julianische Kalender reformiert. Der noch heute gültige Gregorianische 720 // Kalender legt dabei folgendes fest: 721 // 722 // Ein Jahr hat 365 Tage und ein Schaltjahr wird eingefügt, wenn das Jahr 723 // durch 4 oder durch 400, aber nicht durch 100 teilbar ist. Hieraus 724 // ergeben sich die zwei notwendigen Konstanten, um den Ostersonntag zu 725 // berechnen: 726 // 727 // 1. Die Jahreslänge von und bis zum Zeitpunkt der 728 // Frühlings-Tagundnachtgleiche: 365,2422 mittlere Sonnentage 729 // 2. Ein Mondmonat: 29,5306 mittlere Sonnentage 730 // 731 // Mit der "Osterformel", von Carl Friedrich Gauß (1777-1855) im Jahre 1800 732 // entwickelt, läßt sich der Ostersonntag für jedes Jahr von 1583 bis 8202 733 // berechnen. 734 // 735 // Der früheste mögliche Ostertermin ist der 22. März. (Wenn der Vollmond 736 // auf den 21. März fällt und der 22. März ein Sonntag ist.) 737 // 738 // Der späteste mögliche Ostertermin ist der 25. April. (Wenn der Vollmond 739 // auf den 21. März fällt und der 21. März ein Sonntag ist.) 740 // 741 Int_t MAstro::GetEasterOffset(UShort_t year) 742 { 743 if (year<1700 || year>2199) 744 { 745 cout << "MAstro::GetDayOfEaster - Year " << year << " not between 1700 and 2199" << endl; 746 return -1; 747 } 748 749 const Int_t M = (year+2900)/200; 750 751 Int_t N=0; 752 switch (year/100) 753 { 754 case 17: N=3; break; 755 case 18: N=4; break; 756 case 19: 757 case 20: N=5; break; 758 case 21: N=6; break; 759 } 760 761 const Int_t a = year%19; 762 const Int_t b = year%4; 763 const Int_t c = year%7; 764 const Int_t d = (19*a + M)%30; 765 const Int_t e = (2*b + 4*c + 6*d + N)%7; 766 767 if (e==6 && d==28 && a>10) 768 return 48; 769 770 if (d+e==35) 771 return 49; 772 773 return d + e + 21; 774 } -
trunk/MagicSoft/Mars/mastro/MAstro.h
r7202 r7432 10 10 11 11 class TVector3; 12 class MTime; 12 13 13 14 class MAstro … … 76 77 static Double_t GetDevAbs(Double_t nomzd, Double_t devzd, Double_t devaz); 77 78 79 static Int_t GetEasterOffset(UShort_t year); 80 78 81 ClassDef(MAstro, 0) 79 82 }; -
trunk/MagicSoft/Mars/mbase/MEnv.cc
r6553 r7432 34 34 #include "MEnv.h" 35 35 36 #include <Gtypes.h> 36 37 #include <TObjString.h> 38 39 #include <TAttText.h> 40 #include <TAttFill.h> 41 #include <TAttLine.h> 42 #include <TAttMarker.h> 37 43 38 44 #include "MLog.h" … … 62 68 fChecked.Add(new TObjString(name)); 63 69 return TEnv::GetValue(name, dflt); 70 } 71 72 Int_t MEnv::GetColor(const char *name, Int_t dftl) 73 { 74 TString str = GetValue(name, ""); 75 76 str = str.Strip(TString::kBoth); 77 if (str.IsNull()) 78 return dftl; 79 80 str.ToLower(); 81 82 switch (str.Hash()) 83 { 84 case (unsigned)-1926423925/*2368543371*/: return kWhite; 85 case 1814927399: return kBlack; 86 case 7496964: return kRed; 87 case (unsigned)-1397860222/*2897107074*/: return kGreen; 88 case 1702194402: return kBlue; 89 case (unsigned)-1920149414/* 2374817882*/: return kYellow; 90 case (unsigned)-1400748595/*2894218701*/: return kMagenta; 91 case 1851881955: return kCyan; 92 case 749623518: return 18; // grey1 93 case 749623517: return 17; // grey2 94 case 749623516: return 16; // grey3 95 case 749623515: return 15; // grey4 96 case 749623514: return 14; // grey5 97 case 741234910: return 18; // gray1 98 case 741234909: return 17; // gray2 99 case 741234908: return 16; // gray3 100 case 741234907: return 15; // gray4 101 case 741234906: return 14; // gray5 102 } 103 return str.Atoi(); 104 } 105 106 TString MEnv::Compile(TString str, const char *post) const 107 { 108 if (!str.IsNull() && str[str.Length()-1]!='.') 109 str += "."; 110 111 str += post; 112 113 return str; 114 } 115 116 void MEnv::GetAttLine(const char *name, TAttLine &line, TAttLine *dftl) 117 { 118 const TString color = Compile(name, "LineColor"); 119 const TString style = Compile(name, "LineStyle"); 120 const TString width = Compile(name, "LineWidth"); 121 122 if (!dftl) 123 dftl = &line; 124 125 const Color_t col = GetColor(color, dftl->GetLineColor()); 126 const Style_t sty = GetValue(style, dftl->GetLineStyle()); 127 const Style_t wid = GetValue(width, dftl->GetLineWidth()); 128 129 line.SetLineColor(col); 130 line.SetLineStyle(sty); 131 line.SetLineWidth(wid); 132 } 133 134 void MEnv::GetAttText(const char *name, TAttText &text, TAttText *dftl) 135 { 136 const TString color = Compile(name, "TextColor"); 137 const TString align = Compile(name, "TextAlign"); 138 const TString angle = Compile(name, "TextAngle"); 139 const TString font = Compile(name, "TextFont"); 140 const TString size = Compile(name, "TextSize"); 141 142 if (!dftl) 143 dftl = &text; 144 145 const Color_t col = GetColor(color, dftl->GetTextColor()); 146 const Short_t ali = GetValue(align, dftl->GetTextAlign()); 147 const Float_t ang = GetValue(angle, dftl->GetTextAngle()); 148 const Font_t fon = GetValue(font, dftl->GetTextFont()); 149 const Float_t siz = GetValue(size, dftl->GetTextSize()); 150 151 text.SetTextColor(col); 152 text.SetTextAlign(ali); 153 text.SetTextAngle(ang); 154 text.SetTextFont(fon); 155 text.SetTextSize(siz); 156 } 157 158 void MEnv::GetAttFill(const char *name, TAttFill &fill, TAttFill *dftl) 159 { 160 const TString color = Compile(name, "FillColor"); 161 const TString style = Compile(name, "FillStyle"); 162 163 if (!dftl) 164 dftl = &fill; 165 166 const Color_t col = GetColor(color, dftl->GetFillColor()); 167 const Style_t sty = GetValue(style, dftl->GetFillStyle()); 168 169 fill.SetFillColor(col); 170 fill.SetFillStyle(sty); 171 } 172 173 void MEnv::GetAttMarker(const char *name, TAttMarker &marker, TAttMarker *dftl) 174 { 175 const TString color = Compile(name, "MarkerColor"); 176 const TString style = Compile(name, "MarkerStyle"); 177 const TString size = Compile(name, "MarkerSize"); 178 179 if (!dftl) 180 dftl = ▮ 181 182 const Color_t col = GetColor(color, dftl->GetMarkerColor()); 183 const Style_t sty = GetValue(style, dftl->GetMarkerStyle()); 184 const Size_t siz = GetValue(size, dftl->GetMarkerSize()); 185 186 marker.SetMarkerColor(col); 187 marker.SetMarkerStyle(sty); 188 marker.SetMarkerSize(siz); 189 } 190 191 void MEnv::GetAttributes(const char *name, TObject *obj, TObject *dftl) 192 { 193 //TAttAxis *line = dynamic_cast<TAttAxis*>(obj); 194 //TAtt3D *line = dynamic_cast<TAtt3D*>(obj); 195 //TAttCanvas *line = dynamic_cast<TAttCanvas*>(obj); 196 //TAttFillCanvas *line = dynamic_cast<TAttFillEitor*>(obj); 197 //TAttLineCanvas *line = dynamic_cast<TAttLineCanvas*>(obj); 198 //TAttLineEditor *line = dynamic_cast<TAttLineEditor*>(obj); 199 //TAttMarkerCanvas *line = dynamic_cast<TAttMarkerCanvas*>(obj); 200 //TAttMarkerEditor *line = dynamic_cast<TAttMarkerEditor*>(obj); 201 //TAttPad *line = dynamic_cast<TAttPad*>(obj); 202 //TAttParticle *line = dynamic_cast<TAttParticle*>(obj); 203 //TAttTextCanvas *line = dynamic_cast<TAttTextCanvas*>(obj); 204 //TAttTextEditor *line = dynamic_cast<TAttTextEditor*>(obj); 205 206 TAttLine *line = dynamic_cast<TAttLine*>(/*(TAttLine*)*/obj); 207 TAttText *text = dynamic_cast<TAttText*>(/*(TAttText*)*/obj); 208 TAttFill *fill = dynamic_cast<TAttFill*>(/*(TAttFill*)*/obj); 209 TAttMarker *mark = dynamic_cast<TAttMarker*>(/*(TAttMarker*)*/obj); 210 211 cout << line << " " << text << " " << fill << " " << mark << endl; 212 213 if (line) 214 GetAttLine(name, *line, dynamic_cast<TAttLine*>(/*(TAttLine*)*/dftl)); 215 if (text) 216 GetAttText(name, *text, dynamic_cast<TAttText*>(/*(TAttText*)*/dftl)); 217 if (fill) 218 GetAttFill(name, *fill, dynamic_cast<TAttFill*>(/*(TAttFill*)*/dftl)); 219 if (mark) 220 GetAttMarker(name, *mark, dynamic_cast<TAttMarker*>(/*(TAttMarker*)*/dftl)); 64 221 } 65 222 -
trunk/MagicSoft/Mars/mbase/MEnv.h
r6553 r7432 10 10 #endif 11 11 12 class TAttLine; 13 class TAttMarker; 14 class TAttText; 15 class TAttFill; 16 12 17 class MEnv : public TEnv 13 18 { 14 19 private: 15 20 TOrdCollection fChecked; 21 22 TString Compile(TString str, const char *post) const; 16 23 17 24 public: … … 22 29 const char *GetValue(const char *name, const char *dflt); 23 30 31 Int_t GetColor(const char *name, Int_t dftl); 32 33 void GetAttributes(const char *name, TObject *obj, TObject *dftl=0); 34 void GetAttLine(const char *name, TAttLine &line, TAttLine *dftl=0); 35 void GetAttText(const char *name, TAttText &text, TAttText *dftl=0); 36 void GetAttFill(const char *name, TAttFill &fill, TAttFill *dftl=0); 37 void GetAttMarker(const char *name, TAttMarker &marker, TAttMarker *dftl=0); 38 24 39 void PrintUntouched() const; 25 40 -
trunk/MagicSoft/Mars/mbase/MTime.cc
r7384 r7432 239 239 { 240 240 SetMjd(time*1000/kDay+49718); 241 } 242 243 // -------------------------------------------------------------------------- 244 // 245 // Set this to the date of easter corresponding to the given year. 246 // If calculation was not possible it is set to MTime() 247 // 248 // The date corresponding to the year of MTime(-1) is returned 249 // if year<0 250 // 251 // The date corresponding to the Year() is returned if year==0. 252 // 253 // for more information see: GetEaster and MAstro::GetEasterOffset() 254 // 255 void MTime::SetEaster(Short_t year) 256 { 257 *this = GetEaster(year==0 ? Year() : year); 241 258 } 242 259 … … 515 532 // The maximum size of the return string is 128 (incl. NULL) 516 533 // 517 TString MTime::GetStringFmt(const char *fmt) const 534 // For dates before 1.1.1902 a null string is returned 535 // For dates after 31.12.2037 a null string is returned 536 // 537 // To change the localization use loc, eg loc = "da_DK", "de_DE". 538 // Leaving the argument empty will just take the default localization. 539 // 540 // If loc is "", each part of the locale that should be modified is set 541 // according to the environment variables. The details are implementation 542 // dependent. For glibc, first (regardless of category), the environment 543 // variable LC_ALL is inspected, next the environment variable with the 544 // same name as the category (LC_COLLATE, LC_CTYPE, LC_MESSAGES, LC_MONE? 545 // TARY, LC_NUMERIC, LC_TIME) and finally the environment variable LANG. 546 // The first existing environment variable is used. 547 // 548 // A locale name is typically of the form language[_territory][.code? 549 // set][@modifier], where language is an ISO 639 language code, territory 550 // is an ISO 3166 country code, and codeset is a character set or encoding 551 // identifier like ISO-8859-1 or UTF-8. For a list of all supported 552 // locales, try "locale -a", cf. locale(1). 553 // 554 TString MTime::GetStringFmt(const char *fmt, const char *loc) const 518 555 { 519 556 if (!fmt) … … 525 562 GetDate(y, mon, d); 526 563 GetTime(h, m, s, ms); 564 565 if (y<1902 || y>2037) 566 return ""; 527 567 528 568 struct tm time; … … 535 575 time.tm_isdst = 0; 536 576 577 const TString locale = setlocale(LC_TIME, 0); 578 579 setlocale(LC_TIME, loc); 580 537 581 // recalculate tm_yday and tm_wday 538 582 mktime(&time); 539 583 540 584 char ret[128]; 541 return TString(strftime(ret, 127, fmt, &time) ? ret : ""); 585 const size_t rc = strftime(ret, 127, fmt, &time); 586 587 setlocale(LC_TIME, locale); 588 589 return rc ? ret : ""; 542 590 } 543 591 … … 549 597 // For more information see GetStringFmt 550 598 // 551 Bool_t MTime::SetStringFmt(const char *time, const char *fmt )599 Bool_t MTime::SetStringFmt(const char *time, const char *fmt, const char *loc) 552 600 { 553 601 if (!fmt) … … 556 604 struct tm t; 557 605 memset(&t, 0, sizeof(struct tm)); 606 607 const TString locale = setlocale(LC_TIME, 0); 608 609 setlocale(LC_TIME, loc); 558 610 strptime(time, fmt, &t); 611 setlocale(LC_TIME, locale); 559 612 560 613 return Set(t.tm_year+1900, t.tm_mon+1, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec); … … 795 848 return out; 796 849 } 850 851 // -------------------------------------------------------------------------- 852 // 853 // Calculate the day of easter for the given year. 854 // MTime() is returned if this was not possible. 855 // 856 // In case of the default argument or the year less than zero 857 // the date of eastern of the current year (the year corresponding to 858 // MTime(-1)) is returned. 859 // 860 // for more information see: MAstro::GetDayOfEaster() 861 // 862 MTime MTime::GetEaster(Short_t year) 863 { 864 if (year<0) 865 year = MTime(-1).Year(); 866 867 const Int_t day = MAstro::GetEasterOffset(year); 868 if (day<0) 869 return MTime(); 870 871 MTime t; 872 t.Set(year, 3, 1); 873 t.SetMjd(t.GetMjd() + day); 874 875 return t; 876 } -
trunk/MagicSoft/Mars/mbase/MTime.h
r7384 r7432 83 83 Bool_t SetSqlTimeStamp(const char *str); 84 84 void SetCT1Time(UInt_t mjd, UInt_t t1, UInt_t t0); 85 Bool_t SetStringFmt(const char *time, const char *fmt );85 Bool_t SetStringFmt(const char *time, const char *fmt, const char *loc=0); 86 86 Bool_t UpdMagicTime(Byte_t h, Byte_t m, Byte_t s, UInt_t ns); 87 87 Bool_t SetMjd(UInt_t mjd, ULong_t ms, UInt_t ns=0); 88 88 void SetMjd(Double_t m); 89 89 void SetAxisTime(Double_t time); 90 void SetEaster(Short_t year=0); 90 91 91 92 // Getter functions … … 93 94 Double_t GetGmst() const; 94 95 TString GetString() const; 95 TString GetStringFmt(const char *fmt=0 ) const;96 TString GetStringFmt(const char *fmt=0, const char *loc=0) const; 96 97 TString GetSqlDateTime() const; 97 98 TString GetSqlTimeStamp() const; … … 112 113 } 113 114 114 UInt_t Year() const { UShort_t y; Byte_t m, d; GetDate(y,m,d); return y; } 115 UInt_t Month() const { UShort_t y; Byte_t m, d; GetDate(y,m,d); return m; } 116 UInt_t Day() const { UShort_t y; Byte_t m, d; GetDate(y,m,d); return d; } 117 UInt_t Hour() const { Byte_t h, m, s; GetTime(h,m,s); return h; } 118 UInt_t Min() const { Byte_t h, m, s; GetTime(h,m,s); return m; } 119 UInt_t Sec() const { Byte_t h, m, s; GetTime(h,m,s); return s; } 115 UInt_t Year() const { UShort_t y; Byte_t m, d; GetDate(y,m,d); return y; } 116 UInt_t Month() const { UShort_t y; Byte_t m, d; GetDate(y,m,d); return m; } 117 UInt_t Day() const { UShort_t y; Byte_t m, d; GetDate(y,m,d); return d; } 118 Byte_t WeekDay() const { return TMath::Nint(TMath::Floor(GetMjd()+3))%7; } // Return Day of the week: Sun=0, Mon=1, ..., Sat=6 119 UInt_t Hour() const { Byte_t h, m, s; GetTime(h,m,s); return h; } 120 UInt_t Min() const { Byte_t h, m, s; GetTime(h,m,s); return m; } 121 UInt_t Sec() const { Byte_t h, m, s; GetTime(h,m,s); return s; } 120 122 121 123 Bool_t IsMidnight() const { return (Long_t)fTime==0 && fNanoSec==0; } … … 155 157 bool operator!() const; 156 158 159 static MTime GetEaster(Short_t year=-1); 160 157 161 ClassDef(MTime, 3) //A generalized MARS time stamp 158 162 }; -
trunk/MagicSoft/Mars/merpp.cc
r7430 r7432 53 53 gLog << " MERPP - MARS V" << MARSVER << endl; 54 54 gLog << " MARS - Merging and Preprocessing Program" << endl; 55 gLog << " Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ ">" << endl;55 gLog << " Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ << ">" << endl; 56 56 gLog << "==================================================" << endl; 57 57 gLog << endl; -
trunk/MagicSoft/Mars/mjobs/MJCut.cc
r7425 r7432 356 356 write->AddContainer("MNewImagePar", "Events", kFALSE); 357 357 write->AddContainer("MNewImagePar2", "Events", kFALSE); 358 write->AddContainer(" MHadronness","Events", kFALSE);358 write->AddContainer("Hadronness", "Events", kFALSE); 359 359 write->AddContainer("MSrcPosCam", "Events", kFALSE); 360 360 write->AddContainer("MSrcPosAnti", "Events", kFALSE); -
trunk/MagicSoft/Mars/readdaq.cc
r7091 r7432 39 39 gLog << " ReadDaq - MARS V" << MARSVER << endl; 40 40 gLog << " MARS - Read and print daq data files" << endl; 41 gLog << " Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ ">" << endl;41 gLog << " Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ << ">" << endl; 42 42 gLog << "==================================================" << endl; 43 43 gLog << endl; -
trunk/MagicSoft/Mars/readraw.cc
r7091 r7432 42 42 gLog << " ReadRaw - MARS V" << MARSVER << endl; 43 43 gLog << " MARS - Read and print raw data files" << endl; 44 gLog << " Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ ">" << endl;44 gLog << " Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ << ">" << endl; 45 45 gLog << "==================================================" << endl; 46 46 gLog << endl; -
trunk/MagicSoft/Mars/showlog.cc
r7179 r7432 11 11 using namespace std; 12 12 13 static void StartUpMessage() 14 { 15 // 1 2 3 4 5 16 // 12345678901234567890123456789012345678901234567890 17 gLog << endl; 18 gLog << "showlog --- Mars V" << MARSVER << " compiled on <" << __DATE__ << "> using ROOT v" << ROOTVER << endl; 19 gLog << endl; 20 } 21 13 22 static void Usage() 14 23 { 15 24 gLog << endl; 16 25 gLog << "Sorry the usage is:" << endl; 17 gLog << " showlog [options] filename" << endl;26 gLog << " showlog [options] {filename}|{location number}" << endl; 18 27 gLog << " or" << endl; 19 28 gLog << " showlog [options] < filename" << endl << endl; 29 gLog << " Arguments:" << endl; 30 gLog << " filename Input log file" << endl; 31 gLog << " location number Open file from location callisto, star, etc." << endl; 32 gLog << " of sequence or dataset number" << endl << endl; 20 33 gLog.Usage(); 21 34 gLog << " --version, -V Show startup message with version number" << endl; … … 52 65 53 66 if (arg.HasOnly("-V") || arg.HasOnly("--version")) 67 { 68 StartUpMessage(); 54 69 return 0; 70 } 55 71 56 72 if (arg.HasOnly("-?") || arg.HasOnly("-h") || arg.HasOnly("--help")) … … 74 90 // check for the right usage of the program 75 91 // 76 if (arg.GetNumArguments()> 1)92 if (arg.GetNumArguments()>2) 77 93 { 78 94 Usage(); … … 80 96 } 81 97 98 // 99 // Something special for datacenter access 100 // 101 TString kInput = arg.GetArgumentStr(0); 102 if (arg.GetNumArguments()==2) 103 { 104 const Int_t num = arg.GetArgumentStr(1).Atoi(); 105 TString file = "/magic/data/"; 106 file += kInput; 107 file += Form("/%04d/%08d/", num/10000, num); 108 file += kInput; 109 file += Form("%08d.log", num); 110 111 kInput = file; 112 113 gLog << inf << "Inflated file name: " << kInput << endl; 114 } 115 116 82 117 // casts necessary for gcc 2.95.3 83 istream *in = arg.GetNumArguments() ==1 ? (istream*)new ifstream(arg.GetArgumentStr(0)) : (istream*)&cin;118 istream *in = arg.GetNumArguments()>0 ? (istream*)new ifstream(kInput) : (istream*)&cin; 84 119 if (!*in) 85 120 { 86 gLog << "Cannot open file " << arg.GetArgumentStr(0)<< ": " << strerror(errno) << endl;121 gLog << err << "Cannot open file " << kInput << ": " << strerror(errno) << endl; 87 122 return 2; 88 123 } -
trunk/MagicSoft/Mars/showplot.cc
r7179 r7432 28 28 gLog << all << endl; 29 29 gLog << "Sorry the usage is:" << endl; 30 gLog << " showplot [options] filename" << endl << endl;30 gLog << " showplot [options] {filename}|{filetype number}" << endl << endl; 31 31 gLog << " Arguments:" << endl; 32 gLog << " filename Input file containing an MStatusArray" << endl << endl; 32 gLog << " filename Input file containing an MStatusArray" << endl; 33 gLog << " filetype number Open file of filetype calib, signal, star, etc." << endl; 34 gLog << " of sequence or dataset number" << endl << endl; 33 35 gLog << " Root Options:" << endl; 34 36 gLog << " -b Batch mode (no graphical output to screen)" << endl<<endl; … … 135 137 return 3; 136 138 } 137 if (arg.GetNumArguments() !=1)139 if (arg.GetNumArguments()<1 || arg.GetNumArguments()>2 || !arg.GetArgumentStr(1).IsDigit()) 138 140 { 139 141 Usage(); … … 151 153 // Process filenames 152 154 // 153 const TString kInput = arg.GetArgumentStr(0); 155 TString kInput = arg.GetArgumentStr(0); 156 157 // 158 // Something special for datacenter access 159 // 160 if (arg.GetNumArguments()==2) 161 { 162 const Int_t num = arg.GetArgumentStr(1).Atoi(); 163 TString file = "/magic/data/"; 164 switch (kInput.Hash()) 165 166 { 167 case (unsigned long)-856860927: 168 case 764164111: 169 file += "callisto"; 170 break; 171 default: 172 file += kInput; 173 break; 174 } 175 file += Form("/%04d/%08d/", num/10000, num); 176 file += kInput; 177 file += Form("%08d.root", num); 178 179 kInput = file; 180 181 gLog << inf << "Inflated file name: " << kInput << endl; 182 } 154 183 155 184 if (kNamePs.IsNull() && kSaveAsPs) -
trunk/MagicSoft/Mars/sponde.cc
r7179 r7432 30 30 gLog << " Sponde - MARS V" << MARSVER << endl; 31 31 gLog << " MARS -- SPectrum ON DEmand" << endl; 32 gLog << " Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ ">" << endl;32 gLog << " Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ << ">" << endl; 33 33 gLog << "========================================================" << endl; 34 34 gLog << endl; -
trunk/MagicSoft/Mars/star.cc
r7091 r7432 30 30 gLog << " Star - MARS V" << MARSVER << endl; 31 31 gLog << " MARS -- STandard Analysis and Reconstruction" << endl; 32 gLog << " Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ ">" << endl;32 gLog << " Compiled with ROOT v" << ROOTVER << " on <" << __DATE__ << ">" << endl; 33 33 gLog << "========================================================" << endl; 34 34 gLog << endl; … … 41 41 gLog << all << endl; 42 42 gLog << "Sorry the usage is:" << endl; 43 gLog << " star [options] sequence.txt " << endl << endl;43 gLog << " star [options] sequence.txt|number" << endl << endl; 44 44 gLog << " Arguments:" << endl; 45 45 gLog << " sequence.txt: Ascii file defining a sequence of runs" << endl; 46 gLog << " number: The sequence number (using file in the datacenter)" << endl; 46 47 gLog << " For more details see MSequence" << endl; 47 48 gLog << " Root Options:" << endl; … … 146 147 // Setup sequence file and check for its existance 147 148 // 148 const TString kSequence = arg.GetArgumentStr(0); 149 TString kSequence = arg.GetArgumentStr(0); 150 151 // 152 // Something special for datacenter access 153 // 154 if (kSequence.IsDigit()) 155 { 156 const Int_t numseq = kSequence.Atoi(); 157 kSequence = Form("/magic/sequences/%04d/sequence%08d.txt", numseq/10000, numseq); 158 gLog << inf << "Inflated sequence file: " << kSequence << endl; 159 } 149 160 150 161 if (gSystem->AccessPathName(kSequence, kFileExists))
Note:
See TracChangeset
for help on using the changeset viewer.