This repository has been archived by the owner on Aug 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
example_print_test.go
85 lines (73 loc) · 2.01 KB
/
example_print_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package proio_test
import (
"fmt"
"github.com/decibelcooper/proio/go-proio"
"github.com/decibelcooper/proio/go-proio/model/eic"
)
func Example_print() {
event := proio.NewEvent()
parentPDG := int32(443)
parent := &eic.Particle{Pdg: &parentPDG}
parentID := event.AddEntry("Particle", parent)
event.TagEntry(parentID, "MC", "Primary")
child1PDG := int32(11)
child1 := &eic.Particle{Pdg: &child1PDG}
child2PDG := int32(-11)
child2 := &eic.Particle{Pdg: &child2PDG}
childIDs := event.AddEntries("Particle", child1, child2)
for _, id := range childIDs {
event.TagEntry(id, "MC", "GenStable")
}
parent.Child = append(parent.Child, childIDs...)
child1.Parent = append(child1.Parent, parentID)
child2.Parent = append(child2.Parent, parentID)
fmt.Print(event)
// Output:
// ---------- TAG: GenStable ----------
// ID: 2
// Entry type: proio.model.eic.Particle
// parent: 1
// pdg: 11
//
// ID: 3
// Entry type: proio.model.eic.Particle
// parent: 1
// pdg: -11
//
// ---------- TAG: MC ----------
// ID: 1
// Entry type: proio.model.eic.Particle
// child: 2
// child: 3
// pdg: 443
//
// ID: 2
// Entry type: proio.model.eic.Particle
// parent: 1
// pdg: 11
//
// ID: 3
// Entry type: proio.model.eic.Particle
// parent: 1
// pdg: -11
// ---------- TAG: Particle ----------
// ID: 1
// Entry type: proio.model.eic.Particle
// child: 2
// child: 3
// pdg: 443
// ID: 2
// Entry type: proio.model.eic.Particle
// parent: 1
// pdg: 11
// ID: 3
// Entry type: proio.model.eic.Particle
// parent: 1
// pdg: -11
// ---------- TAG: Primary ----------
// ID: 1
// Entry type: proio.model.eic.Particle
// child: 2
// child: 3
// pdg: 443
}