Ejemplo n.º 1
0
    def test_physics(self):
        """
        Check physics_processes datacard works okay

        Check that we lose same energy in mean_energy_loss mode for two
        particles with different seeds and that we have no transverse scatter.

        Check that we lose different energy amount in standard mode and that we
        do have a transverse scatter
        """
        # I want to check that we can set mean energy loss even when reference
        # particle has no energy loss
        file_de = run_simulation("none", "mean_energy_loss", False,
                                                                  -1., -1., 5.)
        bunch_de = Bunch.new_dict_from_read_builtin('maus_root_virtual_hit',
                                                           file_de, "pid")[211]
        # should lose energy in absorber
        de_hits_1 = bunch_de.get_hits('station', 1) # pions us of material
        de_hits_2 = bunch_de.get_hits('station', 2) # pions ds of material
        # check we lose energy through the absorber
        self.assertNotAlmostEqual(de_hits_1 [0]['pz'], de_hits_2[1]['pz'], 3)
        # check two particles lose same energy through absorber (no stochastics)
        self.assertAlmostEqual(de_hits_2 [0]['pz'], de_hits_2[1]['pz'], 3)
        # check no transverse
        self.assertAlmostEqual(de_hits_2[1]['px'], 0., 3)

        file_strag = run_simulation("none", "standard", False, -1., -1., 5.)
        bunch_strag = Bunch.new_dict_from_read_builtin('maus_root_virtual_hit',
                                                      file_strag, "pid")[211]
        strag_hits = bunch_strag.get_hits('station', 2) # pions ds of material
        # check two particles lose different energy through absorber 
        # (no stochastics)
        self.assertNotAlmostEqual(strag_hits[0]['pz'], strag_hits[1]['pz'], 3)
        # check for transverse distribution
        self.assertNotAlmostEqual(strag_hits[0]['px'], 0., 7)
Ejemplo n.º 2
0
    def test_physics(self):
        """
        Check physics_processes datacard works okay

        Check that we lose same energy in mean_energy_loss mode for two
        particles with different seeds and that we have no transverse scatter.

        Check that we lose different energy amount in standard mode and that we
        do have a transverse scatter
        """
        # I want to check that we can set mean energy loss even when reference
        # particle has no energy loss
        file_de = run_simulation("none", "mean_energy_loss", False, -1., -1.,
                                 5.)
        bunch_de = Bunch.new_dict_from_read_builtin('maus_root_virtual_hit',
                                                    file_de, "pid")[211]
        # should lose energy in absorber
        de_hits_1 = bunch_de.get_hits('station', 1)  # pions us of material
        de_hits_2 = bunch_de.get_hits('station', 2)  # pions ds of material
        # check we lose energy through the absorber
        self.assertNotAlmostEqual(de_hits_1[0]['pz'], de_hits_2[1]['pz'], 3)
        # check two particles lose same energy through absorber (no stochastics)
        self.assertAlmostEqual(de_hits_2[0]['pz'], de_hits_2[1]['pz'], 3)
        # check no transverse
        self.assertAlmostEqual(de_hits_2[1]['px'], 0., 3)

        file_strag = run_simulation("none", "standard", False, -1., -1., 5.)
        bunch_strag = Bunch.new_dict_from_read_builtin('maus_root_virtual_hit',
                                                       file_strag, "pid")[211]
        strag_hits = bunch_strag.get_hits('station', 2)  # pions ds of material
        # check two particles lose different energy through absorber
        # (no stochastics)
        self.assertNotAlmostEqual(strag_hits[0]['pz'], strag_hits[1]['pz'], 3)
        # check for transverse distribution
        self.assertNotAlmostEqual(strag_hits[0]['px'], 0., 7)
Ejemplo n.º 3
0
 def read_bunch(self):
     """
     Read the input file
     """
     print self.bunch_read
     return Bunch.new_dict_from_read_builtin(*self.bunch_read)\
                                                           [self.bunch_index]
Ejemplo n.º 4
0
 def read_bunch(self):
     """
     Read the input file
     """
     print self.bunch_read
     return Bunch.new_dict_from_read_builtin(*self.bunch_read)\
                                                           [self.bunch_index]
Ejemplo n.º 5
0
    def test_reference_physics(self):
        """
        Check that reference_physics_processes works okay

        Want to check that the hadronic, energy straggling, decay, scattering
        are disabled in reference particle mode; and that energy loss is either
        disabled or mean only (deterministic).

        So fire hadron that decays i.e. pion; assert that there is some energy
        lost in material when required; assert that the energy loss is the same
        for two consecutive particles (i.e. no stochastic contribution); check
        energy loss by check that the time through RF cavity is 0 (for 0 phase).
        Better to write reference particle parameters, but unfortunately that
        isn't implemented yet.

        Long 100 m baseline is chosen st pion is likely to decay.
        """
        file_no_de = run_simulation("none", "none", False, -1., -1., 5.)
        bunch_no_de = Bunch.new_dict_from_read_builtin('maus_root_virtual_hit',
                                                         file_no_de, "pid")[211]
        # assert no energy lost in absorber
        self.assertAlmostEqual(bunch_no_de[0]['pz'], bunch_no_de[1]['pz'], 3)
        # assert no energy change in RF => reference particle also sees no
        # energy loss in absorber
        self.assertAlmostEqual(bunch_no_de[1]['pz'], bunch_no_de[2]['pz'], 3)
        # assert no scattering
        self.assertAlmostEqual(bunch_no_de[1]['px'], 0., 3)

        file_de = run_simulation("mean_energy_loss", "mean_energy_loss",
                                                          False, -1., -1., 5.)
        bunch_de = Bunch.new_dict_from_read_builtin('maus_root_virtual_hit',
                                                            file_de, "pid")[211]
        # assert energy lost in absorber
        self.assertNotAlmostEqual(bunch_de[0]['pz'], bunch_de[1]['pz'], 3)
        # assert no energy change in RF => reference particle also sees same
        # energy loss in absorber
        self.assertAlmostEqual(bunch_de[1]['pz'], bunch_de[2]['pz'], 3)
        # assert no scattering
        self.assertAlmostEqual(bunch_no_de[1]['px'], 0., 3)
Ejemplo n.º 6
0
    def test_reference_physics(self):
        """
        Check that reference_physics_processes works okay

        Want to check that the hadronic, energy straggling, decay, scattering
        are disabled in reference particle mode; and that energy loss is either
        disabled or mean only (deterministic).

        So fire hadron that decays i.e. pion; assert that there is some energy
        lost in material when required; assert that the energy loss is the same
        for two consecutive particles (i.e. no stochastic contribution); check
        energy loss by check that the time through RF cavity is 0 (for 0 phase).
        Better to write reference particle parameters, but unfortunately that
        isn't implemented yet.

        Long 100 m baseline is chosen st pion is likely to decay.
        """
        file_no_de = run_simulation("none", "none", False, -1., -1., 5.)
        bunch_no_de = Bunch.new_dict_from_read_builtin('maus_root_virtual_hit',
                                                       file_no_de, "pid")[211]
        # assert no energy lost in absorber
        self.assertAlmostEqual(bunch_no_de[0]['pz'], bunch_no_de[1]['pz'], 3)
        # assert no energy change in RF => reference particle also sees no
        # energy loss in absorber
        self.assertAlmostEqual(bunch_no_de[1]['pz'], bunch_no_de[2]['pz'], 3)
        # assert no scattering
        self.assertAlmostEqual(bunch_no_de[1]['px'], 0., 3)

        file_de = run_simulation("mean_energy_loss", "mean_energy_loss", False,
                                 -1., -1., 5.)
        bunch_de = Bunch.new_dict_from_read_builtin('maus_root_virtual_hit',
                                                    file_de, "pid")[211]
        # assert energy lost in absorber
        self.assertNotAlmostEqual(bunch_de[0]['pz'], bunch_de[1]['pz'], 3)
        # assert no energy change in RF => reference particle also sees same
        # energy loss in absorber
        self.assertAlmostEqual(bunch_de[1]['pz'], bunch_de[2]['pz'], 3)
        # assert no scattering
        self.assertAlmostEqual(bunch_no_de[1]['px'], 0., 3)