diff --git a/MCwrapper/MakeMC.csh b/MCwrapper/MakeMC.csh index 4516de79..f3b562b9 100755 --- a/MCwrapper/MakeMC.csh +++ b/MCwrapper/MakeMC.csh @@ -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" @@ -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" @@ -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" @@ -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 @@ -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` diff --git a/MCwrapper/MakeMC.sh b/MCwrapper/MakeMC.sh index ad51f134..e01c311e 100755 --- a/MCwrapper/MakeMC.sh +++ b/MCwrapper/MakeMC.sh @@ -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" @@ -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 @@ -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" @@ -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 @@ -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 diff --git a/MCwrapper/gluex_MC.py b/MCwrapper/gluex_MC.py index 8886f358..1dad29c5 100755 --- a/MCwrapper/gluex_MC.py +++ b/MCwrapper/gluex_MC.py @@ -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 @@ -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 "*********************************" @@ -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" @@ -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":