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 | 404 | // If there is no input filename then read all parameters that |
| 405 | 405 | // are required to build a model map from scratch |
| 406 | 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 | 410 | m_tmin = (*this)["tmin"].real(); |
| 408 | 411 | m_tmax = (*this)["tmax"].real(); |
| 409 | 412 | m_emin = (*this)["emin"].real(); |
| ... | ... | @@ -473,6 +476,12 @@ void ctmodel::setup_obs(void) |
| 473 | 476 | // from the task parameters |
| 474 | 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 | 485 | // Setup energy range covered by model |
| 477 | 486 | GEnergy emin; |
| 478 | 487 | GEnergy emax; |
| ... | ... | @@ -500,6 +509,12 @@ void ctmodel::setup_obs(void) |
| 500 | 509 | // Allocate CTA observation |
| 501 | 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 | 518 | // Set event cube in observation |
| 504 | 519 | obs.events(&cube); |
| 505 | 520 | |
| ... | ... | @@ -658,9 +673,11 @@ void ctmodel::init_members(void) |
| 658 | 673 | m_srcmdl.clear(); |
| 659 | 674 | m_proj.clear(); |
| 660 | 675 | m_coordsys.clear(); |
| 676 | + m_ra = 0.0; | |
| 677 | + m_dec = 0.0; | |
| 678 | + m_deadc = 1.0; | |
| 661 | 679 | m_tmin = 0.0; |
| 662 | 680 | m_tmax = 0.0; |
| 663 | - m_deadc = 1.0; | |
| 664 | 681 | m_emin = 0.0; |
| 665 | 682 | m_emax = 0.0; |
| 666 | 683 | m_enumbins = 0; |
| ... | ... | @@ -700,9 +717,11 @@ void ctmodel::copy_members(const ctmodel& app) |
| 700 | 717 | m_srcmdl = app.m_srcmdl; |
| 701 | 718 | m_proj = app.m_proj; |
| 702 | 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 | 723 | m_tmin = app.m_tmin; |
| 704 | 724 | m_tmax = app.m_tmax; |
| 705 | - m_deadc = app.m_deadc; | |
| 706 | 725 | m_emin = app.m_emin; |
| 707 | 726 | m_emax = app.m_emax; |
| 708 | 727 | m_enumbins = app.m_enumbins; | ... | ... |
src/ctmodel/ctmodel.hpp
| ... | ... | @@ -91,9 +91,11 @@ protected: |
| 91 | 91 | std::string m_caldb; //!< Calibration database |
| 92 | 92 | std::string m_irf; //!< Instrument response functions |
| 93 | 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 | 97 | double m_tmin; //!< Start time |
| 95 | 98 | double m_tmax; //!< Stop time |
| 96 | - double m_deadc; //!< Deadtime correction factor | |
| 97 | 99 | double m_emin; //!< Lower energy |
| 98 | 100 | double m_emax; //!< Upper energy |
| 99 | 101 | int m_enumbins; //!< Number of energy bins | ... | ... |
src/ctmodel/ctmodel.par
| ... | ... | @@ -24,11 +24,16 @@ caldb, s, a, "test/irf",,, "Calibration database" |
| 24 | 24 | irf, s, a, "kb_E_50h_v3",,, "Instrument response function" |
| 25 | 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 | 33 | # Time range parameters |
| 28 | 34 | #====================== |
| 29 | 35 | tmin, r, a, 0.0, 0, , "Start time (MET in s)" |
| 30 | 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 | 38 | # Energy binning parameters |
| 34 | 39 | #========================== | ... | ... |