This commit is contained in:
suter_a 2012-03-22 08:58:00 +00:00
parent 68af10d160
commit 6fcc0b25e5
12 changed files with 0 additions and 3861 deletions

View File

@ -1,105 +0,0 @@
#---------------------------------------------------
# Makefile
#
# Author: Andreas Suter
# e-mail: andreas.suter@psi.ch
#
# $Id: Makefile 5052 2012-01-12 09:55:19Z suter_a $
#
#---------------------------------------------------
#---------------------------------------------------
# get compilation and library flags from root-config
ROOTCFLAGS = $(shell $(ROOTSYS)/bin/root-config --cflags)
ROOTLIBS = $(shell $(ROOTSYS)/bin/root-config --libs)
ROOTGLIBS = $(shell $(ROOTSYS)/bin/root-config --glibs)
#---------------------------------------------------
# depending on the architecture, choose the compiler,
# linker, and the flags to use
#
OSTYPE = $(shell uname)
ifeq ($(OSTYPE),Linux)
OS = LINUX
endif
ifeq ($(OSTYPE),Linux-gnu)
OS = LINUX
endif
ifeq ($(OSTYPE),darwin)
OS = DARWIN
endif
# -- Linux
ifeq ($(OS),LINUX)
CXX = g++
CXXFLAGS = -g -Wall -Wno-trigraphs -fPIC
INCLUDES = -I./
LD = g++
LDFLAGS = -g
SOFLAGS = -O -shared
endif
# -- Darwin
ifeq ($(OS),DARWIN)
CXX = g++
CXXFLAGS = -g -Wall -Wno-trigraphs -fPIC
INCLUDES = -I../include
LD = g++
LDFLAGS = -g
SOFLAGS = -dynamic
endif
# the output from the root-config script:
CXXFLAGS += $(ROOTCFLAGS)
LDFLAGS +=
# the ROOT libraries (G = graphic)
LIBS = $(ROOTLIBS) -lXMLParser
GLIBS = $(ROOTGLIBS) -lXMLParser
# PSI libs
PSILIBS = -lTMusrRunHeader
EXEC =
EXEC += musrRoot_runHeader_test
EXEC += write_musrRoot_runHeader
EXEC += read_musrRoot_runHeader
# some definitions: headers (used to generate *Dict* stuff), sources, objects,...
OBJS =
OBJS += musrRoot_runHeader_test.o
OBJS += write_musrRoot_runHeader.o
OBJS += read_musrRoot_runHeader.o
# make the executable:
#
all: $(EXEC)
musrRoot_runHeader_test: musrRoot_runHeader_test.o
@echo "---> Building musrRoot_runHeader_test ..."
$(LD) musrRoot_runHeader_test.o -o musrRoot_runHeader_test $(GLIBS) $(PSILIBS)
@echo "done"
write_musrRoot_runHeader: write_musrRoot_runHeader.o
@echo "---> Building write_musrRoot_runHeader ..."
$(LD) write_musrRoot_runHeader.o -o write_musrRoot_runHeader $(GLIBS) $(PSILIBS)
@echo "done"
read_musrRoot_runHeader: read_musrRoot_runHeader.o
@echo "---> Building read_musrRoot_runHeader ..."
$(LD) read_musrRoot_runHeader.o -o read_musrRoot_runHeader $(GLIBS) $(PSILIBS)
@echo "done"
# clean up: remove all object file (and core files)
# semicolon needed to tell make there is no source
# for this target!
#
clean:; @rm -f $(OBJS) *Dict* core*
@echo "---> removing $(OBJS)"
#
$(OBJS): %.o: %.cpp
$(CXX) $(INCLUDES) $(CXXFLAGS) -c $<

View File

@ -1,131 +0,0 @@
# Makefile for TMusrRunHeader
#
# Copyright (c) 2000 Rene Brun and Fons Rademakers
#
# Author: Fons Rademakers, 29/2/2000
#
# modified: Andreas Suter, 12/01/2012
#
# $Id$
#
include Makefile.arch
#------------------------------------------------------------------------------
# TMusrRunHeader
TNAME = TMusrRunHeader
TLRHO = $(TNAME).$(ObjSuf) $(TNAME)Dict.$(ObjSuf)
TLRHS = $(TNAME).$(SrcSuf) $(TNAME)Dict.$(SrcSuf)
TLRHSO = lib$(TNAME).$(DllSuf)
ifeq ($(ARCH),win32)
TLRHLIB = lib$(TNAME).lib
else
TLRHLIB = $(TLRHSO)
endif
OBJS = $(TLRHO)
# my one stuff
ifeq ($(ARCH),macosx)
CXXFLAGS += -I./ -I/usr/local/include
else
CXXFLAGS += -I./ -I/usr/local/include
endif
MYINCLUDES += ./
MYLIBS += ./
#------------------------------------------------------------------------------
.SUFFIXES: .$(SrcSuf) .$(ObjSuf) .$(DllSuf)
#TLRH
$(TLRHSO): $(TLRHO)
ifeq ($(ARCH),aix)
/usr/ibmcxx/bin/makeC++SharedLib $(OutPutOpt) $@ $(LIBS) -p 0 $^
else
ifeq ($(ARCH),aix5)
/usr/vacpp/bin/makeC++SharedLib $(OutPutOpt) $@ $(LIBS) -p 0 $^
else
ifeq ($(ARCH),macosx)
# We need to make both the .dylib and the .so
# SOFLAGS = -dynamiclib -flat_namespace -undefined suppress
#
$(LD) $(SOFLAGS) $(EVENTO) $(EVENTSO) $^
$(LD) -bundle -undefined suppress -Wl,-x $(LDFLAGS) $^ \
$(OutPutOpt) $(subst .$(DllSuf),.so,$@) $(EXPLLINKLIBS)
else
ifeq ($(ARCH),win32)
bindexplib $* $^ > $*.def
lib -nologo -MACHINE:IX86 $^ -def:$*.def \
$(OutPutOpt)$(EVENTLIB)
$(LD) $(SOFLAGS) $(LDFLAGS) $^ $*.exp $(LIBS) \
$(OutPutOpt)$@
else
$(LD) $(SOFLAGS) $(LDFLAGS) $^ $(OutPutOpt) $(MYLIBS)/$@ $(EXPLLINKLIBS)
endif
endif
endif
endif
@echo
@echo "$@ done $(TNAME)"
clean:
@rm -f $(OBJS) core
@rm -f *Dict*
@rm -f *.*~
distclean: clean
@rm -f $(PROGRAMS) $(EVENTSO) $(EVENTLIB) *Dict.* *.def *.exp \
*.root *.ps *.so *.lib *.dll *.d .def so_locations
@rm -rf cxx_repository
-@cd RootShower && $(MAKE) distclean
install: $(TLRHS) $(TLRHSO)
ifeq ($(ARCH),linux)
cp -pv $(MYLIBS)/$(TLRHSO) $(ROOTSYS)/lib
cp -pv $(MYINCLUDES)/$(TNAME).h $(ROOTSYS)/include
endif
ifeq ($(ARCH),linuxx8664gcc)
cp -pv $(MYLIBS)/$(TLRHSO) $(ROOTSYS)/lib
cp -pv $(MYINCLUDES)/$(TNAME).h $(ROOTSYS)/include
endif
ifeq ($(ARCH),win32gcc)
cp -pv $(MYLIBS)/$(TLRHSO) $(ROOTSYS)/bin
ln -sf $(ROOTSYS)/bin/$(TLRHSO) $(ROOTSYS)/lib/$(TLRHSO)
cp -pv $(MYINCLUDES)/$(TNAME).h $(ROOTSYS)/include
endif
uninstall:
ifeq ($(ARCH),linux)
rm $(ROOTSYS)/lib/$(TLRHSO)
rm $(ROOTSYS)/include/$(TNAME).h
endif
ifeq ($(ARCH),linuxx8664gcc)
rm $(ROOTSYS)/lib/$(TLRHSO)
rm $(ROOTSYS)/include/$(TNAME).h
endif
ifeq ($(ARCH),win32gcc)
rm $(ROOTSYS)/lib/$(TLRHSO)
rm $(ROOTSYS)/include/$(TNAME).h
endif
.SUFFIXES: .$(SrcSuf)
###
#TLRH
$(TNAME).$(ObjSuf): $(MYINCLUDES)/$(TNAME).h
$(TNAME)Dict.$(SrcSuf): $(MYINCLUDES)/$(TNAME).h $(MYINCLUDES)/$(TNAME)LinkDef.h
@echo "Generating dictionary $@..."
rootcint -f $@ -c -p $^
.$(SrcSuf).$(ObjSuf):
@echo "Generating object file $@..."
$(CXX) $(CXXFLAGS) -c $<

View File

@ -1,510 +0,0 @@
# -*- mode: makefile -*-
#
# Makefile containing platform dependencies for ROOT based projects.
#
# Copyright (c) 2000 Rene Brun and Fons Rademakers
#
# Author: Fons Rademakers, 29/2/2000
ARCH := $(shell root-config --arch)
CXX =
ObjSuf = o
SrcSuf = cpp
ExeSuf =
DllSuf = so
OutPutOpt = -o # keep whitespace after "-o"
ROOTCFLAGS := $(shell root-config --cflags)
ROOTLIBS := $(shell root-config --libs)
ROOTGLIBS := $(shell root-config --glibs)
ifeq ($(ARCH),hpux)
# HP-UX with CC
CXX = CC
CXXFLAGS = -O +Z
LD = CC
LDFLAGS = -O +a1 -z
SOFLAGS = -b
DllSuf = sl
endif
ifeq ($(ARCH),hpuxacc)
# HP-UX 10.x with aCC
CXX = aCC
CXXFLAGS = -O +Z
LD = aCC
LDFLAGS = -O -z
SOFLAGS = -b
endif
ifeq ($(ARCH),hpuxia64acc)
# HP-UX 11i 1.5 (IA-64) with aCC
CXX = aCC
CXXFLAGS = +DD64 -O +Z
LD = aCC
LDFLAGS = +DD64 -O -z
SOFLAGS = -b
endif
ifeq ($(ARCH),hpuxegcs)
# HP-UX 10.x with g++
CXXFLAGS = -O -fPIC
CXX = g++
LD = g++
LDFLAGS = -O
SOFLAGS = -fPIC -shared
endif
ifeq ($(ARCH),hurddeb)
# GNU/Hurd
CXX = g++
CXXFLAGS = -O -Wall -fPIC
LD = g++
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),aix)
# IBM AIX xlC 4.x
CXX = xlC
CXXFLAGS = -O
LD = xlC
LDFLAGS = -O
SOFLAGS =
ROOTLIBS := $(shell root-config --nonew --libs)
ROOTGLIBS := $(shell root-config --nonew --glibs)
endif
ifeq ($(ARCH),aix5)
# IBM AIX xlC 5.x
CXX = xlC
CXXFLAGS = -O
LD = xlC
LDFLAGS = -O
SOFLAGS =
ROOTLIBS := $(shell root-config --nonew --libs)
ROOTGLIBS := $(shell root-config --nonew --glibs)
endif
ifeq ($(ARCH),aixegcs)
# IBM AIX with GCC
CXX = g++
CXXFLAGS = -O
LD = g++
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),solaris)
# Solaris CC
CXX = /opt/SUNWspro/bin/CC
CXXFLAGS = -O -KPIC
LD = /opt/SUNWspro/bin/CC
LDFLAGS = -O
SOFLAGS = -G
endif
ifeq ($(ARCH),solarisCC5)
# Solaris CC 5.0
CXX = CC
CXXFLAGS = -O -KPIC
LD = CC
LDFLAGS = -O
SOFLAGS = -G
endif
ifeq ($(ARCH),solarisegcs)
# Solaris egcs
CXX = g++
CXXFLAGS = -O -fPIC
LD = CC
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),solarisgcc)
# Solaris gcc
CXX = g++
CXXFLAGS = -O -fPIC
LD = g++
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),solariskcc)
# Solaris kcc
CXX = KCC --one_instantiation_per_object
CXXFLAGS = -O4 -KPIC
LD = KCC
LDFLAGS = -O4
SOFLAGS =
endif
ifeq ($(ARCH),solarisx86)
# Solaris CC on Intel
CXX = CC
CXXFLAGS = -O -KPIC
LD = CC
LDFLAGS = -O
SOFLAGS = -G
endif
ifeq ($(ARCH),sgicc)
# SGI
CXX = CC -n32 -I/usr/include/CC.sgi
CXXFLAGS = -O
LD = CC -n32 -LANG:std -I/usr/include/CC.sgi
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),sgicc64)
# SGI
CXX = CC -64 -I/usr/include/CC.sgi
CXXFLAGS = -O
LD = CC -64 -LANG:std -I/usr/include/CC.sgi
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),sgiegcs)
# SGI 6.x with EGCS
CXX = g++
CXXFLAGS = -O -Wall -fPIC
LD = g++
LDFLAGS = -O -Wl,-u,__builtin_new -Wl,-u,__builtin_delete -Wl,-u,__nw__FUiPv
SOFLAGS = -shared
endif
ifeq ($(ARCH),sgin32egcs)
# SGI 6.x with EGCS for n32 ABI
CXX = g++
CXXFLAGS = -O -Wall -fPIC
LD = g++
LDFLAGS = -O -L/usr/lib32 -Wl,-woff,134
SOFLAGS = -shared
endif
ifeq ($(ARCH),sgigcc)
# SGI with GCC
CXX = g++
CXXFLAGS = -O -Wall -fPIC
LD = g++
LDFLAGS = -O -Wl,-u,__builtin_new -Wl,-u,__builtin_delete -Wl,-u,__nw__FUiPv
SOFLAGS = -shared
endif
ifeq ($(ARCH),sgikcc)
# SGI with KCC
CXX = KCC -n32 --one_instantiation_per_object
CXXFLAGS = -O
LD = KCC -n32
LDFLAGS = -O
SOFLAGS =
endif
ifeq ($(ARCH),alphagcc)
# Alpha/OSF with g++
CXX = g++
CXXFLAGS = -O -Wall -fPIC
LD = g++
LDFLAGS = -O
SOFLAGS = -Wl,-expect_unresolved,* -shared
endif
ifeq ($(ARCH),alphaegcs)
# Alpha/OSF with egcs
CXX = g++
CXXFLAGS = -O -Wall -fPIC
LD = g++
LDFLAGS = -O
SOFLAGS = -Wl,-expect_unresolved,* -shared
endif
ifeq ($(ARCH),alphakcc)
# Alpha/OSF with kai compiler (not yet valid)
CXX = KCC --one_instantiation_per_object
CXXFLAGS = -O -fPIC
LD = KCC
LDFLAGS = -O
SOFLAGS = -Wl,-expect_unresolved,* -shared
endif
ifeq ($(ARCH),alphacxx6)
# Alpha/OSF with cxx6
CXX = cxx
CXXFLAGS = -O
LD = cxx
LDFLAGS = -O
SOFLAGS = -shared -nocxxstd -Wl,-expect_unresolved,*,-msym
endif
ifeq ($(ARCH),alphacxx)
# Alpha/OSF with cxx5
CXX = cxx
CXXFLAGS = -O
LD = cxx
LDFLAGS = -O
SOFLAGS = -Wl,-expect_unresolved,* -call_shared
endif
ifeq ($(ARCH),linuxrh51)
# Linux with gcc 2.7.2.x
CXX = g++
CXXFLAGS = -O -Wall -fPIC
LD = g++
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxrh42)
# Linux with gcc 2.7.2.x (RedHat 4.2)
CXX = g++
CXXFLAGS = -O -Wall -fPIC
LD = g++
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxdeb)
# Linux with gcc 2.7.2.x
CXX = g++
CXXFLAGS = -O -Wall -fPIC
LD = g++
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxdeb2)
# Linux with gcc 2.7.2.x
CXX = g++
CXXFLAGS = -O -Wall -fPIC
LD = g++
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxdeb2ppc)
# Debian/Linux on the PowerPC
CXX = g++
CXXFLAGS = -O -Wall -fPIC
LD = g++
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxsuse6)
# Linux with gcc 2.7.2.x
CXX = g++
CXXFLAGS = -O -Wall -fPIC
LD = g++
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),linux)
# Linux with egcs, gcc 2.9x, gcc 3.x (>= RedHat 5.2)
CXX = g++
CXXFLAGS = -O -Wall -fPIC
LD = g++
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxkcc)
# Linux with the KAI compiler
CXX = KCC --one_instantiation_per_object
CXXFLAGS = -fPIC +K0
LD = KCC
LDFLAGS = -O $(shell root-config --cflags)
SOFLAGS =
endif
ifeq ($(ARCH),linuxicc)
# Linux with Intel icc compiler
CXX = icc
CXXFLAGS = -O
LD = icc
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxppcegcs)
# MkLinux with egcs/glibc
CXX = g++
CXXFLAGS = -O -Wall -fPIC
LD = g++
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxia64gcc)
# Itanium Linux with gcc 2.9x
CXX = g++
CXXFLAGS = -O -Wall -fPIC
LD = g++
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxia64sgi)
# Itanium Linux with sgiCC
CXX = sgiCC
CXXFLAGS = -O -Wall -fPIC
LD = gsgiCC
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxia64ecc)
# Itanium Linux with Intel icc (was ecc)
ICC_MAJOR := $(shell ecc -quiet -V 2>&1 | awk '{ if (NR==2) print $$2 }' | \
cut -d'.' -f1)
ICC_MINOR := $(shell ecc -quiet -V 2>&1 | awk '{ if (NR==2) print $$2 }' | \
cut -d'.' -f2 | cut -d',' -f1)
ifeq ($(ICC_MAJOR),8)
ICC = icc
IFORT = ifort
else
ICC = ecc
IFORT = efc
endif
CXX = $(ICC)
CXXFLAGS = -O -fPIC
LD = $(ICC)
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxx8664gcc)
# AMD Opteron (64 bit mode) Linux with gcc 3.x
CXX = g++
CXXFLAGS = -O -Wall -fPIC
LD = g++
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxalphaegcs)
# Alpha Linux with egcs
CXX = g++
CXXFLAGS = -O -Wall -fPIC
LD = g++
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),linuxarm)
# ARM Linux with egcs
CXX = g++
CXXFLAGS = -O -Wall -fPIC
LD = g++
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),mklinux)
# MkLinux with libc5
CXX = g++
CXXFLAGS = -O -Wall -fPIC
LD = g++
LDFLAGS = -O
SOFLAGS = -shared
endif
ifeq ($(ARCH),freebsd)
# FreeBSD with libc5
CXX = g++
CXXFLAGS = -O -pipe -W -Wall -fPIC
LD = g++
LDFLAGS = -O
SOFLAGS = -shared -Wl,-x
endif
ifeq ($(ARCH),freebsd4)
# FreeBSD with glibc
CXX = g++
CXXFLAGS = -O -pipe -W -Wall -fPIC
LD = g++
LDFLAGS = -O
SOFLAGS = -shared -Wl,-x
endif
ifeq ($(ARCH),macosx)
# MacOS X with cc (GNU cc 2.95.2)
CXX = g++
CXXFLAGS = -O -pipe -Wall -W -Woverloaded-virtual
LD = g++
LDFLAGS = -O -Xlinker -bind_at_load -flat_namespace
# The SOFLAGS will be used to create the .dylib; the .so will
# be created separately
DllSuf = dylib
SOFLAGS = -dynamiclib -flat_namespace -undefined suppress
endif
ifeq ($(ARCH),macosxxlc)
# MacOS X with IBM xlC compiler
CXX = xlC
CXXFLAGS =
LD = g++
LDFLAGS = -O -Xlinker -bind_at_load -flat_namespace
# The SOFLAGS will be used to create the .dylib; the .so will
# be created separately
DllSuf = dylib
SOFLAGS = -dynamiclib -flat_namespace -undefined suppress
endif
ifeq ($(ARCH),hiux)
# Hitachi HIUX
CXX = g++
CXXFLAGS = -O2 -fPIC
LD = g++
LDFLAGS = -Wl,+s
SOFLAGS = -Wl,-b,-E -nostdlib -nostartfiles
DllSuf = sl
endif
ifeq ($(ARCH),win32)
# Windows with the VC++ compiler
ObjSuf = obj
SrcSuf = cxx
ExeSuf = .exe
DllSuf = dll
OutPutOpt = -out:
CXX = cl
CXXOPT = -O2
#CXXOPT = -Z7
CXXFLAGS = $(CXXOPT) -G5 -GR -GX -MD -DWIN32 -D_WINDOWS -nologo \
-DVISUAL_CPLUSPLUS -D_X86_=1 -D_DLL
LD = link
LDOPT = -opt:ref
#LDOPT = -debug
LDFLAGS = $(LDOPT) -pdb:none -nologo
SOFLAGS = -DLL
ROOTLIBS := $(shell root-config --nonew --libs)
ROOTGLIBS := $(shell root-config --nonew --glibs)
EXPLLINKLIBS = $(ROOTLIBS) $(ROOTGLIBS)
endif
ifeq ($(ARCH),win32gcc)
# Windows with gcc
DllSuf = dll
ExeSuf = .exe
CXX = g++
CXXFLAGS = -O -Wall -Woverloaded-virtual -I/usr/X11R6/include
LD = g++
LDFLAGS = -O -Wl,--enable-auto-import
SOFLAGS = -shared -D_DLL -Wl,--export-all-symbols
EXPLLINKLIBS = $(ROOTLIBS) $(ROOTGLIBS)
endif
ifeq ($(CXX),)
$(error $(ARCH) invalid architecture)
endif
CXXFLAGS += $(ROOTCFLAGS)
LIBS = $(ROOTLIBS) $(SYSLIBS)
GLIBS = $(ROOTGLIBS) $(SYSLIBS)

View File

@ -1,195 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:documentation>
This XSD document describes the muSR file structure for CERN/ROOT based files.
In the following it will be called MusrRoot.
It is currently the default standard for writting muSR data files at the
Paul Scherrer Institute.
Author: Andreas Suter, andreas.suter@psi.ch
$Id$
</xs:documentation>
</xs:annotation>
<xs:element name="MusrRoot" type="musrRoot"/>
<xs:complexType name="musrRoot">
<xs:sequence>
<xs:element ref="histos"/>
<xs:element name="RunHeader" type="runHeaderFolder"/>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
</xs:sequence>
</xs:complexType>
<xs:element name="histos">
<xs:annotation>
<xs:documentation>
The histos folder is containing potentially various subfolders.
At least two subfolders, called DecayAnaModule, and SlowControlAnaModule,
which holds the muSR decay histograms, must be present.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="DecayAnaModule" type="decayHistoData"/>
<xs:element name="SCAnaModule" type="slowControlHistoData"/>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="decayHistoData">
<xs:sequence>
<xs:element name="DecayHistoEntry" type="decayHistoEntry" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="decayHistoEntry">
<xs:sequence>
<xs:element name="HistoName" type="histoName"/>
<xs:element name="HistoType" type="histoType"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="histoName">
<xs:restriction base="xs:string">
<xs:pattern value="hDecay([0-9]){3,}"/> <!-- this means hDecayXXX, where XXX are 3 digits -->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="histoType">
<xs:restriction base="xs:string">
<xs:pattern value="TH1F"></xs:pattern>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="slowControlHistoData">
<xs:sequence>
<xs:element name="SlowControlHistoEntry" type="slowControlHistoEntry" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="slowControlHistoEntry">
<xs:sequence>
<xs:element name="SlowControlName" type="xs:string"/>
<xs:element name="SlowControlType" type="slowControlType"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="slowControlType">
<xs:restriction base="xs:string">
<xs:pattern value="TH1F"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="runHeaderFolder">
<xs:sequence>
<xs:element name="RunInfo" type="runInfo"/>
<xs:element name="DetectorInfo" type="detectorInfo"/>
<xs:element name="SampleEnvironmentInfo" type="sampleEnvironmentInfo"/>
<xs:element name="MagneticFieldEnvironmentInfo" type="magneticFieldEnvironmentInfo"/>
<xs:element name="BeamlineInfo" type="beamlineInfo"/>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
</xs:sequence>
</xs:complexType>
<xs:complexType name="runInfo">
<xs:sequence>
<xs:element name="Version" type="TString"/>
<xs:element name="Generic_Validator_URL" type="TString"/>
<xs:element name="Specific_Validator_URL" type="TString"/>
<xs:element name="Generator" type="TString"/>
<xs:element name="File_Name" type="TString"/>
<xs:element name="Run_Title" type="TString"/>
<xs:element name="Run_Number" type="Int_t"/>
<xs:element name="Run_Start_Time" type="TString"/>
<xs:element name="Run_Stop_Time" type="TString"/>
<xs:element name="Run_Duration" type="TMusrRunPhysicalQuantity"/>
<xs:element name="Laboratory" type="TString"/>
<xs:element name="Instrument" type="TString"/>
<xs:element name="Muon_Beam_Momentum" type="TMusrRunPhysicalQuantity"/>
<xs:element name="Muon_Species" type="TString"/>
<xs:element name="Muon_Source" type="TString"/>
<xs:element name="Setup" type="TString"/>
<xs:element name="Comment" type="TString"/>
<xs:element name="Sample_Name" type="TString"/>
<xs:element name="Sample_Temperature" type="TMusrRunPhysicalQuantity"/>
<xs:element name="Sample_Magnetic_Field" type="TMusrRunPhysicalQuantity"/>
<xs:element name="No_of_Histos" type="Int_t"/>
<xs:element name="Time_Resolution" type="TMusrRunPhysicalQuantity"/>
<xs:element name="RedGreen_Offsets" type="TIntVector"/>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
</xs:sequence>
</xs:complexType>
<xs:simpleType name="Int_t">
<xs:restriction base="xs:string">
<xs:pattern value="Int_t"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Double_t">
<xs:restriction base="xs:string">
<xs:pattern value="Double_t"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TString">
<xs:restriction base="xs:string">
<xs:pattern value="TString"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TMusrRunPhysicalQuantity">
<xs:restriction base="xs:string">
<xs:pattern value="TMusrRunPhysicalQuantity"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TIntVector">
<xs:restriction base="xs:string">
<xs:pattern value="TIntVector"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="sampleEnvironmentInfo">
<xs:sequence>
<xs:element name="Cryo" type="TString"/>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
</xs:sequence>
</xs:complexType>
<xs:complexType name="magneticFieldEnvironmentInfo">
<xs:sequence>
<xs:element name="Magnet_Name" type="TString"/>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
</xs:sequence>
</xs:complexType>
<xs:complexType name="detectorInfo">
<xs:sequence>
<xs:element name="Detector" type="detector" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="detector">
<xs:sequence>
<xs:element name="Name" type="TString"/>
<xs:element name="Histo_Number" type="Int_t"/>
<xs:element name="Histo_Length" type="Int_t"/>
<xs:element name="Time_Zero_Bin" type="Double_t"/>
<xs:element name="First_Good_Bin" type="Int_t"/>
<xs:element name="Last_Good_Bin" type="Int_t"/>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
</xs:sequence>
</xs:complexType>
<xs:complexType name="beamlineInfo">
<xs:sequence>
<xs:element name="Name" type="TString"/>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
</xs:sequence>
</xs:complexType>
</xs:schema>

View File

@ -1,221 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:documentation>
This XSD document describes the muSR file structure of CERN/ROOT based files for LEM.
In the following it will be called MusrRootLEM.
It is an extension of MusrRoot.xsd and describes the additional LEM specific entries.
Author: Andreas Suter, andreas.suter@psi.ch
$Id$
</xs:documentation>
</xs:annotation>
<xs:element name="MusrRoot" type="musrRoot"/>
<xs:complexType name="musrRoot">
<xs:sequence>
<xs:element ref="histos"/>
<xs:element name="RunHeader" type="runHeaderFolder"/>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
</xs:sequence>
</xs:complexType>
<xs:element name="histos">
<xs:annotation>
<xs:documentation>
The histos folder is containing potentially various subfolders.
At least two subfolders, called DecayAnaModule, and SlowControlAnaModule,
which holds the muSR decay histograms, must be present.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="DecayAnaModule" type="decayHistoData"/>
<xs:element name="SCAnaModule" type="slowControlHistoData"/>
<xs:element name="TOFAnaModule" type="histoData"/>
<xs:element name="PileUpAnaModule" type="histoData"/>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="decayHistoData">
<xs:sequence>
<xs:element name="DecayHistoEntry" type="decayHistoEntry" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="decayHistoEntry">
<xs:sequence>
<xs:element name="HistoName" type="histoName"/>
<xs:element name="HistoType" type="histoType"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="histoName">
<xs:restriction base="xs:string">
<xs:pattern value="hDecay([0-9]){3,}"/> <!-- this means hDecayXXX, where XXX are 3 digits or more -->
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="histoType">
<xs:restriction base="xs:string">
<xs:pattern value="TH1F"></xs:pattern>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="slowControlHistoData">
<xs:sequence>
<xs:element name="SlowControlHistoEntry" type="slowControlHistoEntry" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="slowControlHistoEntry">
<xs:sequence>
<xs:element name="SlowControlName" type="xs:string"/>
<xs:element name="SlowControlType" type="slowControlType"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="slowControlType">
<xs:restriction base="xs:string">
<xs:pattern value="TH1F"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="runHeaderFolder">
<xs:sequence>
<xs:element name="RunInfo" type="runInfo"/>
<xs:element name="DetectorInfo" type="detectorInfo"/>
<xs:element name="SampleEnvironmentInfo" type="sampleEnvironmentInfo"/>
<xs:element name="MagneticFieldEnvironmentInfo" type="magneticFieldEnvironmentInfo"/>
<xs:element name="BeamlineInfo" type="beamlineInfo"/>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
</xs:sequence>
</xs:complexType>
<xs:complexType name="runInfo">
<xs:sequence>
<xs:element name="Version" type="TString"/>
<xs:element name="Generic_Validator_URL" type="TString"/>
<xs:element name="Specific_Validator_URL" type="TString"/>
<xs:element name="Generator" type="TString"/>
<xs:element name="File_Name" type="TString"/>
<xs:element name="Run_Title" type="TString"/>
<xs:element name="Run_Number" type="Int_t"/>
<xs:element name="Run_Start_Time" type="TString"/>
<xs:element name="Run_Stop_Time" type="TString"/>
<xs:element name="Run_Duration" type="TMusrRunPhysicalQuantity"/>
<xs:element name="Laboratory" type="TString"/>
<xs:element name="Instrument" type="TString"/>
<xs:element name="Muon_Beam_Momentum" type="TMusrRunPhysicalQuantity"/>
<xs:element name="Muon_Species" type="TString"/>
<xs:element name="Muon_Source" type="TString"/>
<xs:element name="Setup" type="TString"/>
<xs:element name="Comment" type="TString"/>
<xs:element name="Sample_Name" type="TString"/>
<xs:element name="Sample_Temperature" type="TMusrRunPhysicalQuantity"/>
<xs:element name="Sample_Magnetic_Field" type="TMusrRunPhysicalQuantity"/>
<xs:element name="No_of_Histos" type="Int_t"/>
<xs:element name="Time_Resolution" type="TMusrRunPhysicalQuantity"/>
<xs:element name="RedGreen_Offsets" type="TIntVector"/>
<xs:element name="Moderator" type="TString"/>
<xs:element name="Moderator_HV" type="TMusrRunPhysicalQuantity"/>
<xs:element name="Sample_HV" type="TMusrRunPhysicalQuantity"/>
<xs:element name="Implantation_Energy" type="TMusrRunPhysicalQuantity"/>
<xs:element name="Cuts" type="TString"/>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
</xs:sequence>
</xs:complexType>
<xs:simpleType name="Int_t">
<xs:restriction base="xs:string">
<xs:pattern value="Int_t"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Double_t">
<xs:restriction base="xs:string">
<xs:pattern value="Double_t"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TString">
<xs:restriction base="xs:string">
<xs:pattern value="TString"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TMusrRunPhysicalQuantity">
<xs:restriction base="xs:string">
<xs:pattern value="TMusrRunPhysicalQuantity"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="TIntVector">
<xs:restriction base="xs:string">
<xs:pattern value="TIntVector"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="sampleEnvironmentInfo">
<xs:sequence>
<xs:element name="Cryo" type="TString"/>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
</xs:sequence>
</xs:complexType>
<xs:complexType name="magneticFieldEnvironmentInfo">
<xs:sequence>
<xs:element name="Magnet_Name" type="TString"/>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
</xs:sequence>
</xs:complexType>
<xs:complexType name="detectorInfo">
<xs:sequence>
<xs:element name="Detector" type="detector" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="detector">
<xs:sequence>
<xs:element name="Name" type="TString"/>
<xs:element name="Histo_Number" type="Int_t"/>
<xs:element name="Histo_Length" type="Int_t"/>
<xs:element name="Time_Zero_Bin" type="Double_t"/>
<xs:element name="First_Good_Bin" type="Int_t"/>
<xs:element name="Last_Good_Bin" type="Int_t"/>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
</xs:sequence>
</xs:complexType>
<xs:complexType name="beamlineInfo">
<xs:sequence>
<xs:element name="Name" type="TString"/>
<xs:element name="Beamline_Settings" type="TString"/>
<xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/> <!-- here can go any additional stuff you like -->
</xs:sequence>
</xs:complexType>
<xs:complexType name="histoData">
<xs:sequence>
<xs:element name="Entry" type="histoEntry" minOccurs="1" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="histoEntry">
<xs:sequence>
<xs:element name="Name" type="xs:string"/>
<xs:element name="Type" type="rootHistoType"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="rootHistoType">
<xs:restriction base="xs:string">
<xs:pattern value="TH([1-2])F"/> <!-- this means TH1F or TH2F -->
</xs:restriction>
</xs:simpleType>
</xs:schema>

File diff suppressed because it is too large Load Diff

View File

@ -1,196 +0,0 @@
/***************************************************************************
TMusrRunHeader.h
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
$Id$
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2012 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef TMUSRRUNHEADER_H
#define TMUSRRUNHEADER_H
#include <vector>
using namespace std;
#include <TDatime.h>
#include <TObject.h>
#include <TQObject.h>
#include <TObjString.h>
#include <TObjArray.h>
#include <TFolder.h>
#define MRH_UNDEFINED -9.99e99
#define MRH_DOUBLE_PREC 6
#define MRH_TSTRING 0
#define MRH_INT 1
#define MRH_DOUBLE 2
#define MRH_TMUSR_RUN_PHYSICAL_QUANTITY 3
#define MRH_TSTRING_VECTOR 4
#define MRH_INT_VECTOR 5
#define MRH_DOUBLE_VECTOR 6
typedef vector<Int_t> TIntVector;
typedef vector<Double_t> TDoubleVector;
typedef vector<TString> TStringVector;
//-------------------------------------------------------------------------
template <class T> class TMusrRunObject : public TObject
{
public:
TMusrRunObject() { fPathName = "n/a"; fType = "n/a"; }
TMusrRunObject(TString pathName, TString type, T value) : fPathName(pathName), fType(type), fValue(value) {}
virtual ~TMusrRunObject() {}
virtual TString GetPathName() { return fPathName; }
virtual TString GetType() { return fType; }
virtual T GetValue() { return fValue; }
virtual void SetPathName(TString pathName) { fPathName = pathName; }
virtual void SetType(TString type) { fType = type; }
virtual void SetValue(T value) { fValue = value; }
private:
TString fPathName; ///< path name of the variable, e.g. 'RunInfo/Run Number'
TString fType; ///< type of value, e.g. TString, or Int_t, etc.
T fValue; ///< value itself
};
//-------------------------------------------------------------------------
class TMusrRunPhysicalQuantity : public TObject
{
public:
TMusrRunPhysicalQuantity();
TMusrRunPhysicalQuantity(TString label, Double_t demand, Double_t value, Double_t error, TString unit, TString description = TString("n/a"));
TMusrRunPhysicalQuantity(TString label, Double_t demand, Double_t value, TString unit, TString description = TString("n/a"));
TMusrRunPhysicalQuantity(TString label, Double_t value, TString unit, TString description = TString("n/a"));
virtual ~TMusrRunPhysicalQuantity() {}
virtual TString GetLabel() const { return fLabel; }
virtual Double_t GetDemand() const { return fDemand; }
virtual Double_t GetValue() const { return fValue; }
virtual Double_t GetError() const { return fError; }
virtual TString GetUnit() const { return fUnit; }
virtual TString GetDescription() const { return fDescription; }
virtual void Set(TString label, Double_t demand, Double_t value, Double_t error, TString unit, TString description = TString("n/a"));
virtual void Set(TString label, Double_t demand, Double_t value, TString unit, TString description = TString("n/a"));
virtual void Set(TString label, Double_t value, TString unit, TString description = TString("n/a"));
virtual void SetLabel(TString &label) { fLabel = label; }
virtual void SetLabel(const char *label) { fLabel = label; }
virtual void SetDemand(Double_t val) { fDemand = val; }
virtual void SetValue(Double_t val) { fValue = val; }
virtual void SetError(Double_t err) { fError = err; }
virtual void SetUnit(TString &unit) { fUnit = unit; }
virtual void SetUnit(const char *unit) { fUnit = unit; }
virtual void SetDescription(TString &str) { fDescription = str; }
virtual void SetDescription(const char *str) { fDescription = str; }
private:
TString fLabel; ///< property label, like Sample Temperature etc.
Double_t fDemand; ///< demand value of the physical quantity, e.g. temperature setpoint
Double_t fValue; ///< measured value of the physical quantity
Double_t fError; ///< estimated error (standard deviation) of the measured value
TString fUnit; ///< unit of the physical quantity
TString fDescription; ///< a more detailed description of the physical quantity
ClassDef(TMusrRunPhysicalQuantity, 1)
};
//-------------------------------------------------------------------------
class TMusrRunHeader : public TObject
{
public:
TMusrRunHeader(bool quite=false);
TMusrRunHeader(const char *fileName, bool quite=false);
virtual ~TMusrRunHeader();
virtual TString GetFileName() { return fFileName; }
virtual Bool_t FillFolder(TFolder *folder);
virtual Bool_t ExtractAll(TFolder *folder);
virtual Bool_t ExtractHeaderInformation(TObjArray *headerInfo, TString path);
virtual void GetValue(TString pathName, TString &value, Bool_t &ok);
virtual void GetValue(TString pathName, Int_t &value, Bool_t &ok);
virtual void GetValue(TString pathName, Double_t &value, Bool_t &ok);
virtual void GetValue(TString pathName, TMusrRunPhysicalQuantity &value, Bool_t &ok);
virtual void GetValue(TString pathName, TStringVector &value, Bool_t &ok);
virtual void GetValue(TString pathName, TIntVector &value, Bool_t &ok);
virtual void GetValue(TString pathName, TDoubleVector &value, Bool_t &ok);
virtual void SetFileName(TString fln) { fFileName = fln; }
virtual void Set(TString pathName, TString value);
virtual void Set(TString pathName, Int_t value);
virtual void Set(TString pathName, Double_t value);
virtual void Set(TString pathName, TMusrRunPhysicalQuantity value);
virtual void Set(TString pathName, TStringVector value);
virtual void Set(TString pathName, TIntVector value);
virtual void Set(TString pathName, TDoubleVector value);
virtual void DumpHeader();
virtual void DrawHeader();
private:
bool fQuite;
TString fFileName;
TString fVersion;
vector< TMusrRunObject<TString> > fStringObj;
vector< TMusrRunObject<Int_t> > fIntObj;
vector< TMusrRunObject<Double_t> > fDoubleObj;
vector< TMusrRunObject<TMusrRunPhysicalQuantity> > fMusrRunPhysQuantityObj;
vector< TMusrRunObject<TStringVector> > fStringVectorObj;
vector< TMusrRunObject<TIntVector> > fIntVectorObj;
vector< TMusrRunObject<TDoubleVector> > fDoubleVectorObj;
vector< TString > fPathNameOrder; ///< keeps the path-name as they were created in ordered to keep ordering
virtual void Init(TString str="n/a");
virtual void CleanUp();
virtual UInt_t GetDecimalPlace(Double_t val);
virtual UInt_t GetLeastSignificantDigit(Double_t val) const;
virtual void SplitPathName(TString pathName, TString &path, TString &name);
virtual TString GetLabel(TString str);
virtual TString GetStrValue(TString str);
virtual TString GetType(TString str);
virtual bool UpdateFolder(TObject *treeObj, TString path);
virtual TObject* FindObject(TObject *treeObj, TString path);
virtual TObjString GetHeaderString(UInt_t idx);
virtual bool RemoveFirst(TString &str, const char splitter);
virtual TString GetFirst(TString &str, const char splitter);
ClassDef(TMusrRunHeader, 1)
};
#endif // TMUSRRUNHEADER_H

View File

@ -1,41 +0,0 @@
/***************************************************************************
TMusrRunHeaderLinkDef.h
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
$Id$
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2012 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class TMusrRunPhysicalQuantity+;
#pragma link C++ class TMusrRunHeader+;
#endif

View File

@ -1,158 +0,0 @@
/***************************************************************************
musrRoot_runHeader_test.cpp
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
$Id$
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2012 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <iostream>
using namespace std;
#include <TROOT.h>
#include <TFile.h>
#include <TFolder.h>
#include "TMusrRunHeader.h"
void musrRoot_runHeader_test_syntax()
{
cout << endl << "usage: musrRoot_runHeader_test <fileName>";
cout << endl << " <fileName> is the file name including the extention root, e.g. test.root";
cout << endl << endl;
}
int main(int argc, char *argv[])
{
if (argc != 2) {
musrRoot_runHeader_test_syntax();
return 1;
}
// read the file and extract the header info
TFile *f = new TFile(argv[1], "READ", "musrRoot_runHeader_test");
if (f->IsZombie()) {
delete f;
return -1;
}
TFolder *runHeader = 0;
f->GetObject("RunHeader", runHeader);
if (runHeader == 0) {
cerr << endl << ">> **ERROR** Couldn't get top folder RunHeader";
f->Close();
return -1;
}
// MusrRoot Run Header object
TMusrRunHeader *header = new TMusrRunHeader(argv[1]);
header->ExtractAll(runHeader);
f->Close();
delete f;
header->DumpHeader();
// get some information from the read file
cout << endl << "++++++++++++++++++++++++++++";
cout << endl << ">> get header infos " << argv[1];
cout << endl << "++++++++++++++++++++++++++++" << endl;
TString str("");
TStringVector strVec;
Int_t ival;
Double_t dval;
TDoubleVector dvec;
TMusrRunPhysicalQuantity prop;
Bool_t ok;
header->GetValue("RunInfo/Run Title", str, ok);
if (ok)
cout << endl << "Run Title: " << str.Data();
else
cout << endl << "**ERROR** Couldn't obtain the 'Run Title'.";
header->GetValue("RunInfo/Run Number", ival, ok);
if (ok)
cout << endl << "Run Number: " << ival;
else
cout << endl << "**ERROR** Couldn't obtain the 'Run Number'.";
header->GetValue("RunInfo/Sample Temperature", prop, ok);
if (ok) {
cout << endl << "Sample Temperature: " << prop.GetValue() << " +- " << prop.GetError() << " " << prop.GetUnit().Data() << "; SP: " << prop.GetDemand() << "; " << prop.GetDescription().Data();
} else {
cout << endl << "**ERROR** Couldn't obtain the 'Sample Temperature'.";
}
header->GetValue("DetectorInfo/Detector000/Name", str, ok);
if (ok) {
cout << endl << "DetectorInfo/Detector000: Name=" << str;
} else {
cout << endl << "**ERROR** Couldn't obtain 'Detector/Detector000/Name'.";
}
header->GetValue("DetectorInfo/Detector000/Histo Number", ival, ok);
if (ok) {
cout << endl << "DetectorInfo/Detector000: Histo Number=" << ival;
} else {
cout << endl << "**ERROR** Couldn't obtain 'Detector/Detector000/Histo Number'.";
}
header->GetValue("DetectorInfo/Detector000/Histo Length", ival, ok);
if (ok) {
cout << endl << "DetectorInfo/Detector000: Histo Length=" << ival;
} else {
cout << endl << "**ERROR** Couldn't obtain 'Detector/Detector000/Histo Length'.";
}
header->GetValue("DetectorInfo/Detector000/Time Zero Bin", dval, ok);
if (ok) {
cout << endl << "DetectorInfo/Detector000: Time Zero Bin=" << dval;
} else {
cout << endl << "**ERROR** Couldn't obtain 'Detector/Detector000/Time Zero Bin'.";
}
header->GetValue("DetectorInfo/Detector000/First Good Bin", ival, ok);
if (ok) {
cout << endl << "DetectorInfo/Detector000: First Good Bin=" << ival;
} else {
cout << endl << "**ERROR** Couldn't obtain 'Detector/Detector000/First Good Bin'.";
}
header->GetValue("DetectorInfo/Detector000/Last Good Bin", ival, ok);
if (ok) {
cout << endl << "DetectorInfo/Detector000: Last Good Bin=" << ival;
} else {
cout << endl << "**ERROR** Couldn't obtain 'Detector/Detector000/Last Good Bin'.";
}
cout << endl << endl;
delete header;
return 0;
}

View File

@ -1,97 +0,0 @@
/***************************************************************************
read_musrRoot_runHeader.cpp
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
$Id$
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2012 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <iostream>
using namespace std;
#include <TROOT.h>
#include <TFile.h>
#include <TFolder.h>
#include "TMusrRunHeader.h"
void closeFile(TFile *f)
{
if (f == 0)
return;
f->Close();
delete f;
}
void read_musrRoot_runHeader_syntax()
{
cout << endl << "usage: read_musrRoot_runHeader <fileName>";
cout << endl << " <fileName> is the file name including the extention root, e.g. test.root";
cout << endl << endl;
}
int main(int argc, char *argv[])
{
if (argc != 2) {
read_musrRoot_runHeader_syntax();
return 1;
}
// read the file back and extract the header info
TFile *f = new TFile(argv[1], "READ", "read_musrRoot_runHeader");
if (f->IsZombie()) {
delete f;
return -1;
}
TFolder *runHeader = 0;
f->GetObject("RunHeader", runHeader);
if (runHeader == 0) {
cerr << endl << ">> **ERROR** Couldn't get top folder RunHeader";
closeFile(f);
return -1;
}
TMusrRunHeader *header = new TMusrRunHeader(argv[1]);
if (!header->ExtractAll(runHeader)) {
cerr << endl << ">> **ERROR** couldn't extract all RunHeader information :-(" << endl << endl;
closeFile(f);
return -1;
}
f->Close();
delete f;
header->DumpHeader();
delete header;
cout << endl << endl;
return 0;
}

View File

@ -1,318 +0,0 @@
// quick and dirty ROOT -> XML converter for MusrRoot
// needs to be rewritten as proper program.
//
// Andreas Suter
//
// $Id$
vector<string> xml_data;
enum EFolderTag {eUnkown, eDecayAnaModule, eSlowControlAnaModule};
enum ERunHeaderTag {eUnkown, eRunInfo, eSampleEnvironmentInfo, eMagneticFieldEnvironmentInfo, eBeamlineInfo, eScalerInfo};
EFolderTag folderTag = eUnkown;
ERunHeaderTag runHeaderTag = eUnkown;
void root2xml(const char *filename, const char *xmlFilename)
{
TFile f(filename);
if (f.IsZombie()) {
cout << endl << "**ERROR** couldn't open file " << filename << endl;
return;
}
xml_data.clear();
xml_data.push_back("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
xml_data.push_back("<MusrRoot xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"file:MusrRoot.xsd\">");
TIter next = f.GetListOfKeys();
TKey *key;
TFolder *folder;
TString str, tag;
UInt_t offset = 2;
while (key = (TKey*) next()) {
cout << endl << "name: " << key->GetName() << ", class name: " << key->GetClassName();
str = key->GetClassName();
if (str == "TFolder") {
folder = (TFolder*)key->ReadObj();
checkClass(folder, str, offset);
}
}
cout << endl;
f.Close();
xml_data.push_back("</MusrRoot>");
// the sort_histo_folders is needed since XML-Schema is not flexible enough to handle
// histos -|
// |- DecayAnaModule
// ... (any other analyzer module sub-folder
// |- SCAnaModule
// Hence SCAnaModule has artificially moved up, just to follow DecayAnaModule
sort_histo_folders();
ofstream fout(xmlFilename);
for (UInt_t i=0; i<xml_data.size(); i++)
fout << xml_data[i] << endl;
fout.close();
}
void sort_histo_folders()
{
vector<string> temp_xml_data;
// first make a copy of the original xml_data
for (unsigned int i=0; i<xml_data.size(); i++)
temp_xml_data.push_back(xml_data[i]);
// remove SCAnaModule from temp_xml_data
unsigned int start = 0, end = 0;
for (unsigned int i=0; i<temp_xml_data.size(); i++) {
if (temp_xml_data[i].find("<SCAnaModule>") != string::npos)
start = i;
if (temp_xml_data[i].find("</SCAnaModule>") != string::npos)
end = i+1;
}
if ((start > 0) && (end > 0))
temp_xml_data.erase(temp_xml_data.begin()+start, temp_xml_data.begin()+end);
else // no SCAnaModule present, hence nothing to be done
return;
// insert SCAnaModule just after DecayAnaModule
// 1st find end of DecayAnaModule
unsigned int pos = 0;
for (unsigned int i=0; i<temp_xml_data.size(); i++) {
if (temp_xml_data[i].find("</DecayAnaModule>") != string::npos) {
pos = i+1;
break;
}
}
if (pos == 0) // something is wrong, hence to not do anything
return;
temp_xml_data.insert(temp_xml_data.begin()+pos, xml_data.begin()+start, xml_data.begin()+end);
// copy temp_xml_data back into xml_data
xml_data.clear();
for (unsigned int i=0; i<temp_xml_data.size(); i++)
xml_data.push_back(temp_xml_data[i]);
// clean up
temp_xml_data.clear();
}
void dumpFolder(TFolder *folder, UInt_t offset)
{
TString offsetStr="";
for (UInt_t i=0; i<offset; i++)
offsetStr += " ";
TIter next = folder->GetListOfFolders();
TObject *obj;
TString str;
while (obj = (TObject*) next()) {
cout << endl << offsetStr << "name: " << obj->GetName() << ", class name: " << obj->ClassName();
str = obj->ClassName();
checkClass(obj, str, offset);
}
}
void dumpObjArray(TObjArray *obj, UInt_t offset)
{
TString offsetStr="";
for (UInt_t i=0; i<offset; i++)
offsetStr += " ";
TObjString *tstr;
TString str, xmlStr, type, label, xmlLabel;
// check if the obj name is anything like DetectorXXX, where XXX is a number
xmlLabel = TString(obj->GetName());
if (xmlLabel.BeginsWith("Detector")) {
xmlLabel.Remove(0, 8); // remove 'Detector'
if (xmlLabel.IsDigit())
xmlLabel = "Detector";
else
xmlLabel = TString(obj->GetName());
}
cout << endl << offsetStr << obj->GetName() << " (# " << obj->GetEntries() << ")";
xmlStr = offsetStr + "<" + xmlLabel + ">";
xml_data.push_back(xmlStr.Data());
for (UInt_t i=0; i<obj->GetEntries(); i++) {
// check if entry is a TObjArray
type = obj->At(i)->ClassName();
if (type == "TObjArray") {
dumpObjArray((TObjArray*)(obj->At(i)), offset+2);
} else { // not a TObjArray
tstr = (TObjString*) obj->At(i);
str = tstr->GetString();
str.Remove(TString::kTrailing, '\n');
getType(str, type);
getLabel(str, label);
cout << endl << offsetStr << i << ": " << str;
xmlStr = offsetStr + " " + "<" + label + ">" + type + "</" + label + ">" ;
xml_data.push_back(xmlStr.Data());
}
}
xmlStr = offsetStr + "</" + xmlLabel + ">";
xml_data.push_back(xmlStr.Data());
}
void dumpEntry(TObject *obj, UInt_t offset)
{
TString offsetStr="";
for (UInt_t i=0; i<offset; i++)
offsetStr += " ";
TString nameTag(""), typeTag("");
switch (folderTag) {
case eDecayAnaModule:
nameTag = "HistoName";
typeTag = "HistoType";
break;
case eSlowControlAnaModule:
nameTag = "SlowControlName";
typeTag = "SlowControlType";
break;
case eUnkown:
default:
nameTag = "Name";
typeTag = "Type";
break;
}
TString str;
str = offsetStr + "<" + nameTag + ">";
str += obj->GetName();
str += "</" + nameTag + ">";
xml_data.push_back(str.Data());
str = offsetStr + "<" + typeTag + ">";
str += obj->ClassName();
str += "</" + typeTag + ">";
xml_data.push_back(str.Data());
}
void checkClass(TObject *obj, TString str, UInt_t offset)
{
TString offsetStr="";
for (UInt_t i=0; i<offset; i++)
offsetStr += " ";
if (str == "TFolder") {
TString xmlTagName(TString(obj->GetName()));
// set folder tag
if (!xmlTagName.CompareTo("DecayAnaModule"))
folderTag = eDecayAnaModule;
else if (!xmlTagName.CompareTo("SCAnaModule"))
folderTag = eSlowControlAnaModule;
else if (!xmlTagName.CompareTo("SCAnaModule"))
folderTag = eSlowControlAnaModule;
else
folderTag = eUnkown;
offset += 2;
str = offsetStr + "<" + xmlTagName + ">";
xml_data.push_back(str.Data());
dumpFolder((TFolder*)obj, offset);
str = offsetStr + "</" + xmlTagName + ">";
xml_data.push_back(str.Data());
} else if (str == "TObjArray") {
offset += 2;
dumpObjArray((TObjArray*)obj, offset);
} else {
// filter out the proper entry tag
TString entryTag("");
switch (folderTag) {
case eDecayAnaModule:
entryTag = TString("DecayHistoEntry");
break;
case eSlowControlAnaModule:
entryTag = TString("SlowControlHistoEntry");
break;
case eUnkown:
default:
entryTag = TString("Entry");
break;
}
offset += 2;
str = offsetStr + "<" + entryTag + ">";
xml_data.push_back(str.Data());
dumpEntry((TObjArray*)obj, offset);
str = offsetStr + "</" + entryTag + ">";
xml_data.push_back(str.Data());
}
}
void getType(TString entry, TString &type)
{
if (entry.Contains("-@0")) {
type = "TString";
} else if (entry.Contains("-@1")) {
type = "Int_t";
} else if (entry.Contains("-@2")) {
type = "Double_t";
} else if (entry.Contains("-@3")) {
type = "TMusrRunPhysicalQuantity";
} else if (entry.Contains("-@4")) {
type = "TStringVector";
} else if (entry.Contains("-@5")) {
type = "TIntVector";
} else if (entry.Contains("-@6")) {
type = "TDoubleVector";
} else {
type = "TString";
}
}
void getLabel(TString entry, TString &label)
{
label="no_idea";
Ssiz_t start = entry.First('-');
Ssiz_t end = entry.First(':');
if ((start == -1) || (end == -1))
return;
if (end - start < 2)
return;
// check that '-@' is present in the string, otherwise it is NOT a known label
Ssiz_t pos = entry.First('@');
if (pos < 1)
return;
if (entry(pos-1) != '-')
return;
// cut out value
label = entry;
label.Remove(0, start+2);
label.Remove(end-start-2, label.Length());
label.ReplaceAll(' ', '_'); // replace spaces through underscores
label.ReplaceAll('(', '_'); // replace '(' through underscores
label.ReplaceAll(')', '_'); // replace ')' through underscores
label.ReplaceAll('[', '_'); // replace '[' through underscores
label.ReplaceAll(']', '_'); // replace ']' through underscores
label.ReplaceAll('{', '_'); // replace '[' through underscores
label.ReplaceAll('}', '_'); // replace ']' through underscores
}

View File

@ -1,236 +0,0 @@
/***************************************************************************
write_musrRoot_runHeader.cpp
Author: Andreas Suter
e-mail: andreas.suter@psi.ch
$Id$
***************************************************************************/
/***************************************************************************
* Copyright (C) 2007-2012 by Andreas Suter *
* andreas.suter@psi.ch *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <cstdlib>
#include <ctime>
#include <cstring>
#include <iostream>
using namespace std;
#include <TROOT.h>
#include <TFile.h>
#include <TFolder.h>
#include "TMusrRunHeader.h"
void write_musrRoot_runHeader_syntax()
{
cout << endl << "usage: write_musrRoot_runHeader <fileName>";
cout << endl << " <fileName> is the file name including the extention root, e.g. test.root";
cout << endl << endl;
}
int main(int argc, char *argv[])
{
if (argc != 2) {
write_musrRoot_runHeader_syntax();
return 1;
}
// MusrRoot Run Header object
TMusrRunHeader *header = new TMusrRunHeader(argv[1]);
TMusrRunPhysicalQuantity prop;
// run info
header->Set("RunInfo/Generic Validator URL", "http://lmu.web.psi.ch/facilities/software/MusrRoot/Validation/MusrRoot.xsd");
header->Set("RunInfo/Specific Validator URL", "http://lmu.web.psi.ch/facilities/software/MusrRoot/Validation/MusrRootGPS.xsd");
header->Set("RunInfo/Generator", "any2many");
header->Set("RunInfo/File Name", "deltat_tdc_gps_2871.root");
header->Set("RunInfo/Run Title", "here comes the run title");
header->Set("RunInfo/Run Number", 2871);
// run info - start/stop time and duration
TString startTime("2012-04-19 14:25:22"), stopTime("2012-04-19 19:13:47");
struct tm tm_start, tm_stop;
header->Set("RunInfo/Run Start Time", startTime);
header->Set("RunInfo/Run Stop Time", stopTime);
// calculate run duration
memset(&tm_start, 0, sizeof(tm_start));
strptime(startTime.Data(), "%Y-%m-%d %H:%M:%S", &tm_start);
memset(&tm_stop, 0, sizeof(tm_stop));
strptime(stopTime.Data(), "%Y-%m-%d %H:%M:%S", &tm_stop);
Double_t duration = difftime(mktime(&tm_stop), mktime(&tm_start));
prop.Set("Run Duration", (Int_t)duration, "sec");
header->Set("RunInfo/Run Duration", prop);
header->Set("RunInfo/Laboratory", "PSI");
header->Set("RunInfo/Instrument", "GPS");
prop.Set("Muon Beam Momentum", 28.1, "MeV/c");
header->Set("RunInfo/Muon Beam Momentum", prop);
header->Set("RunInfo/Muon Species", "positive muon");
header->Set("RunInfo/Muon Source", "target M");
header->Set("RunInfo/Setup", "a very special setup with Heliox");
header->Set("RunInfo/Comment", "nothing more to be said");
header->Set("RunInfo/Sample Name", "the best ever");
prop.Set("Sample Temperature", 3.2, 3.21, 0.05, "K", "CF1");
header->Set("RunInfo/Sample Temperature", prop);
prop.Set("Sample Magnetic Field", 350.0, 350.002, 0.005, "G", "WXY");
header->Set("RunInfo/Sample Magnetic Field", prop);
header->Set("RunInfo/No of Histos", 4);
prop.Set("Time Resolution", 0.1953125, "ns", "TDC 9999");
header->Set("RunInfo/Time Resolution", prop);
header->Set("DetectorInfo/Detector000/Name", "Left - NPP");
header->Set("DetectorInfo/Detector000/Histo Number", 0);
header->Set("DetectorInfo/Detector000/Histo Length", 66661);
header->Set("DetectorInfo/Detector000/Time Zero Bin", 3419.0);
header->Set("DetectorInfo/Detector000/First Good Bin", 3419);
header->Set("DetectorInfo/Detector000/Last Good Bin", 66661);
header->Set("DetectorInfo/Detector001/Name", "Top - NPP");
header->Set("DetectorInfo/Detector001/Histo Number", 1);
header->Set("DetectorInfo/Detector001/Histo Length", 66661);
header->Set("DetectorInfo/Detector001/Time Zero Bin", 3419.0);
header->Set("DetectorInfo/Detector001/First Good Bin", 3419);
header->Set("DetectorInfo/Detector001/Last Good Bin", 66661);
header->Set("DetectorInfo/Detector002/Name", "Right - NPP");
header->Set("DetectorInfo/Detector002/Histo Number", 2);
header->Set("DetectorInfo/Detector002/Histo Length", 66661);
header->Set("DetectorInfo/Detector002/Time Zero Bin", 3419.0);
header->Set("DetectorInfo/Detector002/First Good Bin", 3419);
header->Set("DetectorInfo/Detector002/Last Good Bin", 66661);
header->Set("DetectorInfo/Detector003/Name", "Bottom - NPP");
header->Set("DetectorInfo/Detector003/Histo Number", 3);
header->Set("DetectorInfo/Detector003/Histo Length", 66661);
header->Set("DetectorInfo/Detector003/Time Zero Bin", 3419.0);
header->Set("DetectorInfo/Detector003/First Good Bin", 3419);
header->Set("DetectorInfo/Detector003/Last Good Bin", 66661);
header->Set("DetectorInfo/Detector004/Name", "Left - PPC");
header->Set("DetectorInfo/Detector004/Histo Number", 20);
header->Set("DetectorInfo/Detector004/Histo Length", 66661);
header->Set("DetectorInfo/Detector004/Time Zero Bin", 3419.0);
header->Set("DetectorInfo/Detector004/First Good Bin", 3419);
header->Set("DetectorInfo/Detector004/Last Good Bin", 66661);
header->Set("DetectorInfo/Detector005/Name", "Top - PPC");
header->Set("DetectorInfo/Detector005/Histo Number", 21);
header->Set("DetectorInfo/Detector005/Histo Length", 66661);
header->Set("DetectorInfo/Detector005/Time Zero Bin", 3419.0);
header->Set("DetectorInfo/Detector005/First Good Bin", 3419);
header->Set("DetectorInfo/Detector005/Last Good Bin", 66661);
header->Set("DetectorInfo/Detector006/Name", "Right - PPC");
header->Set("DetectorInfo/Detector006/Histo Number", 22);
header->Set("DetectorInfo/Detector006/Histo Length", 66661);
header->Set("DetectorInfo/Detector006/Time Zero Bin", 3419.0);
header->Set("DetectorInfo/Detector006/First Good Bin", 3419);
header->Set("DetectorInfo/Detector006/Last Good Bin", 66661);
header->Set("DetectorInfo/Detector007/Name", "Bottom - PPC");
header->Set("DetectorInfo/Detector007/Histo Number", 23);
header->Set("DetectorInfo/Detector007/Histo Length", 66661);
header->Set("DetectorInfo/Detector007/Time Zero Bin", 3419.0);
header->Set("DetectorInfo/Detector007/First Good Bin", 3419);
header->Set("DetectorInfo/Detector007/Last Good Bin", 66661);
TStringVector scHistoNames;
scHistoNames.push_back("Sample Temperature");
scHistoNames.push_back("Sample Magnetic Field");
header->Set("RunInfo/Slow Control Histo Names", scHistoNames);
TStringVector dummyTest;
dummyTest.push_back("dummy1");
dummyTest.push_back("dummy2");
dummyTest.push_back("dummy3");
header->Set("RunInfo/Dummy Test", dummyTest);
// sample environment
header->Set("SampleEnvironmentInfo/Cryo", "Konti-1");
header->Set("SampleEnvironmentInfo/Insert", "X123");
header->Set("SampleEnvironmentInfo/Orientation", "c-axis perp spin, perp field. spin perp field");
prop.Set("CF2", 3.2, 3.22, 0.04, "K");
header->Set("SampleEnvironmentInfo/CF2", prop);
prop.Set("CF3", MRH_UNDEFINED, 3.27, 0.09, "K", "strange temperature");
header->Set("SampleEnvironmentInfo/CF3", prop);
prop.Set("CF4", 3.25, 3.28, "K");
header->Set("SampleEnvironmentInfo/CF4", prop);
prop.Set("CF5", 3.26, 3.29, "K", "another strange temperature");
header->Set("SampleEnvironmentInfo/CF5", prop);
prop.Set("Dummy Prop", -2.0, -2.001, 0.002, "SI-unit");
header->Set("SampleEnvironmentInfo/Dummy Prop", prop);
// magnetic field environment
header->Set("MagneticFieldEnvironmentInfo/Magnet Name", "Bpar");
prop.Set("Current", 1.34, "A");
header->Set("MagneticFieldEnvironmentInfo/Current", prop);
// beamline
header->Set("BeamlineInfo/Name", "piM3.2");
header->Set("BeamlineInfo/WSX61a", "DAC = 3289, ADC = 0.800");
TIntVector dummyInt;
for (UInt_t i=0; i<3; i++) dummyInt.push_back(i+1000);
header->Set("BeamlineInfo/Dummy Int", dummyInt);
// scaler
header->Set("ScalerInfo/Ip", 12332123);
// funny sub/sub/../sub-structure
header->Set("aa/bb/cc/dd/ee/ff/name", "funny");
header->Set("aa/bb/cc/dd/ee/ff/gg/xyz", 123);
TFile *f = new TFile(argv[1], "RECREATE", "write_musrRoot_runHeader");
if (f->IsZombie()) {
delete f;
return -1;
}
// root file header related things
TFolder *runHeader = new TFolder("RunHeader", "MusrRoot Run Header Info");
if (header->FillFolder(runHeader)) {
runHeader->Write();
}
f->Close();
// clean up
delete f;
delete header;
return 0;
}