Changeset 9337 for trunk/MagicSoft/Mars/mhflux
- Timestamp:
- 02/15/09 13:47:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhflux/MMcSpectrumWeight.cc
r8907 r9337 41 41 // ------- 42 42 // 43 // - Corsika spectru n: dN/dE = A * E^(a)43 // - Corsika spectrum: dN/dE = A * E^(a) 44 44 // with a = fOldSlope, and A = N/integral{E*de} from ELowLim to EUppLim 45 45 // … … 90 90 #include "MLogManip.h" 91 91 92 #include "MString.h" 92 93 #include "MParList.h" 93 94 #include "MParameters.h" … … 204 205 TString MMcSpectrumWeight::ReplaceX(TString str) const 205 206 { 206 return str.ReplaceAll( Form("%s.fEnergy", fNameMcEvt.Data()), "(x)");207 return str.ReplaceAll(MString::Format("%s.fEnergy", fNameMcEvt.Data()), "(x)"); 207 208 } 208 209 … … 216 217 TString MMcSpectrumWeight::GetFormulaSpecOld(const char *name) const 217 218 { 218 return Form("pow(%s.fEnergy, %.3f)", name, fOldSlope);219 return MString::Format("pow(%s.fEnergy, %.3f)", name, fOldSlope); 219 220 } 220 221 … … 231 232 TString MMcSpectrumWeight::GetFormulaSpecNew(const char *name) const 232 233 { 233 TString str = fFormula.IsNull() ? Form("pow(%s.fEnergy, %.3f)", name, fNewSlope) : fFormula.Data();234 TString str = fFormula.IsNull() ? MString::Format("pow(%s.fEnergy, %.3f)", name, fNewSlope) : fFormula; 234 235 if (!fFormula.IsNull()) 235 str.ReplaceAll("X", Form("(%s.fEnergy)", name));236 str.ReplaceAll("X", MString::Format("(%s.fEnergy)", name)); 236 237 237 238 return str; … … 265 266 { 266 267 if (GetFormulaSpecOld()==GetFormulaSpecNew()) 267 return Form("%.16e", fNorm);268 return MString::Format("%.16e", fNorm); 268 269 269 270 const Double_t iold = fNormEnergy<0 ? GetSpecOldIntegral() : CalcSpecOld(fNormEnergy); … … 272 273 const Double_t norm = fNorm*iold/inew; 273 274 274 return Form("%.16e*(%s)/(%s)", norm, GetFormulaSpecNew(name).Data(), GetFormulaSpecOld(name).Data());275 return MString::Format("%.16e*(%s)/(%s)", norm, GetFormulaSpecNew(name).Data(), GetFormulaSpecOld(name).Data()); 275 276 } 276 277 … … 388 389 } 389 390 391 if (fNormEnergy<0 && fEnergyMin>0 && TMath::Abs(fEnergyMin-rh.GetELowLim())>1e-10) 392 { 393 *fLog << err; 394 *fLog << "You try to use changing minimum simulated Monte Carlo energies" << endl; 395 *fLog << "together with a normalization calculated from the integral." << endl; 396 *fLog << "This is not yet supported. Please switch to a normalization" << endl; 397 *fLog << "at a dedicated energy by specifying the energy" << endl; 398 *fLog << " MMcSpectrumWeight.NormEnergy: 500" << endl; 399 *fLog << "in your sponde.rc." << endl; 400 return kFALSE; 401 } 402 390 403 fOldSlope = rh.GetSlopeSpec(); 391 404 fEnergyMin = rh.GetELowLim(); … … 413 426 414 427 fFunc = new TF1("", GetFormulaWeightsX().Data()); 428 fFunc->SetName("SpectralWeighs"); 415 429 gROOT->GetListOfFunctions()->Remove(fFunc); 416 fFunc->SetName("SpectralWeighs");417 430 418 431 return kTRUE; … … 465 478 const TAxis &axey = *h.GetYaxis(); 466 479 467 // Find energy range between the minimum energy to be fille s(emin)480 // Find energy range between the minimum energy to be filled (emin) 468 481 // and the minimum energy corresponding to the data filled into 469 482 // this histogram (fEnergyMin) 470 483 const Int_t first = axey.FindFixBin(emin); 471 const Int_t last = axey.FindFixBin(fEnergyMin); 472 const Int_t max = axey.FindFixBin(fEnergyMax); 484 const Int_t last = axey.FindFixBin(fEnergyMin); // data range min energy 485 const Int_t max = axey.FindFixBin(fEnergyMax); // data range max energy 473 486 474 487 for (int x=1; x<=h.GetNbinsX(); x++) … … 537 550 } 538 551 *fLog << " Additional user norm.: " << fNorm << endl; 539 *fLog << " Spectra are normalized: " << (fNormEnergy<0?"by integral": Form("at %.1fGeV", fNormEnergy)) << endl;552 *fLog << " Spectra are normalized: " << (fNormEnergy<0?"by integral":MString::Format("at %.1fGeV", fNormEnergy)) << endl; 540 553 if (hasold) 541 554 {
Note:
See TracChangeset
for help on using the changeset viewer.