From 635464385737b759f47090463bdf95c3464fef93 Mon Sep 17 00:00:00 2001 From: Jürgen Knödlseder Date: Tue, 16 Oct 2012 00:02:42 +0200 Subject: [PATCH] Add ra and dec parameters to specify pointing. --- src/ctmodel/ctmodel.cpp | 23 +++++++++++++++++++++-- src/ctmodel/ctmodel.hpp | 4 +++- src/ctmodel/ctmodel.par | 7 ++++++- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/ctmodel/ctmodel.cpp b/src/ctmodel/ctmodel.cpp index 0ce9a7a..7fca3d6 100644 --- a/src/ctmodel/ctmodel.cpp +++ b/src/ctmodel/ctmodel.cpp @@ -404,6 +404,9 @@ 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) == "")) { + m_ra = (*this)["ra"].real(); + m_dec = (*this)["dec"].real(); + m_deadc = (*this)["deadc"].real(); m_tmin = (*this)["tmin"].real(); m_tmax = (*this)["tmax"].real(); m_emin = (*this)["emin"].real(); @@ -473,6 +476,12 @@ void ctmodel::setup_obs(void) // from the task parameters if ((m_infile == "NONE") || (strip_whitespace(m_infile) == "")) { + // Set pointing direction + GCTAPointing pnt; + GSkyDir skydir; + skydir.radec_deg(m_ra, m_dec); + pnt.dir(skydir); + // Setup energy range covered by model GEnergy emin; GEnergy emax; @@ -500,6 +509,12 @@ void ctmodel::setup_obs(void) // Allocate CTA observation GCTAObservation obs; + // Set CTA observation attributes + obs.pointing(pnt); + obs.ontime(gti.ontime()); + obs.livetime(gti.ontime()*m_deadc); + obs.deadc(m_deadc); + // Set event cube in observation obs.events(&cube); @@ -658,9 +673,11 @@ void ctmodel::init_members(void) m_srcmdl.clear(); m_proj.clear(); m_coordsys.clear(); + m_ra = 0.0; + m_dec = 0.0; + m_deadc = 1.0; m_tmin = 0.0; m_tmax = 0.0; - m_deadc = 1.0; m_emin = 0.0; m_emax = 0.0; m_enumbins = 0; @@ -700,9 +717,11 @@ void ctmodel::copy_members(const ctmodel& app) m_srcmdl = app.m_srcmdl; m_proj = app.m_proj; m_coordsys = app.m_coordsys; + m_ra = app.m_ra; + m_dec = app.m_dec; + m_deadc = app.m_deadc; m_tmin = app.m_tmin; m_tmax = app.m_tmax; - m_deadc = app.m_deadc; m_emin = app.m_emin; m_emax = app.m_emax; m_enumbins = app.m_enumbins; diff --git a/src/ctmodel/ctmodel.hpp b/src/ctmodel/ctmodel.hpp index 89a69be..7afcd43 100644 --- a/src/ctmodel/ctmodel.hpp +++ b/src/ctmodel/ctmodel.hpp @@ -91,9 +91,11 @@ protected: std::string m_caldb; //!< Calibration database std::string m_irf; //!< Instrument response functions std::string m_srcmdl; //!< Source model + double m_ra; //!< RA of pointing direction + double m_dec; //!< DEC of pointing direction + double m_deadc; //!< Deadtime correction factor double m_tmin; //!< Start time double m_tmax; //!< Stop time - double m_deadc; //!< Deadtime correction factor double m_emin; //!< Lower energy double m_emax; //!< Upper energy int m_enumbins; //!< Number of energy bins diff --git a/src/ctmodel/ctmodel.par b/src/ctmodel/ctmodel.par index cab13e1..3388172 100644 --- a/src/ctmodel/ctmodel.par +++ b/src/ctmodel/ctmodel.par @@ -24,11 +24,16 @@ caldb, s, a, "test/irf",,, "Calibration database" irf, s, a, "kb_E_50h_v3",,, "Instrument response function" srcmdl, f, a, "test/data/crab.xml",,, "Source model" # +# Instrument parameters +#====================== +ra, r, a, 83.63, 0,360, "RA of pointing (degrees)" +dec, r, a, 22.01, -90, 90, "Dec of pointing (degrees)" +deadc, r, h, 0.95, 0, 1, "Average deadtime correction factor" +# # Time range parameters #====================== tmin, r, a, 0.0, 0, , "Start time (MET in s)" tmax, r, a, 1800.0, 0, , "End time (MET in s)" -deadc, r, h, 0.95, 0, 1, "Average deadtime correction factor" # # Energy binning parameters #========================== -- libgit2 0.21.4