Skip to content

Commit

Permalink
Merge pull request #7 from JeffersonLab/preGen
Browse files Browse the repository at this point in the history
Pre gen
  • Loading branch information
T-Britton authored Apr 17, 2017
2 parents 2d88736 + c398763 commit 5c7dac5
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 28 deletions.
47 changes: 36 additions & 11 deletions MCwrapper/MakeMC.csh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ setenv NUMTHREADS 1
endif

# PRINT INPUTS
echo `date`
echo "CONTEXT = $JANA_CALIB_CONTEXT"
echo "ENVIRONMENT = $ENVIRONMENT"
echo "CONFIG_FILE = $CONFIG_FILE"
Expand Down Expand Up @@ -152,19 +153,36 @@ if ( ! -d "$OUTDIR/root/" ) then
mkdir $OUTDIR/root/
endif

set gen_pre=""

if ( "$GENR" != "0" ) then
if ( "$GENERATOR" != "genr8" && "$GENERATOR" != "bggen" && "$GENERATOR" != "genEtaRegge" && "$GENERATOR" != "gen_2pi_amp" && "$GENERATOR" != "gen_pi0" && "$GENERATOR" != "gen_2pi_primakoff" ) then
set gen_pre=`echo $GENERATOR | cut -c1-4`
if ( "$gen_pre" != "file" && "$GENERATOR" != "genr8" && "$GENERATOR" != "bggen" && "$GENERATOR" != "genEtaRegge" && "$GENERATOR" != "gen_2pi_amp" && "$GENERATOR" != "gen_pi0" && "$GENERATOR" != "gen_2pi_primakoff" ) then
echo "NO VALID GENERATOR GIVEN"
echo "only [genr8, bggen, genEtaRegge, gen_2pi_amp, gen_pi0] are supported"
exit
endif

if ( -f $CONFIG_FILE ) then
echo " input file found"
else
echo $CONFIG_FILE" does not exist"
exit
endif
if ( "$gen_pre" == "file" ) then
set gen_in_file=`echo $GENERATOR | sed -r 's/^.{5}//'`
echo "bypassing generation"
if ( -f $gen_in_file ) then
echo "using pre-generated file: "$gen_in_file
cp $gen_in_file ./$STANDARD_NAME.hddm
else
echo "cannot find file: "$gen_in_file
exit
endif

else
if ( -f $CONFIG_FILE ) then
echo "input file found"
else
echo $CONFIG_FILE" does not exist"
exit
endif

endif

if ( "$GENERATOR" == "genr8" ) then
echo "configuring genr8"
Expand Down Expand Up @@ -195,8 +213,12 @@ if ( "$GENR" != "0" ) then
set STANDARD_NAME="genr_pi0_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
endif


if ( "$gen_pre" != "file" ) then
set config_file_name=`basename "$CONFIG_FILE"`
echo $config_file_name
endif

if ( "$GENERATOR" == "genr8" ) then
echo "RUNNING GENR8"
Expand Down Expand Up @@ -315,7 +337,7 @@ if ( "$GENR" != "0" ) then
if ( $RUN_NUMBER < 30000 ) then
echo "Warning: random triggers did not exist by this point"
endif
set bkglocstring="/cache/halld/""$runperiod""/sim/random_triggers/""$formatted_runNumber"".hddm"
set bkglocstring="/cache/halld/""$runperiod""/sim/random_triggers/""run$formatted_runNumber""_random.hddm"
#set bkglocstring="/w/halld-scifs1a/home/tbritton/converted.hddm"

if ( ! -f $bkglocstring ) then
Expand Down Expand Up @@ -399,6 +421,9 @@ if ( "$GENR" != "0" ) then
endif
endif

mv $PWD/*.conf $OUTDIR/configurations/
mv $PWD/*.hddm $OUTDIR/hddm/
mv $PWD/*.root $OUTDIR/root/ #just in case
if ( "$gen_pre" != "file" ) then
mv $PWD/*.conf $OUTDIR/configurations/
endif
mv $PWD/*.hddm $OUTDIR/hddm/
# mv $PWD/*.root $OUTDIR/root/ #just in case
echo `date`
45 changes: 33 additions & 12 deletions MCwrapper/MakeMC.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,19 +153,36 @@ if [[ ! -d "$OUTDIR/root/" ]]; then
mkdir $OUTDIR/root/
fi

gen_pre=""

if [[ "$GENR" != "0" ]]; then
if [[ "$GENERATOR" != "genr8" && "$GENERATOR" != "bggen" && "$GENERATOR" != "genEtaRegge" && "$GENERATOR" != "gen_2pi_amp" && "$GENERATOR" != "gen_pi0" && "$GENERATOR" != "gen_2pi_primakoff" ]]; then
gen_pre=`echo $GENERATOR | cut -c1-4`
if [[ "$gen_pre" != "file" && "$GENERATOR" != "genr8" && "$GENERATOR" != "bggen" && "$GENERATOR" != "genEtaRegge" && "$GENERATOR" != "gen_2pi_amp" && "$GENERATOR" != "gen_pi0" && "$GENERATOR" != "gen_2pi_primakoff" ]]; then
echo "NO VALID GENERATOR GIVEN"
echo "only [genr8, bggen, genEtaRegge, gen_2pi_amp, gen_pi0] are supported"
exit
fi

if [[ -f $CONFIG_FILE ]]; then
echo " input file found"
else
echo $CONFIG_FILE" does not exist"
exit
fi
if [[ "$gen_pre" == "file" ]]; then
gen_in_file=`echo $GENERATOR | sed -r 's/^.{5}//'`
echo "bypassing generation"
if [[ -f $gen_in_file ]]; then
echo "using pre-generated file: "$gen_in_file
cp $gen_in_file ./$STANDARD_NAME.hddm
else
echo "cannot find file: "$gen_in_file
exit
fi

else
if [[ -f $CONFIG_FILE ]]; then
echo "input file found"
else
echo $CONFIG_FILE" does not exist"
exit
fi

fi

if [[ "$GENERATOR" == "genr8" ]]; then
echo "configuring genr8"
Expand Down Expand Up @@ -196,9 +213,12 @@ if [[ "$GENR" != "0" ]]; then
STANDARD_NAME="genr_pi0_"$STANDARD_NAME
cp $CONFIG_FILE ./$STANDARD_NAME.conf
fi

if [[ "$gen_pre" != "file" ]]; then
config_file_name=`basename "$CONFIG_FILE"`
echo $config_file_name

fi

if [[ "$GENERATOR" == "genr8" ]]; then
echo "RUNNING GENR8"
RUNNUM=$formatted_runNumber+$formatted_fileNumber
Expand Down Expand Up @@ -234,7 +254,7 @@ if [[ "$GENR" != "0" ]]; then
echo "RUNNING GEN_2PI_AMP"
optionals_line=`head -n 1 $config_file_name | sed -r 's/.//'`
echo $optionals_line
echo gen_2pi_amp -c $STANDARD_NAME.conf -o $STANDARD_NAME.hddm -hd $STANDARD_NAME.root -n $EVT_TO_GEN -r $RUN_NUMBER -a $GEN_MIN_ENERGY -b $GEN_MAX_ENERGY $optionals_line
echo gen_2pi_amp -c $STANDARD_NAME.conf -hd $STANDARD_NAME.hddm -o $STANDARD_NAME.root -n $EVT_TO_GEN -r $RUN_NUMBER -a $GEN_MIN_ENERGY -b $GEN_MAX_ENERGY $optionals_line
gen_2pi_amp -c $STANDARD_NAME.conf -hd $STANDARD_NAME.hddm -o $STANDARD_NAME.root -n $EVT_TO_GEN -r $RUN_NUMBER -a $GEN_MIN_ENERGY -b $GEN_MAX_ENERGY $optionals_line
elif [[ "$GENERATOR" == "gen_2pi_primakoff" ]]; then
echo "RUNNING GEN_2PI_PRIMAKOFF"
Expand Down Expand Up @@ -316,7 +336,7 @@ if [[ "$GENR" != "0" ]]; then
if [[ $RUN_NUMBER < 30000 ]]; then
echo "Warning: random triggers did not exist by this point"
fi
bkglocstring="/cache/halld/""$runperiod""/sim/random_triggers/""$formatted_runNumber"".hddm"
bkglocstring="/cache/halld/""$runperiod""/sim/random_triggers/""run$formatted_runNumber""_random.hddm"
#bkglocstring="/w/halld-scifs1a/home/tbritton/converted.hddm"

if [[ ! -f $bkglocstring ]]; then
Expand Down Expand Up @@ -401,7 +421,8 @@ if [[ "$GENR" != "0" ]]; then
fi
fi
fi

if [[ "$gen_pre" != "file" ]]; then
mv $PWD/*.conf $OUTDIR/configurations/
fi
mv $PWD/*.hddm $OUTDIR/hddm/
mv $PWD/*.root $OUTDIR/root/ #just in case
#mv $PWD/*.root $OUTDIR/root/ #just in case
10 changes: 5 additions & 5 deletions MCwrapper/gluex_MC.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def showhelp():
helpstring+= " recon=[0/1] where 0 means that the reconstruction step will not run (default is 1)\n"
helpstring+= " cleangenerate=[0/1] where 0 means that the generation step will not be cleaned up after use (default is 1)\n"
helpstring+= " cleangeant=[0/1] where 0 means that the geant step will not be cleaned up after use (default is 1)\n"
helpstring+= " cleanmcsmear=[0/1] where 0 means that the mcsmear step will not (default is 1)\n"
helpstring+= " cleanmcsmear=[0/1] where 0 means that the mcsmear step will not be cleaned up after use (default is 1)\n"
helpstring+= " cleanrecon=[0/1] where 0 means that the reconstruction step will not run (default is 1)\n"
helpstring+= " swif=[0/1] where 1 means that a workflow will be created and jobs added to it (default is 0)\n"
return helpstring
Expand Down Expand Up @@ -102,8 +102,8 @@ def main(argv):
#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

print "*********************************"
print "Welcome to v1.3 of the MCwrapper"
print "Thomas Britton 04/12/17"
print "Welcome to v1.3.1 of the MCwrapper"
print "Thomas Britton 04/14/17"
print "*********************************"


Expand All @@ -117,7 +117,7 @@ def main(argv):
ENVFILE = "my-environment-file"#change this to your own environment file

GENERATOR = "genr8"
GENCONFIG = "genrator config file"
GENCONFIG = "NA"

eBEAM_ENERGY="12"
COHERENT_PEAK="9"
Expand Down Expand Up @@ -267,7 +267,7 @@ def main(argv):
if flag[0]=="recon":
argfound=1
RECON=int(flag[1])
if flag[0]=="cleangenr8":
if flag[0]=="cleangenerate":
argfound=1
CLEANGENR=int(flag[1])
if flag[0]=="cleangeant":
Expand Down

0 comments on commit 5c7dac5

Please sign in to comment.