Changeset 7442 for trunk/MagicSoft


Ignore:
Timestamp:
12/05/05 16:36:41 (19 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r7440 r7442  
    1818
    1919                                                 -*-*- END OF LINE -*-*-
     20 2005/12/06 Thomas Bretz
     21
     22   * mbase/MEnv.[h,cc]:
     23     - added new function to get fillstyle by name
     24     - added new function to get attributes of a TPave
     25
     26   * mbase/MTime.cc:
     27     - fixed layout of a comment
     28
     29   * mhflux/MAlphaFitter.[h,cc]:
     30     - added a function to calc upper limits
     31     - exchaged some GetListOfFunctions()-Remove() with SetName
     32
     33
     34
    2035 2005/12/01 Thomas Bretz
    2136
     
    110125   * mjobs/MJCut.cc:
    111126     - output is called "Hadronness" not "MHadronness"
     127
     128   * mjtrain/MJTrainDisp.cc, mjtrain/MJTrainEnergy.cc:
     129     - fixed bug which caused the traincuts to be ignored
    112130
    113131
  • trunk/MagicSoft/Mars/mbase/MEnv.cc

    r7432 r7442  
    3737#include <TObjString.h>
    3838
     39#include <TPave.h>
    3940#include <TAttText.h>
    40 #include <TAttFill.h>
    41 #include <TAttLine.h>
     41//#include <TAttFill.h>
     42//#include <TAttLine.h>
    4243#include <TAttMarker.h>
    4344
     
    6869        fChecked.Add(new TObjString(name));
    6970    return TEnv::GetValue(name, dflt);
     71}
     72
     73Int_t MEnv::GetFillStyle(const char *name, Int_t dftl)
     74{
     75    TString str = GetValue(name, "");
     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)-1920099718/*2374867578*/: return 0;// hollow
     85    case 764279305:  return 1001;// solid
     86    case 1854683492: return 2001; // hatch
     87    }
     88
     89    return str.EndsWith("%") ? 4000+str.Atoi() : str.Atoi();
    7090}
    7191
     
    106126TString MEnv::Compile(TString str, const char *post) const
    107127{
    108     if (!str.IsNull() && str[str.Length()-1]!='.')
     128    if (!str.IsNull() && !str.EndsWith("."))
    109129        str += ".";
    110130
     
    165185
    166186    const Color_t col = GetColor(color, dftl->GetFillColor());
    167     const Style_t sty = GetValue(style, dftl->GetFillStyle());
    168 
     187    const Style_t sty = GetFillStyle(style, dftl->GetFillStyle());
     188 
    169189    fill.SetFillColor(col);
    170190    fill.SetFillStyle(sty);
     
    187207    marker.SetMarkerStyle(sty);
    188208    marker.SetMarkerSize(siz);
     209}
     210
     211void MEnv::GetAttPave(const char *str, TPave &pave, TPave *dftl)
     212{
     213    const TString post(str);
     214
     215    TString name(pave.GetName());
     216    if (!name.IsNull() && name!=pave.ClassName())
     217        name = Compile(name, post);
     218
     219    GetAttLine(name, pave, dftl);
     220    GetAttFill(name, pave, dftl);
     221
     222    const TString corner = Compile(name, "CornerRadius");
     223    const TString border = Compile(name, "BorderSize");
     224    const TString option = Compile(name, "Option");
     225
     226    if (!dftl)
     227        dftl = &pave;
     228
     229    const Double_t cor = GetValue(corner, dftl->GetCornerRadius());
     230    const Int_t    bor = GetValue(border, dftl->GetBorderSize());
     231
     232    pave.SetCornerRadius(cor);
     233    pave.SetBorderSize(bor);
     234
     235    TString  opt = GetValue(option, dftl->GetOption());
     236    opt.ToLower();
     237
     238    const Bool_t has = pave.GetCornerRadius()>0;
     239
     240    if (has && !opt.Contains("arc"))
     241        opt += "arc";
     242
     243    if (!has && opt.Contains("arc"))
     244        opt.ReplaceAll("arc", "");
     245
     246    pave.SetOption(opt);
     247
    189248}
    190249
     
    204263    //TAttTextEditor   *line = dynamic_cast<TAttTextEditor*>(obj);
    205264
     265    TPave      *pave = dynamic_cast<TPave*>(/*(TAttLine*)*/obj);
    206266    TAttLine   *line = dynamic_cast<TAttLine*>(/*(TAttLine*)*/obj);
    207267    TAttText   *text = dynamic_cast<TAttText*>(/*(TAttText*)*/obj);
     
    210270
    211271    cout << line << " " << text << " " << fill << " " << mark << endl;
     272
     273    if (pave)
     274    {
     275        GetAttPave(name, *pave, dynamic_cast<TPave*>(dftl));
     276        return;
     277    }
    212278
    213279    if (line)
     
    228294    TIter Next(GetTable());
    229295    TObject *o=0;
     296
    230297    while ((o=Next()))
    231298        if (!fChecked.FindObject(o->GetName()))
  • trunk/MagicSoft/Mars/mbase/MEnv.h

    r7432 r7442  
    1414class TAttText;
    1515class TAttFill;
     16class TPave;
    1617
    1718class MEnv : public TEnv
     
    3031
    3132    Int_t       GetColor(const char *name, Int_t dftl);
     33    Int_t       GetFillStyle(const char *name, Int_t dftl);
    3234
    3335    void        GetAttributes(const char *name, TObject *obj, TObject *dftl=0);
     
    3638    void        GetAttFill(const char *name, TAttFill &fill, TAttFill *dftl=0);
    3739    void        GetAttMarker(const char *name, TAttMarker &marker, TAttMarker *dftl=0);
     40    void        GetAttPave(const char *name, TPave &pave, TPave *dftl=0);
    3841
    3942    void PrintUntouched() const;
  • trunk/MagicSoft/Mars/mbase/MTime.cc

    r7432 r7442  
    532532// The maximum size of the return string is 128 (incl. NULL)
    533533//
    534 // For dates before 1.1.1902  a null string is returned
     534// For dates before 1. 1.1902  a null string is returned
    535535// For dates after 31.12.2037 a null string is returned
    536536//
  • trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc

    r7392 r7442  
    4747
    4848#include <TRandom.h>
     49#include <TFeldmanCousins.h>
    4950
    5051#include <TLine.h>
     
    256257
    257258    return kTRUE;
     259}
     260
     261// --------------------------------------------------------------------------
     262//
     263// Calculate the upper limit for fEventsSignal number of observed events
     264// and fEventsBackground number of background events.
     265//
     266// Therefor TFeldmanCousin is used.
     267//
     268// The Feldman-Cousins method as described in PRD V57 #7, p3873-3889
     269//
     270Double_t MAlphaFitter::CalcUpperLimit() const
     271{
     272    // get a FeldmanCousins calculation object with the default limits
     273    // of calculating a 90% CL with the minimum signal value scanned
     274    // = 0.0 and the maximum signal value scanned of 50.0
     275    TFeldmanCousins f;
     276    f.SetMuStep(0.05);
     277    f.SetMuMax(100);
     278    return f.CalculateUpperLimit(fEventsSignal, fEventsBackground);
    258279}
    259280
     
    315336    TF1 *fcn = f.fFunc;
    316337    f.fFunc = new TF1(*fFunc);
     338    f.fFunc->SetName("Dummy");
    317339    gROOT->GetListOfFunctions()->Remove(f.fFunc);
    318     f.fFunc->SetName("Dummy");
    319340    delete fcn;
    320341}
  • trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h

    r7392 r7442  
    5353    SignalFunc_t fSignalFunc;   // Type of signal function
    5454    // Result
    55     Double_t fSignificance;     // significance of signal
    56     Double_t fSignificanceExc;  // significance of excess
     55    Double_t fSignificance;     // significance of an unknown signal (Li/Ma 17)
     56    Double_t fSignificanceExc;  // significance of a known excess    (Li/Ma 5)
    5757    Double_t fEventsExcess;     // calculated number of excess events (signal-bg)
    5858    Double_t fEventsSignal;     // calculated number of signal events
     
    8888        fTitle = title ? title : "Fit alpha";
    8989
     90        fFunc->SetName("Dummy");
    9091        gROOT->GetListOfFunctions()->Remove(fFunc);
    91         fFunc->SetName("Dummy");
    9292
    9393        Clear();
     
    147147        }
    148148        fSignalFunc=func;
     149        fFunc->SetName("Dummy");
    149150        gROOT->GetListOfFunctions()->Remove(fFunc);
    150         fFunc->SetName("Dummy");
    151151        fCoefficients.Set(3+fPolynomOrder+1);
    152152        fCoefficients.Reset();
     
    175175    Double_t Eval(Double_t d) const { return fFunc ? fFunc->Eval(d) : 0; }
    176176
     177    Double_t CalcUpperLimit() const;
     178
    177179    // Interface to fit
    178180    Bool_t Fit(TH1D &h, Bool_t paint=kFALSE);
Note: See TracChangeset for help on using the changeset viewer.