BIN=../../Bin
DATA=../../Data

# Match simulated primaries to the data with the standard goal
# Mf=d to get an estimative of multiplaes. The kinematics of 
#the estmated multiples is perfect

#!!!!!!!!!!!!!!!!!!!!!!!!!!!
#
# Returning to the problem
#      (03/23/07)
#
#!!!!!!!!!!!!!!!!!!!!!!!!!!!


# do adaptive subtraction of the primaries to get the multiples
#
primest01.H:
	Window < ${DATA}/prim_data1_h.H f3=110 d3=400 n3=2> target2cig.H
	Window < ${DATA}/prim_prc.H f3=110 d3=400 n3=2> junk2cig.H
	time ${BIN}/Ultimatch-new-all.x < target2cig.H\
		multiples_in=junk2cig.H mu=1. \
		mode=2 nsmode=2 wmode=1 nfilt=11,11 npatch=50,50 \
		op=1 niter=30 2D=1 eps=30.0 > ${DATA}/$@

mulest02.H:
	Math file1=target2cig.H file2=../../Data/primest01.H exp="file1-file2" > mulest01.H
	time ${BIN}/Ultimatch-new-all.x < target2cig.H\
		primaries_in=junk2cig.H multiples_in=mulest01.H mu=.6 \
                primaries_out=${DATA}/primest02.H\
		mode=2 nsmode=2 wmode=1 nfilt=11,11 npatch=50,50 \
		op=2 niter=60 2D=1 eps=30.0 > ${DATA}/$@


###############################################################
# TEST THE PATCH SIZE
#
# do adaptive subtraction of the primaries to get the multiples
# in common angle panels for the whole line
mult_patch_tst.H:
	time ${BIN}/Ultimatch-new-all.x < target_CAP.H\
                primaries_in=junk_CAP.H multiples_in=diff01_prc_CAP.H mu=0.8 \
                primaries_out=prim_patch_tst.H\
                mode=2 nsmode=2 wmode=1 nfilt=21,11 npatch=35,35 \
                op=2 niter=40 2D=1 eps=15.0 > $@

################################################################
#
# Now after getting the primairies usinf inverse theory 
#
#
mult01.H: 
	time ${BIN}/Ultimatch-new-all.x < ${DATA}/prim_data1_h.H\
		primaries_in=${DATA}/prim_prc.H multiples_in=${DATA}/diff01_prc.H mu=0.8 \
		primaries_out=${DATA}/prim01.H\
		mode=2 nsmode=2 wmode=1 nfilt=21,21 npatch=30,5 \
#


####### Parallel test
prim_par01.H:
	time Parallel command=${BIN}/Ultimatch-new-all.x \
		files="${DATA}/prim_data1_h_samp.H,${DATA}/prim_prc_samp.H,${DATA}/$@" \
		tags="stdin,multiples_in,stdout" \
		mach_mfile=machinefile_200 axis=3,3,3 \
		usage="INPUT,INPUT,OUTPUT" \
                file_type="DISTRIBUTE,DISTRIBUTE,COPY" \
	        pverb=2 nblock=20 \
                mu=1. mode=2 nsmode=2 wmode=1 nfilt=11,11 npatch=50,50 \
                op=1 niter=30 2D=1 eps=30.0 > prim_par01.log

mult01_par.H: 
	time Parallel command=${BIN}/Ultimatch-new-all.x \
		files="${DATA}/prim_data1_h.H,${DATA}/prim_prc.H,${DATA}/diff01_prc.H,$@" \
		tags="stdin,primaries_in,multiples_in,stdout" \
		mach_mfile=machinefile_200 axis=3,3,3,3 \
		usage="INPUT,INPUT,INPUT,OUPUT" \
		file_type="DISTRIBUTE,DISTRIBUTE,DISTRIBUTE,DISTRIBUTE" \
		pverb=2 nblock=20\
		mu=0.8 mode=2 nsmode=2 wmode=1 nfilt=11,11 npatch=50,50 \
		op=2 niter=50 2D=1 eps=15.0

mult02.H: 
	time ${BIN}/Ultimatch-new-all.x < ${DATA}/prim_data1_h.H\
                primaries_in=${DATA}/prim_prc.H multiples_in=${DATA}/diff01_prc.H mu=0.4 \
                primaries_out=${DATA}/prim02.H\
                mode=1 nsmode=1 wmode=1 nfilt=11,11 npatch=30,5 \
                op=1 niter=5 2D=1 eps=0.0 > ${DATA}/$@

mult03.H: 
	time ${BIN}/Ultimatch-new-all.x < ${DATA}/prim_data1_h.H\
                primaries_in=${DATA}/prim_prc.H multiples_in=${DATA}/diff01_prc.H mu=1. \
                primaries_out=${DATA}/prim03.H\
                mode=1 nsmode=2 wmode=1 nfilt=31,31 npatch=20,5 \
                op=2 niter=5 2D=1 eps=0.0 > ${DATA}/$@

mult03.H: 
	Window < ${DATA}/prim_data1_h.H f3=110 n3=2 j3=300 > target.H
	Window < ${DATA}/prim01w.H f3=110 n3=2 j3=300 > junk.H
	Math file1=target.H file2=junk.H exp="file1-file2" > junk2.H
	time ${BIN}/Ultimatch-new-all.x < ${DATA}/prim_data1_h.H\
                primaries_in=${DATA}/prim_prc.H multiples_in=${DATA}/diff01_prc.H mu=1. \
                primaries_out=${DATA}/prim03.H\
                mode=1 nsmode=2 wmode=1 nfilt=31,31 npatch=20,5 \
                op=2 niter=5 2D=1 eps=0.0 > ${DATA}/$@

mult01_CAP_a01.H: 
	time ${BIN}/Ultimatch-new-all.x < target_CAPw_a0.H\
                primaries_in=prim_prc_CAP_a0.H multiples_in=diff01_prc_CAP_a0.H mu=0.8 \
                primaries_out=${DATA}/prim01_CAP_a01.H\
                mode=2 nsmode=2 wmode=1 nfilt=21,21 npatch=5,5 \
                op=2 niter=50 2D=1 eps=1.0 > ${DATA}/$@

mult01_CAP_a31.H: 
	time ${BIN}/Ultimatch-new-all.x < target_a30.H\
                primaries_in=prim_prc_a30.H multiples_in=diff01_prc_a30.H mu=0.8 \
                primaries_out=${DATA}/prim01_CAP_a30.H\
                mode=2 nsmode=2 wmode=1 nfilt=21,21 npatch=5,5 \
                op=2 niter=50 2D=1 eps=1.0 > ${DATA}/$@

primtch_CAP_a0.H:  
	time ${BIN}/Ultimatch-new-all.x < target_CAPw_a0.H\
                multiples_in=prim_prc_a0.H mu=1. \
                mode=1 nsmode=2 wmode=1 nfilt=21,21 npatch=5,5 \
                op=1 niter=50 2D=1 eps=15.0 > ${DATA}/$@


