Changeset 9302
- Timestamp:
- 02/07/09 20:40:28 (16 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mastro/MAstroCamera.cc
r8106 r9302 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MAstroCamera.cc,v 1.3 0 2006-10-17 17:15:58tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MAstroCamera.cc,v 1.31 2009-02-07 20:39:55 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 88 88 #include "MGeomMirror.h" 89 89 90 #include "MString.h" 91 90 92 #include "MTime.h" 91 93 #include "MAstroSky2Local.h" … … 411 413 // transform meters into millimeters (camera display works with mm) 412 414 mean *= 1./num; 413 DrawStar(mean(0), mean(1), *radec, hasmean?kBlack:-1, Form("x=%.1fmm y=%.1fmm", mean(0), mean(1)), resize);415 DrawStar(mean(0), mean(1), *radec, hasmean?kBlack:-1, MString::Format("x=%.1fmm y=%.1fmm", mean(0), mean(1)), resize); 414 416 if (hasnull) 415 417 { … … 417 419 vstar *= rot; 418 420 const TVector3 spot = fMirror0->GetReflection(vstar, fGeom->GetCameraDist())*1000; 419 DrawStar(spot(0), spot(1), *radec, hasmean?kBlack:-1, Form("x=%.1fmm y=%.1fmm", mean(0), mean(1)), resize);421 DrawStar(spot(0), spot(1), *radec, hasmean?kBlack:-1, MString::Format("x=%.1fmm y=%.1fmm", mean(0), mean(1)), resize); 420 422 // This can be used to get the abberation... 421 423 //cout << TMath::Hypot(spot(0), spot(1)) << " " << TMath::Hypot(mean(0)-spot(0), mean(1)-spot(1)) << endl; -
trunk/MagicSoft/Mars/mastro/MAstroCatalog.cc
r9292 r9302 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MAstroCatalog.cc,v 1.3 2 2009-02-03 13:27:58tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MAstroCatalog.cc,v 1.33 2009-02-07 20:40:01 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 1198 1198 1199 1199 TString txt; 1200 txt += Form("\\alpha=%.2fh ", fmod(ra/15+48, 24));1201 txt += Form("\\delta=%.1f\\circ ", fmod(dec+270,180)-90);1202 txt += Form("/ FOV=%.1f\\circ", fRadiusFOV);1200 txt += MString::Format("\\alpha=%.2fh ", fmod(ra/15+48, 24)); 1201 txt += MString::Format("\\delta=%.1f\\circ ", fmod(dec+270,180)-90); 1202 txt += MString::Format("/ FOV=%.1f\\circ", fRadiusFOV); 1203 1203 1204 1204 if (!fTime || !fObservatory) … … 1214 1214 1215 1215 txt.Prepend("#splitline{"); 1216 txt += Form(" \\theta=%.1f\\circ ", fmod(zd+270,180)-90);1217 txt += Form("\\phi=%.1f\\circ ", fmod(az+720, 360));1218 txt += Form(" / \\rho=%.1f\\circ", rho*TMath::RadToDeg());1216 txt += MString::Format(" \\theta=%.1f\\circ ", fmod(zd+270,180)-90); 1217 txt += MString::Format("\\phi=%.1f\\circ ", fmod(az+720, 360)); 1218 txt += MString::Format(" / \\rho=%.1f\\circ", rho*TMath::RadToDeg()); 1219 1219 txt += "}{<"; 1220 1220 txt += fTime->GetSqlDateTime(); -
trunk/MagicSoft/Mars/mbase/MContinue.cc
r9178 r9302 52 52 53 53 #include "MF.h" 54 #include "MString.h" 54 55 #include "MParList.h" 55 56 #include "MTaskList.h" … … 105 106 { 106 107 fName = name ? name : "MContinue"; 107 fTitle = title ? title : "Task returning kCONTINUE ";108 fTitle = title ? title : "Task returning kCONTINUE (or any other return code)"; 108 109 109 110 SetFilter(f); … … 155 156 156 157 if ((TString)GetFilter()->GetName()==fName) 157 GetFilter()->SetName( Form("MF:%s", fName.Data()));158 GetFilter()->SetName(MString::Format("MF:%s", fName.Data())); 158 159 159 160 if (!fTaskList->AddToListBefore(GetFilter(), this)) -
trunk/MagicSoft/Mars/mbase/MFilter.cc
r8907 r9302 77 77 #include "MLogManip.h" 78 78 79 #include "MString.h" 80 79 81 ClassImp(MFilter); 80 82 … … 97 99 TString MFilter::GetRule() const 98 100 { 99 return Form("(%s)", ClassName()); //"<GetRule n/a for " + fName + ">";101 return MString::Format("(%s)", ClassName()); //"<GetRule n/a for " + fName + ">"; 100 102 } 101 103 -
trunk/MagicSoft/Mars/mbase/MLog.cc
r8965 r9302 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MLog.cc,v 1.6 1 2008-06-16 14:58:27 tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MLog.cc,v 1.62 2009-02-07 20:40:07 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 114 114 #include "MArgs.h" 115 115 #include "MTime.h" 116 #include "MString.h" 116 117 #include "MParContainer.h" 117 118 … … 572 573 TString f1 = arg.GetStringAndRemove("--log=", ""); 573 574 if (f1.IsNull() && arg.HasOnlyAndRemove("--log")) 574 f1 = Form("%s.log", arg.GetName());575 f1 = MString::Format("%s.log", arg.GetName()); 575 576 if (!f1.IsNull()) 576 577 { … … 581 582 TString f2 = arg.GetStringAndRemove("--html=", ""); 582 583 if (f2.IsNull() && arg.HasOnlyAndRemove("--html")) 583 f2 = Form("%s.html", arg.GetName());584 f2 = MString::Format("%s.html", arg.GetName()); 584 585 if (!f2.IsNull()) 585 586 { -
trunk/MagicSoft/Mars/mbase/MMath.cc
r9253 r9302 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.4 6 2009-01-24 10:57:46tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MMath.cc,v 1.47 2009-02-07 20:33:22 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 876 876 } 877 877 878 const char *fmt = MString::Format("%%.%de", i);879 880 v = MString::Format(fmt , v).Atof();878 const TString fmt = MString::Format("%%.%de", i); 879 880 v = MString::Format(fmt.Data(), v).Atof(); 881 881 e = error.Atof(); 882 882 } -
trunk/MagicSoft/Mars/mbase/MParContainer.cc
r9268 r9302 1103 1103 for (int i=1; i<9; i++) 1104 1104 { 1105 const TString form = Form(id.Data(), i);1106 const TString res = Form(form.Data(), num);1105 const TString form = MString::Format(id.Data(), i); 1106 const TString res = MString::Format(form.Data(), num); 1107 1107 1108 1108 const TString str = GetEnvValue2(env, prefix, res, ""); -
trunk/MagicSoft/Mars/mbase/MParEmulated.cc
r9079 r9302 50 50 #include "MLogManip.h" 51 51 52 #include "MString.h" 53 52 54 ClassImp(MParEmulated); 53 55 … … 158 160 name.Prepend("Get"); 159 161 160 TMethodCall *call = new TMethodCall(MParEmulated::Class(), name, proxy? Form("%p,%d", proxy, offset):Form("%d", offset));162 TMethodCall *call = new TMethodCall(MParEmulated::Class(), name, proxy?MString::Format("%p,%d", proxy, offset):MString::Format("%d", offset)); 161 163 fgListMethodCall.Add(call); 162 164 return call; -
trunk/MagicSoft/Mars/mbase/MStatusDisplay.cc
r9292 r9302 485 485 486 486 // Add copyright notice 487 l = new TGLabel(f, Form("(c) MARS Software Development, 2000-%d", TDatime().GetYear()));487 l = new TGLabel(f, MString::Format("(c) MARS Software Development, 2000-%d", TDatime().GetYear())); 488 488 fList->Add(l); 489 489 f->AddFrame(l, layb); … … 2580 2580 Int_t MStatusDisplay::InitWriteDisplay(Int_t num, TString &name, const TString &ext) 2581 2581 { 2582 SetStatusLine1( Form("Writing %s file...",ext.Data()));2582 SetStatusLine1(MString::Format("Writing %s file...",ext.Data())); 2583 2583 SetStatusLine2("Please be patient!"); 2584 2584 -
trunk/MagicSoft/Mars/mbase/MTime.cc
r9210 r9302 84 84 85 85 #include "MAstro.h" 86 #include "MString.h" 86 87 87 88 ClassImp(MTime); … … 708 709 GetTime(h, m, s, ms); 709 710 710 return TString(Form("%02d.%02d.%04d %02d:%02d:%02d.%03d", d, mon, y, h, m, s, ms));711 return MString::Format("%02d.%02d.%04d %02d:%02d:%02d.%03d", d, mon, y, h, m, s, ms); 711 712 } 712 713 … … 883 884 884 885 *fLog << all << GetDescriptor() << ": "; 885 *fLog << GetString() << Form(" (+%dns)", fNanoSec) << endl;886 *fLog << GetString() << MString::Format(" (+%dns)", fNanoSec) << endl; 886 887 } 887 888 -
trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
r9292 r9302 102 102 103 103 gROOT->GetListOfCleanups()->Add(this); // To remove fOut if deleted 104 SetBit(kMustCleanup); 104 105 } 105 106 -
trunk/MagicSoft/Mars/mhbase/MFillH.cc
r9153 r9302 93 93 #include "MLogManip.h" 94 94 95 #include "MString.h" 96 95 97 #include "MH.h" 96 98 #include "MHArray.h" … … 599 601 if (fDisplay && fDisplay->HasCanvas(fCanvas)) 600 602 { 601 const TString opt( Form("nonew %s", fDrawOption.Data()));603 const TString opt(MString::Format("nonew %s", fDrawOption.Data())); 602 604 fCanvas->cd(); 603 605 // Remove the old class to prevent clashes calling -
trunk/MagicSoft/Mars/mhbase/MH.cc
r9195 r9302 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MH.cc,v 1.4 2 2008-12-21 18:09:49tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MH.cc,v 1.43 2009-02-07 20:40:12 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 74 74 #include "MLogManip.h" 75 75 76 #include "MString.h" 77 76 78 #include "MParList.h" 77 79 #include "MParContainer.h" … … 156 158 157 159 if (list->FindObject(name)) 158 name += Form(" <%d>", list->GetSize()+1);160 name += MString::Format(" <%d>", list->GetSize()+1); 159 161 160 162 if (!usescreenfactor) … … 1507 1509 { 1508 1510 *fLog << " " << setw(7) << n << " ("; 1509 *fLog << Form("%5.1f", 100.*n/GetNumExecutions());1511 *fLog << MString::Format("%5.1f", 100.*n/GetNumExecutions()); 1510 1512 *fLog << "%) Evts skipped: " << str << endl; 1511 1513 } -
trunk/MagicSoft/Mars/mhbase/MH3.cc
r9195 r9302 166 166 #include "MLog.h" 167 167 #include "MLogManip.h" 168 169 #include "MString.h" 168 170 169 171 #include "MParList.h" … … 643 645 if (gPad) 644 646 { 645 const TString pfx( Form("%sProfX", fHist->GetName()));646 const TString pfy( Form("%sProfY", fHist->GetName()));647 const TString pfx(MString::Format("%sProfX", fHist->GetName())); 648 const TString pfy(MString::Format("%sProfY", fHist->GetName())); 647 649 648 650 TProfile *p = 0; 649 651 if ((p=dynamic_cast<TProfile*>(gPad->FindObject(pfx)))) 650 p->SetName( Form("%sProfX", name));652 p->SetName(MString::Format("%sProfX", name)); 651 653 if ((p=dynamic_cast<TProfile*>(gPad->FindObject(pfy)))) 652 p->SetName( Form("%sProfY", name));654 p->SetName(MString::Format("%sProfY", name)); 653 655 } 654 656 … … 851 853 MH::SetPalette("pretty"); 852 854 853 const TString pfx( Form("%sProfX", fHist->GetName()));855 const TString pfx(MString::Format("%sProfX", fHist->GetName())); 854 856 if ((p=dynamic_cast<TProfile*>(gPad->FindObject(pfx)))) 855 857 { … … 859 861 } 860 862 861 const TString pfy( Form("%sProfY", fHist->GetName()));863 const TString pfy(MString::Format("%sProfY", fHist->GetName())); 862 864 if ((p=dynamic_cast<TProfile*>(gPad->FindObject(pfy)))) 863 865 { … … 969 971 if (profx) 970 972 { 971 const TString pfx( Form("%sProfX", fHist->GetName()));973 const TString pfx(MString::Format("%sProfX", fHist->GetName())); 972 974 973 975 if (same && (p=dynamic_cast<TProfile*>(gPad->FindObject(pfx)))) … … 985 987 if (profy) 986 988 { 987 const TString pfy( Form("%sProfY", fHist->GetName()));989 const TString pfy(MString::Format("%sProfY", fHist->GetName())); 988 990 989 991 if (same && (p=dynamic_cast<TProfile*>(gPad->FindObject(pfy)))) … … 1298 1300 delete arr; 1299 1301 } 1302 1303 void MH3::RecursiveRemove(TObject *obj) 1304 { 1305 if (obj==fHist) 1306 fHist = 0; 1307 } -
trunk/MagicSoft/Mars/mhbase/MH3.h
r9153 r9302 158 158 void Paint(Option_t *opt=""); 159 159 160 void RecursiveRemove(TObject *obj); 161 160 162 ClassDef(MH3, 4) // Generalized 1/2/3D-histogram for Mars variables 161 163 }; -
trunk/MagicSoft/Mars/mhbase/MHn.cc
r9153 r9302 136 136 137 137 #include "MH3.h" 138 #include "MString.h" 138 139 139 140 ClassImp(MHn); … … 170 171 if (name==fHist[i]->GetName()) 171 172 { 172 name += Form("_%d", fNum);173 name += MString::Format("_%d", fNum); 173 174 break; 174 175 } -
trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc
r9281 r9302 71 71 using namespace std; 72 72 73 // -------------------------------------------------------------------------- 74 // 75 // Default constructor. 76 // 77 MAlphaFitter::MAlphaFitter(const char *name, const char *title) : fSigInt(15), 78 fSigMax(75), fBgMin(45), fBgMax(85), fScaleMin(40), fScaleMax(80), 79 fPolynomOrder(2), fFitBackground(kTRUE), fFunc(0), 80 fScaleMode(kOffRegion), fScaleUser(1), fStrategy(kSignificance) 81 { 82 fName = name ? name : "MAlphaFitter"; 83 fTitle = title ? title : "Fit alpha"; 84 85 SetSignalFunction(kGauss); 86 87 Clear(); 88 } 89 90 // -------------------------------------------------------------------------- 91 // 92 // Destructor 93 // 94 MAlphaFitter::~MAlphaFitter() 95 { 96 delete fFunc; 97 } 98 99 // -------------------------------------------------------------------------- 100 // 101 // Re-initializes fFunc either according to SignalFunc_t 102 // 103 void MAlphaFitter::SetSignalFunction(SignalFunc_t func) 104 { 105 if (gROOT->GetListOfFunctions()->FindObject("")) 106 { 107 gLog << err << "MAlphaFitter::SetSignalFunction -- '' found!" << endl; 108 return; 109 } 110 111 delete fFunc; 112 fFunc = 0; 113 114 switch (func) 115 { 116 case kGauss: 117 fFunc=new TF1("", MString::Format("gaus(0) + pol%d(3)", fPolynomOrder)); 118 break; 119 case kThetaSq: 120 if (fPolynomOrder>0) 121 fPolynomOrder = 1; 122 fFunc=new TF1("", "[0]*exp(-0.5*((sqrt(x)-[1])/[2])^2) + expo(3)"); 123 break; 124 } 125 126 fSignalFunc=func; 127 128 fFunc->SetName("Dummy"); 129 gROOT->GetListOfFunctions()->Remove(fFunc); 130 131 fCoefficients.Set(3+fPolynomOrder+1); 132 fCoefficients.Reset(); 133 134 fErrors.Set(3+fPolynomOrder+1); 135 fErrors.Reset(); 136 } 137 138 // -------------------------------------------------------------------------- 139 // 140 // Reset variables which belong to results. Reset the arrays. 141 // 73 142 void MAlphaFitter::Clear(Option_t *o) 74 143 { … … 86 155 fCoefficients.Reset(); 87 156 fErrors.Reset(); 157 } 158 159 // -------------------------------------------------------------------------- 160 // 161 // Returns fFunc->Eval(d) or 0 if fFunc==NULL 162 // 163 Double_t MAlphaFitter::Eval(Double_t d) const 164 { 165 return fFunc ? fFunc->Eval(d) : 0; 88 166 } 89 167 … … 294 372 h.SetDirectory(0); 295 373 h.Add(&hon); 374 296 375 h.Scale(0.5); 297 376 for (int i=1; i<=bin+3; i++) … … 310 389 // Do a gaussian error propagation to calculated the error of 311 390 // the background estimated from the fit 312 const Double_t ea = fit. GetErrors()[3];313 const Double_t eb = fit. GetErrors()[4];314 const Double_t a = fit. GetCoefficients()[3];315 const Double_t b = fit. GetCoefficients()[4];391 const Double_t ea = fit.fErrors[3]; 392 const Double_t eb = fit.fErrors[4]; 393 const Double_t a = fit.fCoefficients[3]; 394 const Double_t b = fit.fCoefficients[4]; 316 395 317 396 const Double_t t = fIntegralMax; … … 333 412 // const Double_t sc = bg * er*er / (fit2.GetEventsBackground()*fit2.GetEventsBackground()); 334 413 // Assuming that bg and fit2.GetEventsBackground() are rather identical: 335 const Double_t sc = er*er / fit.GetEventsBackground(); 414 const Double_t sc = er*er / fit.fEventsBackground; 415 416 336 417 /* 337 418 cout << MMath::SignificanceLiMaSigned(hon.Integral(1, bin), fit.GetEventsBackground()/sc, sc) << " "; … … 354 435 return kFALSE; 355 436 356 fChiSqSignal = fit. GetChiSqSignal();357 fChiSqBg = fit. GetChiSqBg();358 fCoefficients = fit. GetCoefficients();359 fErrors = fit. GetErrors();437 fChiSqSignal = fit.fChiSqSignal; 438 fChiSqBg = fit.fChiSqBg; 439 fCoefficients = fit.fCoefficients; 440 fErrors = fit.fErrors; 360 441 361 442 // ---------------------------------------------------------------------------- … … 472 553 473 554 // Function 474 TF1 *fcn = f.fFunc; 555 delete f.fFunc; 556 475 557 f.fFunc = new TF1(*fFunc); 476 558 f.fFunc->SetName("Dummy"); 477 559 gROOT->GetListOfFunctions()->Remove(f.fFunc); 478 delete fcn;479 560 } 480 561 … … 527 608 { 528 609 const TString name(MString::Format("TempAlphaEnergy%06d", gRandom->Integer(1000000))); 610 529 611 TH1D *h = hon.ProjectionZ(name, 0, hon.GetNbinsX()+1, bin, bin, "E"); 612 h->SetDirectory(0); 613 614 const Bool_t rc = Fit(*h, paint); 615 616 delete h; 617 618 return rc; 619 } 620 621 Bool_t MAlphaFitter::FitTheta(const TH3D &hon, UInt_t bin, Bool_t paint) 622 { 623 const TString name(MString::Format("TempAlphaTheta%06d", gRandom->Integer(1000000))); 624 625 TH1D *h = hon.ProjectionZ(name, bin, bin, 0, hon.GetNbinsY()+1, "E"); 626 h->SetDirectory(0); 627 628 const Bool_t rc = Fit(*h, paint); 629 630 delete h; 631 632 return rc; 633 } 634 /* 635 Bool_t MAlphaFitter::FitTime(const TH3D &hon, UInt_t bin, Bool_t paint) 636 { 637 const TString name(Form("TempAlphaTime%06d", gRandom->Integer(1000000))); 638 639 hon.GetZaxis()->SetRange(bin,bin); 640 TH1D *h = (TH1D*)hon.Project3D("ye"); 641 hon.GetZaxis()->SetRange(-1,-1); 642 530 643 h->SetDirectory(0); 531 644 … … 534 647 return rc; 535 648 } 536 537 Bool_t MAlphaFitter::FitTheta(const TH3D &hon, UInt_t bin, Bool_t paint)538 {539 const TString name(MString::Format("TempAlphaTheta%06d", gRandom->Integer(1000000)));540 TH1D *h = hon.ProjectionZ(name, bin, bin, 0, hon.GetNbinsY()+1, "E");541 h->SetDirectory(0);542 543 const Bool_t rc = Fit(*h, paint);544 delete h;545 return rc;546 }547 /*548 Bool_t MAlphaFitter::FitTime(const TH3D &hon, UInt_t bin, Bool_t paint)549 {550 const TString name(Form("TempAlphaTime%06d", gRandom->Integer(1000000)));551 552 hon.GetZaxis()->SetRange(bin,bin);553 TH1D *h = (TH1D*)hon.Project3D("ye");554 hon.GetZaxis()->SetRange(-1,-1);555 556 h->SetDirectory(0);557 558 const Bool_t rc = Fit(*h, paint);559 delete h;560 return rc;561 }562 649 */ 563 650 Bool_t MAlphaFitter::FitAlpha(const TH3D &hon, Bool_t paint) 564 651 { 565 652 const TString name(MString::Format("TempAlpha%06d", gRandom->Integer(1000000))); 653 566 654 TH1D *h = hon.ProjectionZ(name, 0, hon.GetNbinsX()+1, 0, hon.GetNbinsY()+1, "E"); 567 655 h->SetDirectory(0); 568 656 569 657 const Bool_t rc = Fit(*h, paint); 658 570 659 delete h; 660 571 661 return rc; 572 662 } … … 578 668 579 669 TH1D *h1 = hon.ProjectionZ(name1, 0, hon.GetNbinsX()+1, bin, bin, "E"); 670 h1->SetDirectory(0); 671 580 672 TH1D *h0 = hof.ProjectionZ(name0, 0, hof.GetNbinsX()+1, bin, bin, "E"); 581 h1->SetDirectory(0);582 673 h0->SetDirectory(0); 583 674 … … 596 687 597 688 TH1D *h1 = hon.ProjectionZ(name1, bin, bin, 0, hon.GetNbinsY()+1, "E"); 689 h1->SetDirectory(0); 690 598 691 TH1D *h0 = hof.ProjectionZ(name0, bin, bin, 0, hof.GetNbinsY()+1, "E"); 599 h1->SetDirectory(0);600 692 h0->SetDirectory(0); 601 693 … … 638 730 639 731 TH1D *h1 = hon.ProjectionZ(name1, 0, hon.GetNbinsX()+1, 0, hon.GetNbinsY()+1, "E"); 732 h1->SetDirectory(0); 733 640 734 TH1D *h0 = hof.ProjectionZ(name0, 0, hof.GetNbinsX()+1, 0, hof.GetNbinsY()+1, "E"); 641 h1->SetDirectory(0);642 735 h0->SetDirectory(0); 643 736 … … 656 749 657 750 TH1D *h1 = hon.ProjectionZ(name1, 0, hon.GetNbinsX()+1, bin, bin, "E"); 751 h1->SetDirectory(0); 752 658 753 TH1D *h0 = hof.ProjectionZ(name0, 0, hof.GetNbinsX()+1, bin, bin, "E"); 659 h1->SetDirectory(0);660 754 h0->SetDirectory(0); 661 755 -
trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h
r8989 r9302 10 10 #endif 11 11 12 #ifndef ROOT_TF1 13 #include <TF1.h> 14 #endif 15 12 class TF1; 16 13 class TH1D; 17 14 class TH3D; … … 85 82 public: 86 83 // Implementing the function yourself is only about 5% faster 87 MAlphaFitter(const char *name=0, const char *title=0) : fSigInt(15), 88 fSigMax(75), fBgMin(45), fBgMax(85), fScaleMin(40), fScaleMax(80), 89 fPolynomOrder(2), fFitBackground(kTRUE), fSignalFunc(kGauss), 90 fCoefficients(3+fPolynomOrder+1), fErrors(3+fPolynomOrder+1), 91 fFunc(new TF1("", Form("gaus(0) + pol%d(3)", fPolynomOrder), 0, 90)), 92 fScaleMode(kOffRegion), fScaleUser(1), fStrategy(kSignificance) 93 { 94 fName = name ? name : "MAlphaFitter"; 95 fTitle = title ? title : "Fit alpha"; 96 97 fFunc->SetName("Dummy"); 98 gROOT->GetListOfFunctions()->Remove(fFunc); 99 100 Clear(); 101 } 102 84 MAlphaFitter(const char *name=0, const char *title=0); 103 85 MAlphaFitter(const MAlphaFitter &f) : fFunc(0) 104 86 { 105 87 f.Copy(*this); 106 88 } 107 ~MAlphaFitter() 108 { 109 delete fFunc; 110 } 89 ~MAlphaFitter(); 111 90 112 91 // TObject … … 134 113 SetSignalFunction(fSignalFunc); 135 114 } 136 void SetSignalFunction(SignalFunc_t func) 137 { 138 delete fFunc; 139 switch (func) 140 { 141 case kGauss: 142 fFunc=new TF1 ("", Form("gaus(0) + pol%d(3)", fPolynomOrder)); 143 break; 144 case kThetaSq: 145 // if (fPolynomOrder==0) 146 // fFunc=new TF1("", "[0]*exp(-0.5*((sqrt(x)-[1])/[2])^2) + pol0(3)"); 147 // else 148 // { 149 if (fPolynomOrder>0) 150 fPolynomOrder = 1; 151 fFunc=new TF1("", "[0]*exp(-0.5*((sqrt(x)-[1])/[2])^2) + expo(3)"); 152 // } 153 break; 154 } 155 fSignalFunc=func; 156 fFunc->SetName("Dummy"); 157 gROOT->GetListOfFunctions()->Remove(fFunc); 158 159 fCoefficients.Set(3+fPolynomOrder+1); 160 fCoefficients.Reset(); 161 162 fErrors.Set(3+fPolynomOrder+1); 163 fErrors.Reset(); 164 } 115 void SetSignalFunction(SignalFunc_t func); 116 165 117 void EnableBackgroundFit(Bool_t b=kTRUE) { fFitBackground=b; } 166 118 … … 193 145 const TArrayD &GetCoefficients() const { return fCoefficients; } 194 146 const TArrayD &GetErrors() const { return fErrors; } 195 Double_t Eval(Double_t d) const { return fFunc ? fFunc->Eval(d) : 0; }147 Double_t Eval(Double_t d) const; 196 148 197 149 Double_t CalcUpperLimit() const;
Note:
See TracChangeset
for help on using the changeset viewer.