Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devauto #2

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions OnlineAnalysis/AutomaticAnalysis/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
MAIN_DIR = ${GO_DIR}/SIDSRoot/OnlineAnalysis/AutomaticAnalysis
PACKAGE = PVWAVE2ESRIO
WAVE_EXE = ${WAVE_DIR}/bin/bin.linux64/wave
SED_EXE = sed
C_DIR = c
SO_DIR = c
SOLIB = ${SO_DIR}/${PACKAGE}.so
ESRIOLIB = ${SO_DIR}/EsrIO.so
makeall_profile = ${PACKAGE}makeall.pro
init_infile = ac-stuff/${PACKAGE}init.in
init_profile = ${PACKAGE}init.pro

CXX = $(shell root-config --cxx)
LD = $(shell root-config --ld)
CINT = rootcint

OS_NAME:=$(shell uname -s | tr A-Z a-z)
ifeq ($(OS_NAME),darwin)
STDINCDIR := /opt/local/include
STDLIBDIR := /opt/local/lib
else
STDINCDIR := -I${C_DIR} -I${ESRIO} -I${ESRIO}/../SubTask -I${SIMPATH}/include
STDLIBDIR :=
endif

CPPFLAGS := $(shell root-config --cflags) -I$(STDINCDIR)
LDFLAGS := $(shell root-config --glibs) -L$(STDLIBDIR)

CPPFLAGS += -g -fPIC -std=c++11
LDFLAGS += -lgsl -lgslcblas -lfftw3 -lm

TARGET = ${SOLIB}

SRC = ${C_DIR}/esrio_cw.c

esrio_srcfiles = \
${ESRIO}/EsrSMSEvent.cxx \
${ESRIO}/EsrDecayEvent.cxx \
${ESRIO}/EsrBinDecayEvent.cxx \
${ESRIO}/EsrInjData.cxx \
${ESRIO}/../SubTask/EsrTree.cxx \
${C_DIR}/esrio_dict.cxx
esrio_hfiles = \
${ESRIO}/EsrSMSEvent.h \
${ESRIO}/EsrDecayEvent.h \
${ESRIO}/EsrBinDecayEvent.h \
${ESRIO}/EsrInjData.h \
${ESRIO}/../SubTask/EsrTree.h

esrio_objfiles = $(esrio_srcfiles:.cxx=.o)

OBJ = $(SRC:.c=.o)

all : esriolib $(TARGET) initfile cprfiles

%.o : %.c
$(CXX) $(CPPFLAGS) -o $@ -c $< \
${STDINCDIR}

%.o : %.cxx
$(CXX) $(CPPFLAGS) -o $@ -c $< \
${STDINCDIR}

${C_DIR}/esrio_dict.cxx : $(esrio_hfiles) ${C_DIR}/esrio_linkdef.h
$(CINT) -f ${C_DIR}/esrio_dict.cxx -c $(esrio_hfiles) ${C_DIR}/esrio_linkdef.h

$(TARGET) : $(OBJ)
$(LD) $(CPPFLAGS) -shared -o ${SOLIB} $(OBJ) ${esrio_objfiles} $(LDFLAGS)

esriolib : ${esrio_objfiles}
$(LD) $(CPPFLAGS) -shared -o ${ESRIOLIB} ${esrio_objfiles}

initfile : \
${MAIN_DIR}/${init_infile}
@echo ""
@echo " ******************** Preparing ${init_profile}"
@echo ""
cd ${MAIN_DIR}; \
${SED_EXE} "s?${initpro}, xxx?${initpro}, '${MAIN_DIR}'?g" \
${init_infile} > ${init_profile}

cprfiles : \
${makeall_profile}
@echo ""
@echo " ******************** Preparing PV-WAVE files"
@echo ""
cd ${MAIN_DIR}; \
unset WAVE_STARTUP; ${WAVE_EXE} ${makeall_profile}

clean :
rm -f ${C_DIR}/*.o $(TARGET) $(ESRIOLIB) \
${esrio_objfiles} ${C_DIR}/esrio_dict.* \
*~
172 changes: 172 additions & 0 deletions OnlineAnalysis/AutomaticAnalysis/PVWAVE2ESRIOinit.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
pro PVWAVE2ESRIOinit, PVWAVE2ESRIOmaindir
;
; initializes PVWAVE2ESRIOmain.pro and PVWAVE2ESRIOstartup.pro
; PVWAVE2ESRIOstartup.pro contains PVWAVE2ESRIO PV-WAVE startup
; instructions which must be executed prior to usage of the PVWAVE2ESRIO
; functions. PVWAVE2ESRIOstartup.pro also includes a call to
; PVWAVE2ESRIOmain, which initialises the PVWAVE2ESRIO specific common
; block ESRIOcommon
;
declare func, PVWAVE2ESRIOmkstartup
declare func, PVWAVE2ESRIOmkmain


; create the programs
if (PVWAVE2ESRIOmkmain(PVWAVE2ESRIOmaindir) lt 0) then return
if (PVWAVE2ESRIOmkstartup(PVWAVE2ESRIOmaindir) lt 0) then return

return
end

; -----------------------------------------------------------------------------
function PVWAVE2ESRIOmkstartup, PVWAVE2ESRIOmaindir
;
; creates the file PVWAVE2ESRIOstartup.pro.
; PVWAVE2ESRIOstartup.pro contains PVWAVE2ESRIO specific PV-WAVE startup
; instructions. These instructions must be executed before PVWAVE2ESRIO is
; used. Include them in the PV-WAVE startup routine defined by the
; environmental variable WAVE_STARTUP or execute them to activate the
; PVWAVE2ESRIO functions.
;

; make sure that PVWAVE2ESRIOmaindir ends with a `/'
dnlen=strlen(PVWAVE2ESRIOmaindir)
if (strmid(PVWAVE2ESRIOmaindir,dnlen-1,1) ne "/") then $
PVWAVE2ESRIOmaindir=PVWAVE2ESRIOmaindir+"/"

; check if PVWAVE2ESRIOmaindir and all the subdirectories exist
dirs=PVWAVE2ESRIOmaindir+['','c','pro']
ndirs=n_elements(dirs)

for i=0,ndirs-1 do begin
stat=checkfile(dirs(i),/write,is_dir=is_dir)
if (stat ne 1 or is_dir ne 1) then begin
print
print, "Error: The directory, "+dirs(i)+" can not be accessed!"
print, "The procedure is stopped and no output is created!"
print
return, -2
endif
endfor


; create PVWAVE2ESRIOstartup.pro
PVWAVE2ESRIO_PROGS=PVWAVE2ESRIOmaindir+"pro"
fname=PVWAVE2ESRIOmaindir+'PVWAVE2ESRIOstartup.pro'
openw,fid,fname,error=error,/get_lun
if (error ne 0) then begin
print
print, "Error: The file, "+fname+" could not be opened!"
print, "The procedure is stopped and no output is created!"
print
return, -1
endif

printf,fid,"; PVWAVE2ESRIOstartup.pro"
printf,fid,";"
printf,fid,"; PVWAVE2ESRIOstartup.pro contains PVWAVE2ESRIO specific "+ $
"PV-WAVE startup"
printf,fid,"; instructions. These instructions must be executed to "+ $
"activate the"
printf,fid,"; PVWAVE2ESRIO functions. Include them in the PV-WAVE "+ $
"startup routine"
printf,fid,"; defined by the environmental variable WAVE_STYARTUP or "+ $
"execute them before"
printf,fid,"; using a PVWAVE2ESRIO function."
printf,fid,""
printf,fid,"; ESRIO functions
printf,fid,"!path = !path+':"+PVWAVE2ESRIO_PROGS+"'"
printf,fid,"PVWAVE2ESRIOmain"


; close PVWAVE2ESRIOstartup.pro
close,fid
free_lun,fid

return, 0
end

; -----------------------------------------------------------------------------
function PVWAVE2ESRIOmkmain, PVWAVE2ESRIOmaindir
;
; creates the file PVWAVE2ESRIOmain.pro.
; PVWAVE2ESRIOmain.pro is used to initialise the PVWAVE2ESRIO specific common block
; ESRIOcommon
;

; make sure that PVWAVE2ESRIOmaindir ends with a `/'
dnlen=strlen(PVWAVE2ESRIOmaindir)
if (strmid(PVWAVE2ESRIOmaindir,dnlen-1,1) ne "/") then $
PVWAVE2ESRIOmaindir=PVWAVE2ESRIOmaindir+"/"

; check if PVWAVE2ESRIOmaindir and all the subdirectories exist
dirs=PVWAVE2ESRIOmaindir+['','c','pro']
ndirs=n_elements(dirs)

for i=0,ndirs-1 do begin
stat=checkfile(dirs(i),/write,is_dir=is_dir)
if (stat ne 1 or is_dir ne 1) then begin
print
print, "Error: The directory, "+dirs(i)+" can not be accessed!"
print, "The procedure is stopped and no output is created!"
print
return, -2
endif
endfor


; create PVWAVE2ESRIOmain.pro
PVWAVE2ESRIO_PROGS=PVWAVE2ESRIOmaindir+"pro"
fname=PVWAVE2ESRIO_PROGS+"/PVWAVE2ESRIOmain.pro"
openw,fid,fname,error=error,/get_lun
if (error ne 0) then begin
print
print, "Error: The file, "+fname+" could not be opened!"
print, "The procedure is stopped and no output is created!"
print
return, -1
endif


printf,fid,";+ --------------------------------------------------------"+ $
"---------------"
printf,fid,"; Author: P. Buehler"
printf,fid,"; Date: Summer 2014"
printf,fid,";"
printf,fid,"; NAME: PVWAVE2ESRIOmain"
printf,fid,"; PURPOSE: initialise the ESRIOobject"
printf,fid,";"
printf,fid,"; CALLING SEQUENCE:"
printf,fid,"; PVWAVE2ESRIOmain"
printf,fid,"; INPUTS:"
printf,fid,";"
printf,fid,"; OUTPUTS:"
printf,fid,";"
printf,fid,";- ---------------------------------------------------------"+ $
"--------------"
printf,fid,"pro PVWAVE2ESRIOmain"
printf,fid,";"
printf,fid,";"
printf,fid,";"
printf,fid,"common ESRIOcommon, ESRIOobject"
printf,fid,"ESRIOobject='"+PVWAVE2ESRIOmaindir+"c/PVWAVE2ESRIO.so"
printf,fid,""
printf,fid,"end"
printf,fid,""
printf,fid,";------------------------------------------------------------"+ $
"-------------"


; close PVWAVE2ESRIOmain.pro
close,fid
free_lun,fid

return, 0
end

; -----------------------------------------------------------------------------
PVWAVE2ESRIOinit, '/home/pbuehler/physics/projects/GO/2014/SIDSRoot/OnlineAnalysis/AutomaticAnalysis'

end

; -----------------------------------------------------------------------------
12 changes: 12 additions & 0 deletions OnlineAnalysis/AutomaticAnalysis/PVWAVE2ESRIOmakeall.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
; PVWAVE2ESRIOmakeall.pro
;
; Usage:
; > wave PVWAVE2ESRIOmakeall.pro
;

.run PVWAVE2ESRIOinit.pro

cd,'pro'
.run MAKER.PRO

exit
11 changes: 11 additions & 0 deletions OnlineAnalysis/AutomaticAnalysis/PVWAVE2ESRIOstartup.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
; PVWAVE2ESRIOstartup.pro
;
; PVWAVE2ESRIOstartup.pro contains PVWAVE2ESRIO specific PV-WAVE startup
; instructions. These instructions must be executed to activate the
; PVWAVE2ESRIO functions. Include them in the PV-WAVE startup routine
; defined by the environmental variable WAVE_STYARTUP or execute them before
; using a PVWAVE2ESRIO function.

; ESRIO functions
!path = !path+':/home/pbuehler/physics/projects/GO/2014/SIDSRoot/OnlineAnalysis/AutomaticAnalysis/pro'
PVWAVE2ESRIOmain
Loading