Skip to content

Home

Logo

Release Build status codecov Commit activity License DOI

Welcome to pyGeoSimplify!

Download pyGeoSimplify

pip install pygeosimplify

Quick Start

import pygeosimplify as pgs
from pygeosimplify.simplify.layer import GeoLayer
from pygeosimplify.simplify.detector import SimplifiedDetector

# Set names of branches that specify coordinate system of cells
pgs.set_coordinate_branch("XYZ", "isXYZ")
pgs.set_coordinate_branch("EtaPhiR", "isEtaPhiR")
pgs.set_coordinate_branch("EtaPhiZ", "isEtaPhiZ")
pgs.set_coordinate_branch("RPhiZ", "isRPhiZ")

# Load geometry
geo = pgs.load_geometry("DetectorCells.root", tree_name='treeName')

# Create simplified detector
detector = SimplifiedDetector()

# Add dector layers to detector
n_layer = max(geo.layer) + 1
for i_layer in range(0, n_layer):
    layer = GeoLayer(geo, layer_idx = i_layer, thinned_layer_width = 1)
    detector.add_layer(layer)

# Process detector
detector.process()

# Save simplified detector to gdml file
detector.save_to_gdml(cyl_type='processed', output_path='processed.gdml')

LICENSE

pyGeoSimplify is free of use and open-source. All versions are published under the MIT License.