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

Everest collimator natively in xobjects C API, pencil initial conditions, and loss map functionality #16

Merged
merged 177 commits into from
Jan 26, 2023

Conversation

freddieknets
Copy link
Collaborator

@freddieknets freddieknets commented Jan 26, 2023

This pull request summarises one year of work on Everest, mainly done by @ddemetriadou and @freddieknets :

  • We have a working EverestCollimator and EverestCrystal in native xobjects-style C API
  • We have a working PyEverestCollimator and PyEverestCrystal in python for benchmarking
  • We have a working K2Collimator and K2Crystal in FORTRAN as a reference
  • Possibility to generate an matched pencil distribution on one or both jaws of a collimator
  • Post-processing to identify aperture losses (and their location) from collimator losses, ready to be analysed as a loss map

Summary of commits:

  • Does not work yet
  • Bunch of unused variable warnings but pyk2 and coll_k2 are in sync
  • Clean compilation, added zanuc4,5 to k2collimator and test
  • Small typo in compilation script
  • Variable zatom has been pulled out of FORTRAN (using a hack: global variable zatomcurr
  • Included hcut and bnref
  • Removed zatom4 and zatom5
  • Included exenergy as well
  • Added csref
  • DOES NOT WORK. Temporary save
  • WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOORKS
  • Removed csect, nmat, edens, and pleng from coll_materials.
  • cprob taken care of
  • Removed matID, and fixed k2collimator.py
  • xintl moved out
  • bn moved out
  • freep out of coll_materials
  • moved cgen out of coll_materials
  • Removed module coll_materials.
  • Moved funlxp out of coll_scatin.
  • Created stub function in python (calculate_scattering) to replace coll_scatin.
  • Scatin is now done in python!
  • removed all private vars at the start of coll_k2 except those related to FLUKA
  • Typo in k2.py; not tested
  • Fixed another typo in k2.py; all tests pass.
  • Reorganised file structure.
  • Removed old tests.
  • Changed FLUKA global variables into local variables.
  • Moved K2_src into pyk2 folder.
  • Made scatter.py
  • Made random_init wrapper
  • TEMP SAVE, DOES NOT WORK
  • WOOOOORKS
  • the Force is strong with this one
  • Cleaned up code: removed unused variables; coll_k2 is now only the if crystal ... end if part.
  • Two wrappers for crystal and jaw work.
  • Moved fortran out of wrapper function calls
  • Cleaned code from unused variables and old comments.
  • Wrappers for jaw function created.
  • Jaw function is now completely in python.
  • CLEAAAN
  • pyk2_gettran works
  • pyk2_calcionloss works
  • pyk2_ichoix and pyk2_tetat work
  • Everything in python except crystals and random generator
  • not functioning
  • Random generator funlux now in python.
  • Removed all comments.
  • Investigate random Rutherford distribution.
  • Added uniform
  • Manual merge of main.
  • Finished implementing 'fake' random generator in reference K2.
  • Work in progress on crystals; does not work yet
  • works
  • added crystal tests to NoMoreFORTRAN
  • Adding the test files....
  • iAdded more test files...j
  • crystal tests added fully
  • nothing new
  • doesn't work
  • i don't know
  • Crystals don't work, segmentation fault
  • It should works, but does not, for one crystal only (tcpcv,a6r7.b2)
  • Removed global variables enr, mom, betar, bgr, tmax, plen from crystals
  • Code works but funlux has problems
  • Made FUNLUX work; materials parameters are passed.
  • All material dependency (nmat, matid, ..) completely out of FORTRAN.
  • All global variables removed from FORTRAN (except constants).
  • cry_doCrystal is out of FORTRAN
  • Trying to update code with new xobjects API - does not work yet.
  • Fixed issue with xojects API: correct c-source loading.
  • DOES NOT WORK! Need updated fortran files...
  • Random generator back in, but crystals fail
  • Fixed crystal implementation; FORTRAN random generator is now correctly implemented.
  • function interact partly moved to python
  • interact function completely in python
  • function calcionloss now in python
  • moveam completely in python and movech is in the wrapper
  • movech also in Python
  • Cleaned up FORTRAN random generator.
  • Renamed K2 as Everest.
  • Fixed compilation script.
  • Prepared test and examples folders for merge with BaseCollimator.
  • Quick fix in number of turns in LHC B2 lossmap.
  • Removed spurious np.array(...)'s from Everest scattering code.
  • Copied Everest into PyEverest, to be used as a reference when translating Everest to C.
  • Removed spurious drift/backtrack around CO shift.
  • First try in C; does not work.
  • Function soln3 in jaw.h works.
  • WIP; trying C random generators.
  • Removed C-calls random for now.
  • Playing with CO; does not work.
  • Fixed GCC version check.
  • Made a random generator fully in C. Need to test and benchmark timing against FORTRAN. Also, currently Rutherford has default material parameters and sampling range; need to pass them as variables.
  • testing_random_generator notebook available for comparison of Everest and K2 random generators.
  • Some updates to random generator.
  • Added vscode folder to gitignore.
  • Latest updates to random generator.
  • More tests on random generators.
  • Not tested. Moved jaw.py functions to jaw.h but still WIP.
  • Finished implementing random generator.
  • Moved jaw to C - DOES NOT WORK
  • Made temporary references for Despo.
  • Removed python3.9-only code.
  • Removed non-working C code.
  • All functions in C except ichoix and jaw.
  • IChoix also in C.
  • jaw.h is fully functional.
  • jaw.py completely deleted.
  • First crystal function movech in C.
  • Previous commit was wrong, now movech is added.
  • MoveAM is in C.
  • Interact is in C.
  • Updated comments
  • Created new references
  • Doesn't work. Commit to save the work done.
  • Removed csect from crystal.h as it is not used.
  • Fixed returning of array from moveam and movech in C.
  • Crystal now fully in C.
  • Merge work done in Geant4Collimator - test FAIL!
  • Fixed - added missing engine reset.
  • CO angles are no longer used in K2!
  • WIP. Have to deal with pointers.
  • WIP to move loop out of scatter.
  • Small fix to move inside loop.
  • Small fix: equalise length and c_length.
  • Small fix to previous fix.
  • Small fix to previous fix.
  • Moved for loop out of scatter - not yet tested.
  • Fix of continue statement - not yet tested.
  • Fix of enom error - not yet tested.
  • Fix of x_in vs x_part error - not yet tested.
  • Removed npart from scatter - not yet tested.
  • Renamed input variables in scatter - not yet tested.
  • calculate_scattering now in C.
  • Crystals don't work.
  • Crystals work. Scatter successfully in C.
  • Unused variable cleanup.
  • Removed scatter.py
  • Implemented xtrack API for everest Collimator - does not work!
  • Finished C implementation for EverestCollimator (EverestCrystal not yet done): compilation succeeds but results are wrong!
  • Small changes from tempDespinaRefFrederik
  • EverestCollimator fully in native xobjects API. All tests pass except test_materials_b2 Glid for particle id 3429 (and crystals as not yet implemented).
  • Crystals natively use xobjects API, tests pass (new references generated to deal with 1e-11 difference for one particle due to repeated numerical rounding).
  • Merged jaw from tempDespina.
  • Deleted track.py as it is no longer used.
  • Restored build_c.py as it is still needed -temporarily- for the random generator.
  • Collected scattering parameters in a struct.
  • Moved LocalParticle into scatter, but crystals fail..
  • Correct references.
  • Fixed bug in scatter.h. Tests pass.
  • Made UnionRef to pass EverestData in scatter functions - Does not work!
  • Each Everest type gets its own scatter method - works.
  • Using xobject Material to pass parameters to scatter functions.
  • Removed CO angles to be in line with release0.2.0 and cleaned naming and installation of PyEverest elements. Tests pass -however- lossmap does not work. To be investigated.
  • Fixed issues with lossmap (collective vs non-collective tracker), fixed _xobject initialisation, and added correct options to align_to in colldb.
  • Some small improvements and C-code for the base collimator.
  • Fixed logic with InvalidCollimator.
  • Tried to use xpart random generator - DOES NOT WORK; compilation hangs.
  • Integrated xpart random generator. Seems to work, but still need to test decency of random generator to compare.
  • Trying to expose random kernel; not succesfully yet.
  • New references for Everest with new random generator.
  • Fixed energy rescaling after collimator scattering.
  • Added pencil generation.
  • Added save to json for coll_summary in examples.
  • Previous merge was incomplete - fixed now.
  • Quick fix with installation of K2Collimator in manager.
  • Corrected rescaling of energy after scattering (to be in line with everest and pyeverest) and made new references.
  • Combined 4 example lossmaps into one.

Description

Closes # .

Checklist

Mandatory:

  • I have added tests to cover my changes
  • All the tests are passing, including my new ones
  • I described my changes in this PR description

Optional:

  • The code I wrote follows good style practices (see PEP 8 and PEP 20).
  • I have updated the docs in relation to my changes, if applicable
  • I have tested also GPU contexts

ddemetriadou and others added 24 commits January 13, 2023 18:09
…and installation of PyEverest elements. Tests pass -however- lossmap does not work. To be investigated.
…ed _xobject initialisation, and added correct options to align_to in colldb.
…erest and pyeverest) and made new references.
@freddieknets freddieknets changed the title Everest collimator natively in xobjects C API Everest collimator natively in xobjects C API, pencil initial conditions, and loss map functionality Jan 26, 2023
@freddieknets freddieknets marked this pull request as ready for review January 26, 2023 02:03
@freddieknets freddieknets self-assigned this Jan 26, 2023
@freddieknets freddieknets changed the base branch from main to release0.2.0 January 26, 2023 02:11
@freddieknets freddieknets merged commit 7422aa1 into release0.2.0 Jan 26, 2023
@freddieknets freddieknets deleted the Everest branch January 26, 2023 02:12
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.

2 participants