Changeset 5907 for trunk/MagicSoft/Mars/mtemp
- Timestamp:
- 01/20/05 10:53:09 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mtemp/mifae/macros/OptimizeDisp.C
r5906 r5907 19 19 // 20 20 // - and determines the free parameters p[0],p[1],p[2]... from MC gamma data 21 // by minimizing a chi2which measures the deviation of the estimated21 // by minimizing a parameter which measures the deviation of the estimated 22 22 // source position (using DISP) and the true source position 23 23 // 24 24 // The following classes are used : 25 25 // 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 : 34 36 // 35 37 // ::DefineTrainMatrix \ member functions which generate the training … … 37 39 // ::DefineTrainTestMatrix / from the MC gamma data 38 40 // 39 // ::FindParams member function steering the minimization40 // (definition of the fcn function for Minuit, setting up the41 // event loop to be executed in each minimization step,42 // call to Minuit);43 // for the minimization the training matrix isused44 // 45 // ::TestParams member function testing the quality of the DISP estimate;46 // for the test the test matrix isused47 // 48 // MHDisp container for histograms which are useful for judging49 // the quality of the DISP estimate50 // Also task calculating the chi2 contribution of an event51 // (in Fill())52 // and computing the final chi2 of the whole event sample53 // (in Finalize())54 // 55 // MFDisp filter to select sample for the optimization41 // ::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 56 58 // 57 59 // … … 73 75 //TString typeOpt = "Data"; 74 76 TString typeOpt = "MC"; 75 Bool_t RTest = k FALSE; // Test the quality of the Disp estimate77 Bool_t RTest = kTRUE; // Test the quality of the Disp estimate 76 78 // using the test matrix 77 Bool_t WDisp = k TRUE; // Make Disp plots for the data of type :79 Bool_t WDisp = kFALSE; // Make Disp plots for the data of type : 78 80 //TString typeInput = "ON"; 79 81 //TString typeInput = "OFF"; … … 100 102 "/home/pcmagic14/wittek/CalibData/CrabLow42/2004_10_17/"; 101 103 TString inPathMC = 102 "~domingo/MC/"; 104 //"/discpepe/root_0.73mirror/wuerzburg/"; 105 "~domingo/Munich/Munich/MC/"; 103 106 104 107 // path for output from Mars 105 TString outPath = " /mnt/home/pcmagic04/domingo/DispOptimization/";108 TString outPath = "~domingo/Munich/Bcn05/DispOptimization/"; 106 109 107 110 //----------------------------------------------- … … 110 113 const char *onfile = "*CrabLowEn42*"; 111 114 const char *mcfile = "starmc_Gammas_30-20_Period21.27ReducedMC.Zbins0-12"; 115 //const char *mcfile = "All_gammas0.73wuerzburg_zbin0to12_cleaned_3020_PeakSearch6_RunHeaders"; 112 116 //----------------------------------------------- 113 117 … … 309 313 // - from the file parDispInit (if != "") 310 314 // - or from the arrays params and steps (if their sizes are != 0) 311 // - or from the MDisp constructor315 // - or from the MDispParameters constructor 312 316 //====================================================================== 313 317 … … 316 320 gLog << "-----------------------------------------------------" << endl; 317 321 gLog << "Optimize the Disp parameters over a " 318 << typeOpt << " sample, using the training matri x" << endl;319 320 // Read training matri xfrom file322 << typeOpt << " sample, using the training matrices" << endl; 323 324 // Read training matrices from file 321 325 finddisp.ReadMatrix(fileMatrixTrain, fileMatrixTest); 322 326 … … 326 330 // - the initial values are taken from the arrays params and steps 327 331 // if their sizes are different from 0 328 // - otherwise they are taken from the MDisp constructor332 // - otherwise they are taken from the MDispParameters constructor 329 333 330 334 TString parDispInit = outPath; … … 377 381 if (RTest) 378 382 { 379 // Read test matri xfrom file383 // Read test matrices from file 380 384 finddisp.ReadMatrix(fileMatrixTrain, fileMatrixTest); 381 385 382 386 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; 384 388 Bool_t rt = finddisp.TestParams(); 385 389 if (!rt) 386 390 { 387 gLog << "Test of the Disp parameters on the test matri xfailed"391 gLog << "Test of the Disp parameters on the test matrices failed" 388 392 << endl; 389 393 } … … 424 428 425 429 TFile inparam(parDispFile); 426 MDisp dispin;427 dispin.Read("MDisp ");430 MDispParameters dispin; 431 dispin.Read("MDispParameters"); 428 432 inparam.Close(); 429 433 … … 463 467 // 3 the position according to M3Long 464 468 // 4 the position according to Asym 465 MHDisp hdisp;466 hdisp.SetSelectedPos(1);467 MFillH filldisp("MHDisp", "");468 filldisp.SetName("FillDispPlots");469 470 469 MHDisp hdisp1; 471 470 hdisp1.SetName("MHDispCorr"); … … 494 493 pliston.AddToList(&tliston); 495 494 pliston.AddToList(&dispin); 496 pliston.AddToList(&hdisp);497 495 pliston.AddToList(&hdisp1); 498 496 pliston.AddToList(&hdisp2); … … 507 505 tliston.AddToList(&contdisp); 508 506 tliston.AddToList(&dispcalc); 509 tliston.AddToList(&filldisp);510 507 tliston.AddToList(&filldisp1); 511 508 tliston.AddToList(&filldisp2); … … 532 529 // Display the histograms 533 530 // 534 // hdisp.Draw();535 531 hdisp1.Draw(); 536 532 hdisp2.Draw();
Note:
See TracChangeset
for help on using the changeset viewer.