diff --git a/src/ctbin/ctbin.cpp b/src/ctbin/ctbin.cpp index 9b7bce4..35126ef 100644 --- a/src/ctbin/ctbin.cpp +++ b/src/ctbin/ctbin.cpp @@ -197,7 +197,7 @@ void ctbin::execute(void) { // Read ahead output filename so that it gets dumped correctly in the // parameters log - m_outfile = par("outfile")->value(); + m_outfile = (*this)["outfile"].filename(); // Bin the event data run(); @@ -251,7 +251,7 @@ void ctbin::run(void) for (int i = 0; i < m_obs.size(); ++i) { // Get CTA observation - GCTAObservation* obs = dynamic_cast(m_obs(i)); + GCTAObservation* obs = dynamic_cast(&m_obs[i]); // Continue only if observation is a CTA observation if (obs != NULL) { @@ -303,14 +303,14 @@ void ctbin::save(void) } // Get output filename - m_outfile = par("outfile")->value(); + m_outfile = (*this)["outfile"].filename(); // Loop over all observations in the container int file_num = 0; for (int i = 0; i < m_obs.size(); ++i) { // Get CTA observation - GCTAObservation* obs = dynamic_cast(m_obs(i)); + GCTAObservation* obs = dynamic_cast(&m_obs[i]); // Save only if observation is a CTA observation if (obs != NULL) { @@ -349,7 +349,7 @@ void ctbin::get_parameters(void) if (m_obs.size() == 0) { // Get name of CTA events file - m_evfile = par("evfile")->value(); + m_evfile = (*this)["evfile"].filename(); // Load unbinned CTA observation GCTAObservation obs; @@ -361,16 +361,16 @@ void ctbin::get_parameters(void) } // endif: there was no observation in the container // Get remaining parameters - m_emin = par("emin")->real(); - m_emax = par("emax")->real(); - m_enumbins = par("enumbins")->integer(); - m_proj = par("proj")->value(); - m_coordsys = par("coordsys")->value(); - m_xref = par("xref")->real(); - m_yref = par("yref")->real(); - m_binsz = par("binsz")->real(); - m_nxpix = par("nxpix")->integer(); - m_nypix = par("nypix")->integer(); + m_emin = (*this)["emin"].real(); + m_emax = (*this)["emax"].real(); + m_enumbins = (*this)["enumbins"].integer(); + m_proj = (*this)["proj"].string(); + m_coordsys = (*this)["coordsys"].string(); + m_xref = (*this)["xref"].real(); + m_yref = (*this)["yref"].real(); + m_binsz = (*this)["binsz"].real(); + m_nxpix = (*this)["nxpix"].integer(); + m_nypix = (*this)["nypix"].integer(); // Return return; diff --git a/src/ctlike/ctlike.cpp b/src/ctlike/ctlike.cpp index 2139124..9d694a2 100644 --- a/src/ctlike/ctlike.cpp +++ b/src/ctlike/ctlike.cpp @@ -196,7 +196,7 @@ void ctlike::execute(void) { // Read ahead output filename so that it gets dumped correctly in the // parameters log - m_outmdl = par("outmdl")->value(); + m_outmdl = (*this)["outmdl"].filename(); // Bin the event data run(); @@ -272,7 +272,7 @@ void ctlike::save(void) } // Get output filename - m_outmdl = par("outmdl")->value(); + m_outmdl = (*this)["outmdl"].value(); // Write results out as XML model if (toupper(m_outmdl) != "NONE") @@ -309,7 +309,7 @@ void ctlike::get_parameters(void) if (m_obs.models().size() == 0) { // Get models XML filename - std::string filename = par("srcmdl")->value(); + std::string filename = (*this)["srcmdl"].filename(); // Setup models for optimizing. m_obs.models(GModels(filename)); @@ -321,16 +321,16 @@ void ctlike::get_parameters(void) if (m_obs.size() == 0) { // Get observation parameters - m_method = toupper(par("method")->value()); - m_stat = toupper(par("stat")->value()); - m_caldb = par("caldb")->value(); - m_irf = par("irf")->value(); + m_method = toupper((*this)["method"].string()); + m_stat = toupper((*this)["stat"].string()); + m_caldb = (*this)["caldb"].string(); + m_irf = (*this)["irf"].string(); // Case A: set-up unbinned CTA observation if (m_method == "UNBINNED") { // Get event file name - std::string filename = par("evfile")->value(); + std::string filename = (*this)["evfile"].filename(); // Load and append unbinned CTA observation load_unbinned(filename); @@ -341,7 +341,7 @@ void ctlike::get_parameters(void) else if (m_method == "BINNED") { // Get counts map file name - std::string filename = par("cntmap")->value(); + std::string filename = (*this)["cntmap"].filename(); // Load and append binned CTA observation load_binned(filename); @@ -357,7 +357,7 @@ void ctlike::get_parameters(void) } // endif: there was no observation in the container // Get standard parameters - m_refit = par("refit")->boolean(); + m_refit = (*this)["refit"].boolean(); // Return return; diff --git a/src/ctobssim/ctobssim.cpp b/src/ctobssim/ctobssim.cpp index 36f324e..6aca9fb 100644 --- a/src/ctobssim/ctobssim.cpp +++ b/src/ctobssim/ctobssim.cpp @@ -196,7 +196,7 @@ void ctobssim::execute(void) { // Read ahead output filename so that it gets dumped correctly in the // parameters log - m_outfile = par("outfile")->value(); + m_outfile = (*this)["outfile"].filename(); // Run the simulation run(); @@ -253,7 +253,7 @@ void ctobssim::run(void) for (int i = 0; i < m_obs.size(); ++i) { // Get CTA observation - GCTAObservation* obs = dynamic_cast(m_obs(i)); + GCTAObservation* obs = dynamic_cast(&m_obs[i]); // Continue only if observation is a CTA observation if (obs != NULL) { @@ -313,14 +313,14 @@ void ctobssim::save(void) } // Get output filename - m_outfile = par("outfile")->value(); + m_outfile = (*this)["outfile"].filename(); // Loop over all observation in the container int file_num = 0; for (int i = 0; i < m_obs.size(); ++i) { // Get CTA observation - GCTAObservation* obs = dynamic_cast(m_obs(i)); + GCTAObservation* obs = dynamic_cast(&m_obs[i]); // Save only if observation is a CTA observation if (obs != NULL) { @@ -359,11 +359,11 @@ void ctobssim::get_parameters(void) if (m_obs.size() == 0) { // Get CTA observation parameters - m_infile = par("infile")->value(); - m_caldb = par("caldb")->value(); - m_irf = par("irf")->value(); - m_ra = par("ra")->real(); - m_dec = par("dec")->real(); + m_infile = (*this)["infile"].filename(); + m_caldb = (*this)["caldb"].string(); + m_irf = (*this)["irf"].string(); + m_ra = (*this)["ra"].real(); + m_dec = (*this)["dec"].real(); // Set pointing direction GCTAPointing pnt; @@ -390,7 +390,7 @@ void ctobssim::get_parameters(void) } // endif: there was no observation in the container // Get other parameters - m_seed = par("seed")->integer(); + m_seed = (*this)["seed"].integer(); // Initialise random number generator m_ran.seed(m_seed); @@ -411,13 +411,13 @@ void ctobssim::set_list(GCTAObservation* obs) if (obs != NULL) { // Get CTA observation parameters - m_ra = par("ra")->real(); - m_dec = par("dec")->real(); - m_rad = par("rad")->real(); - m_tmin = par("tmin")->real(); - m_tmax = par("tmax")->real(); - m_emin = par("emin")->real(); - m_emax = par("emax")->real(); + m_ra = (*this)["ra"].real(); + m_dec = (*this)["dec"].real(); + m_rad = (*this)["rad"].real(); + m_tmin = (*this)["tmin"].real(); + m_tmax = (*this)["tmax"].real(); + m_emin = (*this)["emin"].real(); + m_emax = (*this)["emax"].real(); // Allocate CTA event list GCTAEventList events; @@ -547,7 +547,7 @@ GPhotons ctobssim::simulate_photons(const GCTAObservation* obs, for (int i = 0; i < models.size(); ++i) { // Get sky model (NULL if not a sky model) - const GModelSky* model = dynamic_cast(models(i)); + const GModelSky* model = dynamic_cast(&models[i]); // If we have a sky model then simulate photons if (model != NULL) { @@ -688,7 +688,7 @@ void ctobssim::simulate_background(GCTAObservation* obs, const GModels& models) // Get model (NULL if not a radial acceptance model) const GCTAModelRadialAcceptance* model = - dynamic_cast(models(i)); + dynamic_cast(&models[i]); // If we have a radial acceptance model then simulate events if (model != NULL) { diff --git a/src/ctselect/ctselect.cpp b/src/ctselect/ctselect.cpp index 5a320ea..e289fff 100644 --- a/src/ctselect/ctselect.cpp +++ b/src/ctselect/ctselect.cpp @@ -194,7 +194,7 @@ void ctselect::execute(void) { // Read ahead output filename so that it gets dumped correctly in the // parameters log - m_outfile = par("outfile")->value(); + m_outfile = (*this)["outfile"].value(); // Perform event selection run(); @@ -250,7 +250,7 @@ void ctselect::run(void) for (int i = 0; i < m_obs.size(); ++i) { // Get CTA observation - GCTAObservation* obs = dynamic_cast(m_obs(i)); + GCTAObservation* obs = dynamic_cast(&m_obs[i]); // Continue only if observation is a CTA observation if (obs != NULL) { @@ -305,13 +305,13 @@ void ctselect::save(void) } // Get output filename - m_outfile = par("outfile")->value(); + m_outfile = (*this)["outfile"].value(); // Loop over all observation in the container for (int i = 0; i < m_obs.size(); ++i) { // Get CTA observation - GCTAObservation* obs = dynamic_cast(m_obs(i)); + GCTAObservation* obs = dynamic_cast(&m_obs[i]); // Save only if observation is a CTA observation if (obs != NULL) { @@ -341,7 +341,7 @@ void ctselect::get_parameters(void) if (m_obs.size() == 0) { // Get CTA event list file name - m_infile = par("infile")->value(); + m_infile = (*this)["infile"].value(); // Allocate CTA observation GCTAObservation obs; @@ -355,13 +355,13 @@ void ctselect::get_parameters(void) } // endif: there was no observation in the container // Get parameters - m_ra = par("ra")->real(); - m_dec = par("dec")->real(); - m_rad = par("rad")->real(); - m_tmin = par("tmin")->real(); - m_tmax = par("tmax")->real(); - m_emin = par("emin")->real(); - m_emax = par("emax")->real(); + m_ra = (*this)["ra"].real(); + m_dec = (*this)["dec"].real(); + m_rad = (*this)["rad"].real(); + m_tmin = (*this)["tmin"].real(); + m_tmax = (*this)["tmax"].real(); + m_emin = (*this)["emin"].real(); + m_emax = (*this)["emax"].real(); // Return return;