Changeset 7151
- Timestamp:
- 06/13/05 10:20:58 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MLog.cc
r7001 r7151 259 259 void MLog::Underline() 260 260 { 261 if (fIsNull) 262 return; 263 261 264 SetBit(kIsUnderlined); 262 265 -
trunk/MagicSoft/Mars/mhbase/MBinning.cc
r7142 r7151 428 428 const Double_t cud = ud<0 ? cos(ud)-1 : 1-cos(ud); 429 429 430 SetEdgesASin(nbins, ld, ud); 431 /* 432 const Double_t binsize = (cld-cud)/nbins; 433 fEdges.Set(nbins+1); 434 for (int i=0; i<=nbins; i++) 435 { 436 const Double_t a = cld-binsize*i; 437 fEdges[i] = a<0 ? -acos(1+a)*kRad2Deg : acos(1-a)*kRad2Deg; 438 cout << a << " " << fEdges[i] << endl; 439 } 440 441 fType = kIsCosinic;*/ 430 SetEdgesASin(nbins, cld, cud); 442 431 } 443 432 -
trunk/MagicSoft/Mars/mhflux/MAlphaFitter.cc
r7142 r7151 135 135 136 136 for (int i=5; i<fFunc->GetNpar(); i++) 137 fFunc->ReleaseParameter(i); 137 if (fFitBackground) 138 fFunc->ReleaseParameter(i); 139 else 140 fFunc->SetParameter(i, 0); 138 141 139 142 // options : N do not store the function, do not draw … … 142 145 // Q quiet mode 143 146 // E Perform better Errors estimation using Minos technique 144 h.Fit(fFunc, "NQI", "", bgmin, bgmax); 145 146 fChiSqBg = fFunc->GetChisquare()/fFunc->GetNDF(); 147 if (fFitBackground) 148 { 149 h.Fit(fFunc, "NQI", "", bgmin, bgmax); 150 fChiSqBg = fFunc->GetChisquare()/fFunc->GetNDF(); 151 } 152 147 153 148 154 // ------------------------------------ 149 if (paint )155 if (paint && fFitBackground) 150 156 { 151 157 fFunc->SetRange(0, 90); … … 209 215 fSignificance = MMath::SignificanceLiMaSigned(fEventsSignal, fEventsBackground); 210 216 217 if (TMath::IsNaN(fSignificance)) 218 fSignificance=0; 219 211 220 if (fEventsExcess<0) 212 221 fEventsExcess=0; … … 240 249 fSignificance = MMath::SignificanceLiMaSigned(fEventsSignal, fEventsBackground/alpha, alpha); 241 250 251 if (TMath::IsNaN(fSignificance)) 252 fSignificance=0; 242 253 if (fEventsExcess<0) 243 254 fEventsExcess=0; 244 /* 245 TF1 func("", "gaus(0)+pol0(3)", 0., 90.); 246 247 const Double_t A = fEventsSignal/bin; 248 const Double_t dA = TMath::Abs(A); 249 func.SetParLimits(0, -dA*4, dA*4); 250 func.SetParLimits(2, 0, 90); 251 func.SetParLimits(3, -dA, dA); 252 253 func.SetParameter(0, A); 254 func.FixParameter(1, 0); 255 func.SetParameter(2, fSigMax*0.75); 256 func.SetParameter(3, 0); 257 258 // options : N do not store the function, do not draw 259 // I use integral of function in bin rather than value at bin center 260 // R use the range specified in the function range 261 // Q quiet mode 262 // E Perform better Errors estimation using Minos technique 263 TH1D h(hon); 264 h.Add(&hof, -1); 265 h.Fit(&func, "NQI", "", 0, 90); 266 267 fChiSqSignal = func.GetChisquare()/func.GetNDF(); 268 269 const Int_t bin1 = h.GetXaxis()->FindFixBin(func.GetParameter(2)*2); 270 271 fChiSqBg = 0; 272 for (int i=bin1; i<=h.GetNbinsX(); i++) 273 { 274 const Float_t val = h.GetBinContent(i); 275 fChiSqBg = val*val; 276 } 277 if (fChiSqBg>0) 278 fChiSqBg /= h.GetNbinsX()+1-bin1; 279 280 fCoefficients.Set(func.GetNpar(), func.GetParameters()); 281 282 // ------------------------------------ 283 if (paint) 284 { 285 func.SetLineColor(kBlue); 286 func.SetLineWidth(2); 287 func.Paint("same"); 288 } 289 // ------------------------------------ 290 */ 255 291 256 return kTRUE; 292 257 } … … 323 288 f.fScaleMax = fScaleMax; 324 289 f.fPolynomOrder = fPolynomOrder; 290 f.fFitBackground= fFitBackground; 291 f.fSignalFunc = fSignalFunc; 325 292 f.fScaleMode = fScaleMode; 326 293 f.fScaleUser = fScaleUser; … … 350 317 { 351 318 *fLog << GetDescriptor() << ": Fitting..." << endl; 352 *fLog << " ...background from " << fBgMin << " to " << fBgMax << endl;353 319 *fLog << " ...signal to " << fSigMax << " (integrate into bin at " << fSigInt << ")" << endl; 354 *fLog << " ...polynom order " << fPolynomOrder << endl; 355 *fLog << " ...scale mode: "; 356 switch (fScaleMode) 357 { 358 case kNone: *fLog << "none."; break; 359 case kEntries: *fLog << "entries."; break; 360 case kIntegral: *fLog << "integral."; break; 361 case kOffRegion: *fLog << "off region (integral between " << fScaleMin << " and " << fScaleMax << ")"; break; 362 case kBackground: *fLog << "background (integral between " << fBgMin << " and " << fBgMax << ")"; break; 363 case kLeastSquare: *fLog << "least square (N/A)"; break; 364 case kUserScale: *fLog << "user def (" << fScaleUser << ")"; break; 320 *fLog << " ...signal function: "; 321 switch (fSignalFunc) 322 { 323 case kGauss: *fLog << "gauss(x)"; break; 324 case kThetaSq: *fLog << "gauss(sqrt(x))"; break; 365 325 } 366 326 *fLog << endl; 327 if (!fFitBackground) 328 *fLog << " ...no background." << endl; 329 else 330 { 331 *fLog << " ...background from " << fBgMin << " to " << fBgMax << endl; 332 *fLog << " ...polynom order " << fPolynomOrder << endl; 333 *fLog << " ...scale mode: "; 334 switch (fScaleMode) 335 { 336 case kNone: *fLog << "none."; break; 337 case kEntries: *fLog << "entries."; break; 338 case kIntegral: *fLog << "integral."; break; 339 case kOffRegion: *fLog << "off region (integral between " << fScaleMin << " and " << fScaleMax << ")"; break; 340 case kBackground: *fLog << "background (integral between " << fBgMin << " and " << fBgMax << ")"; break; 341 case kLeastSquare: *fLog << "least square (N/A)"; break; 342 case kUserScale: *fLog << "user def (" << fScaleUser << ")"; break; 343 } 344 *fLog << endl; 345 } 367 346 368 347 if (TString(o).Contains("result")) … … 402 381 } 403 382 383 Bool_t MAlphaFitter::FitTime(const TH3D &hon, UInt_t bin, Bool_t paint) 384 { 385 const TString name(Form("TempAlphaTime%06d", gRandom->Integer(1000000))); 386 387 hon.GetZaxis()->SetRange(bin,bin); 388 TH1D *h = (TH1D*)hon.Project3D("ye"); 389 hon.GetZaxis()->SetRange(-1,9999); 390 391 h->SetDirectory(0); 392 393 const Bool_t rc = Fit(*h, paint); 394 delete h; 395 return rc; 396 } 397 404 398 Bool_t MAlphaFitter::FitAlpha(const TH3D &hon, Bool_t paint) 405 399 { … … 448 442 return rc; 449 443 } 450 444 /* 445 Bool_t MAlphaFitter::FitTime(const TH3D &hon, const TH3D &hof, UInt_t bin, Bool_t paint) 446 { 447 const TString name1(Form("TempAlphaTime%06d_on", gRandom->Integer(1000000))); 448 const TString name0(Form("TempAlphaTime%06d_off", gRandom->Integer(1000000))); 449 450 hon.GetZaxis()->SetRange(bin,bin); 451 TH1D *h1 = (TH1D*)hon.Project3D("ye"); 452 hon.GetZaxis()->SetRange(-1,9999); 453 h1->SetDirectory(0); 454 455 hof.GetZaxis()->SetRange(bin,bin); 456 TH1D *h0 = (TH1D*)hof.Project3D("ye"); 457 hof.GetZaxis()->SetRange(-1,9999); 458 h0->SetDirectory(0); 459 460 const Bool_t rc = ScaleAndFit(*h1, h0, paint); 461 462 delete h0; 463 delete h1; 464 465 return rc; 466 } 467 */ 451 468 Bool_t MAlphaFitter::FitAlpha(const TH3D &hon, const TH3D &hof, Bool_t paint) 452 469 { … … 541 558 case kExcess: 542 559 return -GetEventsExcess(); 560 case kGaussSigma: 561 return GetGausSigma(); 543 562 } 544 563 return 0; … … 601 620 if (txt==(TString)"excess") 602 621 fStrategy = kExcess; 622 if (txt==(TString)"gausssigma" || txt==(TString)"gaussigma") 623 fStrategy = kGaussSigma; 603 624 rc = kTRUE; 604 625 } … … 625 646 rc = kTRUE; 626 647 } 648 if (IsEnvDefined(env, prefix, "Signalfunction", print)) 649 { 650 TString txt = GetEnvValue(env, prefix, "SignalFunction", ""); 651 txt = txt.Strip(TString::kBoth); 652 txt.ToLower(); 653 if (txt==(TString)"gauss" || txt==(TString)"gaus") 654 SetSignalFunction(kGauss); 655 if (txt==(TString)"thetasq") 656 SetSignalFunction(kThetaSq); 657 rc = kTRUE; 658 } 627 659 if (IsEnvDefined(env, prefix, "Scale", print)) 628 660 { -
trunk/MagicSoft/Mars/mhflux/MAlphaFitter.h
r7066 r7151 34 34 kSignificanceLogExcess, 35 35 kSignificanceExcess, 36 kExcess 36 kExcess, 37 kGaussSigma 37 38 }; 39 enum SignalFunc_t { 40 kGauss, kThetaSq 41 }; 42 38 43 private: 39 Float_t fSigInt; 40 Float_t fSigMax; 41 Float_t fBgMin; 42 Float_t fBgMax; 43 Float_t fScaleMin; 44 Float_t fScaleMax; 45 Int_t fPolynomOrder; 46 47 Double_t fSignificance; 48 Double_t fEventsExcess; 49 Double_t fEventsSignal; 50 Double_t fEventsBackground; // fScaleFactor already applied 51 52 Double_t fChiSqSignal; 53 Double_t fChiSqBg; 54 Double_t fIntegralMax; 55 Double_t fScaleFactor; // Scale factor for off-data 56 57 TArrayD fCoefficients; 58 59 TF1 *fFunc; 60 61 ScaleMode_t fScaleMode; 62 Double_t fScaleUser; 63 64 Strategy_t fStrategy; 44 // Fitting Setup 45 Float_t fSigInt; // minimum of range to fit the signal 46 Float_t fSigMax; // maximum of range to fit the signal 47 Float_t fBgMin; // minimum of range to fit the background 48 Float_t fBgMax; // minimum of range to fit the background 49 Float_t fScaleMin; // minimum of range to determin the scale factor of the background 50 Float_t fScaleMax; // maximum of range to determin the scale factor of the background 51 Int_t fPolynomOrder; // order of polyom to be fitted to the background 52 Bool_t fFitBackground; // Backround fit: yes/no 53 SignalFunc_t fSignalFunc; // Type of signal function 54 // Result 55 Double_t fSignificance; // significance of signal 56 Double_t fEventsExcess; // calculated number of excess events (signal-bg) 57 Double_t fEventsSignal; // calculated number of signal events 58 Double_t fEventsBackground; // calculated number of bg events (fScaleFactor already applied) 59 60 Double_t fChiSqSignal; // Reduced (chi^2/NDF) chisq of signal fit 61 Double_t fChiSqBg; // Reduced (chi^2/NDF) chisq of bg fit 62 Double_t fIntegralMax; // Calculated bin border to which it was integrated 63 Double_t fScaleFactor; // Scale factor for off-data 64 65 TArrayD fCoefficients; // Fit result 66 67 // Function 68 TF1 *fFunc; // fit function (gauss + polynom) 69 70 // Scaling setup 71 ScaleMode_t fScaleMode; // scaling mode 72 Double_t fScaleUser; // user scale factor 73 74 // Minimization strategy 75 Strategy_t fStrategy; // How to calc minimization value 65 76 66 77 public: 67 78 // Implementing the function yourself is only about 5% faster 68 MAlphaFitter(const char *name=0, const char *title=0) : fSigInt(15), fSigMax(75), fBgMin(45), fBgMax(85), fScaleMin(40), fScaleMax(80), fPolynomOrder(2), fCoefficients(3+fPolynomOrder+1), fFunc(new TF1("", Form("gaus(0) + pol%d(3)", fPolynomOrder), 0, 90)), fScaleMode(kOffRegion), fScaleUser(1), fStrategy(kSignificance) 79 MAlphaFitter(const char *name=0, const char *title=0) : fSigInt(15), 80 fSigMax(75), fBgMin(45), fBgMax(85), fScaleMin(40), fScaleMax(80), 81 fPolynomOrder(2), fFitBackground(kTRUE), fSignalFunc(kGauss), 82 fCoefficients(3+fPolynomOrder+1), 83 fFunc(new TF1("", Form("gaus(0) + pol%d(3)", fPolynomOrder), 0, 90)), 84 fScaleMode(kOffRegion), fScaleUser(1), fStrategy(kSignificance) 69 85 { 70 86 fName = name ? name : "MAlphaFitter"; … … 86 102 } 87 103 104 // TObject 88 105 void Clear(Option_t *o=""); 89 106 void Print(Option_t *o="") const; //*MENU* 90 107 void Copy(TObject &o) const; 91 /* 92 TObject *Clone(const char *name) const 93 { 94 return new MAlphaFitter(*this); 95 } 96 */ 97 108 109 // Setter 98 110 void SetScaleUser(Float_t scale) { fScaleUser = scale; fScaleMode=kUserScale; } 99 111 void SetScaleMode(ScaleMode_t mode) { fScaleMode = mode; } … … 105 117 void SetScaleMin(Float_t s) { fScaleMin = s; } 106 118 void SetScaleMax(Float_t s) { fScaleMax = s; } 107 void SetPolynomOrder(Int_t s) { if (s==fPolynomOrder) return; fPolynomOrder = s; delete fFunc; fFunc=new TF1 ("", Form("gaus(0) + pol%d(3)", s)); 119 void SetPolynomOrder(Int_t s) 120 { 121 if (s==fPolynomOrder) 122 return; 123 124 fPolynomOrder = s; 125 126 SetSignalFunction(fSignalFunc); 127 } 128 void SetSignalFunction(SignalFunc_t func) 129 { 130 delete fFunc; 131 switch (func) 132 { 133 case kGauss: 134 fFunc=new TF1 ("", Form("gaus(0) + pol%d(3)", fPolynomOrder)); 135 break; 136 case kThetaSq: 137 fFunc=new TF1 ("", Form("[0]*exp(-((sqrt(x)-[1])/[2])^2) + pol%d(3)", fPolynomOrder)); 138 break; 139 } 140 fSignalFunc=func; 108 141 gROOT->GetListOfFunctions()->Remove(fFunc); 109 142 fFunc->SetName("Dummy"); 110 fCoefficients.Set(3+s+1); fCoefficients.Reset(); } 111 143 fCoefficients.Set(3+fPolynomOrder+1); 144 fCoefficients.Reset(); 145 } 146 void EnableBackgroundFit(Bool_t b=kTRUE) { fFitBackground=b; } 147 148 // Getter 112 149 Double_t GetSignalIntegralMax() const { return fSigInt; } 113 150 … … 127 164 Double_t GetCoefficient(Int_t i) const { return fCoefficients[i]; } 128 165 const TArrayD &GetCoefficients() const { return fCoefficients; } 129 130 void PaintResult(Float_t x=0.04, Float_t y=0.94, Float_t size=0.035) const; 131 166 Double_t Eval(Double_t d) const { return fFunc ? fFunc->Eval(d) : 0; } 167 168 // Interface to fit 132 169 Bool_t Fit(TH1D &h, Bool_t paint=kFALSE); 133 170 Bool_t Fit(const TH1D &on, const TH1D &off, Double_t alpha, Bool_t paint=kFALSE); … … 149 186 Bool_t FitEnergy(const TH3D &h, UInt_t bin, Bool_t paint=kFALSE); 150 187 Bool_t FitTheta(const TH3D &h, UInt_t bin, Bool_t paint=kFALSE); 188 //Bool_t FitTime(const TH3D &h, UInt_t bin, Bool_t paint=kFALSE); 151 189 152 190 Bool_t FitAlpha(const TH3D &on, const TH3D &off, Bool_t paint=kFALSE); 153 191 Bool_t FitEnergy(const TH3D &on, const TH3D &off, UInt_t bin, Bool_t paint=kFALSE); 154 192 Bool_t FitTheta(const TH3D &on, const TH3D &off, UInt_t bin, Bool_t paint=kFALSE); 193 //Bool_t FitTime(const TH3D &on, const TH3D &off, UInt_t bin, Bool_t paint=kFALSE); 155 194 156 195 Bool_t FitAlpha(const TH3D &on, const TH3D *off, Bool_t paint=kFALSE) … … 165 204 { 166 205 return off ? FitTheta(on, *off, bin, paint) : FitTheta(on, bin, paint); 167 } 206 }/* 207 Bool_t FitTime(const TH3D &on, const TH3D *off, UInt_t bin, Bool_t paint=kFALSE) 208 { 209 return off ? FitTime(on, *off, bin, paint) : FitTime(on, bin, paint); 210 }*/ 168 211 169 212 Double_t Scale(TH1D &off, const TH1D &on) const; 170 213 214 // Interface to result 215 void PaintResult(Float_t x=0.04, Float_t y=0.94, Float_t size=0.035) const; 216 217 // MTask 171 218 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE); 172 219 -
trunk/MagicSoft/Mars/mhflux/MHAlpha.cc
r7142 r7151 292 292 if (!fResult) 293 293 return kFALSE; 294 fSigma = (MParameterD*)const_cast<MParList*>(pl)->FindCreateObj("MParameterD", "GaussSigma"); 295 if (!fSigma) 296 return kFALSE; 294 297 295 298 //fExcess = (MParameterD*)const_cast<MParList*>(pl)->FindCreateObj("MParameterD", "MExcess"); … … 469 472 size = fHillas->GetSize(); 470 473 energy = fEnergy ? fEnergy->GetVal() : (fHillas?fHillas->GetSize():1000); 471 theta = fPointPos ? fPointPos->GetZd() : 0; 472 } 473 474 //if (size>0) 475 // alpha /= (2.4 + 1.13*(log10((energy-14)/0.37)-5)*(log10((energy-14)/0.37)-5))/15; 474 theta = fPointPos ? fPointPos->GetZd() : 0; 475 } 476 476 477 477 // enhance histogram if necessary … … 480 480 // Fill histograms 481 481 fHist.Fill(theta, energy, TMath::Abs(alpha), w); 482 483 // Check cuts484 /*485 if ( (fEnergyMin>=0 && energy<fEnergyMin) ||486 (fEnergyMax>=0 && energy>fEnergyMax) ||487 (fSizeMin>=0 && size <fSizeMin) ||488 (fSizeMax>=0 && size >fSizeMin) )489 return kTRUE;490 */491 482 492 483 if (!fSkipHistTime) … … 851 842 852 843 fResult->SetVal(fFit.GetMinimizationValue()); 844 fSigma->SetVal(fFit.GetGausSigma()); 853 845 854 846 if (!fSkipHistEnergy) -
trunk/MagicSoft/Mars/mhflux/MHAlpha.h
r7122 r7151 44 44 45 45 MParameterD *fResult; //! 46 MParameterD *fSigma; //! 46 47 MParameterD *fEnergy; //! 47 48 MHillas *fHillas; //! -
trunk/MagicSoft/Mars/mhflux/MHThetaSq.h
r7147 r7151 24 24 25 25 Bool_t SetupFill(const MParList *pl); 26 void InitMapping(MHMatrix *mat, Int_t type=0);27 26 28 27 // MParContainer … … 31 30 public: 32 31 MHThetaSq(const char *name=NULL, const char *title=NULL); 32 33 void InitMapping(MHMatrix *mat, Int_t type=0); 33 34 34 35 void SetNumBinsSignal(UInt_t n) { fNumBinsSignal=TMath::Max(n, 1U); } -
trunk/MagicSoft/Mars/mjobs/JobsLinkDef.h
r7121 r7151 19 19 #pragma link C++ class MJSpectrum+; 20 20 21 #pragma link C++ class MJOptimize+;22 #pragma link C++ class MJOptimizeCuts+;23 #pragma link C++ class MJOptimizeEnergy+;24 25 21 #endif -
trunk/MagicSoft/Mars/mjobs/MJOptimize.cc
r7121 r7151 158 158 MParList *plist = fEvtLoop->GetParList(); 159 159 160 MParameterD *eval = (MParameterD*)plist->FindObject( "MinimizationValue", "MParameterD");160 MParameterD *eval = (MParameterD*)plist->FindObject(fNameMinimizationValue, "MParameterD"); 161 161 MParContainer *pars = (MParContainer*)plist->FindObject("MParameters", "MParContainer"); 162 162 … … 172 172 *fLog << endl; 173 173 } 174 174 175 175 pars->SetVariables(par); 176 176 eval->SetVal(0); … … 225 225 } 226 226 227 MJOptimize::MJOptimize() : fDebug(-1), fNumEvents(0), fType(kSimplex), fNumMaxCalls(0), fTolerance(0), fTestTrain(0) 227 MJOptimize::MJOptimize() : fDebug(-1), fNumEvents(0), fType(kSimplex), fNumMaxCalls(0), fTolerance(0), fTestTrain(0), fNameMinimizationValue("MinimizationValue") 228 228 { 229 229 fRules.SetOwner(); … … 648 648 { 649 649 // Checks to make sure, that fcn doesn't crash 650 if (!parlist.FindCreateObj("MParameterD", "MinimizationValue"))650 if (!parlist.FindCreateObj("MParameterD", fNameMinimizationValue)) 651 651 return kFALSE; 652 652 -
trunk/MagicSoft/Mars/mjobs/MJOptimize.h
r7142 r7151 73 73 Float_t fTolerance; 74 74 Int_t fTestTrain; 75 TString fNameMinimizationValue; 75 76 76 77 Bool_t Optimize(MEvtLoop &evtloop); … … 112 113 void SetTolerance(Float_t tol=0) { fTolerance=tol; } 113 114 void EnableTestTrain(Int_t b=1) { fTestTrain=b; } // Use 1 and -1 115 void SetNameMinimizationValue(const char *name="MinimizationValue") { fNameMinimizationValue = name; } 114 116 115 117 // Parameter access -
trunk/MagicSoft/Mars/mjobs/MJOptimizeEnergy.cc
r7121 r7151 27 27 // MJOptimize 28 28 // 29 // Class for otimizing the parameters of the supercuts 29 // Class for otimizing a rule to estimate the energy. For more details see 30 // MJOptimize. 30 31 // 31 // Minimization Control32 // ====================32 // Example: 33 // -------- 33 34 // 34 // To choose the minimization algorithm use: 35 // void SetOptimizer(Optimizer_t o); 36 // 37 // Allowed options are: 38 // enum Optimizer_t 39 // { 40 // kMigrad, // Minimize by the method of Migrad 41 // kSimplex, // Minimize by the method of Simplex 42 // kMinimize, // Migrad + Simplex (if Migrad fails) 43 // kMinos, // Minos error determination 44 // kImprove, // Local minimum search 45 // kSeek, // Minimize by the method of Monte Carlo 46 // kNone // Skip optimization 47 // }; 48 // 49 // For more details on the methods see TMinuit. 50 // 51 // 52 // You can change the behaviour of the minimization using 53 // 54 // void SetNumMaxCalls(UInt_t num=0); 55 // void SetTolerance(Float_t tol=0); 56 // 57 // While NumMaxCalls is the first, Tolerance the second arguement. 58 // For more details start root and type 59 // 60 // gMinuit->mnhelp("command") 61 // 62 // while command can be 63 // * MIGRAD 64 // * SIMPLEX 65 // * MINIMIZE 66 // * MINOS 67 // * IMPROVE 68 // * SEEK 69 // 70 // The default (num==0 and tol==0) should always give you the 71 // corresponding defaults used in Minuit. 72 // 73 // 74 // FIXME: Implement changing cut in hadronness... 75 // FIXME: Show MHSignificance on MStatusDisplay during filling... 76 // FIXME: Choose step-size percentage as static data membewr 77 // FIXME: Choose minimization method 35 // MJOptimizeEnergy opt; 36 // opt.SetDebug(2); 37 // opt.SetOptimizer(MJOptimize::kMigrad); 38 // opt.SetNumEvents(20000); 39 // opt.EnableTestTrain(); 40 // opt.AddParameter("MHillas.fSize"); 41 // opt.SetParameter(0, 1, 0, 2); 42 // char *r = "[0]*M[0]"; //Rule to calculate estimated energy 43 // MStatusDisplay *d = new MStatusDisplay; 44 // opt.SetDisplay(d); 45 // opt.RunDisp("ganymed-summary.root", r); 78 46 // 79 47 ///////////////////////////////////////////////////////////////////////////// … … 116 84 // energy estimator. 117 85 // 118 Bool_t MJOptimizeEnergy::RunEnergy(const char *fname, const char *rule )86 Bool_t MJOptimizeEnergy::RunEnergy(const char *fname, const char *rule, MTask *weights) 119 87 { 120 88 fLog->Separator("Preparing Energy optimization"); … … 139 107 hist.InitMapping(&m); 140 108 141 M EnergyEstimate est("MParameters");142 est.Set Rule(rule);109 MParameterCalc est(rule, "MParameters"); 110 est.SetNameParameter("MEnergyEst"); 143 111 parlist.AddToList(&est); 144 112 … … 159 127 160 128 MFillH fill(&hist); 129 if (weights) 130 fill.SetWeight(); 161 131 162 132 MMatrixLoop loop(&m); … … 164 134 tasklist.AddToList(&loop); 165 135 tasklist.AddToList(&est); 136 if (weights) 137 tasklist.AddToList(weights); 166 138 tasklist.AddToList(&fill); 167 139 -
trunk/MagicSoft/Mars/mjobs/MJOptimizeEnergy.h
r7121 r7151 6 6 #endif 7 7 8 class MTask; 9 8 10 class MJOptimizeEnergy : public MJOptimize 9 11 { 10 12 public: 13 MJOptimizeEnergy() : MJOptimize() { } 14 11 15 // Special optimizing routines 12 Bool_t RunEnergy(const char *fname, const char *rule );13 Bool_t RunEnergy(const char *rule )16 Bool_t RunEnergy(const char *fname, const char *rule, MTask *weights=0); 17 Bool_t RunEnergy(const char *rule, MTask *weights=0) 14 18 { 15 return RunEnergy(0, rule );19 return RunEnergy(0, rule, weights); 16 20 } 17 21
Note:
See TracChangeset
for help on using the changeset viewer.