From 06349ac90a0139c2e178ec4c5021e461a3cc394b Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Sat, 13 Apr 2013 00:14:18 +0200 Subject: [PATCH] Use gammalib namespace for GammaLib functions. --- src/ctbin/ctbin.cpp | 12 ++++++------ src/ctlike/ctlike.cpp | 13 ++++++++----- src/ctmodel/ctmodel.cpp | 8 ++++---- src/ctobssim/ctobssim.cpp | 34 +++++++++++++++++----------------- src/ctselect/ctselect.cpp | 18 +++++++++--------- src/ctskymap/ctskymap.cpp | 10 +++++----- 6 files changed, 49 insertions(+), 46 deletions(-) diff --git a/src/ctbin/ctbin.cpp b/src/ctbin/ctbin.cpp index 63a8ff4..cc26ad9 100644 --- a/src/ctbin/ctbin.cpp +++ b/src/ctbin/ctbin.cpp @@ -503,7 +503,7 @@ void ctbin::bin_events(GCTAObservation* obs) } // Set reference point to pointing - if (toupper(m_coordsys) == "GAL") { + if (gammalib::toupper(m_coordsys) == "GAL") { xref = pnt->dir().l_deg(); yref = pnt->dir().b_deg(); } @@ -558,13 +558,13 @@ void ctbin::bin_events(GCTAObservation* obs) if (logTerse()) { log << std::endl; log.header1("Binning"); - log << parformat("Events in list"); + log << gammalib::parformat("Events in list"); log << obs->events()->size() << std::endl; - log << parformat("Events in map"); + log << gammalib::parformat("Events in map"); log << num_in_map << std::endl; - log << parformat("Events outside map area"); + log << gammalib::parformat("Events outside map area"); log << num_outside_map << std::endl; - log << parformat("Events outside energy bins"); + log << gammalib::parformat("Events outside energy bins"); log << num_outside_ebds << std::endl; } @@ -690,7 +690,7 @@ void ctbin::free_members(void) std::string ctbin::set_outfile_name(const std::string& filename) const { // Split input filename into path elements - std::vector elements = split(filename, "/"); + std::vector elements = gammalib::split(filename, "/"); // The last path element is the filename std::string outname = m_prefix + elements[elements.size()-1]; diff --git a/src/ctlike/ctlike.cpp b/src/ctlike/ctlike.cpp index 040a08f..9dbd6a6 100644 --- a/src/ctlike/ctlike.cpp +++ b/src/ctlike/ctlike.cpp @@ -264,9 +264,12 @@ void ctlike::run(void) // Write results into logger if (logTerse()) { - log << parformat("Maximum log likelihood") << m_logL << std::endl; - log << parformat("Observed events (Nobs)") << num_events << std::endl; - log << parformat("Predicted events (Npred)") << m_obs.npred(); + log << gammalib::parformat("Maximum log likelihood"); + log << m_logL << std::endl; + log << gammalib::parformat("Observed events (Nobs)"); + log << num_events << std::endl; + log << gammalib::parformat("Predicted events (Npred)"); + log << m_obs.npred(); log << " (Nobs - Npred = " << num_events-m_obs.npred(); log << ")" << std::endl; log << m_obs.models() << std::endl; @@ -294,7 +297,7 @@ void ctlike::save(void) m_outmdl = (*this)["outmdl"].filename(); // Write results out as XML model - if (toupper(m_outmdl) != "NONE") { + if (gammalib::toupper(m_outmdl) != "NONE") { m_obs.models().save(m_outmdl); } @@ -351,7 +354,7 @@ void ctlike::get_parameters(void) } // Get task parameters for event file loading - m_stat = toupper((*this)["stat"].string()); + m_stat = gammalib::toupper((*this)["stat"].string()); m_caldb = (*this)["caldb"].string(); m_irf = (*this)["irf"].string(); diff --git a/src/ctmodel/ctmodel.cpp b/src/ctmodel/ctmodel.cpp index 216807e..87e578d 100644 --- a/src/ctmodel/ctmodel.cpp +++ b/src/ctmodel/ctmodel.cpp @@ -403,7 +403,7 @@ void ctmodel::get_parameters(void) // If there is no input filename then read all parameters that // are required to build a model map from scratch - if ((m_infile == "NONE") || (strip_whitespace(m_infile) == "")) { + if ((m_infile == "NONE") || (gammalib::strip_whitespace(m_infile) == "")) { m_ra = (*this)["ra"].real(); m_dec = (*this)["dec"].real(); m_deadc = (*this)["deadc"].real(); @@ -474,7 +474,7 @@ void ctmodel::setup_obs(void) // If no input filename has been specified, then create a model map // from the task parameters - if ((m_infile == "NONE") || (strip_whitespace(m_infile) == "")) { + if ((m_infile == "NONE") || (gammalib::strip_whitespace(m_infile) == "")) { // Set pointing direction GCTAPointing pnt; @@ -640,7 +640,7 @@ void ctmodel::model_map(GCTAObservation* obs, const GModels& models) // Log results if (logTerse()) { - log << parformat("Model events in cube"); + log << gammalib::parformat("Model events in cube"); log << sum << std::endl; } @@ -767,7 +767,7 @@ void ctmodel::free_members(void) std::string ctmodel::set_outfile_name(const std::string& filename) const { // Split input filename into path elements - std::vector elements = split(filename, "/"); + std::vector elements = gammalib::split(filename, "/"); // The last path element is the filename std::string outname = m_prefix + elements[elements.size()-1]; diff --git a/src/ctobssim/ctobssim.cpp b/src/ctobssim/ctobssim.cpp index 361496b..5313c5a 100644 --- a/src/ctobssim/ctobssim.cpp +++ b/src/ctobssim/ctobssim.cpp @@ -251,8 +251,8 @@ void ctobssim::run(void) log << std::endl; log.header1("Seed values"); for (int i = 0; i < m_rans.size(); ++i) { - log << parformat("Seed "+str(i)); - log << str(m_rans[i].seed()) << std::endl; + log << gammalib::parformat("Seed "+gammalib::str(i)); + log << gammalib::str(m_rans[i].seed()) << std::endl; } } @@ -640,9 +640,9 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, // Dump simulation cone information if (logNormal()) { - *wrklog << parformat("Simulation area"); - *wrklog << str(m_area) << " cm2" << std::endl; - *wrklog << parformat("Simulation cone"); + *wrklog << gammalib::parformat("Simulation area"); + *wrklog << m_area << " cm2" << std::endl; + *wrklog << gammalib::parformat("Simulation cone"); *wrklog << "RA=" << dir.ra_deg() << " deg"; *wrklog << ", Dec=" << dir.dec_deg() << " deg"; *wrklog << ", r=" << rad << " deg" << std::endl; @@ -664,7 +664,7 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, indent++; wrklog->indent(indent); } - *wrklog << parformat("Time interval", indent); + *wrklog << gammalib::parformat("Time interval", indent); *wrklog << tmin.convert(m_cta_ref); *wrklog << " - "; *wrklog << tmax.convert(m_cta_ref); @@ -684,7 +684,7 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, indent++; wrklog->indent(indent); } - *wrklog << parformat("Energy range", indent); + *wrklog << gammalib::parformat("Energy range", indent); *wrklog << emin << " - " << emax << std::endl; } @@ -722,7 +722,7 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, indent++; wrklog->indent(indent); } - *wrklog << parformat("Time slice", indent); + *wrklog << gammalib::parformat("Time slice", indent); *wrklog << tstart.convert(m_cta_ref); *wrklog << " - "; *wrklog << tstop.convert(m_cta_ref); @@ -775,14 +775,14 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, // Dump simulation results if (logNormal()) { - *wrklog << parformat("MC source photons", indent); - *wrklog << str(nphotons); + *wrklog << gammalib::parformat("MC source photons", indent); + *wrklog << nphotons; if (model->name().length() > 0) { *wrklog << " [" << model->name() << "]"; } *wrklog << std::endl; - *wrklog << parformat("MC source events", indent); - *wrklog << str(events->size()); + *wrklog << gammalib::parformat("MC source events", indent); + *wrklog << events->size(); if (model->name().length() > 0) { *wrklog << " [" << model->name() << "]"; } @@ -796,8 +796,8 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models, // Dump simulation results if (logNormal()) { - *wrklog << parformat("MC source events", indent); - *wrklog << str(events->size()); + *wrklog << gammalib::parformat("MC source events", indent); + *wrklog << events->size(); *wrklog << " (all source models)"; *wrklog << std::endl; } @@ -909,8 +909,8 @@ void ctobssim::simulate_background(GCTAObservation* obs, // Dump simulation results if (logNormal()) { - *wrklog << parformat("MC background events"); - *wrklog << str(list->size()) << std::endl; + *wrklog << gammalib::parformat("MC background events"); + *wrklog << list->size() << std::endl; } // Free event list @@ -1087,7 +1087,7 @@ void ctobssim::save_xml(void) if (obs != NULL) { // Set event output file name - std::string outfile = m_prefix + str(file_num) + ".fits"; + std::string outfile = m_prefix + gammalib::str(file_num) + ".fits"; // Store output file name in observation obs->eventfile(outfile); diff --git a/src/ctselect/ctselect.cpp b/src/ctselect/ctselect.cpp index 2ec8a65..7e955d2 100644 --- a/src/ctselect/ctselect.cpp +++ b/src/ctselect/ctselect.cpp @@ -537,7 +537,7 @@ void ctselect::select_events(GCTAObservation* obs, const std::string& filename) sprintf(cmax, "%.8f", tmax); selection = "TIME >= "+std::string(cmin)+" && TIME <= "+std::string(cmax); if (logTerse()) { - log << parformat("Time range"); + log << gammalib::parformat("Time range"); log << tmin << " - " << tmax << " s" << std::endl; } if (selection.length() > 0) { @@ -550,7 +550,7 @@ void ctselect::select_events(GCTAObservation* obs, const std::string& filename) sprintf(cmax, "%.8f", m_emax); selection += "ENERGY >= "+std::string(cmin)+" && ENERGY <= "+std::string(cmax); if (logTerse()) { - log << parformat("Energy range"); + log << gammalib::parformat("Energy range"); log << m_emin << " - " << m_emax << " TeV" << std::endl; } if (selection.length() > 0) { @@ -565,22 +565,22 @@ void ctselect::select_events(GCTAObservation* obs, const std::string& filename) std::string(cdec)+",RA,DEC) <= " + std::string(crad); if (logTerse()) { - log << parformat("Acceptance cone centre"); + log << gammalib::parformat("Acceptance cone centre"); log << "RA=" << ra << ", DEC=" << dec << " deg" << std::endl; - log << parformat("Acceptance cone radius"); + log << gammalib::parformat("Acceptance cone radius"); log << m_rad << " deg" << std::endl; } if (logTerse()) { - log << parformat("cfitsio selection"); + log << gammalib::parformat("cfitsio selection"); log << selection << std::endl; } // Add additional expression - if (strip_whitespace(m_expr).length() > 0) { + if (gammalib::strip_whitespace(m_expr).length() > 0) { if (selection.length() > 0) { selection += " && "; } - selection += "("+strip_whitespace(m_expr)+")"; + selection += "("+gammalib::strip_whitespace(m_expr)+")"; } // Build input filename including selection expression @@ -588,7 +588,7 @@ void ctselect::select_events(GCTAObservation* obs, const std::string& filename) if (selection.length() > 0) expression += "[EVENTS]["+selection+"]"; if (logTerse()) { - log << parformat("FITS filename"); + log << gammalib::parformat("FITS filename"); log << expression << std::endl; } @@ -850,7 +850,7 @@ std::string ctselect::check_infile(const std::string& filename) const std::string ctselect::set_outfile_name(const std::string& filename) const { // Split input filename into path elements - std::vector elements = split(filename, "/"); + std::vector elements = gammalib::split(filename, "/"); // The last path element is the filename std::string outname = m_prefix + elements[elements.size()-1]; diff --git a/src/ctskymap/ctskymap.cpp b/src/ctskymap/ctskymap.cpp index fe146f6..440050c 100644 --- a/src/ctskymap/ctskymap.cpp +++ b/src/ctskymap/ctskymap.cpp @@ -425,7 +425,7 @@ void ctskymap::init_map(GCTAObservation* obs) } // Set reference point to pointing - if (toupper(m_coordsys) == "GAL") { + if (gammalib::toupper(m_coordsys) == "GAL") { xref = pnt->dir().l_deg(); yref = pnt->dir().b_deg(); } @@ -512,13 +512,13 @@ void ctskymap::map_events(GCTAObservation* obs) if (logTerse()) { log << std::endl; log.header1("Mapping"); - log << parformat("Events in list"); + log << gammalib::parformat("Events in list"); log << obs->events()->size() << std::endl; - log << parformat("Events in map"); + log << gammalib::parformat("Events in map"); log << num_in_map << std::endl; - log << parformat("Events outside map area"); + log << gammalib::parformat("Events outside map area"); log << num_outside_map << std::endl; - log << parformat("Events outside energy range"); + log << gammalib::parformat("Events outside energy range"); log << num_outside_erange << std::endl; } -- libgit2 0.21.4