Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
test_propagation.py
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file test_propagation.py
1 import pytest
2 
3 import acts
4 import acts.examples
5 
6 
7 class AssertCollectionExistsAlg(acts.examples.IAlgorithm):
8  events_seen = 0
9 
10  def __init__(self, collection, *args, **kwargs):
11  self.collection = collection
12  acts.examples.IAlgorithm.__init__(self, *args, **kwargs)
13 
14  def execute(self, ctx):
15  assert ctx.eventStore.exists(self.collection)
16  self.events_seen += 1
17  return acts.examples.ProcessCode.SUCCESS
18 
19 
20 def test_navigator(conf_const):
21  nav = conf_const(acts.Navigator)
22  nav = conf_const(acts.Navigator, trackingGeometry=None)
23 
24 
25 def test_steppers(conf_const, trk_geo):
26  with pytest.raises(TypeError):
27  acts.examples.PropagationAlgorithm()
28  with pytest.raises(ValueError):
29  acts.examples.PropagationAlgorithm(level=acts.logging.INFO)
30 
31  with pytest.raises(TypeError):
33 
34  nav = acts.Navigator(trackingGeometry=trk_geo)
35 
36  with pytest.raises(TypeError):
37  acts.Propagator(navigator=nav)
38 
39  for stepper in (acts.EigenStepper, acts.AtlasStepper):
40  with pytest.raises(TypeError):
41  stepper()
42  s = stepper(acts.NullBField())
43  assert s
44 
46  acts.Propagator(stepper=s, navigator=nav)
47  )
48 
49  alg = conf_const(
50  acts.examples.PropagationAlgorithm,
51  level=acts.logging.WARNING,
52  propagatorImpl=prop,
53  randomNumberSvc=acts.examples.RandomNumbers(),
54  propagationStepCollection="propagation_steps",
55  sterileLogger=False,
56  ntests=10,
57  )
58 
60  events=10, numThreads=1, logLevel=acts.logging.WARNING
61  )
62  seq.addAlgorithm(alg)
64  "propagation_steps", "chk_alg", level=acts.logging.WARNING
65  )
66  seq.addAlgorithm(chkAlg)
67  seq.run()
68 
69  assert acts.StraightLineStepper()