Changeset 2318 for trunk/MagicSoft/Mars


Ignore:
Timestamp:
08/26/03 13:50:39 (21 years ago)
Author:
wittek
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/MCT1FindSupercuts.cc

    r2310 r2318  
    3838
    3939#include <TFile.h>
     40#include <TArrayD.h>
    4041#include <TMinuit.h>
    4142#include <TCanvas.h>
     
    117118    // transfer current parameter values to MCT1Supercuts
    118119    //
    119     super->SetParameters(TArrayD(npar, par));
    120 
     120    // Attention : npar is the number of variable parameters
     121    //                  not the total number of parameters
     122    //
     123    Double_t fMin, fEdm, fErrdef;
     124    Int_t     fNpari, fNparx, fIstat;
     125    gMinuit->mnstat(fMin, fEdm, fErrdef, fNpari, fNparx, fIstat);
     126
     127    super->SetParameters(TArrayD(fNparx, par));
     128
     129    //$$$$$$$$$$$$$$$$$$$$$
     130    // for testing
     131    //TArrayD checkparameters = super->GetParameters();
     132    //gLog << "fcnsupercuts : i, par, checkparameters =" << endl;
     133    //for (Int_t i=0; i<fNparx; i++)
     134    //{
     135    //  gLog << i << ",  " << par[i] << ",  " << checkparameters[i] << endl;
     136    //}
     137    //$$$$$$$$$$$$$$$$$$$$$
    121138
    122139    //
     
    629646//
    630647// - for the minimization, the starting values of the parameters are taken as
    631 //   MCT1Supercuts::GetParams(fVinit)
     648//   MCT1Supercuts::GetParameters(fVinit)
    632649//
    633650//----------------------------------------------------------------------
     
    651668    {
    652669      *fLog << "MCT1FindSupercuts::FindParams; training matrix is not defined... aborting"
     670            << endl;
     671      return kFALSE;
     672    }
     673
     674    if (fMatrixTrain->GetM().GetNrows() <= 0)
     675    {
     676      *fLog << "MCT1FindSupercuts::FindParams; training matrix has no entries"
    653677            << endl;
    654678      return kFALSE;
     
    737761    //
    738762
    739     // get initial values of parameters from MCT1SupercutsCalc
     763    // get initial values of parameters from MCT1Supercuts
    740764    fVinit = super.GetParameters();
    741765
    742766    TString name[fVinit.GetSize()];
    743 
    744     for (Int_t i=0; i<fVinit.GetSize(); i++)
     767    fStep.Set(fVinit.GetSize());
     768    fLimlo.Set(fVinit.GetSize());
     769    fLimup.Set(fVinit.GetSize());
     770    fFix.Set(fVinit.GetSize());
     771
     772    fNpar = fVinit.GetSize();
     773
     774    for (UInt_t i=0; i<fNpar; i++)
    745775    {
    746776        name[i]   = "p";
    747777        name[i]  += i+1;
    748778        fStep[i]  = TMath::Abs(fVinit[i]/10.0);
    749         fLimlo[i] = -10.0;
    750         fLimup[i] =  10.0;
     779        fLimlo[i] = -100.0;
     780        fLimup[i] =  100.0;
    751781        fFix[i]   =     0;
     782
     783        // vary only first 48 parameters
     784        if (i >= 48)
     785        {
     786          fStep[i] = 0.0;
     787          fFix[i]  =   1;
     788        }
    752789    }
    753790
     
    757794    TStopwatch clock;
    758795    clock.Start();
     796
     797    *fLog << "before calling CallMinuit" << endl;
    759798
    760799    MMinuitInterface inter;               
     
    763802                                 &evtloopfcn, "SIMPLEX", kFALSE);
    764803 
     804    *fLog << "after calling CallMinuit" << endl;
     805
    765806    *fLog << "Time spent for the minimization in MINUIT :   " << endl;;
    766807    clock.Stop();
     
    812853    if (fMatrixTest->GetM().GetNrows() <= 0)
    813854    {
    814         *fLog << "MCT1FindSupercuts::TestParams; test matrix is empty... aborting" << endl;
     855        *fLog << "MCT1FindSupercuts::TestParams; test matrix has no entries"
     856              << endl;
    815857        return kFALSE;
    816858    }
  • trunk/MagicSoft/Mars/manalysis/MCT1Supercuts.cc

    r2308 r2318  
    162162{
    163163    if (d.GetSize() != fParameters.GetSize())
    164         // *fLog << err << ...
     164    {
     165        *fLog << err << "Sizes of d and of fParameters are different : "
     166              << d.GetSize() << ",  " << fParameters.GetSize() << endl;
    165167        return kFALSE;
     168    }
    166169
    167170    fParameters = d;
     171
    168172    return kTRUE;
    169173}
     174
     175
     176
     177
     178
     179
     180
     181
     182
     183
     184
     185
  • trunk/MagicSoft/Mars/manalysis/MMinuitInterface.cc

    r2313 r2318  
    8989    //..............................................
    9090    // Set the maximum number of parameters
    91     TMinuit *const save = gMinuit;
     91    //TMinuit *const save = gMinuit;
    9292
    9393    TMinuit &minuit = *new TMinuit(vinit.GetSize());
     
    284284    minuit.mnexcm("CALL", &iflag, 1, errfcn3);
    285285
    286     delete &minuit;
    287     gMinuit = save;
     286    // WW : the following statements were commented out because the
     287    // Minuit object will still be used;
     288    // this may be changed in the future
     289    //delete &minuit;
     290    //gMinuit = save;
    288291
    289292    return kTRUE;
  • trunk/MagicSoft/Mars/mhist/MHFindSignificance.cc

    r2311 r2318  
    6868#include <TMinuit.h>
    6969#include <TPaveText.h>
     70#include <TStyle.h>
    7071
    7172#include "MLog.h"
     
    297298    delete fGPoly;
    298299    delete fGBackg;
    299     delete fCanvas;
     300    //delete fCanvas;
    300301}
    301302
     
    348349       Bool_t drawpoly,   Bool_t fitgauss, Bool_t print)
    349350{
    350   *fLog << "MHFindSignificance::FindSigma;" << endl;
     351  //*fLog << "MHFindSignificance::FindSigma;" << endl;
    351352
    352353  fHistOrig = fhist;
     
    503504  fHist = (TH1*)fHistOrig->Clone("|alpha| plot");
    504505  fHist->Sumw2();
    505   fHist->SetNameTitle("Alpha", "alpha plot");
     506  fHist->SetNameTitle("alpha", "alpha plot");
    506507  fHist->SetXTitle("|alpha|  [\\circ]");
    507508  fHist->SetYTitle("Counts");
     
    545546      continue;
    546547    }
    547 
    548 
    549     *fLog << "before SigmaLiMa : fNon, fNoff, fGamma = " << fNon << ",  "
    550           << fNoff << ",  " << fGamma << endl;
    551548
    552549    Double_t siglima = 0.0;
     
    570567 
    571568  gROOT->SetSelectedPad(NULL);
     569  gStyle->SetPadLeftMargin(0.05);
    572570
    573571  ccc->cd();
     
    920918                                         kFALSE);
    921919
     920      *fLog << "FitPolynomial : after CallMinuit()" << endl;
     921
    922922      if (rc != 0)
    923923      {
     
    939939          gMinuit->mnstat(fmin, fedm, errdef, npari, nparx, fIstat);
    940940
    941       //*fLog << "MHFindSignificance::FitPolynomial; fmin, fedm, errdef, npari, nparx, fIstat = "
    942       //      << fmin << ",  " << fedm << ",  " << errdef << ",  " << npari
    943       //      << ",  " << nparx << ",  " << fIstat << endl;
     941      *fLog << "MHFindSignificance::FitPolynomial; fmin, fedm, errdef, npari, nparx, fIstat = "
     942            << fmin << ",  " << fedm << ",  " << errdef << ",  " << npari
     943            << ",  " << nparx << ",  " << fIstat << endl;
    944944
    945945
     
    969969          fErrors[j] = err;
    970970      }
     971
    971972
    972973      //--------------------------------------------------
     
    10681069  for (Int_t i=1; i<=nbins; i++)
    10691070      fHist->SetBinError(i, saveError[i-1]);
     1071
    10701072
    10711073  return kTRUE;
     
    12621264  TString formulaBackg = "[0]";
    12631265  for (Int_t i=1; i<=fDegree; i++)
    1264       formulaBackg += Form("+[%d]^%d", i, i);
    1265 
    1266   const TString formulaGauss = Form("[%d]/[%d]*exp(-0.5*((x-[%d])/[%d])^2)",
    1267                                     fDegree+1, fDegree+3, fDegree+2, fDegree+3);
     1266      formulaBackg += Form("+[%d]*x^%d", i, i);
     1267
     1268  const TString formulaGauss =
     1269        Form("[%d]/[%d]*exp(-0.5*((x-[%d])/[%d])^2)",
     1270             fDegree+1, fDegree+3, fDegree+2, fDegree+3);
    12681271
    12691272  TString formula = formulaBackg;
     
    17231726Bool_t MHFindSignificance::DrawFit(const Option_t *opt)
    17241727{
    1725   *fLog << "entry DrawFit" << endl;
    1726 
    17271728    if (fHist == NULL)
    17281729      *fLog << "MHFindSignificance::DrawFit; fHist = NULL" << endl;
     
    17331734
    17341735    //gStyle->SetOptFit(1011);
     1736
    17351737    gROOT->SetSelectedPad(NULL);   
     1738    gStyle->SetPadLeftMargin(0.1);
    17361739
    17371740    fCanvas->cd();
     1741
    17381742
    17391743    if (fHist)
     
    17841788    }
    17851789
    1786   *fLog << "DrawFit : before text" << endl;
    17871790
    17881791    //-------------------------------
     
    18641867    pt->SetTextAlign(12);
    18651868
    1866   *fLog << "DrawFit : before pt->Draw()" << endl;
    1867 
    18681869    pt->Draw();
    18691870
    18701871    fCanvas->Modified();
    18711872    fCanvas->Update();
    1872 
    1873   *fLog << "exit DrawFit" << endl;
    18741873
    18751874    return kTRUE;
Note: See TracChangeset for help on using the changeset viewer.