Changeset 7887 for trunk


Ignore:
Timestamp:
08/19/06 20:22:55 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r7886 r7887  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20 2006/08/19 Thomas Bretz
     21
     22   * mastro/MAstroCatalog.cc:
     23     - replaced all ifstream by MZlib to allow reading gzip
     24       compressed catalogs
     25
     26   * mbase/MString.[h,cc]:
     27     - changed function Form()
     28     - renamed old function Form() to Format()
     29
     30   * mastro/MAstroCatalog.cc, mbase/MParContainer.cc,
     31     mbase/MStatusDisplay.cc, mbase/MTask.cc, mpointing/MHSrcPosCam.cc
     32     mpointing/MPointingPos.cc:
     33     - replaced MString::Form by new function name MString::Format
     34
     35
     36
    2037 2006/08/18 Thomas Bretz
    2138
  • trunk/MagicSoft/Mars/NEWS

    r7883 r7887  
    3030   - callisto: Callisto now raises an error if one of the input files could
    3131     not be opened.
     32
     33   - callisto: In some rare cases it could happen that in the hi-gain
     34     extraction of the digital filter the extractor returned nonsense
     35     results due a wrong initializion of a variable
    3236
    3337   - callisto: The lo-gains have been marked as valid in some cases
  • trunk/MagicSoft/Mars/mastro/MAstroCatalog.cc

    r7491 r7887  
    129129
    130130#include <errno.h>      // strerror
    131 #include <fstream>      // ifstream
    132131#include <stdlib.h>     // ati, atof
    133132#include <limits.h>     // INT_MAX (Suse 7.3/gcc 2.95)
     
    144143#include "MLog.h"
    145144#include "MLogManip.h"
     145
     146#include "MZlib.h"      // MZlib <ifstream>
    146147
    147148#include "MTime.h"
     
    261262    gLog << inf << "Reading Xephem catalog: " << catalog << endl;
    262263
    263     ifstream fin(catalog);
     264    MZlib fin(catalog);
    264265    if (!fin)
    265266    {
     
    342343    gLog << inf << "Reading NGC2000 catalog: " << catalog << endl;
    343344
    344     ifstream fin(catalog);
     345    MZlib fin(catalog);
    345346    if (!fin)
    346347    {
     
    406407    gLog << inf << "Reading Bright Star Catalog (BSC5) catalog: " << catalog << endl;
    407408
    408     ifstream fin(catalog);
     409    MZlib fin(catalog);
    409410    if (!fin)
    410411    {
     
    478479    gLog << inf << "Reading Heasarc PPM catalog: " << catalog << endl;
    479480
    480     ifstream fin(catalog);
     481    MZlib fin(catalog);
    481482    if (!fin)
    482483    {
     
    582583    gLog << inf << "Reading MAstroCatalog compressed catalog: " << catalog << endl;
    583584
    584     ifstream fin(catalog);
     585    MZlib fin(catalog);
    585586    if (!fin)
    586587    {
     
    735736    if (!str.IsNull())
    736737        str += ":  ";
    737     str += MString::Form("Ra=%.2fh  Dec=%.1fd  Mag=%.1f", ra, dec, mag);
     738    str += MString::Format("Ra=%.2fh  Dec=%.1fd  Mag=%.1f", ra, dec, mag);
    738739    if (txt)
    739740    {
  • trunk/MagicSoft/Mars/mbase/MParContainer.cc

    r7851 r7887  
    230230    //
    231231    return (TString)o.GetName()==o.ClassName() ? (TString)o.ClassName() :
    232         MString::Form("%s [%s]", o.GetName(), o.ClassName());
     232        MString::Format("%s [%s]", o.GetName(), o.ClassName());
    233233}
    234234
  • trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc

    r7827 r7887  
    253253    filemenu->AddSeparator();
    254254
    255     const TString fname(MString::Form("Save %s.", gROOT->GetName()));
     255    const TString fname(MString::Format("Save %s.", gROOT->GetName()));
    256256    MGPopupMenu *savemenu = new MGPopupMenu(gClient->GetRoot());
    257     savemenu->AddEntry(MString::Form("%s&ps",  fname.Data()),  kFileSaveAsPS);
    258     savemenu->AddEntry(MString::Form("%sp&df", fname.Data()),  kFileSaveAsPDF);
    259     savemenu->AddEntry(MString::Form("%s&svg", fname.Data()),  kFileSaveAsSVG);
     257    savemenu->AddEntry(MString::Format("%s&ps",  fname.Data()),  kFileSaveAsPS);
     258    savemenu->AddEntry(MString::Format("%sp&df", fname.Data()),  kFileSaveAsPDF);
     259    savemenu->AddEntry(MString::Format("%s&svg", fname.Data()),  kFileSaveAsSVG);
    260260    savemenu->AddSeparator();
    261     savemenu->AddEntry(MString::Form("%sp&ng", fname.Data()),  kFileSaveAsPNG);
    262     savemenu->AddEntry(MString::Form("%s&gif", fname.Data()),  kFileSaveAsGIF);
    263     savemenu->AddEntry(MString::Form("%s&jpg", fname.Data()),  kFileSaveAsJPG);
    264     savemenu->AddEntry(MString::Form("%s&xpm", fname.Data()),  kFileSaveAsXPM);
     261    savemenu->AddEntry(MString::Format("%sp&ng", fname.Data()),  kFileSaveAsPNG);
     262    savemenu->AddEntry(MString::Format("%s&gif", fname.Data()),  kFileSaveAsGIF);
     263    savemenu->AddEntry(MString::Format("%s&jpg", fname.Data()),  kFileSaveAsJPG);
     264    savemenu->AddEntry(MString::Format("%s&xpm", fname.Data()),  kFileSaveAsXPM);
    265265    //savemenu->AddEntry("Save status.x&cf",  kFileSaveAsXCF);
    266266    //savemenu->AddEntry("Save status.&tiff", kFileSaveAsTIFF);
     
    268268    savemenu->AddEntry("Save status.&xml",  kFileSaveAsXML);
    269269    savemenu->AddSeparator();
    270     savemenu->AddEntry(MString::Form("%s&C",    fname.Data()), kFileSaveAsC);
    271     savemenu->AddEntry(MString::Form("%s&root", fname.Data()), kFileSaveAsRoot);
     270    savemenu->AddEntry(MString::Format("%s&C",    fname.Data()), kFileSaveAsC);
     271    savemenu->AddEntry(MString::Format("%s&root", fname.Data()), kFileSaveAsRoot);
    272272    savemenu->Associate(this);
    273273
     
    292292    tabmenu->AddSeparator();
    293293
    294     const TString fname2(MString::Form("Save %s-i.", gROOT->GetName()));
     294    const TString fname2(MString::Format("Save %s-i.", gROOT->GetName()));
    295295    MGPopupMenu *savemenu2 = new MGPopupMenu(gClient->GetRoot());
    296     savemenu2->AddEntry(MString::Form("%s&ps",  fname2.Data()),  kTabSaveAsPS);
    297     savemenu2->AddEntry(MString::Form("%sp&df", fname2.Data()),  kTabSaveAsPDF);
    298     savemenu2->AddEntry(MString::Form("%s&svg", fname2.Data()),  kTabSaveAsSVG);
     296    savemenu2->AddEntry(MString::Format("%s&ps",  fname2.Data()),  kTabSaveAsPS);
     297    savemenu2->AddEntry(MString::Format("%sp&df", fname2.Data()),  kTabSaveAsPDF);
     298    savemenu2->AddEntry(MString::Format("%s&svg", fname2.Data()),  kTabSaveAsSVG);
    299299    savemenu2->AddSeparator();
    300     savemenu2->AddEntry(MString::Form("%sp&ng", fname2.Data()),  kTabSaveAsPNG);
    301     savemenu2->AddEntry(MString::Form("%s&gif", fname2.Data()),  kTabSaveAsGIF);
    302     savemenu2->AddEntry(MString::Form("%s&jpg", fname2.Data()),  kTabSaveAsJPG);
    303     savemenu2->AddEntry(MString::Form("%s&xpm", fname2.Data()),  kTabSaveAsXPM);
     300    savemenu2->AddEntry(MString::Format("%sp&ng", fname2.Data()),  kTabSaveAsPNG);
     301    savemenu2->AddEntry(MString::Format("%s&gif", fname2.Data()),  kTabSaveAsGIF);
     302    savemenu2->AddEntry(MString::Format("%s&jpg", fname2.Data()),  kTabSaveAsJPG);
     303    savemenu2->AddEntry(MString::Format("%s&xpm", fname2.Data()),  kTabSaveAsXPM);
    304304    //savemenu->AddEntry("Save status.x&cf",  kFileSaveAsXCF);
    305305    //savemenu->AddEntry("Save status.&tiff", kFileSaveAsTIFF);
     
    307307    savemenu->AddEntry("Save status.&xml",  kFileSaveAsXML);
    308308    savemenu2->AddSeparator();
    309     savemenu2->AddEntry(MString::Form("%s&C",    fname2.Data()), kTabSaveAsC);
    310     savemenu2->AddEntry(MString::Form("%s&root", fname2.Data()), kTabSaveAsRoot);
     309    savemenu2->AddEntry(MString::Format("%s&C",    fname2.Data()), kTabSaveAsC);
     310    savemenu2->AddEntry(MString::Format("%s&root", fname2.Data()), kTabSaveAsRoot);
    311311    savemenu2->Associate(this);
    312312
     
    440440
    441441    // Add MARS version
    442     TGLabel *l = new TGLabel(f, MString::Form("Official Release: V%s", MARSVER));
     442    TGLabel *l = new TGLabel(f, MString::Format("Official Release: V%s", MARSVER));
    443443    fList->Add(l);
    444444
     
    451451
    452452    // Add root version
    453     l = new TGLabel(f, MString::Form("Using ROOT v%s", ROOTVER));
     453    l = new TGLabel(f, MString::Format("Using ROOT v%s", ROOTVER));
    454454    fList->Add(l);
    455455
     
    660660void MStatusDisplay::SetStatusLine2(const MParContainer &cont)
    661661{
    662     SetStatusLine2(MString::Form("%s: %s", cont.GetDescriptor().Data(), cont.GetTitle()));
     662    SetStatusLine2(MString::Format("%s: %s", cont.GetDescriptor().Data(), cont.GetTitle()));
    663663}
    664664
     
    10971097    {
    10981098        // Tell the X-Requester how to call this method
    1099         TString str = MString::Form("%d", (ULong_t)f);
     1099        TString str = MString::Format("%d", (ULong_t)f);
    11001100
    11011101        TMethodCall call(IsA(), "UpdateTab", "NULL");
     
    12721272    gSystem->Unlink(tmp);
    12731273
    1274     SetStatusLine2(MString::Form("Done (%dpage(s))", pages));
     1274    SetStatusLine2(MString::Format("Done (%dpage(s))", pages));
    12751275
    12761276    return pages;
     
    13801380
    13811381    // Code taken from TGTextEdit::Print
    1382     const TString pipe = MString::Form("a2ps -o%s", name.Data());
     1382    const TString pipe = MString::Format("a2ps -o%s", name.Data());
    13831383    FILE *p = gSystem->OpenPipe(pipe, "w");
    13841384    if (!p)
     
    14931493
    14941494    case kFileTab:
    1495         AddTab(MString::Form("%d", fTab->GetNumberOfTabs()));
     1495        AddTab(MString::Format("%d", fTab->GetNumberOfTabs()));
    14961496        return kTRUE;
    14971497
     
    16831683        SetStatusLine2("");
    16841684        *fLog << inf << "Saving log... " << flush;
    1685         if (fLogBox->GetText()->Save(MString::Form("%s.log", gROOT->GetName())))
     1685        if (fLogBox->GetText()->Save(MString::Format("%s.log", gROOT->GetName())))
    16861686        {
    16871687            *fLog << "done." << endl;
     
    16991699        SetStatusLine2("");
    17001700        *fLog << inf << "Appending log... " << flush;
    1701         if (fLogBox->GetText()->Append(MString::Form("%s.log", gROOT->GetName())))
     1701        if (fLogBox->GetText()->Append(MString::Format("%s.log", gROOT->GetName())))
    17021702        {
    17031703            *fLog << "done." << endl;
     
    19481948void MStatusDisplay::UpdateMemory() const
    19491949{
    1950     const TString path = MString::Form("/proc/%d/status", gSystem->GetPid());
     1950    const TString path = MString::Format("/proc/%d/status", gSystem->GetPid());
    19511951    if (gSystem->AccessPathName(path, kFileExists))
    19521952        return;
     
    19701970        val /= 1000;
    19711971    }
    1972     const TString txt = MString::Form("%.1f%c", val, type);
     1972    const TString txt = MString::Format("%.1f%c", val, type);
    19731973    fStatusBar->SetText(txt, 2);
    19741974}
     
    24642464        }
    24652465
    2466         SetStatusLine2(MString::Form("Tab #%d", i));
     2466        SetStatusLine2(MString::Format("Tab #%d", i));
    24672467
    24682468        //
     
    25262526        PSToolsTextNDC(*ps, 0.5, 1.015, TString("MARS - Magic Analysis and Reconstruction Software - ")+d.AsString());
    25272527        ps->SetTextAlign(31); // right top
    2528         PSToolsTextNDC(*ps, 1, 1.015, MString::Form("Page No.%i (%i)  ", page++, i));
     2528        PSToolsTextNDC(*ps, 1, 1.015, MString::Format("Page No.%i (%i)  ", page++, i));
    25292529        line.PaintLineNDC(0, 1.01, 1, 1.01);
    25302530
     
    25702570        *fLog << inf << "done." << endl;
    25712571
    2572     SetStatusLine2(MString::Form("Done (%dpages)", page-1));
     2572    SetStatusLine2(MString::Format("Done (%dpages)", page-1));
    25732573
    25742574    return page-1;
     
    26752675        }
    26762676
    2677         SetStatusLine2(MString::Form("Tab #%d", i));
     2677        SetStatusLine2(MString::Format("Tab #%d", i));
    26782678
    26792679        //
     
    27712771        }
    27722772
    2773         SetStatusLine2(MString::Form("Tab #%d", i));
     2773        SetStatusLine2(MString::Format("Tab #%d", i));
    27742774
    27752775        //
  • trunk/MagicSoft/Mars/mbase/MString.cc

    r5713 r7887  
    120120// M/TString.
    121121//
    122 MString MString::Form(const char *fmt, ...)
     122MString MString::Format(const char *fmt, ...)
    123123{
    124124    va_list ap;
     
    129129    return ret;
    130130}
     131
     132// --------------------------------------------------------------------------
     133//
     134// This is my implementation for root versions prior to 5.12/00 where
     135// TString::Form didn't exist.
     136//
     137void MString::Form(const char *fmt, ...)
     138{
     139    va_list ap;
     140    va_start(ap, fmt);
     141
     142    Print(fmt, ap);
     143}
  • trunk/MagicSoft/Mars/mbase/MString.h

    r7804 r7887  
    1818    MString &Print(const char *fmt, ...);
    1919
    20 #ifndef __CINT__
    21     static MString Form(const char *fmt, ...);
    22 #endif
     20    static MString Format(const char *fmt, ...);
     21
     22    void Form(const char *fmt, ...);
    2323
    2424    ClassDef(MString, 1) // Tool to make Form() thread safe against other TStrings
  • trunk/MagicSoft/Mars/mbase/MTask.cc

    r7838 r7887  
    361361    //
    362362    if (fName==ClassName())
    363         return fSerialNumber==0 ? (TString)ClassName() : MString::Form("%s;%d", ClassName(), fSerialNumber);
     363        return fSerialNumber==0 ? (TString)ClassName() : MString::Format("%s;%d", ClassName(), fSerialNumber);
    364364
    365365    return fSerialNumber>0 ?
    366         MString::Form("%s;%d [%s]", fName.Data(), fSerialNumber, ClassName()) :
    367         MString::Form("%s [%s]",    fName.Data(), ClassName());
     366        MString::Format("%s;%d [%s]", fName.Data(), fSerialNumber, ClassName()) :
     367        MString::Format("%s [%s]",    fName.Data(), ClassName());
    368368}
    369369
  • trunk/MagicSoft/Mars/mpointing/MHSrcPosCam.cc

    r7566 r7887  
    113113
    114114    const TString src = pos->GetString("radec");
    115     fHist.SetTitle(MString::Form("SrcPos distribution in camera: %s", src.Data()));
     115    fHist.SetTitle(MString::Format("SrcPos distribution in camera: %s", src.Data()));
    116116
    117117    fHist.Reset();
  • trunk/MagicSoft/Mars/mpointing/MPointingPos.cc

    r7726 r7887  
    100100
    101101    if (opt.Contains("ra", TString::kIgnoreCase))
    102         rc += MString::Form(" Ra=%s", MAstro::GetStringHor(fRa).Data());
     102        rc += MString::Format(" Ra=%s", MAstro::GetStringHor(fRa).Data());
    103103
    104104    if (opt.Contains("ha", TString::kIgnoreCase))
    105         rc += MString::Form(" Ha=%s", MAstro::GetStringHor(fHa).Data());
     105        rc += MString::Format(" Ha=%s", MAstro::GetStringHor(fHa).Data());
    106106
    107107    if (opt.Contains("dec", TString::kIgnoreCase))
    108         rc += MString::Form(" Dec=%s", MAstro::GetStringDeg(fDec).Data());
     108        rc += MString::Format(" Dec=%s", MAstro::GetStringDeg(fDec).Data());
    109109
    110110    if (opt.Contains("zd", TString::kIgnoreCase))
    111         rc += MString::Form(" Zd=%s", MAstro::GetStringDeg(fZd).Data());
     111        rc += MString::Format(" Zd=%s", MAstro::GetStringDeg(fZd).Data());
    112112
    113113    if (opt.Contains("az", TString::kIgnoreCase))
    114         rc += MString::Form(" Az=%s", MAstro::GetStringDeg(fAz).Data());
     114        rc += MString::Format(" Az=%s", MAstro::GetStringDeg(fAz).Data());
    115115
    116116    if (fTitle!=gsDefTitle)
    117         rc += MString::Form(" <%s>", fTitle.Data());
     117        rc += MString::Format(" <%s>", fTitle.Data());
    118118
    119119    return rc.Strip(TString::kBoth);
Note: See TracChangeset for help on using the changeset viewer.