go-hep.org/x/hep@v0.38.1/groot/rpad/attcanvas.go (about) 1 // Copyright ©2023 The go-hep Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package rpad 6 7 import ( 8 "reflect" 9 10 "go-hep.org/x/hep/groot/rbytes" 11 "go-hep.org/x/hep/groot/root" 12 "go-hep.org/x/hep/groot/rtypes" 13 "go-hep.org/x/hep/groot/rvers" 14 ) 15 16 type AttCanvas struct { 17 fXBetween float32 // X distance between pads 18 fYBetween float32 // Y distance between pads 19 fTitleFromTop float32 // Y distance of Global Title from top 20 fXdate float32 // X position where to draw the date 21 fYdate float32 // X position where to draw the date 22 fAdate float32 // Alignment for the date 23 } 24 25 func (*AttCanvas) RVersion() int16 { 26 return rvers.AttCanvas 27 } 28 29 func (*AttCanvas) Class() string { 30 return "TAttCanvas" 31 } 32 33 func init() { 34 f := func() reflect.Value { 35 var v AttCanvas 36 return reflect.ValueOf(&v) 37 } 38 rtypes.Factory.Add("TAttCanvas", f) 39 } 40 41 // ROOTUnmarshaler is the interface implemented by an object that can 42 // unmarshal itself from a ROOT buffer 43 func (att *AttCanvas) UnmarshalROOT(r *rbytes.RBuffer) error { 44 if r.Err() != nil { 45 return r.Err() 46 } 47 48 hdr := r.ReadHeader(att.Class(), att.RVersion()) 49 50 att.fXBetween = r.ReadF32() 51 att.fYBetween = r.ReadF32() 52 att.fTitleFromTop = r.ReadF32() 53 att.fXdate = r.ReadF32() 54 att.fYdate = r.ReadF32() 55 att.fAdate = r.ReadF32() 56 57 r.CheckHeader(hdr) 58 return r.Err() 59 } 60 61 var ( 62 _ root.Object = (*AttCanvas)(nil) 63 _ rbytes.Unmarshaler = (*AttCanvas)(nil) 64 )