Beispiel #1
0
 def test_helix(self):
     cyl1 = SurfaceCylinder('cyl1', 1., 2.)
     cyl2 = SurfaceCylinder('cyl2', 2., 1.)
     field = 3.8
     particle = Particle(LorentzVector(2., 0, 1, 5), Point(0., 0., 0.), -1)
     debug_info = helix.propagate_one(particle, cyl1, field)
     particle = Particle(LorentzVector(0., 2, 1, 5), Point(0., 0., 0.), -1)
     debug_info = helix.propagate_one(particle, cyl1, field)
    def __init__(self, dimensions, rust_worker, SG_info, model, h_function, hyperparameters, debug=0, **opts):

        self.debug = debug
        self.rust_worker = rust_worker
        self.model = model
        self.SG_info = SG_info
        self.hyperparameters = hyperparameters
        self.dimensions = dimensions
        self.h_function = h_function

        E_cm = math.sqrt(max(sum(LorentzVector(vec) for vec in hyperparameters['CrossSection']['incoming_momenta']).square(),0.0))
        self.E_cm = E_cm
        if debug: print("E_cm detected=%.16e"%self.E_cm)

        self.generator = PS.FlatInvertiblePhasespace(
            [0.]*2, [0.]*(SG_info['topo']['n_loops']+1), 
            beam_Es =(E_cm/2.,E_cm/2.), beam_types=(0,0),
            dimensions = self.dimensions,
        )

        # Variables for testing that the inverse jacobian works well.
        # Sett test_inverse_jacobian to True in order to debug the inverse jacobian.
        self.test_inverse_jacobian = False
        if self.test_inverse_jacobian:
            print("WARNING: Running in debug mode 'test_inverse_jacobian'.")
            time.sleep(1.0)
        self.rv = None
        self.i_count = 0
Beispiel #3
0
    def test_straightline(self):
        origin = Point(0, 0, 0)
        cyl1 = SurfaceCylinder('cyl1', 1, 2)
        cyl2 = SurfaceCylinder('cyl2', 2, 1)

        particle = Particle(LorentzVector(1, 0, 1, 2.), origin, 0)
        straight_line.propagate_one(particle, cyl1)
        straight_line.propagate_one(particle, cyl2)
        self.assertEqual(len(particle.points), 3)
        # test extrapolation to barrel
        self.assertAlmostEqual(particle.points['cyl1'].Perp(), 1.)
        self.assertAlmostEqual(particle.points['cyl1'].Z(), 1.)
        # test extrapolation to endcap
        self.assertAlmostEqual(particle.points['cyl2'].Z(), 1.)

        # testing extrapolation to -z
        particle = Particle(LorentzVector(1, 0, -1, 2.), origin, 0)
        # import pdb; pdb.set_trace()
        straight_line.propagate_one(particle, cyl1)
        straight_line.propagate_one(particle, cyl2)
        self.assertEqual(len(particle.points), 3)
        self.assertAlmostEqual(particle.points['cyl1'].Perp(), 1.)
        # test extrapolation to endcap
        self.assertAlmostEqual(particle.points['cyl1'].Z(), -1.)
        self.assertAlmostEqual(particle.points['cyl2'].Z(), -1.)

        # extrapolating from a vertex close to +endcap
        particle = Particle(LorentzVector(1, 0, 1, 2.), Point(0, 0, 1.5), 0)
        straight_line.propagate_one(particle, cyl1)
        self.assertAlmostEqual(particle.points['cyl1'].Perp(), 0.5)

        # extrapolating from a vertex close to -endcap
        particle = Particle(LorentzVector(1, 0, -1, 2.), Point(0, 0, -1.5), 0)
        straight_line.propagate_one(particle, cyl1)
        self.assertAlmostEqual(particle.points['cyl1'].Perp(), 0.5)

        # extrapolating from a non-zero radius
        particle = Particle(LorentzVector(0, 0.5, 1, 2.), Point(0, 0.5, 0), 0)
        straight_line.propagate_one(particle, cyl1)
        self.assertAlmostEqual(particle.points['cyl1'].Perp(), 1.)
        self.assertAlmostEqual(particle.points['cyl1'].Z(), 1.)

        # extrapolating from a z outside the cylinder
        particle = Particle(LorentzVector(0, 0, -1, 2.), Point(0, 0, 2.5), 0)
        straight_line.propagate_one(particle, cyl1)
        self.assertFalse('cyl1' in particle.points)

        # extrapolating from a z outside the cylinder, negative
        particle = Particle(LorentzVector(0, 0, -1, 2.), Point(0, 0, -2.5), 0)
        straight_line.propagate_one(particle, cyl1)
        self.assertFalse('cyl1' in particle.points)

        # extrapolating from a rho outside the cylinder
        particle = Particle(LorentzVector(0, 0, -1, 2.), Point(0, 1.1, 0), 0)
        straight_line.propagate_one(particle, cyl1)
        self.assertFalse('cyl1' in particle.points)
    def __init__(self, dimensions, rust_worker, SG_info, model, h_function, hyperparameters, debug=0, **opts):

        self.rust_worker = rust_worker
        self.model = model
        self.SG_info = SG_info
        self.dimensions = dimensions
        self.h_function = h_function
        self.debug = debug

        self.topology = (
                    # s-channels first:
                    base_objects.VertexList([]),
                    # t-channels then:
                    base_objects.VertexList([
                        # The dummy vertex below is just to close the diagram and connect
                        # with the number -3 which is to be understood here as the initial state #2.
                        base_objects.Vertex({
                            'id': DUMMY, # Irrelevant
                            'legs': base_objects.LegList([
                                base_objects.Leg({
                                    'id': 11,
                                    'number': -2,
                                    'state': FINAL,
                                }),
                                base_objects.Leg({
                                    'id': 23,
                                    'number': -1,
                                    'state': FINAL,
                                }),
                                base_objects.Leg({
                                    'id': -11,
                                    'number': -3,
                                    'state': INITIAL,
                                })
                            ])
                        }),
                    ])
                )

        E_cm = math.sqrt(max(sum(LorentzVector(vec) for vec in hyperparameters['CrossSection']['incoming_momenta']).square(),0.0))


        self.generator = PS.SingleChannelPhasespace([0.]*2, [0.]*3,
                beam_Es =(E_cm/2.,E_cm/2.), beam_types=(0,0), 
                model=model, topology=self.topology, path = [[0,],[]],
                dimensions = self.dimensions
            )
        
        print("Considering the following topology:")
        print("-"*10)
        print(self.generator.get_topology_string(self.generator.topology, path_to_print=self.generator.path))
        print("-"*10)
    def __init__(self, dimensions, rust_worker, SG_info, model, h_function, hyperparameters, debug=0, **opts):

        self.debug = debug
        self.rust_worker = rust_worker
        self.model = model
        self.SG_info = SG_info
        self.hyperparameters = hyperparameters
        self.dimensions = dimensions
        self.h_function = h_function

        E_cm = math.sqrt(max(sum(LorentzVector(vec) for vec in hyperparameters['CrossSection']['incoming_momenta']).square(),0.0))
        self.E_cm = E_cm
        if debug: print("E_cm detected=%.16e"%self.E_cm)

        # This generator is actually only used for its 'self.generator.dim_name_to_position' attribute
        self.generator = PS.FlatInvertiblePhasespace(
            [0.]*2, [0.]*(SG_info['topo']['n_loops']+1), 
            beam_Es =(E_cm/2.,E_cm/2.), beam_types=(0,0),
            dimensions = self.dimensions,
        )
    def __init__(self, dimensions, rust_worker, SG_info, model, h_function, hyperparameters, debug=0, **opts):

        self.rust_worker = rust_worker
        self.model = model
        self.SG_info = SG_info
        self.dimensions = dimensions
        self.h_function = h_function
        self.debug = debug

        # The process is e+(1) e-(2) > a > d(3) d~(4) g(5) g(6)
        # The SG_QG36 topoology assigns externals as follows:
        # LMB vec #1 = pq3 = -d(3)
        # LMB vec #2 = pq6 = +d~(4)
        # LMB vec #3 = pq10 = +g(5)
        # dependnet momentum = pq9 = -(-#1 +#2 +#3 +Q) 

        # Topology is 
        # g(5) g(6) -> -1
        # -1 d~(4) -> -2
        # -2 d(3) -> incoming "decaying" particle

        self.topology = (
                    # s-channels first:
                    base_objects.VertexList([
                        base_objects.Vertex({
                            'id': DUMMY, # Irrelevant
                            'legs': base_objects.LegList([
                                base_objects.Leg({
                                    'id': 21,
                                    'number': 5,
                                    'state': FINAL,
                                }),
                                base_objects.Leg({
                                    'id': 21,
                                    'number': 6,
                                    'state': FINAL,
                                }),
                                base_objects.Leg({
                                    'id': 21,
                                    'number': -1,
                                    'state': FINAL,
                                })
                            ])
                        }),
                        base_objects.Vertex({
                            'id': DUMMY, # Irrelevant
                            'legs': base_objects.LegList([
                                base_objects.Leg({
                                    'id': 21,
                                    'number': -1,
                                    'state': FINAL,
                                }),
                                base_objects.Leg({
                                    'id': 1,
                                    'number': 4,
                                    'state': FINAL,
                                }),
                                base_objects.Leg({
                                    'id': 1,
                                    'number': -2,
                                    'state': FINAL,
                                })
                            ])
                        }),
                        base_objects.Vertex({
                            'id': DUMMY, # Irrelevant
                            'legs': base_objects.LegList([
                                base_objects.Leg({
                                    'id': 1,
                                    'number': -2,
                                    'state': FINAL,
                                }),
                                base_objects.Leg({
                                    'id': 1,
                                    'number': 3,
                                    'state': FINAL,
                                }),
                                base_objects.Leg({
                                    'id': 22,
                                    'number': -3,
                                    'state': FINAL,
                                })
                            ])
                        }),
                    ]),
                    # t-channels then:
                    base_objects.VertexList([
                        # The dummy vertex below is just to close the diagram and connect
                        # with the number -3 which is to be understood here as the initial state #2.
                        base_objects.Vertex({
                            'id': DUMMY, # Irrelevant
                            'legs': base_objects.LegList([
                                base_objects.Leg({
                                    'id': 11,
                                    'number': 1,
                                    'state': INITIAL,
                                }),
                                base_objects.Leg({
                                    'id': 22,
                                    'number': -3,
                                    'state': FINAL,
                                }),
                                base_objects.Leg({
                                    'id': 11,
                                    'number': -4,
                                    'state': INITIAL,
                                })
                            ])
                        }),
                    ])
                )

        E_cm = math.sqrt(max(sum(LorentzVector(vec) for vec in hyperparameters['CrossSection']['incoming_momenta']).square(),0.0))
        self.E_cm = E_cm
        if debug: print("E_cm detected=%.16e"%self.E_cm)

        self.generator = PS.SingleChannelPhasespace([0.]*2, [0.]*(SG_info['topo']['n_loops']+1),
                beam_Es =(self.E_cm/2.,self.E_cm/2.), beam_types=(0,0), 
                model=model, topology=self.topology, #path = [[0,1], []],
                dimensions = self.dimensions
        )

        print("Considering the following topology:")
        print("-"*10)
        print(self.generator.get_topology_string(self.generator.topology, path_to_print=self.generator.path))
        print("-"*10)
        print("With the following path = ",self.generator.path)

#       For testing we can substitute here a flat PS generator.
#        self.generator = PS.FlatInvertiblePhasespace(
#            [0.]*2, [0.]*(SG_info['topo']['n_loops']+1), 
#            beam_Es =(E_cm/2.,E_cm/2.), beam_types=(0,0),
#            dimensions = self.dimensions
#        )

        # Variables for testing that the inverse jacobian works well.
        # Sett test_inverse_jacobian to True in order to debug the inverse jacobian.
        self.test_inverse_jacobian = False
        if self.test_inverse_jacobian:
            print("WARNING: Running in debug mode 'test_inverse_jacobian'.")
            time.sleep(1.0)
        self.rv = None
        self.i_count = 0