Skip to content

Commit

Permalink
groot/rphys: make LorentzVector implement fmt.Stringer
Browse files Browse the repository at this point in the history
  • Loading branch information
sbinet committed Dec 16, 2021
1 parent 07e2951 commit 7851644
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions groot/rphys/lorentzvector.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package rphys

import (
"fmt"
"reflect"

"go-hep.org/x/hep/groot/rbase"
Expand Down Expand Up @@ -90,6 +91,14 @@ func (vec *LorentzVector) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

func (vec *LorentzVector) String() string {
return fmt.Sprintf(
"TLorentzVector{P: {%v, %v, %v}, E: %v}",
vec.p.x, vec.p.y, vec.p.z,
vec.e,
)
}

func init() {
{
f := func() reflect.Value {
Expand Down

0 comments on commit 7851644

Please sign in to comment.