Commit 890b18c26e3c238bc526dc03b88eb845aa4fcf6e

Authored by knodlseder
1 parent f22ea22c

use GApplication::operator[] for parameter access and GObservations::operator[] …

…for observation access
src/ctbin/ctbin.cpp
... ... @@ -197,7 +197,7 @@ void ctbin::execute(void)
197 197 {
198 198 // Read ahead output filename so that it gets dumped correctly in the
199 199 // parameters log
200   - m_outfile = par("outfile")->value();
  200 + m_outfile = (*this)["outfile"].filename();
201 201  
202 202 // Bin the event data
203 203 run();
... ... @@ -251,7 +251,7 @@ void ctbin::run(void)
251 251 for (int i = 0; i < m_obs.size(); ++i) {
252 252  
253 253 // Get CTA observation
254   - GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs(i));
  254 + GCTAObservation* obs = dynamic_cast<GCTAObservation*>(&m_obs[i]);
255 255  
256 256 // Continue only if observation is a CTA observation
257 257 if (obs != NULL) {
... ... @@ -303,14 +303,14 @@ void ctbin::save(void)
303 303 }
304 304  
305 305 // Get output filename
306   - m_outfile = par("outfile")->value();
  306 + m_outfile = (*this)["outfile"].filename();
307 307  
308 308 // Loop over all observations in the container
309 309 int file_num = 0;
310 310 for (int i = 0; i < m_obs.size(); ++i) {
311 311  
312 312 // Get CTA observation
313   - GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs(i));
  313 + GCTAObservation* obs = dynamic_cast<GCTAObservation*>(&m_obs[i]);
314 314  
315 315 // Save only if observation is a CTA observation
316 316 if (obs != NULL) {
... ... @@ -349,7 +349,7 @@ void ctbin::get_parameters(void)
349 349 if (m_obs.size() == 0) {
350 350  
351 351 // Get name of CTA events file
352   - m_evfile = par("evfile")->value();
  352 + m_evfile = (*this)["evfile"].filename();
353 353  
354 354 // Load unbinned CTA observation
355 355 GCTAObservation obs;
... ... @@ -361,16 +361,16 @@ void ctbin::get_parameters(void)
361 361 } // endif: there was no observation in the container
362 362  
363 363 // Get remaining parameters
364   - m_emin = par("emin")->real();
365   - m_emax = par("emax")->real();
366   - m_enumbins = par("enumbins")->integer();
367   - m_proj = par("proj")->value();
368   - m_coordsys = par("coordsys")->value();
369   - m_xref = par("xref")->real();
370   - m_yref = par("yref")->real();
371   - m_binsz = par("binsz")->real();
372   - m_nxpix = par("nxpix")->integer();
373   - m_nypix = par("nypix")->integer();
  364 + m_emin = (*this)["emin"].real();
  365 + m_emax = (*this)["emax"].real();
  366 + m_enumbins = (*this)["enumbins"].integer();
  367 + m_proj = (*this)["proj"].string();
  368 + m_coordsys = (*this)["coordsys"].string();
  369 + m_xref = (*this)["xref"].real();
  370 + m_yref = (*this)["yref"].real();
  371 + m_binsz = (*this)["binsz"].real();
  372 + m_nxpix = (*this)["nxpix"].integer();
  373 + m_nypix = (*this)["nypix"].integer();
374 374  
375 375 // Return
376 376 return;
... ...
src/ctlike/ctlike.cpp
... ... @@ -196,7 +196,7 @@ void ctlike::execute(void)
196 196 {
197 197 // Read ahead output filename so that it gets dumped correctly in the
198 198 // parameters log
199   - m_outmdl = par("outmdl")->value();
  199 + m_outmdl = (*this)["outmdl"].filename();
200 200  
201 201 // Bin the event data
202 202 run();
... ... @@ -272,7 +272,7 @@ void ctlike::save(void)
272 272 }
273 273  
274 274 // Get output filename
275   - m_outmdl = par("outmdl")->value();
  275 + m_outmdl = (*this)["outmdl"].value();
276 276  
277 277 // Write results out as XML model
278 278 if (toupper(m_outmdl) != "NONE")
... ... @@ -309,7 +309,7 @@ void ctlike::get_parameters(void)
309 309 if (m_obs.models().size() == 0) {
310 310  
311 311 // Get models XML filename
312   - std::string filename = par("srcmdl")->value();
  312 + std::string filename = (*this)["srcmdl"].filename();
313 313  
314 314 // Setup models for optimizing.
315 315 m_obs.models(GModels(filename));
... ... @@ -321,16 +321,16 @@ void ctlike::get_parameters(void)
321 321 if (m_obs.size() == 0) {
322 322  
323 323 // Get observation parameters
324   - m_method = toupper(par("method")->value());
325   - m_stat = toupper(par("stat")->value());
326   - m_caldb = par("caldb")->value();
327   - m_irf = par("irf")->value();
  324 + m_method = toupper((*this)["method"].string());
  325 + m_stat = toupper((*this)["stat"].string());
  326 + m_caldb = (*this)["caldb"].string();
  327 + m_irf = (*this)["irf"].string();
328 328  
329 329 // Case A: set-up unbinned CTA observation
330 330 if (m_method == "UNBINNED") {
331 331  
332 332 // Get event file name
333   - std::string filename = par("evfile")->value();
  333 + std::string filename = (*this)["evfile"].filename();
334 334  
335 335 // Load and append unbinned CTA observation
336 336 load_unbinned(filename);
... ... @@ -341,7 +341,7 @@ void ctlike::get_parameters(void)
341 341 else if (m_method == "BINNED") {
342 342  
343 343 // Get counts map file name
344   - std::string filename = par("cntmap")->value();
  344 + std::string filename = (*this)["cntmap"].filename();
345 345  
346 346 // Load and append binned CTA observation
347 347 load_binned(filename);
... ... @@ -357,7 +357,7 @@ void ctlike::get_parameters(void)
357 357 } // endif: there was no observation in the container
358 358  
359 359 // Get standard parameters
360   - m_refit = par("refit")->boolean();
  360 + m_refit = (*this)["refit"].boolean();
361 361  
362 362 // Return
363 363 return;
... ...
src/ctobssim/ctobssim.cpp
... ... @@ -196,7 +196,7 @@ void ctobssim::execute(void)
196 196 {
197 197 // Read ahead output filename so that it gets dumped correctly in the
198 198 // parameters log
199   - m_outfile = par("outfile")->value();
  199 + m_outfile = (*this)["outfile"].filename();
200 200  
201 201 // Run the simulation
202 202 run();
... ... @@ -253,7 +253,7 @@ void ctobssim::run(void)
253 253 for (int i = 0; i < m_obs.size(); ++i) {
254 254  
255 255 // Get CTA observation
256   - GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs(i));
  256 + GCTAObservation* obs = dynamic_cast<GCTAObservation*>(&m_obs[i]);
257 257  
258 258 // Continue only if observation is a CTA observation
259 259 if (obs != NULL) {
... ... @@ -313,14 +313,14 @@ void ctobssim::save(void)
313 313 }
314 314  
315 315 // Get output filename
316   - m_outfile = par("outfile")->value();
  316 + m_outfile = (*this)["outfile"].filename();
317 317  
318 318 // Loop over all observation in the container
319 319 int file_num = 0;
320 320 for (int i = 0; i < m_obs.size(); ++i) {
321 321  
322 322 // Get CTA observation
323   - GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs(i));
  323 + GCTAObservation* obs = dynamic_cast<GCTAObservation*>(&m_obs[i]);
324 324  
325 325 // Save only if observation is a CTA observation
326 326 if (obs != NULL) {
... ... @@ -359,11 +359,11 @@ void ctobssim::get_parameters(void)
359 359 if (m_obs.size() == 0) {
360 360  
361 361 // Get CTA observation parameters
362   - m_infile = par("infile")->value();
363   - m_caldb = par("caldb")->value();
364   - m_irf = par("irf")->value();
365   - m_ra = par("ra")->real();
366   - m_dec = par("dec")->real();
  362 + m_infile = (*this)["infile"].filename();
  363 + m_caldb = (*this)["caldb"].string();
  364 + m_irf = (*this)["irf"].string();
  365 + m_ra = (*this)["ra"].real();
  366 + m_dec = (*this)["dec"].real();
367 367  
368 368 // Set pointing direction
369 369 GCTAPointing pnt;
... ... @@ -390,7 +390,7 @@ void ctobssim::get_parameters(void)
390 390 } // endif: there was no observation in the container
391 391  
392 392 // Get other parameters
393   - m_seed = par("seed")->integer();
  393 + m_seed = (*this)["seed"].integer();
394 394  
395 395 // Initialise random number generator
396 396 m_ran.seed(m_seed);
... ... @@ -411,13 +411,13 @@ void ctobssim::set_list(GCTAObservation* obs)
411 411 if (obs != NULL) {
412 412  
413 413 // Get CTA observation parameters
414   - m_ra = par("ra")->real();
415   - m_dec = par("dec")->real();
416   - m_rad = par("rad")->real();
417   - m_tmin = par("tmin")->real();
418   - m_tmax = par("tmax")->real();
419   - m_emin = par("emin")->real();
420   - m_emax = par("emax")->real();
  414 + m_ra = (*this)["ra"].real();
  415 + m_dec = (*this)["dec"].real();
  416 + m_rad = (*this)["rad"].real();
  417 + m_tmin = (*this)["tmin"].real();
  418 + m_tmax = (*this)["tmax"].real();
  419 + m_emin = (*this)["emin"].real();
  420 + m_emax = (*this)["emax"].real();
421 421  
422 422 // Allocate CTA event list
423 423 GCTAEventList events;
... ... @@ -547,7 +547,7 @@ GPhotons ctobssim::simulate_photons(const GCTAObservation* obs,
547 547 for (int i = 0; i < models.size(); ++i) {
548 548  
549 549 // Get sky model (NULL if not a sky model)
550   - const GModelSky* model = dynamic_cast<const GModelSky*>(models(i));
  550 + const GModelSky* model = dynamic_cast<const GModelSky*>(&models[i]);
551 551  
552 552 // If we have a sky model then simulate photons
553 553 if (model != NULL) {
... ... @@ -688,7 +688,7 @@ void ctobssim::simulate_background(GCTAObservation* obs, const GModels&amp; models)
688 688  
689 689 // Get model (NULL if not a radial acceptance model)
690 690 const GCTAModelRadialAcceptance* model =
691   - dynamic_cast<const GCTAModelRadialAcceptance*>(models(i));
  691 + dynamic_cast<const GCTAModelRadialAcceptance*>(&models[i]);
692 692  
693 693 // If we have a radial acceptance model then simulate events
694 694 if (model != NULL) {
... ...
src/ctselect/ctselect.cpp
... ... @@ -194,7 +194,7 @@ void ctselect::execute(void)
194 194 {
195 195 // Read ahead output filename so that it gets dumped correctly in the
196 196 // parameters log
197   - m_outfile = par("outfile")->value();
  197 + m_outfile = (*this)["outfile"].value();
198 198  
199 199 // Perform event selection
200 200 run();
... ... @@ -250,7 +250,7 @@ void ctselect::run(void)
250 250 for (int i = 0; i < m_obs.size(); ++i) {
251 251  
252 252 // Get CTA observation
253   - GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs(i));
  253 + GCTAObservation* obs = dynamic_cast<GCTAObservation*>(&m_obs[i]);
254 254  
255 255 // Continue only if observation is a CTA observation
256 256 if (obs != NULL) {
... ... @@ -305,13 +305,13 @@ void ctselect::save(void)
305 305 }
306 306  
307 307 // Get output filename
308   - m_outfile = par("outfile")->value();
  308 + m_outfile = (*this)["outfile"].value();
309 309  
310 310 // Loop over all observation in the container
311 311 for (int i = 0; i < m_obs.size(); ++i) {
312 312  
313 313 // Get CTA observation
314   - GCTAObservation* obs = dynamic_cast<GCTAObservation*>(m_obs(i));
  314 + GCTAObservation* obs = dynamic_cast<GCTAObservation*>(&m_obs[i]);
315 315  
316 316 // Save only if observation is a CTA observation
317 317 if (obs != NULL) {
... ... @@ -341,7 +341,7 @@ void ctselect::get_parameters(void)
341 341 if (m_obs.size() == 0) {
342 342  
343 343 // Get CTA event list file name
344   - m_infile = par("infile")->value();
  344 + m_infile = (*this)["infile"].value();
345 345  
346 346 // Allocate CTA observation
347 347 GCTAObservation obs;
... ... @@ -355,13 +355,13 @@ void ctselect::get_parameters(void)
355 355 } // endif: there was no observation in the container
356 356  
357 357 // Get parameters
358   - m_ra = par("ra")->real();
359   - m_dec = par("dec")->real();
360   - m_rad = par("rad")->real();
361   - m_tmin = par("tmin")->real();
362   - m_tmax = par("tmax")->real();
363   - m_emin = par("emin")->real();
364   - m_emax = par("emax")->real();
  358 + m_ra = (*this)["ra"].real();
  359 + m_dec = (*this)["dec"].real();
  360 + m_rad = (*this)["rad"].real();
  361 + m_tmin = (*this)["tmin"].real();
  362 + m_tmax = (*this)["tmax"].real();
  363 + m_emin = (*this)["emin"].real();
  364 + m_emax = (*this)["emax"].real();
365 365  
366 366 // Return
367 367 return;
... ...