Ignore:
Timestamp:
05/20/03 11:08:23 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/macros
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/macros/estfit.C

    r1842 r2124  
    3333
    3434// --------------------------------------------------------------------------
    35 
    36 void estfit(Bool_t evalenergy=kFALSE)
     35//
     36//  0: fit impact parameter only
     37//  1: fit energy only
     38//  2: fit all parameters with respect to the energy resolution
     39//
     40void estfit(Int_t evalenergy=0)
    3741{
    3842    //
     
    4852    eest.InitMapping(&matrix);
    4953
    50     MReadTree read("Events", "~/ct1/MC_ON2.root");
     54    MReadTree read("Events", "MC_ON2_short.root");
    5155    read.DisableAutoScheme();
    5256
     
    9296    //
    9397    TArrayD fA(5);
    94     fA[0] = -3907.74; //4916.4;    //-2414.75;
    95     fA[1] = 1162.3;   //149.549;   // 1134.28;
    96     fA[2] = 199.351;  //-558.209;  // 132.932;
    97     fA[3] = 0.403192; //0.270725;  //0.292845;
    98     fA[4] = 121.921;  //107.001;   // 107.001;
    99 
    10098    TArrayD fB(7);
    101     fB[0] = -100;
    102     fB[1] = 10;
    103     fB[2] = 0.1;
    104     fB[3] = 10;
    105     fB[4] = -1;
    106     fB[5] = -0.1;
    107     fB[6] = -0.1;
    108 
     99    fA[0] =  392957;
     100    fA[1] =  135;
     101    fA[2] =  -37449;
     102    fA[3] =  0.3464;
     103    fA[4] =  1;
     104    fB[0] =  1;
     105    fB[1] =  1;
     106    fB[2] =  1;
     107    fB[3] =  1;
     108    fB[4] =  1;
     109    fB[5] =  1;
     110    fB[6] =  1;
     111     /*
     112     fA[0] = 6122.97;
     113     fA[1] = 144.889;
     114     fA[2] = -601.256;
     115     fA[3] = 0.00171985;
     116     fA[4] = 116.451;
     117     fB[0] =  -2368.21;
     118     fB[1] =  1186.26;
     119     fB[2] =  0.147235;
     120     fB[3] =  144.49;
     121     fB[4] =  42.7681;
     122     fB[5] = -0.757817;
     123     fB[6] =  0.182482;
     124     */
     125    /*
     126     TArrayD fA(5);
     127    fA[0] = 6122.97;
     128    fA[1] = 144.889;
     129    fA[2] = -601.256;
     130    fA[3] = 0.00171985;
     131    fA[4] = 116.451;
     132
     133    TArrayD fB(7);
     134    fB[0] =  -10445.5;
     135    fB[1] =  2172.05;
     136    fB[2] =  0.69;
     137    fB[3] =  491.2;
     138    fB[4] =  4.71444;
     139    fB[5] = -0.0331926;
     140    fB[6] = -0.014833;
     141    */
    109142    // Set starting values and step sizes for parameters
    110143    for (Int_t i=0; i<fA.GetSize(); i++)
     
    120153
    121154        Bool_t rc = minuit.DefineParameter(i, name, vinit, step, limlo, limup);
    122         if (evalenergy)
     155        if (evalenergy==1)
     156        {
    123157            minuit.FixParameter(i);
     158            cout << "Fixed Parameter #" << i << endl;
     159        }
    124160
    125161        if (!rc)
     
    142178
    143179        Bool_t rc = minuit.DefineParameter(i+fA.GetSize(), name, vinit, step, limlo, limup);
    144         if (!evalenergy)
     180        if (evalenergy==0)
     181        {
    145182            minuit.FixParameter(i+fA.GetSize());
     183            cout << "Fixed Parameter #" << i+fA.GetSize() << endl;
     184        }
    146185
    147186        if (!rc)
     
    156195    //
    157196    minuit.SetObjectFit(&evtloop);
     197
     198    cout << endl << "Fitting procedure running..." << endl;
    158199
    159200    TStopwatch clock;
     
    164205    Bool_t rc = minuit.Migrad();
    165206    gLog.SetNullOutput(kFALSE);
    166 
    167207    if (rc)
    168208    {
     
    176216    cout << endl;
    177217
    178     for (Int_t i=(evalenergy?fA.GetSize():0); i<(evalenergy?fA.GetSize()+fB.GetSize():fA.GetSize()); i++)
     218    for (Int_t i=(evalenergy==1?fA.GetSize():0); i<(evalenergy>0?fA.GetSize()+fB.GetSize():fA.GetSize()); i++)
     219    //for (Int_t i=0; i<fA.GetSize()+fB.GetSize(); i++)
    179220    {
    180221        Double_t val;
     
    182223
    183224        if (!minuit.GetParameter(i, val, er))
    184         {
    185225            cout << "Error getting parameter #" << i << endl;
    186             return;
    187         }
    188226
    189227        cout << i << ":  " << val << "  +-  " << er << endl;
  • trunk/MagicSoft/Mars/macros/multidimdist2.C

    r1629 r2124  
    6666    //   Here you give the trainings sample(s) for
    6767    //                 the gammas
     68    //      If you have only _one_ single Theta
     69    //            remove MMcEvt.fTheta!
    6870    // ---------------------------------------------
    69     MReadMarsFile readg("Events", "star_gammas.root");
     71    MReadMarsFile readg("Events", "star_gammas0.root");
    7072    readg.DisableAutoScheme();
    7173    tlistg.AddToList(&readg);
     
    9597    // --- Create and set up the eventloop (gammas) ---
    9698    //
    97     MEvtLoop evtloop;
    98     evtloop.SetParList(&plist);
     99    MEvtLoop evtloop1;
     100    evtloop1.SetParList(&plist);
    99101
    100102    //
    101103    // --- Execute matrix buildup (gammas) ---
    102104    //
    103     if (!evtloop.Eventloop())
     105    if (!evtloop1.Eventloop())
    104106        return;
    105107
     
    119121    //                 the hadrons
    120122    // ---------------------------------------------
    121     MReadMarsFile  readh("Events", "star_protons.root");
     123    MReadMarsFile  readh("Events", "star_protons0.root");
    122124    readh.DisableAutoScheme();
    123125    tlisth.AddToList(&readh);
     
    135137    // Create and set up the eventloop (protons)
    136138    //
    137     MEvtLoop evtloop;
    138     evtloop.SetParList(&plist);
     139    MEvtLoop evtloop2;
     140    evtloop2.SetParList(&plist);
    139141
    140142    //
    141143    // Execute matrix buildup (hadrons)
    142144    //
    143     if (!evtloop.Eventloop())
     145    if (!evtloop2.Eventloop())
    144146        return;
    145147
    146148    //  sum up in log
    147     tlistg.PrintStatistics();
     149    tlisth.PrintStatistics();
    148150
    149151    matrix.Print("size");
     
    165167    //          and one gamma file available
    166168    // ----------------------------------------------------
    167     MReadMarsFile read2("Events", "star_protons.root");
    168     read2.AddFile("star_gammas.root");
     169    MReadMarsFile read2("Events", "star_gammas0.root");
     170    read2.AddFile("star_protons0.root");
    169171    read2.DisableAutoScheme();
    170172    tlist2.AddToList(&read2);
     
    190192    //
    191193    MProgressBar bar;
    192     MEvtLoop evtloop;
    193     evtloop.SetProgressBar(&bar);
    194     evtloop.SetParList(&plist);
    195 
    196     if (!evtloop.Eventloop())
     194    MEvtLoop evtloop3;
     195    evtloop3.SetProgressBar(&bar);
     196    evtloop3.SetParList(&plist);
     197
     198    if (!evtloop3.Eventloop())
    197199        return;
    198200
  • trunk/MagicSoft/Mars/macros/star.C

    r2026 r2124  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  5/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
     18!   Author(s): Thomas Bretz, 5/2002 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    20 !   Copyright: MAGIC Software Development, 2000-2002
     20!   Copyright: MAGIC Software Development, 2000-2003
    2121!
    2222!
     
    6666
    6767    // ------------- user change -----------------
    68     read.AddFile("data/Gamma_z*.root");
    69     //read.AddFile("Gam*.root");
     68    read.AddFile("magictest/test/Gamma_z*.root");
    7069
    7170    MMcPedestalCopy   pcopy;
     
    7675    blind.SetUseInterpolation();
    7776
     77    MSigmabarCalc     sgcal;
    7878    MImgCleanStd      clean;
    7979    MHillasCalc       hcalc;
     
    8181
    8282    // ------------- user change -----------------
    83     MWriteRootFile write("data/star_protons.root");
     83    MWriteRootFile write("starfile.root");
     84    write.AddContainer("MMcEvt",        "Events");
     85    write.AddContainer("MSigmabar",     "Events");
    8486    write.AddContainer("MHillas",       "Events");
    8587    write.AddContainer("MHillasExt",    "Events");
     88    write.AddContainer("MHillasSrc",    "Events");
    8689    write.AddContainer("MNewImagePar",  "Events");
    87     write.AddContainer("MMcEvt",        "Events");
    88     write.AddContainer("MHillasSrc",    "Events");
    8990    write.AddContainer("MRawRunHeader", "RunHeaders");
    9091    write.AddContainer("MMcRunHeader",  "RunHeaders");
     
    9697    tlist.AddToList(&ncalc);
    9798    tlist.AddToList(&blind);
     99    tlist.AddToList(&sgcal);
    98100    tlist.AddToList(&clean);
    99101    tlist.AddToList(&hcalc);
  • trunk/MagicSoft/Mars/macros/status.C

    r2065 r2124  
    1616!
    1717!
    18 !   Author(s): Thomas Bretz  4/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
     18!   Author(s): Thomas Bretz, 4/2003 <mailto:tbretz@astro.uni-wuerzburg.de>
    1919!
    2020!   Copyright: MAGIC Software Development, 2000-2003
     
    6161    plist.AddToList(&src);
    6262
    63     // Use MHillasExt instead of MHillas
    64     MHillasExt hext;
    65     plist.AddToList(&hext);
    66 
    6763    //
    6864    // The geometry container must be created by yourself to make sure
     
    8076
    8177    // ------------- user change -----------------
    82     read.AddFile("data/Pro*.root");
    83     read.AddFile("data/Gam*.root");
     78    read.AddFile("magictest/test/Gamma_z*.root");
    8479
    8580    MMcPedestalCopy   pcopy;
     
    9085    blind.SetUseInterpolation();
    9186
     87    MSigmabarCalc     sgcal;
    9288    MImgCleanStd      clean;
    9389    MHillasCalc       hcalc;
     
    9793    // -------------------------------------------
    9894    MFillH hfill1("MHHillas", "MHillas");
    99     MFillH hfill2("MHHillasExt [MHHillasExt]");
    100     MFillH hfill3("MHHillasExtSrc [MHHillasExt]");
     95    MFillH hfill2("MHHillasExt");
     96    MFillH hfill3("MHHillasExtSrc [MHHillasExt]", "MHillasSrc");
    10197    MFillH hfill4("MHHillasSrc","MHillasSrc");
    10298    MFillH hfill4("MHNewImagePar","MNewImagePar");
     
    104100    MFillH hfill6("MHCerPhotEvt", "MCerPhotEvt");
    105101    MFillH hfill7("MHHadronness", "MHadronness");
     102    MFillH hfill8("MHSigmaTheta");
    106103
    107104    tlist.AddToList(&read);
    108105    tlist.AddToList(&pcopy);
    109106    tlist.AddToList(&pnsb);
    110 
    111107    tlist.AddToList(&ncalc);
    112108    tlist.AddToList(&blind);
     109    tlist.AddToList(&sgcal);
    113110    tlist.AddToList(&clean);
    114111    tlist.AddToList(&hcalc);
    115112    tlist.AddToList(&scalc);
    116113    tlist.AddToList(&calc1);
    117     tlist.AddToList(&hfill7);
    118114    tlist.AddToList(&hfill1);
    119115    tlist.AddToList(&hfill2);
     
    122118    tlist.AddToList(&hfill5);
    123119    tlist.AddToList(&hfill6);
     120    tlist.AddToList(&hfill7);
     121    tlist.AddToList(&hfill8);
    124122
    125123    MEvtLoop evtloop;
     
    142140    {
    143141        // Save data in a postscriptfile (status.ps)
    144        // d->SaveAsPS();
     142        d->SaveAsPS();
    145143        /*
    146144         * ----------- Write status to a root file ------------
Note: See TracChangeset for help on using the changeset viewer.