Changeset 9337 for trunk


Ignore:
Timestamp:
02/15/09 13:47:00 (16 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.cc

    r8354 r9337  
    8989// --------------------------------------------------------------------------
    9090//
    91 // Check for the run type. Return kTRUE if it is a MC run or if there
    92 // is no MC run header (old camera files) kFALSE in case of a different
    93 // run type
    94 //
    95 Bool_t MMcCalibrationUpdate::CheckRunType(MParList *pList) const
    96 {
    97     const MRawRunHeader *run = (MRawRunHeader*)pList->FindObject(AddSerialNumber("MRawRunHeader"));
    98     if (!run)
    99     {
    100         *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl;
    101         return kTRUE;
    102     }
    103 
    104     return run->IsMonteCarloRun();
    105 }
    106 
    107 // --------------------------------------------------------------------------
    108 //
    10991// Make sure, that there is an MCalibrationCam Object in the Parameter List.
    11092//
     
    150132Bool_t MMcCalibrationUpdate::ReInit(MParList *pList)
    151133{
     134    const MRawRunHeader *run = (MRawRunHeader*)pList->FindObject(AddSerialNumber("MRawRunHeader"));
     135    if (!run)
     136    {
     137        *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl;
     138        return kTRUE;
     139    }
     140
    152141    //
    153142    // If it is no MC file skip this function...
    154143    //
    155144    fGeom = 0;
    156     if (!CheckRunType(pList))
     145    if (run->IsMonteCarloRun())
    157146    {
    158147        *fLog << inf << "This is no MC file... skipping." << endl;
    159148        return kTRUE;
    160149    }
     150
     151    const MMcRunHeader* mcrunh = (MMcRunHeader*) pList->FindObject(AddSerialNumber("MMcRunHeader"));
     152    if (!mcrunh)
     153    {
     154        *fLog << err << AddSerialNumber("MMcRunHeader") << " not found... aborting." << endl;
     155        return kFALSE;
     156    }
     157
     158    if (mcrunh->IsCeres())
     159    {
     160        *fLog << inf;
     161        *fLog << "This is a ceres file... skipping." << endl;
     162        *fLog << "   MCalibrationChargeCam (calibration constants), MCalibrationQECam (avg quantum efficiency)" << endl;
     163        *fLog << "   and MPedPhotCam (randomly extracted pedestal) not updated." << endl;
     164        return kTRUE;
     165    }
    161166       
    162167    //
     
    174179    {
    175180        *fLog << err << AddSerialNumber("MMcFadcHeader") << " not found... aborting." << endl;
    176         return kFALSE;
    177     }
    178 
    179     MMcRunHeader* mcrunh = (MMcRunHeader*) pList->FindObject(AddSerialNumber("MMcRunHeader"));
    180     if (!mcrunh)
    181     {
    182         *fLog << err << AddSerialNumber("MMcRunHeader") << " not found... aborting." << endl;
    183181        return kFALSE;
    184182    }
  • 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.