Skip to content

Commit 4db4aa4

Browse files
committed
Adding assert in 000 files
1 parent d93eada commit 4db4aa4

File tree

7 files changed

+35
-139
lines changed

7 files changed

+35
-139
lines changed

python_examples/hl_lhc_collisions_python/000_pymask.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@
288288

289289
# For B1, to be generalized for B4
290290
if 'filling_scheme_json' in configuration['beambeam_config'].keys():
291+
assert 'b4' not in mode
291292
filling_scheme_json = configuration['beambeam_config']['filling_scheme_json']
292293
bunch_to_track = configuration['beambeam_config']['bunch_to_track']
293294
bb_schedule_to_track_b1 = ost.create_bb_shedule_to_track(
@@ -346,7 +347,7 @@
346347
mad_track.set_variables_from_dict(
347348
params=configuration['pars_for_legacy_bb_macros'])
348349
mad_track.set_variables_from_dict(
349-
params={f'par_nho_ir{ir}':bbconfig['numberOfHOSlices']
350+
params={f'par_nho_ir{ir}': bbconfig['numberOfHOSlices']
350351
for ir in [1,2,5,8]})
351352
mad_track.input("call, file='modules/module_03_beambeam.madx';")
352353

python_examples/hl_lhc_collisions_python/001_reload.madx

Lines changed: 0 additions & 8 deletions
This file was deleted.

python_examples/hl_lhc_collisions_python/001_reload.py

Lines changed: 0 additions & 103 deletions
This file was deleted.

python_examples/ions_python/000_pymask.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@
288288

289289
# For B1, to be generalized for B4
290290
if 'filling_scheme_json' in configuration['beambeam_config'].keys():
291+
assert 'b4' not in mode
291292
filling_scheme_json = configuration['beambeam_config']['filling_scheme_json']
292293
bunch_to_track = configuration['beambeam_config']['bunch_to_track']
293294
bb_schedule_to_track_b1 = ost.create_bb_shedule_to_track(
@@ -338,14 +339,15 @@
338339

339340
# Legacy bb macros
340341
if enable_bb_legacy:
342+
bbconfig = configuration['beambeam_config']
341343
assert(beam_to_configure == 1)
342344
assert(not(track_from_b4_mad_instance))
343345
assert(not(enable_bb_python))
344346
mad_track.globals['par_on_bb_switch'] = 1
345347
mad_track.set_variables_from_dict(
346348
params=configuration['pars_for_legacy_bb_macros'])
347349
mad_track.set_variables_from_dict(
348-
params={f'par_nho_ir{ir}':configuration['numberOfHOSlices']
350+
params={f'par_nho_ir{ir}': bbconfig['numberOfHOSlices']
349351
for ir in [1,2,5,8]})
350352
mad_track.input("call, file='modules/module_03_beambeam.madx';")
351353

@@ -495,7 +497,7 @@
495497
output_folder='./',
496498
reference_num_particles_sixtrack=(
497499
mad_track.sequence[sequence_to_track].beam.npart),
498-
reference_particle_charge_sixtrack=mad_track.sequence[sequence_to_track].beam.charge,
500+
reference_particle_charge_sixtrack=mad_track.sequence[sequence_to_track].beam.charge,
499501
emitnx_sixtrack_um=(
500502
mad_track.sequence[sequence_to_track].beam.exn),
501503
emitny_sixtrack_um=(
@@ -522,9 +524,9 @@
522524
pickle.dump(optics_orbit_start_ring, fid)
523525

524526

525-
#############################
526-
# Generate pysixtrack lines #
527-
#############################
527+
###################
528+
# Generate xlines #
529+
###################
528530

529531
if enable_bb_legacy:
530532
print('xline is not generated with bb legacy macros')
@@ -536,8 +538,6 @@
536538
pickle_lines_in_folder=xline_fol_name,
537539
skip_mad_use=True)
538540

539-
540-
541541
###################################
542542
# Save final twiss #
543543
###################################
@@ -560,6 +560,6 @@
560560
#############################
561561
# Save sequence and errors #
562562
#############################
563-
564-
pm.save_mad_sequence_and_error(mad_track, sequence_to_track, filename='final')
563+
# N.B. this erases the errors
564+
# pm.save_mad_sequence_and_error(mad_track, sequence_to_track, filename='final')
565565

python_examples/ions_python/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
'tools': 'tracking_tools/tools',
88
'beambeam_macros': 'tracking_tools/beambeam_macros',
99
'errors': 'tracking_tools/errors',
10+
'optics_repository' : '/afs/cern.ch/eng/lhc/optics',
1011
},
1112
# Mode - choose between:
1213

@@ -23,7 +24,7 @@
2324
'mode' : 'b1_with_bb',
2425

2526
# Optics file
26-
'optics_file' : '/afs/cern.ch/eng/lhc/optics/runII/2018/ION/opticsfile.21',
27+
'optics_file' : 'optics_repository/runII/2018/ION/opticsfile.21',
2728

2829
# Enable checks
2930
'check_betas_at_ips' : True,

python_examples/run3_collisions_python/000_pymask.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@
288288

289289
# For B1, to be generalized for B4
290290
if 'filling_scheme_json' in configuration['beambeam_config'].keys():
291+
assert 'b4' not in mode
291292
filling_scheme_json = configuration['beambeam_config']['filling_scheme_json']
292293
bunch_to_track = configuration['beambeam_config']['bunch_to_track']
293294
bb_schedule_to_track_b1 = ost.create_bb_shedule_to_track(
@@ -338,14 +339,15 @@
338339

339340
# Legacy bb macros
340341
if enable_bb_legacy:
342+
bbconfig = configuration['beambeam_config']
341343
assert(beam_to_configure == 1)
342344
assert(not(track_from_b4_mad_instance))
343345
assert(not(enable_bb_python))
344346
mad_track.globals['par_on_bb_switch'] = 1
345347
mad_track.set_variables_from_dict(
346348
params=configuration['pars_for_legacy_bb_macros'])
347349
mad_track.set_variables_from_dict(
348-
params={f'par_nho_ir{ir}':configuration['numberOfHOSlices']
350+
params={f'par_nho_ir{ir}': bbconfig['numberOfHOSlices']
349351
for ir in [1,2,5,8]})
350352
mad_track.input("call, file='modules/module_03_beambeam.madx';")
351353

@@ -495,7 +497,7 @@
495497
output_folder='./',
496498
reference_num_particles_sixtrack=(
497499
mad_track.sequence[sequence_to_track].beam.npart),
498-
reference_particle_charge_sixtrack=mad_track.sequence[sequence_to_track].beam.charge,
500+
reference_particle_charge_sixtrack=mad_track.sequence[sequence_to_track].beam.charge,
499501
emitnx_sixtrack_um=(
500502
mad_track.sequence[sequence_to_track].beam.exn),
501503
emitny_sixtrack_um=(
@@ -522,9 +524,9 @@
522524
pickle.dump(optics_orbit_start_ring, fid)
523525

524526

525-
#############################
526-
# Generate pysixtrack lines #
527-
#############################
527+
###################
528+
# Generate xlines #
529+
###################
528530

529531
if enable_bb_legacy:
530532
print('xline is not generated with bb legacy macros')
@@ -536,8 +538,6 @@
536538
pickle_lines_in_folder=xline_fol_name,
537539
skip_mad_use=True)
538540

539-
540-
541541
###################################
542542
# Save final twiss #
543543
###################################
@@ -560,6 +560,6 @@
560560
#############################
561561
# Save sequence and errors #
562562
#############################
563-
564-
pm.save_mad_sequence_and_error(mad_track, sequence_to_track, filename='final')
563+
# N.B. this erases the errors
564+
# pm.save_mad_sequence_and_error(mad_track, sequence_to_track, filename='final')
565565

python_examples/run3_collisions_python/config.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
'tools': 'tracking_tools/tools',
88
'beambeam_macros': 'tracking_tools/beambeam_macros',
99
'errors': 'tracking_tools/errors',
10+
'optics_repository' : '/afs/cern.ch/eng/lhc/optics',
1011
},
1112
# Mode - choose between:
1213

@@ -23,7 +24,7 @@
2324
'mode' : 'b1_with_bb',
2425

2526
# Optics file
26-
'optics_file' : '/afs/cern.ch/eng/lhc/optics/runIII/RunIII_dev/2022_V1/PROTON/opticsfile.29',
27+
'optics_file' : 'optics_repository/runIII/RunIII_dev/2022_V1/PROTON/opticsfile.29',
2728

2829
# Enable checks
2930
'check_betas_at_ips' : True,
@@ -69,20 +70,24 @@
6970
'nco_IP8' : 2376,
7071

7172
# Beam-beam parameters (used by python tools - NOT by legacy macros)
72-
'numberOfLRPerIRSide' : [25, 20, 25, 20],
73-
'bunch_spacing_buckets' : 10,
74-
'numberOfHOSlices' : 11,
75-
'bunch_population_ppb' : None,
76-
'sigmaz_m' : None,
77-
'z_crab_twiss' : 0.,
73+
'beambeam_config' :
74+
{
75+
'numberOfLRPerIRSide' : [25, 20, 25, 20],
76+
'bunch_spacing_buckets' : 10,
77+
'numberOfHOSlices' : 11,
78+
'bunch_num_particles' : None,
79+
'bunch_particle_charge' : None,
80+
'sigmaz_m' : None,
81+
'z_crab_twiss' : 0.,
82+
},
7883

7984
# Match tunes and chromaticities including beam-beam effects
8085
'match_q_dq_with_bb' : False, # should be off at collision
8186

8287
# Enable crab cavities
8388
'enable_crabs' : False,
8489

85-
# N. iterations coupling correction
90+
# N. iterations for coupling correction
8691
'N_iter_coupling' : 2,
8792

8893
# Value to be added to linear coupling knobs (on sequence_to_track)

0 commit comments

Comments
 (0)