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

matched_prim.H matched_prims.H: ${DATA}/prim01.H ${DATA}/cmp2667_muum.H
#	Scale < one_muls_only.H dscale=0.1 > junk1.H
#	Scale < one_all.H dscale=1.0 > target.H
	time ${BIN}/Ultimatch-new-all.x < target.H \
		multiples_in=junk1.H primaries_in=junk2.H \
		nfilt=27,1 npatch=1,1 wmode=1 mode=2 nsmode=1 \
		op=1 mu=1.0 2D=y niter=20 eps=1. dtest=n > $@
	Add scale=1,-1 one_all.H $@ > matched_prims.H

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


# do adaptive subtraction of the primaries to get the multiples
# 
mult_est_02.H: ${DATA}/prim01w.H ${DATA}/prim_data1_h.H
	Window < ${DATA}/prim_data1_h.H n3=1 >  ${DATA}/target.H
	Window < ${DATA}/prim01w.H n3=1 >  ${DATA}/junk.H
	Math file1=${DATA}/junk.H file2=${DATA}/target.H exp="file2-file1" > ${DATA}/junk2.H
	time ${BIN}/Ultimatch-new-all.x < ${DATA}/target.H \
		primaries_in=${DATA}/junk.H multiples_in= ${DATA}/junk2.H mu=0.001 \
		primaries_out=${DATA}/prim_est01.H \
		mode=2 nsmode=1 wmode=1 nfilt=21,1 npatch=31,31 \
		op=1 niter=10 2D=.true. eps=1.0 > ${DATA}/$@
