-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_print_test.go
82 lines (74 loc) · 1.62 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
package proio_test
import (
"fmt"
"github.com/proio-org/go-proio"
model "github.com/proio-org/go-proio-pb/model/example"
)
func Example_print() {
event := proio.NewEvent()
parent := &model.Particle{Pdg: 443}
parentID := event.AddEntry("Particle", parent)
event.TagEntry(parentID, "Truth", "Primary")
child1 := &model.Particle{Pdg: 11}
child2 := &model.Particle{Pdg: -11}
childIDs := event.AddEntries("Particle", child1, child2)
for _, id := range childIDs {
event.TagEntry(id, "Truth", "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.example.Particle
// parent: 1
// pdg: 11
//
// ID: 3
// Entry type: proio.model.example.Particle
// parent: 1
// pdg: -11
//
// ---------- TAG: Particle ----------
// ID: 1
// Entry type: proio.model.example.Particle
// child: 2
// child: 3
// pdg: 443
//
// ID: 2
// Entry type: proio.model.example.Particle
// parent: 1
// pdg: 11
//
// ID: 3
// Entry type: proio.model.example.Particle
// parent: 1
// pdg: -11
//
// ---------- TAG: Primary ----------
// ID: 1
// Entry type: proio.model.example.Particle
// child: 2
// child: 3
// pdg: 443
//
// ---------- TAG: Truth ----------
// ID: 1
// Entry type: proio.model.example.Particle
// child: 2
// child: 3
// pdg: 443
//
// ID: 2
// Entry type: proio.model.example.Particle
// parent: 1
// pdg: 11
//
// ID: 3
// Entry type: proio.model.example.Particle
// parent: 1
// pdg: -11
}