Changeset 5907 for trunk/MagicSoft


Ignore:
Timestamp:
01/20/05 10:53:09 (20 years ago)
Author:
domingo
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mtemp/mifae/macros/OptimizeDisp.C

    r5906 r5907  
    1919//
    2020// - and determines the free parameters p[0],p[1],p[2]... from MC gamma data
    21 //   by minimizing a chi2 which measures the deviation of the estimated
     21//   by minimizing a parameter which measures the deviation of the estimated
    2222//   source position (using DISP) and the true source position
    2323//
    2424// The following classes are used :
    2525//
    26 // MDisp          container holding the parameters p[0],p[1],p[2],...
    27 //
    28 //   ::Calc       member function calculating DISP for a given event;
    29 //                it is called by MDispCalc::Process()     
    30 //
    31 // MDispCalc      task calculating DISP with the parameters stored in MDisp
    32 //
    33 // MFindDisp      class with several functions :
     26// MDispParameters  container holding the parameters p[0],p[1],p[2],...
     27//
     28// MDispCalc        task calculating DISP with the parameters stored in
     29//                  MDispParameters
     30//
     31//   ::Calc         member function where the DISP parameterization is
     32//                  defined. It calculates DISP for a given event;
     33//                  it is called by MDispCalc::Process()     
     34//
     35// MFindDisp        class with several functions :
    3436//
    3537//  ::DefineTrainMatrix     \  member functions which generate the training
     
    3739//  ::DefineTrainTestMatrix /  from the MC gamma data
    3840//
    39 //  ::FindParams  member function steering the minimization
    40 //                (definition of the fcn function for Minuit, setting up the
    41 //                event loop to be executed in each minimization step,
    42 //                call to Minuit);
    43 //                for the minimization the training matrix is used
    44 //
    45 //  ::TestParams  member function testing the quality of the DISP estimate;
    46 //                for the test the test matrix is used
    47 //
    48 // MHDisp         container for histograms which are useful for judging
    49 //                the quality of the DISP estimate
    50 //                Also task calculating the chi2 contribution of an event
    51 //                (in Fill())
    52 //                and computing the final chi2 of the whole event sample
    53 //                (in Finalize())
    54 //
    55 // MFDisp         filter to select sample for the optimization     
     41//  ::FindParams    member function steering the minimization
     42//                  (definition of the fcn function for Minuit, setting up the
     43//                  event loop to be executed in each minimization step,
     44//                  call to Minuit);
     45//                  for the minimization the training matrices are used
     46//
     47//  ::TestParams    member function testing the quality of the DISP estimate;
     48//                  for the test the test matrices are used
     49//
     50// MHDisp           container for histograms which are useful for judging
     51//                  the quality of the DISP estimate
     52//                  Also task calculating the Minimization parameter
     53//                  contribution of an event (in Fill())
     54//                  and computing the final Minimization parameter of the
     55//                  whole event sample (in Finalize())
     56//
     57// MFDisp           filter to select sample for the optimization     
    5658//
    5759//
     
    7375                        //TString typeOpt = "Data";
    7476                        TString typeOpt = "MC";
    75     Bool_t RTest       = kFALSE;  // Test the quality of the Disp estimate
     77    Bool_t RTest       = kTRUE;  // Test the quality of the Disp estimate
    7678                                  // using the test matrix
    77     Bool_t WDisp       = kTRUE;  // Make Disp plots for the data of type :
     79    Bool_t WDisp       = kFALSE;  // Make Disp plots for the data of type :
    7880                        //TString typeInput = "ON";
    7981                        //TString typeInput = "OFF";
     
    100102      "/home/pcmagic14/wittek/CalibData/CrabLow42/2004_10_17/";
    101103    TString inPathMC  =
    102       "~domingo/MC/";
     104    //"/discpepe/root_0.73mirror/wuerzburg/";
     105    "~domingo/Munich/Munich/MC/";
    103106   
    104107    // path for output from Mars
    105     TString outPath = "/mnt/home/pcmagic04/domingo/DispOptimization/";
     108    TString outPath = "~domingo/Munich/Bcn05/DispOptimization/";
    106109   
    107110    //-----------------------------------------------
     
    110113    const char *onfile   = "*CrabLowEn42*";
    111114    const char *mcfile   = "starmc_Gammas_30-20_Period21.27ReducedMC.Zbins0-12";
     115    //const char *mcfile   = "All_gammas0.73wuerzburg_zbin0to12_cleaned_3020_PeakSearch6_RunHeaders";
    112116    //-----------------------------------------------
    113117   
     
    309313    //     - from the file parDispInit (if != "")
    310314    //     - or from the arrays params and steps (if their sizes are != 0)
    311     //     - or from the MDisp constructor
     315    //     - or from the MDispParameters constructor
    312316    //======================================================================
    313317   
     
    316320      gLog << "-----------------------------------------------------" << endl;
    317321      gLog << "Optimize the Disp parameters over a "
    318            << typeOpt << " sample, using the training matrix" << endl;
    319      
    320       // Read training matrix from file
     322           << typeOpt << " sample, using the training matrices" << endl;
     323     
     324      // Read training matrices from file
    321325      finddisp.ReadMatrix(fileMatrixTrain, fileMatrixTest);
    322326
     
    326330      //    - the initial values are taken from the arrays params and steps
    327331      //      if their sizes are different from 0
    328       //    - otherwise they are taken from the MDisp constructor
     332      //    - otherwise they are taken from the MDispParameters constructor
    329333     
    330334      TString parDispInit = outPath;
     
    377381    if (RTest)
    378382    {
    379       // Read test matrix from file
     383      // Read test matrices from file
    380384      finddisp.ReadMatrix(fileMatrixTrain, fileMatrixTest);
    381385     
    382386      gLog << "-----------------------------------------------------" << endl;
    383       gLog << "Test the Disp parameters using on the test matrix" << endl;
     387      gLog << "Test the Disp parameters using the test matrices" << endl;
    384388      Bool_t rt = finddisp.TestParams();
    385389      if (!rt)
    386390      {
    387         gLog << "Test of the Disp parameters on the test matrix failed"
     391        gLog << "Test of the Disp parameters on the test matrices failed"
    388392             << endl;
    389393      }
     
    424428     
    425429      TFile inparam(parDispFile);
    426       MDisp dispin;
    427       dispin.Read("MDisp");
     430      MDispParameters dispin;
     431      dispin.Read("MDispParameters");
    428432      inparam.Close();
    429433     
     
    463467      //               3               the position according to M3Long
    464468      //               4               the position according to Asym
    465       MHDisp hdisp;
    466       hdisp.SetSelectedPos(1);
    467       MFillH filldisp("MHDisp", "");
    468       filldisp.SetName("FillDispPlots");
    469      
    470469      MHDisp hdisp1;
    471470      hdisp1.SetName("MHDispCorr");
     
    494493      pliston.AddToList(&tliston);
    495494      pliston.AddToList(&dispin);
    496       pliston.AddToList(&hdisp);
    497495      pliston.AddToList(&hdisp1);
    498496      pliston.AddToList(&hdisp2);
     
    507505        tliston.AddToList(&contdisp);
    508506      tliston.AddToList(&dispcalc);
    509       tliston.AddToList(&filldisp);
    510507      tliston.AddToList(&filldisp1);
    511508      tliston.AddToList(&filldisp2);
     
    532529      // Display the histograms
    533530      //
    534       //    hdisp.Draw();
    535531      hdisp1.Draw();
    536532      hdisp2.Draw();
Note: See TracChangeset for help on using the changeset viewer.