Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to simulate for trigger rate #1007

Merged
merged 16 commits into from
Jun 26, 2024

Conversation

VictorBarbosaMartins
Copy link
Collaborator

@VictorBarbosaMartins VictorBarbosaMartins commented Jun 21, 2024

Summary:

This PR improves and tests the simtools-simulate-showers-for-trigger-rates application. It includes also a new file in the DB (see details below). Related to #1001.

Small history of the development:

  • Using simtools-simulate-showers-for-trigger-rates for a very concentrated energetic (1TeV) beam of protons with --array_layout_name 1MST has never lead to triggered events (always 0).
  • The reason turned out to be because the default trigger conditions are configured by the simtel parameter array_triggers which points to a file array_trigger_prod5_lapalma_extended.dat where the array trigger conditions are defined. In this file, every trigger condition is defined starting with at least 2 telescopes, which explains why it did not work to use this trigger condition for a single telescope;
  • I created a new file array_trigger_1MST_lapalma.dat with a single line Trigger 1 of 1 replacing the previous list of trigger conditions and uploaded this file to our currently default DB Staging-CTA-Simulation-Model-v0-3-0;
  • In the application, I changed the simtel parameter array_triggers to point to the new file in the DB.
  • I reran simtools-simulate-showers-for-trigger-rates with this command simtools-simulate-showers-for-trigger-rates --array_layout_name 1MST --primary proton --scatter_x 5 --scatter_y 5 --energy_min 1 --energy_max 2 --site North --nruns 1 --nevents 1 --view_cone 1 --submit_command local --output_path 1MST --use_plain_output_path --run_number 1 and calculated the trigger rate of the resulting simulation with simtools-calculate-trigger-rate --simtel_file_names simtools-output/simulate_showers_for_trigger_rates/simtel-data/North/proton/data/run000001_proton_za020deg_azm000deg_North_1MST_simulate_showers_for_trigger_rates.simtel.zst and finally got all of the simulated events also triggered by the single MST at the center of the array.

Statistics of the simulation and trigger rate estimate

MST (North)

  • simulated with time simtools-simulate-showers-for-trigger-rates --array_layout_name 1MST --primary proton --energy_min 0.01 --energy_max 300 --scatter_x 1500 --scatter_y 0 --site North --nruns 1 --nevents 10000 --view_cone 10 --submit_command local --output_path 1MST --use_plain_output_path --run_number 1. Total time real 28m1.828s
  • trigger calculated with simtools-calculate-trigger-rate --simtel_file_names simtools-output/simulate_showers_for_trigger_rates/simtel-data/North/proton/data/run000001_proton_za020deg_azm000deg_North_1MST_simulate_showers_for_trigger_rates.simtel.zst. Trigger rate 3.9522e+03 ± 4.8656e+02 Hz

LST (North)

  • simulated with time simtools-simulate-showers-for-trigger-rates --array_layout_name 1LST --primary proton --energy_min 0.01 --energy_max 300 --scatter_x 1500 --scatter_y 0 --site North --nruns 1 --nevents 10000 --view_cone 10 --submit_command local --output_path 1LST --use_plain_output_path --run_number 2. Total time real 41m31.767s
  • trigger calculated with simtools-calculate-trigger-rate --simtel_file_names simtools-output/simulate_showers_for_trigger_rates/simtel-data/North/proton/data/run000002_proton_za020deg_azm000deg_North_1LST_simulate_showers_for_trigger_rates.simtel.zst. Trigger rate 4.7178e+03 ± 4.8932e+02 Hz

SST (South)

  • simulated with time simtools-simulate-showers-for-trigger-rates --array_layout_name 1SST --primary proton --energy_min 0.01 --energy_max 300 --scatter_x 1500 --scatter_y 0 --site South --nruns 1 --nevents 10000 --view_cone 10 --submit_command local --output_path 1SST --use_plain_output_path --run_number 3. Total time real 33m12.787s
  • trigger calculated with simtools-calculate-trigger-rate --simtel_file_names simtools-output/simulate_showers_for_trigger_rates/simtel-data/South/proton/data/run000003_proton_za020deg_azm000deg_South_1SST_simulate_showers_for_trigger_rates.simtel.zst. Trigger rate 1.3247e+03 ± 1.9122e+02 Hz

Bias curve

  • I varied the energy threshold for protons, simulated 1e5 events and calculate the trigger rate (all for a single MST). This turned out not to be the best approach to extract a bias curve, because the simulations get very heavy for higher energies (since I maintained the number of simulated events). But this gives us a good first estimate:

Screenshot 2024-06-24 at 09 41 17
Should we perhaps create an application to directly generate bias curves @GernotMaier ?

Signed-off-by: Victor Barbosa Martins <victorbarbosamartins@yahoo.com.br>
Signed-off-by: Victor Barbosa Martins <victorbarbosamartins@yahoo.com.br>
Signed-off-by: Victor Barbosa Martins <victorbarbosamartins@yahoo.com.br>
…simtel"

Signed-off-by: Victor Barbosa Martins <victorbarbosamartins@yahoo.com.br>
Signed-off-by: Victor Barbosa Martins <victorbarbosamartins@yahoo.com.br>
Signed-off-by: Victor Barbosa Martins <victorbarbosamartins@yahoo.com.br>
Signed-off-by: Victor Barbosa Martins <victorbarbosamartins@yahoo.com.br>
Signed-off-by: Victor Barbosa Martins <victorbarbosamartins@yahoo.com.br>

This comment has been minimized.

Signed-off-by: Victor Barbosa Martins <victorbarbosamartins@yahoo.com.br>
Signed-off-by: Victor Barbosa Martins <victorbarbosamartins@yahoo.com.br>
Signed-off-by: Victor Barbosa Martins <victorbarbosamartins@yahoo.com.br>

This comment has been minimized.

@VictorBarbosaMartins VictorBarbosaMartins marked this pull request as ready for review June 24, 2024 07:44
Copy link
Contributor

@GernotMaier GernotMaier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor items, see below.

@GernotMaier
Copy link
Contributor

Did you check the trigger rates with the results we had before? 4 kHz seems to be quite low for an MST - I remember it to be in the rage of 10-15 kHz.

Note also that bias curves are calculates as a function of trigger threshold setting (depending on the trigger type; e.g., as function of discriminator threshold) and not as function of energy. In bias curves, we also include pure NSB trigger (which gives us the threshold).

Signed-off-by: Victor Barbosa Martins <victorbarbosamartins@yahoo.com.br>
@VictorBarbosaMartins
Copy link
Collaborator Author

Did you check the trigger rates with the results we had before? 4 kHz seems to be quite low for an MST - I remember it to be in the rage of 10-15 kHz.

Note also that bias curves are calculates as a function of trigger threshold setting (depending on the trigger type; e.g., as function of discriminator threshold) and not as function of energy. In bias curves, we also include pure NSB trigger (which gives us the threshold).

I believe it is because we used to use the threshold at 8 GeV before and not it is at 10 GeV, but I will double check. The simtools trigger rate tool was already validated by the rht tool, so I tend to believe the results at this first glance.

I am not aware of the definitions you mentioned of "discriminator threshold" and threshold estimated from the NSB. I followed your explanation here #1001 (comment). Could you point me to some references? Ok, so no need for an application to estimate the bias curve for now.

@VictorBarbosaMartins
Copy link
Collaborator Author

VictorBarbosaMartins commented Jun 25, 2024

Hi @GernotMaier, thank you for the comments. Please let me know if something is missing and you can have a look again once the tests pass.

Signed-off-by: Victor Barbosa Martins <victorbarbosamartins@yahoo.com.br>
@GernotMaier
Copy link
Contributor

The important point is that we want to get an understand how telescope triggers change with changes in the setting of the trigger parameters (e.g., trigger discriminator thresholds (or sums), patterns, multiplicities). So will need the trigger rate as function of those parameters for both proton and NSB triggers.

I've looked again into KB's results (here and those results give:

  • SST: 350-450 Hz (above value given is 1.3 kHz; much higher)
  • MST-N: 2.8-4.2 kHz depending on the trigger settings (above value is 4 kHz, so probably fine; but need to check the corresponding trigger setting)
  • LST-N: 4.2-6 kHz (above value is 4.7 kHz; check settings)

So LST/MST look fine; SST a bit high.

(the 10-15 kHz for the MST I had in mind was protons + NSB trigger).

Signed-off-by: Victor Barbosa Martins <victorbarbosamartins@yahoo.com.br>
Signed-off-by: Victor Barbosa Martins <victorbarbosamartins@yahoo.com.br>

This comment has been minimized.

1 similar comment
Copy link

Failed

  • 0.00% Coverage on New Code (is less than 80.00%)

Analysis Details

0 Issues

  • Bug 0 Bugs
  • Vulnerability 0 Vulnerabilities
  • Code Smell 0 Code Smells

Coverage and Duplications

  • Coverage 0.00% Coverage (72.90% Estimated after merge)
  • Duplications 0.00% Duplicated Code (0.10% Estimated after merge)

Project ID: gammasim_simtools_AY_ssha9WiFxsX-2oy_w

View in SonarQube

@VictorBarbosaMartins
Copy link
Collaborator Author

The important point is that we want to get an understand how telescope triggers change with changes in the setting of the trigger parameters (e.g., trigger discriminator thresholds (or sums), patterns, multiplicities). So will need the trigger rate as function of those parameters for both proton and NSB triggers.

I've looked again into KB's results (here and those results give:

  • SST: 350-450 Hz (above value given is 1.3 kHz; much higher)
  • MST-N: 2.8-4.2 kHz depending on the trigger settings (above value is 4 kHz, so probably fine; but need to check the corresponding trigger setting)
  • LST-N: 4.2-6 kHz (above value is 4.7 kHz; check settings)

So LST/MST look fine; SST a bit high.

(the 10-15 kHz for the MST I had in mind was protons + NSB trigger).

I used the very same simulation results for the SST here as input to the rht tool and got 1.38 KHz, hence compatible with the simtools trigger estimate. The differences are either configuration or model:

(base) ./rht $USERMASSSTORAGE/CTA/simtools/run000003_proton_za020deg_azm000deg_South_1SST_simulate_showers_for_trigger_rates.hdata.zst --show-num
# Read 151 histograms from /lustre/fs23/group/hess/user/vimartin/CTA/simtools/run000003_proton_za020deg_azm000deg_South_1SST_simulate_showers_for_trigger_rates.hdata.zst
# Maximum actual core range of simulations: 1499.87 m


Attention: Core range in histograms not matching. Use common part.


Attention: Energy range in histograms not matching. Use common part.
# Core range up to 3000 m, energy range 0.001 to 10000 TeV
# Cone angle = 10 deg. (solid angle = 0.0954557 sr)
# No histogram 11000

# Maximum radius from histogram #1006 = 1499.87 m.
#@EA lg(E)      Aeff    diff.Rate    	E
#@EA [(TeV)]    [m^2]   [Hz/bin]     	[TeV]
@EA -1.975	0	0    	0.0105925
@EA -1.925	0	0    	0.011885
@EA -1.875	0	0    	0.0133352
@EA -1.825	0	0    	0.0149624
@EA -1.775	0	0    	0.016788
@EA -1.725	0	0    	0.0188365
@EA -1.675	0	0    	0.0211349
@EA -1.625	0	0    	0.0237137
@EA -1.575	0	0    	0.0266073
@EA -1.525	0	0    	0.0298538
@EA -1.475	0	0    	0.0334965
@EA -1.425	0	0    	0.0375837
@EA -1.375	0	0    	0.0421697
@EA -1.325	0	0    	0.0473151
@EA -1.275	0	0    	0.0530884
@EA -1.225	0	0    	0.0595662
@EA -1.175	0	0    	0.0668344
@EA -1.125	0	0    	0.0749894
@EA -1.075	0	0    	0.0841395
@EA -1.025	0	0    	0.0944061
@EA -0.975	306.645	155.619    	0.105925
@EA -0.925	0	0    	0.11885
@EA -0.875	0	0    	0.133352
@EA -0.825	0	0    	0.149624
@EA -0.775	0	0    	0.16788
@EA -0.725	0	0    	0.188365
@EA -0.675	0	0    	0.211349
@EA -0.625	0	0    	0.237137
@EA -0.575	0	0    	0.266073
@EA -0.525	1984.17	176.204    	0.298538
@EA -0.475	3162.27	231.059    	0.334965
@EA -0.425	864.895	51.9902    	0.375837
@EA -0.375	0	0    	0.421697
@EA -0.325	2810.91	114.329    	0.473151
@EA -0.275	0	0    	0.530884
@EA -0.225	4216.36	116.006    	0.595662
@EA -0.175	1466.56	33.184    	0.668344
@EA -0.125	0	0    	0.749894
@EA -0.075	0	0    	0.841395
@EA -0.025	0	0    	0.944061
@EA 0.025	5189.37	53.6978    	1.05925
@EA 0.075	11243.6	95.6709    	1.1885
@EA 0.125	0	0    	1.33352
@EA 0.175	8432.73	48.5163    	1.49624
@EA 0.225	11243.6	53.1917    	1.6788
@EA 0.275	0	0    	1.88365
@EA 0.325	33730.9	107.892    	2.11349
@EA 0.375	5621.82	14.7859    	2.37137
@EA 0.425	0	0    	2.66073
@EA 0.475	28912.2	51.4123    	2.98538
@EA 0.525	11243.6	16.4398    	3.34965
@EA 0.575	0	0    	3.75837
@EA 0.725	0	0    	5.30884
@EA 0.775	33730.9	18.5367    	5.95662
@EA 0.825	33730.9	15.2418    	6.68344
@EA 0.875	0	0    	7.49894
@EA 0.975	0	0    	9.44061
@EA 1.025	33730.9	6.96689    	10.5925
@EA 1.125	101193	14.1306    	13.3352
@EA 1.525	134924	3.93642    	33.4965
@EA 1.775	33730.9	0.369864    	59.5662
@EA 1.875	67461.8	0.500117    	74.9894
@EA 2.325	67461.8	0.0859156    	211.349

# Proton trigger rate(#1007/#1006)  = 1379.77 Hz.
# Rate in range: 1379.77 (1379.77)
# dN/dE peak at 0.105925 TeV
# dN/d log E peak at 0.324882 TeV
# Median energy 0.481731 TeV
# 10% of events below 0.110747 TeV
# 1% of events below 0.101026 TeV
# 0.1% of events below 0.100102 TeV
# Total number of events simulated: 200000
# Total number of events triggered: 48

#@TA   Rate  	Pk(dN/dlogE)  	Pk(dN/dE)  	Median  	10%<     	1%<       	0.1%<       	Filename
#@TA   [Hz]   	[TeV] ...

@TA  1379.77   	0.324882  	0.105925   	0.481731  	0.110747  	0.101026  	0.100102  	run000003_proton_za020deg_azm000deg_South_1SST_simulate_showers_for_trigger_rates.hdata.zst




Summary of class constructor, Reset(), and Clear() calls:
   iactio::MultiDimHistogram: 19,  0,  1,  0

Copy link
Contributor

@GernotMaier GernotMaier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking the SST rates. All good now and ready to merge.

@VictorBarbosaMartins
Copy link
Collaborator Author

Thanks for checking the SST rates. All good now and ready to merge.

Thanks!

@VictorBarbosaMartins VictorBarbosaMartins merged commit 57be74d into main Jun 26, 2024
13 checks passed
@VictorBarbosaMartins VictorBarbosaMartins deleted the corrections_to_simulate_for_trigger_rate branch June 26, 2024 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants