dif

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2020 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package dif holds functions to manipulate data from DIFs.

Index

Constants

View Source
const (
	MaxEventSize = (hardrocV2SLCFrameSize+1)*MaxNumASICs + (20*ASICMemDepth+2)*MaxNumASICs + 3 + MaxFwHeaderSize + 2 + MaxAnalogDataSize + 50

	MaxAnalogDataSize = 1024*64*2 + 20
	MaxFwHeaderSize   = 50
	MaxNumASICs       = 48  // max number of hardrocs per dif that the system can handle
	MaxNumDIFs        = 200 // max number of difs that the system can handle
	ASICMemDepth      = 128 // memory depth of one asic . 128 is for hardroc v1

)

Variables

This section is empty.

Functions

This section is empty.

Types

type DIF

type DIF struct {
	Header GlobalHeader
	Frames []Frame
}

DIF represents a detector interface.

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder reads and decodes DIF data from an input stream. Decoder computes the CRC-16 checksums on the fly, during the acquisition of DIF Frames.

func NewDecoder

func NewDecoder(difID uint8, r io.Reader) *Decoder

NewDecoder returns a new Decoder that reads from r.

func (*Decoder) Decode

func (dec *Decoder) Decode(dif *DIF) error

Decode reads the next DIF data from its input stream and stores it in the value pointed by dif.

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

Encoder writes DIF data to an output stream. Encoder computes the CRC-16 checksum on the fly and appends it at the end of the stream.

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

NewEncoder returns a new Encoder that writes to w.

func (*Encoder) Encode

func (enc *Encoder) Encode(dif *DIF) error

Encode writes the DIF data to the stream, computes the corresponding CRC-16 checksum on the fly and appends it to the stream.

type File

type File struct {
	Version uint8
	Headers []SCHeader
}

type Frame

type Frame struct {
	Header uint8 // Hardroc header
	BCID   uint32
	Data   [16]uint8
}
type GlobalHeader struct {
	ID        uint8
	DTC       uint32 // DIF trigger counter
	ATC       uint32 // Acquisition trigger counter
	GTC       uint32 // Global trigger counter
	AbsBCID   uint64 // Absolute BCID
	TimeDIFTC uint32 // Time DIF trigger counter
}

type Readout

type Readout struct {
	// contains filtered or unexported fields
}

Readout reads data out of a digital interface board (DIF).

func NewReadout

func NewReadout(name string, prodID uint32, msg log.MsgStream) (*Readout, error)

NewReadout creates a new DIF readout.

func (*Readout) Readout

func (rdo *Readout) Readout(p []byte) (int, error)

type SCHeader

type SCHeader struct {
	Timestamp uint32 // epoch
	DIFID     uint8
	NumHRs    uint8 // number of Hardrocs
	HRs       [][72]uint8
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL