Changeset 2357 for trunk/MagicSoft/Mars/manalysis
- Timestamp:
- 09/24/03 13:29:00 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/manalysis
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MCT1FindSupercuts.cc
r2318 r2357 57 57 #include "MFEventSelector2.h" 58 58 #include "MFillH.h" 59 #include "MGeomCamCT1Daniel.h" 59 //#include "MGeomCamCT1Daniel.h" 60 #include "MGeomCamCT1.h" 60 61 #include "MH3.h" 61 62 #include "MHCT1Supercuts.h" … … 95 96 Double_t *par, Int_t iflag) 96 97 { 98 //cout << "entry fcnSupercuts" << endl; 99 97 100 //------------------------------------------------------------- 98 101 // save pointer to the MINUIT object for optimizing the supercuts … … 106 109 107 110 MParList *plistfcn = (MParList*)evtloopfcn->GetParList(); 111 //MTaskList *tasklistfcn = (MTaskList*)plistfcn->FindObject("MTaskList"); 108 112 109 113 MCT1Supercuts *super = (MCT1Supercuts*)plistfcn->FindObject("MCT1Supercuts"); … … 130 134 // for testing 131 135 //TArrayD checkparameters = super->GetParameters(); 136 //gLog << "fcnsupercuts : fNpari, fNparx =" << fNpari << ", " 137 // << fNparx << endl; 132 138 //gLog << "fcnsupercuts : i, par, checkparameters =" << endl; 133 139 //for (Int_t i=0; i<fNparx; i++) … … 142 148 evtloopfcn->Eventloop(); 143 149 150 //tasklistfcn->PrintStatistics(0, kTRUE); 151 144 152 MH3* alpha = (MH3*)plistfcn->FindObject("AlphaFcn", "MH3"); 145 153 if (!alpha) … … 147 155 148 156 TH1 &alphaHist = alpha->GetHist(); 149 //alphaHist.SetXTitle("|\\alpha| [\\circ]");157 alphaHist.SetName("alpha-fcnSupercuts"); 150 158 151 159 //------------------------------------------- … … 161 169 const Double_t alphamin = 30.0; 162 170 const Double_t alphamax = 90.0; 163 const Int_t degree = 4;171 const Int_t degree = 2; 164 172 165 173 Bool_t drawpoly; … … 240 248 //--------------------------- 241 249 // camera geometry is needed for conversion mm ==> degree 242 fCam = new MGeomCamCT1Daniel; 243 244 // matrices to contain the the training/test samples 250 //fCam = new MGeomCamCT1Daniel; 251 fCam = new MGeomCamCT1; 252 253 // matrices to contain the training/test samples 245 254 fMatrixTrain = new MHMatrix("MatrixTrain"); 246 255 fMatrixTest = new MHMatrix("MatrixTest"); … … 277 286 // 278 287 Bool_t MCT1FindSupercuts::DefineTrainMatrix(const TString &nametrain, 279 const Int_t howmanytrain, MH3 &hreftrain) 288 const Int_t howmanytrain, MH3 &hreftrain, 289 const TString &filetrain) 280 290 { 281 291 if (nametrain.IsNull() || howmanytrain <= 0) … … 343 353 *fLog << "=============================================" << endl; 344 354 355 //-------------------------- 356 // write out training matrix 357 358 if (filetrain != "") 359 { 360 TFile filetr(filetrain, "RECREATE"); 361 fMatrixTrain->Write(); 362 filetr.Close(); 363 364 *fLog << "MCT1FindSupercuts::DefineTrainMatrix; Training matrix was written onto file '" 365 << filetrain << "'" << endl; 366 } 367 368 345 369 return kTRUE; 346 370 } … … 356 380 // 357 381 Bool_t MCT1FindSupercuts::DefineTestMatrix(const TString &nametest, 358 const Int_t howmanytest, MH3 &hreftest) 382 const Int_t howmanytest, MH3 &hreftest, 383 const TString &filetest) 359 384 { 360 385 if (nametest.IsNull() || howmanytest<=0) … … 422 447 *fLog << "=============================================" << endl; 423 448 449 //-------------------------- 450 // write out test matrix 451 452 if (filetest != "") 453 { 454 TFile filete(filetest, "RECREATE", ""); 455 fMatrixTest->Write(); 456 filete.Close(); 457 458 *fLog << "MCT1FindSupercuts::DefineTestMatrix; Test matrix was written onto file '" 459 << filetest << "'" << endl; 460 } 461 462 424 463 return kTRUE; 425 464 } … … 434 473 const TString &name, 435 474 const Int_t howmanytrain, MH3 &hreftrain, 436 const Int_t howmanytest, MH3 &hreftest) 475 const Int_t howmanytest, MH3 &hreftest, 476 const TString &filetrain, const TString &filetest) 437 477 { 438 478 *fLog << "=============================================" << endl; … … 511 551 evtloop.SetProgressBar(&bar); 512 552 513 if (!evtloop.Eventloop()) 553 Int_t maxev = -1; 554 if (!evtloop.Eventloop(maxev)) 514 555 return kFALSE; 515 556 … … 520 561 if (TMath::Abs(generatedtrain-howmanytrain) > TMath::Sqrt(9.*howmanytrain)) 521 562 { 522 *fLog << "MCT1FindSupercuts::DefineTrain Matrix; no.of generated events ("563 *fLog << "MCT1FindSupercuts::DefineTrainTestMatrix; no.of generated events (" 523 564 << generatedtrain 524 565 << ") is incompatible with the no.of requested events (" … … 530 571 if (TMath::Abs(generatedtest-howmanytest) > TMath::Sqrt(9.*howmanytest)) 531 572 { 532 *fLog << "MCT1FindSupercuts::DefineT estMatrix; no.of generated events ("573 *fLog << "MCT1FindSupercuts::DefineTrainTestMatrix; no.of generated events (" 533 574 << generatedtest 534 575 << ") is incompatible with the no.of requested events (" … … 541 582 542 583 584 //-------------------------- 585 // write out training matrix 586 587 if (filetrain != "") 588 { 589 TFile filetr(filetrain, "RECREATE"); 590 fMatrixTrain->Write(); 591 filetr.Close(); 592 593 *fLog << "MCT1FindSupercuts::DefineTrainTestMatrix; Training matrix was written onto file '" 594 << filetrain << "'" << endl; 595 } 596 597 //-------------------------- 598 // write out test matrix 599 600 if (filetest != "") 601 { 602 TFile filete(filetest, "RECREATE", ""); 603 fMatrixTest->Write(); 604 filete.Close(); 605 606 *fLog << "MCT1FindSupercuts::DefineTrainTestMatrix; Test matrix was written onto file '" 607 << filetest << "'" << endl; 608 } 609 543 610 return kTRUE; 544 611 } … … 548 615 // Read training and test matrices from files 549 616 // 550 //551 // $$$$$$$$$$$$$$ this does not work !!! ??? $$$$$$$$$$$$$$$$$$$$$$552 617 // 553 618 … … 563 628 *fLog << "MCT1FindSupercuts::ReadMatrix; Training matrix was read in from file '" 564 629 << filetrain << "'" << endl; 630 filetr.Close(); 565 631 566 632 … … 574 640 *fLog << "MCT1FindSupercuts::ReadMatrix; Test matrix was read in from file '" 575 641 << filetest << "'" << endl; 576 642 filete.Close(); 577 643 578 644 return kTRUE; 579 645 } 580 646 581 // --------------------------------------------------------------------------582 //583 // Write training and test matrices onto files584 //585 //586 // $$$$$$$$$$$$$$ this does not work !!! ??? $$$$$$$$$$$$$$$$$$$$$$587 //588 //589 Bool_t MCT1FindSupercuts::WriteMatrix(const TString &filetrain, const TString &filetest)590 {591 //--------------------------592 // write out training matrix593 594 TFile filetr(filetrain, "RECREATE");595 596 *fLog << "nach TFile" << endl;597 598 fMatrixTrain->Write();599 600 *fLog << "MCT1FindSupercuts::WriteMatrix; Training matrix was written onto file '"601 << filetrain << "'" << endl;602 603 604 //--------------------------605 // write out test matrix606 607 TFile filete(filetest, "RECREATE");608 fMatrixTest->Print("SizeCols");609 fMatrixTest->Write();610 611 *fLog << "MCT1FindSupercuts::WriteMatrix; Test matrix was written onto file '"612 << filetest << "'" << endl;613 614 615 return kTRUE;616 }617 647 618 648 //------------------------------------------------------------------------ … … 645 675 // put the supercuts hadronness 646 676 // 647 // - for the minimization, the starting values of the parameters are taken as 648 // MCT1Supercuts::GetParameters(fVinit) 677 // - for the minimization, the starting values of the parameters are taken 678 // - from file parSCinit (if it is != "") 679 // - or from the arrays params and/or steps 649 680 // 650 681 //---------------------------------------------------------------------- 651 Bool_t MCT1FindSupercuts::FindParams() 682 Bool_t MCT1FindSupercuts::FindParams(TString parSCinit, 683 TArrayD ¶ms, TArrayD &steps) 652 684 { 653 685 // Setup the event loop which will be executed in the 654 686 // fcnSupercuts function of MINUIT 655 687 // 688 // parSCinit is the name of the file containing the initial values 689 // of the parameters; 690 // if parSCinit = "" 'params' and 'steps' are taken as initial values 656 691 657 692 *fLog << "=============================================" << endl; … … 685 720 MMatrixLoop loop(fMatrixTrain); 686 721 722 //-------------------------------- 687 723 // create container for the supercut parameters 688 // and set them to their defaultvalues724 // and set them to their initial values 689 725 MCT1Supercuts super; 690 726 727 // take initial values from file parSCinit 728 if (parSCinit != "") 729 { 730 TFile inparam(parSCinit); 731 super.Read("MCT1Supercuts"); 732 inparam.Close(); 733 *fLog << "MCT1FindSupercuts::FindParams; initial values of parameters are taken from file " 734 << parSCinit << endl; 735 } 736 737 // take initial values from 'params' and/or 'steps' 738 else if (params.GetSize() != 0 || steps.GetSize() != 0 ) 739 { 740 if (params.GetSize() != 0) 741 { 742 *fLog << "MCT1FindSupercuts::FindParams; initial values of parameters are taken from 'params'" 743 << endl; 744 super.SetParameters(params); 745 } 746 if (steps.GetSize() != 0) 747 { 748 *fLog << "MCT1FindSupercuts::FindParams; initial step sizes are taken from 'steps'" 749 << endl; 750 super.SetStepsizes(steps); 751 } 752 } 753 else 754 { 755 *fLog << "MCT1FindSupercuts::FindParams; initial values and step sizes are taken from the MCT1Supercits constructor" 756 << endl; 757 } 758 759 760 //-------------------------------- 691 761 // calculate supercuts hadronness 692 762 fCalcHadTrain->SetHadronnessName(fHadronnessName); … … 761 831 // 762 832 763 // get initial values of parameters from MCT1Supercuts833 // get initial values of parameters 764 834 fVinit = super.GetParameters(); 835 fStep = super.GetStepsizes(); 765 836 766 837 TString name[fVinit.GetSize()]; … … 776 847 name[i] = "p"; 777 848 name[i] += i+1; 778 fStep[i] = TMath::Abs(fVinit[i]/10.0);849 //fStep[i] = TMath::Abs(fVinit[i]/10.0); 779 850 fLimlo[i] = -100.0; 780 851 fLimup[i] = 100.0; 781 852 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 } 789 } 853 } 854 855 // these parameters make no sense, fix them at 0.0 856 fVinit[33] = 0.0; 857 fStep[33] = 0.0; 858 fFix[33] = 1; 859 860 fVinit[36] = 0.0; 861 fStep[36] = 0.0; 862 fFix[36] = 1; 863 864 fVinit[39] = 0.0; 865 fStep[39] = 0.0; 866 fFix[39] = 1; 867 868 fVinit[41] = 0.0; 869 fStep[41] = 0.0; 870 fFix[41] = 1; 871 872 fVinit[44] = 0.0; 873 fStep[44] = 0.0; 874 fFix[44] = 1; 875 876 fVinit[47] = 0.0; 877 fStep[47] = 0.0; 878 fFix[47] = 1; 879 880 // vary only first 48 parameters 881 //for (UInt_t i=0; i<fNpar; i++) 882 //{ 883 // if (i >= 48) 884 // { 885 // fStep[i] = 0.0; 886 // fFix[i] = 1; 887 // } 888 //} 889 790 890 791 891 // ------------------------------------------- … … 910 1010 MH3 alphabefore("MatrixTest[7]"); 911 1011 alphabefore.SetName(mh3NameB); 1012 1013 TH1 &alphahistb = alphabefore.GetHist(); 1014 alphahistb.SetName("alphaBefore-TestParams"); 1015 912 1016 MFillH fillalphabefore(&alphabefore); 913 1017 fillalphabefore.SetName("FillAlphaBefore"); … … 924 1028 MH3 alphaafter("MatrixTest[7]"); 925 1029 alphaafter.SetName(mh3NameA); 1030 1031 TH1 &alphahista = alphaafter.GetHist(); 1032 alphahista.SetName("alphaAfter-TestParams"); 1033 926 1034 MFillH fillalphaafter(&alphaafter); 927 1035 fillalphaafter.SetName("FillAlphaAfter"); … … 978 1086 TH1 &alphaHist2 = alphaAfter->GetHist(); 979 1087 alphaHist2.SetXTitle("|\\alpha| [\\circ]"); 1088 alphaHist2.SetName("alpha-TestParams)"); 980 1089 981 1090 TCanvas *c = new TCanvas("AlphaAfterSC", "AlphaTest", 600, 300); … … 999 1108 const Double_t alphamin = 30.0; 1000 1109 const Double_t alphamax = 90.0; 1001 const Int_t degree = 4;1110 const Int_t degree = 2; 1002 1111 const Bool_t drawpoly = kTRUE; 1003 1112 const Bool_t fitgauss = kFALSE; … … 1025 1134 return kTRUE; 1026 1135 } 1136 -
trunk/MagicSoft/Mars/manalysis/MCT1FindSupercuts.h
r2310 r2357 89 89 90 90 Bool_t DefineTrainMatrix(const TString &name, const Int_t howmany, 91 MH3 &href );91 MH3 &href, const TString &filetrain); 92 92 93 93 Bool_t DefineTestMatrix(const TString &name, const Int_t howmany, 94 MH3 &href );94 MH3 &href, const TString &filetest); 95 95 96 96 Bool_t DefineTrainTestMatrix(const TString &name, 97 const Int_t howmanytrain, MH3 &hreftrain, 98 const Int_t howmanytest, MH3 &hreftest); 97 const Int_t howmanytrain, MH3 &hreftrain, 98 const Int_t howmanytest, MH3 &hreftest, 99 const TString &filetrain, const TString &filetest); 100 101 MHMatrix *GetMatrixTrain() { return fMatrixTrain; } 102 MHMatrix *GetMatrixTest() { return fMatrixTest; } 99 103 100 104 Bool_t ReadMatrix( const TString &filetrain, const TString &filetest); 101 Bool_t WriteMatrix(const TString &filetrain, const TString &filetest);102 105 103 Bool_t FindParams( );106 Bool_t FindParams(TString parSCinit, TArrayD ¶ms, TArrayD &steps); 104 107 Bool_t TestParams(); 105 108 -
trunk/MagicSoft/Mars/manalysis/MCT1Supercuts.cc
r2318 r2357 50 50 // 51 51 MCT1Supercuts::MCT1Supercuts(const char *name, const char *title) 52 : fParameters(72),53 fLengthUp(fParameters.GetArray()), fLengthLo(fParameters.GetArray()+8),52 : fParameters(104), fStepsizes(104), 53 fLengthUp(fParameters.GetArray()), fLengthLo(fParameters.GetArray()+8), 54 54 fWidthUp(fParameters.GetArray()+16), fWidthLo(fParameters.GetArray()+24), 55 fDistUp(fParameters.GetArray()+32), fDistLo(fParameters.GetArray()+40), 56 fAsymUp(fParameters.GetArray()+48), fAsymLo(fParameters.GetArray()+56), 57 fAlphaUp(fParameters.GetArray()+64) 55 fDistUp(fParameters.GetArray()+32), fDistLo(fParameters.GetArray()+40), 56 fAsymUp(fParameters.GetArray()+48), fAsymLo(fParameters.GetArray()+56), 57 fConcUp(fParameters.GetArray()+64), fConcLo(fParameters.GetArray()+72), 58 fLeakage1Up(fParameters.GetArray()+80), fLeakage1Lo(fParameters.GetArray()+88), 59 fAlphaUp(fParameters.GetArray()+96) 58 60 { 59 61 fName = name ? name : "MCT1Supercuts"; … … 71 73 void MCT1Supercuts::InitParameters() 72 74 { 75 //--------------------------------------------------- 76 // these are Daniel's original values for Mkn 421 77 73 78 fLengthUp[0] = 0.315585; 74 79 fLengthUp[1] = 0.001455; … … 80 85 fLengthUp[7] = -0.013463; 81 86 87 fLengthLo[0] = 0.151530; 88 fLengthLo[1] = 0.028323; 89 fLengthLo[2] = 0.510707; 90 fLengthLo[3] = 0.053089; 91 fLengthLo[4] = 0.013708; 92 fLengthLo[5] = 2.357993; 93 fLengthLo[6] = 0.000080; 94 fLengthLo[7] = -0.007157; 95 82 96 fWidthUp[0] = 0.145412; 83 97 fWidthUp[1] = -0.001771; … … 89 103 fWidthUp[7] = -0.016703; 90 104 105 fWidthLo[0] = 0.089187; 106 fWidthLo[1] = -0.006430; 107 fWidthLo[2] = 0.074442; 108 fWidthLo[3] = 0.003738; 109 fWidthLo[4] = -0.004256; 110 fWidthLo[5] = -0.014101; 111 fWidthLo[6] = 0.006126; 112 fWidthLo[7] = -0.002849; 113 91 114 fDistUp[0] = 1.787943; 92 115 fDistUp[1] = 0; … … 98 121 fDistUp[7] = 0; 99 122 100 fLengthLo[0] = 0.151530;101 fLengthLo[1] = 0.028323;102 fLengthLo[2] = 0.510707;103 fLengthLo[3] = 0.053089;104 fLengthLo[4] = 0.013708;105 fLengthLo[5] = 2.357993;106 fLengthLo[6] = 0.000080;107 fLengthLo[7] = -0.007157;108 109 fWidthLo[0] = 0.089187;110 fWidthLo[1] = -0.006430;111 fWidthLo[2] = 0.074442;112 fWidthLo[3] = 0.003738;113 fWidthLo[4] = -0.004256;114 fWidthLo[5] = -0.014101;115 fWidthLo[6] = 0.006126;116 fWidthLo[7] = -0.002849;117 118 123 fDistLo[0] = 0.589406; 119 124 fDistLo[1] = 0; … … 124 129 fDistLo[6] = -0.001750; 125 130 fDistLo[7] = 0; 126 127 fAsymUp[0] = 0.061267; 128 fAsymUp[1] = 0.014462; 129 fAsymUp[2] = 0.014327; 130 fAsymUp[3] = 0.014540; 131 fAsymUp[4] = 0.013391; 132 fAsymUp[5] = 0.012319; 133 fAsymUp[6] = 0.010444; 134 fAsymUp[7] = 0.008328; 135 136 fAsymLo[0] = -0.012055; 137 fAsymLo[1] = 0.009157; 138 fAsymLo[2] = 0.005441; 139 fAsymLo[3] = 0.000399; 140 fAsymLo[4] = 0.001433; 141 fAsymLo[5] = -0.002050; 142 fAsymLo[6] = -0.000104; 143 fAsymLo[7] = -0.001188; 131 132 133 // dummy values 134 135 fAsymUp[0] = 1.e10; 136 fAsymUp[1] = 0.0; 137 fAsymUp[2] = 0.0; 138 fAsymUp[3] = 0.0; 139 fAsymUp[4] = 0.0; 140 fAsymUp[5] = 0.0; 141 fAsymUp[6] = 0.0; 142 fAsymUp[7] = 0.0; 143 144 fAsymLo[0] = -1.e10; 145 fAsymLo[1] = 0.0; 146 fAsymLo[2] = 0.0; 147 fAsymLo[3] = 0.0; 148 fAsymLo[4] = 0.0; 149 fAsymLo[5] = 0.0; 150 fAsymLo[6] = 0.0; 151 fAsymLo[7] = 0.0; 152 153 fConcUp[0] = 1.e10; 154 fConcUp[1] = 0.0; 155 fConcUp[2] = 0.0; 156 fConcUp[3] = 0.0; 157 fConcUp[4] = 0.0; 158 fConcUp[5] = 0.0; 159 fConcUp[6] = 0.0; 160 fConcUp[7] = 0.0; 161 162 fConcLo[0] = -1.e10; 163 fConcLo[1] = 0.0; 164 fConcLo[2] = 0.0; 165 fConcLo[3] = 0.0; 166 fConcLo[4] = 0.0; 167 fConcLo[5] = 0.0; 168 fConcLo[6] = 0.0; 169 fConcLo[7] = 0.0; 170 171 fLeakage1Up[0] = 1.e10; 172 fLeakage1Up[1] = 0.0; 173 fLeakage1Up[2] = 0.0; 174 fLeakage1Up[3] = 0.0; 175 fLeakage1Up[4] = 0.0; 176 fLeakage1Up[5] = 0.0; 177 fLeakage1Up[6] = 0.0; 178 fLeakage1Up[7] = 0.0; 179 180 fLeakage1Lo[0] = -1.e10; 181 fLeakage1Lo[1] = 0.0; 182 fLeakage1Lo[2] = 0.0; 183 fLeakage1Lo[3] = 0.0; 184 fLeakage1Lo[4] = 0.0; 185 fLeakage1Lo[5] = 0.0; 186 fLeakage1Lo[6] = 0.0; 187 fLeakage1Lo[7] = 0.0; 144 188 145 189 fAlphaUp[0] = 13.123440; … … 151 195 fAlphaUp[6] = 0; 152 196 fAlphaUp[7] = 0; 197 198 //--------------------------------------------------- 199 // fStepsizes 200 // if == 0.0 the parameter will be fixed in the minimization 201 // != 0.0 initial step sizes for the parameters 202 203 // LengthUp 204 fStepsizes[0] = 0.03; 205 fStepsizes[1] = 0.0002; 206 fStepsizes[2] = 0.02; 207 fStepsizes[3] = 0.0006; 208 fStepsizes[4] = 0.0002; 209 fStepsizes[5] = 0.002; 210 fStepsizes[6] = 0.0008; 211 fStepsizes[7] = 0.002; 212 213 // LengthLo 214 fStepsizes[8] = 0.02; 215 fStepsizes[9] = 0.003; 216 fStepsizes[10] = 0.05; 217 fStepsizes[11] = 0.006; 218 fStepsizes[12] = 0.002; 219 fStepsizes[13] = 0.3; 220 fStepsizes[14] = 0.0001; 221 fStepsizes[15] = 0.0008; 222 223 // WidthUp 224 fStepsizes[16] = 0.02; 225 fStepsizes[17] = 0.0002; 226 fStepsizes[18] = 0.006; 227 fStepsizes[19] = 0.003; 228 fStepsizes[20] = 0.002; 229 fStepsizes[21] = 0.006; 230 fStepsizes[22] = 0.002; 231 fStepsizes[23] = 0.002; 232 233 // WidthLo 234 fStepsizes[24] = 0.009; 235 fStepsizes[25] = 0.0007; 236 fStepsizes[26] = 0.008; 237 fStepsizes[27] = 0.0004; 238 fStepsizes[28] = 0.0005; 239 fStepsizes[29] = 0.002; 240 fStepsizes[30] = 0.0007; 241 fStepsizes[31] = 0.003; 242 243 // DistUp 244 fStepsizes[32] = 0.2; 245 fStepsizes[33] = 0.0; 246 fStepsizes[34] = 0.3; 247 fStepsizes[35] = 0.02; 248 fStepsizes[36] = 0.0; 249 fStepsizes[37] = 0.03; 250 fStepsizes[38] = 0.02; 251 fStepsizes[39] = 0.0; 252 253 // DistLo 254 fStepsizes[40] = 0.06; 255 fStepsizes[41] = 0.0; 256 fStepsizes[42] = 0.009; 257 fStepsizes[43] = 0.0008; 258 fStepsizes[44] = 0.0; 259 fStepsizes[45] = 0.005; 260 fStepsizes[46] = 0.0002; 261 fStepsizes[47] = 0.0; 262 263 // AsymUp 264 fStepsizes[48] = 0.0; 265 fStepsizes[49] = 0.0; 266 fStepsizes[50] = 0.0; 267 fStepsizes[51] = 0.0; 268 fStepsizes[52] = 0.0; 269 fStepsizes[53] = 0.0; 270 fStepsizes[54] = 0.0; 271 fStepsizes[55] = 0.0; 272 273 // AsymLo 274 fStepsizes[56] = 0.0; 275 fStepsizes[57] = 0.0; 276 fStepsizes[58] = 0.0; 277 fStepsizes[59] = 0.0; 278 fStepsizes[60] = 0.0; 279 fStepsizes[61] = 0.0; 280 fStepsizes[62] = 0.0; 281 fStepsizes[63] = 0.0; 282 283 // ConcUp 284 fStepsizes[64] = 0.0; 285 fStepsizes[65] = 0.0; 286 fStepsizes[66] = 0.0; 287 fStepsizes[67] = 0.0; 288 fStepsizes[68] = 0.0; 289 fStepsizes[69] = 0.0; 290 fStepsizes[70] = 0.0; 291 fStepsizes[71] = 0.0; 292 293 // ConcLo 294 fStepsizes[72] = 0.0; 295 fStepsizes[73] = 0.0; 296 fStepsizes[74] = 0.0; 297 fStepsizes[75] = 0.0; 298 fStepsizes[76] = 0.0; 299 fStepsizes[77] = 0.0; 300 fStepsizes[78] = 0.0; 301 fStepsizes[79] = 0.0; 302 303 // Leakage1Up 304 fStepsizes[80] = 0.0; 305 fStepsizes[81] = 0.0; 306 fStepsizes[82] = 0.0; 307 fStepsizes[83] = 0.0; 308 fStepsizes[84] = 0.0; 309 fStepsizes[85] = 0.0; 310 fStepsizes[86] = 0.0; 311 fStepsizes[87] = 0.0; 312 313 // Leakage1Lo 314 fStepsizes[88] = 0.0; 315 fStepsizes[89] = 0.0; 316 fStepsizes[90] = 0.0; 317 fStepsizes[91] = 0.0; 318 fStepsizes[92] = 0.0; 319 fStepsizes[93] = 0.0; 320 fStepsizes[94] = 0.0; 321 fStepsizes[95] = 0.0; 322 323 // AlphaUp 324 fStepsizes[96] = 0.0; 325 fStepsizes[97] = 0.0; 326 fStepsizes[98] = 0.0; 327 fStepsizes[99] = 0.0; 328 fStepsizes[100] = 0.0; 329 fStepsizes[101] = 0.0; 330 fStepsizes[102] = 0.0; 331 fStepsizes[103] = 0.0; 153 332 } 154 333 … … 173 352 } 174 353 175 176 177 178 179 180 181 182 183 184 185 354 // -------------------------------------------------------------------------- 355 // 356 // Set the step sizes from the array 'd' 357 // 358 // 359 Bool_t MCT1Supercuts::SetStepsizes(const TArrayD &d) 360 { 361 if (d.GetSize() != fStepsizes.GetSize()) 362 { 363 *fLog << err << "Sizes of d and of fStepsizes are different : " 364 << d.GetSize() << ", " << fStepsizes.GetSize() << endl; 365 return kFALSE; 366 } 367 368 fStepsizes = d; 369 370 return kTRUE; 371 } 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 -
trunk/MagicSoft/Mars/manalysis/MCT1Supercuts.h
r2311 r2357 14 14 private: 15 15 TArrayD fParameters; // supercut parameters 16 TArrayD fStepsizes; // step sizes of supercut parameters 16 17 17 18 Double_t *fLengthUp; //! … … 23 24 Double_t *fAsymUp; //! 24 25 Double_t *fAsymLo; //! 26 27 Double_t *fConcUp; //! 28 Double_t *fConcLo; //! 29 Double_t *fLeakage1Up; //! 30 Double_t *fLeakage1Lo; //! 31 25 32 Double_t *fAlphaUp; //! 33 26 34 27 35 public: … … 31 39 32 40 Bool_t SetParameters(const TArrayD &d); 41 Bool_t SetStepsizes(const TArrayD &d); 42 33 43 const TArrayD &GetParameters() const { return fParameters; } 44 const TArrayD &GetStepsizes() const { return fStepsizes; } 34 45 35 46 const Double_t *GetLengthUp() const { return fLengthUp; } … … 41 52 const Double_t *GetAsymUp() const { return fAsymUp; } 42 53 const Double_t *GetAsymLo() const { return fAsymLo; } 54 55 const Double_t *GetConcUp() const { return fConcUp; } 56 const Double_t *GetConcLo() const { return fConcLo; } 57 58 const Double_t *GetLeakage1Up() const { return fLeakage1Up; } 59 const Double_t *GetLeakage1Lo() const { return fLeakage1Lo; } 60 43 61 const Double_t *GetAlphaUp() const { return fAlphaUp; } 44 62 … … 47 65 48 66 #endif 67 68 69 -
trunk/MagicSoft/Mars/manalysis/MCT1SupercutsCalc.cc
r2308 r2357 44 44 #include "MHillasExt.h" 45 45 #include "MHillasSrc.h" 46 #include "MNewImagePar.h" 46 47 #include "MMcEvt.hxx" 47 48 #include "MCerPhotEvt.h" … … 65 66 66 67 MCT1SupercutsCalc::MCT1SupercutsCalc(const char *hilname, 67 const char *hilsrcname, const char *name, const char *title) 68 const char *hilsrcname, 69 const char *name, const char *title) 68 70 : fHadronnessName("MHadronness"), fHilName(hilname), fHilSrcName(hilsrcname), 69 fSuperName("MCT1Supercuts") 71 fHilExtName("MHillasExt"), fNewParName("MNewImagePar"), 72 fSuperName("MCT1Supercuts") 70 73 { 71 74 fName = name ? name : "MCT1SupercutsCalc"; … … 101 104 return kFALSE; 102 105 } 103 104 106 105 107 if (fMatrix) … … 114 116 } 115 117 118 fHilExt = (MHillasExt*)pList->FindObject(fHilExtName, "MHillasExt"); 119 if (!fHilExt) 120 { 121 *fLog << err << fHilExtName << " [MHillasExt] not found... aborting." << endl; 122 return kFALSE; 123 } 124 116 125 fHilSrc = (MHillasSrc*)pList->FindObject(fHilSrcName, "MHillasSrc"); 117 126 if (!fHilSrc) 118 127 { 119 128 *fLog << err << fHilSrcName << " [MHillasSrc] not found... aborting." << endl; 129 return kFALSE; 130 } 131 132 fNewPar = (MNewImagePar*)pList->FindObject(fNewParName, "MNewImagePar"); 133 if (!fNewPar) 134 { 135 *fLog << err << fNewParName << " [MNewImagePar] not found... aborting." << endl; 120 136 return kFALSE; 121 137 } … … 172 188 Double_t MCT1SupercutsCalc::GetVal(Int_t i) const 173 189 { 174 return (*fMatrix)[fMap[i]]; 190 191 Double_t val = (*fMatrix)[fMap[i]]; 192 193 194 //*fLog << "MCT1SupercutsCalc::GetVal; i, fMatrix, fMap, val = " 195 // << i << ", " << fMatrix << ", " << fMap[i] << ", " << val << endl; 196 197 198 return val; 175 199 } 176 200 … … 187 211 { 188 212 if (fMatrix) 189 213 return; 190 214 191 215 fMatrix = mat; … … 199 223 fMap[6] = fMatrix->AddColumn("MHillasSrc.fDist"); 200 224 fMap[7] = fMatrix->AddColumn("fabs(MHillasSrc.fAlpha)"); 225 fMap[8] = fMatrix->AddColumn("sgn(MHillasSrc.fCosDeltaAlpha)*(MHillasExt.fM3Long)"); 226 fMap[9] = fMatrix->AddColumn("MNewImagePar.fConc"); 227 fMap[10]= fMatrix->AddColumn("MNewImagePar.fLeakage1"); 201 228 } 202 229 203 230 // --------------------------------------------------------------------------- 204 231 // 205 // Evaluate dynamical supercuts for CT1 Mkn421 2001 (Daniel Kranich) 206 // optimized for mkn 421 2001 data 232 // Evaluate dynamical supercuts 207 233 // 208 234 // set hadronness to 0.25 if cuts are fullfilled … … 222 248 const Double_t dist0 = fMatrix ? GetVal(6) : fHilSrc->GetDist(); 223 249 250 Double_t help; 251 if (!fMatrix) 252 help = TMath::Sign(fHilExt->GetM3Long(), 253 fHilSrc->GetCosDeltaAlpha()); 254 const Double_t asym0 = fMatrix ? GetVal(8) : help; 255 const Double_t conc = fMatrix ? GetVal(9) : fNewPar->GetConc(); 256 const Double_t leakage = fMatrix ? GetVal(10): fNewPar->GetLeakage1(); 257 224 258 const Double_t newdist = dist0 * fMm2Deg; 225 259 … … 236 270 const Double_t length = length0 * fMm2Deg; 237 271 const Double_t width = width0 * fMm2Deg; 238 239 if (newdist < 1.05 && 272 const Double_t asym = asym0 * fMm2Deg; 273 274 /* 275 *fLog << "newdist, length, width, asym, dist, conc, leakage = " 276 << newdist << ", " << length << ", " << width << ", " 277 << asym << ", " << dist << ", " << conc << ", " << leakage 278 << endl; 279 280 *fLog << "upper cuts in newdist, length, width, asym, dist, conc, leakage = " 281 << CtsMCut (fSuper->GetDistUp(), dmls, dmcza, dmls2, dd2) << ", " 282 << CtsMCut (fSuper->GetDistLo(), dmls, dmcza, dmls2, dd2) << ", " 283 284 << CtsMCut (fSuper->GetLengthUp(), dmls, dmcza, dmls2, dd2) << ", " 285 << CtsMCut (fSuper->GetLengthLo(), dmls, dmcza, dmls2, dd2) << ", " 286 287 << CtsMCut (fSuper->GetWidthUp(), dmls, dmcza, dmls2, dd2) << ", " 288 << CtsMCut (fSuper->GetWidthLo(), dmls, dmcza, dmls2, dd2) << ", " 289 290 << CtsMCut (fSuper->GetAsymUp(), dmls, dmcza, dmls2, dd2) << ", " 291 << CtsMCut (fSuper->GetAsymLo(), dmls, dmcza, dmls2, dd2) << ", " 292 293 << CtsMCut (fSuper->GetDistUp(), dmls, dmcza, dmls2, dd2) << ", " 294 << CtsMCut (fSuper->GetDistLo(), dmls, dmcza, dmls2, dd2) << ", " 295 296 << CtsMCut (fSuper->GetConcUp(), dmls, dmcza, dmls2, dd2) << ", " 297 << CtsMCut (fSuper->GetConcLo(), dmls, dmcza, dmls2, dd2) << ", " 298 299 << CtsMCut (fSuper->GetLeakage1Up(), dmls, dmcza, dmls2, dd2) << ", " 300 << CtsMCut (fSuper->GetLeakage1Lo(), dmls, dmcza, dmls2, dd2) << ", " 301 << endl; 302 */ 303 304 305 if ( 306 //dist < 1.05 && 307 //newdist < 1.05 && 308 240 309 newdist < CtsMCut (fSuper->GetDistUp(), dmls, dmcza, dmls2, dd2) && 241 310 newdist > CtsMCut (fSuper->GetDistLo(), dmls, dmcza, dmls2, dd2) && 242 dist < 1.05 && 311 243 312 length < CtsMCut (fSuper->GetLengthUp(), dmls, dmcza, dmls2, dd2) && 244 313 length > CtsMCut (fSuper->GetLengthLo(), dmls, dmcza, dmls2, dd2) && 314 245 315 width < CtsMCut (fSuper->GetWidthUp(), dmls, dmcza, dmls2, dd2) && 246 316 width > CtsMCut (fSuper->GetWidthLo(), dmls, dmcza, dmls2, dd2) && 247 //asym < CtsMCut (fSuper->GetAsymUp(), dmls, dmcza, dmls2, dd2) && 248 //asym > CtsMCut (fSuper->GetAsymLo(), dmls, dmcza, dmls2, dd2) && 317 318 asym < CtsMCut (fSuper->GetAsymUp(), dmls, dmcza, dmls2, dd2) && 319 asym > CtsMCut (fSuper->GetAsymLo(), dmls, dmcza, dmls2, dd2) && 320 249 321 dist < CtsMCut (fSuper->GetDistUp(), dmls, dmcza, dmls2, dd2) && 250 dist > CtsMCut (fSuper->GetDistLo(), dmls, dmcza, dmls2, dd2) ) 251 fHadronness->SetHadronness(0.25); 322 dist > CtsMCut (fSuper->GetDistLo(), dmls, dmcza, dmls2, dd2) && 323 324 conc < CtsMCut (fSuper->GetConcUp(), dmls, dmcza, dmls2, dd2) && 325 conc > CtsMCut (fSuper->GetConcLo(), dmls, dmcza, dmls2, dd2) && 326 327 leakage < CtsMCut (fSuper->GetLeakage1Up(),dmls, dmcza, dmls2, dd2) && 328 leakage > CtsMCut (fSuper->GetLeakage1Lo(),dmls, dmcza, dmls2, dd2) ) 329 330 fHadronness->SetHadronness(0.25); 252 331 else 253 fHadronness->SetHadronness(0.75); 332 fHadronness->SetHadronness(0.75); 333 334 //*fLog << "SChadroness = " << fHadronness->GetHadronness() << endl; 254 335 255 336 fHadronness->SetReadyToSave(); … … 257 338 return kTRUE; 258 339 } 340 341 342 343 344 345 346 347 348 -
trunk/MagicSoft/Mars/manalysis/MCT1SupercutsCalc.h
r2308 r2357 13 13 class MHillas; 14 14 class MHillasSrc; 15 class MHillasExt; 16 class MNewImagePar; 15 17 class MMcEvt; 16 18 class MCerPhotEvt; … … 25 27 MHillas *fHil; 26 28 MHillasSrc *fHilSrc; 29 MHillasExt *fHilExt; 30 MNewImagePar *fNewPar; 27 31 MMcEvt *fMcEvt; 28 32 MHadronness *fHadronness; //! output container for hadronness … … 32 36 TString fHilName; 33 37 TString fHilSrcName; 38 TString fHilExtName; 39 TString fNewParName; 34 40 TString fSuperName; // name of container for supercut parameters 35 41 36 42 Double_t fMm2Deg; //! 37 43 38 Int_t fMap[ 8];//!44 Int_t fMap[11]; //! 39 45 MHMatrix *fMatrix; //! 40 46 … … 63 69 64 70 #endif 71 72 73 74 75 76 77 78 79 80 81 82 -
trunk/MagicSoft/Mars/manalysis/MMinuitInterface.cc
r2318 r2357 103 103 // 3 maximum output, showing progress of minimizations 104 104 // 105 minuit.SetPrintLevel( 1);105 minuit.SetPrintLevel(-1); 106 106 107 107 //.............................................. … … 175 175 176 176 //.............................................. 177 // This doesn't seem to have any effect 177 178 // Set maximum number of iterations (default = 500) 178 179 //Int_t maxiter = 100000; 179 minuit.SetMaxIterations(10);180 //minuit.SetMaxIterations(maxiter); 180 181 181 182 //.............................................. … … 211 212 if (nulloutput) 212 213 fLog->SetNullOutput(kTRUE); 213 Double_t tmp = 0; 214 minuit.mnexcm("SIMPLEX", &tmp, 0, fErrMinimize); 214 Int_t maxcalls = 3000; 215 Double_t tolerance = 0.1; 216 Double_t tmp[2]; 217 tmp[0] = maxcalls; 218 tmp[1] = tolerance; 219 minuit.mnexcm("SIMPLEX", &tmp[0], 2, fErrMinimize); 215 220 if (nulloutput) 216 221 fLog->SetNullOutput(kFALSE); 217 //*fLog << "return from SIMPLEX" << endl;222 *fLog << "return from SIMPLEX" << endl; 218 223 } 219 224 … … 269 274 // 2 values, errors, step sizes, internal values 270 275 // 3 values, errors, step sizes, 1st derivatives 271 // 4 values, parabol oc errors, MINOS errors276 // 4 values, parabolic errors, MINOS errors 272 277 273 278 //Int_t nkode = 4; … … 292 297 return kTRUE; 293 298 } 299 300 301 302 303 304 305 306 307
Note:
See TracChangeset
for help on using the changeset viewer.