Ignore:
Timestamp:
02/15/09 13:47:00 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mhflux/MMcSpectrumWeight.cc

    r8907 r9337  
    4141//  -------
    4242//
    43 //   - Corsika spectrun: dN/dE = A * E^(a)
     43//   - Corsika spectrum: dN/dE = A * E^(a)
    4444//     with a = fOldSlope, and A = N/integral{E*de} from ELowLim to EUppLim
    4545//
     
    9090#include "MLogManip.h"
    9191
     92#include "MString.h"
    9293#include "MParList.h"
    9394#include "MParameters.h"
     
    204205TString MMcSpectrumWeight::ReplaceX(TString str) const
    205206{
    206     return str.ReplaceAll(Form("%s.fEnergy", fNameMcEvt.Data()), "(x)");
     207    return str.ReplaceAll(MString::Format("%s.fEnergy", fNameMcEvt.Data()), "(x)");
    207208}
    208209
     
    216217TString MMcSpectrumWeight::GetFormulaSpecOld(const char *name) const
    217218{
    218     return Form("pow(%s.fEnergy, %.3f)", name, fOldSlope);
     219    return MString::Format("pow(%s.fEnergy, %.3f)", name, fOldSlope);
    219220}
    220221
     
    231232TString MMcSpectrumWeight::GetFormulaSpecNew(const char *name) const
    232233{
    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;
    234235    if (!fFormula.IsNull())
    235         str.ReplaceAll("X", Form("(%s.fEnergy)", name));
     236        str.ReplaceAll("X", MString::Format("(%s.fEnergy)", name));
    236237
    237238    return str;
     
    265266{
    266267    if (GetFormulaSpecOld()==GetFormulaSpecNew())
    267         return Form("%.16e", fNorm);
     268        return MString::Format("%.16e", fNorm);
    268269
    269270    const Double_t iold = fNormEnergy<0 ? GetSpecOldIntegral() : CalcSpecOld(fNormEnergy);
     
    272273    const Double_t norm = fNorm*iold/inew;
    273274
    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());
    275276}
    276277
     
    388389    }
    389390
     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
    390403    fOldSlope  = rh.GetSlopeSpec();
    391404    fEnergyMin = rh.GetELowLim();
     
    413426
    414427    fFunc = new TF1("", GetFormulaWeightsX().Data());
     428    fFunc->SetName("SpectralWeighs");
    415429    gROOT->GetListOfFunctions()->Remove(fFunc);
    416     fFunc->SetName("SpectralWeighs");
    417430
    418431    return kTRUE;
     
    465478    const TAxis &axey = *h.GetYaxis();
    466479
    467     // Find energy range between the minimum energy to be filles (emin)
     480    // Find energy range between the minimum energy to be filled (emin)
    468481    // and the minimum energy corresponding to the data filled into
    469482    // this histogram (fEnergyMin)
    470483    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
    473486
    474487    for (int x=1; x<=h.GetNbinsX(); x++)
     
    537550    }
    538551    *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;
    540553    if (hasold)
    541554    {
Note: See TracChangeset for help on using the changeset viewer.