From e4e8af4a6a3c1aaefde612cdef6c5b32e773b746 Mon Sep 17 00:00:00 2001 From: tbritton Date: Fri, 7 Apr 2017 10:51:31 -0400 Subject: [PATCH] rewrite of standard names, enhanced naming, more minor bug fixes --- MCwrapper/MakeMC.csh | 106 +++++++------ MCwrapper/MakeMC.sh | 285 ++++++++++++++++++----------------- MCwrapper/examples/MC.config | 2 +- MCwrapper/gluex_MC.py | 10 +- 4 files changed, 216 insertions(+), 187 deletions(-) diff --git a/MCwrapper/MakeMC.csh b/MCwrapper/MakeMC.csh index 9a221640..5b1c6f3e 100755 --- a/MCwrapper/MakeMC.csh +++ b/MCwrapper/MakeMC.csh @@ -5,8 +5,6 @@ setenv ENVIRONMENT $1 shift setenv CONFIG_FILE $1 shift -setenv GEN_NAME $1 -shift setenv OUTDIR $1 shift setenv RUN_NUMBER $1 @@ -52,6 +50,8 @@ shift setenv GEN_MIN_ENERGY $1 shift setenv GEN_MAX_ENERGY $1 +shift +setenv TAGSTR $1 if ("$GEANTVER" == "3") then setenv NUMTHREADS 1 @@ -86,7 +86,7 @@ mkdir -p $OUTDIR mkdir -p $OUTDIR/log endif -if ("$CUSTOM_GCONTROL" == "0" ) then +if ( "$CUSTOM_GCONTROL" == "0" ) then cp $MCWRAPPER_CENTRAL/Gcontrol.in ./temp_Gcontrol.in chmod 777 ./temp_Gcontrol.in else @@ -111,6 +111,14 @@ set formatted_fileNumber="0""$formatted_fileNumber" end set formatted_fileNumber=$formatted_fileNumber$FILE_NUMBER +set custom_tag="" + +if ( "$TAGSTR" != "I_dont_have_one" ) then +set custom_tag=$TAGSTR\_ +endif + +set STANDARD_NAME=$custom_tag$formatted_runNumber\_$formatted_fileNumber + set colsize=`rcnd $RUN_NUMBER collimator_diameter | awk '{print $1}' | sed -r 's/.{2}$//' | sed -e 's/\.//g'` if ( "$colsize" == "B" || "$colsize" == "R" || "$JANA_CALIB_CONTEXT" != "variation=mc" ) then set colsize="50" @@ -145,26 +153,32 @@ if ( "$GENR" != "0" ) then if ( "$GENERATOR" == "genr8" ) then echo "configuring genr8" - cp $CONFIG_FILE ./genr8\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf + set STANDARD_NAME="genr8_"$STANDARD_NAME + cp $CONFIG_FILE ./$STANDARD_NAME.conf else if ( "$GENERATOR" == "bggen" ) then echo "configuring bggen" + set STANDARD_NAME="bggen_"$STANDARD_NAME cp $MCWRAPPER_CENTRAL/Generators/bggen/particle.dat ./ cp $MCWRAPPER_CENTRAL/Generators/bggen/pythia.dat ./ cp $MCWRAPPER_CENTRAL/Generators/bggen/pythia-geant.map ./ - cp $CONFIG_FILE ./bggen\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf + cp $CONFIG_FILE ./$STANDARD_NAME.conf else if ( "$GENERATOR" == "genEtaRegge" ) then echo "configuring genEtaRegge" - cp $CONFIG_FILE ./genEtaRegge\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf + set STANDARD_NAME="genEtaRegge_"$STANDARD_NAME + cp $CONFIG_FILE ./$STANDARD_NAME.conf else if ( "$GENERATOR" == "gen_2pi_amp" ) then echo "configuring gen_2pi_amp" - cp $CONFIG_FILE ./gen_2pi_amp\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf + set STANDARD_NAME="gen_2pi_amp_"$STANDARD_NAME + cp $CONFIG_FILE ./$STANDARD_NAME.conf else if ( "$GENERATOR" == "gen_2pi_primakoff" ) then echo "configuring gen_2pi_primakoff" - cp $CONFIG_FILE ./gen_2pi_primakoff\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf + set STANDARD_NAME="gen_2pi_primakoff_"$STANDARD_NAME + cp $CONFIG_FILE ./$STANDARD_NAME.conf else if ( "$GENERATOR" == "gen_pi0" ) then echo "configuring gen_pi0" - cp $CONFIG_FILE ./gen_pi0\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf + set STANDARD_NAME="genr_pi0_"$STANDARD_NAME + cp $CONFIG_FILE ./$STANDARD_NAME.conf endif set config_file_name=`basename "$CONFIG_FILE"` echo $config_file_name @@ -172,51 +186,51 @@ if ( "$GENR" != "0" ) then if ( "$GENERATOR" == "genr8" ) then echo "RUNNING GENR8" set RUNNUM=$formatted_runNumber+$formatted_fileNumber - sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' genr8\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf + sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' $STANDARD_NAME.conf # RUN genr8 and convert - genr8 -r$formatted_runNumber -M$EVT_TO_GEN -A$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.ascii < genr8\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf #$config_file_name - genr8_2_hddm $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.ascii + genr8 -r$formatted_runNumber -M$EVT_TO_GEN -A$STANDARD_NAME.ascii < $STANDARD_NAME.conf #$config_file_name + genr8_2_hddm $STANDARD_NAME.ascii else if ( "$GENERATOR" == "bggen" ) then set RANDOM=$$ echo $RANDOM - sed -i 's/TEMPTRIG/'$EVT_TO_GEN'/' bggen\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPRUNNO/'$RUN_NUMBER'/' bggen\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPCOLD/'0.00$colsize'/' bggen\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPRAND/'$RANDOM'/' bggen\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPELECE/'$eBEAM_ENERGY'/' bggen\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' bggen\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPMINGENE/'$GEN_MIN_ENERGY'/' bggen\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPMAXGENE/'$GEN_MAX_ENERGY'/' bggen\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf + sed -i 's/TEMPTRIG/'$EVT_TO_GEN'/' $STANDARD_NAME.conf + sed -i 's/TEMPRUNNO/'$RUN_NUMBER'/' $STANDARD_NAME.conf + sed -i 's/TEMPCOLD/'0.00$colsize'/' $STANDARD_NAME.conf + sed -i 's/TEMPRAND/'$RANDOM'/' $STANDARD_NAME.conf + sed -i 's/TEMPELECE/'$eBEAM_ENERGY'/' $STANDARD_NAME.conf + sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' $STANDARD_NAME.conf + sed -i 's/TEMPMINGENE/'$GEN_MIN_ENERGY'/' $STANDARD_NAME.conf + sed -i 's/TEMPMAXGENE/'$GEN_MAX_ENERGY'/' $STANDARD_NAME.conf - ln -s bggen\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf fort.15 + ln -s $STANDARD_NAME.conf fort.15 bggen - mv bggen.hddm $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.hddm + mv bggen.hddm $STANDARD_NAME.hddm else if ( "$GENERATOR" == "genEtaRegge" ) then echo "RUNNING GENETAREGGE" - sed -i 's/TEMPCOLD/'0.00$colsize'/' genEtaRegge\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPELECE/'$eBEAM_ENERGY'/' genEtaRegge\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' genEtaRegge\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPMINGENE/'$GEN_MIN_ENERGY'/' genEtaRegge\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPMAXGENE/'$GEN_MAX_ENERGY'/' genEtaRegge\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - genEtaRegge -N$EVT_TO_GEN -O$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.hddm -I'genEtaRegge'\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf + sed -i 's/TEMPCOLD/'0.00$colsize'/' $STANDARD_NAME.conf + sed -i 's/TEMPELECE/'$eBEAM_ENERGY'/' $STANDARD_NAME.conf + sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' $STANDARD_NAME.conf + sed -i 's/TEMPMINGENE/'$GEN_MIN_ENERGY'/' $STANDARD_NAME.conf + sed -i 's/TEMPMAXGENE/'$GEN_MAX_ENERGY'/' $STANDARD_NAME.conf + genEtaRegge -N$EVT_TO_GEN -O$STANDARD_NAME.hddm -I$STANDARD_NAME.conf else if ( "$GENERATOR" == "gen_2pi_amp" ) then echo "RUNNING GEN_2PI_AMP" set optionals_line=`head -n 1 $config_file_name | sed -r 's/.//'` echo $optionals_line - echo gen_2pi_amp -c gen_2pi_amp\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf -o $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.hddm -hd $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.root -n $EVT_TO_GEN -r $RUN_NUMBER -a $GEN_MIN_ENERGY -b $GEN_MAX_ENERGY $optionals_line - gen_2pi_amp -c gen_2pi_amp\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf -hd $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.hddm -o $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.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 -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 + 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 else if ( "$GENERATOR" == "gen_2pi_primakoff" ) then echo "RUNNING GEN_2PI_PRIMAKOFF" set optionals_line=`head -n 1 $config_file_name | sed -r 's/.//'` echo $optionals_line - echo gen_2pi_primakoff -c gen_2pi_primakoff\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf -o $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.hddm -hd $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.root -n $EVT_TO_GEN -r $RUN_NUMBER -a $GEN_MIN_ENERGY -b $GEN_MAX_ENERGY $optionals_line - gen_2pi_primakoff -c gen_2pi_primakoff\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf -hd $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.hddm -o $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.root -n $EVT_TO_GEN -r $RUN_NUMBER -a $GEN_MIN_ENERGY -b $GEN_MAX_ENERGY $optionals_line + echo gen_2pi_primakoff -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 + gen_2pi_primakoff -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 else if ( "$GENERATOR" == "gen_pi0" ) then echo "RUNNING GEN_PI0" set optionals_line=`head -n 1 $config_file_name | sed -r 's/.//'` echo $optionals_line - gen_pi0 -c gen_pi0\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf -hd $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.hddm -o $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.root -n $EVT_TO_GEN -r $RUN_NUMBER -a $GEN_MIN_ENERGY -b $GEN_MAX_ENERGY -p $COHERENT_PEAK -s $formatted_fileNumber $optionals_line -m $eBEAM_ENERGY + gen_pi0 -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 -p $COHERENT_PEAK -s $formatted_fileNumber $optionals_line -m $eBEAM_ENERGY endif #GEANT/smearing @@ -231,14 +245,13 @@ if ( "$GENR" != "0" ) then set COHERENT_PEAK=$COHERENT_PEAK\. endif - set inputfile=$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber cp temp_Gcontrol.in $PWD/control'_'$formatted_runNumber'_'$formatted_fileNumber.in chmod 777 $PWD/control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPELECE/'$eBEAM_ENERGY'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in - sed -i 's/TEMPIN/'$inputfile.hddm'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + sed -i 's/TEMPIN/'$STANDARD_NAME.hddm'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPRUNG/'$RUN_NUMBER'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in - sed -i 's/TEMPOUT/'$inputfile'_geant.hddm/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + sed -i 's/TEMPOUT/'$STANDARD_NAME'_geant'$GEANTVER'.hddm/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPTRIG/'$EVT_TO_GEN'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in sed -i 's/TEMPCOLD/'0.00$colsize'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in @@ -272,7 +285,7 @@ if ( "$GENR" != "0" ) then if ( "$BKGFOLDSTR" == "BeamPhotons" || "$BKGFOLDSTR" == "None" ) then echo "running MCsmear without folding in random background" - mcsmear -o$inputfile'_geant_smeared.hddm' $inputfile'_geant.hddm' + mcsmear -o$STANDARD_NAME'_geant'$GEANTVER'_smeared.hddm' $STANDARD_NAME'_geant'$GEANTVER'.hddm' else if( "$BKGFOLDSTR" == "DEFAULT" ) then #find file and run:1 @@ -280,6 +293,7 @@ if ( "$GENR" != "0" ) then set runperiod="RunPeriod-2017-01" if ( $RUN_NUMBER > 40000 ) then + echo #set runperiod="RunPeriod-2017-10" endif @@ -293,14 +307,14 @@ if ( "$GENR" != "0" ) then echo "Could not find mix-in file "$bkglocstring exit else - echo "mcsmear -o$inputfile"\_"geant"\_"smeared.hddm $inputfile"\_"geant.hddm $bkglocstring"\:"1" - mcsmear -o$inputfile\_geant\_smeared.hddm $inputfile\_geant.hddm $bkglocstring\:1 + echo "mcsmear -o$STANDARD_NAME"\_"geant$GEANTVER"\_"smeared.hddm $STANDARD_NAME"\_"geant$GEANTVER.hddm $bkglocstring"\:"1" + mcsmear -o$STANDARD_NAME\_geant$GEANTVER\_smeared.hddm $STANDARD_NAME\_geant$GEANTVER.hddm $bkglocstring\:1 endif else #trust the user and use their string - echo 'mcsmear -o'$inputfile'_geant_smeared.hddm'' '$inputfile'_geant.hddm'' '$BKGFOLDSTR - mcsmear -o$inputfile'_geant_smeared.hddm' $inputfile'_geant.hddm' $BKGFOLDSTR + echo 'mcsmear -o'$STANDARD_NAME'_geant'$GEANTVER'_smeared.hddm'' '$STANDARD_NAME'_geant'$GEANTVER'.hddm'' '$BKGFOLDSTR + mcsmear -o$STANDARD_NAME'_geant'$GEANTVER'_smeared.hddm' $STANDARD_NAME'_geant'$GEANTVER'.hddm' $BKGFOLDSTR endif endif #run reconstruction @@ -314,17 +328,17 @@ if ( "$GENR" != "0" ) then unlink fort.15 endif - rm $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.hddm + rm $STANDARD_NAME.hddm endif if ( "$RECON" != "0" ) then echo "RUNNING RECONSTRUCTION" - hd_root $inputfile'_geant_smeared.hddm' -PPLUGINS=danarest,monitoring_hists -PNTHREADS=$NUMTHREADS - mv hd_root.root hd_root_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.root - mv dana_rest.hddm dana_rest_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.hddm + hd_root $STANDARD_NAME'_geant'$GEANTVER'_smeared.hddm' -PPLUGINS=danarest,monitoring_hists -PNTHREADS=$NUMTHREADS + mv hd_root.root hd_root_$STANDARD_NAME.root + mv dana_rest.hddm dana_rest_$STANDARD_NAME.hddm if ( "$CLEANGEANT" == "1" ) then - rm *_geant.hddm + rm *_geant$GEANTVER.hddm if ( "$PWD" != "$MCWRAPPER_CENTRAL" ) then rm temp_Gcontrol.in endif diff --git a/MCwrapper/MakeMC.sh b/MCwrapper/MakeMC.sh index e099e565..5cf9792b 100755 --- a/MCwrapper/MakeMC.sh +++ b/MCwrapper/MakeMC.sh @@ -5,8 +5,6 @@ export ENVIRONMENT=$1 shift export CONFIG_FILE=$1 shift -export GEN_NAME=$1 -shift export OUTDIR=$1 shift export RUN_NUMBER=$1 @@ -52,9 +50,11 @@ shift export GEN_MIN_ENERGY=$1 shift export GEN_MAX_ENERGY=$1 +shift +export TAGSTR=$1 if [[ "$GEANTVER" == "3" ]]; then - export NUMTHREADS=1 +export NUMTHREADS=1 fi # PRINT INPUTS @@ -78,19 +78,19 @@ echo "detected bash" #printenv #necessary to run swif, uses local directory if swif=0 is used if [[ "$MCSWIF" == "1" ]]; then - # ENVIRONMENT - echo $ENVIRONMENT - source $ENVIRONMENT - echo pwd=$PWD - mkdir -p $OUTDIR - mkdir -p $OUTDIR/log +# ENVIRONMENT +echo $ENVIRONMENT +source $ENVIRONMENT +echo pwd=$PWD +mkdir -p $OUTDIR +mkdir -p $OUTDIR/log fi if [[ "$CUSTOM_GCONTROL" == "0" ]]; then - cp $MCWRAPPER_CENTRAL/Gcontrol.in ./temp_Gcontrol.in - chmod 777 ./temp_Gcontrol.in +cp $MCWRAPPER_CENTRAL/Gcontrol.in ./temp_Gcontrol.in +chmod 777 ./temp_Gcontrol.in else - cp $CUSTOM_GCONTROL/Gcontrol.in ./temp_Gcontrol.in +cp $CUSTOM_GCONTROL/Gcontrol.in ./temp_Gcontrol.in fi length_count=$((`echo $RUN_NUMBER | wc -c` - 1)) @@ -112,199 +112,210 @@ done formatted_fileNumber=$formatted_fileNumber$FILE_NUMBER -set colsize=`rcnd $RUN_NUMBER collimator_diameter | awk '{print $1}' | sed -r 's/.{2}$//' | sed -e 's/\.//g'` +custom_tag="" + +if [[ "$TAGSTR" != "I_dont_have_one" ]]; then +custom_tag=$TAGSTR\_ +fi + +STANDARD_NAME=$custom_tag$formatted_runNumber\_$formatted_fileNumber + +colsize=`rcnd $RUN_NUMBER collimator_diameter | awk '{print $1}' | sed -r 's/.{2}$//' | sed -e 's/\.//g'` if [[ "$colsize" == "B" || "$colsize" == "R" || "$JANA_CALIB_CONTEXT" != "variation=mc" ]]; then - set colsize="50" + colsize="50" fi if [[ `echo $eBEAM_ENERGY | grep -o "\." | wc -l` == 0 ]]; then - set eBEAM_ENERGY=$eBEAM_ENERGY\. + eBEAM_ENERGY=$eBEAM_ENERGY\. fi if [[ `echo $COHERENT_PEAK | grep -o "\." | wc -l` == 0 ]]; then - set COHERENT_PEAK=$COHERENT_PEAK\. + COHERENT_PEAK=$COHERENT_PEAK\. fi if [[ `echo $GEN_MIN_ENERGY | grep -o "\." | wc -l` == 0 ]]; then - set GEN_MIN_ENERGY=$GEN_MIN_ENERGY\. + GEN_MIN_ENERGY=$GEN_MIN_ENERGY\. fi if [[ `echo $GEN_MAX_ENERGY | grep -o "\." | wc -l` == 0 ]]; then - set GEN_MAX_ENERGY=$GEN_MAX_ENERGY\. + GEN_MAX_ENERGY=$GEN_MAX_ENERGY\. fi - if [[ "$GENR" != "0" ]]; then - if [["$GENERATOR" != "genr8" && "$GENERATOR" != "bggen" && "$GENERATOR" != "genEtaRegge" && "$GENERATOR" != "gen_2pi_amp" && "$GENERATOR" != "gen_pi0" && "$GENERATOR" != "gen_2pi_primakoff" ]]; then + if [[ "$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 + echo " input file found" + else + echo $CONFIG_FILE" does not exist" + exit fi - + if [[ "$GENERATOR" == "genr8" ]]; then echo "configuring genr8" - cp $CONFIG_FILE ./genr8\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf + STANDARD_NAME="genr8_"$STANDARD_NAME + cp $CONFIG_FILE ./$STANDARD_NAME.conf elif [[ "$GENERATOR" == "bggen" ]]; then echo "configuring bggen" + STANDARD_NAME="bggen_"$STANDARD_NAME cp $MCWRAPPER_CENTRAL/Generators/bggen/particle.dat ./ cp $MCWRAPPER_CENTRAL/Generators/bggen/pythia.dat ./ cp $MCWRAPPER_CENTRAL/Generators/bggen/pythia-geant.map ./ - cp $CONFIG_FILE ./bggen\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - + cp $CONFIG_FILE ./$STANDARD_NAME.conf elif [[ "$GENERATOR" == "genEtaRegge" ]]; then echo "configuring genEtaRegge" - cp $CONFIG_FILE ./genEtaRegge\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf + STANDARD_NAME="genEtaRegge_"$STANDARD_NAME + cp $CONFIG_FILE ./$STANDARD_NAME.conf elif [[ "$GENERATOR" == "gen_2pi_amp" ]]; then echo "configuring gen_2pi_amp" - cp $CONFIG_FILE ./gen_2pi_amp\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf + STANDARD_NAME="gen_2pi_amp_"$STANDARD_NAME + cp $CONFIG_FILE ./$STANDARD_NAME.conf elif [[ "$GENERATOR" == "gen_2pi_primakoff" ]]; then echo "configuring gen_2pi_primakoff" - cp $CONFIG_FILE ./gen_2pi_primakoff\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf + STANDARD_NAME="gen_2pi_primakoff_"$STANDARD_NAME + cp $CONFIG_FILE ./$STANDARD_NAME.conf elif [[ "$GENERATOR" == "gen_pi0" ]]; then echo "configuring gen_pi0" - cp $CONFIG_FILE ./gen_pi0\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf + STANDARD_NAME="genr_pi0_"$STANDARD_NAME + cp $CONFIG_FILE ./$STANDARD_NAME.conf fi - set config_file_name=`basename "$CONFIG_FILE"` + config_file_name=`basename "$CONFIG_FILE"` echo $config_file_name if [[ "$GENERATOR" == "genr8" ]]; then echo "RUNNING GENR8" - set RUNNUM=$formatted_runNumber+$formatted_fileNumber - sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' genr8\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf + RUNNUM=$formatted_runNumber+$formatted_fileNumber + sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' $STANDARD_NAME.conf # RUN genr8 and convert - genr8 -r$formatted_runNumber -M$EVT_TO_GEN -A$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.ascii < genr8\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf #$config_file_name - genr8_2_hddm $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.ascii + genr8 -r$formatted_runNumber -M$EVT_TO_GEN -A$STANDARD_NAME.ascii < $STANDARD_NAME.conf #$config_file_name + genr8_2_hddm $STANDARD_NAME.ascii elif [[ "$GENERATOR" == "bggen" ]]; then - set RANDOM=$$ + RANDOM=$$ echo $RANDOM - sed -i 's/TEMPTRIG/'$EVT_TO_GEN'/' bggen\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPRUNNO/'$RUN_NUMBER'/' bggen\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPCOLD/'0.00$colsize'/' bggen\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPRAND/'$RANDOM'/' bggen\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPELECE/'$eBEAM_ENERGY'/' bggen\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' bggen\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPMINGENE/'$GEN_MIN_ENERGY'/' bggen\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPMAXGENE/'$GEN_MAX_ENERGY'/' bggen\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf + sed -i 's/TEMPTRIG/'$EVT_TO_GEN'/' $STANDARD_NAME.conf + sed -i 's/TEMPRUNNO/'$RUN_NUMBER'/' $STANDARD_NAME.conf + sed -i 's/TEMPCOLD/'0.00$colsize'/' $STANDARD_NAME.conf + sed -i 's/TEMPRAND/'$RANDOM'/' $STANDARD_NAME.conf + sed -i 's/TEMPELECE/'$eBEAM_ENERGY'/' $STANDARD_NAME.conf + sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' $STANDARD_NAME.conf + sed -i 's/TEMPMINGENE/'$GEN_MIN_ENERGY'/' $STANDARD_NAME.conf + sed -i 's/TEMPMAXGENE/'$GEN_MAX_ENERGY'/' $STANDARD_NAME.conf - ln -s bggen\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf fort.15 + ln -s $STANDARD_NAME.conf fort.15 bggen - mv bggen.hddm $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.hddm - elif [[ "$GENERATOR" == "genEtaRegge" ]]; then + mv bggen.hddm $STANDARD_NAME.hddm + elif [[ "$GENERATOR" == "genEtaRegge" ]]; then echo "RUNNING GENETAREGGE" - sed -i 's/TEMPCOLD/'0.00$colsize'/' genEtaRegge\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPELECE/'$eBEAM_ENERGY'/' genEtaRegge\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' genEtaRegge\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPMINGENE/'$GEN_MIN_ENERGY'/' genEtaRegge\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - sed -i 's/TEMPMAXGENE/'$GEN_MAX_ENERGY'/' genEtaRegge\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - genEtaRegge -N$EVT_TO_GEN -O$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.hddm -I'genEtaRegge'\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf - elif [[ "$GENERATOR" == "gen_2pi_amp" ]]; then + sed -i 's/TEMPCOLD/'0.00$colsize'/' $STANDARD_NAME.conf + sed -i 's/TEMPELECE/'$eBEAM_ENERGY'/' $STANDARD_NAME.conf + sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' $STANDARD_NAME.conf + sed -i 's/TEMPMINGENE/'$GEN_MIN_ENERGY'/' $STANDARD_NAME.conf + sed -i 's/TEMPMAXGENE/'$GEN_MAX_ENERGY'/' $STANDARD_NAME.conf + genEtaRegge -N$EVT_TO_GEN -O$STANDARD_NAME.hddm -I$STANDARD_NAME.conf + elif [[ "$GENERATOR" == "gen_2pi_amp" ]]; then echo "RUNNING GEN_2PI_AMP" - set optionals_line=`head -n 1 $config_file_name | sed -r 's/.//'` + optionals_line=`head -n 1 $config_file_name | sed -r 's/.//'` echo $optionals_line - echo gen_2pi_amp -c gen_2pi_amp\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf -o $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.hddm -hd $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.root -n $EVT_TO_GEN -r $RUN_NUMBER -a $GEN_MIN_ENERGY -b $GEN_MAX_ENERGY $optionals_line - gen_2pi_amp -c gen_2pi_amp\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf -hd $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.hddm -o $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.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 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 + 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" - set optionals_line=`head -n 1 $config_file_name | sed -r 's/.//'` + optionals_line=`head -n 1 $config_file_name | sed -r 's/.//'` echo $optionals_line - echo gen_2pi_primakoff -c gen_2pi_primakoff\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf -o $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.hddm -hd $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.root -n $EVT_TO_GEN -r $RUN_NUMBER -a $GEN_MIN_ENERGY -b $GEN_MAX_ENERGY $optionals_line - gen_2pi_primakoff -c gen_2pi_primakoff\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf -hd $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.hddm -o $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.root -n $EVT_TO_GEN -r $RUN_NUMBER -a $GEN_MIN_ENERGY - b $GEN_MAX_ENERGY $optionals_line - elif [[ "$GENERATOR" == "gen_pi0" ]]; then + echo gen_2pi_primakoff -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 + gen_2pi_primakoff -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_pi0" ]]; then echo "RUNNING GEN_PI0" - set optionals_line=`head -n 1 $config_file_name | sed -r 's/.//'` + optionals_line=`head -n 1 $config_file_name | sed -r 's/.//'` echo $optionals_line - gen_pi0 -c gen_pi0\_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.conf -hd $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.hddm -o $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.root -n $EVT_TO_GEN -r $RUN_NUMBER -a $GEN_MIN_ENERGY -b $GEN_MAX_ENERGY -p $COHERENT_PEAK -s $formatted_fileNumber $optionals_line -m $eBEAM_ENERGY + gen_pi0 -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 -p $COHERENT_PEAK -s $formatted_fileNumber $optionals_line -m $eBEAM_ENERGY fi - - #GEANT/smearing - - if [[ "$GEANT" != "0" ]]; then - echo "RUNNING GEANT"$GEANTVER - - if [[ `echo $eBEAM_ENERGY | grep -o "\." | wc -l` == 0]]; then - set eBEAM_ENERGY=$eBEAM_ENERGY\. - fi - if [[ `echo $COHERENT_PEAK | grep -o "\." | wc -l` == 0]]; then - set COHERENT_PEAK=$COHERENT_PEAK\. - fi - - set inputfile=$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber - cp temp_Gcontrol.in $PWD/control'_'$formatted_runNumber'_'$formatted_fileNumber.in - chmod 777 $PWD/control'_'$formatted_runNumber'_'$formatted_fileNumber.in - sed -i 's/TEMPELECE/'$eBEAM_ENERGY'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in - sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in - sed -i 's/TEMPIN/'$inputfile.hddm'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in - sed -i 's/TEMPRUNG/'$RUN_NUMBER'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in - sed -i 's/TEMPOUT/'$inputfile'_geant.hddm/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in - sed -i 's/TEMPTRIG/'$EVT_TO_GEN'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in - sed -i 's/TEMPCOLD/'0.00$colsize'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in - - if [[ "$BKGFOLDSTR" != "BeamPhotons" ]]; then - echo "removing Beam Photon background from geant simulation" - sed -i 's/BGRATE/cBGRATE/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in - sed -i 's/BGGATE/cBGGATE/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in - sed -i 's/TEMPMINE/'$GEN_MIN_ENERGY'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in - else - sed -i 's/TEMPMINE/0.0012/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in - fi - - mv $PWD/control'_'$formatted_runNumber'_'$formatted_fileNumber.in $PWD/control.in + +#GEANT/smearing + + if [[ "$GEANT" != "0" ]]; then + echo "RUNNING GEANT"$GEANTVER + + if [[ `echo $eBEAM_ENERGY | grep -o "\." | wc -l` == 0 ]]; then + eBEAM_ENERGY=$eBEAM_ENERGY\. + fi + if [[ `echo $COHERENT_PEAK | grep -o "\." | wc -l` == 0 ]]; then + COHERENT_PEAK=$COHERENT_PEAK\. + fi + + cp temp_Gcontrol.in $PWD/control'_'$formatted_runNumber'_'$formatted_fileNumber.in + chmod 777 $PWD/control'_'$formatted_runNumber'_'$formatted_fileNumber.in + sed -i 's/TEMPELECE/'$eBEAM_ENERGY'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + sed -i 's/TEMPCOHERENT/'$COHERENT_PEAK'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + sed -i 's/TEMPIN/'$STANDARD_NAME.hddm'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + sed -i 's/TEMPRUNG/'$RUN_NUMBER'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + sed -i 's/TEMPOUT/'$STANDARD_NAME'_geant'$GEANTVER'.hddm/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + sed -i 's/TEMPTRIG/'$EVT_TO_GEN'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + sed -i 's/TEMPCOLD/'0.00$colsize'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + + if [[ "$BKGFOLDSTR" != "BeamPhotons" ]]; then + echo "removing Beam Photon background from geant simulation" + sed -i 's/BGRATE/cBGRATE/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + sed -i 's/BGGATE/cBGGATE/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + sed -i 's/TEMPMINE/'$GEN_MIN_ENERGY'/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + else + sed -i 's/TEMPMINE/0.0012/' control'_'$formatted_runNumber'_'$formatted_fileNumber.in + fi + + mv $PWD/control'_'$formatted_runNumber'_'$formatted_fileNumber.in $PWD/control.in - if [[ "$GEANTVER" == "3" ]]; then - hdgeant - elif [[ "$GEANTVER" == "4" ]]; then - #make run.mac then call it below - rm -f run.mac - echo "/run/beamOn $EVT_TO_GEN" > run.mac - echo "exit" >>! run.mac - hdgeant4 -t$NUMTHREADS run.mac - rm run.mac - else - echo "INVALID GEANT VERSION" - exit - fi + if [[ "$GEANTVER" == "3" ]]; then + hdgeant + elif [[ "$GEANTVER" == "4" ]]; then + #make run.mac then call it below + rm -f run.mac + echo "/run/beamOn $EVT_TO_GEN" > run.mac + echo "exit" >>! run.mac + hdgeant4 -t$NUMTHREADS run.mac + rm run.mac + else + echo "INVALID GEANT VERSION" + exit + fi if [[ "$SMEAR" != "0" ]]; then echo "RUNNING MCSMEAR" if [[ "$BKGFOLDSTR" == "BeamPhotons" || "$BKGFOLDSTR" == "None" ]]; then echo "running MCsmear without folding in random background" - mcsmear -o$inputfile'_geant_smeared.hddm' $inputfile'_geant.hddm' + mcsmear -o$STANDARD_NAME'_geant'$GEANTVER'_smeared.hddm' $STANDARD_NAME'_geant'$GEANTVER'.hddm' else - if( "$BKGFOLDSTR" == "DEFAULT" ]]; then + if [[ "$BKGFOLDSTR" == "DEFAULT" ]]; then #find file and run:1 echo "Finding the right file to fold in" - set runperiod="RunPeriod-2017-01" - + runperiod="RunPeriod-2017-01" + if [[ $RUN_NUMBER > 40000 ]]; then - #set runperiod="RunPeriod-2017-10" echo + #runperiod="RunPeriod-2017-10" fi - + if [[ $RUN_NUMBER < 30000 ]]; then echo "Warning: random triggers did not exist by this point" fi - set bkglocstring="/cache/halld/""$runperiod""/sim/random_triggers/""$formatted_runNumber"".hddm" - #set bkglocstring="/w/halld-scifs1a/home/tbritton/converted.hddm" + bkglocstring="/cache/halld/""$runperiod""/sim/random_triggers/""$formatted_runNumber"".hddm" + #bkglocstring="/w/halld-scifs1a/home/tbritton/converted.hddm" if [[ ! -f $bkglocstring ]]; then echo "Could not find mix-in file "$bkglocstring exit else - echo "mcsmear -o$inputfile"\_"geant"\_"smeared.hddm $inputfile"\_"geant.hddm $bkglocstring"\:"1" - mcsmear -o$inputfile\_geant\_smeared.hddm $inputfile\_geant.hddm $bkglocstring\:1 + echo "mcsmear -o$STANDARD_NAME"\_"geant$GEANTVER"\_"smeared.hddm $STANDARD_NAME"\_"geant$GEANTVER.hddm $bkglocstring"\:"1" + mcsmear -o$STANDARD_NAME\_geant$GEANTVER\_smeared.hddm $STANDARD_NAME\_geant$GEANTVER.hddm $bkglocstring\:1 fi else #trust the user and use their string - echo 'mcsmear -o'$inputfile'_geant_smeared.hddm'' '$inputfile'_geant.hddm'' '$BKGFOLDSTR - mcsmear -o$inputfile'_geant_smeared.hddm' $inputfile'_geant.hddm' $BKGFOLDSTR + echo 'mcsmear -o'$STANDARD_NAME'_geant'$GEANTVER'_smeared.hddm'' '$STANDARD_NAME'_geant'$GEANTVER'.hddm'' '$BKGFOLDSTR + mcsmear -o$STANDARD_NAME'_geant'$GEANTVER'_smeared.hddm' $STANDARD_NAME'_geant'$GEANTVER'.hddm' $BKGFOLDSTR fi fi #run reconstruction @@ -318,29 +329,29 @@ if [[ "$GENR" != "0" ]]; then unlink fort.15 fi - rm $GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.hddm + rm $STANDARD_NAME.hddm fi if [[ "$RECON" != "0" ]]; then echo "RUNNING RECONSTRUCTION" - hd_root $inputfile'_geant_smeared.hddm' -PPLUGINS=danarest,monitoring_hists -PNTHREADS=$NUMTHREADS - mv hd_root.root hd_root_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.root - mv dana_rest.hddm dana_rest_$GEN_NAME\_$formatted_runNumber\_$formatted_fileNumber.hddm + hd_root $STANDARD_NAME'_geant'$GEANTVER'_smeared.hddm' -PPLUGINS=danarest,monitoring_hists -PNTHREADS=$NUMTHREADS + mv hd_root.root hd_root_$STANDARD_NAME.root + mv dana_rest.hddm dana_rest_$STANDARD_NAME.hddm if [[ "$CLEANGEANT" == "1" ]]; then - rm *_geant.hddm + rm *_geant$GEANTVER.hddm if [[ "$PWD" != "$MCWRAPPER_CENTRAL" ]]; then rm temp_Gcontrol.in fi fi if [[ "$CLEANSMEAR" == "1" ]]; then - rm *_smeared.hddm - rm smear.root + rm *_smeared.hddm + rm smear.root fi if [[ "$CLEANRECON" == "1" ]]; then - rm dana_rest* + rm dana_rest* fi fi fi @@ -359,6 +370,6 @@ fi if [[ ! -d "$OUTDIR/root/" ]]; then mkdir $OUTDIR/root/ fi -mv $PWD/*.conf $OUTDIR/configurations/ -mv $PWD/*.hddm $OUTDIR/hddm/ -mv $PWD/*.root $OUTDIR/root/ + mv $PWD/*.conf $OUTDIR/configurations/ + mv $PWD/*.hddm $OUTDIR/hddm/ + mv $PWD/*.root $OUTDIR/root/ diff --git a/MCwrapper/examples/MC.config b/MCwrapper/examples/MC.config index c80ac38c..215193b2 100644 --- a/MCwrapper/examples/MC.config +++ b/MCwrapper/examples/MC.config @@ -2,7 +2,7 @@ #CUSTOM_MAKEMC=use-this-script-instead #CUSTOM_GCONTROL=use-this-Gcontrol-instead #======================================================================== - +#TAG=my-custom-prefix-tab # OUTPUT DATA LOCATION DATA_OUTPUT_BASE_DIR=OUTPUT-LOCATION#your desired output location diff --git a/MCwrapper/gluex_MC.py b/MCwrapper/gluex_MC.py index 11b21802..b44dd018 100755 --- a/MCwrapper/gluex_MC.py +++ b/MCwrapper/gluex_MC.py @@ -30,7 +30,7 @@ from subprocess import call import glob -def add_job(WORKFLOW,CHANNEL, RUNNO, FILENO,SCRIPT,COMMAND, VERBOSE,PROJECT,TRACK,NCORES,DISK,RAM,TIMELIMIT,OS,DATA_OUTPUT_BASE_DIR): +def add_job(WORKFLOW, RUNNO, FILENO,SCRIPT,COMMAND, VERBOSE,PROJECT,TRACK,NCORES,DISK,RAM,TIMELIMIT,OS,DATA_OUTPUT_BASE_DIR): # PREPARE NAMES @@ -106,6 +106,8 @@ def main(argv): #load all argument passed in and set default options VERBOSE = False + TAGSTR="I_dont_have_one" + DATA_OUTPUT_BASE_DIR = "UNKNOWN_LOCATION"#your desired output location (only needed for SWIF jobs ENVFILE = "my-environment-file"#change this to your own environment file @@ -227,6 +229,8 @@ def main(argv): MIN_GEN_ENERGY=rm_comments[0].strip() elif str(parts[0]).upper()=="GEN_MAX_ENERGY" : MAX_GEN_ENERGY=rm_comments[0].strip() + elif str(parts[0]).upper()=="TAG" : + TAGSTR=rm_comments[0].strip() else: print "unknown config parameter!! "+str(parts[0]) #loop over command line arguments @@ -334,7 +338,7 @@ def main(argv): if num == 0: continue - COMMAND=ENVFILE+" "+GENCONFIG+" "+CHANNEL+" "+str(outdir)+" "+str(RUNNUM)+" "+str(FILENUM-1)+" "+str(num)+" "+str(VERSION)+" "+str(GENR)+" "+str(GEANT)+" "+str(SMEAR)+" "+str(RECON)+" "+str(CLEANGENR)+" "+str(CLEANGEANT)+" "+str(CLEANSMEAR)+" "+str(CLEANRECON)+" "+str(MCSWIF)+" "+str(NCORES)+" "+str(GENERATOR)+" "+str(GEANTVER)+" "+str(BGFOLD)+" "+str(CUSTOM_GCONTROL)+" "+str(eBEAM_ENERGY)+" "+str(COHERENT_PEAK)+" "+str(MIN_GEN_ENERGY)+" "+str(MAX_GEN_ENERGY) + COMMAND=ENVFILE+" "+GENCONFIG+" "+str(outdir)+" "+str(RUNNUM)+" "+str(FILENUM-1)+" "+str(num)+" "+str(VERSION)+" "+str(GENR)+" "+str(GEANT)+" "+str(SMEAR)+" "+str(RECON)+" "+str(CLEANGENR)+" "+str(CLEANGEANT)+" "+str(CLEANSMEAR)+" "+str(CLEANRECON)+" "+str(MCSWIF)+" "+str(NCORES)+" "+str(GENERATOR)+" "+str(GEANTVER)+" "+str(BGFOLD)+" "+str(CUSTOM_GCONTROL)+" "+str(eBEAM_ENERGY)+" "+str(COHERENT_PEAK)+" "+str(MIN_GEN_ENERGY)+" "+str(MAX_GEN_ENERGY)+" "+str(TAGSTR) #print COMMAND @@ -342,7 +346,7 @@ def main(argv): if MCSWIF == 0: os.system(str(indir)+" "+COMMAND) else: - add_job(WORKFLOW, CHANNEL, RUNNUM, FILENUM,str(indir),COMMAND,VERBOSE,PROJECT,TRACK,NCORES,DISK,RAM,TIMELIMIT,OS,DATA_OUTPUT_BASE_DIR) + add_job(WORKFLOW, RUNNUM, FILENUM,str(indir),COMMAND,VERBOSE,PROJECT,TRACK,NCORES,DISK,RAM,TIMELIMIT,OS,DATA_OUTPUT_BASE_DIR) if __name__ == "__main__": main(sys.argv[1:])