def test_steppers(conf_const, trk_geo): with pytest.raises(TypeError): acts.examples.PropagationAlgorithm() with pytest.raises(ValueError): acts.examples.PropagationAlgorithm(level=acts.logging.INFO) with pytest.raises(TypeError): acts.Propagator() nav = acts.Navigator(trackingGeometry=trk_geo) with pytest.raises(TypeError): acts.Propagator(navigator=nav) for stepper in (acts.EigenStepper, acts.AtlasStepper): with pytest.raises(TypeError): stepper() s = stepper(acts.NullBField()) assert s prop = acts.examples.ConcretePropagator( acts.Propagator(stepper=s, navigator=nav)) alg = conf_const( acts.examples.PropagationAlgorithm, level=acts.logging.WARNING, propagatorImpl=prop, randomNumberSvc=acts.examples.RandomNumbers(), propagationStepCollection="propagation_steps", sterileLogger=False, ntests=10, ) seq = acts.examples.Sequencer(events=10, numThreads=1, logLevel=acts.logging.WARNING) seq.addAlgorithm(alg) chkAlg = AssertCollectionExistsAlg("propagation_steps", "chk_alg", level=acts.logging.WARNING) seq.addAlgorithm(chkAlg) seq.run() assert acts.StraightLineStepper()
def test_volume_material_mapping(material_recording, tmp_path, assert_root_hash): map_file = tmp_path / "material-map-volume_tracks.root" assert not map_file.exists() s = Sequencer(numThreads=1) geo_map = Path(__file__).parent / "geometry-volume-map.json" assert geo_map.exists() assert geo_map.stat().st_size > 10 with geo_map.open() as fh: assert json.load(fh) detector, trackingGeometry, decorators = getOpenDataDetector( mdecorator=acts.IMaterialDecorator.fromFile(geo_map) ) from material_mapping import runMaterialMapping runMaterialMapping( trackingGeometry, decorators, mapName="material-map-volume", outputDir=str(tmp_path), inputDir=material_recording, s=s, ) s.run() # MaterialMapping alg only writes on destruct. # See https://github.com/acts-project/acts/issues/881 del s mat_file = tmp_path / "material-map-volume.json" assert mat_file.exists() assert mat_file.stat().st_size > 10 with mat_file.open() as fh: assert json.load(fh) assert map_file.exists() assert_entries(map_file, "material-tracks", 200) assert_root_hash(map_file.name, map_file) val_file = tmp_path / "propagation-volume-material.root" assert not val_file.exists() # test the validation as well # we need to destroy the ODD to reload with material # del trackingGeometry # del detector detector, trackingGeometry, decorators = getOpenDataDetector( mdecorator=acts.IMaterialDecorator.fromFile(mat_file) ) from material_validation import runMaterialValidation s = Sequencer(events=10, numThreads=1) field = acts.NullBField() runMaterialValidation( trackingGeometry, decorators, field, outputDir=str(tmp_path), outputName="propagation-volume-material", s=s, ) s.run() assert val_file.exists() assert_root_hash(val_file.name, val_file)
def test_null_bfield(): assert acts.NullBField()