Warning, /snippets/TestBeamsAndSetups/beam_evenlope/README.md is written in an unsupported language. File is not indexed.
0001 # Particle Event Simulator and Visualizer
0002
0003 This project is a simulation and visualization tool for generating synthetic particle events in HepMC ASCII format, supporting pion, kaon, and proton species. It uses [ROOT](https://root.cern/) for random generation, histogramming, and fitting.
0004
0005 ## Features
0006
0007 - Generate synthetic particle events with randomized momenta and vertices
0008 - Save events in HepMC v3 ASCII format
0009 - Parse and visualize vertex and momentum distributions using ROOT
0010 - Fit distributions with Gaussian and 2D Gaussian functions
0011 - Interactive plotting interface
0012
0013 ## Requirements
0014
0015 - Python 3.x
0016 - [ROOT](https://root.cern/install/) (Python bindings must be available, e.g., `import ROOT` should work)
0017
0018 ## Getting Started
0019
0020 ## Running the Program
0021 ```python3 particle_simulator.py```
0022
0023 Options:
0024 1. Pion
0025 2. Kaon
0026 3. Proton
0027
0028 Plot Options:
0029 1. Unfitted Distributions
0030 2. Fitted Distributions
0031 0. Exit
0032
0033
0034 ## Output Format
0035 HEMP3 format
0036
0037 ```
0038 E 0 0 0 0 0 0
0039 F GenEvent 3 0
0040 F Units 0 0
0041 F MomentumUnit GEV
0042 F LengthUnit MM
0043 F GenParticle 1 1 211 1 0 0 0 0 px py pz E
0044 F GenVertex 1 -1 -1 -1 vx vy vz 0.0
0045 ```
0046
0047 ## Visualizations
0048 - 2D Vertex Distribution (X vs Y in mm)
0049 - Momentum Magnitude Histogram (|p| in GeV)
0050 - Optional Gaussian/2D Gaussian fits with reduced χ² output
0051
0052
0053 # Using the generated HEPMC files in the npsim:
0054 - Loading the detector geomettry (we are using the default ePIC detector geometry file as an example)
0055
0056 ```source /opt/detector/epic-main/bin/thisepic.sh```
0057
0058 - Running the generated detector geometry file "flat_particle_ascii.hepmc" through DD4Hep.
0059
0060 ```ddsim --compactFile $DETECTOR_PATH/$DETECTOR_CONFIG.xml --numberOfEvents 10 --inputFiles flat_particle_ascii.hepmc --outputFile envolope_sim_output.root```