1212# ============================================
1313
1414# Get line and collimators
15- line = xt .Line .from_json (xc ._pkg_root / '..' / 'examples' / 'machines' / 'lhc_run3_b1.json' )
15+ line = xt .Line .from_json (xc ._pkg_root . parent / 'examples' / 'machines' / 'lhc_run3_b1.json' )
1616
17- coll_manager = xc .CollimatorDatabase .from_yaml (xc ._pkg_root / '..' / 'examples' / 'colldb' / 'lhc_run3.yaml' , beam = 1 )
18- coll_manager .install_everest_collimators (verbose = True , line = line )
17+ colldb = xc .CollimatorDatabase .from_yaml (xc ._pkg_root . parent / 'examples' / 'colldb' / 'lhc_run3.yaml' , beam = 1 )
18+ colldb .install_everest_collimators (verbose = True , line = line )
1919df_with_coll = line .check_aperture ()
2020assert not np .any (df_with_coll .has_aperture_problem )
2121
2424
2525# Build tracker, assign optics and generate particles
2626line .build_tracker ()
27- xc . assign_optics_to_collimators ( line = line )
27+ line . collimators . assign_optics ( )
2828part = xc .generate_pencil_on_collimator (line , 'tcp.d6l7.b1' , 50000 )
2929
3030# This is not needed, but is done here so that we can track with 12 treads.
3131line .discard_tracker ()
3232line .build_tracker (_context = xo .ContextCpu (omp_num_threads = 12 ))
3333
3434# Track
35- xc . enable_scattering ( line )
35+ line . scattering . enable ( )
3636line .track (part , num_turns = 20 , time = True , with_progress = 1 )
37- xc . disable_scattering ( line )
37+ line . scattering . disable ( )
3838line .discard_tracker ()
3939impacts .stop ()
4040
4141df = impacts .to_pandas ()
42- df .to_csv ('impacts .csv' , index = False )
42+ df .to_csv ('impacts_line .csv' , index = False )
4343
4444# ============================================
4545# With collimator
5959part .sort (interleave_lost_particles = True )
6060
6161df = impacts_coll .to_pandas ()
62- df [df .interaction_type == 'Enter Jaw L' ].to_csv ('Enter_Jaw_L .csv' , index = False )
62+ df [df .interaction_type == 'Enter Jaw L' ].to_csv ('impacts_coll_enter_jaw_L .csv' , index = False )
6363
6464# ============================================
6565# With crystal
8080
8181impacts_crystal .to_pandas ()
8282df_crystal = impacts_crystal .interactions_per_collimator ()
83- df_crystal .to_csv ('interactions_per_crystal .csv' , index = False )
83+ df_crystal .to_csv ('impacts_crystal_interactions .csv' , index = False )
0 commit comments