Exemple #1
0
    def test_oneVertexTwoOutgoingParticlesWithoutEndVertices_expectSameRepresentationInDot(
            self):
        self.hepmc_file.write(
            "E 29 -1 -1.00000000e+00 -1.00000000e+00 -1.00000000e+00 1111230000 -243 534 1 2 0 3\n"
        )
        self.hepmc_file.write(
            "V -200648 1121 9.51900940e+02 -5.33236511e+02 -1.88166296e+03 2.88058228e+03 0 1 1 2.00877000e+05\n"
        )
        self.hepmc_file.write(
            "P 200386 2112 -2.51403702e+02 4.56170502e+02 -1.67972778e+02 1.08733311e+03 9.39565369e+02 1 0 0 0 0\n"
        )
        self.hepmc_file.write(
            "P 200391 2212 -3.58282349e+02 -2.69635498e+02 -7.32659836e+01 1.04249310e+03 9.38272034e+02 1 0 0 0 0\n"
        )
        self.hepmc_file.close()

        hepmc2dot.convert(self.hepmc_file.name, self.dot_file.name)

        with open(self.dot_file.name, 'r') as result_file:
            actual_dot_contents = result_file.read()
        expected_dot_contents = 'digraph event_29 {\n' \
                                + vtx_200648 \
                                + vtx_dummy_200386 \
                                + p_200386 \
                                + vtx_dummy_200391 \
                                + p_200391 \
                                + '}\n'
        self.assertEqual(expected_dot_contents, actual_dot_contents)
Exemple #2
0
    def test_eventTwoVerticesWithOneConnectingParticleAndOneParticleWithoutEndVertex_expectSameRepresentationInDot(
            self):
        self.hepmc_file.write(
            "E 29 -1 -1.00000000e+00 -1.00000000e+00 -1.00000000e+00 1111230000 -243 534 1 2 0 3\n"
        )
        self.hepmc_file.write(
            "V -200648 1121 9.51900940e+02 -5.33236511e+02 -1.88166296e+03 2.88058228e+03 0 1 1 2.00877000e+05\n"
        )
        self.hepmc_file.write(
            "P 200388 211 -2.08521011e+02 2.27627213e+02 1.08288109e+02 3.55670194e+02 1.39570099e+02 1 0 0 -200334 0\n"
        )
        self.hepmc_file.write(
            "P 200389 -211 -5.99197632e+02 -4.59768372e+02 7.55172729e+02 1.07712136e+03 1.39570099e+02 1 0 0 0 0\n"
        )
        self.hepmc_file.write(
            "V -200334 1121 -7.28379395e+02 7.24970886e+02 1.42365698e+03 2.04311096e+03 0 2 1 2.00388000e+05\n"
        )
        self.hepmc_file.close()

        hepmc2dot.convert(self.hepmc_file.name, self.dot_file.name)

        with open(self.dot_file.name, 'r') as result_file:
            actual_dot_contents = result_file.read()
        expected_dot_contents = 'digraph event_29 {\n' \
                                + vtx_200648 \
                                + p_200388 \
                                + vtx_dummy_200389 \
                                + p_200389 \
                                + vtx_200334 \
                                + '}\n'
        self.assertEqual(expected_dot_contents, actual_dot_contents)
Exemple #3
0
    def test_emptyHepMCFile_expectEmptyDotFile(self):
        self.hepmc_file.close()

        hepmc2dot.convert(self.hepmc_file.name, self.dot_file.name)

        with open(self.dot_file.name, 'r') as result_file:
            expected_dot_contents = ""
            actual_dot_contents = result_file.read()
            self.assertEqual(expected_dot_contents, actual_dot_contents)
Exemple #4
0
    def test_unknownDataInHepMCFile_expectEmptyDotFile(self):
        self.hepmc_file.write("X this should be ignored\n")
        self.hepmc_file.write("  this should be ignored too\n")
        self.hepmc_file.write("Y and that as well\n")
        self.hepmc_file.close()

        hepmc2dot.convert(self.hepmc_file.name, self.dot_file.name)

        with open(self.dot_file.name, 'r') as result_file:
            actual_dot_contents = result_file.read()
        expected_dot_contents = ""
        self.assertEqual(expected_dot_contents, actual_dot_contents)
Exemple #5
0
    def test_oneEmptyHepMCEvent_expectOneEmptyDotDigraph(self):
        self.hepmc_file.write(
            "E 29 -1 -1.00000000e+00 -1.00000000e+00 -1.00000000e+00 1111230000 -243 534 1 2 0 3\n"
        )
        self.hepmc_file.close()

        hepmc2dot.convert(self.hepmc_file.name, self.dot_file.name)

        with open(self.dot_file.name, 'r') as result_file:
            actual_dot_contents = result_file.read()
        expected_dot_contents = "digraph event_29 {\n" \
                                "}\n"
        self.assertEqual(expected_dot_contents, actual_dot_contents)
Exemple #6
0
    def test_eventWithOneHepMCVertex_expectOneEventWithOneVertexInDot(self):
        self.hepmc_file.write(
            "E 29 -1 -1.00000000e+00 -1.00000000e+00 -1.00000000e+00 1111230000 -243 534 1 2 0 3\n"
        )
        self.hepmc_file.write(
            "V -200648 1121 9.51900940e+02 -5.33236511e+02 -1.88166296e+03 2.88058228e+03 0 1 1 2.00877000e+05\n"
        )
        self.hepmc_file.close()

        hepmc2dot.convert(self.hepmc_file.name, self.dot_file.name)

        with open(self.dot_file.name, 'r') as result_file:
            actual_dot_contents = result_file.read()
        expected_dot_contents = 'digraph event_29 {\n' \
                                + vtx_200648 + \
                                '}\n'
        self.assertEqual(expected_dot_contents, actual_dot_contents)
Exemple #7
0
    def test_unknownDataAndOneEmptyEventInHepMCFile_expectOneEmptyDotDigraph(
            self):
        self.hepmc_file.write("X this should be ignored\n")
        self.hepmc_file.write("  this should be ignored too\n")
        self.hepmc_file.write(
            "E 29 -1 -1.00000000e+00 -1.00000000e+00 -1.00000000e+00 1111230000 -243 534 1 2 0 3\n"
        )
        self.hepmc_file.write("Y and please ignore this too\n")
        self.hepmc_file.close()

        hepmc2dot.convert(self.hepmc_file.name, self.dot_file.name)

        with open(self.dot_file.name, 'r') as result_file:
            actual_dot_contents = result_file.read()
        expected_dot_contents = "digraph event_29 {\n" \
                                "}\n"
        self.assertEqual(expected_dot_contents, actual_dot_contents)