Commit ba06213bff1bb47f1b4a7b29dcb5e76a35064bdb
1 parent
e602b275
update
Showing
1 changed file
with
5 additions
and
95 deletions
src/ctobssim/ctobssim.cpp
| @@ -266,24 +266,12 @@ void ctobssim::run(void) | @@ -266,24 +266,12 @@ void ctobssim::run(void) | ||
| 266 | log.header3("Observation"); | 266 | log.header3("Observation"); |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | - // Write header for photon simulation | ||
| 270 | - //if (logTerse()) | ||
| 271 | - // log.header3("Simulate photons"); | ||
| 272 | - | ||
| 273 | // Simulate photons | 269 | // Simulate photons |
| 274 | GPhotons photons = simulate_photons(obs, m_obs.models()); | 270 | GPhotons photons = simulate_photons(obs, m_obs.models()); |
| 275 | 271 | ||
| 276 | - // Write header for sky event simulation | ||
| 277 | - //if (logTerse()) | ||
| 278 | - // log.header3("Simulate sky events"); | ||
| 279 | - | ||
| 280 | // Simulate source events | 272 | // Simulate source events |
| 281 | simulate_source(obs, photons); | 273 | simulate_source(obs, photons); |
| 282 | 274 | ||
| 283 | - // Write header for bacgkround event simulation | ||
| 284 | - //if (logTerse()) | ||
| 285 | - // log.header3("Simulate background events"); | ||
| 286 | - | ||
| 287 | // Simulate source events | 275 | // Simulate source events |
| 288 | simulate_background(obs, m_obs.models()); | 276 | simulate_background(obs, m_obs.models()); |
| 289 | 277 | ||
| @@ -558,7 +546,7 @@ GPhotons ctobssim::simulate_photons(const GCTAObservation* obs, | @@ -558,7 +546,7 @@ GPhotons ctobssim::simulate_photons(const GCTAObservation* obs, | ||
| 558 | 546 | ||
| 559 | // Reserve new space for photons | 547 | // Reserve new space for photons |
| 560 | photons.reserve(photons.size() + p.size()); | 548 | photons.reserve(photons.size() + p.size()); |
| 561 | - | 549 | + |
| 562 | // Add photons to list | 550 | // Add photons to list |
| 563 | for (int k = 0; k < p.size(); ++k) { | 551 | for (int k = 0; k < p.size(); ++k) { |
| 564 | p[k].mcid(i); | 552 | p[k].mcid(i); |
| @@ -573,7 +561,7 @@ GPhotons ctobssim::simulate_photons(const GCTAObservation* obs, | @@ -573,7 +561,7 @@ GPhotons ctobssim::simulate_photons(const GCTAObservation* obs, | ||
| 573 | log << " [" << model->name() << "]"; | 561 | log << " [" << model->name() << "]"; |
| 574 | log << std::endl; | 562 | log << std::endl; |
| 575 | } | 563 | } |
| 576 | - | 564 | + |
| 577 | } // endif: model was a sky model | 565 | } // endif: model was a sky model |
| 578 | 566 | ||
| 579 | } // endfor: looped over models | 567 | } // endfor: looped over models |
| @@ -630,7 +618,7 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GPhotons& photons) | @@ -630,7 +618,7 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GPhotons& photons) | ||
| 630 | // is not the case then allocate and attach a CTA event list now. | 618 | // is not the case then allocate and attach a CTA event list now. |
| 631 | if (dynamic_cast<const GCTAEventList*>(obs->events()) == NULL) | 619 | if (dynamic_cast<const GCTAEventList*>(obs->events()) == NULL) |
| 632 | set_list(obs); | 620 | set_list(obs); |
| 633 | - | 621 | + |
| 634 | // Get pointer on event list (circumvent const correctness) | 622 | // Get pointer on event list (circumvent const correctness) |
| 635 | GCTAEventList* events = (GCTAEventList*)(obs->events()); | 623 | GCTAEventList* events = (GCTAEventList*)(obs->events()); |
| 636 | 624 | ||
| @@ -679,7 +667,7 @@ void ctobssim::simulate_background(GCTAObservation* obs, const GModels& models) | @@ -679,7 +667,7 @@ void ctobssim::simulate_background(GCTAObservation* obs, const GModels& models) | ||
| 679 | // is not the case then allocate and attach a CTA event list now. | 667 | // is not the case then allocate and attach a CTA event list now. |
| 680 | if (dynamic_cast<const GCTAEventList*>(obs->events()) == NULL) | 668 | if (dynamic_cast<const GCTAEventList*>(obs->events()) == NULL) |
| 681 | set_list(obs); | 669 | set_list(obs); |
| 682 | - | 670 | + |
| 683 | // Get pointer on event list (circumvent const correctness) | 671 | // Get pointer on event list (circumvent const correctness) |
| 684 | GCTAEventList* events = (GCTAEventList*)(obs->events()); | 672 | GCTAEventList* events = (GCTAEventList*)(obs->events()); |
| 685 | 673 | ||
| @@ -723,84 +711,6 @@ void ctobssim::simulate_background(GCTAObservation* obs, const GModels& models) | @@ -723,84 +711,6 @@ void ctobssim::simulate_background(GCTAObservation* obs, const GModels& models) | ||
| 723 | } | 711 | } |
| 724 | 712 | ||
| 725 | 713 | ||
| 726 | -/***********************************************************************//** | ||
| 727 | - * @brief Save events | ||
| 728 | - * | ||
| 729 | - * @todo Set header keywords | ||
| 730 | - ***************************************************************************/ | ||
| 731 | -/* | ||
| 732 | -void ctobssim::save_events(const GCTAEventList* events) | ||
| 733 | -{ | ||
| 734 | - // Allocate events file | ||
| 735 | - GFits file; | ||
| 736 | - | ||
| 737 | - // Write events | ||
| 738 | - events->write(&file); | ||
| 739 | - | ||
| 740 | - // Set keywords in EVENTS header | ||
| 741 | - set_events_keywords(&file); | ||
| 742 | - | ||
| 743 | - // Allocate Gti | ||
| 744 | - GGti gti; | ||
| 745 | - | ||
| 746 | - // Setup single GTI covering the selected time range | ||
| 747 | - GTime tstart; | ||
| 748 | - GTime tstop; | ||
| 749 | - tstart.met(m_tmin); | ||
| 750 | - tstop.met(m_tmax); | ||
| 751 | - gti.add(tstart, tstop); | ||
| 752 | - | ||
| 753 | - // Write GTI | ||
| 754 | - gti.write(&file); | ||
| 755 | - | ||
| 756 | - // Dump FITS file | ||
| 757 | - if (logExplicit()) { | ||
| 758 | - log << file << std::endl; | ||
| 759 | - } | ||
| 760 | - | ||
| 761 | - // Save events file. We need to use to saveto() method to make sure | ||
| 762 | - // that any existing file is indeed overwritten | ||
| 763 | - file.saveto(m_outfile, clobber()); | ||
| 764 | - | ||
| 765 | - // Close FITS file | ||
| 766 | - file.close(); | ||
| 767 | - | ||
| 768 | - // Return | ||
| 769 | - return; | ||
| 770 | -} | ||
| 771 | -*/ | ||
| 772 | - | ||
| 773 | -/***********************************************************************//** | ||
| 774 | - * @brief Set keywords of EVENTS header | ||
| 775 | - * | ||
| 776 | - * @param[in] file FITS file. | ||
| 777 | - ***************************************************************************/ | ||
| 778 | -/* | ||
| 779 | -void ctobssim::set_events_keywords(GFits* file) | ||
| 780 | -{ | ||
| 781 | - // Get EVENTS HDU | ||
| 782 | - GFitsHDU* hdu = file->hdu("EVENTS"); | ||
| 783 | - | ||
| 784 | - // Set observation time information | ||
| 785 | - hdu->card("TSTART", m_tmin, "[s] Mission time of start of observation"); | ||
| 786 | - hdu->card("TSTOP", m_tmax, "[s] Mission time of end of observation"); | ||
| 787 | - hdu->card("TELAPSE", m_tmax-m_tmin, "[s] Mission elapsed time"); | ||
| 788 | - hdu->card("ONTIME", m_tmax-m_tmin, "[s] Total good time including deadtime"); | ||
| 789 | - hdu->card("LIVETIME", m_tmax-m_tmin, "[s] Total livetime"); | ||
| 790 | - | ||
| 791 | - // Set target information | ||
| 792 | - //hdu->card("RA_OBJ", m_ra, "[deg] Target Right Ascension"); | ||
| 793 | - //hdu->card("DEC_OBJ", m_dec, "[deg] Target Declination"); | ||
| 794 | - | ||
| 795 | - // Set pointing information | ||
| 796 | - hdu->card("RA_PNT", m_ra, "[deg] Pointing Right Ascension"); | ||
| 797 | - hdu->card("DEC_PNT", m_dec, "[deg] Pointing Declination"); | ||
| 798 | - | ||
| 799 | - // Return | ||
| 800 | - return; | ||
| 801 | -} | ||
| 802 | -*/ | ||
| 803 | - | ||
| 804 | /*========================================================================== | 714 | /*========================================================================== |
| 805 | = = | 715 | = = |
| 806 | = Private methods = | 716 | = Private methods = |
| @@ -863,7 +773,7 @@ void ctobssim::copy_members(const ctobssim& app) | @@ -863,7 +773,7 @@ void ctobssim::copy_members(const ctobssim& app) | ||
| 863 | 773 | ||
| 864 | // Return | 774 | // Return |
| 865 | return; | 775 | return; |
| 866 | -} | 776 | +} |
| 867 | 777 | ||
| 868 | 778 | ||
| 869 | /***********************************************************************//** | 779 | /***********************************************************************//** |