Changeset 6988
- Timestamp:
- 05/02/05 10:17:41 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r6987 r6988 21 21 22 22 -*-*- END OF LINE -*-*- 23 24 2005/05/02 Thomas Bretz 25 26 * ganymed.rc: 27 - updated to the latest changes 28 29 * mhflux/MHAlpha.[h,cc]: 30 - made a base class with the necessary interface to derived classes 31 to support other variables like dca or theta 32 33 * mjobs/MJCut.[h,cc]: 34 - added support for MHAlpha derived classes 35 36 23 37 24 38 2005/04/29 Thomas Bretz -
trunk/MagicSoft/Mars/NEWS
r6985 r6988 46 46 - MEventRateCalc handles the calculation of the event rate more 47 47 accurate now in case of the start of a new run inside a sequence 48 49 - ganymed got support for using other variables than Alpha, eg. Theta. 50 Therefor you need a class deriving from MHAlpha which supports 51 this variable (one is already existing: MHTheta). It is setup 52 through ganymed.rc 48 53 49 54 -
trunk/MagicSoft/Mars/ganymed.rc
r6356 r6988 47 47 #MAlphaFitter.ScaleMax: 80 48 48 #MAlphaFitter.PolynomOrder: 2 49 #/*MISSING*/ ScaleMode 49 #MAlphaFitter.ScaleMode: kSignificance 50 51 # ------------------------------------------------------------------------- 52 # Define here which histogram class to use to determin the signal. 53 # Currently availyble: MHAlpha, MHTheta <default> 54 # ------------------------------------------------------------------------- 55 #MJCut.NameHist: MHAlpha 56 50 57 51 58 # ------------------------------------------------------------------------- … … 66 73 # Get rid of triangular events... 67 74 Cut0.Condition: {0} 68 Cut0.0: 0.33 * log10(MHillas.fSize) < 1.05 - log10(MNewImagePar.fConc)75 Cut0.0: log10(MNewImagePar.fConc1) < (-0.467)*log10(MHillas.fSize) +0.75 69 76 70 77 # If you could setup MFEventSelector by resource file you could use it here … … 92 99 # Setup cuts in false source plot 93 100 # ------------------------------------------------------------------------- 94 MHFalseSource.DistMin: 0.55101 #MHFalseSource.DistMin: 0.55 95 102 #MHFalseSource.DistMax: 0.55 96 103 #MHFalseSource.DWMin: 0.55 97 104 #MHFalseSource.DWMax: 0.55 98 99 # -------------------------------------------------------------------------100 # Energy Estimation101 # -------------------------------------------------------------------------102 103 #EstimateEnergy: MEnergyEstimate104 EstimateEnergy.Rule: {0} + {1} + {2} + {3} + {4} + {5}105 EstimateEnergy.0: 6.3106 EstimateEnergy.1: 0.04*MHillasSrc.fDist*MGeomCam.fConvMm2Deg107 EstimateEnergy.2: -0.13*MHillas.fLength*MGeomCam.fConvMm2Deg108 EstimateEnergy.3: 0.15*MHillas.fSize109 EstimateEnergy.4: 0.0000519*MHillas.fSize*MHillasSrc.fDist*MGeomCam.fConvMm2Deg110 EstimateEnergy.5: 0.0000519*MHillas.fLength*MGeomCam.fConvMm2Deg*MHillasSrc.fDist*MGeomCam.fConvMm2Deg111 112 105 113 106 # ------------------------------------------------------------------------- -
trunk/MagicSoft/Mars/mhflux/MHAlpha.cc
r6977 r6988 18 18 ! Author(s): Thomas Bretz, 3/2004 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 420 ! Copyright: MAGIC Software Development, 2000-2005 21 21 ! 22 22 ! … … 81 81 // 82 82 MHAlpha::MHAlpha(const char *name, const char *title) 83 : fOffData(0), fResult(0), /*fExcess(0),*/ fEnergy(0), fHillas(0), 83 : fNameParameter("MHillasSrc"), fParameter(0), 84 fOffData(0), fResult(0), /*fExcess(0),*/ fEnergy(0), fHillas(0), 84 85 fPointPos(0), fTimeEffOn(0), fTime(0), 85 86 fSkipHistTime(kFALSE), fSkipHistTheta(kFALSE), fSkipHistEnergy(kFALSE), … … 93 94 fTitle = title ? title : "Alpha plot"; 94 95 95 fH Alpha.SetName("Alpha");96 fH Alpha.SetTitle("Alpha");97 fH Alpha.SetXTitle("\\Theta [deg]");98 //fH Alpha.SetYTitle("E_{est} [GeV]");99 fH Alpha.SetZTitle("|\\alpha| [\\circ]");100 fH Alpha.SetDirectory(NULL);101 fH Alpha.UseCurrentStyle();96 fHist.SetName("Alpha"); 97 fHist.SetTitle("Alpha"); 98 fHist.SetXTitle("\\Theta [deg]"); 99 //fHist.SetYTitle("E_{est} [GeV]"); 100 fHist.SetZTitle("|\\alpha| [\\circ]"); 101 fHist.SetDirectory(NULL); 102 fHist.UseCurrentStyle(); 102 103 103 104 // Main histogram 104 fH AlphaTime.SetName("Alpha");105 fH AlphaTime.SetXTitle("|\\alpha| [\\circ]");106 fH AlphaTime.SetYTitle("Counts");107 fH AlphaTime.UseCurrentStyle();108 fH AlphaTime.SetDirectory(NULL);105 fHistTime.SetName("Alpha"); 106 fHistTime.SetXTitle("|\\alpha| [\\circ]"); 107 fHistTime.SetYTitle("Counts"); 108 fHistTime.UseCurrentStyle(); 109 fHistTime.SetDirectory(NULL); 109 110 110 111 … … 142 143 binse.Apply(fHEnergy); 143 144 binst.Apply(fHTheta); 144 binsa.Apply(fHAlphaTime); 145 146 MH::SetBinning(&fHAlpha, &binst, &binse, &binsa); 147 } 148 149 void MHAlpha::FitEnergySpec(Bool_t paint) 150 { 151 /* 152 TF1 f("Spectrum", "pow(x, [0])*exp(-x/[1])*[2]*x");// 153 f.SetParameter(0, -2.1); 154 f.SetParameter(1, 1400); // 50 155 f.SetParameter(2, fHEnergy.Integral()); // 50 156 f.SetLineWidth(2); 157 158 fHEnergy.Fit(&f, "0QI", "", 100, 2400); // Integral? 90, 2800 159 160 const Double_t chi2 = f.GetChisquare(); 161 const Int_t NDF = f.GetNDF(); 162 163 // was fit successful ? 164 const Bool_t ok = NDF>0 && chi2<2.5*NDF; 165 f.SetLineColor(ok ? kGreen : kRed); 166 167 if (paint) 168 { 169 f.Paint("same"); 170 171 if (ok) 172 { 173 TString s; 174 s += Form("\\alpha=%.1f ", f.GetParameter(0)); 175 s += Form("E_{c}=%.1f TeV ", f.GetParameter(1)/1000); 176 s += Form("N=%.1e", f.GetParameter(2)); 177 178 TLatex text(0.25, 0.94, s.Data()); 179 text.SetBit(TLatex::kTextNDC); 180 text.SetTextSize(0.04); 181 text.Paint(); 182 } 183 }*/ 145 binsa.Apply(fHistTime); 146 147 MH::SetBinning(&fHist, &binst, &binse, &binsa); 148 } 149 150 Double_t MHAlpha::GetVal() const 151 { 152 return static_cast<const MHillasSrc*>(fParameter)->GetAlpha(); 184 153 } 185 154 … … 189 158 MAlphaFitter fit(fFit); 190 159 191 const Int_t n = fH Alpha.GetNbinsY();160 const Int_t n = fHist.GetNbinsY(); 192 161 193 162 fHEnergy.SetEntries(0); … … 197 166 for (int i=1; i<=n; i++) 198 167 { 199 if (fit.FitEnergy(fH Alpha, fOffData, i))168 if (fit.FitEnergy(fHist, fOffData, i)) 200 169 { 201 170 fHEnergy.SetBinContent(i, fit.GetEventsExcess()); … … 220 189 MAlphaFitter fit(fFit); 221 190 222 const Int_t n = fH Alpha.GetNbinsX();191 const Int_t n = fHist.GetNbinsX(); 223 192 224 193 fHTheta.SetEntries(0); … … 226 195 for (int i=1; i<=n; i++) 227 196 { 228 if (fit.FitTheta(fH Alpha, fOffData, i))197 if (fit.FitTheta(fHist, fOffData, i)) 229 198 { 230 199 fHTheta.SetBinContent(i, fit.GetEventsExcess()); … … 237 206 } 238 207 208 Bool_t MHAlpha::GetParameter(const MParList &pl) 209 { 210 fParameter = (MParContainer*)pl.FindObject(fNameParameter, "MHillasSrc"); 211 if (fParameter) 212 return kTRUE; 213 214 *fLog << err << fNameParameter << " [MHillasSrc] not found... abort." << endl; 215 return kFALSE; 216 } 217 239 218 Bool_t MHAlpha::SetupFill(const MParList *pl) 240 219 { 241 fH Alpha.Reset();220 fHist.Reset(); 242 221 fHEnergy.Reset(); 243 222 fHTheta.Reset(); 244 223 fHTime.Reset(); 245 224 246 if (fName!=(TString)"MHAlphaOff" && fOffData==NULL) 247 { 248 MHAlpha *hoff = (MHAlpha*)pl->FindObject("MHAlphaOff", "MHAlpha"); 225 const TString off(Form("%sOff", ClassName())); 226 if (fName!=off && fOffData==NULL) 227 { 228 const TString desc(Form("%s [%s] found... using ", off.Data(), ClassName())); 229 MHAlpha *hoff = (MHAlpha*)pl->FindObject(off, ClassName()); 249 230 if (!hoff) 250 *fLog << inf << "No MHAlphaOff [MHAlpha] found... usingcurrent data only!" << endl;231 *fLog << inf << "No " << desc << "current data only!" << endl; 251 232 else 252 233 { 253 *fLog << inf << "MHAlphaOff [MHAlpha] found... usingon-off mode!" << endl;234 *fLog << inf << desc << "on-off mode!" << endl; 254 235 SetOffData(*hoff); 255 236 } 256 237 } 238 239 if (!GetParameter(*pl)) 240 return kFALSE; 257 241 258 242 fHillas = 0; … … 271 255 fHEnergy.SetTitle(" N_{exc} vs. Size "); 272 256 fHEnergy.SetXTitle("Size [phe]"); 273 fH Alpha.SetYTitle("Size [phe]");257 fHist.SetYTitle("Size [phe]"); 274 258 } 275 259 else … … 277 261 fHEnergy.SetTitle(" N_{exc} vs. E_{est} "); 278 262 fHEnergy.SetXTitle("E_{est} [GeV]"); 279 fH Alpha.SetYTitle("E_{est} [GeV]");263 fHist.SetYTitle("E_{est} [GeV]"); 280 264 } 281 265 … … 306 290 307 291 MBinning binst, binse, binsa; 308 binst.SetEdges(fOffData ? *fOffData : fH Alpha, 'x');309 binse.SetEdges(fOffData ? *fOffData : fH Alpha, 'y');310 binsa.SetEdges(fOffData ? *fOffData : fH Alpha, 'z');292 binst.SetEdges(fOffData ? *fOffData : fHist, 'x'); 293 binse.SetEdges(fOffData ? *fOffData : fHist, 'y'); 294 binsa.SetEdges(fOffData ? *fOffData : fHist, 'z'); 311 295 if (!fOffData) 312 296 { … … 324 308 binse.SetEdges(*pl, "BinningSize"); 325 309 326 binsa.SetEdges(*pl, "BinningAlpha");310 binsa.SetEdges(*pl, Form("Binning%s", ClassName()+2)); 327 311 } 328 312 else … … 330 314 fHEnergy.SetTitle(fOffData->GetTitle()); 331 315 fHEnergy.SetXTitle(fOffData->GetYaxis()->GetTitle()); 332 fH Alpha.SetYTitle(fOffData->GetYaxis()->GetTitle());316 fHist.SetYTitle(fOffData->GetYaxis()->GetTitle()); 333 317 } 334 318 335 319 binse.Apply(fHEnergy); 336 320 binst.Apply(fHTheta); 337 binsa.Apply(fH AlphaTime);338 MH::SetBinning(&fH Alpha, &binst, &binse, &binsa);321 binsa.Apply(fHistTime); 322 MH::SetBinning(&fHist, &binst, &binse, &binsa); 339 323 340 324 MAlphaFitter *fit = (MAlphaFitter*)pl->FindObject("MAlphaFitter"); … … 402 386 403 387 TH1D *h = fOffData ? fOffData->ProjectionZ("ProjTimeTemp", -1, 9999, -1, 9999, "E") : 0; 404 const Bool_t rc = fit.ScaleAndFit(fH AlphaTime, h);388 const Bool_t rc = fit.ScaleAndFit(fHistTime, h); 405 389 if (h) 406 390 delete h; … … 410 394 411 395 // Reset Histogram 412 fH AlphaTime.Reset();413 fH AlphaTime.SetEntries(0);396 fHistTime.Reset(); 397 fHistTime.SetEntries(0); 414 398 415 399 // … … 469 453 else 470 454 { 471 const MHillasSrc *hil = dynamic_cast<const MHillasSrc*>(par); 472 if (!par) 473 { 474 *fLog << err << dbginf << "MHillasSrc not found... abort." << endl; 475 return kFALSE; 476 } 477 478 alpha = hil->GetAlpha(); 455 alpha = GetVal(); 479 456 480 457 if (fHillas) … … 491 468 492 469 // Fill histograms 493 fH Alpha.Fill(theta, energy, TMath::Abs(alpha), w);470 fHist.Fill(theta, energy, TMath::Abs(alpha), w); 494 471 495 472 // Check cuts … … 503 480 504 481 if (!fSkipHistTime) 505 fH AlphaTime.Fill(TMath::Abs(alpha), w);482 fHistTime.Fill(TMath::Abs(alpha), w); 506 483 507 484 return kTRUE; … … 557 534 558 535 padsave->cd(1); 559 TH1D *hon = fH Alpha.ProjectionZ("ProjAlpha");536 TH1D *hon = fHist.ProjectionZ("Proj"); 560 537 if (fOffData) 561 538 { 562 TH1D *hoff = fOffData->ProjectionZ("Proj AlphaOff");539 TH1D *hoff = fOffData->ProjectionZ("ProjOff"); 563 540 const Double_t alpha = fFit.Scale(*hoff, *hon); 564 541 … … 569 546 hoff->SetMaximum(alpha); 570 547 571 if ((h0=(TH1D*)gPad->FindObject("Proj AlphaOnOff")))548 if ((h0=(TH1D*)gPad->FindObject("ProjOnOff"))) 572 549 { 573 550 h0->Reset(); … … 583 560 } 584 561 585 if (o==(TString)" alpha")586 if ((h0 = (TH1D*)gPad->FindObject("Proj Alpha")))562 if (o==(TString)"variable") 563 if ((h0 = (TH1D*)gPad->FindObject("Proj"))) 587 564 { 588 565 // Check whether we are dealing with on-off analysis 589 TH1D *hoff = (TH1D*)gPad->FindObject("Proj AlphaOff");566 TH1D *hoff = (TH1D*)gPad->FindObject("ProjOff"); 590 567 591 568 // BE CARFEULL: This is a really weird workaround! … … 603 580 if (o==(TString)"theta") 604 581 { 605 TH1 *h = (TH1*)gPad->FindObject( "Alpha_x");582 TH1 *h = (TH1*)gPad->FindObject(Form("%s_x", fHist.GetName())); 606 583 if (h) 607 584 { 608 TH1D *h2 = (TH1D*)fH Alpha.Project3D("dum_x");585 TH1D *h2 = (TH1D*)fHist.Project3D("dum_x"); 609 586 h2->SetDirectory(0); 610 587 h2->Scale(fHTheta.Integral()/h2->Integral()); … … 618 595 if (o==(TString)"energy") 619 596 { 620 TH1 *h = (TH1*)gPad->FindObject( "Alpha_y");597 TH1 *h = (TH1*)gPad->FindObject(Form("%s_y", fHist.GetName())); 621 598 if (h) 622 599 { 623 TH1D *h2 = (TH1D*)fH Alpha.Project3D("dum_y");600 TH1D *h2 = (TH1D*)fHist.Project3D("dum_y"); 624 601 h2->SetDirectory(0); 625 602 h2->Scale(fHEnergy.Integral()/h2->Integral()); … … 634 611 gPad->SetLogy(); 635 612 } 636 FitEnergySpec(kTRUE);637 613 } 638 614 … … 660 636 gPad->SetBorderMode(0); 661 637 662 h = fH Alpha.ProjectionZ("ProjAlpha", -1, 9999, -1, 9999, "E");638 h = fHist.ProjectionZ("Proj", -1, 9999, -1, 9999, "E"); 663 639 h->SetBit(TH1::kNoTitle); 664 640 h->SetStats(kTRUE); 665 h->SetXTitle( "\\alpha [\\circ]");641 h->SetXTitle(fHist.GetZaxis()->GetTitle()); 666 642 h->SetYTitle("Counts"); 667 643 h->SetDirectory(NULL); … … 674 650 h->SetMarkerColor(kGreen); 675 651 676 h = fOffData->ProjectionZ("Proj AlphaOff", -1, 9999, -1, 9999, "E");652 h = fOffData->ProjectionZ("ProjOff", -1, 9999, -1, 9999, "E"); 677 653 h->SetBit(TH1::kNoTitle); 678 h->SetXTitle( "\\alpha [\\circ]");654 h->SetXTitle(fHist.GetZaxis()->GetTitle()); 679 655 h->SetYTitle("Counts"); 680 656 h->SetDirectory(NULL); … … 684 660 h->Draw("same"); 685 661 686 h = (TH1D*)h->Clone("Proj AlphaOnOff");662 h = (TH1D*)h->Clone("ProjOnOff"); 687 663 h->SetBit(TH1::kNoTitle); 688 h->SetXTitle( "\\alpha [\\circ]");664 h->SetXTitle(fHist.GetZaxis()->GetTitle()); 689 665 h->SetYTitle("Counts"); 690 666 h->SetDirectory(NULL); … … 696 672 TLine lin; 697 673 lin.SetLineStyle(kDashed); 698 lin.DrawLine( 0, 0, 90, 0);674 lin.DrawLine(h->GetXaxis()->GetXmin(), 0, h->GetXaxis()->GetXmax(), 0); 699 675 } 700 676 701 677 // After the Alpha-projection has been drawn. Fit the histogram 702 678 // and paint the result into this pad 703 AppendPad(" alpha");679 AppendPad("variable"); 704 680 705 681 if (fHEnergy.GetNbinsX()>1) … … 713 689 AppendPad("energy"); 714 690 715 h = (TH1D*)fH Alpha.Project3D("y");691 h = (TH1D*)fHist.Project3D("y"); 716 692 h->SetBit(TH1::kNoTitle|TH1::kNoStats); 717 693 h->SetXTitle("E [GeV]"); … … 749 725 AppendPad("theta"); 750 726 751 h = (TH1D*)fH Alpha.Project3D("x");727 h = (TH1D*)fHist.Project3D("x"); 752 728 h->SetBit(TH1::kNoTitle|TH1::kNoStats); 753 729 h->SetXTitle("\\theta [\\circ]"); … … 768 744 // FIXME: Do in Paint if special option given! 769 745 TCanvas *c = new TCanvas; 770 Int_t n = fH Alpha.GetNbinsY();746 Int_t n = fHist.GetNbinsY(); 771 747 Int_t nc = (Int_t)(TMath::Sqrt((Float_t)n-1)+1); 772 748 c->Divide(nc, nc, 1e-10, 1e-10); … … 775 751 MAlphaFitter fit(fFit); 776 752 777 for (int i=1; i<=fH Alpha.GetNbinsY(); i++)753 for (int i=1; i<=fHist.GetNbinsY(); i++) 778 754 { 779 755 c->cd(i); 780 756 781 TH1D *hon = fH Alpha.ProjectionZ("ProjAlpha", -1, 9999, i, i, "E");757 TH1D *hon = fHist.ProjectionZ("Proj", -1, 9999, i, i, "E"); 782 758 hon->SetBit(TH1::kNoTitle); 783 759 hon->SetStats(kTRUE); 784 hon->SetXTitle( "\\alpha [\\circ]");760 hon->SetXTitle(fHist.GetZaxis()->GetTitle()); 785 761 hon->SetYTitle("Counts"); 786 762 hon->SetDirectory(NULL); … … 796 772 hon->SetMarkerColor(kGreen); 797 773 798 hof = fOffData->ProjectionZ("Proj AlphaOff", -1, 9999, i, i, "E");774 hof = fOffData->ProjectionZ("ProjOff", -1, 9999, i, i, "E"); 799 775 hof->SetBit(TH1::kNoTitle|TH1::kNoStats); 800 hof->SetXTitle( "\\alpha [\\circ]");776 hof->SetXTitle(fHist.GetZaxis()->GetTitle()); 801 777 hof->SetYTitle("Counts"); 802 778 hof->SetDirectory(NULL); … … 814 790 diff->Add(hof, -1); 815 791 diff->SetBit(TH1::kNoTitle); 816 diff->SetXTitle( "\\alpha [\\circ]");792 diff->SetXTitle(fHist.GetZaxis()->GetTitle()); 817 793 diff->SetYTitle("Counts"); 818 794 diff->SetDirectory(NULL); … … 824 800 TLine lin; 825 801 lin.SetLineStyle(kDashed); 826 lin.DrawLine( 0, 0, 90, 0);802 lin.DrawLine(diff->GetXaxis()->GetXmin(), 0, diff->GetXaxis()->GetXmax(), 0); 827 803 828 804 const Float_t min = diff->GetMinimum()*1.05; … … 833 809 *fLog << dbg << "Bin " << i << ": sigma=" << fit.GetSignificance() << " omega=" << fit.GetGausSigma() << " events=" << fit.GetEventsExcess() << endl; 834 810 /* 835 if (fit.FitEnergy(fH Alpha, fOffData, i, kTRUE))811 if (fit.FitEnergy(fHist, fOffData, i, kTRUE)) 836 812 { 837 813 fHEnergy.SetBinContent(i, fit.GetEventsExcess()); … … 845 821 Bool_t MHAlpha::Finalize() 846 822 { 847 //TH1D *h = fH Alpha.ProjectionZ("AlphaExc_px", -1, 9999, -1, 9999, "E");823 //TH1D *h = fHist.ProjectionZ("AlphaExc_px", -1, 9999, -1, 9999, "E"); 848 824 //h->SetDirectory(0); 849 825 //Bool_t rc = fFit.Fit(*h); 850 826 //delete h; 851 827 852 if (!fFit.FitAlpha(fH Alpha, fOffData))828 if (!fFit.FitAlpha(fHist, fOffData)) 853 829 { 854 830 *fLog << warn << "MAlphaFitter - Fit failed..." << endl; … … 900 876 fMatrix = mat; 901 877 902 fMap[0] = fMatrix->AddColumn( "MHillasSrc.fAlpha");878 fMap[0] = fMatrix->AddColumn(GetParameterRule()); 903 879 fMap[1] = -1; 904 880 fMap[2] = -1; -
trunk/MagicSoft/Mars/mhflux/MHAlpha.h
r6977 r6988 24 24 class MPointingPos; 25 25 26 /*27 class MAlphaFitter : public MParContainer28 {29 private:30 Float_t fSigInt;31 Float_t fSigMax;32 Float_t fBgMin;33 Float_t fBgMax;34 Int_t fPolynom;35 36 Double_t fSignificance;37 Double_t fExcessEvents;38 Double_t fChiSqSignal;39 Double_t fChiSqBg;40 Double_t fSigmaGaus;41 Double_t fIntegralMax;42 43 public:44 MAlphaFitter() : fSigInt(10), fSigMax(75), fBgMin(45), fBgMax(85), fPolynom(2)45 {46 }47 48 MAlphaFitter(const MAlphaFitter &f)49 {50 f.Copy(*this);51 }52 53 void Copy(TObject &o) const54 {55 MAlphaFitter &f = static_cast<MAlphaFitter&>(o);56 57 f.fSigInt = fSigInt;58 f.fSigMax = fSigMax;59 f.fBgMin = fBgMin;60 f.fBgMax = fBgMax;61 f.fPolynom = fPolynom;62 }63 64 void SetSignalIntegralMax(Float_t s) { fSigInt = s; }65 void SetSignalFitMax(Float_t s) { fSigMax = s; }66 void SetBackgroundFitMin(Float_t s) { fBgMin = s; }67 void SetBackgroundFitMax(Float_t s) { fBgMax = s; }68 void SetNumPolynom(Int_t s) { fPolynom = s; }69 70 Double_t GetExcessEvents() const { return fExcessEvents; }71 Double_t GetSignificance() const { return fSignificance; }72 Double_t GetChiSqSignal() const { return fChiSqSignal; }73 Double_t GetChiSqBg() const { return fChiSqBg; }74 Double_t GetSigmaGaus() const { return fSigmaGaus; }75 76 void PaintResult(Float_t x=0.04, Float_t y=0.94, Float_t size=0.035) const;77 78 Bool_t Fit(TH1D &h, Bool_t paint=kFALSE);79 ClassDef(MAlphaFitter, 1)80 };81 */82 83 26 class MHAlpha : public MH 84 27 { 28 protected: 29 TH3D fHist; // Alpha vs. theta and energy 30 TH1D fHistTime; //! temporary histogram to get alpha vs. time 31 32 TString fNameParameter; 33 34 MParContainer *fParameter; //! 35 85 36 private: 86 37 const TH3D *fOffData; … … 88 39 MAlphaFitter fFit; // SEEMS THAT STREAMER HAS SOME PROBLEMS... MAYBE IF FUNC IS USED AT THE SAME TIME FOR FITS (PAINT) 89 40 90 TH3D fHAlpha; // Alpha vs. theta and energy91 41 TH1D fHEnergy; // excess events vs energy 92 42 TH1D fHTheta; // excess events vs theta 93 43 TH1D fHTime; // excess events vs time; 94 TH1D fHAlphaTime; //! temporary histogram to get alpha vs. time95 44 96 MParameterD *fResult;//!97 MParameterD *fEnergy;//!98 MHillas *fHillas;//!99 MPointingPos *fPointPos;//!45 MParameterD *fResult; //! 46 MParameterD *fEnergy; //! 47 MHillas *fHillas; //! 48 MPointingPos *fPointPos; //! 100 49 101 50 MTime *fTimeEffOn; //! Time to steer filling of fHTime … … 116 65 Int_t fMap[5]; //! 117 66 118 void FitEnergySpec(Bool_t paint=kFALSE);119 67 Float_t FitEnergyBins(Bool_t paint=kFALSE); 120 68 void FitThetaBins(Bool_t paint=kFALSE); … … 128 76 Int_t DistancetoPrimitive(Int_t px, Int_t py) { return 0; } 129 77 78 virtual Bool_t GetParameter(const MParList &pl); 79 virtual Double_t GetVal() const; 80 virtual const char *GetParameterRule() const 81 { 82 return "MHillasSrc.fAlpha"; 83 } 84 130 85 public: 131 86 MHAlpha(const char *name=NULL, const char *title=NULL); 132 87 88 // MH 133 89 Bool_t SetupFill(const MParList *pl); 134 90 Bool_t Fill(const MParContainer *par, const Stat_t w=1); 135 91 Bool_t Finalize(); 136 92 137 const TH3D &GetHist() const { return fHAlpha; } 93 // MHAlpha 94 const TH3D &GetHist() const { return fHist; } 138 95 const MAlphaFitter &GetAlphaFitter() const { return fFit; } 139 96 140 97 const TH1D &GetHEnergy() const { return fHEnergy; } 141 98 99 // Setter 100 void SetNameParameter(const char *name) { fNameParameter=name; } 142 101 void SetOffData(const MHAlpha &h) 143 102 { 144 fOffData = &h.fH Alpha;103 fOffData = &h.fHist; 145 104 fForceUsingSize = h.fForceUsingSize; 146 105 fNumTimeBins = h.fNumTimeBins; -
trunk/MagicSoft/Mars/mjobs/MJCut.cc
r6979 r6988 77 77 MJCut::MJCut(const char *name, const char *title) 78 78 : fStoreSummary(kFALSE), fStoreResult(kTRUE), fWriteOnly(kFALSE), 79 fIsWobble(kFALSE), fIsMonteCarlo(kFALSE), fFullDisplay(kFALSE), /*fSubstraction(kFALSE),*/80 /*fEstimateEnergy(0),*/fCalcHadronness(0)79 fIsWobble(kFALSE), fIsMonteCarlo(kFALSE), fFullDisplay(kFALSE), 80 fNameHist("MHTheta"), fCalcHadronness(0) 81 81 { 82 82 fName = name ? name : "MJCut"; … … 258 258 259 259 // Save also the result, not only the setup 260 const MHAlpha *halpha = (MHAlpha*)plist.FindObject( "MHAlpha");260 const MHAlpha *halpha = (MHAlpha*)plist.FindObject(fNameHist, "MHAlpha"); 261 261 if (halpha) 262 262 arr.Add((TObject*)(&halpha->GetAlphaFitter())); … … 285 285 // MJCut.WriteResult: yes, no 286 286 // MJCut.ResultFile: filename 287 // MJCut.HistName: MHAlpha 287 288 // 288 289 Bool_t MJCut::CheckEnvLocal() … … 301 302 EnableFullDisplay(GetEnv("FullDisplay", fFullDisplay)); 302 303 //EnableSubstraction(GetEnv("HistogramSubstraction", fSubstraction)); 304 305 SetNameHist(GetEnv("NameHist", fNameHist)); 303 306 304 307 return kTRUE; … … 341 344 } 342 345 343 void MJCut::DisplayResult(const MParList &plist) const 344 { 345 /* 346 TObject *h1 = plist.FindObject("MHHillasOffPre", "MHHillas"); 347 TObject *h2 = plist.FindObject("MHHillasOffPost", "MHHillas"); 348 TObject *h3 = plist.FindObject("MHVsSizeOffPost", "MHVsSize"); 349 TObject *h4 = plist.FindObject("MHHilExtOffPost", "MHHillasExt"); 350 TObject *h5 = plist.FindObject("MHHilSrcOffPost", "MHHillasSrc"); 351 TObject *h6 = plist.FindObject("MHImgParOffPost", "MHImagePar"); 352 TObject *h7 = plist.FindObject("MHNewParOffPost", "MHNewImagePar"); 353 */ 346 // -------------------------------------------------------------------------- 347 // 348 // Create a new instance of an object with name name of class 349 // type fNameHist in parlist. It must derive from MHAlpha. 350 // Call ForceUsingSize for it and return its pointer. 351 // If something fails NULL is returned. 352 // 353 MHAlpha *MJCut::CreateNewHist(MParList &plist, const char *name) const 354 { 355 TClass *cls = gROOT->GetClass(fNameHist); 356 if (!cls) 357 { 358 *fLog << err << "Class " << fNameHist << " not found in dictionary... abort." << endl; 359 return NULL; 360 } 361 if (!cls->InheritsFrom(MHAlpha::Class())) 362 { 363 *fLog << err << "Class " << fNameHist << " doesn't inherit from MHAlpha... abort." << endl; 364 return NULL; 365 } 366 367 const TString objname(Form("%s%s", fNameHist.Data(), name)); 368 MHAlpha *h = (MHAlpha*)plist.FindCreateObj(fNameHist, objname); 369 if (!h) 370 return NULL; 371 372 h->ForceUsingSize(); 373 374 return h; 354 375 } 355 376 … … 424 445 fit.SetScaleMode(MAlphaFitter::kNone); 425 446 426 MHAlpha halphaoff("MHAlphaOff"); 427 halphaoff.ForceUsingSize(); 428 plist.AddToList(&halphaoff); 429 430 MFillH falpha("MHAlphaOff [MHAlpha]", "MHillasSrc", "FillAlpha"); 447 MHAlpha *halphaoff = CreateNewHist(plist, "Off"); 448 MFillH falpha(halphaoff, "MHillasSrc", "FillAlpha"); 431 449 MFillH ffs("MHFalseSourceOff [MHFalseSource]", "MHillas", "FillFS"); 432 450 … … 655 673 } 656 674 */ 657 MHAlpha halphaon("MHAlpha"); 658 halphaon.ForceUsingSize(); 659 plist.AddToList(&halphaon); 660 661 MFillH falpha2("MHAlpha", "MHillasSrc", "FillAlpha"); 675 MHAlpha *halphaon=CreateNewHist(plist); 676 MFillH falpha2(halphaon, "MHillasSrc", "FillAlpha"); 662 677 MFillH ffs2("MHFalseSource", "MHillas", "FillFS"); 663 678 … … 706 721 tlist.PrintStatistics(); 707 722 708 DisplayResult(plist);709 710 723 // FIXME: Perform fit and plot energy dependant alpha plots 711 724 // and fit result to new tabs! -
trunk/MagicSoft/Mars/mjobs/MJCut.h
r6979 r6988 9 9 class MDataSet; 10 10 class MParList; 11 class MHAlpha; 11 12 class MWriteRootFile; 12 13 … … 26 27 TString fNameOutput; 27 28 29 TString fNameHist; 30 28 31 //MTask *fEstimateEnergy; 29 32 MTask *fCalcHadronness; 30 33 31 TString GetOutputFile(UInt_t num) const;32 Bool_t CheckEnvLocal();33 void SetupWriter(MWriteRootFile *write, const char *name) const;34 Bool_t WriteTasks(UInt_t num, TObjArray &cont) const;35 Bool_t WriteResult(const MParList &plist, UInt_t num) const;36 void DisplayResult(const MParList &plist) const;34 TString GetOutputFile(UInt_t num) const; 35 Bool_t CheckEnvLocal(); 36 void SetupWriter(MWriteRootFile *write, const char *name) const; 37 Bool_t WriteTasks(UInt_t num, TObjArray &cont) const; 38 Bool_t WriteResult(const MParList &plist, UInt_t num) const; 39 MHAlpha *CreateNewHist(MParList &plist, const char *name="") const; 37 40 38 Bool_t CanStoreSummary() const { return !fPathOut.IsNull() && fStoreSummary; }39 Bool_t CanStoreResult() const { return !fPathOut.IsNull() && fStoreResult; }41 Bool_t CanStoreSummary() const { return !fPathOut.IsNull() && fStoreSummary; } 42 Bool_t CanStoreResult() const { return !fPathOut.IsNull() && fStoreResult; } 40 43 41 44 public: … … 57 60 void SetNameOutFile(const char *name="") { fNameOutput=name; } 58 61 62 void SetNameHist(const char *name) { fNameHist=name; } 63 59 64 //void SetEnergyEstimator(const MTask *task=0); 60 65 void SetHadronnessCalculator(const MTask *task=0);
Note:
See TracChangeset
for help on using the changeset viewer.