newly added minimal mockup for a proposed PSI-ROOT format
This commit is contained in:
parent
37c2cd0d8f
commit
6dd6381a4e
91
src/tests/PsiRoot/Makefile
Normal file
91
src/tests/PsiRoot/Makefile
Normal file
@ -0,0 +1,91 @@
|
||||
#---------------------------------------------------
|
||||
# Makefile
|
||||
#
|
||||
# Author: Andreas Suter
|
||||
# e-mail: andreas.suter@psi.ch
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
#---------------------------------------------------
|
||||
|
||||
#---------------------------------------------------
|
||||
# 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 = -lTPsiRunHeader
|
||||
|
||||
EXEC = psi_runHeader_test
|
||||
|
||||
# some definitions: headers (used to generate *Dict* stuff), sources, objects,...
|
||||
OBJS =
|
||||
OBJS += $(EXEC).o
|
||||
|
||||
# make the executable:
|
||||
#
|
||||
all: $(EXEC)
|
||||
|
||||
$(EXEC): $(OBJS)
|
||||
@echo "---> Building $(EXEC) ..."
|
||||
/bin/rm -f $(SHLIB)
|
||||
$(LD) $(OBJS) -o $(EXEC) $(PSILIBS) $(GLIBS)
|
||||
@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 $<
|
123
src/tests/PsiRoot/Makefile.TPsiRunHeader
Normal file
123
src/tests/PsiRoot/Makefile.TPsiRunHeader
Normal file
@ -0,0 +1,123 @@
|
||||
# Makefile for TPH1F
|
||||
#
|
||||
# Copyright (c) 2000 Rene Brun and Fons Rademakers
|
||||
#
|
||||
# Author: Fons Rademakers, 29/2/2000
|
||||
#
|
||||
# modified: Andreas Suter, 14/04/2004
|
||||
# modified: Thomas Prokscha, 30/01/2007
|
||||
#
|
||||
#
|
||||
include Makefile.arch
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# TPsiRunHeader
|
||||
TNAME = TPsiRunHeader
|
||||
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:
|
||||
ifeq ($(ARCH),linux)
|
||||
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),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 $<
|
||||
|
||||
|
510
src/tests/PsiRoot/Makefile.arch
Normal file
510
src/tests/PsiRoot/Makefile.arch
Normal file
@ -0,0 +1,510 @@
|
||||
# -*- 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 = cxx
|
||||
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)
|
520
src/tests/PsiRoot/TPsiRunHeader.cpp
Normal file
520
src/tests/PsiRoot/TPsiRunHeader.cpp
Normal file
@ -0,0 +1,520 @@
|
||||
/***************************************************************************
|
||||
|
||||
TPsiRunHeader.cpp
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
$Id$
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2011 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>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
|
||||
#include "TPsiRunHeader.h"
|
||||
|
||||
#include <TPaveText.h>
|
||||
#include <TCanvas.h>
|
||||
|
||||
#define TPRH_VERSION_IDX 0
|
||||
#define TPRH_RUN_TITLE_IDX 1
|
||||
#define TPRH_RUN_NUMBER_IDX 2
|
||||
#define TPRH_LABORATORY_IDX 3
|
||||
#define TPRH_INSTRUMENT_IDX 4
|
||||
#define TPRH_SETUP_IDX 5
|
||||
#define TPRH_SAMPLE_IDX 6
|
||||
#define TPRH_ORIENTATION_IDX 7
|
||||
|
||||
#define TPRH_OFFSET 9
|
||||
|
||||
ClassImp(TPsiRunProperty)
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Constructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Constructor.
|
||||
*/
|
||||
TPsiRunProperty::TPsiRunProperty()
|
||||
{
|
||||
fName = "n/a";
|
||||
fValue = 0.0;
|
||||
fError = 0.0;
|
||||
fUnit = "n/a";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Constructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Constructor.
|
||||
*
|
||||
* \param name
|
||||
* \param value
|
||||
* \param error
|
||||
* \param unit
|
||||
*/
|
||||
TPsiRunProperty::TPsiRunProperty(TObjString &name, Double_t value, Double_t error, TObjString &unit) :
|
||||
fName(name), fValue(value), fError(error), fUnit(unit)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Constructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Constructor.
|
||||
*
|
||||
* \param name
|
||||
* \param value
|
||||
* \param error
|
||||
* \param unit
|
||||
*/
|
||||
TPsiRunProperty::TPsiRunProperty(TString &name, Double_t value, Double_t error, TString &unit) : fName(name), fValue(value), fError(error), fUnit(unit)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Destructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Destructor.
|
||||
*/
|
||||
TPsiRunProperty::~TPsiRunProperty()
|
||||
{
|
||||
}
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
ClassImp(TPsiRunHeader)
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Constructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Constructor.
|
||||
*/
|
||||
TPsiRunHeader::TPsiRunHeader()
|
||||
{
|
||||
fVersion.SetString("00 - version: $Id$");
|
||||
fRunTitle.SetString("01 - run title: n/a");
|
||||
fRunNumber.SetString("02 - run number: -1");
|
||||
fLaboratory.SetString("03 - laboratory: n/a");
|
||||
fInstrument.SetString("04 - instrument: n/a");
|
||||
fSetup.SetString("05 - setup: n/a");
|
||||
fSample.SetString("06 - sample: n/a");
|
||||
fOrientation.SetString("07 - orientation: n/a");
|
||||
fPropertiesList.Expand(0); // init to size 0
|
||||
fProperties.Expand(0); // init to size 0
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Destructor
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>Destructor.
|
||||
*/
|
||||
TPsiRunHeader::~TPsiRunHeader()
|
||||
{
|
||||
fPropertiesList.Delete();
|
||||
fProperties.Delete();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetVersion (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
TString TPsiRunHeader::GetVersion() const
|
||||
{
|
||||
return GetInfoString(fVersion);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetRunTitle (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
TString TPsiRunHeader::GetRunTitle() const
|
||||
{
|
||||
return GetInfoString(fRunTitle);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetRunTitle (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* \param runTitle
|
||||
*/
|
||||
void TPsiRunHeader::SetRunTitle(TString runTitle)
|
||||
{
|
||||
char str[1024];
|
||||
sprintf(str, "%02d - run title: %s", TPRH_RUN_TITLE_IDX, runTitle.Data());
|
||||
|
||||
fRunTitle.SetString(str);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetRunNumber (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
Int_t TPsiRunHeader::GetRunNumber() const
|
||||
{
|
||||
TObjArray *tokens = 0;
|
||||
TObjString *ostr = 0;
|
||||
TString str("");
|
||||
Int_t ival=-999;
|
||||
|
||||
tokens = fRunNumber.GetString().Tokenize(":");
|
||||
if (!tokens) { // couldn't get tokens
|
||||
return ival;
|
||||
}
|
||||
if (tokens->GetEntries() != 2) { // wrong number of tokens
|
||||
delete tokens;
|
||||
return ival;
|
||||
}
|
||||
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(1));
|
||||
str = ostr->GetString();
|
||||
if (str.IsDigit())
|
||||
ival = str.Atoi();
|
||||
|
||||
delete tokens;
|
||||
|
||||
return ival;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetRunNumber (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* \param runNumber
|
||||
*/
|
||||
void TPsiRunHeader::SetRunNumber(Int_t runNumber)
|
||||
{
|
||||
char str[1024];
|
||||
sprintf(str, "%02d - run number: %06d", TPRH_RUN_NUMBER_IDX, runNumber);
|
||||
|
||||
fRunNumber.SetString(str);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetLab (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
TString TPsiRunHeader::GetLab() const
|
||||
{
|
||||
return GetInfoString(fLaboratory);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetLab (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* \param lab
|
||||
*/
|
||||
void TPsiRunHeader::SetLab(TString lab)
|
||||
{
|
||||
char str[1024];
|
||||
sprintf(str, "%02d - laboratory: %s", TPRH_LABORATORY_IDX, lab.Data());
|
||||
|
||||
fLaboratory.SetString(str);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetInstrument (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
TString TPsiRunHeader::GetInstrument() const
|
||||
{
|
||||
return GetInfoString(fInstrument);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetInstrument (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* \param instrument
|
||||
*/
|
||||
void TPsiRunHeader::SetInstrument(TString instrument)
|
||||
{
|
||||
char str[1024];
|
||||
sprintf(str, "%02d - instrument: %s", TPRH_INSTRUMENT_IDX, instrument.Data());
|
||||
|
||||
fInstrument.SetString(str);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetSetup (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
TString TPsiRunHeader::GetSetup() const
|
||||
{
|
||||
return GetInfoString(fSetup);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetSetup (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* \param setup
|
||||
*/
|
||||
void TPsiRunHeader::SetSetup(TString setup)
|
||||
{
|
||||
char str[1024];
|
||||
sprintf(str, "%02d - setup: %s", TPRH_SETUP_IDX, setup.Data());
|
||||
|
||||
fSetup.SetString(str);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetSample (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
TString TPsiRunHeader::GetSample() const
|
||||
{
|
||||
return GetInfoString(fSample);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetSample (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* \param sample
|
||||
*/
|
||||
void TPsiRunHeader::SetSample(TString sample)
|
||||
{
|
||||
char str[1024];
|
||||
sprintf(str, "%02d - sample: %s", TPRH_SAMPLE_IDX, sample.Data());
|
||||
|
||||
fSample.SetString(str);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetOrientation (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
TString TPsiRunHeader::GetOrientation() const
|
||||
{
|
||||
return GetInfoString(fOrientation);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// SetOrientation (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* \param orientation
|
||||
*/
|
||||
void TPsiRunHeader::SetOrientation(TString orientation)
|
||||
{
|
||||
char str[1024];
|
||||
sprintf(str, "%02d - orientation: %s", TPRH_ORIENTATION_IDX, orientation.Data());
|
||||
|
||||
fOrientation.SetString(str);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// AddProperty (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* \param property
|
||||
*/
|
||||
void TPsiRunHeader::AddProperty(TPsiRunProperty &property)
|
||||
{
|
||||
TPsiRunProperty *prop = (TPsiRunProperty*) property.Clone();
|
||||
fProperties.AddLast(prop);
|
||||
|
||||
char str[1024];
|
||||
TObjString *tostr;
|
||||
sprintf(str, "%02d - %s: %lf +- %lf (%s)", TPRH_OFFSET+fPropertiesList.GetLast(),
|
||||
prop->GetName().GetString().Data(), prop->GetValue(), prop->GetError(), prop->GetUnit().GetString().Data());
|
||||
tostr = new TObjString(str);
|
||||
fPropertiesList.AddLast(tostr);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// AddProperty (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* \param name
|
||||
* \param value
|
||||
* \param error
|
||||
* \param unit
|
||||
*/
|
||||
void TPsiRunHeader::AddProperty(TString name, Double_t value, Double_t error, TString unit)
|
||||
{
|
||||
TPsiRunProperty prop(name, value, error, unit);
|
||||
TPsiRunProperty *p_prop = (TPsiRunProperty*) prop.Clone();
|
||||
|
||||
fProperties.AddLast(p_prop);
|
||||
|
||||
char str[1024];
|
||||
TObjString *tostr;
|
||||
sprintf(str, "%02d - %s: %lf +- %lf (%s)", TPRH_OFFSET+fPropertiesList.GetLast(),
|
||||
name.Data(), value, error, unit.Data());
|
||||
tostr = new TObjString(str);
|
||||
fPropertiesList.AddLast(tostr);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// DumpHeader (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
void TPsiRunHeader::DumpHeader() const
|
||||
{
|
||||
int old_width = cout.width();
|
||||
TPsiRunProperty *prop;
|
||||
|
||||
// get maximal length of the property names
|
||||
int name_width = 8; // init to max. length of fixed names like: version, etc.
|
||||
for (Int_t i=0; i<=fProperties.GetLast(); i++) {
|
||||
prop = (TPsiRunProperty*)(fProperties[i]);
|
||||
if (prop->GetName().GetString().Length() > name_width)
|
||||
name_width = prop->GetName().GetString().Length();
|
||||
}
|
||||
name_width++;
|
||||
|
||||
// write SVN versions
|
||||
cout << endl << setw(name_width) << left << "version" << setw(old_width) << ": " << GetVersion().Data();
|
||||
|
||||
// write run title
|
||||
cout << endl << setw(name_width) << left << "run title" << setw(old_width) << ": " << GetRunTitle().Data();
|
||||
|
||||
// write run number
|
||||
cout << endl << setw(name_width) << left << "run number" << setw(old_width) << ": " << GetRunNumber();
|
||||
|
||||
// write laboratory
|
||||
cout << endl << setw(name_width) << left << "laboratory" << setw(old_width) << ": " << GetLab().Data();
|
||||
|
||||
// write instrument
|
||||
cout << endl << setw(name_width) << left << "instrument" << setw(old_width) << ": " << GetInstrument().Data();
|
||||
|
||||
// write setup
|
||||
cout << endl << setw(name_width) << left << "setup" << setw(old_width) << ": " << GetSetup().Data();
|
||||
|
||||
// write sample
|
||||
cout << endl << setw(name_width) << left << "sample" << setw(old_width) << ": " << GetSample().Data();
|
||||
|
||||
// write orientation
|
||||
cout << endl << setw(name_width) << left << "orientation" << setw(old_width) << ": " << GetOrientation().Data();
|
||||
|
||||
for (Int_t i=0; i<=fProperties.GetLast(); i++) {
|
||||
prop = (TPsiRunProperty*)(fProperties[i]);
|
||||
cout << endl << setw(name_width) << left << prop->GetName().GetString().Data() << setw(old_width) << ": " << prop->GetValue() << " +- " << prop->GetError();
|
||||
if (prop->GetUnit().GetString().CompareTo("n/a", TString::kIgnoreCase)) {
|
||||
cout << " " << prop->GetUnit().GetString().Data();
|
||||
}
|
||||
}
|
||||
cout << endl << endl;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// DrawHeader (public)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
void TPsiRunHeader::DrawHeader() const
|
||||
{
|
||||
TPaveText *pt;
|
||||
TCanvas *ca;
|
||||
|
||||
ca = new TCanvas("PSI RunHeader","PSI RunHeader", 147,37,699,527);
|
||||
ca->Range(0., 0., 100., 100.);
|
||||
|
||||
pt = new TPaveText(10.,10.,90.,90.,"br");
|
||||
pt->SetFillColor(19);
|
||||
pt->SetTextAlign(12);
|
||||
|
||||
pt->Draw();
|
||||
|
||||
ca->Modified(kTRUE);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// GetInfoString (private)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* \param tostr a TObjString with a content structure "%s: %s".
|
||||
*/
|
||||
TString TPsiRunHeader::GetInfoString(const TObjString &tostr) const
|
||||
{
|
||||
TObjArray *tokens = 0;
|
||||
TObjString *ostr = 0;
|
||||
TString str("??");
|
||||
|
||||
tokens = tostr.GetString().Tokenize(":");
|
||||
if (!tokens) { // couldn't get tokens
|
||||
return str;
|
||||
}
|
||||
if (tokens->GetEntries() != 2) { // wrong number of tokens
|
||||
delete tokens;
|
||||
return str;
|
||||
}
|
||||
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(1));
|
||||
str = ostr->GetString();
|
||||
str.Remove(TString::kLeading, ' ');
|
||||
|
||||
delete tokens;
|
||||
|
||||
return str;
|
||||
}
|
116
src/tests/PsiRoot/TPsiRunHeader.h
Normal file
116
src/tests/PsiRoot/TPsiRunHeader.h
Normal file
@ -0,0 +1,116 @@
|
||||
/***************************************************************************
|
||||
|
||||
TPsiRunHeader.h
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
$Id$
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2011 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 TPSIRUNHEADER_H
|
||||
#define TPSIRUNHEADER_H
|
||||
|
||||
#include <TObject.h>
|
||||
#include <TObjString.h>
|
||||
#include <TObjArray.h>
|
||||
|
||||
class TPsiRunProperty : public TObject
|
||||
{
|
||||
public:
|
||||
TPsiRunProperty();
|
||||
TPsiRunProperty(TObjString &name, Double_t value, Double_t error, TObjString &unit);
|
||||
TPsiRunProperty(TString &name, Double_t value, Double_t error, TString &unit);
|
||||
virtual ~TPsiRunProperty();
|
||||
|
||||
virtual TObjString GetName() { return fName; }
|
||||
virtual Double_t GetValue() { return fValue; }
|
||||
virtual Double_t GetError() { return fError; }
|
||||
virtual TObjString GetUnit() { return fUnit; }
|
||||
|
||||
virtual void SetName(TObjString &name) { fName = name; }
|
||||
virtual void SetName(TString &name) { fName = name.Data(); }
|
||||
virtual void SetName(const char *name) { fName = name; }
|
||||
virtual void SetValue(Double_t val) { fValue = val; }
|
||||
virtual void SetError(Double_t err) { fError = err; }
|
||||
virtual void SetUnit(TObjString &unit) { fUnit = unit; }
|
||||
virtual void SetUnit(TString &unit) { fUnit = unit.Data(); }
|
||||
virtual void SetUnit(const char *unit) { fUnit = unit; }
|
||||
|
||||
private:
|
||||
TObjString fName;
|
||||
Double_t fValue;
|
||||
Double_t fError;
|
||||
TObjString fUnit;
|
||||
|
||||
ClassDef(TPsiRunProperty, 1)
|
||||
};
|
||||
|
||||
class TPsiRunHeader : public TObject
|
||||
{
|
||||
public:
|
||||
TPsiRunHeader();
|
||||
virtual ~TPsiRunHeader();
|
||||
|
||||
virtual TString GetVersion() const;
|
||||
virtual TString GetRunTitle() const;
|
||||
virtual Int_t GetRunNumber() const;
|
||||
virtual TString GetLab() const;
|
||||
virtual TString GetInstrument() const;
|
||||
virtual TString GetSetup() const;
|
||||
virtual TString GetSample() const;
|
||||
virtual TString GetOrientation() const;
|
||||
virtual TObjArray *GetProperties() { return &fProperties; }
|
||||
|
||||
virtual void SetRunTitle(TString runTitle);
|
||||
virtual void SetRunNumber(Int_t runNumber);
|
||||
virtual void SetLab(TString lab);
|
||||
virtual void SetInstrument(TString insturment);
|
||||
virtual void SetSetup(TString setup);
|
||||
virtual void SetSample(TString sample);
|
||||
virtual void SetOrientation(TString setup);
|
||||
virtual void AddProperty(TPsiRunProperty &property);
|
||||
virtual void AddProperty(TString name, Double_t value, Double_t error, TString unit);
|
||||
|
||||
virtual void DumpHeader() const;
|
||||
virtual void DrawHeader() const;
|
||||
|
||||
private:
|
||||
TObjString fVersion; /// SVN version of the TPsiRunHeader
|
||||
TObjString fRunTitle; /// run title
|
||||
TObjString fRunNumber; /// run number
|
||||
TObjString fLaboratory; /// laboratory: PSI
|
||||
TObjString fInstrument; /// instrument name like: GPS, LEM, ....
|
||||
TObjString fSetup; /// setup
|
||||
TObjString fSample; /// sample name
|
||||
TObjString fOrientation; /// sample orientation
|
||||
TObjArray fPropertiesList;
|
||||
TObjArray fProperties;
|
||||
|
||||
virtual TString GetInfoString(const TObjString &tostr) const;
|
||||
|
||||
ClassDef(TPsiRunHeader, 1)
|
||||
};
|
||||
|
||||
#endif // TPSIRUNHEADER_H
|
41
src/tests/PsiRoot/TPsiRunHeaderLinkDef.h
Normal file
41
src/tests/PsiRoot/TPsiRunHeaderLinkDef.h
Normal file
@ -0,0 +1,41 @@
|
||||
/***************************************************************************
|
||||
|
||||
TPsiRunHeaderLinkDef.h
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
$Id$
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2011 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 TPsiRunProperty+;
|
||||
#pragma link C++ class TPsiRunHeader+;
|
||||
|
||||
#endif
|
91
src/tests/PsiRoot/psi_runHeader_test.cpp
Normal file
91
src/tests/PsiRoot/psi_runHeader_test.cpp
Normal file
@ -0,0 +1,91 @@
|
||||
/***************************************************************************
|
||||
|
||||
psi_runHeader_test.cpp
|
||||
|
||||
Author: Andreas Suter
|
||||
e-mail: andreas.suter@psi.ch
|
||||
|
||||
$Id$
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2007-2011 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 "TPsiRunHeader.h"
|
||||
|
||||
void psi_runHeader_test_syntax()
|
||||
{
|
||||
cout << endl << "usage: psi_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) {
|
||||
psi_runHeader_test_syntax();
|
||||
return 1;
|
||||
}
|
||||
|
||||
TFile *f = new TFile(argv[1], "RECREATE", "psi_runHeader_test");
|
||||
if (f->IsZombie()) {
|
||||
delete f;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// root file header related things
|
||||
TFolder *runInfo = gROOT->GetRootFolder()->AddFolder("RunInfo", "PSI RunInfo");
|
||||
gROOT->GetListOfBrowsables()->Add(runInfo, "RunInfo");
|
||||
|
||||
TPsiRunHeader *header = new TPsiRunHeader();
|
||||
|
||||
runInfo->Add(header); // add header to RunInfo folder
|
||||
|
||||
header->SetRunTitle("This is a run title");
|
||||
header->SetRunNumber(12345);
|
||||
header->SetLab("PSI");
|
||||
header->SetInstrument("LEM");
|
||||
header->SetSetup("Konti-4, WEW");
|
||||
header->SetSample("Eu2CuO4 MOD thin film");
|
||||
header->SetOrientation("c-axis perp to spin");
|
||||
|
||||
header->AddProperty("T0", 30.01, 0.05, "K");
|
||||
header->AddProperty("T1", 30.03, 0.03, "K");
|
||||
header->AddProperty("Field", 3.03, 0.03, "T");
|
||||
header->AddProperty("ThisIsAVeryLongPropertyName", 3.03, 0.03, "SI-Unit");
|
||||
|
||||
header->DumpHeader();
|
||||
|
||||
runInfo->Write();
|
||||
|
||||
f->Close();
|
||||
|
||||
delete f;
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user