Changeset 9302 for trunk/MagicSoft


Ignore:
Timestamp:
02/07/09 20:40:28 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mastro/MAstroCamera.cc

    r8106 r9302  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MAstroCamera.cc,v 1.30 2006-10-17 17:15:58 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MAstroCamera.cc,v 1.31 2009-02-07 20:39:55 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    8888#include "MGeomMirror.h"
    8989
     90#include "MString.h"
     91
    9092#include "MTime.h"
    9193#include "MAstroSky2Local.h"
     
    411413        // transform meters into millimeters (camera display works with mm)
    412414        mean *= 1./num;
    413         DrawStar(mean(0), mean(1), *radec, hasmean?kBlack:-1, Form("x=%.1fmm y=%.1fmm", mean(0), mean(1)), resize);
     415        DrawStar(mean(0), mean(1), *radec, hasmean?kBlack:-1, MString::Format("x=%.1fmm y=%.1fmm", mean(0), mean(1)), resize);
    414416        if (hasnull)
    415417        {
     
    417419            vstar *= rot;
    418420            const TVector3 spot = fMirror0->GetReflection(vstar, fGeom->GetCameraDist())*1000;
    419             DrawStar(spot(0), spot(1), *radec, hasmean?kBlack:-1, Form("x=%.1fmm y=%.1fmm", mean(0), mean(1)), resize);
     421            DrawStar(spot(0), spot(1), *radec, hasmean?kBlack:-1, MString::Format("x=%.1fmm y=%.1fmm", mean(0), mean(1)), resize);
    420422            // This can be used to get the abberation...
    421423            //cout << TMath::Hypot(spot(0), spot(1)) << " " << TMath::Hypot(mean(0)-spot(0), mean(1)-spot(1)) << endl;
  • trunk/MagicSoft/Mars/mastro/MAstroCatalog.cc

    r9292 r9302  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MAstroCatalog.cc,v 1.32 2009-02-03 13:27:58 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MAstroCatalog.cc,v 1.33 2009-02-07 20:40:01 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    11981198
    11991199    TString txt;
    1200     txt += Form("\\alpha=%.2fh ",      fmod(ra/15+48, 24));
    1201     txt += Form("\\delta=%.1f\\circ ", fmod(dec+270,180)-90);
    1202     txt += Form("/ FOV=%.1f\\circ",    fRadiusFOV);
     1200    txt += MString::Format("\\alpha=%.2fh ",      fmod(ra/15+48, 24));
     1201    txt += MString::Format("\\delta=%.1f\\circ ", fmod(dec+270,180)-90);
     1202    txt += MString::Format("/ FOV=%.1f\\circ",    fRadiusFOV);
    12031203
    12041204    if (!fTime || !fObservatory)
     
    12141214
    12151215    txt.Prepend("#splitline{");
    1216     txt += Form("  \\theta=%.1f\\circ ", fmod(zd+270,180)-90);
    1217     txt += Form("\\phi=%.1f\\circ ",     fmod(az+720, 360));
    1218     txt += Form(" / \\rho=%.1f\\circ",   rho*TMath::RadToDeg());
     1216    txt += MString::Format("  \\theta=%.1f\\circ ", fmod(zd+270,180)-90);
     1217    txt += MString::Format("\\phi=%.1f\\circ ",     fmod(az+720, 360));
     1218    txt += MString::Format(" / \\rho=%.1f\\circ",   rho*TMath::RadToDeg());
    12191219    txt += "}{<";
    12201220    txt += fTime->GetSqlDateTime();
  • trunk/MagicSoft/Mars/mbase/MContinue.cc

    r9178 r9302  
    5252
    5353#include "MF.h"
     54#include "MString.h"
    5455#include "MParList.h"
    5556#include "MTaskList.h"
     
    105106{
    106107    fName  = name  ? name  : "MContinue";
    107     fTitle = title ? title : "Task returning kCONTINUE";
     108    fTitle = title ? title : "Task returning kCONTINUE (or any other return code)";
    108109
    109110    SetFilter(f);
     
    155156
    156157    if ((TString)GetFilter()->GetName()==fName)
    157         GetFilter()->SetName(Form("MF:%s", fName.Data()));
     158        GetFilter()->SetName(MString::Format("MF:%s", fName.Data()));
    158159
    159160    if (!fTaskList->AddToListBefore(GetFilter(), this))
  • trunk/MagicSoft/Mars/mbase/MFilter.cc

    r8907 r9302  
    7777#include "MLogManip.h"
    7878
     79#include "MString.h"
     80
    7981ClassImp(MFilter);
    8082
     
    9799TString MFilter::GetRule() const
    98100{
    99     return Form("(%s)", ClassName()); //"<GetRule n/a for " + fName + ">";
     101    return MString::Format("(%s)", ClassName()); //"<GetRule n/a for " + fName + ">";
    100102}
    101103
  • trunk/MagicSoft/Mars/mbase/MLog.cc

    r8965 r9302  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MLog.cc,v 1.61 2008-06-16 14:58:27 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MLog.cc,v 1.62 2009-02-07 20:40:07 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    114114#include "MArgs.h"
    115115#include "MTime.h"
     116#include "MString.h"
    116117#include "MParContainer.h"
    117118
     
    572573    TString f1 = arg.GetStringAndRemove("--log=", "");
    573574    if (f1.IsNull() && arg.HasOnlyAndRemove("--log"))
    574         f1 = Form("%s.log", arg.GetName());
     575        f1 = MString::Format("%s.log", arg.GetName());
    575576    if (!f1.IsNull())
    576577    {
     
    581582    TString f2 = arg.GetStringAndRemove("--html=", "");
    582583    if (f2.IsNull() && arg.HasOnlyAndRemove("--html"))
    583         f2 = Form("%s.html", arg.GetName());
     584        f2 = MString::Format("%s.html", arg.GetName());
    584585    if (!f2.IsNull())
    585586    {
  • trunk/MagicSoft/Mars/mbase/MMath.cc

    r9253 r9302  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.46 2009-01-24 10:57:46 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.47 2009-02-07 20:33:22 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    876876    }
    877877
    878     const char *fmt = MString::Format("%%.%de", i);
    879 
    880     v = MString::Format(fmt, v).Atof();
     878    const TString fmt = MString::Format("%%.%de", i);
     879
     880    v = MString::Format(fmt.Data(), v).Atof();
    881881    e = error.Atof();
    882882}
  • trunk/MagicSoft/Mars/mbase/MParContainer.cc

    r9268 r9302  
    11031103    for (int i=1; i<9; i++)
    11041104    {
    1105         const TString form = Form(id.Data(), i);
    1106         const TString res  = Form(form.Data(), num);
     1105        const TString form = MString::Format(id.Data(), i);
     1106        const TString res  = MString::Format(form.Data(), num);
    11071107
    11081108        const TString str  = GetEnvValue2(env, prefix, res, "");
  • trunk/MagicSoft/Mars/mbase/MParEmulated.cc

    r9079 r9302  
    5050#include "MLogManip.h"
    5151
     52#include "MString.h"
     53
    5254ClassImp(MParEmulated);
    5355
     
    158160    name.Prepend("Get");
    159161
    160     TMethodCall *call = new TMethodCall(MParEmulated::Class(), name, proxy?Form("%p,%d", proxy, offset):Form("%d", offset));
     162    TMethodCall *call = new TMethodCall(MParEmulated::Class(), name, proxy?MString::Format("%p,%d", proxy, offset):MString::Format("%d", offset));
    161163    fgListMethodCall.Add(call);
    162164    return call;
  • trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc

    r9292 r9302  
    485485
    486486    // Add copyright notice
    487     l = new TGLabel(f, Form("(c) MARS Software Development, 2000-%d", TDatime().GetYear()));
     487    l = new TGLabel(f, MString::Format("(c) MARS Software Development, 2000-%d", TDatime().GetYear()));
    488488    fList->Add(l);
    489489    f->AddFrame(l, layb);
     
    25802580Int_t MStatusDisplay::InitWriteDisplay(Int_t num, TString &name, const TString &ext)
    25812581{
    2582     SetStatusLine1(Form("Writing %s file...",ext.Data()));
     2582    SetStatusLine1(MString::Format("Writing %s file...",ext.Data()));
    25832583    SetStatusLine2("Please be patient!");
    25842584
  • trunk/MagicSoft/Mars/mbase/MTime.cc

    r9210 r9302  
    8484
    8585#include "MAstro.h"
     86#include "MString.h"
    8687
    8788ClassImp(MTime);
     
    708709    GetTime(h, m, s, ms);
    709710
    710     return TString(Form("%02d.%02d.%04d %02d:%02d:%02d.%03d", d, mon, y, h, m, s, ms));
     711    return MString::Format("%02d.%02d.%04d %02d:%02d:%02d.%03d", d, mon, y, h, m, s, ms);
    711712}
    712713
     
    883884
    884885    *fLog << all << GetDescriptor() << ": ";
    885     *fLog << GetString() << Form(" (+%dns)", fNanoSec) << endl;
     886    *fLog << GetString() << MString::Format(" (+%dns)", fNanoSec) << endl;
    886887}
    887888
  • trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc

    r9292 r9302  
    102102
    103103    gROOT->GetListOfCleanups()->Add(this); // To remove fOut if deleted
     104    SetBit(kMustCleanup);
    104105}
    105106
  • trunk/MagicSoft/Mars/mhbase/MFillH.cc

    r9153 r9302  
    9393#include "MLogManip.h"
    9494
     95#include "MString.h"
     96
    9597#include "MH.h"
    9698#include "MHArray.h"
     
    599601    if (fDisplay && fDisplay->HasCanvas(fCanvas))
    600602    {
    601         const TString opt(Form("nonew %s", fDrawOption.Data()));
     603        const TString opt(MString::Format("nonew %s", fDrawOption.Data()));
    602604        fCanvas->cd();
    603605        // Remove the old class to prevent clashes calling
  • trunk/MagicSoft/Mars/mhbase/MH.cc

    r9195 r9302  
    11/* ======================================================================== *\
    2 ! $Name: not supported by cvs2svn $:$Id: MH.cc,v 1.42 2008-12-21 18:09:49 tbretz Exp $
     2! $Name: not supported by cvs2svn $:$Id: MH.cc,v 1.43 2009-02-07 20:40:12 tbretz Exp $
    33! --------------------------------------------------------------------------
    44!
     
    7474#include "MLogManip.h"
    7575
     76#include "MString.h"
     77
    7678#include "MParList.h"
    7779#include "MParContainer.h"
     
    156158
    157159    if (list->FindObject(name))
    158         name += Form(" <%d>", list->GetSize()+1);
     160        name += MString::Format(" <%d>", list->GetSize()+1);
    159161
    160162    if (!usescreenfactor)
     
    15071509{
    15081510    *fLog << " " << setw(7) << n << " (";
    1509     *fLog << Form("%5.1f", 100.*n/GetNumExecutions());
     1511    *fLog << MString::Format("%5.1f", 100.*n/GetNumExecutions());
    15101512    *fLog << "%) Evts skipped: " << str << endl;
    15111513}
  • trunk/MagicSoft/Mars/mhbase/MH3.cc

    r9195 r9302  
    166166#include "MLog.h"
    167167#include "MLogManip.h"
     168
     169#include "MString.h"
    168170
    169171#include "MParList.h"
     
    643645        if (gPad)
    644646        {
    645             const TString pfx(Form("%sProfX", fHist->GetName()));
    646             const TString pfy(Form("%sProfY", fHist->GetName()));
     647            const TString pfx(MString::Format("%sProfX", fHist->GetName()));
     648            const TString pfy(MString::Format("%sProfY", fHist->GetName()));
    647649
    648650            TProfile *p = 0;
    649651            if ((p=dynamic_cast<TProfile*>(gPad->FindObject(pfx))))
    650                 p->SetName(Form("%sProfX", name));
     652                p->SetName(MString::Format("%sProfX", name));
    651653            if ((p=dynamic_cast<TProfile*>(gPad->FindObject(pfy))))
    652                 p->SetName(Form("%sProfY", name));
     654                p->SetName(MString::Format("%sProfY", name));
    653655        }
    654656
     
    851853        MH::SetPalette("pretty");
    852854
    853     const TString pfx(Form("%sProfX", fHist->GetName()));
     855    const TString pfx(MString::Format("%sProfX", fHist->GetName()));
    854856    if ((p=dynamic_cast<TProfile*>(gPad->FindObject(pfx))))
    855857    {
     
    859861    }
    860862
    861     const TString pfy(Form("%sProfY", fHist->GetName()));
     863    const TString pfy(MString::Format("%sProfY", fHist->GetName()));
    862864    if ((p=dynamic_cast<TProfile*>(gPad->FindObject(pfy))))
    863865    {
     
    969971    if (profx)
    970972    {
    971         const TString pfx(Form("%sProfX", fHist->GetName()));
     973        const TString pfx(MString::Format("%sProfX", fHist->GetName()));
    972974
    973975        if (same && (p=dynamic_cast<TProfile*>(gPad->FindObject(pfx))))
     
    985987    if (profy)
    986988    {
    987         const TString pfy(Form("%sProfY", fHist->GetName()));
     989        const TString pfy(MString::Format("%sProfY", fHist->GetName()));
    988990
    989991        if (same && (p=dynamic_cast<TProfile*>(gPad->FindObject(pfy))))
     
    12981300    delete arr;
    12991301}
     1302
     1303void MH3::RecursiveRemove(TObject *obj)
     1304{
     1305    if (obj==fHist)
     1306        fHist = 0;
     1307}
  • trunk/MagicSoft/Mars/mhbase/MH3.h

    r9153 r9302  
    158158    void Paint(Option_t *opt="");
    159159
     160    void RecursiveRemove(TObject *obj);
     161
    160162    ClassDef(MH3, 4) // Generalized 1/2/3D-histogram for Mars variables
    161163};
  • trunk/MagicSoft/Mars/mhbase/MHn.cc

    r9153 r9302  
    136136
    137137#include "MH3.h"
     138#include "MString.h"
    138139
    139140ClassImp(MHn);
     
    170171        if (name==fHist[i]->GetName())
    171172        {
    172             name += Form("_%d", fNum);
     173            name += MString::Format("_%d", fNum);
    173174            break;
    174175        }
  • trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc

    r9281 r9302  
    7171using namespace std;
    7272
     73// --------------------------------------------------------------------------
     74//
     75// Default constructor.
     76//
     77MAlphaFitter::MAlphaFitter(const char *name, const char *title) : fSigInt(15),
     78    fSigMax(75), fBgMin(45), fBgMax(85), fScaleMin(40), fScaleMax(80),
     79    fPolynomOrder(2), fFitBackground(kTRUE), fFunc(0),
     80    fScaleMode(kOffRegion), fScaleUser(1), fStrategy(kSignificance)
     81{
     82    fName  = name  ? name  : "MAlphaFitter";
     83    fTitle = title ? title : "Fit alpha";
     84
     85    SetSignalFunction(kGauss);
     86
     87    Clear();
     88}
     89
     90// --------------------------------------------------------------------------
     91//
     92// Destructor
     93//
     94MAlphaFitter::~MAlphaFitter()
     95{
     96    delete fFunc;
     97}
     98
     99// --------------------------------------------------------------------------
     100//
     101// Re-initializes fFunc either according to SignalFunc_t
     102//
     103void MAlphaFitter::SetSignalFunction(SignalFunc_t func)
     104{
     105    if (gROOT->GetListOfFunctions()->FindObject(""))
     106    {
     107        gLog << err << "MAlphaFitter::SetSignalFunction -- '' found!" << endl;
     108        return;
     109    }
     110
     111    delete fFunc;
     112    fFunc = 0;
     113
     114    switch (func)
     115    {
     116    case kGauss:
     117        fFunc=new TF1("", MString::Format("gaus(0) + pol%d(3)", fPolynomOrder));
     118        break;
     119    case kThetaSq:
     120        if (fPolynomOrder>0)
     121            fPolynomOrder = 1;
     122        fFunc=new TF1("", "[0]*exp(-0.5*((sqrt(x)-[1])/[2])^2) + expo(3)");
     123        break;
     124    }
     125
     126    fSignalFunc=func;
     127
     128    fFunc->SetName("Dummy");
     129    gROOT->GetListOfFunctions()->Remove(fFunc);
     130
     131    fCoefficients.Set(3+fPolynomOrder+1);
     132    fCoefficients.Reset();
     133
     134    fErrors.Set(3+fPolynomOrder+1);
     135    fErrors.Reset();
     136}
     137
     138// --------------------------------------------------------------------------
     139//
     140// Reset variables which belong to results. Reset the arrays.
     141//
    73142void MAlphaFitter::Clear(Option_t *o)
    74143{
     
    86155    fCoefficients.Reset();
    87156    fErrors.Reset();
     157}
     158
     159// --------------------------------------------------------------------------
     160//
     161// Returns fFunc->Eval(d) or 0 if fFunc==NULL
     162//
     163Double_t MAlphaFitter::Eval(Double_t d) const
     164{
     165    return fFunc ? fFunc->Eval(d) : 0;
    88166}
    89167
     
    294372    h.SetDirectory(0);
    295373    h.Add(&hon);
     374
    296375    h.Scale(0.5);
    297376    for (int i=1; i<=bin+3; i++)
     
    310389    // Do a gaussian error propagation to calculated the error of
    311390    // the background estimated from the fit
    312     const Double_t ea = fit.GetErrors()[3];
    313     const Double_t eb = fit.GetErrors()[4];
    314     const Double_t a  = fit.GetCoefficients()[3];
    315     const Double_t b  = fit.GetCoefficients()[4];
     391    const Double_t ea = fit.fErrors[3];
     392    const Double_t eb = fit.fErrors[4];
     393    const Double_t a  = fit.fCoefficients[3];
     394    const Double_t b  = fit.fCoefficients[4];
    316395
    317396    const Double_t t  = fIntegralMax;
     
    333412    // const Double_t sc = bg * er*er / (fit2.GetEventsBackground()*fit2.GetEventsBackground());
    334413    // Assuming that bg and fit2.GetEventsBackground() are rather identical:
    335     const Double_t sc = er*er / fit.GetEventsBackground();
     414    const Double_t sc = er*er / fit.fEventsBackground;
     415
     416
    336417    /*
    337418     cout << MMath::SignificanceLiMaSigned(hon.Integral(1, bin), fit.GetEventsBackground()/sc, sc) << " ";
     
    354435        return kFALSE;
    355436
    356     fChiSqSignal  = fit.GetChiSqSignal();
    357     fChiSqBg      = fit.GetChiSqBg();
    358     fCoefficients = fit.GetCoefficients();
    359     fErrors       = fit.GetErrors();
     437    fChiSqSignal  = fit.fChiSqSignal;
     438    fChiSqBg      = fit.fChiSqBg;
     439    fCoefficients = fit.fCoefficients;
     440    fErrors       = fit.fErrors;
    360441
    361442    // ----------------------------------------------------------------------------
     
    472553
    473554    // Function
    474     TF1 *fcn = f.fFunc;
     555    delete f.fFunc;
     556
    475557    f.fFunc = new TF1(*fFunc);
    476558    f.fFunc->SetName("Dummy");
    477559    gROOT->GetListOfFunctions()->Remove(f.fFunc);
    478     delete fcn;
    479560}
    480561
     
    527608{
    528609    const TString name(MString::Format("TempAlphaEnergy%06d", gRandom->Integer(1000000)));
     610
    529611    TH1D *h = hon.ProjectionZ(name, 0, hon.GetNbinsX()+1, bin, bin, "E");
     612    h->SetDirectory(0);
     613
     614    const Bool_t rc = Fit(*h, paint);
     615
     616    delete h;
     617
     618    return rc;
     619}
     620
     621Bool_t MAlphaFitter::FitTheta(const TH3D &hon, UInt_t bin, Bool_t paint)
     622{
     623    const TString name(MString::Format("TempAlphaTheta%06d", gRandom->Integer(1000000)));
     624
     625    TH1D *h = hon.ProjectionZ(name, bin, bin, 0, hon.GetNbinsY()+1, "E");
     626    h->SetDirectory(0);
     627
     628    const Bool_t rc = Fit(*h, paint);
     629
     630    delete h;
     631
     632    return rc;
     633}
     634/*
     635Bool_t MAlphaFitter::FitTime(const TH3D &hon, UInt_t bin, Bool_t paint)
     636{
     637    const TString name(Form("TempAlphaTime%06d", gRandom->Integer(1000000)));
     638
     639    hon.GetZaxis()->SetRange(bin,bin);
     640    TH1D *h = (TH1D*)hon.Project3D("ye");
     641    hon.GetZaxis()->SetRange(-1,-1);
     642
    530643    h->SetDirectory(0);
    531644
     
    534647    return rc;
    535648}
    536 
    537 Bool_t MAlphaFitter::FitTheta(const TH3D &hon, UInt_t bin, Bool_t paint)
    538 {
    539     const TString name(MString::Format("TempAlphaTheta%06d", gRandom->Integer(1000000)));
    540     TH1D *h = hon.ProjectionZ(name, bin, bin, 0, hon.GetNbinsY()+1, "E");
    541     h->SetDirectory(0);
    542 
    543     const Bool_t rc = Fit(*h, paint);
    544     delete h;
    545     return rc;
    546 }
    547 /*
    548 Bool_t MAlphaFitter::FitTime(const TH3D &hon, UInt_t bin, Bool_t paint)
    549 {
    550     const TString name(Form("TempAlphaTime%06d", gRandom->Integer(1000000)));
    551 
    552     hon.GetZaxis()->SetRange(bin,bin);
    553     TH1D *h = (TH1D*)hon.Project3D("ye");
    554     hon.GetZaxis()->SetRange(-1,-1);
    555 
    556     h->SetDirectory(0);
    557 
    558     const Bool_t rc = Fit(*h, paint);
    559     delete h;
    560     return rc;
    561 }
    562649*/
    563650Bool_t MAlphaFitter::FitAlpha(const TH3D &hon, Bool_t paint)
    564651{
    565652    const TString name(MString::Format("TempAlpha%06d", gRandom->Integer(1000000)));
     653
    566654    TH1D *h = hon.ProjectionZ(name, 0, hon.GetNbinsX()+1, 0, hon.GetNbinsY()+1, "E");
    567655    h->SetDirectory(0);
    568656
    569657    const Bool_t rc = Fit(*h, paint);
     658
    570659    delete h;
     660
    571661    return rc;
    572662}
     
    578668
    579669    TH1D *h1 = hon.ProjectionZ(name1, 0, hon.GetNbinsX()+1, bin, bin, "E");
     670    h1->SetDirectory(0);
     671
    580672    TH1D *h0 = hof.ProjectionZ(name0, 0, hof.GetNbinsX()+1, bin, bin, "E");
    581     h1->SetDirectory(0);
    582673    h0->SetDirectory(0);
    583674
     
    596687
    597688    TH1D *h1 = hon.ProjectionZ(name1, bin, bin, 0, hon.GetNbinsY()+1, "E");
     689    h1->SetDirectory(0);
     690
    598691    TH1D *h0 = hof.ProjectionZ(name0, bin, bin, 0, hof.GetNbinsY()+1, "E");
    599     h1->SetDirectory(0);
    600692    h0->SetDirectory(0);
    601693
     
    638730
    639731    TH1D *h1 = hon.ProjectionZ(name1, 0, hon.GetNbinsX()+1, 0, hon.GetNbinsY()+1, "E");
     732    h1->SetDirectory(0);
     733
    640734    TH1D *h0 = hof.ProjectionZ(name0, 0, hof.GetNbinsX()+1, 0, hof.GetNbinsY()+1, "E");
    641     h1->SetDirectory(0);
    642735    h0->SetDirectory(0);
    643736
     
    656749
    657750    TH1D *h1 = hon.ProjectionZ(name1, 0, hon.GetNbinsX()+1, bin, bin, "E");
     751    h1->SetDirectory(0);
     752
    658753    TH1D *h0 = hof.ProjectionZ(name0, 0, hof.GetNbinsX()+1, bin, bin, "E");
    659     h1->SetDirectory(0);
    660754    h0->SetDirectory(0);
    661755
  • trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h

    r8989 r9302  
    1010#endif
    1111
    12 #ifndef ROOT_TF1
    13 #include <TF1.h>
    14 #endif
    15 
     12class TF1;
    1613class TH1D;
    1714class TH3D;
     
    8582public:
    8683    // Implementing the function yourself is only about 5% faster
    87     MAlphaFitter(const char *name=0, const char *title=0) : fSigInt(15),
    88         fSigMax(75), fBgMin(45), fBgMax(85), fScaleMin(40), fScaleMax(80),
    89         fPolynomOrder(2), fFitBackground(kTRUE), fSignalFunc(kGauss),
    90         fCoefficients(3+fPolynomOrder+1), fErrors(3+fPolynomOrder+1),
    91         fFunc(new TF1("", Form("gaus(0) + pol%d(3)", fPolynomOrder), 0, 90)),
    92         fScaleMode(kOffRegion), fScaleUser(1), fStrategy(kSignificance)
    93     {
    94         fName  = name  ? name  : "MAlphaFitter";
    95         fTitle = title ? title : "Fit alpha";
    96 
    97         fFunc->SetName("Dummy");
    98         gROOT->GetListOfFunctions()->Remove(fFunc);
    99 
    100         Clear();
    101     }
    102 
     84    MAlphaFitter(const char *name=0, const char *title=0);
    10385    MAlphaFitter(const MAlphaFitter &f) : fFunc(0)
    10486    {
    10587        f.Copy(*this);
    10688    }
    107     ~MAlphaFitter()
    108     {
    109         delete fFunc;
    110     }
     89    ~MAlphaFitter();
    11190
    11291    // TObject
     
    134113        SetSignalFunction(fSignalFunc);
    135114    }
    136     void SetSignalFunction(SignalFunc_t func)
    137     {
    138         delete fFunc;
    139         switch (func)
    140         {
    141         case kGauss:
    142             fFunc=new TF1 ("", Form("gaus(0) + pol%d(3)", fPolynomOrder));
    143             break;
    144         case kThetaSq:
    145 //            if (fPolynomOrder==0)
    146 //                fFunc=new TF1("", "[0]*exp(-0.5*((sqrt(x)-[1])/[2])^2) + pol0(3)");
    147 //            else
    148             //            {
    149             if (fPolynomOrder>0)
    150                 fPolynomOrder = 1;
    151             fFunc=new TF1("", "[0]*exp(-0.5*((sqrt(x)-[1])/[2])^2) + expo(3)");
    152 //            }
    153             break;
    154         }
    155         fSignalFunc=func;
    156         fFunc->SetName("Dummy");
    157         gROOT->GetListOfFunctions()->Remove(fFunc);
    158 
    159         fCoefficients.Set(3+fPolynomOrder+1);
    160         fCoefficients.Reset();
    161 
    162         fErrors.Set(3+fPolynomOrder+1);
    163         fErrors.Reset();
    164     }
     115    void SetSignalFunction(SignalFunc_t func);
     116
    165117    void EnableBackgroundFit(Bool_t b=kTRUE) { fFitBackground=b; }
    166118
     
    193145    const TArrayD &GetCoefficients() const { return fCoefficients; }
    194146    const TArrayD &GetErrors() const       { return fErrors; }
    195     Double_t Eval(Double_t d) const { return fFunc ? fFunc->Eval(d) : 0; }
     147    Double_t Eval(Double_t d) const;
    196148
    197149    Double_t CalcUpperLimit() const;
Note: See TracChangeset for help on using the changeset viewer.