Changeset 1880 for trunk/MagicSoft


Ignore:
Timestamp:
03/31/03 10:37:56 (22 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 added
34 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r1879 r1880  
    11                                                 -*-*- END OF LINE -*-*-
     2
     3 2003/03/31: Thomas Bretz
     4 
     5   * Makefile.conf.linux:
     6     - removed -fno-rtti to make it compatible with root 3.04.02
     7   
     8   * NEWS:
     9     - changed
     10   
     11   * manalysis/MImgCleanStd.[h,cc]:
     12     - added SetLvl1
     13     - added SetLvl2
     14     - added ReadEnv
     15   
     16   * manalysis/MNewImagePar.[h,cc]:
     17     - removed unnecessary fHillas data member
     18     - removed unnecessary fSrcPos data member
     19     - removed unnecessary Set/GetSrcPos
     20   
     21   * manalysis/MNewImageParCalc.[h,cc]:
     22     - removed unnecessary SetSrcPos
     23     - removed const-qualifier from fGeomCam, fCerPhotEvt
     24       (trouble with root 3.02/06)
     25   
     26   * manalysis/MRanForest.cc:
     27     - changed cout-output
     28     
     29   * manalysis/MSigmabar.cc:
     30     - changed Area to area (local variable)
     31
     32   * mbase/MEvtLoop.[h,cc]:
     33     - added evtloop name to constructor (default=Evtloop)
     34     - adapted StreamPrimitive
     35     - added ReadEnv
     36     - added WriteEnv
     37     
     38   * mbase/MParContainer.[h,cc]:
     39     - removed TROOT.h
     40     - fixed const-qualifier for Copy-function for root>3.04.01
     41     - added ReadEnv
     42     - added WriteEnv
     43     - added IsEnvDefined
     44     - added GetEnvValue
     45     
     46   * mbase/MParList.[h,cc], mbase/MTaskList.[h,cc]:
     47     - added ReadEnv
     48     - added WriteEnv
     49   
     50   * mfileio/MCT1ReadAscii.[h,cc], mfileio/MCT1ReadPreProc.[h,cc]:
     51     - changed AddFile declaration to declaration in MRead
     52     - added return value to AddFile
     53     
     54   * mfileio/MRead.[h,cc]:
     55     - added template for AddFile
     56     - added ReadEnv
     57     
     58   * mgui/MHexagon.[h,cc]:
     59     - fixed const-qualifier for Copy-function for root>3.04.01
     60   
     61   * mhist/MH.cc:
     62     - fixed the FindGoodLimit stuff for root> 3.04.01
     63     
     64   * mhist/MHRanForest.[h,cc], mhist/MHRanForestGini.[h,cc]:
     65     - removed unnecessary casts
     66     - fixed a copilation error with root 3.04.01 (kFullDotlarge
     67       doesn't exist)
     68     - removed second Draw (one should not add something twice to
     69       the pad)
     70       
     71   * mmontecarlo/MMcTriggerRateCalc.cc:
     72     - changes to the header
     73     - changes to the fLog stuff
     74     - added a cast to get rid of a warning
     75     
     76   * mtools/Makefile, mtools/ToolsLinkDef.h:
     77     - added MagicReversi
     78   
     79   * mtools/MagicRevers.[h,cc]:
     80     - added
     81
    282
    383
     
    384464      - Added axis labels in graphic output
    385465      - Added Get function for rate histograms
     466
    386467    * macros/trigrate.C
    387468      - Added output file with rate histograms
  • trunk/MagicSoft/Mars/Makefile.conf.linux

    r1172 r1880  
    2020#  ----->>>   settings for compilation
    2121#
    22 OPTIM    = -O5 -Wall -fno-rtti -fnonnull-objects -fno-exceptions -fPIC -Wtraditional -Wpointer-arith -Wcast-align -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Woverloaded-virtual
     22OPTIM    = -O5 -Wall -fnonnull-objects -fno-exceptions -fPIC -Wtraditional -Wpointer-arith -Wcast-align -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Woverloaded-virtual
    2323DEBUG    =
    2424ARCHDEF  = -D__LINUX__
  • trunk/MagicSoft/Mars/NEWS

    r1860 r1880  
    4040   
    4141   - added Random Forest - method for g/h-separation
     42
     43   - made compatible with the latest PRO version of root (3.04/02)
    4244
    4345
  • trunk/MagicSoft/Mars/manalysis/MImgCleanStd.cc

    r1647 r1880  
    414414}
    415415
     416void MImgCleanStd::SetLvl1(Float_t lvl)
     417{
     418    fCleanLvl1 = lvl;
     419    *fLog << inf << "Cleaning level 1 set to " << lvl << " sigma." << endl;
     420}
     421
     422void MImgCleanStd::SetLvl2(Float_t lvl)
     423{
     424    fCleanLvl2 = lvl;
     425    *fLog << inf << "Cleaning level 2 set to " << lvl << " sigma." << endl;
     426}
     427
    416428// --------------------------------------------------------------------------
    417429//
     
    433445    {
    434446    case kImgCleanLvl1:
    435         fCleanLvl1 = lvl;
    436         *fLog << "Cleaning level 1 set to " << lvl << " sigma." << endl;
     447        SetLvl1(lvl);
    437448        return kTRUE;
    438449
    439450    case kImgCleanLvl2:
    440         fCleanLvl2 = lvl;
    441         *fLog << "Cleaning level 2 set to " << lvl << " sigma." << endl;
     451        SetLvl2(lvl);
    442452        return kTRUE;
    443453    }
     
    465475    out << ");" << endl;
    466476}
     477
     478// --------------------------------------------------------------------------
     479//
     480// Read the setup from a TEnv:
     481//   Float_t fCleanLvl1: CleaningLevel1
     482//   Float_t fCleanLvl2: CleaningLevel2
     483//
     484Bool_t MImgCleanStd::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     485{
     486    Bool_t rc = kTRUE;
     487    if (!IsEnvDefined(env, prefix, "CleaningLevel1", print))
     488        rc = kFALSE;
     489    else
     490    {
     491        SetLvl1(GetEnvValue(env, prefix, "CleaningLevel1", fCleanLvl1));
     492        if (fCleanLvl1<0)
     493        {
     494            *fLog << err << "ERROR - Negative values for Cleaning Level 1 forbidden." << endl;
     495            return kERROR;
     496        }
     497    }
     498
     499    if (!IsEnvDefined(env, prefix, "CleaningLevel2", print))
     500        rc = kFALSE;
     501    else
     502    {
     503        SetLvl2(GetEnvValue(env, prefix, "CleaningLevel2", fCleanLvl2));
     504        if (fCleanLvl2<0)
     505        {
     506            *fLog << err << "ERROR - Negative values for Cleaning Level 2 forbidden." << endl;
     507            return kERROR;
     508        }
     509    }
     510
     511    return rc;
     512}
  • trunk/MagicSoft/Mars/manalysis/MImgCleanStd.h

    r1540 r1880  
    2020    Float_t fCleanLvl2;
    2121
     22    void SetLvl1(Float_t lvl);
     23    void SetLvl2(Float_t lvl);
     24
    2225    void CreateGuiElements(MGGroupFrame *f);
    2326    void StreamPrimitive(ofstream &out) const;
     
    4043
    4144    Bool_t ProcessMessage(Int_t msg, Int_t submsg, Long_t param1, Long_t param2);
     45    Bool_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
    4246
    4347    ClassDef(MImgCleanStd, 0)    // task doing a standard image cleaning
  • trunk/MagicSoft/Mars/manalysis/MNewImagePar.cc

    r1872 r1880  
    7272                          const MHillas *hillas)
    7373{
    74     fHillas = hillas;
     74    //fHillas = (MHillas*)hillas;
    7575
    7676    const UInt_t npixevt = evt.GetNumPixels();
     
    9696    }
    9797
    98 
    99     fLeakage1 = edgepix1 / fHillas->GetSize();
    100     fLeakage2 = edgepix2 / fHillas->GetSize();
     98    fLeakage1 = edgepix1 / hillas->GetSize();
     99    fLeakage2 = edgepix2 / hillas->GetSize();
    101100
    102101    SetReadyToSave();
  • trunk/MagicSoft/Mars/manalysis/MNewImagePar.h

    r1872 r1880  
    1111{
    1212private:
    13     const MHillas    *fHillas; //! Input parameters
    14     const MSrcPosCam *fSrcPos; //! Source position in the camera
    15 
    1613    Float_t fLeakage1;   // (photons in most outer ring of pixels) over fSize
    1714    Float_t fLeakage2;   // (photons in the 2 outer rings of pixels) over fSize
     
    2017    MNewImagePar(const char *name=NULL, const char *title=NULL);
    2118
    22     void SetSrcPos(const MSrcPosCam *pos) { fSrcPos = pos; }
    23     const MSrcPosCam *GetSrcPos() const   { return fSrcPos; }
     19    //    void SetSrcPos(MSrcPosCam *pos) { fSrcPos = pos; }
     20    //    const MSrcPosCam *GetSrcPos() const   { return fSrcPos; }
    2421
    2522    void Reset();
  • trunk/MagicSoft/Mars/manalysis/MNewImageParCalc.cc

    r1872 r1880  
    107107        return kFALSE;
    108108
    109     fNewImagePar->SetSrcPos(fSrcPos);
    110 
    111109    fErrors = 0;
    112110
  • trunk/MagicSoft/Mars/manalysis/MNewImageParCalc.h

    r1872 r1880  
    1515{
    1616private:
    17     const MGeomCam    *fGeomCam;
    18     const MCerPhotEvt *fCerPhotEvt;
     17    MGeomCam    *fGeomCam;
     18    MCerPhotEvt *fCerPhotEvt;
    1919
    2020    MHillas      *fHillas;       //! Pointer to the source independent hillas parameters
  • trunk/MagicSoft/Mars/manalysis/MRanForest.cc

    r1871 r1880  
    288288
    289289    // give running output
    290     TString str=Form("%.2f",100.*fErr);
    291     cout.width(5);  cout<<fTreeNo;
    292     cout.width(15); cout<<str<<endl;
     290    cout << setw(5) << fTreeNo << setw(15) << Form("%.2f",100.*fErr) << endl;
    293291
    294292    // adding tree to forest
  • trunk/MagicSoft/Mars/manalysis/MSigmabar.cc

    r1748 r1880  
    9191  Int_t outerPixels[6]       = {0,0,0,0,0,0};
    9292
    93   Int_t currentSector;
    94   Float_t angle;
    95  
    9693  // sum up sigma**2 for each sector, separately for inner and outer region;
    9794  // all pixels are renormalized to the area of pixel 0
     
    117114
    118115      Int_t j = cerpix.GetPixId();
    119       Double_t Area = geom.GetPixRatio(j);
     116      Double_t area = geom.GetPixRatio(j);
    120117
    121118      const MGeomPix    &gpix = geom[j];
     
    125122      //if (angle<0.0) angle+=6.0;
    126123
    127       angle = 6.0*atan2(gpix.GetY(),gpix.GetX()) / (2.0*TMath::Pi());
    128       if (angle<0.0) angle+=6.0;
    129       currentSector=(Int_t)angle;
     124      Float_t angle = atan2(gpix.GetY(),gpix.GetX())*6 / (TMath::Pi()*2);
     125      if (angle<0) angle+=6;
     126
     127      Int_t currentSector=(Int_t)angle;
    130128       
    131129      // count only those pixels which have a sigma != 0.0
     
    134132      if ( sigma != 0.0 )
    135133      { 
    136         if (Area < 1.5)
     134        if (area < 1.5)
    137135        {
    138136          innerPixels[currentSector]++;
    139           innerSquaredSum[currentSector]+= sigma*sigma / Area;
     137          innerSquaredSum[currentSector]+= sigma*sigma / area;
    140138        }
    141139        else
    142140        {
    143141          outerPixels[currentSector]++;
    144           outerSquaredSum[currentSector]+= sigma*sigma / Area;
     142          outerSquaredSum[currentSector]+= sigma*sigma / area;
    145143        }
    146144      }
     
    191189  }
    192190   
    193   return (fSigmabar);
     191  return fSigmabar;
    194192}
    195193
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.cc

    r1850 r1880  
    103103// default constructor - emty
    104104//
    105 MEvtLoop::MEvtLoop() : fParList(NULL), fProgress(NULL)
    106 {
    107     fName = "Evtloop";
     105MEvtLoop::MEvtLoop(const char *name) : fParList(NULL), fProgress(NULL)
     106{
     107    fName = name;
    108108}
    109109
     
    444444// gui elements to a macro-file.
    445445//
    446 
    447446void MEvtLoop::StreamPrimitive(ofstream &out) const
    448447{
    449     out << "   MEvtLoop " << GetUniqueName() << ";" << endl;
    450 }
    451 
     448    out << "   MEvtLoop " << GetUniqueName();
     449    if (fName!="Evtloop")
     450        out << "(\"" << fName << "\")";
     451    out << ";" << endl;
     452}
     453
     454// --------------------------------------------------------------------------
     455//
     456//
    452457void MEvtLoop::SavePrimitive(ofstream &out, Option_t *opt)
    453458{
     
    666671    return n;
    667672}
     673
     674// --------------------------------------------------------------------------
     675//
     676// Read the contents/setup of a parameter container/task from a TEnv
     677// instance (steering card/setup file).
     678// The key to search for in the file should be of the syntax:
     679//    prefix.vname
     680// While vname is a name which is specific for a single setup date
     681// (variable) of this container and prefix is something like:
     682//    evtloopname.name
     683// While name is the name of the containers/tasks in the parlist/tasklist
     684//
     685// eg.  Job4.MImgCleanStd.CleaningLevel1:  3.0
     686//      Job4.MImgCleanStd.CleaningLevel2:  2.5
     687//
     688// If this cannot be found the next step is to search for
     689//      MImgCleanStd.CleaningLevel1:  3.0
     690// And if this doesn't exist, too, we should search for:
     691//      CleaningLevel1:  3.0
     692//
     693// Warning: The programmer is responsible for the names to be unique in
     694//          all Mars classes.
     695//
     696Bool_t MEvtLoop::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     697{
     698    if (!prefix.IsNull())
     699        *fLog << warn << "WARNING - Second argument in MEvtLoop::ReadEnv has no meaning... ignored." << endl;
     700
     701    *fLog << "1: " << "'" << prefix << "'" << (int)print << endl;
     702
     703    prefix = fName;
     704    prefix += ".";
     705
     706    *fLog << inf << "Reading resources for " << prefix /*TEnv::fRcName << " from " << env.GetRcName()*/ << endl;
     707
     708    if (fParList->ReadEnv(env, prefix, print)==kERROR)
     709    {
     710        *fLog << err << "ERROR - Reading Environment file." << endl;
     711        return kFALSE;
     712    }
     713
     714    return kTRUE;
     715}
     716
     717// --------------------------------------------------------------------------
     718//
     719// Write the contents/setup of a parameter container/task to a TEnv
     720// instance (steering card/setup file).
     721// The key to search for in the file should be of the syntax:
     722//    prefix.vname
     723// While vname is a name which is specific for a single setup date
     724// (variable) of this container and prefix is something like:
     725//    evtloopname.name
     726// While name is the name of the containers/tasks in the parlist/tasklist
     727//
     728// eg.  Job4.MImgCleanStd.CleaningLevel1:  3.0
     729//      Job4.MImgCleanStd.CleaningLevel2:  2.5
     730//
     731// If this cannot be found the next step is to search for
     732//      MImgCleanStd.CleaningLevel1:  3.0
     733// And if this doesn't exist, too, we should search for:
     734//      CleaningLevel1:  3.0
     735//
     736// Warning: The programmer is responsible for the names to be unique in
     737//          all Mars classes.
     738//
     739Bool_t MEvtLoop::WriteEnv(TEnv &env, TString prefix, Bool_t print) const
     740{
     741    if (!prefix.IsNull())
     742        *fLog << warn << "WARNING - Second argument in MEvtLoop::WriteEnv has no meaning... ignored." << endl;
     743
     744    prefix = fName;
     745    prefix += ".";
     746
     747    *fLog << inf << "Writing resources: " << prefix /*TEnv::fRcName << " to " << env.GetRcName()*/ << endl;
     748
     749    if (fParList->WriteEnv(env, prefix, print)!=kTRUE)
     750    {
     751        *fLog << err << "ERROR - Writing Environment file." << endl;
     752        return kFALSE;
     753    }
     754
     755    return kTRUE;
     756}
  • trunk/MagicSoft/Mars/mbase/MEvtLoop.h

    r1657 r1880  
    3737
    3838public:
    39     MEvtLoop();
     39    MEvtLoop(const char *name="Evtloop");
    4040    virtual ~MEvtLoop();
    4141
     
    6666    void Print(Option_t *opt="") const;
    6767
     68    Bool_t ReadEnv(const TEnv &env, TString prefix="", Bool_t print=kFALSE);
     69    Bool_t WriteEnv(TEnv &env, TString prefix="", Bool_t print=kFALSE) const;
     70
    6871    ClassDef(MEvtLoop, 1) // Class to execute the tasks in a tasklist
    6972};
  • trunk/MagicSoft/Mars/mbase/MParContainer.cc

    r1794 r1880  
    4040#include <fstream.h>     // ofstream, AsciiWrite
    4141
    42 #include <TROOT.h>       // TROOT::Identlevel
     42#include <TEnv.h>        // Env::Lookup
    4343#include <TClass.h>      // IsA
    4444#include <TObjArray.h>   // TObjArray
     
    5454#include "MEvtLoop.h"    // gListOfPrimitives
    5555#else
    56 TList *gListOfPrimitives;
     56TList *gListOfPrimitives; // forard declaration in MParContainer.h
    5757#endif
    5858
     
    122122//
    123123void MParContainer::Copy(TObject &obj)
     124#if ROOT_VERSION_CODE > ROOT_VERSION(3,04,01)
     125const
     126#endif
    124127{
    125128    MParContainer &cont = (MParContainer&)obj;
     
    449452    return (MParContainer*)IsA()->New();
    450453}
     454
     455// --------------------------------------------------------------------------
     456//
     457// Read the contents/setup of a parameter container/task from a TEnv
     458// instance (steering card/setup file).
     459// The key to search for in the file should be of the syntax:
     460//    prefix.vname
     461// While vname is a name which is specific for a single setup date
     462// (variable) of this container and prefix is something like:
     463//    evtloopname.name
     464// While name is the name of the containers/tasks in the parlist/tasklist
     465//
     466// eg.  Job4.MImgCleanStd.CleaningLevel1:  3.0
     467//      Job4.MImgCleanStd.CleaningLevel2:  2.5
     468//
     469// If this cannot be found the next step is to search for
     470//      MImgCleanStd.CleaningLevel1:  3.0
     471// And if this doesn't exist, too, we should search for:
     472//      CleaningLevel1:  3.0
     473//
     474// Warning: The programmer is responsible for the names to be unique in
     475//          all Mars classes.
     476//
     477Bool_t MParContainer::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     478{
     479    if (!IsEnvDefined(env, prefix, "", print))
     480        return kFALSE;
     481
     482    *fLog << warn << "WARNING - Resource " << prefix+fName << " found, but no " << IsA()->GetName() << "::ReadEnv." << endl;
     483    return kTRUE;
     484}
     485
     486// --------------------------------------------------------------------------
     487//
     488// Write the contents/setup of a parameter container/task to a TEnv
     489// instance (steering card/setup file).
     490// The key to search for in the file should be of the syntax:
     491//    prefix.vname
     492// While vname is a name which is specific for a single setup date
     493// (variable) of this container and prefix is something like:
     494//    evtloopname.name
     495// While name is the name of the containers/tasks in the parlist/tasklist
     496//
     497// eg.  Job4.MImgCleanStd.CleaningLevel1:  3.0
     498//      Job4.MImgCleanStd.CleaningLevel2:  2.5
     499//
     500// If this cannot be found the next step is to search for
     501//      MImgCleanStd.CleaningLevel1:  3.0
     502// And if this doesn't exist, too, we should search for:
     503//      CleaningLevel1:  3.0
     504//
     505// Warning: The programmer is responsible for the names to be unique in
     506//          all Mars classes.
     507//
     508Bool_t MParContainer::WriteEnv(TEnv &env, TString prefix, Bool_t print) const
     509{
     510    if (!IsEnvDefined(env, prefix, "", print))
     511        return kFALSE;
     512
     513    *fLog << warn << "WARNING - Resource " << prefix+fName << " found, but " << IsA()->GetName() << "::WriteEnv not overloaded." << endl;
     514    return kTRUE;
     515}
     516
     517Bool_t MParContainer::IsEnvDefined(const TEnv &env, TString prefix, TString postfix, Bool_t print) const
     518{
     519    if (!postfix.IsNull())
     520        postfix.Insert(0, ".");
     521
     522    return IsEnvDefined(env, prefix+fName+postfix, print);
     523}
     524
     525Bool_t MParContainer::IsEnvDefined(const TEnv &env, TString name, Bool_t print) const
     526{
     527    if (print)
     528        *fLog << all << GetDescriptor() << " - " << name << "... " << flush;
     529
     530    if (!((TEnv&)env).Defined(name))
     531    {
     532        if (print)
     533            *fLog << "not found." << endl;
     534        return kFALSE;
     535    }
     536
     537    if (print)
     538        *fLog << "found." << endl;
     539
     540    return kTRUE;
     541}
     542
     543Int_t MParContainer::GetEnvValue(const TEnv &env, TString prefix, TString postfix, Int_t dflt) const
     544{
     545    return ((TEnv&)env).GetValue(prefix+fName+"."+postfix, dflt);
     546}
     547
     548Double_t MParContainer::GetEnvValue(const TEnv &env, TString prefix, TString postfix, Double_t dflt) const
     549{
     550    return ((TEnv&)env).GetValue(prefix+fName+"."+postfix, dflt);
     551}
     552
     553const char *MParContainer::GetEnvValue(const TEnv &env, TString prefix, TString postfix, const char *dflt) const
     554{
     555    return ((TEnv&)env).GetValue(prefix+fName+"."+postfix, dflt);
     556}
  • trunk/MagicSoft/Mars/mbase/MParContainer.h

    r1879 r1880  
    2323class ifstream;
    2424
     25class TEnv;
    2526class TDataMember;
    2627class TMethodCall;
     
    5657    virtual TObject    *Clone(const char *newname="") const;
    5758    virtual Int_t       Compare(const TObject *obj) const;
    58     virtual void        Copy(TObject &named);
     59    virtual void        Copy(TObject &named)
     60#if ROOT_VERSION_CODE > ROOT_VERSION(3,04,01)
     61const
     62#endif
     63        ;
    5964    virtual void        FillBuffer(char *&buffer);
    6065
     
    95100    virtual void SetNames(TObjArray &arr);
    96101
     102    virtual Bool_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
     103    virtual Bool_t WriteEnv(TEnv &env, TString prefix, Bool_t print=kFALSE) const;
     104
     105    Bool_t ReadEnv(const TEnv &env, Bool_t print=kFALSE) { return ReadEnv(env, "", print); }
     106    Bool_t WriteEnv(TEnv &env, Bool_t print=kFALSE) const { return WriteEnv(env, "", print); }
     107
     108    Bool_t IsEnvDefined(const TEnv &env, TString prefix, TString postfix, Bool_t print) const;
     109    Bool_t IsEnvDefined(const TEnv &env, TString name, Bool_t print) const;
     110
     111    Int_t       GetEnvValue(const TEnv &env, TString prefix, TString postfix, Int_t dflt) const;
     112    Double_t    GetEnvValue(const TEnv &env, TString prefix, TString postfix, Double_t dflt) const;
     113    const char *GetEnvValue(const TEnv &env, TString prefix, TString postfix, const char *dflt) const;
     114
    97115    ClassDef(MParContainer, 0)  //The basis for all parameter containers
    98116};
  • trunk/MagicSoft/Mars/mbase/MParList.cc

    r1528 r1880  
    768768}
    769769
     770// --------------------------------------------------------------------------
     771//
     772// Read the contents/setup of a parameter container/task from a TEnv
     773// instance (steering card/setup file).
     774// The key to search for in the file should be of the syntax:
     775//    prefix.vname
     776// While vname is a name which is specific for a single setup date
     777// (variable) of this container and prefix is something like:
     778//    evtloopname.name
     779// While name is the name of the containers/tasks in the parlist/tasklist
     780//
     781// eg.  Job4.MImgCleanStd.CleaningLevel1:  3.0
     782//      Job4.MImgCleanStd.CleaningLevel2:  2.5
     783//
     784// If this cannot be found the next step is to search for
     785//      MImgCleanStd.CleaningLevel1:  3.0
     786// And if this doesn't exist, too, we search for:
     787//      CleaningLevel1:  3.0
     788//
     789// Warning: The programmer is responsible for the names to be unique in
     790//          all Mars classes.
     791//
     792Bool_t MParList::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     793{
     794    MParContainer *cont = NULL;
     795
     796    TIter Next(fContainer);
     797    while ((cont=(MParContainer*)Next()))
     798        if (cont->ReadEnv(env, print)==kERROR)
     799            return kERROR;
     800
     801    Next.Reset();
     802    while ((cont=(MParContainer*)Next()))
     803        if (cont->ReadEnv(env, prefix, print)==kERROR)
     804            return kERROR;
     805
     806    return kTRUE;
     807}
     808
     809// --------------------------------------------------------------------------
     810//
     811// Write the contents/setup of a parameter container/task to a TEnv
     812// instance (steering card/setup file).
     813// The key to search for in the file should be of the syntax:
     814//    prefix.vname
     815// While vname is a name which is specific for a single setup date
     816// (variable) of this container and prefix is something like:
     817//    evtloopname.name
     818// While name is the name of the containers/tasks in the parlist/tasklist
     819//
     820// eg.  Job4.MImgCleanStd.CleaningLevel1:  3.0
     821//      Job4.MImgCleanStd.CleaningLevel2:  2.5
     822//
     823// If this cannot be found the next step is to search for
     824//      MImgCleanStd.CleaningLevel1:  3.0
     825// And if this doesn't exist, too, we search for:
     826//      CleaningLevel1:  3.0
     827//
     828// Warning: The programmer is responsible for the names to be unique in
     829//          all Mars classes.
     830//
     831Bool_t MParList::WriteEnv(TEnv &env, TString prefix, Bool_t print) const
     832{
     833    MParContainer *cont = NULL;
     834
     835    TIter Next(fContainer);
     836    while ((cont=(MParContainer*)Next()))
     837        if (!cont->WriteEnv(env, prefix, print))
     838            return kFALSE;
     839    return kTRUE;
     840}
  • trunk/MagicSoft/Mars/mbase/MParList.h

    r1879 r1880  
    9090    void SavePrimitive(ofstream &out, Option_t *o="");
    9191
     92    Bool_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
     93    Bool_t WriteEnv(TEnv &env, TString prefix, Bool_t print=kFALSE) const;
     94
    9295    ClassDef(MParList, 1) // list of parameter containers (MParContainer)
    9396};
  • trunk/MagicSoft/Mars/mbase/MTaskList.cc

    r1666 r1880  
    643643}
    644644
     645// --------------------------------------------------------------------------
     646//
     647// Read the contents/setup of a parameter container/task from a TEnv
     648// instance (steering card/setup file).
     649// The key to search for in the file should be of the syntax:
     650//    prefix.vname
     651// While vname is a name which is specific for a single setup date
     652// (variable) of this container and prefix is something like:
     653//    evtloopname.name
     654// While name is the name of the containers/tasks in the parlist/tasklist
     655//
     656// eg.  Job4.MImgCleanStd.CleaningLevel1:  3.0
     657//      Job4.MImgCleanStd.CleaningLevel2:  2.5
     658//
     659// If this cannot be found the next step is to search for
     660//      MImgCleanStd.CleaningLevel1:  3.0
     661// And if this doesn't exist, too, we should search for:
     662//      CleaningLevel1:  3.0
     663//
     664// Warning: The programmer is responsible for the names to be unique in
     665//          all Mars classes.
     666//
     667Bool_t MTaskList::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     668{
     669    MParContainer *cont = NULL;
     670
     671    TIter Next(fTasks);
     672    while ((cont=(MParContainer*)Next()))
     673        if (cont->ReadEnv(env, print)==kERROR)
     674            return kERROR;
     675
     676    Next.Reset();
     677    while ((cont=(MParContainer*)Next()))
     678        if (cont->ReadEnv(env, prefix, print)==kERROR)
     679            return kERROR;
     680
     681    return kTRUE;
     682}
     683
     684// --------------------------------------------------------------------------
     685//
     686// Write the contents/setup of a parameter container/task to a TEnv
     687// instance (steering card/setup file).
     688// The key to search for in the file should be of the syntax:
     689//    prefix.vname
     690// While vname is a name which is specific for a single setup date
     691// (variable) of this container and prefix is something like:
     692//    evtloopname.name
     693// While name is the name of the containers/tasks in the parlist/tasklist
     694//
     695// eg.  Job4.MImgCleanStd.CleaningLevel1:  3.0
     696//      Job4.MImgCleanStd.CleaningLevel2:  2.5
     697//
     698// If this cannot be found the next step is to search for
     699//      MImgCleanStd.CleaningLevel1:  3.0
     700// And if this doesn't exist, too, we should search for:
     701//      CleaningLevel1:  3.0
     702//
     703// Warning: The programmer is responsible for the names to be unique in
     704//          all Mars classes.
     705//
     706Bool_t MTaskList::WriteEnv(TEnv &env, TString prefix, Bool_t print) const
     707{
     708    MParContainer *cont = NULL;
     709
     710    TIter Next(fTasks);
     711    while ((cont=(MParContainer*)Next()))
     712        if (!cont->WriteEnv(env, prefix, print))
     713            return kFALSE;
     714    return kTRUE;
     715}
  • trunk/MagicSoft/Mars/mbase/MTaskList.h

    r1661 r1880  
    6767    void SetNames(TObjArray &arr);
    6868
     69    Bool_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
     70    Bool_t WriteEnv(TEnv &env, TString prefix, Bool_t print=kFALSE) const;
     71
    6972    ClassDef(MTaskList, 1) //collection of tasks to be performed in the eventloop
    7073};
  • trunk/MagicSoft/Mars/mfileio/MCT1ReadAscii.cc

    r1668 r1880  
    9696// Add this file as the last entry in the chain
    9797//
    98 void MCT1ReadAscii::AddFile(const char *txt)
     98Int_t MCT1ReadAscii::AddFile(const char *txt, Int_t)
    9999{
    100100    TNamed *name = new TNamed(txt, "");
    101101    fFileNames->AddLast(name);
     102    return 1;
    102103}
    103104
     
    299300    return kTRUE;
    300301}
    301 
  • trunk/MagicSoft/Mars/mfileio/MCT1ReadAscii.h

    r1381 r1880  
    3030    ~MCT1ReadAscii();
    3131
    32     void AddFile(const char *fname);
     32    Int_t AddFile(const char *fname, Int_t dummy=-1);
    3333
    3434    Bool_t PreProcess(MParList *pList);
  • trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.cc

    r1873 r1880  
    119119// Add this file as the last entry in the chain
    120120//
    121 void MCT1ReadPreProc::AddFile(const char *txt)
     121Int_t MCT1ReadPreProc::AddFile(const char *txt, Int_t)
    122122{
    123123    const char *name = gSystem->ExpandPathName(txt);
     
    129129    {
    130130        *fLog << warn << "WARNING - Problem reading header... ignored." << endl;
    131         return;
     131        return 0;
    132132    }
    133133
     
    136136    {
    137137        *fLog << warn << "WARNING - File contains no data... ignored." << endl;
    138         return;
     138        return 0;
    139139    }
    140140
     
    144144
    145145    fFileNames->AddLast(new TNamed(txt, ""));
     146    return 1;
    146147}
    147148
  • trunk/MagicSoft/Mars/mfileio/MCT1ReadPreProc.h

    r1849 r1880  
    7777    ~MCT1ReadPreProc();
    7878
    79     void AddFile(const char *fname);
     79    Int_t AddFile(const char *fname, Int_t dummy=-1);
    8080
    8181    UInt_t GetEntries() { return fEntries; }
  • trunk/MagicSoft/Mars/mfileio/MRead.cc

    r1668 r1880  
    3939ClassImp(MRead);
    4040
     41// --------------------------------------------------------------------------
     42//
     43// Read the setup from a TEnv:
     44//   File0, File1, File2, ..., File10, ..., File100, ...
     45//
     46// Searching stops if the first key isn't found in the TEnv
     47//
     48// Enclosing quotation marks (") are removed
     49//
     50// Number of entries at the moment not supported
     51//
     52Bool_t MRead::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     53{
     54    //
     55    // Don't allow 'global' setup of files
     56    //
     57    if (prefix.IsNull())
     58        return kFALSE;
     59
     60    //
     61    // Search (beginning with 0) all keys
     62    //
     63    for (int i=0;; i++)
     64    {
     65        TString idx = "File";
     66        idx += i;
     67
     68        // Output if print set to kTRUE
     69        IsEnvDefined(env, prefix, idx, print);
     70
     71        // Try to get the file name
     72        TString name = GetEnvValue(env, prefix, idx, "");
     73        if (name.IsNull())
     74            return kTRUE;
     75
     76        if (name.BeginsWith("\"") && name.EndsWith("\""))
     77        {
     78            name.Remove(name.Last('\"'), 1);
     79            name.Remove(name.First('\"'), 1);
     80        }
     81
     82        AddFile(name);
     83    }
     84
     85    return kTRUE;
     86}
  • trunk/MagicSoft/Mars/mfileio/MRead.h

    r1668 r1880  
    2121    MFilter *GetSelector() { return fSelector; }
    2222
     23    Int_t AddFile(const char *fname, Int_t entries=-1) { return -1; }
     24
     25    Bool_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
     26
    2327    ClassDef(MRead, 0)  // Base class for a reading task
    2428};
  • trunk/MagicSoft/Mars/mgui/MHexagon.cc

    r1508 r1880  
    9292//
    9393void MHexagon::Copy(TObject &obj)
     94#if ROOT_VERSION_CODE > ROOT_VERSION(3,04,01)
     95const
     96#endif
     97
    9498{
    9599    MHexagon &hex = (MHexagon&) obj;
  • trunk/MagicSoft/Mars/mgui/MHexagon.h

    r1384 r1880  
    4444    virtual ~MHexagon();
    4545
    46     virtual void  Copy(TObject &hexagon);
     46    virtual void  Copy(TObject &hexagon)
     47#if ROOT_VERSION_CODE > ROOT_VERSION(3,04,01)
     48const
     49#endif
     50        ;
    4751
    4852    virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
  • trunk/MagicSoft/Mars/mhist/MH.cc

    r1879 r1880  
    5959#include <TLegend.h>
    6060#include <TPaveStats.h>
     61#if ROOT_VERSION_CODE > ROOT_VERSION(3,04,01)
     62#include <THLimitsFinder.h>
     63#endif
    6164
    6265#include "MLog.h"
     
    469472void MH::FindGoodLimits(Int_t nbins, Int_t &newbins, Double_t &xmin, Double_t &xmax, Bool_t isInteger)
    470473{
     474#if ROOT_VERSION_CODE > ROOT_VERSION(3,04,01)
     475    THLimitsFinder::OptimizeLimits(nbins, newbins, xmin, xmax, isInteger);
     476#else
    471477//*-*-*-*-*-*-*-*-*Find reasonable bin values*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
    472478//*-*              ==========================
     
    486492    Double_t binwidth=0;
    487493
    488 #if ROOT_VERSION_CODE < ROOT_VERSION(3,03,01)
    489494    TGaxis::Optimize(umin, umax, nbins, binlow, binhigh, nbins, binwidth, "");
    490 #else
    491     gLog << all << "*********************************************************" << endl;
    492     gLog << all << "ERROR, because Abelardo removed TGaxis::Optimize from" << endl;
    493     gLog << all << " MH::FindGoodLimits to be able to compile Mars with newer" << endl;
    494     gLog << all << " root versions, whatever you are trying to do will fail!!!" << endl;
    495     gLog << all << "*********************************************************" << endl;
    496 #endif
    497495
    498496    if (binwidth <= 0 || binwidth > 1.e+39)
     
    532530
    533531    newbins = nbins;
     532#endif
    534533}
    535534
  • trunk/MagicSoft/Mars/mhist/MHRanForest.cc

    r1870 r1880  
    114114
    115115    Int_t ntrees=fRanForest->GetNumTrees();
    116     //cout<<"filling"<<endl;
     116
    117117    for (Int_t i=0;i<ntrees;i++)
    118118    {
     
    120120            hest+=fRanForest->GetTreeHad(j);
    121121
    122         hest/=Double_t(i+1);
     122        hest/=i+1;
    123123        fSigma[i]+=(htrue-hest)*(htrue-hest);
    124124    }
     
    177177        g.GetXaxis()->SetTitle("Number of Trees");
    178178        g.GetYaxis()->SetTitle("Standard deviation of estimated hadronness");
    179         g.SetMarkerStyle(kFullDotlarge);
    180         g.Draw("P");
    181 
     179        g.SetMarkerStyle(kFullDotMedium);
     180        gPad->Modified();
     181        gPad->Update();
     182        //g.Draw("P");
    182183    }
    183184    gPad->SetGrid();
     
    209210
    210211        fGraphSigma->SetMarkerStyle(kFullDotSmall);
    211         fGraphSigma->Draw("P");
     212        //fGraphSigma->Draw("P");
    212213        gPad->Modified();
    213214        gPad->Update();
  • trunk/MagicSoft/Mars/mhist/MHRanForestGini.cc

    r1870 r1880  
    121121    for (Int_t i=0; i<n; i++)
    122122    {
     123        fGini[i]/=fRanForest->GetNumTrees();
     124        fGini[i]/=fRanForest->GetNumData();
     125
    123126        Stat_t ip = i+1.;
    124         fGini[i]/=Stat_t(fRanForest->GetNumTrees());
    125         fGini[i]/=Stat_t(fRanForest->GetNumData());
    126127        Stat_t ig = fGini[i];
     128
    127129        max=TMath::Max(max,ig);
    128130        min=TMath::Min(min,ig);
     131
    129132        fGraphGini->SetPoint(i,ip,ig);
    130133    }
     
    157160        g.GetXaxis()->SetTitle("No. of RF-input parameter");
    158161        g.GetYaxis()->SetTitle("Mean decrease in Gini-index [a.u.]");
    159         g.SetMarkerStyle(kFullDotlarge);
    160         g.Draw("P");
    161 
     162        g.SetMarkerStyle(kFullDotMedium);
     163        //g.Draw("P");
     164        gPad->Modified();
     165        gPad->Update();
    162166    }
    163167    gPad->SetGrid();
     
    189193
    190194        fGraphGini->SetMarkerStyle(kFullDotSmall);
    191         fGraphGini->Draw("P");
     195        //fGraphGini->Draw("P");
    192196        gPad->Modified();
    193197        gPad->Update();
  • trunk/MagicSoft/Mars/mhist/MHRanForestGini.h

    r1870 r1880  
    1919{
    2020private:
    21     MRanForest *fRanForest;
     21    MRanForest *fRanForest;  //!
    2222
    23     TArrayF fGini;
    24     TGraph *fGraphGini;
     23    TArrayF fGini;           //!
     24    TGraph *fGraphGini;      //->
    2525
    2626public:
  • trunk/MagicSoft/Mars/mmontecarlo/MMcTriggerRateCalc.cc

    r1800 r1880  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@uni-sw.gwdg.de>
     18!   Author(s): Thomas Bretz  12/2000 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!   Author(s): Harald Kornmayer 1/2001
    2020!
    21 !   Copyright: MAGIC Software Development, 2000-2001
     21!   Copyright: MAGIC Software Development, 2000-2003
    2222!
    2323!   Modified 4/7/2002 Abelardo Moralejo: now the dimension of fTrigger is
     
    2727!
    2828\* ======================================================================== */
    29 
    3029#include "MMcTriggerRateCalc.h"
    3130
     
    105104    if (fMcRunHeader->GetAllEvtsTriggered())
    106105      {
    107         *fLog << endl << all << endl <<
    108           "WARNING: the input data file contains only the" << endl <<
    109           "events that triggered. I will assume the standard value" << endl <<
    110           "for maximum impact parameter (400 m)" <<endl;
    111 
    112 
    113         if (fTrigNSB[0] > 0)
    114           *fLog << endl << all <<
    115             "WARNING: NSB rate can be overestimated by up to 5%." << endl <<
    116             "For a precise estimate of the total rate including NSB" << endl <<
    117             "accidental triggers I need a file containing all event headers."
    118                 << endl;
    119         else
    120           *fLog << endl << all <<
    121             "WARNING: calculating only shower rate (no NSB accidental triggers)" << endl;
     106          *fLog << warn;
     107          *fLog << "WARNING - the input data file contains only the" << endl;
     108          *fLog << "events that triggered. I will assume the standard value" << endl;
     109          *fLog << "for maximum impact parameter (400 m)" <<endl;
     110
     111
     112          if (fTrigNSB[0] > 0)
     113          {
     114              *fLog << warn;
     115              *fLog << "WARNING - NSB rate can be overestimated by up to 5%." << endl;
     116              *fLog << "For a precise estimate of the total rate including NSB" << endl;
     117              *fLog << "accidental triggers I need a file containing all event headers." << endl;
     118          }
     119          else
     120          {
     121            *fLog << warn << "WARNING - calculating only shower rate (no NSB accidental triggers)" << endl;
     122          }
    122123      }
    123124
    124     *fLog << endl << all <<
     125    *fLog << endl << warn <<
    125126      "WARNING: I will assume the standard maximum off axis angle" << endl <<
    126127      "(5 degrees) for the original showers" << endl;
     
    168169//      rate:    rate of incident showers
    169170//
    170 
    171171MMcTriggerRateCalc::MMcTriggerRateCalc(float rate, int dim,
    172172                                       float *trigbg, float simbg,
     
    325325          if (fMcCorRunHeader->GetSlopeSpec() != -2.75)
    326326            {
    327               *fLog << err << dbginf <<
    328                 "Spectrum slope as read from  input file ("<<
    329                 fMcCorRunHeader->GetSlopeSpec() << ") does not match the expected one (-2.75) for protons" << endl << "... aborting." << endl;
    330               return kFALSE;
    331             }
     327                *fLog << err << dbginf << "Spectrum slope as read from input file (";
     328                *fLog << fMcCorRunHeader->GetSlopeSpec() << ") does not match the expected ";
     329                *fLog << "one (-2.75) for protons" << endl << "... aborting." << endl;
     330                return kFALSE;
     331            }
    332332          rate.SetFlux(0.1091, 2.75);
    333333          break;
     
    335335          if (fMcCorRunHeader->GetSlopeSpec() != -2.62)
    336336            {
    337               *fLog << err << dbginf <<
    338                 "Spectrum slope as read from  input file ("<<
    339                 fMcCorRunHeader->GetSlopeSpec() << ") does not match the expected one (-2.75) for Helium" << endl << "... aborting." << endl;
    340               return kFALSE;
     337                *fLog << err << dbginf << "Spectrum slope as read from input file (";
     338                *fLog << fMcCorRunHeader->GetSlopeSpec() << ") does not match the expected ";
     339                *fLog << "one (-2.75) for Helium" << endl << "... aborting." << endl;
     340                return kFALSE;
    341341            }
    342342          rate.SetFlux(0.0660, 2.62);
     
    363363void MMcTriggerRateCalc::Draw()
    364364{
     365    /*
     366     Commented out, because this is creating a memory leak!
     367     The histograms are neither deleted anywhere, nor it is made
     368     sure, that the histograms are not overwritten.
     369     Also the comment for the function doesn't match the rules.
     370
    365371  TCanvas *c = MH::MakeDefCanvas("Rate");
    366372
    367373  Float_t xmin = GetRate(0)->GetMeanThreshold()-0.55;
    368374  Float_t xmax = GetRate(fNum-1)->GetMeanThreshold()+0.55;
    369   Int_t  nbins = 10*(xmax-xmin);
     375  Int_t  nbins = (Int_t)((xmax-xmin)*10);
    370376
    371377  fHist[1] = new TH1F("Rate2","Trigger rate, mult. 2", nbins, xmin, xmax);
     
    412418  fHist[4]->Draw("same");
    413419  fHist[4]->SetMarkerColor(4);
    414 
    415   return;
    416 }
    417 
     420     */
     421}
     422
  • trunk/MagicSoft/Mars/mtools/Makefile

    r1845 r1880  
    2929
    3030SRCFILES = MChisqEval.cc \
     31           MagicReversi.cc \
    3132           MagicSnake.cc \
    3233           MagicShow.cc \
  • trunk/MagicSoft/Mars/mtools/ToolsLinkDef.h

    r1845 r1880  
    77#pragma link C++ class MChisqEval+;
    88#pragma link C++ class MineSweeper+;
    9 // #pragma link C++ class MagicReversi+;
     9#pragma link C++ class MagicReversi+;
    1010#pragma link C++ class MagicSnake+;
    1111#pragma link C++ class MagicShow+;
Note: See TracChangeset for help on using the changeset viewer.