Skip to main content

A package for generating toy tracking data.

Project description

ToyTrack

Documentation Status

ToyTrack is a Python library for generating toy tracking events for particle physics.

The goal: To produce a "good-enough" event simulation, in as few lines as possible (currently 3 lines), as quickly as possible (currently 0.07 seconds for a 10,000-particle event).

Installation

Use the package manager pip to install ToyTrack.

pip install toytrack

Usage

Vanilla Event

from toytrack import ParticleGun, Detector, EventGenerator

# Initialize a particle gun which samples uniformly from pt between 10 and 20 GeV, 
# initial direction phi between -pi and pi, and creation vertex vx and vy between -0.1 and 0.1 cm
particle_gun = ParticleGun(dimension=2, pt=[2, 20], pphi=[-np.pi, np.pi], vx=[-0.1, 0.1], vy=[-0.1, 0.1])

# Initialize a detector
detector = Detector(dimension=2).add_from_template('barrel', min_radius=0.5, max_radius=3, number_of_layers=10)

# Initialize an event generator, which generates an event with a number of particles given by a normal
# distribution, with mean 10 and standard deviation 5
event = EventGenerator(particle_gun, detector, num_particles=[20, 5, 'normal']).generate_event()

# Access the particles, hits and tracks as needed
particles = event.particles
hits = event.hits
tracks = event.tracks

# Plot the event
event.display()

Example Event

Event with Track Holes

... # as above

# Initialize a detector that randomly drops 10% of hits. If an int N is given, then exactly
# N hits per track are dropped
detector = Detector(dimension=2, hole_inefficiency=0.1).add_from_template('barrel', min_radius=0.5, max_radius=3, number_of_layers=10)

... # as above

# Plot the event
event.display()

Example Event with Holes

Event with Noise Hits

... # as above

# Generate event with between 30% and 70% noise hits per real hits. E.g. If the event has 100 
# real hits, then between 30 and 70 noise hits will be generated. If an int N is given, then
# the absolute value of N noise hits are generated
event = EventGenerator(particle_gun, detector, num_particles=[20, 5, 'normal'], noise=[0.3, 0.7]).generate_event()

... # as above

# Plot the event
event.display()

Example Event with Noise

Performance

ToyTrack is designed to be fast. The following benchmarks were performed on a 64-core AMD EPYC 7763 (Milan) CPU.

Scaling Study

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

toytrack-0.1.9.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

toytrack-0.1.9-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file toytrack-0.1.9.tar.gz.

File metadata

  • Download URL: toytrack-0.1.9.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.5

File hashes

Hashes for toytrack-0.1.9.tar.gz
Algorithm Hash digest
SHA256 ff922ed31d77146f51bc47282c3dbd71214a47570702111de2df9315946ea711
MD5 59e7ed867d6d6dac5f0560f399926be1
BLAKE2b-256 59e5d31fb5ad260e68333b3376caaaa1225d23f4874d86746ece2778e8a2bc4b

See more details on using hashes here.

File details

Details for the file toytrack-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: toytrack-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.5

File hashes

Hashes for toytrack-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 e3f72b43456ebb853c298cf1942bf517283cde3401e6cee55e3cc7a31afca7d5
MD5 b8ffa5824c61cc117ef9b4565e93269b
BLAKE2b-256 ce0b36ae834024b2d6b3d4bafdec129a07a7403ea5322e6772f282d6dd3b7726

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page