galo

package module
v0.0.0-...-7829f91 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2019 License: GPL-3.0 Imports: 23 Imported by: 0

README

GoDoc Build Status

Utilities to inspect/play with Run2/3 Alice Muon Intermediate Data Formats.

For the moment it's really a WIP and should be taken "as is", with no guarantee whatsover.

Nevertheless, for the moment the galo executable provides mainly the cluster command.

> galo cluster

Various operations related to clusters

Usage:
  galo cluster [command]

Available Commands:
  convert     Convert cluster(s) from one format to another
  create      Generate clusters
  dump        Dump clusters
  plot        Plot clusters
  read        Just reads input file

Flags:
  -h, --help             help for cluster
  -m, --max-events int   Maximum number of events to process (default 100000000)

Use "galo cluster [command] --help" for more information about a command.

The convert command so far can only get from clusters in YAML format to clusters in HTML(SVG really) format.

The create command generate a cluster at given position within a detection element. Used to observe the charge distribution, and to feed known clusters to the clustering.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCannotAddNilObject     = errors.New("Cannot add a nil object")
	ErrCannotAddUnnamedObject = errors.New("Cannot add an unnamed object")
	ErrNonExistingObject      = errors.New("Non existing object")
)

Functions

func ChargeOverBox

func ChargeOverBox(x, y float64, integ ChargeIntegrator, bbox geo.BBox) float64

Integrate a unit charge originating from (x,y) over the surface given by (lowerLeft,topRight)

func ClusterLoop

func ClusterLoop(dec DEClustersDecoder, tcsel TaggedClusterSelector, firstEvent int, maxEvents int, worker func(index int, tc *TaggedClusters, selected []int)) (int, int)

func DEClusterResidual

func DEClusterResidual(declu *DEClusters, i int, declupos DEClusterPositioner) float64

func DumpClusters

func DumpClusters(index int, tc *TaggedClusters, selected []int)

func FillHistogramCollection

func FillHistogramCollection(tc *TaggedClusters, selected []int, hc *Collection, declupos DEClusterPositioner)

func Gaus

func Gaus(x, cst, mu, sigma float64) float64

func Landau

func Landau(x, mu, sigma float64) float64

func Levy

func Levy(x, mu, sigma float64) float64

func Moyal

func Moyal(x, cst, mu, sigma float64) float64

func PlotHistogramCollection

func PlotHistogramCollection(hc *Collection) []*hplot.Plot

func PlotResidual

func PlotResidual(h *hbook.H1D) *hplot.Plot

func SameCluster

func SameCluster(ca, cb Cluster) bool

SameCluster returns true if the two clusters : - have the same precluster - have close enough positions

func SameDigitLocation

func SameDigitLocation(da, db Digit) bool

SameDigitLocation returns true if the digits are the same pad

func SamePreCluster

func SamePreCluster(a, b PreCluster) bool

SamePreCluster returns true if both preclusters have : - the same digits - in the same order

func SaveFunction

func SaveFunction(outputFileName string)

func SavePlot

func SavePlot(p *hplot.Plot, outputFileName string, name string)

func ShareDigits

func ShareDigits(a, b PreCluster) bool

ShareDigits returns true if both precluster have at least one digit in common

Types

type ChargeIntegrator

type ChargeIntegrator interface {
	Integrate(x1, y1, x2, y2 float64) float64
}

ChargeIntegrator wraps the single Integrate method.

type ChargeSpreader

type ChargeSpreader interface {
	// SpreadCharge spreads the charge q originating at position (x,y)
	// over several digits that are returned
	SpreadCharge(q, x, y float64) []Digit
}

ChargeSpreader wraps the single SpreadCharge method.

type ClipScale

type ClipScale struct {
	Min  float64
	Max  float64
	Norm plot.Normalizer
}

func (ClipScale) Normalize

func (cs ClipScale) Normalize(min, max, x float64) float64

type ClipTicker

type ClipTicker struct {
	Min    float64
	Max    float64
	Ticker plot.Ticker
}

func (ClipTicker) Ticks

func (ct ClipTicker) Ticks(min, max float64) []plot.Tick

type Cluster

type Cluster struct {
	// Pre is the PreCluster this cluster originates from.
	Pre PreCluster
	// Pos is the cluster position.
	Pos ClusterPos
	// Q is the total charge of the cluster.
	Q ClusterCharge
}

Cluster represents a MCH cluster.

func (Cluster) String

func (clu Cluster) String() string

String gets a string representation of the cluster.

type ClusterCharge

type ClusterCharge float64

ClusterCharge represents the total charge of a cluster.

type ClusterCharger

type ClusterCharger interface {
	// Charge (re)computes the charge of the cluster.
	Charge(clu Cluster) float64
	// Name of the charger
	Name() string
}

ClusterCharger computes the position of a cluster.

type ClusterPos

type ClusterPos struct {
	X float64
	Y float64
}

ClusterPos represents the 2D position of a cluster. The position is relative to one detection element.

func (ClusterPos) String

func (pos ClusterPos) String() string

String gets a string representation of the position.

type Clusterizer

type Clusterizer interface {
	// Clusterize converts a precluster into one or several clusters.
	Clusterize(pre PreCluster) []Cluster
}

Clusterizer wraps the single Clusterizer method.

type Collection

type Collection struct {
	Name string
	// contains filtered or unexported fields
}

func CreateHistogramCollection

func CreateHistogramCollection() *Collection

func NewCollection

func NewCollection(name string) *Collection

func (*Collection) Add

func (ob *Collection) Add(h hbook.Object) error

func (*Collection) Get

func (ob *Collection) Get(hname string) (*hbook.Object, error)

func (*Collection) H1D

func (ob *Collection) H1D(hname string) (*hbook.H1D, error)

func (*Collection) H1Ds

func (ob *Collection) H1Ds() []*hbook.H1D

func (*Collection) H2D

func (ob *Collection) H2D(hname string) (*hbook.H2D, error)

func (*Collection) NObjects

func (ob *Collection) NObjects() int

func (*Collection) Print

func (ob *Collection) Print(out io.Writer)

type CounterCollection

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

func NewCounterCollection

func NewCounterCollection() *CounterCollection

func (*CounterCollection) Incr

func (cc *CounterCollection) Incr(label string)

func (*CounterCollection) String

func (cc *CounterCollection) String() string

type DEClusterPositioner

type DEClusterPositioner interface {
	// Position (re)computes the position of the cluster.
	Position(declu *DEClusters, i int) (x, y float64)
	// Name of the positioner.
	Name() string
}

DEClusterPositioner computes the 2D position of clusters

func NewDEClusterPositioner

func NewDEClusterPositioner(name string) DEClusterPositioner

type DEClusterPositionerCOG

type DEClusterPositionerCOG struct {
	Wmod WeightModel
}

func (DEClusterPositionerCOG) Name

func (clupos DEClusterPositionerCOG) Name() string

func (DEClusterPositionerCOG) Position

func (declupos DEClusterPositionerCOG) Position(declu *DEClusters, i int) (float64, float64)

type DEClusters

type DEClusters struct {
	// DeID is the detection element id of those clusters.
	DeID mapping.DEID
	// Clusters is the list of clusters of this group.
	Clusters []Cluster
}

DEClusters represents a group of clusters for one detection element.

func MockClustersFromDigitGroups

func MockClustersFromDigitGroups(deid mapping.DEID, positions []ClusterPos, charges []ClusterCharge, dgs []DigitGroup) DEClusters

type DEClustersDecoder

type DEClustersDecoder interface {
	// Decode reads the next DEClusters from its input and stores it
	// in the value pointed by clu.
	Decode(declu *DEClusters) error
	// Close may be necessary for those decoder implementations.
	Close()
}

DEClustersDecoder decodes DEClusters from an underlying stream.

type DEClustersEncoder

type DEClustersEncoder interface {
	// Encode writes the encoding of clu to the stream.
	Encode(declu *DEClusters) error
	// Close may be necessary for those decoder implementations to flush data.
	Close()
}

DEClustersDecoder encodes DEClusters onto the underlying stream.

type Digit

type Digit struct {
	ID      mapping.PadUID // digit id is the corresponding pad uid (relative to a detection element ID)
	Q       float64        //TODO: should take only 10 bits as the original ADC value
	Toffset byte           // time offset relative to the group ref time
}

func (Digit) String

func (d Digit) String() string

type DigitGroup

type DigitGroup struct {
	RefTime int // reference timestamp for the group digits
	Digits  []Digit
}

type Fitter

type Fitter struct {
	Integrator ChargeIntegrator
	Method     optimize.Method
}

Fitter implements DEClusterPositioner.

func (*Fitter) Name

func (f *Fitter) Name() string

func (*Fitter) Position

func (f *Fitter) Position(declu *DEClusters, i int) (x, y float64)

type IntegrateFunc

type IntegrateFunc func(x1, y1, x2, y2 float64) float64

IntegrateFunc functions implement ChargeIntegrator.

func (IntegrateFunc) Integrate

func (f IntegrateFunc) Integrate(x1, y1, x2, y2 float64) float64

type Plotter

type Plotter interface {
	MakePlots(msg string)
}

type PreCluster

type PreCluster struct {
	DigitGroup
}

func (PreCluster) Charge

func (pre PreCluster) Charge() float64

func (PreCluster) NofPads

func (pre PreCluster) NofPads() int

func (PreCluster) String

func (pre PreCluster) String() string

type TaggedClusterSelector

type TaggedClusterSelector interface {
	// Select decides if a cluster is to be kept or not.
	Select(tagclu *TaggedClusters, i int) bool
	// Name of the selector.
	Name() string
}

TaggedClusterSelector selects or discard a cluster from a tagged group based on some criteria.

func NewClusterSelector

func NewClusterSelector(selector string) TaggedClusterSelector

type TaggedClusterSelectorMult

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

func (TaggedClusterSelectorMult) Name

func (sel TaggedClusterSelectorMult) Name() string

func (TaggedClusterSelectorMult) Select

func (sel TaggedClusterSelectorMult) Select(tc *TaggedClusters, i int) bool

type TaggedClusterSelectorSplit

type TaggedClusterSelectorSplit struct{}

func (TaggedClusterSelectorSplit) Name

func (TaggedClusterSelectorSplit) Select

type TaggedClusterSelectorTrue

type TaggedClusterSelectorTrue struct{}

func (TaggedClusterSelectorTrue) Name

func (sel TaggedClusterSelectorTrue) Name() string

func (TaggedClusterSelectorTrue) Select

func (sel TaggedClusterSelectorTrue) Select(tc *TaggedClusters, i int) bool

type TaggedClusters

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

func GetTaggedClusters

func GetTaggedClusters(declu *DEClusters) *TaggedClusters

func (*TaggedClusters) Clusters

func (tc *TaggedClusters) Clusters() []Cluster

func (*TaggedClusters) IsDup

func (tc *TaggedClusters) IsDup(i int) bool

func (*TaggedClusters) IsSimple

func (tc *TaggedClusters) IsSimple(i int) bool

func (*TaggedClusters) IsSplit

func (tc *TaggedClusters) IsSplit(i int) bool

func (*TaggedClusters) Label

func (tc *TaggedClusters) Label(i int) string

func (*TaggedClusters) NDuplicates

func (tc *TaggedClusters) NDuplicates() int

func (*TaggedClusters) PrintSelected

func (tc *TaggedClusters) PrintSelected(w io.Writer, sel []int)

func (*TaggedClusters) String

func (tc *TaggedClusters) String() string

type WeightModel

type WeightModel int
const (
	NoWeight WeightModel = iota + 1
	RegularWeight
	SquaredWeight
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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