Changeset 9345 for trunk/MagicSoft


Ignore:
Timestamp:
02/16/09 10:19:21 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r9343 r9345  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20 2009/02/16 Thomas Bretz
     21
     22   * mimage/MHHillas.cc, mimage/MHHillasExt.cc, mimage/MHHillasSrc.cc,
     23     mimage/MHImagePar.cc:
     24     - replaced green by blue for better readability on projectors
     25
     26   * mbase/MEnv.[h,cc]:
     27     - added the option of a default name to allow i/o more similar
     28       to MParContainer
     29     - improved Print()
     30
     31   * ceres.cc, callisto.cc, star.cc, ganymed.cc, sponde.cc:
     32     - make use of the new default name of MEnv
     33
     34   * mjobs/MJSpectrum.cc:
     35     - read and write ganymed.rc
     36
     37   * mbase/MParList.cc:
     38     - if adding a TObjArray add only MParContainers (for sanity)
     39
     40   * mjobs/MJob.cc:
     41     - when reading read also TObjects
     42
     43   * mjobs/MJSpectrum.cc:
     44     - now read the ganymed.rc and write it to the output
     45
     46
     47
    2048 2009/02/15 Thomas Bretz
    2149
  • trunk/MagicSoft/Mars/NEWS

    r9343 r9345  
    8484     eff. on-time from the fit in the new tab, e.g. when a zenith distance
    8585     cut was made in ganymed. This can now be forced by ''--force-ontimefit''
     86
     87   * now reads the ''ganymed.rc'' from the ''ganymed.root'' and writes
     88     it to its own output file (for convinience)
    8689
    8790
  • trunk/MagicSoft/Mars/callisto.cc

    r9276 r9345  
    216216    // --rc= from the list of arguments.
    217217    //
    218     MEnv env(kConfig);
     218    MEnv env(kConfig, "callisto.rc");
    219219    if (!env.IsValid())
    220220    {
  • trunk/MagicSoft/Mars/ceres.cc

    r9276 r9345  
    137137    // --rc= from the list of arguments.
    138138    //
    139     MEnv env(kConfig);
     139    MEnv env(kConfig, "ceres.rc");
    140140    if (!env.IsValid())
    141141    {
  • trunk/MagicSoft/Mars/ganymed.cc

    r9276 r9345  
    185185    // --rc= from the list of arguments.
    186186    //
    187     MEnv env(kConfig);
     187    MEnv env(kConfig, "ganymed.rc");
    188188    if (!env.IsValid())
    189189    {
  • trunk/MagicSoft/Mars/mbase/MEnv.cc

    r9314 r9345  
    1818!   Author(s): Thomas Bretz  2/2005 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2007
     20!   Copyright: MAGIC Software Development, 2000-2009
    2121!
    2222!
     
    4444// the including file.
    4545//
     46// Class Version 1:
     47// ----------------
     48//  + TString fName
     49//
    4650//////////////////////////////////////////////////////////////////////////////
    4751#include "MEnv.h"
     
    7175// is called which can then be checked by IsValid()
    7276//
    73 MEnv::MEnv(const char *name) : TEnv(name)
     77// The second argument is the default name. Usually as name of the MEnv
     78// the base name of the file is returned. By giving a default name
     79// you can overwrite this behavious. This is useful for I/O
     80// because it allows to use Read and Write without argument.
     81//
     82MEnv::MEnv(const char *name, const char *defname) : TEnv(name), fName(defname)
    7483{
    7584    fChecked.SetOwner();
     
    174183    inc = inc.Strip(TString::kBoth);
    175184
    176     // Set final resource, now as kEnvLocal (previously set as kEnvChnaged)
     185    // Set final resource, now as kEnvLocal (previously set as kEnvChanged)
    177186    SetValue("Include", inc, kEnvLocal);
    178187
     
    198207}
    199208
     209// --------------------------------------------------------------------------
     210//
     211// Read an object from the current directory. If no name is given
     212// the name of this object is used.
     213//
     214Int_t MEnv::Read(const char *name)
     215{
     216    const Int_t rc = TEnv::Read(name?name:(const char*)fName);
     217    //if (name)
     218    //    SetName(name);
     219    return rc;
     220}
     221
    200222//---------------------------------------------------------------------------
    201223//
     
    204226const char *MEnv::GetName() const
    205227{
     228    if (!fName.IsNull())
     229        return fName;
     230
    206231    const char *pos = strrchr(GetRcName(), '/');
    207232    return pos>0 ? pos+1 : GetRcName();
     
    10611086void MEnv::PrintEnv(EEnvLevel level) const
    10621087{
    1063     cout << "# Path: " << GetRcName() << endl;
    1064     cout << "# Name: " << GetName() << endl;
     1088    if (!TString(GetRcName()).IsNull())
     1089    {
     1090        cout << "# Path: " << GetRcName() << endl;
     1091        cout << "# File: " << gSystem->BaseName(GetRcName()) << endl;
     1092    }
     1093    if (!fName.IsNull())
     1094        cout << "# Name: " << fName << endl;
     1095
    10651096    TEnv::PrintEnv(level);
    10661097}
  • trunk/MagicSoft/Mars/mbase/MEnv.h

    r9301 r9345  
    2121{
    2222private:
    23     TOrdCollection fChecked;
     23    TOrdCollection fChecked; //!
     24
     25    TString fName;
    2426
    2527    TString Compile(TString str, const char *post) const;
     
    2729
    2830public:
    29     MEnv(const char *name="");
     31    MEnv(const char *name="", const char *defname=0);
    3032
    3133    Bool_t      IsValid() const { return !TString(GetRcName()).IsNull(); }
     
    4446
    4547    const char *GetName() const;
     48    void        SetName(const char *name=0) { fName = name; }
    4649
    4750    Int_t       GetColor(const char *name, Int_t dftl);
     
    7376    Bool_t      TakeEnv(MArgs &args, Bool_t print=kFALSE, Bool_t overwrite=kTRUE);
    7477
     78    Int_t       Read(const char *name=0);
    7579    Int_t       ReadFile(const char *fname, EEnvLevel level);
    7680
     
    8589    Int_t GetNumUntouched() const;
    8690
    87     ClassDef(MEnv, 0) // A slightly more advanced version of TEnv
     91    ClassDef(MEnv, 1) // A slightly more advanced version of TEnv
    8892};
    8993   
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r9268 r9345  
    245245// --------------------------------------------------------------------------
    246246//
    247 //  Add all entries of the TObjArray to the list.
     247// Add all entries which derive from MParContainer
     248// of the TObjArray to the list.
    248249//
    249250void MParList::AddToList(TObjArray *list)
     
    255256        return;
    256257
    257     MIter Next(list);
    258 
    259     MParContainer *cont = NULL;
     258    TIter Next(list);
     259
     260    TObject *cont = NULL;
    260261    while ((cont=Next()))
    261262    {
     263        if (!dynamic_cast<MParContainer*>(cont))
     264            continue;
     265
    262266        cont->SetBit(kMustCleanup);
    263267        AddToList(cont);
  • trunk/MagicSoft/Mars/mjobs/MJSpectrum.cc

    r9343 r9345  
    5858#include "MH3.h"
    5959#include "MHn.h"
     60#include "MEnv.h"
    6061#include "MBinning.h"
    6162#include "MParameters.h"
     
    15391540    MBinning binsa("BinningAsym");
    15401541    MBinning binsb("BinningConc1");
     1542
     1543    MEnv env("", "ganymed.rc");
    15411544
    15421545    MAlphaFitter fit;
     
    19631966        // Write the output
    19641967        TObjArray cont;
    1965         cont.Add((TObject*)GetEnv()); // const_cast
    1966         cont.Add((TObject*)&set);     // const_cast
     1968        cont.Add(&env);                           // ganymed.rc
     1969        cont.Add(const_cast<TEnv*>(GetEnv()));    // sponde.rc
     1970        cont.Add(const_cast<MDataSet*>(&set));    // Dataset
    19671971        cont.Add(plist.FindObject("MAlphaFitter"));
    19681972        cont.Add(&area0);
  • trunk/MagicSoft/Mars/mjobs/MJob.cc

    r9261 r9345  
    460460    }
    461461
    462     MIter Next(&list);
    463     MParContainer *o=0;
     462    TIter Next(&list);
     463    TObject *o=0;
    464464    while ((o=Next()))
    465465    {
    466         *fLog << inf << " - Reading " << o->GetDescriptor() << "..." << flush;
     466        *fLog << inf << " - Reading " << MParContainer::GetDescriptor(*o) << "..." << flush;
    467467        if (o->Read(o->GetName())<=0)
    468468        {
    469             *fLog << err << dbginf << "ERROR - Reading " << o->GetDescriptor() << " from file " << gFile->GetName() << endl;
     469            *fLog << err << dbginf << "ERROR - Reading " << MParContainer::GetDescriptor(*o) << " from file " << gFile->GetName() << endl;
    470470            return kFALSE;
    471471        }
  • trunk/MagicSoft/Mars/sponde.cc

    r9343 r9345  
    151151    // --rc= from the list of arguments.
    152152    //
    153     MEnv env(kConfig);
     153    MEnv env(kConfig, "sponde.rc");
    154154    if (!env.IsValid())
    155155    {
  • trunk/MagicSoft/Mars/star.cc

    r9276 r9345  
    149149    // --rc= from the list of arguments.
    150150    //
    151     MEnv env(kConfig);
     151    MEnv env(kConfig, "star.rc");
    152152    if (!env.IsValid())
    153153    {
Note: See TracChangeset for help on using the changeset viewer.