Commit 635464385737b759f47090463bdf95c3464fef93
1 parent
596d6159
Add ra and dec parameters to specify pointing.
If a model is to be built from scratch, the pointing direction of the observation needs to be specified.
Showing
3 changed files
with
30 additions
and
4 deletions
src/ctmodel/ctmodel.cpp
| @@ -404,6 +404,9 @@ void ctmodel::get_parameters(void) | @@ -404,6 +404,9 @@ void ctmodel::get_parameters(void) | ||
| 404 | // If there is no input filename then read all parameters that | 404 | // If there is no input filename then read all parameters that |
| 405 | // are required to build a model map from scratch | 405 | // are required to build a model map from scratch |
| 406 | if ((m_infile == "NONE") || (strip_whitespace(m_infile) == "")) { | 406 | if ((m_infile == "NONE") || (strip_whitespace(m_infile) == "")) { |
| 407 | + m_ra = (*this)["ra"].real(); | ||
| 408 | + m_dec = (*this)["dec"].real(); | ||
| 409 | + m_deadc = (*this)["deadc"].real(); | ||
| 407 | m_tmin = (*this)["tmin"].real(); | 410 | m_tmin = (*this)["tmin"].real(); |
| 408 | m_tmax = (*this)["tmax"].real(); | 411 | m_tmax = (*this)["tmax"].real(); |
| 409 | m_emin = (*this)["emin"].real(); | 412 | m_emin = (*this)["emin"].real(); |
| @@ -473,6 +476,12 @@ void ctmodel::setup_obs(void) | @@ -473,6 +476,12 @@ void ctmodel::setup_obs(void) | ||
| 473 | // from the task parameters | 476 | // from the task parameters |
| 474 | if ((m_infile == "NONE") || (strip_whitespace(m_infile) == "")) { | 477 | if ((m_infile == "NONE") || (strip_whitespace(m_infile) == "")) { |
| 475 | 478 | ||
| 479 | + // Set pointing direction | ||
| 480 | + GCTAPointing pnt; | ||
| 481 | + GSkyDir skydir; | ||
| 482 | + skydir.radec_deg(m_ra, m_dec); | ||
| 483 | + pnt.dir(skydir); | ||
| 484 | + | ||
| 476 | // Setup energy range covered by model | 485 | // Setup energy range covered by model |
| 477 | GEnergy emin; | 486 | GEnergy emin; |
| 478 | GEnergy emax; | 487 | GEnergy emax; |
| @@ -500,6 +509,12 @@ void ctmodel::setup_obs(void) | @@ -500,6 +509,12 @@ void ctmodel::setup_obs(void) | ||
| 500 | // Allocate CTA observation | 509 | // Allocate CTA observation |
| 501 | GCTAObservation obs; | 510 | GCTAObservation obs; |
| 502 | 511 | ||
| 512 | + // Set CTA observation attributes | ||
| 513 | + obs.pointing(pnt); | ||
| 514 | + obs.ontime(gti.ontime()); | ||
| 515 | + obs.livetime(gti.ontime()*m_deadc); | ||
| 516 | + obs.deadc(m_deadc); | ||
| 517 | + | ||
| 503 | // Set event cube in observation | 518 | // Set event cube in observation |
| 504 | obs.events(&cube); | 519 | obs.events(&cube); |
| 505 | 520 | ||
| @@ -658,9 +673,11 @@ void ctmodel::init_members(void) | @@ -658,9 +673,11 @@ void ctmodel::init_members(void) | ||
| 658 | m_srcmdl.clear(); | 673 | m_srcmdl.clear(); |
| 659 | m_proj.clear(); | 674 | m_proj.clear(); |
| 660 | m_coordsys.clear(); | 675 | m_coordsys.clear(); |
| 676 | + m_ra = 0.0; | ||
| 677 | + m_dec = 0.0; | ||
| 678 | + m_deadc = 1.0; | ||
| 661 | m_tmin = 0.0; | 679 | m_tmin = 0.0; |
| 662 | m_tmax = 0.0; | 680 | m_tmax = 0.0; |
| 663 | - m_deadc = 1.0; | ||
| 664 | m_emin = 0.0; | 681 | m_emin = 0.0; |
| 665 | m_emax = 0.0; | 682 | m_emax = 0.0; |
| 666 | m_enumbins = 0; | 683 | m_enumbins = 0; |
| @@ -700,9 +717,11 @@ void ctmodel::copy_members(const ctmodel& app) | @@ -700,9 +717,11 @@ void ctmodel::copy_members(const ctmodel& app) | ||
| 700 | m_srcmdl = app.m_srcmdl; | 717 | m_srcmdl = app.m_srcmdl; |
| 701 | m_proj = app.m_proj; | 718 | m_proj = app.m_proj; |
| 702 | m_coordsys = app.m_coordsys; | 719 | m_coordsys = app.m_coordsys; |
| 720 | + m_ra = app.m_ra; | ||
| 721 | + m_dec = app.m_dec; | ||
| 722 | + m_deadc = app.m_deadc; | ||
| 703 | m_tmin = app.m_tmin; | 723 | m_tmin = app.m_tmin; |
| 704 | m_tmax = app.m_tmax; | 724 | m_tmax = app.m_tmax; |
| 705 | - m_deadc = app.m_deadc; | ||
| 706 | m_emin = app.m_emin; | 725 | m_emin = app.m_emin; |
| 707 | m_emax = app.m_emax; | 726 | m_emax = app.m_emax; |
| 708 | m_enumbins = app.m_enumbins; | 727 | m_enumbins = app.m_enumbins; |
src/ctmodel/ctmodel.hpp
| @@ -91,9 +91,11 @@ protected: | @@ -91,9 +91,11 @@ protected: | ||
| 91 | std::string m_caldb; //!< Calibration database | 91 | std::string m_caldb; //!< Calibration database |
| 92 | std::string m_irf; //!< Instrument response functions | 92 | std::string m_irf; //!< Instrument response functions |
| 93 | std::string m_srcmdl; //!< Source model | 93 | std::string m_srcmdl; //!< Source model |
| 94 | + double m_ra; //!< RA of pointing direction | ||
| 95 | + double m_dec; //!< DEC of pointing direction | ||
| 96 | + double m_deadc; //!< Deadtime correction factor | ||
| 94 | double m_tmin; //!< Start time | 97 | double m_tmin; //!< Start time |
| 95 | double m_tmax; //!< Stop time | 98 | double m_tmax; //!< Stop time |
| 96 | - double m_deadc; //!< Deadtime correction factor | ||
| 97 | double m_emin; //!< Lower energy | 99 | double m_emin; //!< Lower energy |
| 98 | double m_emax; //!< Upper energy | 100 | double m_emax; //!< Upper energy |
| 99 | int m_enumbins; //!< Number of energy bins | 101 | int m_enumbins; //!< Number of energy bins |
src/ctmodel/ctmodel.par
| @@ -24,11 +24,16 @@ caldb, s, a, "test/irf",,, "Calibration database" | @@ -24,11 +24,16 @@ caldb, s, a, "test/irf",,, "Calibration database" | ||
| 24 | irf, s, a, "kb_E_50h_v3",,, "Instrument response function" | 24 | irf, s, a, "kb_E_50h_v3",,, "Instrument response function" |
| 25 | srcmdl, f, a, "test/data/crab.xml",,, "Source model" | 25 | srcmdl, f, a, "test/data/crab.xml",,, "Source model" |
| 26 | # | 26 | # |
| 27 | +# Instrument parameters | ||
| 28 | +#====================== | ||
| 29 | +ra, r, a, 83.63, 0,360, "RA of pointing (degrees)" | ||
| 30 | +dec, r, a, 22.01, -90, 90, "Dec of pointing (degrees)" | ||
| 31 | +deadc, r, h, 0.95, 0, 1, "Average deadtime correction factor" | ||
| 32 | +# | ||
| 27 | # Time range parameters | 33 | # Time range parameters |
| 28 | #====================== | 34 | #====================== |
| 29 | tmin, r, a, 0.0, 0, , "Start time (MET in s)" | 35 | tmin, r, a, 0.0, 0, , "Start time (MET in s)" |
| 30 | tmax, r, a, 1800.0, 0, , "End time (MET in s)" | 36 | tmax, r, a, 1800.0, 0, , "End time (MET in s)" |
| 31 | -deadc, r, h, 0.95, 0, 1, "Average deadtime correction factor" | ||
| 32 | # | 37 | # |
| 33 | # Energy binning parameters | 38 | # Energy binning parameters |
| 34 | #========================== | 39 | #========================== |