From d7bfa39d7647c954959e200aa09b982507538ebb Mon Sep 17 00:00:00 2001
From: Edward Brash <brash@jlab.org>
Date: Wed, 22 Jan 2014 12:46:58 -0500
Subject: [PATCH] Initial commit from within Eclipse

---
 SConstruct                       | 168 ++++++++++++++++++++++++++++++-
 examples/PARAM/52949/hcana.param |  80 ++++++++++++++-
 2 files changed, 246 insertions(+), 2 deletions(-)
 mode change 120000 => 100644 SConstruct
 mode change 120000 => 100644 examples/PARAM/52949/hcana.param

diff --git a/SConstruct b/SConstruct
deleted file mode 120000
index 0fe1cae..0000000
--- a/SConstruct
+++ /dev/null
@@ -1 +0,0 @@
-SConstruct.py
\ No newline at end of file
diff --git a/SConstruct b/SConstruct
new file mode 100644
index 0000000..6d89421
--- /dev/null
+++ b/SConstruct
@@ -0,0 +1,167 @@
+###### Hall C Software Main SConstruct Build File #####
+###### Author:	Edward Brash (brash@jlab.org) June 2013
+
+import os
+import sys
+import platform
+import commands
+import SCons
+
+def rootcint(target,source,env):
+	"""Executes the ROOT dictionary generator over a list of headers."""
+	dictname = target[0]
+	headers = ""
+	cpppath = env.subst('$_CCCOMCOM')
+	ccflags = env.subst('$CCFLAGS')
+	rootcint = env.subst('$ROOTCINT')
+	print "Doing rootcint call now ..."
+	for f in source:
+		headers += str(f) + " "
+	command = rootcint + " -f %s -c -pthread -fPIC %s %s" % (dictname,cpppath,headers)
+	print ('RootCint Command = %s\n' % command)
+	ok = os.system(command)
+	return ok
+
+baseenv = Environment(ENV = os.environ)
+#dict = baseenv.Dictionary()
+#keys = dict.keys()
+#keys.sort()
+#for key in keys:
+#	print "Construction variable = '%s', value = '%s'" % (key, dict[key])
+
+####### Check SCons version ##################
+print('!!! Building the Hall C analyzer and libraries with SCons requires')
+print('!!! SCons version 2.1.0 or newer.')
+EnsureSConsVersion(2,1,0)
+
+####### Hall A Build Environment #############
+#
+baseenv.Append(MAIN_DIR= Dir('.').abspath)
+baseenv.Append(HC_DIR= baseenv.subst('$MAIN_DIR'))
+baseenv.Append(HC_SRC= baseenv.subst('$HC_DIR')+'/src ') 
+baseenv.Append(HA_DIR= baseenv.subst('$HC_DIR')+'/podd ')
+baseenv.Append(HA_SRC= baseenv.subst('$HA_DIR')+'/src ') 
+baseenv.Append(HA_DC= baseenv.subst('$HA_DIR')+'/hana_decode ') 
+baseenv.Append(HA_SCALER= baseenv.subst('$HA_DIR')+'/hana_scaler ') 
+baseenv.Append(MAJORVERSION = '1')
+baseenv.Append(MINORVERSION = '5')
+baseenv.Append(PATCH = '25')
+baseenv.Append(SOVERSION = baseenv.subst('$MAJORVERSION')+'.'+baseenv.subst('$MINORVERSION'))
+baseenv.Append(VERSION = baseenv.subst('$SOVERSION')+'.'+baseenv.subst('$PATCH'))
+baseenv.Append(EXTVERS = '')
+baseenv.Append(HA_VERSION = baseenv.subst('$VERSION')+baseenv.subst('$EXTVERS'))
+print "Hall C Main Directory = %s" % baseenv.subst('$HC_DIR')
+print "Hall C Source Directory = %s" % baseenv.subst('$HC_SRC')
+print "Hall A Main Directory = %s" % baseenv.subst('$HA_DIR')
+print "Software Version = %s" % baseenv.subst('$VERSION')
+ivercode = 65536*int(float(baseenv.subst('$SOVERSION')))+ 256*int(10*(float(baseenv.subst('$SOVERSION'))-int(float(baseenv.subst('$SOVERSION')))))+ int(float(baseenv.subst('$PATCH')))
+baseenv.Append(VERCODE = ivercode)
+baseenv.Append(CPPPATH = ['$HC_SRC','$HA_SRC','$HA_DC','$HA_SCALER'])
+
+proceed = "1" or "y" or "yes" or "Yes" or "Y"
+######## Configure Section #######
+
+import configure
+configure.config(baseenv,ARGUMENTS)
+
+Export('baseenv')
+
+conf = Configure(baseenv)
+
+if not conf.CheckCXX():
+	print('!!! Your compiler and/or environment is not correctly configured.')
+	Exit(0)
+
+if not conf.CheckFunc('printf'):
+       	print('!! Your compiler and/or environment is not correctly configured.')
+       	Exit(0)
+
+if baseenv.subst('$CHECKHEADERS')==proceed:
+	system_header_list = ['arpa/inet.h','errno.h','assert.h','netdb.h','netinet/in.h','pthread.h','signal.h','stddef.h','stdio.h','stdlib.h','string.h','strings.h','sys/ioctl.h','sys/socket.h','sys/time.h','sys/types.h','time.h','unistd.h','memory.h','math.h','limits.h']
+
+	for header_file in system_header_list:
+		if not conf.CheckHeader(header_file):
+			print('!! Header file %s not found.' % header_file)
+			Exit(0)
+
+baseenv = conf.Finish()
+
+######## ROOT Dictionaries #########
+baseenv.Append(ROOTCONFIG = 'root-config')
+baseenv.Append(ROOTCINT = 'rootcint')
+
+try:
+        baseenv.ParseConfig('$ROOTCONFIG --cflags')
+        baseenv.ParseConfig('$ROOTCONFIG --libs')
+        baseenv.MergeFlags('-fPIC')
+except OSError:
+        try:
+		baseenv.Replace(ROOTCONFIG = baseenv['ENV']['ROOTSYS'] + '/bin/root-config')
+		baseenv.Replace(ROOTCINT = baseenv['ENV']['ROOTSYS'] + '/bin/rootcint')
+		baseenv.ParseConfig('$ROOTCONFIG --cflags')
+		baseenv.ParseConfig('$ROOTCONFIG --libs')
+		baseenv.MergeFlags('-fPIC')
+	except KeyError:
+                print('!!! Cannot find ROOT.  Check if root-config is in your PATH.')
+                Exit(1)
+
+bld = Builder(action=rootcint)
+baseenv.Append(BUILDERS = {'RootCint': bld})
+
+######## cppcheck ###########################
+
+def which(program):
+	import os
+	def is_exe(fpath):
+		return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
+	
+	fpath, fname = os.path.split(program)
+	if fpath:
+		if is_exe(program):
+			return program
+	else:
+		for path in os.environ["PATH"].split(os.pathsep):
+			path = path.strip('"')
+			exe_file = os.path.join(path, program)
+			if is_exe(exe_file):
+				return exe_file
+	return None
+
+if baseenv.subst('$CPPCHECK')==proceed:
+	is_cppcheck = which('cppcheck')
+	print "Path to cppcheck is %s\n" % is_cppcheck
+
+	if(is_cppcheck == None):
+		print('!!! cppcheck not found on this system.  Check if cppcheck is installed and in your PATH.')
+		Exit(1)
+	else:
+		cppcheck_command = baseenv.Command('cppcheck_report.txt',[],"cppcheck --quiet --enable=all src/ 2> $TARGET")
+		baseenv.AlwaysBuild(cppcheck_command)
+
+####### Start of main SConstruct ############
+
+hallclib = 'HallC'
+hallalib = 'HallA'
+dclib = 'dc'
+scalerlib = 'scaler'
+
+baseenv.Append(LIBPATH=['$HC_DIR','$HA_DIR','$HC_SRC','$HA_SRC','$HA_DC','$HA_SCALER'])
+baseenv.Replace(SHLIBSUFFIX = '.so')
+baseenv.Append(CPPDEFINES = '-DHALLC_MODS')
+
+directorylist = ['./','src','podd','podd/src','podd/hana_decode','podd/hana_scaler']
+
+baseenv.Append(SHLIBSUFFIX ='.'+baseenv.subst('$VERSION'))
+pbaseenv=baseenv.Clone()
+pbaseenv.Append(LIBS=[hallclib,hallalib,dclib,scalerlib])
+baseenv.Append(LIBS=[hallalib,dclib,scalerlib])
+Export('pbaseenv')
+
+#SConscript('podd/SConscript.py',exports='baseenv')
+#SConscript('podd/hana_scaler/SConscript.py',exports='baseenv')
+#SConscript('podd/hana_decode/SConscript.py',exports='baseenv')
+#SConscript('src/SConscript.py',exports='baseenv')
+#SConscript('./SConscript.py',exports='baseenv')
+SConscript(dirs = directorylist,name='SConscript.py',exports='baseenv')
+
+#######  End of SConstruct #########
diff --git a/examples/PARAM/52949/hcana.param b/examples/PARAM/52949/hcana.param
deleted file mode 120000
index 7fd888b..0000000
--- a/examples/PARAM/52949/hcana.param
+++ /dev/null
@@ -1 +0,0 @@
-../hcana.param
\ No newline at end of file
diff --git a/examples/PARAM/52949/hcana.param b/examples/PARAM/52949/hcana.param
new file mode 100644
index 0000000..47b4766
--- /dev/null
+++ b/examples/PARAM/52949/hcana.param
@@ -0,0 +1,79 @@
+;
+; Parameters that were built into Fortran analyzer that we want
+; to pass as parameters so that the resulting code can be more generic.
+;
+
+hhodo_num_planes = 4
+hhodo_plane_names = "1x 1y 2x 2y"
+
+hcal_num_layers = 4
+
+# Exclusion band width for the calorimeter's fiducial volume.
+hcal_fv_delta = 5.
+
+# Constants for the coordiante correction of the calorimeter energy depositions
+hcal_a_cor = 200.
+hcal_b_cor = 8000.
+hcal_c_cor = 64.36
+hcal_d_cor = 1.66
+
+hcal_layer_names = "1pr 2ta 3ta 4ta"
+
+haero_num_pairs = 8
+
+# Names of planes so that parameter names can be constructed
+hdc_plane_names = "1x1 1y1 1u1 1v1 1y2 1x2 2x1 2y1 2u1 2v1 2y2 2x2"
+
+# The following were defined in REPLAY.PARAM
+h_recon_coeff_filename =    'PARAM/hms_recon_coeff.dat'  ;hms optics matrix
+
+# The following are set to zero to replicate historical ENGINE behavior
+# For new analyses they should be set to 1.  If not defined here,
+# hcana will default 1, the new and correct behaviour.
+
+# If 1, Let a hit have different L/R assignment for different space points
+# instead of L/R assignment from first sp it appears in.
+hdc_fix_lr = 0
+# If 1, don't do the the propagation along the wire each time the hit
+# appears in a space point.  (Which means the correction accumulates)
+hdc_fix_propcorr = 0
+
+# SOS parameters
+shodo_num_planes = 4
+shodo_plane_names = "1x 1y 2x 2y"
+
+scal_num_layers = 4
+
+# Exclusion band width for the calorimeter's fiducial volume.
+# (saw) Don't know what this should be.  Copied it from HMS.
+scal_fv_delta = 5.
+
+# Constants for the coordiante correction of the calorimeter energy depositions
+# (saw) Copied from HMS
+scal_a_cor = 200.
+scal_b_cor = 8000.
+scal_c_cor = 64.36
+scal_d_cor = 1.66
+
+scal_layer_names = "1pr 2ta 3ta 4ta"
+
+# Names of planes so that parameter names can be constructed
+sdc_plane_names = "1u1 1u2 1x1 1x2 1v1 1v2 2u1 2u2 2x1 2x2 2v1 2v2"
+
+# The following were defined in REPLAY.PARAM
+s_recon_coeff_filename =    'PARAM/sos_recon_coeff.dat'  ;sos optics matrix
+
+# Fortran ENGINE only had this as a parameter for HMS.  Need it here
+# because same code used for both spectrometers
+sntracks_max_fp = 10
+
+# The following are set to zero to replicate historical ENGINE behavior
+# For new analyses they should be set to 1.  If not defined here,
+# hcana will default 1, the new and correct behaviour.
+
+# If 1, Let a hit have different L/R assignment for different space points
+# instead of L/R assignment from first sp it appears in.
+sdc_fix_lr = 0
+# If 1, don't do the the propagation along the wire each time the hit
+# appears in a space point.  (Which means the correction accumulates)
+sdc_fix_propcorr = 0
-- 
GitLab