Bug #1480

Constant spatial model gives different number of events for different simulation regions

Added by Knödlseder Jürgen over 9 years ago. Updated over 9 years ago.

Status:ClosedStart date:06/20/2015
Priority:NormalDue date:
Assigned To:Knödlseder Jürgen% Done:

100%

Category:-
Target version:1.0.0
Duration:

Description

Aleksandr Burtovoi sent the following message:

In my work I would like to simulate a simple 2-component model, which contains: 1) point-source and 2) background component with “ConstantValue” Spacial model and “PowerLaw” spectral model (from http://cta.irap.omp.eu/ctools/user_manual/getting_started/models.html).

I run identical simulations with this 2-component model for different objects (with different coordinates).
Although the background model is the same for all cases, I obtained different contribution of the background for the different objects.
In other words, the number of counts corresponded to the constant background differs from object to object, which should not be the case (if my understanding is ok).

I could in fact reproduce the problem with the following model

<source_library title="source library">
  <source name="BG" type="DiffuseSource">
    <spectrum type="PowerLaw">
      <parameter free="1" max="10000" min="0.0001" name="Prefactor" scale="1e-12" value="2.5" />
      <parameter free="1" max="10" min="-10" name="Index" scale="-1" value="2.5" />
      <parameter free="0" max="500000" min="30" name="Scale" scale="1" value="20000" />
    </spectrum>
    <spatialModel type="ConstantValue">
      <parameter free="0" max="10" min="0" name="Value" scale="1" value="1" />
    </spatialModel>
  </source>
</source_library>

and running ctobssim once on the Crab region and once on RA=0 and DEC=0.

Crab region:

2015-06-19T23:07:48: === Observation ===
2015-06-19T23:07:48:  Simulation area ...........: 1.9635e+11 cm2
2015-06-19T23:07:48:  Simulation cone ...........: RA=83.63 deg, Dec=22.01 deg, r=5.5 deg
2015-06-19T23:07:48:  Time interval .............: 0 - 180000 s
2015-06-19T23:07:48:  Photon energy range .......: 100 GeV - 100 TeV
2015-06-19T23:07:48:  Event energy range ........: 100 GeV - 100 TeV
2015-06-19T23:08:33:  MC source photons .........: 196119 [BG]
2015-06-19T23:08:33:  MC source events ..........: 489 [BG]
2015-06-19T23:08:33:  MC source events ..........: 489 (all source models)
2015-06-19T23:08:33:  MC events .................: 489 (all models)

Pole region:

2015-06-19T23:09:06: === Observation ===
2015-06-19T23:09:06:  Simulation area ...........: 1.9635e+11 cm2
2015-06-19T23:09:06:  Simulation cone ...........: RA=0 deg, Dec=0 deg, r=5.5 deg
2015-06-19T23:09:06:  Time interval .............: 0 - 180000 s
2015-06-19T23:09:06:  Photon energy range .......: 100 GeV - 100 TeV
2015-06-19T23:09:06:  Event energy range ........: 100 GeV - 100 TeV
2015-06-19T23:09:52:  MC source photons .........: 9978 [BG]
2015-06-19T23:09:52:  MC source events ..........: 12 [BG]
2015-06-19T23:09:52:  MC source events ..........: 12 (all source models)
2015-06-19T23:09:52:  MC events .................: 12 (all models)


Recurrence

No recurrence.

History

#1 Updated by Knödlseder Jürgen over 9 years ago

  • Status changed from New to In Progress
  • Assigned To set to Knödlseder Jürgen
  • Target version set to 1.0.0
  • % Done changed from 0 to 100

The formula for drawing random numbers on a sphere was not correct. This has now been corrected, and verify using a dedicated test script (test_model_spatial_const.py).

#2 Updated by Knödlseder Jürgen over 9 years ago

  • Status changed from In Progress to Closed

Code in now merged into devel.

#3 Updated by Burtovoi Aleksandr over 9 years ago

I used an updated code that you attached and obtained the similar number of BG-events for Crab and Pole regions:

Crab region:
2015-06-21T14:43:54: ======================
2015-06-21T14:43:54: | Simulate observation |
2015-06-21T14:43:54: ======================
2015-06-21T14:43:54: === Observation ===
2015-06-21T14:43:54: Simulation area ...........: 1.9635e+11 cm2
2015-06-21T14:43:54: Simulation cone ...........: RA=83.63 deg, Dec=22.01 deg, r=6 deg
2015-06-21T14:43:54: Time interval .............: 0 - 180000 s
2015-06-21T14:43:54: Photon energy range .......: 100 GeV - 100 TeV
2015-06-21T14:43:54: Event energy range ........: 100 GeV - 100 TeV
2015-06-21T14:45:33: MC source photons .........: 288728 [BG]
2015-06-21T14:45:33: MC source events ..........: 367 [BG]
2015-06-21T14:45:33: MC source events ..........: 367 (all source models)
2015-06-21T14:45:33: MC events .................: 367 (all models)

Pole region:
2015-06-21T14:34:40: ======================
2015-06-21T14:34:40: | Simulate observation |
2015-06-21T14:34:40: ======================
2015-06-21T14:34:40: === Observation ===
2015-06-21T14:34:40: Simulation area ...........: 1.9635e+11 cm2
2015-06-21T14:34:40: Simulation cone ...........: RA=0 deg, Dec=0 deg, r=6 deg
2015-06-21T14:34:40: Time interval .............: 0 - 180000 s
2015-06-21T14:34:40: Photon energy range .......: 100 GeV - 100 TeV
2015-06-21T14:34:40: Event energy range ........: 100 GeV - 100 TeV
2015-06-21T14:36:09: MC source photons .........: 288395 [BG]
2015-06-21T14:36:09: MC source events ..........: 392 [BG]
2015-06-21T14:36:09: MC source events ..........: 392 (all source models)
2015-06-21T14:36:09: MC events .................: 392 (all models)

The difference of “MC events” for these two cases are due to different runs of MC-experiment.

Also available in: Atom PDF