GithubHelp home page GithubHelp logo

ethancline / apex_g4mc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kvardan/apex_g4mc

0.0 1.0 0.0 3.19 MB

Modified version of G4MC. In this version the magnetic fields are given according to SNAKE package, fringe fields are also added, apertures are updated (from SIMC), several new volumes are added to simulate a more realistic acceptances. For APEX mode simulations, septum magnet and it's vacuum chambers are also defined.

C++ 94.28% Fortran 5.45% CMake 0.26% Shell 0.01%

apex_g4mc's Introduction

APEX_G4MC

This is a modified version of G4MC. In this version the magnetic fields are given according to SNAKE package, fringe fields are also added, apertures are updated (from SIMC), several new volumes are added to simulate a more realistic acceptances. For APEX mode simulations, septum magnet and it's vaccum chambers are also defined.

Magnetic Fields:

Only dipole central field is using fortran code (dipolert2.f) which is a part of the SNAKE package. For the other fields (quads central and fringe fields, dipole fringe field) SNAKE functions are translated to cpp-language and implemented in the G4-codes (a few years ago I found this way more effective, but didn't manage to translate the last part - dipole central field). In the current version the fields are given as global field (by HRSEMField.cc). In old versions the fields were localized in volumes (see HRSEMFieldSetup.cc). This way was not very productive when I added fringe fields and tryed to run simulations with different step sizes, and also monitor the field values on each of the track steps.

Generator:

The initial particle generation is done by "HRSPrimaryGeneratorAction.cc". It uses geant macro input files, while for APEX full simulation, I used root files as input to generate e- e+ pairs... We can modify the particles generation with different ways - depends on what process (particles) you want to generate

Detector:

There are two modes to construct the detector.

  1. HRS standard mode - where we have vacuum, Q1-quad, Q2 quad, Dipole, Q3-quad
  2. APEX mode - where we have displaced targets (by about dz=-100 cm), septum magnet with it's vacuum chambers and then the standard HRS spectrometers (Q1, Q2, Dipole, Q3). Switching the septum "ON" in Detector.ini, the APEX mode is built automatically. With "SeptumOn=0" the standard HRS can be used.
  3. The Sieve slits are defined for APEX mode, but it needs one line modification to place it in the HRS standard mode place. the following parameters (from Detector.ini) are used the most

SetupLSieveSlit=1;
SetupRSieveSlit=0;
sieve_thickness=0.5;
Rad_tail_foil_postn=-104.8;
#if fringe fileds are not needed FringeField=0
FringeField=1;
SeptumOn=1;
SeptumNew=1;
SeptumFieldScale=1.0;
Q1Sos=1;
LFocalPlaneAngle=-45.0
LHRSAngle=12.5;
RHRSAngle=347.5;

The central momentums are defined in HRSUsage.ini
BeamEnergy LHRSMomentum RHRSMomentum BeamTiltedAngle #name list
2200 1500 1500 0.0 #value list
These are the only numbers I changed in HRSUsage.ini
The rest I inherited from old versions and haven't changed (probably most of them are not useful anymore, because of removed modules).

The simulation step size is defined in DetectorConstruction.cc double LarmStepLimit=2.000 * mm;

Simulation Analyses:

I don't use sensitive detectors in my analyses, instead of that I directly analyze track G4Steps (see HRSSteppingAction.cc). I use ASCII output files to write the required information during the simulations. The outputs easily can be changed to root trees, but ASCII files are better when you run several hundreds of parallel jobs and they all write information into the same file simultaneously.

There are a bunch of planes (defined in DetectorConstruction and used in SteppingAction to follow the particles) that I defined and record the track coordinates on these planes. Like "Q1Front", "vdc1Plane", "RSvSlBack" and "LSvSlBack" right and left Sieve back planes I haven't deleted them - may be useful.

How to run:

  1. Set up geant:
    A locally installed geant4 version should be ok.
    On ifarm (@JLab)

setenv JLAB_ROOT /site/12gev_phys
source $JLAB_ROOT/softenv.csh 2.0

  1. Download the package to your local directory

git clone https://github.com/kvardan/APEX_G4MC

  1. Build:

cd APEX_G4MC
mkdir build
cd build
cmake ..
make

4.Run: After above steps an exacutable "G4MC" will appear in build/ directory

ln -s `pwd`/G4MC ../test/no_sieve_central_target/files_in/G4MC
cd ../test/no_sieve_central_target/run
chmod 744 run_0003.sh
./run_0003.sh

Sometimes it is useful to see the detector visually
You can go to files_in/ directory and type:

./G4MC -i -x 1

apex_g4mc's People

Contributors

kvardan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.