Skip to content

Kwaizer/Packaging-the-HEP-simulation-stack

Repository files navigation

Packaging the HEP simulation stack on conda-forge

This repository summarizes a work done during IRIS-HEP 2024 Fellowship under the mentorship of Dr. Matthew Feickert (University of Wisconsin-Madison).

Initial setup

For demonstration of things added to the conda-forge ecosystem a pixi environment was created. It allows installation of libraries and applications in a reproducible way and also is cross-platform, which is helpful because it shows that those tools are now accessible on different platforms.

Clone the repo

git clone git@github.com:Kwaizer/Packaging-the-HEP-simulation-stack.git

Start Jupyter notebook

cd Packaging-the-HEP-simulation-stack
pixi run lab

Compile hepmc2/hepmc3 code:

pixi run hepmc2-example
pixi run hepmc3-example

The binaries can be executed in notebook itself.

conda-forge/hepmc2-feedstock#9

Added and specified aarch64, ppc64le and osx_64 platforms for a hepmc2 package

image

Example usage:

#include "HepMC/GenEvent.h"
#include "HepMC/GenParticle.h"
#include "HepMC/GenVertex.h"

int main() {

    HepMC::GenEvent event(HepMC::Units::GEV, HepMC::Units::MM);

    // Create a vertex and add it to the event
    HepMC::GenVertex* vertex = new HepMC::GenVertex();
    event.add_vertex(vertex);

    // Create a particle and add it to the vertex
    HepMC::GenParticle* particle = new HepMC::GenParticle(HepMC::FourVector(0,0,100,100), 11, 1);
    vertex->add_particle_out(particle);
    event.print();

    return 0;
}

image

  • conda-forge/hepmc3-feedstock#19
  • Added macOS and Linux aarch64 and ppc64le builds
  • Re-rendered with {{ stdlib("c") }}
  • Updated sha256
  • Refactored use of CMake in build.sh
  • Added zlib and bzip2 as host requirements
  • Refactored commands due to MacOS issues
  • Fallback to readlink if macOS missing greadlink (implemented with patch)

image

Example usage:

#include "HepMC3/GenEvent.h"
#include "HepMC3/GenVertex.h"
#include "HepMC3/GenParticle.h"

int main() {
    HepMC3::GenEvent evt;
    auto vtx = std::make_shared<HepMC3::GenVertex>();
    auto p = std::make_shared<HepMC3::GenParticle>();
    vtx->add_particle_out(p);
    evt.add_vertex(vtx);
    std::cout << "Event created with " << evt.vertices().size() << " vertices." << std::endl;
    return 0;
}

image

conda-forge/pyhepmc-feedstock#3

  • Adding macOS and Linux aarch64 and ppc64le builds

image

Here is an example of a working tool:

import pyhepmc

# Create a HepMC3 event
event = pyhepmc.GenEvent()

# Create a vertex and a particle
vertex = pyhepmc.GenVertex(position=(0, 0, 0, 0))  # (x, y, z, t)
particle = pyhepmc.GenParticle(momentum=(0, 0, 100, 100), pid=2212, status=1)  # Proton

# Add particle to vertex and vertex to event
vertex.add_particle_out(particle)
event.add_vertex(vertex)

print(f"Number of vertices: {len(event.vertices)}")
print(f"Number of particles: {len(event.particles)}")

image

Acknowledgements

This work was supported by the United States National Science Foundation under Cooperative Agreements PHY-2323298 (Institute for Research and Innovation in Software for High Energy Physics) NSF-2323298

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published