Changeset 2308 for trunk/MagicSoft/Mars/manalysis
- Timestamp:
- 08/21/03 11:12:21 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/manalysis
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MCT1FindSupercuts.cc
r2304 r2308 104 104 MEvtLoop *evtloopfcn = (MEvtLoop*)gMinuit->GetObjectFit(); 105 105 106 MParList *plistfcn = 107 (MParList*)evtloopfcn->GetParList(); 108 109 MCT1Supercuts *super = 110 (MCT1Supercuts*)plistfcn->FindObject("MCT1Supercuts"); 106 MParList *plistfcn = (MParList*)evtloopfcn->GetParList(); 107 108 MCT1Supercuts *super = (MCT1Supercuts*)plistfcn->FindObject("MCT1Supercuts"); 111 109 if (!super) 112 110 { 113 gLog << "fcnSupercuts : MCT1Supercuts object '" << "MCT1Supercuts"111 gLog << "fcnSupercuts : MCT1Supercuts object '" << "MCT1Supercuts" 114 112 << "' not found... aborting" << endl; 115 return; 116 } 117 118 MHCT1Supercuts *plotsuper = 119 (MHCT1Supercuts*)plistfcn->FindObject("MHCT1Supercuts"); 120 if (!plotsuper) 121 { 122 gLog << "fcnSupercuts : MHCT1Supercuts object '" << "MHCT1Supercuts" 123 << "' not found... aborting" << endl; 124 return; 125 } 126 127 128 //------------------------------------------------------- 113 return; 114 } 115 116 // 129 117 // transfer current parameter values to MCT1Supercuts 130 118 // 131 Double_t fMin, fEdm, fErrdef; 132 Int_t fNpari, fNparx, fIstat; 133 gMinuit->mnstat(fMin, fEdm, fErrdef, fNpari, fNparx, fIstat); 134 135 //gLog << "fcnSupercuts : npar, fNpari, fNparx = " << npar << ", " 136 // << fNpari << ", " << fNparx << endl; 137 138 TArrayD d(fNparx, par); 139 super->SetParams(fNparx, d); 140 141 142 //------------------------------------------- 119 super->SetParameters(TArrayD(npar, par)); 120 121 122 // 143 123 // plot alpha with the current cuts 124 // 144 125 evtloopfcn->Eventloop(); 145 126 146 TString mh3Name = "AlphaFcn"; 147 MH3* alpha = (MH3*)plistfcn->FindObject(mh3Name, "MH3"); 127 MH3* alpha = (MH3*)plistfcn->FindObject("AlphaFcn", "MH3"); 128 if (!alpha) 129 return; 148 130 149 131 TH1 &alphaHist = alpha->GetHist(); 150 alphaHist.SetXTitle("|alpha| [\\circ]");132 //alphaHist.SetXTitle("|\\alpha| [\\circ]"); 151 133 152 134 //------------------------------------------- … … 159 141 // calculate significance of gamma signal in the alpha plot 160 142 161 Double_t alphasig = 20.0;162 Double_t alphamin = 30.0;163 Double_t alphamax = 90.0;164 Int_t degree = 4;165 166 Bool_t 167 Bool_t 168 if ( 169 { 170 drawpoly = kTRUE;171 fitgauss = kTRUE;143 const Double_t alphasig = 20.0; 144 const Double_t alphamin = 30.0; 145 const Double_t alphamax = 90.0; 146 const Int_t degree = 4; 147 148 Bool_t drawpoly; 149 Bool_t fitgauss; 150 if (iflag == 3) 151 { 152 drawpoly = kTRUE; 153 fitgauss = kTRUE; 172 154 } 173 155 else 174 156 { 175 drawpoly = kFALSE;176 fitgauss = kFALSE;157 drawpoly = kFALSE; 158 fitgauss = kFALSE; 177 159 } 178 160 drawpoly = kFALSE; 179 161 fitgauss = kFALSE; 180 162 181 Bool_t print= kTRUE;163 const Bool_t print = kTRUE; 182 164 183 165 MHFindSignificance findsig; … … 185 167 findsig.SetReduceDegree(kFALSE); 186 168 187 Bool_t rc = findsig.FindSigma(&alphaHist, alphamin, alphamax, degree,188 169 const Bool_t rc = findsig.FindSigma(&alphaHist, alphamin, alphamax, degree, 170 alphasig, drawpoly, fitgauss, print); 189 171 190 172 //================================================================= … … 196 178 if (!rc) 197 179 { 198 gLog << "fcnSupercuts : FindSigma() failed" << endl;199 f = 1.e10;200 return;180 gLog << "fcnSupercuts : FindSigma() failed" << endl; 181 f = 1.e10; 182 return; 201 183 } 202 184 203 185 // plot some quantities during the optimization 204 plotsuper->Fill(&findsig); 205 186 MHCT1Supercuts *plotsuper = (MHCT1Supercuts*)plistfcn->FindObject("MHCT1Supercuts"); 187 if (plotsuper) 188 plotsuper->Fill(&findsig); 206 189 207 190 //------------------------ 208 191 // get significance 209 Double_t significance = findsig.GetSignificance();210 f = significance>0 .0 ? -significance : 0.0;192 const Double_t significance = findsig.GetSignificance(); 193 f = significance>0 ? -significance : 0; 211 194 212 195 … … 233 216 // 234 217 MCT1FindSupercuts::MCT1FindSupercuts(const char *name, const char *title) 218 : fHowManyTrain(10000), fHowManyTest(10000), fMatrixFilter(NULL) 235 219 { 236 220 fName = name ? name : "MCT1FindSupercuts"; 237 221 fTitle = title ? title : "Optimizer of the supercuts"; 238 239 //---------------------------240 // default values241 fFilenameTrain = "";242 fFilenameTest = "";243 fFilenameParam = "";244 245 fHowManyTrain = 10000;246 fHowManyTest = 10000;247 248 fHadronnessName = "";249 250 fMatrixFilter = NULL;251 222 252 223 //--------------------------- … … 291 262 const Int_t howmanytrain, MH3 &hreftrain) 292 263 { 293 if ( nametrain == "" || howmanytrain <= 0)294 return kFALSE;264 if (nametrain.IsNull() || howmanytrain <= 0) 265 return kFALSE; 295 266 296 267 *fLog << "=============================================" << endl; … … 344 315 fMatrixTrain->Print("SizeCols"); 345 316 Int_t howmanygenerated = fMatrixTrain->GetM().GetNrows(); 346 if ( fabs(howmanygenerated-howmanytrain) > 3.0*sqrt(howmanytrain))317 if (TMath::Abs(howmanygenerated-howmanytrain) > TMath::Sqrt(9.*howmanytrain)) 347 318 { 348 319 *fLog << "MCT1FindSupercuts::DefineTrainMatrix; no.of generated events (" … … 370 341 const Int_t howmanytest, MH3 &hreftest) 371 342 { 372 if ( nametest == "" || howmanytest <= 0)373 return kFALSE;343 if (nametest.IsNull() || howmanytest<=0) 344 return kFALSE; 374 345 375 346 *fLog << "=============================================" << endl; … … 422 393 423 394 fMatrixTest->Print("SizeCols"); 424 Int_t howmanygenerated = fMatrixTest->GetM().GetNrows();425 if ( fabs(howmanygenerated-howmanytest) > 3.0*sqrt(howmanytest))395 const Int_t howmanygenerated = fMatrixTest->GetM().GetNrows(); 396 if (TMath::Abs(howmanygenerated-howmanytest) > TMath::Sqrt(9.*howmanytest)) 426 397 { 427 398 *fLog << "MCT1FindSupercuts::DefineTestMatrix; no.of generated events (" … … 480 451 MContinue cont(&seltrain); 481 452 482 Float_t fcorr = (Float_t)read.GetEntries() / 483 ((Float_t)read.GetEntries()-(Float_t)howmanytrain); 453 const Float_t fcorr = (Float_t)read.GetEntries() / (read.GetEntries()-howmanytrain); 484 454 485 455 *fLog << "entries, howmanytrain, fcorr = " << read.GetEntries() … … 490 460 MFEventSelector seltest; 491 461 seltest.SetName("SelTest"); 492 seltest.SetNumSelectEvts( howmanytest*fcorr);462 seltest.SetNumSelectEvts((Int_t)(fcorr*howmanytest)); 493 463 494 464 MFillH filltest(fMatrixTest); … … 524 494 evtloop.SetProgressBar(&bar); 525 495 526 Int_t maxevents = -1; 527 if ( !evtloop.Eventloop(maxevents) ) 496 if (!evtloop.Eventloop()) 528 497 return kFALSE; 529 498 … … 531 500 532 501 fMatrixTrain->Print("SizeCols"); 533 Int_t generatedtrain = fMatrixTrain->GetM().GetNrows();534 if ( fabs(generatedtrain-howmanytrain) > 3.0*sqrt(howmanytrain))502 const Int_t generatedtrain = fMatrixTrain->GetM().GetNrows(); 503 if (TMath::Abs(generatedtrain-howmanytrain) > TMath::Sqrt(9.*howmanytrain)) 535 504 { 536 505 *fLog << "MCT1FindSupercuts::DefineTrainMatrix; no.of generated events (" … … 541 510 542 511 fMatrixTest->Print("SizeCols"); 543 Int_t generatedtest = fMatrixTest->GetM().GetNrows();544 if ( fabs(generatedtest-howmanytest) > 3.0*sqrt(howmanytest))512 const Int_t generatedtest = fMatrixTest->GetM().GetNrows(); 513 if (TMath::Abs(generatedtest-howmanytest) > TMath::Sqrt(9.*howmanytest)) 545 514 { 546 515 *fLog << "MCT1FindSupercuts::DefineTestMatrix; no.of generated events (" … … 566 535 // 567 536 568 Bool_t MCT1FindSupercuts::ReadMatrix( TString &filetrain,TString &filetest)537 Bool_t MCT1FindSupercuts::ReadMatrix(const TString &filetrain, const TString &filetest) 569 538 { 570 539 //-------------------------- … … 601 570 // 602 571 // 603 Bool_t MCT1FindSupercuts::WriteMatrix( TString &filetrain,TString &filetest)572 Bool_t MCT1FindSupercuts::WriteMatrix(const TString &filetrain, const TString &filetest) 604 573 { 605 574 //-------------------------- 606 575 // write out training matrix 607 576 608 TFile filetr(filetrain, "RECREATE" , "");577 TFile filetr(filetrain, "RECREATE"); 609 578 610 579 *fLog << "nach TFile" << endl; … … 619 588 // write out test matrix 620 589 621 TFile filete(filetest, "RECREATE" , "");590 TFile filete(filetest, "RECREATE"); 622 591 fMatrixTest->Print("SizeCols"); 623 592 fMatrixTest->Write(); … … 628 597 629 598 return kTRUE; 630 631 599 } 632 600 … … 673 641 *fLog << "Setup event loop for fcnSupercuts" << endl; 674 642 675 if ( fHadronnessName == "")643 if (fHadronnessName.IsNull()) 676 644 { 677 645 *fLog << "MCT1FindSupercuts::FindParams; hadronness name is not defined... aborting" … … 680 648 } 681 649 682 if ( 650 if (fMatrixTrain == NULL) 683 651 { 684 652 *fLog << "MCT1FindSupercuts::FindParams; training matrix is not defined... aborting" … … 696 664 // and set them to their default values 697 665 MCT1Supercuts super; 698 super.InitParams();699 666 700 667 // calculate supercuts hadronness … … 706 673 707 674 // plot |alpha| 708 TString mh3Name = "AlphaFcn";675 const TString mh3Name = "AlphaFcn"; 709 676 MBinning binsalpha("Binning"+mh3Name); 710 677 binsalpha.SetEdges(54, -12.0, 96.0); 678 679 *fLog << warn << "WARNING------------>ALPHA IS ASSUMED TO BE IN COLUMN 7!!!!!!!!" << endl; 711 680 712 681 // |alpha| is assumed to be in column 7 of the matrix … … 745 714 //****************************** 746 715 747 MEvtLoop evtloopfcn ;716 MEvtLoop evtloopfcn("EvtLoopFCN"); 748 717 evtloopfcn.SetParList(&parlistfcn); 749 evtloopfcn.SetName("EvtLoopFCN");750 718 *fLog << "Event loop for fcnSupercuts has been setup" << endl; 751 719 752 720 // address of evtloopfcn is used in CallMinuit() 753 fObjectFit = &evtloopfcn;754 721 755 722 … … 770 737 // 771 738 772 fNpar = 48;773 774 739 // get initial values of parameters from MCT1SupercutsCalc 775 TArrayD vinit(fNpar); 776 super.GetParams(fNpar, vinit); 777 778 for (UInt_t i=0; i<fNpar; i++) 779 { 780 fVinit[i] = vinit[i]; 781 } 782 783 for (UInt_t i=0; i<fNpar; i++) 784 { 785 sprintf(&fParName[i][0], "p%d", i+1); 786 fStep[i] = fabs(fVinit[i]/10.0); 787 fLimlo[i] = -10.0; 788 fLimup[i] = 10.0; 789 fFix[i] = 0; 790 } 791 792 fMethod = "SIMPLEX"; 793 Bool_t nulloutput = kFALSE; 740 fVinit = super.GetParameters(); 741 742 TString name[fVinit.GetSize()]; 743 744 for (Int_t i=0; i<fVinit.GetSize(); i++) 745 { 746 name[i] = "p"; 747 name[i] += i+1; 748 fStep[i] = TMath::Abs(fVinit[i]/10.0); 749 fLimlo[i] = -10.0; 750 fLimup[i] = 10.0; 751 fFix[i] = 0; 752 } 794 753 795 754 // ------------------------------------------- … … 800 759 801 760 MMinuitInterface inter; 802 Bool_t rc = inter.CallMinuit( fcnSupercuts, fNpar, fParName,803 fVinit, fStep, fLimlo, fLimup, fFix,804 fObjectFit, fMethod, nulloutput);761 Bool_t rc = inter.CallMinuit(fcnSupercuts, fParName, 762 fVinit, fStep, fLimlo, fLimup, fFix, 763 &evtloopfcn, "SIMPLEX", kFALSE); 805 764 806 765 *fLog << "Time spent for the minimization in MINUIT : " << endl;; … … 810 769 plotsuper.DrawClone(); 811 770 812 if (!rc) return kFALSE; 771 if (!rc) 772 return kFALSE; 813 773 814 774 *fLog << "Minimization for supercuts finished" << endl; … … 829 789 << fFilenameParam << "' :" << endl; 830 790 831 TArrayD check(72); 832 super.GetParams(72, check); 833 for (Int_t i=0; i<72; i++) 834 { 835 *fLog << check[i] << ", "; 836 } 791 const TArrayD &check = super.GetParameters(); 792 for (Int_t i=0; i<check.GetSize(); i++) 793 *fLog << check[i] << ", "; 837 794 *fLog << endl; 838 795 … … 853 810 Bool_t MCT1FindSupercuts::TestParams() 854 811 { 855 Int_t howmanygenerated = fMatrixTest->GetM().GetNrows(); 856 857 if ( howmanygenerated <= 0 ) 858 { 859 *fLog << "MCT1FindSupercuts::TestParams; test matrix is empty... aborting" 860 << endl; 861 return kFALSE; 812 if (fMatrixTest->GetM().GetNrows() <= 0) 813 { 814 *fLog << "MCT1FindSupercuts::TestParams; test matrix is empty... aborting" << endl; 815 return kFALSE; 862 816 } 863 817 … … 865 819 // 866 820 *fLog << "Test the supercuts on the test sample" << endl; 867 868 821 869 822 // ----------------------------------------------------------------- … … 876 829 inparam.Close(); 877 830 878 *fLog << "Optimum parameter values for supercuts were read from file '" 879 << fFilenameParam << "' :" << endl; 880 881 TArrayD supercutsPar(72);; 882 scin.GetParams(72, supercutsPar); 883 for (Int_t i=0; i<72; i++) 884 { 885 *fLog << supercutsPar[i] << ", "; 886 } 831 *fLog << "Optimum parameter values for supercuts were read from file '"; 832 *fLog << fFilenameParam << "' :" << endl; 833 834 const TArrayD &supercutsPar = scin.GetParameters(); 835 for (Int_t i=0; i<supercutsPar.GetSize(); i++) 836 *fLog << supercutsPar[i] << ", "; 887 837 *fLog << endl; 888 838 //--------------------------- … … 890 840 891 841 // ----------------------------------------------------------------- 892 if ( fHadronnessName == "") 893 { 894 *fLog << "MCT1FindSupercuts::TestParams; hadronness name is not defined... aborting" 895 << endl; 896 return kFALSE; 897 } 898 842 if (fHadronnessName.IsNull()) 843 { 844 *fLog << "MCT1FindSupercuts::TestParams; hadronness name is not defined... aborting"; 845 *fLog << endl; 846 return kFALSE; 847 } 899 848 900 849 MParList parlist2; … … 902 851 903 852 MCT1Supercuts supercuts; 904 supercuts.SetParam s(72,supercutsPar);853 supercuts.SetParameters(supercutsPar); 905 854 906 855 fCalcHadTest->SetHadronnessName(fHadronnessName); … … 912 861 913 862 // plot alpha before applying the supercuts 914 TString mh3NameB = "AlphaBefore";863 const TString mh3NameB = "AlphaBefore"; 915 864 MBinning binsalphabef("Binning"+mh3NameB); 916 865 binsalphabef.SetEdges(54, -12.0, 96.0); … … 927 876 928 877 // plot alpha after applying the supercuts 929 TString mh3NameA = "AlphaAfter";878 const TString mh3NameA = "AlphaAfter"; 930 879 MBinning binsalphaaft("Binning"+mh3NameA); 931 880 binsalphaaft.SetEdges(54, -12.0, 96.0); … … 980 929 // draw the alpha plots 981 930 982 MH3* alphaBefore = (MH3*) (parlist2.FindObject(mh3NameB, "MH3"));931 MH3* alphaBefore = (MH3*)parlist2.FindObject(mh3NameB, "MH3"); 983 932 TH1 &alphaHist1 = alphaBefore->GetHist(); 984 alphaHist1.SetXTitle("| alpha| [\\circ]");985 986 MH3* alphaAfter = (MH3*) (parlist2.FindObject(mh3NameA, "MH3"));933 alphaHist1.SetXTitle("|\\alpha| [\\circ]"); 934 935 MH3* alphaAfter = (MH3*)parlist2.FindObject(mh3NameA, "MH3"); 987 936 TH1 &alphaHist2 = alphaAfter->GetHist(); 988 alphaHist2.SetXTitle("| alpha| [\\circ]");937 alphaHist2.SetXTitle("|\\alpha| [\\circ]"); 989 938 990 939 TCanvas *c = new TCanvas("AlphaAfterSC", "AlphaTest", 600, 300); … … 1005 954 // calculate significance of gamma signal in the alpha plot 1006 955 1007 Double_t alphasig = 20.0; 1008 Double_t alphamin = 30.0; 1009 Double_t alphamax = 90.0; 1010 Int_t degree = 4; 1011 Double_t significance = -99.0; 1012 Bool_t drawpoly = kTRUE; 1013 Bool_t fitgauss = kFALSE; 1014 Bool_t print = kTRUE; 956 const Double_t alphasig = 20.0; 957 const Double_t alphamin = 30.0; 958 const Double_t alphamax = 90.0; 959 const Int_t degree = 4; 960 const Bool_t drawpoly = kTRUE; 961 const Bool_t fitgauss = kFALSE; 962 const Bool_t print = kTRUE; 1015 963 1016 964 MHFindSignificance findsig; … … 1020 968 findsig.FindSigma(&alphaHist2, alphamin, alphamax, degree, 1021 969 alphasig, drawpoly, fitgauss, print); 1022 significance = findsig.GetSignificance(); 1023 Double_t alphasi = findsig.GetAlphasi(); 970 971 const Double_t significance = findsig.GetSignificance(); 972 const Double_t alphasi = findsig.GetAlphasi(); 1024 973 1025 974 *fLog << "Significance of gamma signal after supercuts in test sample : " … … 1034 983 return kTRUE; 1035 984 } 1036 1037 1038 //===========================================================================1039 1040 1041 1042 1043 1044 1045 1046 1047 -
trunk/MagicSoft/Mars/manalysis/MCT1FindSupercuts.h
r2300 r2308 9 9 #include <TArrayD.h> 10 10 #endif 11 #ifndef ROOT_TArrayI 12 #include <TArrayI.h> 13 #endif 11 14 15 class MFilter; 16 class MEvtLoop; 17 class MH3; 18 class MCT1SupercutsCalc; 19 class MGeomCam; 20 class MHMatrix; 21 /* 12 22 #include "MFilter.h" 13 23 #include "MEvtLoop.h" … … 16 26 #include "MGeomCam.h" 17 27 #include "MHMatrix.h" 18 28 */ 19 29 20 30 class MCT1FindSupercuts : public MParContainer … … 46 56 // attention : dimensions must agree with those in 47 57 // MMinuitInterface::CallMinuit() 48 char 49 Double_t fVinit[80];50 Double_t fStep[80];51 Double_t fLimlo[80];52 Double_t fLimup[80];53 Int_t fFix[80];58 char fParName [80][100]; 59 TArrayD fVinit; 60 TArrayD fStep; 61 TArrayD fLimlo; 62 TArrayD fLimup; 63 TArrayI fFix; 54 64 55 65 UInt_t fNpar; … … 88 98 const Int_t howmanytest, MH3 &hreftest); 89 99 90 Bool_t ReadMatrix( TString &filetrain,TString &filetest);91 Bool_t WriteMatrix( TString &filetrain,TString &filetest);100 Bool_t ReadMatrix( const TString &filetrain, const TString &filetest); 101 Bool_t WriteMatrix(const TString &filetrain, const TString &filetest); 92 102 93 103 Bool_t FindParams(); -
trunk/MagicSoft/Mars/manalysis/MCT1Supercuts.cc
r2306 r2308 17 17 ! 18 18 ! Author(s): Wolfgang Wittek, 08/2003 <mailto:wittek@mppmu.mpg.de> 19 ! Author(s): Thomas Bretz, 08/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 20 ! 20 21 ! Copyright: MAGIC Software Development, 2000-2003 … … 49 50 // 50 51 MCT1Supercuts::MCT1Supercuts(const char *name, const char *title) 52 : fParameters(72), 53 fLengthUp(fParameters.GetArray()), fLengthLo(fParameters.GetArray()+8), 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) 51 58 { 52 59 fName = name ? name : "MCT1Supercuts"; 53 60 fTitle = title ? title : "Container for the supercut parameters"; 54 61 55 fNpartot = 72;56 57 fLengthUp.Set(8);58 fLengthLo.Set(8);59 fWidthUp.Set(8);60 fWidthLo.Set(8);61 fDistUp.Set(8);62 fDistLo.Set(8);63 fAsymUp.Set(8);64 fAsymLo.Set(8);65 fAlphaUp.Set(8);66 67 62 // set supercut parameters to their default values 68 InitParam s();63 InitParameters(); 69 64 } 70 65 … … 74 69 // set default values for the supercut parameters 75 70 // 76 void MCT1Supercuts::InitParam s()71 void MCT1Supercuts::InitParameters() 77 72 { 78 //--------------------------------- 79 // supercut parameters 73 fLengthUp[0] = 0.315585; 74 fLengthUp[1] = 0.001455; 75 fLengthUp[2] = 0.203198; 76 fLengthUp[3] = 0.005532; 77 fLengthUp[4] = -0.001670; 78 fLengthUp[5] = -0.020362; 79 fLengthUp[6] = 0.007388; 80 fLengthUp[7] = -0.013463; 80 81 81 f LengthUp[0] = 0.315585;82 f LengthUp[1] = 0.001455;83 f LengthUp[2] = 0.203198;84 f LengthUp[3] = 0.005532;85 f LengthUp[4] =-0.001670;86 f LengthUp[5] =-0.020362;87 f LengthUp[6] = 0.007388;88 f LengthUp[7] =-0.013463;82 fWidthUp[0] = 0.145412; 83 fWidthUp[1] = -0.001771; 84 fWidthUp[2] = 0.054462; 85 fWidthUp[3] = 0.022280; 86 fWidthUp[4] = -0.009893; 87 fWidthUp[5] = 0.056353; 88 fWidthUp[6] = 0.020711; 89 fWidthUp[7] = -0.016703; 89 90 90 f WidthUp[0] = 0.145412;91 f WidthUp[1] =-0.001771;92 f WidthUp[2] = 0.054462;93 f WidthUp[3] = 0.022280;94 f WidthUp[4] =-0.009893;95 f WidthUp[5] = 0.056353;96 f WidthUp[6] = 0.020711;97 f WidthUp[7] =-0.016703;91 fDistUp[0] = 1.787943; 92 fDistUp[1] = 0; 93 fDistUp[2] = 2.942310; 94 fDistUp[3] = 0.199815; 95 fDistUp[4] = 0; 96 fDistUp[5] = 0.249909; 97 fDistUp[6] = 0.189697; 98 fDistUp[7] = 0; 98 99 99 f DistUp[0] = 1.787943;100 f DistUp[1] = 0.;101 f DistUp[2] = 2.942310;102 f DistUp[3] = 0.199815;103 f DistUp[4] = 0.;104 f DistUp[5] = 0.249909;105 f DistUp[6] = 0.189697;106 f DistUp[7] = 0.;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; 107 108 108 f LengthLo[0] = 0.151530;109 f LengthLo[1] = 0.028323;110 f LengthLo[2] = 0.510707;111 f LengthLo[3] = 0.053089;112 f LengthLo[4] = 0.013708;113 f LengthLo[5] = 2.357993;114 f LengthLo[6] = 0.000080;115 f LengthLo[7] =-0.007157;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; 116 117 117 f WidthLo[0] = 0.089187;118 f WidthLo[1] =-0.006430;119 f WidthLo[2] = 0.074442;120 f WidthLo[3] = 0.003738;121 f WidthLo[4] =-0.004256;122 f WidthLo[5] =-0.014101;123 f WidthLo[6] = 0.006126;124 f WidthLo[7] =-0.002849;118 fDistLo[0] = 0.589406; 119 fDistLo[1] = 0; 120 fDistLo[2] = -0.083964; 121 fDistLo[3] = -0.007975; 122 fDistLo[4] = 0; 123 fDistLo[5] = 0.045374; 124 fDistLo[6] = -0.001750; 125 fDistLo[7] = 0; 125 126 126 f DistLo[0] = 0.589406;127 f DistLo[1] = 0.;128 f DistLo[2] =-0.083964;129 f DistLo[3] =-0.007975;130 f DistLo[4] = 0.;131 f DistLo[5] = 0.045374;132 f DistLo[6] =-0.001750;133 f DistLo[7] = 0.;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; 134 135 135 fAsymUp[0] = 0.061267; 136 fAsymUp[1] = 0.014462; 137 fAsymUp[2] = 0.014327; 138 fAsymUp[3] = 0.014540; 139 fAsymUp[4] = 0.013391; 140 fAsymUp[5] = 0.012319; 141 fAsymUp[6] = 0.010444; 142 fAsymUp[7] = 0.008328; 143 144 fAsymLo[0] =-0.012055; 145 fAsymLo[1] = 0.009157; 146 fAsymLo[2] = 0.005441; 147 fAsymLo[3] = 0.000399; 148 fAsymLo[4] = 0.001433; 149 fAsymLo[5] =-0.002050; 150 fAsymLo[6] =-0.000104; 151 fAsymLo[7] =-0.001188; 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; 152 144 153 145 fAlphaUp[0] = 13.123440; 154 fAlphaUp[1] = 0.; 155 fAlphaUp[2] = 0.; 156 fAlphaUp[3] = 0.; 157 fAlphaUp[4] = 0.; 158 fAlphaUp[5] = 0.; 159 fAlphaUp[6] = 0.; 160 fAlphaUp[7] = 0.; 161 //--------------------------------- 146 fAlphaUp[1] = 0; 147 fAlphaUp[2] = 0; 148 fAlphaUp[3] = 0; 149 fAlphaUp[4] = 0; 150 fAlphaUp[5] = 0; 151 fAlphaUp[6] = 0; 152 fAlphaUp[7] = 0; 162 153 } 163 154 … … 168 159 // 169 160 // 161 Bool_t MCT1Supercuts::SetParameters(const TArrayD &d) 162 { 163 if (d.GetSize() != fParameters.GetSize()) 164 // *fLog << err << ... 165 return kFALSE; 170 166 171 void MCT1Supercuts::SetParams(UInt_t npar, TArrayD &d) 172 { 173 UInt_t ncutpar = fLengthUp.GetSize(); 174 UInt_t k0 = 0; 175 176 for (UInt_t j=0; j<ncutpar; j++) 177 { 178 UInt_t k = k0 + j; 179 if (k >= npar) return; 180 fLengthUp[j] = d[k]; 181 } 182 k0 += ncutpar; 183 184 for (UInt_t j=0; j<ncutpar; j++) 185 { 186 UInt_t k = k0 + j; 187 if (k >= npar) return; 188 fWidthUp[j] = d[k]; 189 } 190 k0 += ncutpar; 191 192 for (UInt_t j=0; j<ncutpar; j++) 193 { 194 UInt_t k = k0 + j; 195 if (k >= npar) return; 196 fDistUp[j] = d[k]; 197 } 198 k0 += ncutpar; 199 200 for (UInt_t j=0; j<ncutpar; j++) 201 { 202 UInt_t k = k0 + j; 203 if (k >= npar) return; 204 fLengthLo[j] = d[k]; 205 } 206 k0 += ncutpar; 207 208 for (UInt_t j=0; j<ncutpar; j++) 209 { 210 UInt_t k = k0 + j; 211 if (k >= npar) return; 212 fWidthLo[j] = d[k]; 213 } 214 k0 += ncutpar; 215 216 for (UInt_t j=0; j<ncutpar; j++) 217 { 218 UInt_t k = k0 + j; 219 if (k >= npar) return; 220 fDistLo[j] = d[k]; 221 } 222 k0 += ncutpar; 223 224 for (UInt_t j=0; j<ncutpar; j++) 225 { 226 UInt_t k = k0 + j; 227 if (k >= npar) return; 228 fAsymUp[j] = d[k]; 229 } 230 k0 += ncutpar; 231 232 for (UInt_t j=0; j<ncutpar; j++) 233 { 234 UInt_t k = k0 + j; 235 if (k >= npar) return; 236 fAsymLo[j] = d[k]; 237 } 238 k0 += ncutpar; 239 240 for (UInt_t j=0; j<ncutpar; j++) 241 { 242 UInt_t k = k0 + j; 243 if (k >= npar) return; 244 fAlphaUp[j] = d[k]; 245 } 246 k0 += ncutpar; 167 fParameters = d; 168 return kTRUE; 247 169 } 248 249 // --------------------------------------------------------------------------250 //251 // Get the parameter values and put them into the array 'd'252 //253 //254 255 void MCT1Supercuts::GetParams(UInt_t npar, TArrayD &d)256 {257 UInt_t ncutpar = fLengthUp.GetSize();258 UInt_t k0 = 0;259 260 for (UInt_t j=0; j<ncutpar; j++)261 {262 UInt_t k = k0 + j;263 if (k >= npar) return;264 d[k] = fLengthUp[j];265 }266 k0 += ncutpar;267 268 for (UInt_t j=0; j<ncutpar; j++)269 {270 UInt_t k = k0 + j;271 if (k >= npar) return;272 d[k] = fWidthUp[j];273 }274 k0 += ncutpar;275 276 for (UInt_t j=0; j<ncutpar; j++)277 {278 UInt_t k = k0 + j;279 if (k >= npar) return;280 d[k] = fDistUp[j];281 }282 k0 += ncutpar;283 284 for (UInt_t j=0; j<ncutpar; j++)285 {286 UInt_t k = k0 + j;287 if (k >= npar) return;288 d[k] = fLengthLo[j];289 }290 k0 += ncutpar;291 292 for (UInt_t j=0; j<ncutpar; j++)293 {294 UInt_t k = k0 + j;295 if (k >= npar) return;296 d[k] = fWidthLo[j];297 }298 k0 += ncutpar;299 300 for (UInt_t j=0; j<ncutpar; j++)301 {302 UInt_t k = k0 + j;303 if (k >= npar) return;304 d[k] = fDistLo[j];305 }306 k0 += ncutpar;307 308 for (UInt_t j=0; j<ncutpar; j++)309 {310 UInt_t k = k0 + j;311 if (k >= npar) return;312 d[k] = fAsymUp[j];313 }314 k0 += ncutpar;315 316 for (UInt_t j=0; j<ncutpar; j++)317 {318 UInt_t k = k0 + j;319 if (k >= npar) return;320 d[k] = fAsymLo[j];321 }322 k0 += ncutpar;323 324 for (UInt_t j=0; j<ncutpar; j++)325 {326 UInt_t k = k0 + j;327 if (k >= npar) return;328 d[k] = fAlphaUp[j];329 }330 }331 //==========================================================================332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 -
trunk/MagicSoft/Mars/manalysis/MCT1Supercuts.h
r2300 r2308 2 2 #define MARS_MCT1Supercuts 3 3 4 #ifndef MARS_MParContainer 5 #include "MParContainer.h" 6 #endif 4 7 5 8 #ifndef ROOT_TArrayD … … 7 10 #endif 8 11 9 #ifndef ROOT_TString10 #include <TString.h>11 #endif12 13 #ifndef MARS_MParContainer14 #include <MParContainer.h>15 #endif16 17 18 19 12 class MCT1Supercuts : public MParContainer 20 13 { 21 14 private: 15 TArrayD fParameters; // supercut parameters 22 16 23 UInt_t fNpartot; 24 25 //--------------------------------- 26 // supercut parameters 27 28 TArrayD fLengthUp; 29 TArrayD fLengthLo; 30 TArrayD fWidthUp; 31 TArrayD fWidthLo; 32 TArrayD fDistUp; 33 TArrayD fDistLo; 34 TArrayD fAsymUp; 35 TArrayD fAsymLo; 36 TArrayD fAlphaUp; 37 //--------------------------------- 38 17 Double_t *fLengthUp; //! 18 Double_t *fLengthLo; //! 19 Double_t *fWidthUp; //! 20 Double_t *fWidthLo; //! 21 Double_t *fDistUp; //! 22 Double_t *fDistLo; //! 23 Double_t *fAsymUp; //! 24 Double_t *fAsymLo; //! 25 Double_t *fAlphaUp; //! 39 26 40 27 public: 41 28 MCT1Supercuts(const char *name=NULL, const char *title=NULL); 42 29 43 void InitParam s();30 void InitParameters(); 44 31 45 void SetParams(UInt_t npar,TArrayD &d);46 void GetParams(UInt_t npar, TArrayD &d);32 Bool_t SetParameters(const TArrayD &d); 33 const TArrayD &GetParameters() const; 47 34 48 TArrayD &GetLengthUp(){ return fLengthUp; }49 TArrayD &GetLengthLo(){ return fLengthLo; }50 TArrayD &GetWidthUp(){ return fWidthUp; }51 TArrayD &GetWidthLo(){ return fWidthLo; }52 TArrayD &GetDistUp(){ return fDistUp; }53 TArrayD &GetDistLo(){ return fDistLo; }54 TArrayD &GetAsymUp(){ return fAsymUp; }55 TArrayD &GetAsymLo(){ return fAsymLo; }56 TArrayD &GetAlphaUp(){ return fAlphaUp; }35 const Double_t *GetLengthUp() const { return fLengthUp; } 36 const Double_t *GetLengthLo() const { return fLengthLo; } 37 const Double_t *GetWidthUp() const { return fWidthUp; } 38 const Double_t *GetWidthLo() const { return fWidthLo; } 39 const Double_t *GetDistUp() const { return fDistUp; } 40 const Double_t *GetDistLo() const { return fDistLo; } 41 const Double_t *GetAsymUp() const { return fAsymUp; } 42 const Double_t *GetAsymLo() const { return fAsymLo; } 43 const Double_t *GetAlphaUp() const { return fAlphaUp; } 57 44 58 45 ClassDef(MCT1Supercuts, 1) // A container for the Supercut parameters … … 60 47 61 48 #endif 62 63 64 65 66 67 68 69 70 71 72 73 74 75 -
trunk/MagicSoft/Mars/manalysis/MCT1SupercutsCalc.cc
r2306 r2308 136 136 // Calculation of upper and lower limits 137 137 // 138 Double_t MCT1SupercutsCalc::CtsMCut( TArrayD &a, Double_t ls, Double_t ct,139 Double_t ls2, Double_t dd2) 138 Double_t MCT1SupercutsCalc::CtsMCut(const Double_t* a, Double_t ls, Double_t ct, 139 Double_t ls2, Double_t dd2) const 140 140 { 141 141 // define cut-function … … 257 257 return kTRUE; 258 258 } 259 //==========================================================================260 261 262 263 -
trunk/MagicSoft/Mars/manalysis/MCT1SupercutsCalc.h
r2300 r2308 2 2 #define MARS_MCT1SupercutsCalc 3 3 4 #ifndef MARS_M Filter5 #include "M Filter.h"4 #ifndef MARS_MTask 5 #include "MTask.h" 6 6 #endif 7 7 … … 20 20 class MCT1Supercuts; 21 21 22 23 22 class MCT1SupercutsCalc : public MTask 24 23 { … … 27 26 MHillasSrc *fHilSrc; 28 27 MMcEvt *fMcEvt; 29 MHadronness *fHadronness; 30 MCT1Supercuts *fSuper; 28 MHadronness *fHadronness; //! output container for hadronness 29 MCT1Supercuts *fSuper; // container for supercut parameters 31 30 32 TString fHadronnessName;// name of container to store hadronness33 TString 34 TString 35 TString fSuperName;// name of container for supercut parameters31 TString fHadronnessName; // name of container to store hadronness 32 TString fHilName; 33 TString fHilSrcName; 34 TString fSuperName; // name of container for supercut parameters 36 35 37 Double_t fMm2Deg;36 Double_t fMm2Deg; //! 38 37 39 Int_t fMap[8]; 40 MHMatrix *fMatrix; 38 Int_t fMap[8]; //! 39 MHMatrix *fMatrix; //! 41 40 42 41 Int_t PreProcess(MParList *pList); … … 45 44 Double_t GetVal(Int_t i) const; 46 45 47 Double_t CtsMCut( TArrayD &a, Double_t ls, Double_t ct,48 Double_t ls2, Double_t dd2) ;46 Double_t CtsMCut(const Double_t* a, Double_t ls, Double_t ct, 47 Double_t ls2, Double_t dd2) const; 49 48 50 49 public: … … 64 63 65 64 #endif 66 67 68 69 70 71 72 73 74 75 76 77 78 79
Note:
See TracChangeset
for help on using the changeset viewer.