Changeset 6924
- Timestamp:
- 04/11/05 16:15:08 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MMatrixLoop.cc
r6499 r6924 46 46 // through. 47 47 // 48 MMatrixLoop::MMatrixLoop(MHMatrix *mat, const char *name, const char *title) : fMatrix(mat) 48 MMatrixLoop::MMatrixLoop(MHMatrix *mat, const char *name, const char *title) : fMatrix(mat), fOperationMode(kDefault) 49 49 { 50 50 fName = name ? name : gsDefName.Data(); … … 75 75 Int_t MMatrixLoop::PreProcess(MParList *plist) 76 76 { 77 fNumRow = 0;77 fNumRow = fOperationMode==kOdd ? 1 : 0; 78 78 79 79 return fMatrix ? kTRUE : kFALSE; … … 87 87 Int_t MMatrixLoop::Process() 88 88 { 89 return fMatrix->SetNumRow(fNumRow++); 89 const Int_t rc = fMatrix->SetNumRow(fNumRow); 90 fNumRow += fOperationMode==kDefault ? 1 : 2; 91 return rc; 90 92 } -
trunk/MagicSoft/Mars/manalysis/MMatrixLoop.h
r6499 r6924 10 10 class MMatrixLoop : public MRead 11 11 { 12 public: 13 enum OperationMode_t { 14 kDefault, 15 kEven, 16 kOdd 17 }; 12 18 private: 13 19 // MMatrixLoop … … 17 23 MHMatrix *fMatrix; 18 24 Int_t fNumRow; //! Number of dimensions of histogram 25 26 Byte_t fOperationMode; 19 27 20 28 // MRead … … 33 41 MMatrixLoop(MHMatrix *mat, const char *name=NULL, const char *title=NULL); 34 42 43 void SetOperationMode(OperationMode_t mode) { fOperationMode = mode; } 44 35 45 ClassDef(MMatrixLoop, 0) // Task 'reading' events from a MHMatrix 36 46 }; -
trunk/MagicSoft/Mars/mhflux/MHEnergyEst.cc
r6917 r6924 78 78 fHResolution.SetDirectory(NULL); 79 79 fHResolution.SetName("EnergyRes"); 80 fHResolution.SetTitle("Histogram in \\frac{\\Delta E}{E_{mc}} vs E_{est} and E_{mc}");80 fHResolution.SetTitle("Histogram in \\frac{\\Delta lg(E)}{lg(E_{mc})} vs E_{est} and E_{mc}"); 81 81 fHResolution.SetXTitle("E_{est} [GeV]"); 82 82 fHResolution.SetYTitle("E_{mc} [GeV]"); 83 fHResolution.SetZTitle("\\frac{ E_{est} - E_{mc}}{E_{mc}}");83 fHResolution.SetZTitle("\\frac{lg(E_{est}) - lg(E_{mc})}{lg(E_{mc})}"); 84 84 85 85 fHImpact.SetDirectory(NULL); 86 86 fHImpact.SetName("Impact"); 87 fHImpact.SetTitle("\\frac{\\Delta E}{E} vs Impact parameter");87 fHImpact.SetTitle("\\frac{\\Delta lg(E)}{lg(E)} vs Impact parameter"); 88 88 fHImpact.SetXTitle("Impact parameter [m]"); 89 fHImpact.SetYTitle("\\frac{ E_{est} - E_{mc}}{E_{mc}}");89 fHImpact.SetYTitle("\\frac{lg(E_{est}) - lg(E_{mc})}{lg(E_{mc})}"); 90 90 91 91 fHEnergy.Sumw2(); … … 97 97 binst.SetEdgesCos(50, 0, 60); 98 98 binsi.SetEdges(10, 0, 400); 99 binsr.SetEdges( 10, 0, 1);99 binsr.SetEdges(50, -1.3, 1.3); 100 100 101 101 SetBinning(&fHEnergy, &binse, &binse, &binst); … … 164 164 const Double_t imp = fMatrix ? GetVal(1) : fMcEvt->GetImpact()/100; 165 165 const Double_t theta = fMatrix ? GetVal(2) : fMcEvt->GetTelescopeTheta()*TMath::RadToDeg(); 166 const Double_t res = (eest-etru)/etru; 166 const Double_t res = (log10(eest)-log10(etru));///log10(etru); 167 const Double_t resE = (eest-etru)/etru; 167 168 168 169 fHEnergy.Fill(eest, etru, theta, w); 169 fHResolution.Fill(eest, etru, TMath::Abs(res), w);170 fHImpact.Fill(imp, TMath::Abs(res), w);171 172 fChisq += TMath::Abs(res);//*res;170 fHResolution.Fill(eest, etru, resE, w); 171 fHImpact.Fill(imp, resE, w); 172 173 fChisq += res*res; 173 174 fBias += res; 174 175 … … 181 182 fBias /= GetNumExecutions(); 182 183 183 Double_t res = fChisq; //TMath::Sqrt(fChisq - fBias*fBias); 184 185 fResult->SetVal(TMath::IsNaN(res)?0:res);/// GetNumExecutions()); 186 187 *fLog << all << "Mean Energy Resoltuion: " << Form("%.1f%%", fResult->GetVal()*100) << endl; 188 *fLog << all << "Energy Bias at: " << Form("%.1f%%", fBias*100) << endl; 184 Double_t sigma = TMath::Sqrt(fChisq);//+TMath::Abs(fBias); 185 fResult->SetVal(sigma); 186 187 *fLog << all << "Mean log10(Energy) Resoltion: " << Form("%.1f%%", TMath::Sqrt(fChisq-fBias*fBias)*100) << endl; 188 *fLog << all << "Mean log10(Energy) Bias: " << Form("%.1f%%", fBias*100) << endl; 189 189 190 190 return kTRUE; … … 239 239 } 240 240 241 //pad->GetPad(1)->GetPad(2)->cd(2); 241 pad->GetPad(1)->GetPad(2)->cd(2); 242 /*=*/fHResolution.ProjectionZ("Resolution"); 242 243 ///*h =*/ fHImpact.ProjectionX("Impact", -1, 9999, "e"); 243 244 } … … 294 295 gPad->SetBorderMode(0); 295 296 gPad->SetLogx(); 297 gPad->SetGridx(); 298 gPad->SetGridy(); 296 299 297 300 //gROOT->GetListOfCleanups()->Add(gPad); // WHY? … … 301 304 h2->SetBit(kCanDelete); 302 305 h2->SetFillColor(kBlue); 306 h2->SetLineColor(kRed); 303 307 304 308 TH1D *h1 = h2->ProfileX(Form("Prof%s", h.GetName()), -1, 9999, "s"); … … 310 314 h1->SetStats(kFALSE); 311 315 312 313 //h1->Draw("E3"); 314 h2->Draw(); 316 h2->Draw(""); 317 h1->Draw("E3same"); 315 318 h1->Draw("Chistsame"); 316 319 … … 346 349 gPad->SetBorderMode(0); 347 350 351 gPad->SetGridx(); 352 gPad->SetGridy(); 348 353 gPad->SetLogx(); 349 354 h = (TH1D*)fHEnergy.Project3D("ey"); … … 376 381 pad3->Divide(2, 1, 1e-10, 1e-10); 377 382 pad3->cd(1); 378 gPad->SetBorderMode(0);/* 383 gPad->SetBorderMode(0); 384 gPad->SetGridx(); 385 gPad->SetGridy(); 386 h = fHEnergy.Project3D("ez"); 387 h->SetTitle("Zenith Angle Distribution"); 388 h->SetBit(TH1::kNoStats); 389 h->SetDirectory(NULL); 390 h->SetXTitle("\\Theta [\\circ]"); 391 h->SetBit(kCanDelete); 392 h->Draw(); 393 394 pad3->cd(2); 395 gPad->SetBorderMode(0); 396 gPad->SetGridx(); 397 gPad->SetGridy(); 398 /* 379 399 h = fHImpact.ProjectionX("Impact", -1, 9999, "e"); 380 400 h->SetBit(TH1::kNoStats); … … 384 404 h->SetBit(kCanDelete); 385 405 h->Draw();*/ 386 h = fHEnergy.Project3D("ez"); 387 h->SetTitle("Distribution of Theta"); 388 h->SetBit(TH1::kNoStats); 406 // ---------------------------------------- 407 h = fHResolution.ProjectionZ("Resolution"); 408 //h->SetXTitle("\\frac{lg(E_{est}) - lg(E_{mc})}{lg(E_{mc})}"); 409 h->SetYTitle("Counts"); 410 h->SetTitle("Distribution of \\Delta lg(E) / lg(E_{mc})"); 389 411 h->SetDirectory(NULL); 390 h->SetXTitle("\\Theta [\\circ]");391 412 h->SetBit(kCanDelete); 392 h->Draw(); 393 394 pad3->cd(2); 395 gPad->SetBorderMode(0); 413 h->GetXaxis()->SetRangeUser(-1.3, 1.3); 414 h->Draw(""); 415 // ---------------------------------------- 396 416 397 417 pad->cd(2); … … 413 433 h = MakePlot(fHResolution, "zy"); 414 434 h->SetXTitle("E_{mc} [GeV]"); 415 h->SetYTitle("\\frac{ E_{est} - E_{mc}}{E_{mc}}");416 h->SetTitle("Energy resolution \\Delta E / Evs Monte Carlo energy E_{mc}");417 h->SetMinimum( 0);418 h->SetMaximum(1 );435 h->SetYTitle("\\frac{lg(E_{est}) - lg(E_{mc})}{lg(E_{mc})}"); 436 h->SetTitle("Energy resolution \\Delta lg(E) / lg(E) vs Monte Carlo energy E_{mc}"); 437 h->SetMinimum(-1.3); 438 h->SetMaximum(1.3); 419 439 420 440 pad2->cd(3); 421 441 h = MakePlot(fHResolution, "zx"); 422 442 h->SetXTitle("E_{est} [GeV]"); 423 h->SetYTitle("\\frac{ E_{est} - E_{mc}}{E_{mc}}");424 h->SetTitle("Energy Resolution \\Delta E / Evs estimated Energy E_{est}");425 h->SetMinimum( 0);426 h->SetMaximum(1 );443 h->SetYTitle("\\frac{lg(E_{est}) - lg(E_{mc})}{lg(E_{mc})}"); 444 h->SetTitle("Energy Resolution \\Delta lg(E) / lg(E) vs estimated Energy E_{est}"); 445 h->SetMinimum(-1.3); 446 h->SetMaximum(1.3); 427 447 } 428 448 -
trunk/MagicSoft/Mars/mjobs/MJOptimize.cc
r6907 r6924 228 228 } 229 229 230 MJOptimize::MJOptimize() : fDebug(-1), fNumEvents(0), fType(kSimplex), fNumMaxCalls(0), fTolerance(0) 230 MJOptimize::MJOptimize() : fDebug(-1), fNumEvents(0), fType(kSimplex), fNumMaxCalls(0), fTolerance(0), fTestTrain(kFALSE) 231 231 { 232 232 fRules.SetOwner(); … … 642 642 } 643 643 644 MMatrixLoop *loop = dynamic_cast<MMatrixLoop*>(parlist.FindTask("MRead")); 645 644 646 TString txt("Starting "); 645 647 switch (fType) … … 666 668 *fLog << inf << "Number of Parameters: " << fParameters.GetSize() << endl; 667 669 670 // In case the reader is the matrix loop and testrain is enabled 671 // switch on even mode... 672 if (loop && fTestTrain) 673 loop->SetOperationMode(MMatrixLoop::kEven); 674 668 675 if (!Optimize(evtloop)) 669 676 return kFALSE; … … 672 679 673 680 fEvtLoop->SetDisplay(fDisplay); 674 return Fcn(fParameters); 681 if (!Fcn(fParameters)) 682 return kFALSE; 683 684 // In case the reader is the matrix loop and testrain is enabled 685 // switch on odd mode... 686 if (!loop || !fTestTrain) 687 return kTRUE; 688 689 loop->SetOperationMode(MMatrixLoop::kOdd); 690 675 691 // Done already in Fcn 676 692 // list.SetVariables(fParameters); 693 return Fcn(fParameters); 677 694 } 678 695 -
trunk/MagicSoft/Mars/mjobs/MJOptimize.h
r6896 r6924 84 84 UInt_t fNumMaxCalls; 85 85 Float_t fTolerance; 86 Bool_t fTestTrain; 86 87 87 88 Bool_t Optimize(MEvtLoop &evtloop); … … 108 109 void SetNumMaxCalls(UInt_t num=0) { fNumMaxCalls=num; } 109 110 void SetTolerance(Float_t tol=0) { fTolerance=tol; } 111 void EnableTestTrain(Bool_t b=kTRUE) { fTestTrain=b; } 110 112 111 113 // Parameter access
Note:
See TracChangeset
for help on using the changeset viewer.