go-tucs: github.com/sbinet/go-tucs/tucs Index | Files | Directories

package tucs

import "github.com/sbinet/go-tucs/tucs"

An experimental re-write of TUCS (TileCal Unified Calibration Software) in Go.




Package Files

base.go calibbase.go doc.go event.go filter.go region.go tucs.go utils.go


var Runs = make(RunList, 0)

Runs is the global variable holding a RunList

func PathExists Uses

func PathExists(name string) bool

PathExists returns whether the given file or directory exists or not.

func SortRunList Uses

func SortRunList(runs []Run)

SortRunList sorts runs by run number

func SortRunListBy Uses

func SortRunListBy(runs []Run, fct func(i, j Run) bool)

SortRunListBy sorts runs by the provided function fct

type App Uses

type App struct {
    // contains filtered or unexported fields

func NewApp Uses

func NewApp(useMBTS, useSpecialEBmods bool) *App

NewApp creates a new tucs application

func (*App) AddWorker Uses

func (app *App) AddWorker(w ...Worker)

func (*App) Run Uses

func (app *App) Run() error

type Base Uses

type Base struct {
    HistFile croot.File
    // contains filtered or unexported fields

Base implements a basic tucs.Worker

func NewBase Uses

func NewBase(rtype RegionType) Base

NewBase creates a new Base worker ready for embedding

func (*Base) InitHistFile Uses

func (b *Base) InitHistFile(fname string) error

InitHistFile grabs the ROOT file 'fname' and makes it the current gDirectory

func (*Base) ProcessRegion Uses

func (b *Base) ProcessRegion(region *Region) error

func (*Base) ProcessStart Uses

func (b *Base) ProcessStart() error

func (*Base) ProcessStop Uses

func (b *Base) ProcessStop() error

func (*Base) RegionType Uses

func (b *Base) RegionType() RegionType

type CalibBase Uses

type CalibBase struct {
    // contains filtered or unexported fields

CalibBase is a generic calibration worker with a cache of ROOT files/trees

func NewCalibBase Uses

func NewCalibBase(rtype RegionType, workdir string) CalibBase

NewCalibBase creates a new CalibBase worker ready for embedding

func (*CalibBase) Dir Uses

func (w *CalibBase) Dir() string

func (*CalibBase) FileTree Uses

func (w *CalibBase) FileTree(file, tree string) (croot.File, croot.Tree)

type DataMap Uses

type DataMap map[string]interface{}

type Event Uses

type Event struct {
    Run  Run
    Data DataMap

type FilterCfg Uses

type FilterCfg struct {
    Runs           interface{} //[]string
    RunSet         string
    Region         string // fixme: use a const-type
    UseDateProg    bool
    Verbose        bool
    RunType        string  // fixme: use a const-type
    KeepOnlyActive bool    // only keep the active detector parts
    Filter         string  // requested laser filter. fixme: type-safety
    Amp            float64 // requested amperage
    GetLast        bool
    UpdateSpecial  bool
    AllowC10Errors bool   // allow errors for C10
    CsComment      string // cesium run/magnet description. fixme: type-safety
    TwoInput       bool   // whether CIS runs should be between 2 dates

FilterCfg is a helper struct to ease the configuration of NewFilter

type Region Uses

type Region struct {

    // the Type for any given region says if region is part of the
    // read-out electronics (partitions, modules, channels) or the physical
    // geometry (cells, towers).
    // In case of ambiguity, assume Readout.
    Type RegionType
    // contains filtered or unexported fields

Region is what a detector tree is made of.

Each region has various attributes: its parent(s), its child(ren), and any event object associated with it. One can also call the Hash method to get a unique location for this region in detector geometry tree.

func NewRegion Uses

func NewRegion(typ RegionType, name string, names ...string) *Region

NewRegion creates a new Region of type typ with primary name name

func TileCal Uses

func TileCal(useMBTS, useSpecialEBmods bool) *Region

func (*Region) AddEvent Uses

func (r *Region) AddEvent(evt Event)

func (*Region) Channels Uses

func (r *Region) Channels(useSpecialEBmods bool) []int

func (*Region) Children Uses

func (r *Region) Children(regtype RegionType) []*Region

func (*Region) Contains Uses

func (r *Region) Contains(rhs *Region) bool

func (*Region) CrackPartner Uses

func (r *Region) CrackPartner() string

CrackPartner returns the module name of the module partner with which that region shares the crack scintillator.

func (*Region) EtaPhi Uses

func (r *Region) EtaPhi() (eta, phi float64, err error)

func (*Region) Events Uses

func (r *Region) Events() []Event

func (*Region) Hash Uses

func (r *Region) Hash(nidx, pidx uint) string

func (*Region) IterRegions Uses

func (r *Region) IterRegions(t RegionType, fct RegionFct) error

func (*Region) MBTSName Uses

func (r *Region) MBTSName() string

MBTSName returns a stub name consistent with L1 trigger name

func (*Region) MBTSType Uses

func (r *Region) MBTSType() int

MBTSType checks if a module has MBTS connected to channel 0 and whether the crack scintillator is missing. It returns:

0 if no MBTS
1 if the MBTS is present but the crack missing
2 if the MBTS is present and the crack present

func (*Region) Name Uses

func (r *Region) Name(idx uint) string

func (*Region) Number Uses

func (r *Region) Number(nidx, pidx uint) []int

func (*Region) Parent Uses

func (r *Region) Parent(regtype RegionType, idx uint) *Region

func (*Region) Print Uses

func (r *Region) Print(out io.Writer, depth int, nidx, pidx uint, rtype RegionType)

Print dumps the tree structure of the Region into the out io.Writer If depth == -1, the whole tree is displayed

func (*Region) SanityCheck Uses

func (r *Region) SanityCheck() error

SanityCheck checks whether the internal state of this Region is consistent with all the other Regions it is in relation (parents and children) It returns a non-nil error in case of inconsistency

func (*Region) SetChildren Uses

func (r *Region) SetChildren(children []*Region)

func (*Region) SetParent Uses

func (r *Region) SetParent(parents ...*Region)

type RegionFct Uses

type RegionFct func(t RegionType, region *Region) error

RegionFct allows to apply an item of work on each sub-region of a given Region. See tucs.Region.IterRegion

type RegionType Uses

type RegionType uint
const (
    Readout RegionType = iota

func (RegionType) String Uses

func (rt RegionType) String() string

type Run Uses

type Run struct {
    Type   string
    Number int64
    Time   time.Time
    Data   DataMap

func (*Run) String Uses

func (r *Run) String() string

type RunList Uses

type RunList []Run

RunList is a slice of Runs with some more refinements

func (*RunList) Remove Uses

func (r *RunList) Remove(run Run)

Remove removes a given Run from this RunList. Note it only checks the run number for the equality comparison.

func (RunList) RunsOfType Uses

func (r RunList) RunsOfType(rtype string) []Run

RunsOfType returns a slice of Runs from this RunList with the correct run_type

type Worker Uses

type Worker interface {
    ProcessStart() error
    ProcessStop() error
    ProcessRegion(region *Region) error

    RegionType() RegionType

func NewFilter Uses

func NewFilter(rtype RegionType, cfg FilterCfg) Worker

NewFilter creates a new filterWorker



Package tucs imports 13 packages (graph) and is imported by 3 packages. Updated 2016-07-21. Refresh now. Tools for package owners.