Skip to content

Commit 1ebbca8

Browse files
committed
Initial changes to remove cernlib dependency
1 parent 0bef3b5 commit 1ebbca8

16 files changed

+640
-59
lines changed

CTP/Makefile.Unix

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,16 @@ endif
2828

2929
include ../Makefile.etc
3030

31+
#ctp_sources = thTest.c thTestParse.c thTestExecute.c thHandlers.c thParm.c \
32+
# thUtils.c thLoad.c thGroup.c thHist.c thReport.c thGethit.c \
33+
# daVarRegister.c daVarRpcProc.c daVarHandlers.c daVarServ.c \
34+
# daVarRpc_svc.c daVarRpc_xdr.c daVarHashLib.c thTree.c
35+
3136
ctp_sources = thTest.c thTestParse.c thTestExecute.c thHandlers.c thParm.c \
32-
thUtils.c thLoad.c thGroup.c thHist.c thReport.c thGethit.c \
37+
thUtils.c thLoad.c thGroup.c thReport.c \
3338
daVarRegister.c daVarRpcProc.c daVarHandlers.c daVarServ.c \
3439
daVarRpc_svc.c daVarRpc_xdr.c daVarHashLib.c thTree.c
40+
3541
ctpclient_sources = daVarRpc_xdr.c daVarRpc_clnt.c thClient.c
3642

3743
lib_targets := $(patsubst %.c, libctp.a(%.o), $(ctp_sources)) \

CTP/thGroup.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,11 @@ typedef struct thHook thHook;
8585
/* How many of these c routines are "advertised */
8686
thHook thHooks[] = {
8787
{PARMSTR ,thLoadParameters,0,0,0,0,0,0},
88-
{GETHITSTR ,thBookGethits,thExecuteaGethitBlock,0,0,0,0,0},
88+
/*{GETHITSTR ,thBookGethits,thExecuteaGethitBlock,0,0,0,0,0},*/
8989
{TESTSTR ,thBookTests,thExecuteTestsV,thClearTestFlagsV,thClearTestScalersV
9090
,thIncTestScalersV,0,0},
91-
{HISTSTR,thBookHists,thExecuteHistsV,thClearHistsV,0,0,0,0},
92-
{UHISTSTR,thBookHists,0,0,0,0,0,0},
91+
/*{HISTSTR,thBookHists,thExecuteHistsV,thClearHistsV,0,0,0,0},*/
92+
/*{UHISTSTR,thBookHists,0,0,0,0,0,0},*/
9393
{TREESTR,thBookTree,thFillTreeV,thClearTreeV,0,0,thWriteTreeV,thCloseTreeV},
9494
{REPORTSTR,thBookReports,0,0,0,0,0,0},
9595
{0,0,0,0,0,0,0,0}};

CTP/thHandlers.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ daVarStatus thHistRHandler(char *name, daVarStruct *varclass, any *retval)
160160
retval->any_u.error = S_DAVAR_UNKATTR;
161161
if(thLastIdRhandled != *((DAINT *) varp->varptr)) {
162162
thLastIdRhandled = *((DAINT *) varp->varptr);
163-
HGIVE(*((DAINT *) varp->varptr),chtitle,NX,XMI,XMA,NY,YMI,YMA
164-
,NWT,LOC);
163+
/*HGIVE(*((DAINT *) varp->varptr),chtitle,NX,XMI,XMA,NY,YMI,YMA
164+
,NWT,LOC);*/
165165
}
166166
if(strcasecmp(attribute,TH_ND) == 0){
167167
retval->valtype = DAVARINT_RPC;
@@ -207,7 +207,7 @@ daVarStatus thHistRHandler(char *name, daVarStruct *varclass, any *retval)
207207
retval->any_u.r.r_val = (float *)malloc(size*sizeof(float));
208208
/* Next line gives warning "assignment of read-only location */
209209
char tmpstring[] = "HIST";
210-
HUNPAK(thLastIdRhandled,retval->any_u.r.r_val,tmpstring,(int) 1);
210+
/*HUNPAK(thLastIdRhandled,retval->any_u.r.r_val,tmpstring,(int) 1);*/
211211
}
212212
}
213213
return(status);

CTP/thLoad.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ extern daVarStatus thRHandler();*/
125125
char *types[]={PARMSTR, GETHITSTR, TESTSTR, HISTSTR, UHISTSTR,
126126
TREESTR,
127127
REPORTSTR, 0};
128-
thStatus (*hooks[])()={thLoadParameters, thBookGethits, thBookTests,
129-
thBookHists, thBookHists,
128+
thStatus (*hooks[])()={thLoadParameters, /*thBookGethits,*/ thBookTests,
129+
/*thBookHists, thBookHists,*/
130130
thBookTree,
131131
thBookReports, 0};
132132

Makefile

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,8 @@
33
## These will have to be modified when setting up your own simc. They
44
## point to the software necessary to run simc.
55

6-
## ARGONNE DEFAULT SETUP FLAGS:
7-
#simcdir = .
8-
#Csoft = /disk1/users/reinhold/Csoft/05Dec1996
9-
106
## CEBAF DEFAULT SETUP FLAGS:
117
simcdir = .
12-
#Csoft = /group/hallc/Csoft/Analyzer
13-
#Csoft = /group/c-gep/jones/Linux_fc8/
14-
15-
## U Regina SETUP FLAGS
16-
simcdir = .
17-
Csoft = /home/huberg/r2d2/simc/
188

199
## THE REST SHOULD BE OK WITHOUT MODIFICATION.
2010

@@ -31,11 +21,12 @@ A = $(simcdir)/shared/
3121
SH = $(simcdir)/shms/
3222
T = $(simcdir)/cteq5/
3323
C = $(simcdir)/calo/
24+
CH = $(simcdir)/cern/
3425

3526
OBJ1 = target.o brem.o gauss1.o NtupleInit.o NtupleClose.o enerloss_new.o
3627
OBJ2 = radc.o init.o dbase.o physics_kaon.o physics_pion.o physics_delta.o physics_proton.o loren.o sf_lookup.o
3728
OBJ3 = semi_physics.o rho_physics.o rho_decay.o generate_rho.o trg_track.o semi_dilution.o
38-
OBJ4 = results_write.o event.o ranlux.o jacobians.o
29+
OBJ4 = results_write.o event.o call_ranlux.o jacobians.o
3930
OBJ5 = $(A)musc.o $(A)musc_ext.o $(A)project.o $(A)transp.o
4031
OBJ6 = $(A)rotate_haxis.o $(A)rotate_vaxis.o $(A)locforunt.o
4132
OBJ7 = $(H)mc_hms.o $(H)mc_hms_hut.o $(H)mc_hms_recon.o
@@ -45,13 +36,16 @@ OBJA = $(L)mc_hrsl.o $(L)mc_hrsl_hut.o $(L)mc_hrsl_recon.o
4536
OBJB = $(SH)mc_shms.o $(SH)mc_shms_hut.o $(SH)mc_shms_recon.o
4637
OBJC = $(T)Ctq5Pdf.o
4738
OBJD = $(C)mc_calo.o $(C)mc_calo_recon.o
48-
my_objs = $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) $(OBJ5) $(OBJ6) $(OBJ7) $(OBJ8) $(OBJ9) $(OBJA) $(OBJB) $(OBJC) $(OBJD)
39+
OBJCH = $(CH)lfit.o $(CH)ranlux.o $(CH)fint.o $(CH)kerset.o $(CH)abend.o
40+
41+
my_objs = $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) $(OBJ5) $(OBJ6) $(OBJ7) $(OBJ8) $(OBJ9) $(OBJA) $(OBJB) $(OBJC) $(OBJD) $(OBJCH)
4942

5043
my_deps = $(my_objs:.o=.d)
5144

5245
MYOS := $(subst -,,$(shell uname))
5346
#CERNLIBS = -lgeant$(GEANTVER) -lpawlib -lgraflib -lgrafX11 -lpacklib -lmathlib
54-
CERNLIBS = -Wl,-static -lgeant$(GEANTVER) -lpawlib -lgraflib -lgrafX11 -lpacklib -lkernlib -lmathlib -ljetset74 -Wl,-dy
47+
#CERNLIBS = -Wl,-static -lgeant$(GEANTVER) -lpawlib -lgraflib -lgrafX11 -lpacklib -lkernlib -lmathlib -ljetset74 -Wl,-dy
48+
5549

5650
#For use with gfortran compiler
5751
# -fno-automatic - all program storage treated as static
@@ -68,7 +62,7 @@ ifeq ($(MYOS),Linux)
6862
FFLAGS= $(INCLUDES) $(FFLAGSA)
6963
FFLAG1=$(FFLAGS) -c
7064
OTHERLIBS = -L$(LIBROOT) -lctp \
71-
-L$(CERN_ROOT)/lib $(CERNLIBS) -L/usr/lib64
65+
-L$(CERN_ROOT)/lib -L/usr/lib64
7266
# 64 vs 32 bit
7367
# -L$(CERN_ROOT)/lib $(CERNLIBS) -L/usr/lib
7468
FC := gfortran
@@ -113,6 +107,10 @@ $(R)/%.o: $(R)/%.f
113107
$(SH)/%.o: $(SH)/%.f
114108
$(F77) $(FFLAGS) -c $< -o $@
115109

110+
$(CH)/%.o: $(SH)/%.f
111+
$(F77) $(FFLAGS) -c $< -o $@
112+
113+
116114
DEPEND_RULE = ( cat $< | sed -n -e \
117115
"s|^[ ]*[Ii][Nn][Cc][Ll][Uu][Dd][Ee][ ]*['\"]|$@: $(@D)/|p" | \
118116
sed -e "s|['\"].*$$||" | \
@@ -164,7 +162,7 @@ CTP/O.Linux/Linux/lib/libctp.a:
164162

165163

166164
clean:
167-
$(RM) *.[od] $(H)*.[od] $(S)*.[od] $(L)*.[od] $(R)*.[od] $(SH)*.[od] $(A)*.[od] $(T)*.[od] $(C)*.[od] simc
165+
$(RM) *.[od] $(H)*.[od] $(S)*.[od] $(L)*.[od] $(R)*.[od] $(SH)*.[od] $(A)*.[od] $(T)*.[od] $(C)*.[od] $(CH)*.[od] simc
168166

169167
real_clean:
170168
$(RM) *.[od] $(H)*.[od] $(S)*.[od] $(L)*.[od] $(R)*.[od] $(SH)*.[od] $(A)*.[od] $(T)*.[od] $(C)*.[od] simc

NtupleClose.f

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ subroutine NtupleClose(filename)
77
character*80 filename
88
integer*4 cycle
99

10-
cycle= 0 !dummy for HROUT
11-
call HCDIR(NtupleDirectory,' ')
12-
call HROUT(NtupleID,cycle,' ') !flush CERNLIB buffers
13-
call HREND(NtupleName) !CERNLIB close file
14-
write(6,*)'Closing file:',filename(1:60)
10+
c cycle= 0 !dummy for HROUT
11+
c call HCDIR(NtupleDirectory,' ')
12+
c call HROUT(NtupleID,cycle,' ') !flush CERNLIB buffers
13+
c call HREND(NtupleName) !CERNLIB close file
14+
c write(6,*)'Closing file:',filename(1:60)
1515
CLOSE(NtupleIO) !close IO channel
1616

1717
return

NtupleInit.f

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,27 @@ subroutine NtupleInit(filename)
77

88
character*80 filename,directory
99
character*16 NtupleTag(80),name,title
10-
integer*4 m,io,recl,bank,id,status
11-
parameter(recl = 1024)
12-
parameter(bank = 8000)
10+
integer*4 m,io,recl,bank,id,status,i
11+
c parameter(recl = 1024)
12+
c parameter(bank = 8000)
1313
parameter(io = 29)
1414
parameter(name = 'SimcNtuple')
1515
parameter(title = 'SIMTUPLE')
1616

17-
NtupleID = defaultID
18-
id = NtupleID
17+
c NtupleID = defaultID
18+
c id = NtupleID
1919
NtupleIO = io
20-
NtupleName = name
20+
c NtupleName = name
2121

22-
call HCDIR(directory,'R') !CERNLIB read current directory
23-
call HROPEN(io,name,filename,'N',recl,status) !CERNLIB
22+
c call HCDIR(directory,'R') !CERNLIB read current directory
23+
c call HROPEN(io,name,filename,'N',recl,status) !CERNLIB
2424
!directory set to "//TUPLE"
25-
if (status.ne.0)then
26-
write(6,*) 'HROPEN error: istat=',status
27-
stop
28-
endif
25+
c if (status.ne.0)then
26+
c write(6,*) 'HROPEN error: istat=',status
27+
c stop
28+
c endif
29+
30+
open(NtupleIO,file=filename,form="unformatted",access="sequential")
2931

3032
m = 0
3133
m = m+1
@@ -279,11 +281,17 @@ subroutine NtupleInit(filename)
279281

280282
NtupleSize = m
281283

282-
call HBOOKN(id,title,NtupleSize,name,bank,NtupleTag) !create Ntuple
283-
284-
call HCDIR(NtupleDirectory,'R') !record Ntuple directory
284+
c call HBOOKN(id,title,NtupleSize,name,bank,NtupleTag) !create Ntuple
285+
c
286+
c call HCDIR(NtupleDirectory,'R') !record Ntuple directory
287+
c
288+
c call HCDIR(directory,' ') !reset CERNLIB directory
285289

286-
call HCDIR(directory,' ') !reset CERNLIB directory
290+
c write ntuple size first
291+
write(NtupleIO) NtupleSize
292+
do i=1,m
293+
write(NtupleIO) NtupleTag(i)
294+
enddo
287295

288296
return
289297
end

ranlux.f renamed to call_ranlux.f

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ subroutine start_file_random_state(fname)
5858
double precision function grnd()
5959
implicit none
6060
integer len/1000/,latest,i
61-
real*4 rvec(1000)
61+
c real*4 rvec(1000)
62+
real*8 rvec(1000)
6263

6364
if(latest.le.0 .or. latest.ge.1000) then
6465
CALL RANLUX(RVEC,LEN)

cern/abend.f

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
*
2+
* $Id: abend.F,v 1.1.1.1 1996/02/15 17:48:36 mclareni Exp $
3+
*
4+
* $Log: abend.F,v $
5+
* Revision 1.1.1.1 1996/02/15 17:48:36 mclareni
6+
* Kernlib
7+
*
8+
*
9+
#include "kernnumt/pilot.h"
10+
SUBROUTINE ABEND
11+
#include "kernnumt/sysdat.inc"
12+
IF(LGFILE .EQ. 0) WRITE(*,1000)
13+
IF(LGFILE .NE. 0) WRITE(LGFILE,1000)
14+
RETURN
15+
1000 FORMAT(31H ABEND ROUTINE HAS BEEN CALLED.)
16+
END

cern/fint.f

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
*
2+
* $Id: fint.F,v 1.1.1.1 1996/02/15 17:48:36 mclareni Exp $
3+
*
4+
* $Log: fint.F,v $
5+
* Revision 1.1.1.1 1996/02/15 17:48:36 mclareni
6+
* Kernlib
7+
*
8+
*
9+
#include "kernnum/pilot.h"
10+
FUNCTION FINT(NARG,ARG,NENT,ENT,TABLE)
11+
C
12+
C INTERPOLATION ROUTINE. AUTHOR C. LETERTRE.
13+
C MODIFIED BY B. SCHORR, 1.07.1982.
14+
C
15+
INTEGER NENT(9)
16+
REAL*4 ARG(9), ENT(9), TABLE(9)
17+
INTEGER INDEX(32)
18+
REAL WEIGHT(32)
19+
LOGICAL MFLAG, RFLAG
20+
FINT = 0.
21+
IF(NARG .LT. 1 .OR. NARG .GT. 5) GOTO 300
22+
LMAX = 0
23+
ISTEP = 1
24+
KNOTS = 1
25+
INDEX(1) = 1
26+
WEIGHT(1) = 1.
27+
DO 100 N = 1, NARG
28+
X = ARG(N)
29+
NDIM = NENT(N)
30+
LOCA = LMAX
31+
LMIN = LMAX + 1
32+
LMAX = LMAX + NDIM
33+
IF(NDIM .GT. 2) GOTO 10
34+
IF(NDIM .EQ. 1) GOTO 100
35+
H = X - ENT(LMIN)
36+
IF(H .EQ. 0.) GOTO 90
37+
ISHIFT = ISTEP
38+
IF(X-ENT(LMIN+1) .EQ. 0.) GOTO 21
39+
ISHIFT = 0
40+
ETA = H / (ENT(LMIN+1) - ENT(LMIN))
41+
GOTO 30
42+
10 LOCB = LMAX + 1
43+
11 LOCC = (LOCA+LOCB) / 2
44+
IF(X-ENT(LOCC)) 12, 20, 13
45+
12 LOCB = LOCC
46+
GOTO 14
47+
13 LOCA = LOCC
48+
14 IF(LOCB-LOCA .GT. 1) GOTO 11
49+
LOCA = MIN0( MAX0(LOCA,LMIN), LMAX-1 )
50+
ISHIFT = (LOCA - LMIN) * ISTEP
51+
ETA = (X - ENT(LOCA)) / (ENT(LOCA+1) - ENT(LOCA))
52+
GOTO 30
53+
20 ISHIFT = (LOCC - LMIN) * ISTEP
54+
21 DO 22 K = 1, KNOTS
55+
INDEX(K) = INDEX(K) + ISHIFT
56+
22 CONTINUE
57+
GOTO 90
58+
30 DO 31 K = 1, KNOTS
59+
INDEX(K) = INDEX(K) + ISHIFT
60+
INDEX(K+KNOTS) = INDEX(K) + ISTEP
61+
WEIGHT(K+KNOTS) = WEIGHT(K) * ETA
62+
WEIGHT(K) = WEIGHT(K) - WEIGHT(K+KNOTS)
63+
31 CONTINUE
64+
KNOTS = 2*KNOTS
65+
90 ISTEP = ISTEP * NDIM
66+
100 CONTINUE
67+
DO 200 K = 1, KNOTS
68+
I = INDEX(K)
69+
FINT = FINT + WEIGHT(K) * TABLE(I)
70+
200 CONTINUE
71+
RETURN
72+
300 CALL KERMTR('E104.1',LGFILE,MFLAG,RFLAG)
73+
IF(MFLAG) THEN
74+
IF(LGFILE .EQ. 0) THEN
75+
WRITE(*,1000) NARG
76+
ELSE
77+
WRITE(LGFILE,1000) NARG
78+
ENDIF
79+
ENDIF
80+
IF(.NOT. RFLAG) CALL ABEND
81+
RETURN
82+
1000 FORMAT( 7X, 24HFUNCTION FINT ... NARG =,I6,
83+
+ 17H NOT WITHIN RANGE)
84+
END

0 commit comments

Comments
 (0)