Changeset 9337 for trunk/MagicSoft
- Timestamp:
- 02/15/09 13:47:00 (16 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MMcCalibrationUpdate.cc
r8354 r9337 89 89 // -------------------------------------------------------------------------- 90 90 // 91 // Check for the run type. Return kTRUE if it is a MC run or if there92 // is no MC run header (old camera files) kFALSE in case of a different93 // run type94 //95 Bool_t MMcCalibrationUpdate::CheckRunType(MParList *pList) const96 {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 //109 91 // Make sure, that there is an MCalibrationCam Object in the Parameter List. 110 92 // … … 150 132 Bool_t MMcCalibrationUpdate::ReInit(MParList *pList) 151 133 { 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 152 141 // 153 142 // If it is no MC file skip this function... 154 143 // 155 144 fGeom = 0; 156 if ( !CheckRunType(pList))145 if (run->IsMonteCarloRun()) 157 146 { 158 147 *fLog << inf << "This is no MC file... skipping." << endl; 159 148 return kTRUE; 160 149 } 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 } 161 166 162 167 // … … 174 179 { 175 180 *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;183 181 return kFALSE; 184 182 } -
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.