Changeset 5956


Ignore:
Timestamp:
01/24/05 11:07:29 (20 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r5952 r5956  
    2121                                                 -*-*- END OF LINE -*-*-
    2222
     23 2005/01/24 Thomas Bretz
     24
     25   * callisto.cc:
     26     - removed non-existing option from output
     27
     28   * manalysis/MEnergyEstimate.[h,cc]:
     29     - added ReadEnv member function
     30
     31   * mbase/MContinue.[h,cc]:
     32     - implementes AllowEmpty option to support doing nothing
     33       defined in resource file
     34     - added a first draft to allow usage of class-filters instead of
     35       rules
     36
     37   * mbase/MMath.[h,cc]:
     38     - implemented a function suggested by Florian Goebel which reduces
     39       the precision of a float to ~0.5% which is usefull for data
     40       compression by gzip
     41
     42   * mdata/MDataChain.[h,cc]:
     43     - implemented ReadEnv member function
     44
     45   * mfbase/MF.cc:
     46     - a small enhancement to the output in ReadEnv
     47
     48   * mhbase/MH3.cc:
     49     - fixed call to FindObject in Paint which caused a profile to be
     50       displayed incorrectly in case it was read from a file
     51
     52   * mhflux/MHFalseSource.[h,cc]:
     53     - removed old obsolete unsused Significance functions
     54     - implemented ReadEnv member function
     55
     56   * mjobs/MJCalibrateSignal.cc, mjobs/MJCalibration.cc,
     57     mjobs/MJPedestal.cc:
     58     - added an additional check and output if output-file could
     59       not be opened
     60
     61   * mjobs/MJob.h:
     62     - added some Getter
     63
     64
     65
    2366 2005/01/24 Markus Gaug
    2467
     
    2871  * msignal/MExtractedSignalPix.cc
    2972    - change sign of default initializer to negative.
     73
     74
    3075
    3176 2005/01/23 Markus Gaug
     
    4691  * mbadpixels/MBadPixelsCam.cc
    4792    - removed some bugs in the Print() function
     93
     94
    4895
    4996 2005/01/22 Markus Gaug
     
    67114   * macros/calibration.C
    68115     - update to changes in MJExtractCalibTest
     116
     117
    69118
    70119 2005/01/21 Markus Gaug
  • trunk/MagicSoft/Mars/callisto.cc

    r5832 r5956  
    5858    gLog << "   -q                        Quit when job is finished" << endl;
    5959    gLog << "   -f                        Force overwrite of existing files" << endl;
    60     gLog << "   -ff                       Force execution if not all files found" << endl;
     60    //gLog << "   -ff                       Force execution if not all files found" << endl;
    6161    gLog << "   --ind=path                Path where to search for the data files" << endl;
    6262    gLog << "                             [default=standard path in datacenter]" << endl;
  • trunk/MagicSoft/Mars/manalysis/MEnergyEstimate.cc

    r5869 r5956  
    134134    return kTRUE;
    135135}
     136
     137// --------------------------------------------------------------------------
     138//
     139// Check for corresponding entries in resource file and setup filters.
     140// Avoid trailing 0's!
     141//
     142// Example:
     143//   test.C:
     144//     MEnergyEstimate est("MyEstimator");
     145//
     146//   test.rc:
     147//     MyEstimator.Rule: {0} + {1}
     148//     MyEstimator.0: log10(MHillas.fSize)
     149//     MyEstimator.1: 5.5
     150//
     151// For more details see MDataChain::ReadEnv
     152//
     153Int_t MEnergyEstimate::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     154{
     155    MDataChain *f = new MDataChain;
     156    f->SetName(fName);
     157
     158    const Bool_t rc = f->ReadEnv(env, prefix, print);
     159    if (rc!=kTRUE)
     160    {
     161        delete f;
     162        return rc;
     163    }
     164
     165    delete fData;
     166    fData = f;
     167
     168    if (!fData->IsValid())
     169    {
     170        *fLog << err << "MEnergyEst::ReadEnv - ERROR: Inavlid rule from resource file." << endl;
     171        return kERROR;
     172    }
     173
     174    return kTRUE;
     175}
  • trunk/MagicSoft/Mars/manalysis/MEnergyEstimate.h

    r5869 r5956  
    1414    MData      *fData;    //->
    1515    MEnergyEst *fEnergy;
     16
     17    Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
    1618
    1719public:
  • trunk/MagicSoft/Mars/mbase/MContinue.cc

    r5910 r5956  
    7373//
    7474MContinue::MContinue(const TString rule, const char *name, const char *title)
     75    : fTaskList(0)
    7576{
    7677    fName  = name  ? name  : "MContinue";
     
    9596//
    9697MContinue::MContinue(MFilter *f, const char *name, const char *title)
     98    : fTaskList(0)
    9799{
    98100    fName  = name  ? name  : "MContinue";
     
    119121Int_t MContinue::PreProcess(MParList *list)
    120122{
     123    ResetBit(kFilterIsPrivate);
     124
    121125    if (!GetFilter())
    122126    {
     127        if (IsAllowEmpty())
     128        {
     129            *fLog << warn << GetDescriptor() << " - WARNING: Empty filter found... task removed." << endl;
     130            return kSKIP;
     131        }
     132
    123133        *fLog << err << dbginf << "Unknown fatal Error! (fFilter=NULL?!?)" << endl;
    124134        return kFALSE;
     
    144154    }
    145155
     156    // Make sure, that everything is correctly propageted to the childs
    146157    GetFilter()->SetDisplay(fDisplay);
    147158    GetFilter()->SetLogStream(fLog);
    148159
     160    // Remeber that the filter is not already in tasklist
    149161    SetBit(kFilterIsPrivate);
    150162
     
    229241//     MyContinue.0: MHillas.fSize>1000
    230242//     MyContinue.1: MHillas.fSize<10000
     243//   or
     244//     MyContinue.Condition: <MMyClass>
     245//     MMyClass.Variable1: ...
     246//     MMyClass.Variable2: ...
    231247//
    232248// For more details see MF::ReadEnv
     
    234250Int_t MContinue::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
    235251{
     252    if (IsEnvDefined(env, prefix, "Condition", print))
     253    {
     254        TString txt = GetEnvValue(env, prefix, "Condition", "");
     255        txt = txt.Strip(TString::kBoth);
     256        if (txt.BeginsWith("<") && txt.EndsWith(">"))
     257        {
     258            *fLog << err << "NOT YET IMPLEMENTED..." << endl;
     259            return kERROR;
     260        }
     261    }
     262
    236263    MF *f = new MF;
    237264    f->SetName(fName);
  • trunk/MagicSoft/Mars/mbase/MContinue.h

    r5910 r5956  
    3030    Int_t PostProcess();
    3131
    32     enum { kIsOwner = BIT(14), kFilterIsPrivate = BIT(15) };
     32    enum { kIsOwner = BIT(14), kFilterIsPrivate = BIT(15), kAllowEmpty = BIT(16) };
    3333
    3434public:
     
    3636    MContinue(MFilter *f, const char *name=NULL, const char *title=NULL);
    3737    ~MContinue();
     38
     39    // MContinue
     40    void SetAllowEmpty(Bool_t b=kTRUE) { b ? SetBit(kAllowEmpty) : ResetBit(kAllowEmpty); }
     41    Bool_t IsAllowEmpty() const { return TestBit(kAllowEmpty); }
     42
    3843
    3944    void SetInverted(Bool_t i=kTRUE);
  • trunk/MagicSoft/Mars/mbase/MMath.cc

    r5901 r5956  
    135135}
    136136
     137// --------------------------------------------------------------------------
     138//
     139// This function truncates the precision to roughly 0.5% of a Float_t by
     140// changing its bit-pattern (Be carefull, in rare cases this function must
     141// be adapted to different machines!). This is usefull to enforce better
     142// compression by eg. gzip.
     143//
     144void MMath::TruncatePrecision(Float_t &val)
     145{
     146    UInt_t &f = (UInt_t&)val;
     147
     148    f += 0x00004000;
     149    f &= 0xffff8000;
     150}
     151
    137152// -------------------------------------------------------------------------
    138153//
  • trunk/MagicSoft/Mars/mbase/MMath.h

    r5832 r5956  
    1818    Double_t SignificanceLiMaSigned(Double_t s, Double_t b, Double_t alpha=1);
    1919
     20    void TruncatePrecision(Float_t &val);
     21
    2022    TVector3 GetParab(const TVector3 &x, const TVector3 &y);
    2123    Double_t InterpolParabLin(const TVector3 &vx, const TVector3 &vy, Double_t x);
  • trunk/MagicSoft/Mars/mdata/MDataChain.cc

    r5832 r5956  
    749749    return fMember->SetVariables(arr);
    750750}
     751
     752// --------------------------------------------------------------------------
     753//
     754// Check for corresponding entries in resource file and setup data chain.
     755//
     756// Assuming your MDataChain is called (Set/GetName): MyData
     757//
     758// Now setup the condition, eg:
     759//     MyData.Rule: log10(MHillas.fSize)
     760// or
     761//     MyData.Rule: log10(MHillas.fSize) - 4.1
     762//
     763// If you want to use more difficult rules you can split the
     764// condition into subrules. Subrules are identified
     765// by {}-brackets. Avoid trailing 0's! For example:
     766//
     767//     MyData.Rule: log10(MHillas.fSize) + {0} - {1}
     768//     MyData.0: 5.5*MHillas.fSize
     769//     MyData.1: 2.3*log10(MHillas.fSize)
     770//
     771// The numbering must be continous and start with 0. You can use
     772// a subrules more than once. All {}-brackets are simply replaced
     773// by the corresponding conditions. The rules how conditions can
     774// be written can be found in the class description of MDataChain.
     775//
     776Int_t MDataChain::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
     777{
     778    Bool_t rc = kFALSE;
     779    if (!IsEnvDefined(env, prefix, "Rule", print))
     780        return rc;
     781
     782    TString rule = GetEnvValue(env, prefix, "Rule", "");
     783    rule.ReplaceAll(" ", "");
     784
     785    Int_t idx=0;
     786    while (1)
     787    {
     788        TString cond;
     789        if (IsEnvDefined(env, prefix, Form("%d", idx), print))
     790        {
     791            cond += "(";
     792            cond += GetEnvValue(env, prefix, Form("%d", idx), "");
     793            cond += ")";
     794        }
     795
     796        if (cond.IsNull())
     797            break;
     798
     799        rule.ReplaceAll(Form("{%d}", idx), cond);
     800        idx++;
     801    }
     802
     803    if (fMember)
     804    {
     805        delete fMember;
     806        fMember = 0;
     807    }
     808
     809    if (rule.IsNull())
     810    {
     811        *fLog << warn << "MDataChain::ReadEnv - ERROR: Empty rule found." << endl;
     812        return kERROR;
     813    }
     814
     815    if (!(fMember=ParseString(rule, 1)))
     816    {
     817        *fLog << err << "MDataChain::ReadEnv - ERROR: Parsing '" << rule << "' failed." << endl;
     818        return kERROR;
     819    }
     820
     821    if (print)
     822    {
     823        *fLog << inf << "found: ";
     824        fMember->Print();
     825        *fLog << endl;
     826    }
     827
     828    return kTRUE;
     829}
  • trunk/MagicSoft/Mars/mdata/MDataChain.h

    r3788 r5956  
    1717{
    1818private:
    19     MData    *fMember; // Filter
     19    MData *fMember; // Filter
    2020
    2121    // PLEASE, always add new enums to the end of the enumeration,
     
    5454    ~MDataChain();
    5555
     56    // MData
    5657    Double_t GetValue() const;
    57     Bool_t PreProcess(const MParList *plist);
    5858
    5959    Bool_t IsValid() const { return fMember ? kTRUE : kFALSE; }
    60     Bool_t IsReadyToSave() const;
    61 
    62 //    void Print(Option_t *opt = "") const;
     60    Bool_t PreProcess(const MParList *plist);
    6361
    6462    TString GetRule() const;
    6563    TString GetDataMember() const;
    6664
     65    // MParContainer
     66    Bool_t IsReadyToSave() const;
    6767    void SetVariables(const TArrayD &arr);
     68    Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
    6869
    6970    ClassDef(MDataChain, 1) // A chain/concatenation of MData objects
  • trunk/MagicSoft/Mars/mfbase/MF.cc

    r5924 r5956  
    478478
    479479    if (!IsEnvDefined(env, prefix, "Condition", print))
     480    {
     481        if (rc)
     482        {
     483            *fLog << warn << GetDescriptor() << " ::ReadEnv - WARNING: No condition found." << endl;
     484            SetAllowEmpty();
     485        }
    480486        return rc;
     487    }
    481488
    482489    TString rule = GetEnvValue(env, prefix, "Condition", "");
     
    509516    if (rule.IsNull())
    510517    {
    511         *fLog << warn << "MF::ReadEnv - WARNING: Empty condition found." << endl;
     518        *fLog << warn << GetDescriptor() << " ::ReadEnv - WARNING: Empty condition found." << endl;
    512519        SetAllowEmpty();
    513520        return kTRUE;
  • trunk/MagicSoft/Mars/mhbase/MH3.cc

    r5620 r5956  
    546546
    547547    // FIXME: We may have to remove all our own options from str!
    548     if (!only && !gPad->GetListOfPrimitives()->FindObject(fHist))
     548    if (!only && !gPad->FindObject(fHist))
    549549        fHist->Draw(str);
    550550
     
    552552    {
    553553        TProfile *p = ((TH2*)fHist)->ProfileX("ProfX", -1, 9999, "s");
    554         if (!gPad->GetListOfPrimitives()->FindObject(p))
     554        if (!gPad->FindObject(p))
    555555        {
    556556            p->UseCurrentStyle();
     
    566566    {
    567567        TProfile *p = ((TH2*)fHist)->ProfileY("ProfY", -1, 9999, "s");
    568         if (!gPad->GetListOfPrimitives()->FindObject(p))
     568        if (!gPad->FindObject(p))
    569569        {
    570570            p->UseCurrentStyle();
Note: See TracChangeset for help on using the changeset viewer.