Commit 485abe085fb3ad98b538b4e4d6264423f89dd52e

Authored by knodlseder
1 parent d3fa9b00

Remove explicit deadtime correction as this is now done in the GCTAResponse::mc …

…and GCTAModelRadialAcceptance::mc method.
Showing 1 changed file with 9 additions and 49 deletions
src/ctobssim/ctobssim.cpp
... ... @@ -492,8 +492,6 @@ void ctobssim::set_list(GCTAObservation* obs)
492 492 * @param[in] obs Pointer on CTA observation.
493 493 * @param[in] photons Photon list.
494 494 *
495   - * @exception GCTAException::no_pointing
496   - * No valid pointing found in CTA observation
497 495 * @exception GCTAException::no_response
498 496 * No valid response found in CTA observation
499 497 *
... ... @@ -513,15 +511,6 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models)
513 511 // Continue only if observation pointer is valid
514 512 if (obs != NULL) {
515 513  
516   - // Get pointer on CTA pointing. As we have no time dependent
517   - // pointings implement we just determine the pointing from the
518   - // beginning of the observation. Throw an exception if the pointing
519   - // is not defined.
520   - GCTAPointing* pnt = obs->pointing();
521   - if (pnt == NULL) {
522   - throw GCTAException::no_pointing(G_SIMULATE_SOURCE);
523   - }
524   -
525 514 // Get pointer on CTA response. Throw an exception if the response
526 515 // is not defined.
527 516 GCTAResponse* rsp = obs->response();
... ... @@ -607,7 +596,6 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels& models)
607 596  
608 597 // Initialise cumulative photon counters
609 598 int nphotons = 0;
610   - int ndeadc = 0;
611 599  
612 600 // Loop over time slices
613 601 while (tstart < tmax) {
... ... @@ -635,20 +623,15 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels&amp; models)
635 623 // Simulate events from photons
636 624 for (int i = 0; i < photons.size(); ++i) {
637 625  
638   - // Apply deadtime correction
639   - double deadc = obs->deadc(photons[i].time());
640   - if (deadc < 1.0) {
641   - if (m_ran.uniform() > deadc) {
642   - ndeadc++;
643   - continue;
644   - }
645   - }
646   -
647 626 // Increment photon counter
648 627 nphotons++;
649 628  
650   - // Simulate event
651   - GCTAEventAtom* event = rsp->mc(m_area, photons[i], *pnt, m_ran);
  629 + // Simulate event. Note that this method
  630 + // includes the deadtime correction.
  631 + GCTAEventAtom* event = rsp->mc(m_area,
  632 + photons[i],
  633 + *obs,
  634 + m_ran);
652 635 if (event != NULL) {
653 636 events->append(*event);
654 637 delete event;
... ... @@ -678,12 +661,6 @@ void ctobssim::simulate_source(GCTAObservation* obs, const GModels&amp; models)
678 661 log << " [" << model->name() << "]";
679 662 }
680 663 log << std::endl;
681   - log << parformat("MC photons during deadtime");
682   - log << str(ndeadc);
683   - if (model->name().length() > 0) {
684   - log << " [" << model->name() << "]";
685   - }
686   - log << std::endl;
687 664 log << parformat("MC source events");
688 665 log << str(events->size());
689 666 if (model->name().length() > 0) {
... ... @@ -769,34 +746,19 @@ void ctobssim::simulate_background(GCTAObservation* obs, const GModels&amp; models)
769 746 // If we have a radial acceptance model then simulate events
770 747 if (model != NULL) {
771 748  
772   - // Get simulated event list
  749 + // Get simulated event list. Note that this method includes
  750 + // the deadtime correction.
773 751 GCTAEventList* list = model->mc(*obs, m_ran);
774 752  
775 753 // Reserves space for events
776 754 events->reserve(list->size()+events->size());
777 755  
778   - // Initialise event counters
779   - int nevents = 0;
780   - int ndeadc = 0;
781   -
782 756 // Append events
783 757 for (int k = 0; k < list->size(); k++) {
784 758  
785 759 // Get event pointer
786 760 GCTAEventAtom* event = (*list)[k];
787 761  
788   - // Apply deadtime correction
789   - double deadc = obs->deadc(event->time());
790   - if (deadc < 1.0) {
791   - if (m_ran.uniform() > deadc) {
792   - ndeadc++;
793   - continue;
794   - }
795   - }
796   -
797   - // Increment background event counter
798   - nevents++;
799   -
800 762 // Append event
801 763 events->append(*event);
802 764  
... ... @@ -805,9 +767,7 @@ void ctobssim::simulate_background(GCTAObservation* obs, const GModels&amp; models)
805 767 // Dump simulation results
806 768 if (logNormal()) {
807 769 log << parformat("MC background events");
808   - log << str(nevents) << std::endl;
809   - log << parformat("MC events during deadtime");
810   - log << str(ndeadc) << std::endl;
  770 + log << str(list->size()) << std::endl;
811 771 }
812 772  
813 773 // Free event list
... ...