Skip to content

Commit

Permalink
no longer disturbs files located in the running directory at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
T-Britton committed Apr 21, 2017
1 parent a0da940 commit 314d968
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 15 deletions.
27 changes: 20 additions & 7 deletions MCwrapper/MakeMC.csh
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ if ( "$MCSWIF" == "1" ) then
mkdir -p $OUTDIR/log
endif

set current_files=`find . -maxdepth 1 -type f`

if ( "$CUSTOM_GCONTROL" == "0" ) then
cp $MCWRAPPER_CENTRAL/Gcontrol.in ./temp_Gcontrol.in
chmod 777 ./temp_Gcontrol.in
Expand Down Expand Up @@ -423,7 +425,7 @@ if ( "$GENR" != "0" ) then
endif

if ( "$CLEANGEANT" == "1" ) then
rm *_geant$GEANTVER.hddm
rm $STANDARD_NAME'_geant'$GEANTVER'.hddm'
rm control.in
rm -f geant.hbook
rm -f hdgeant.rz
Expand All @@ -433,7 +435,7 @@ if ( "$GENR" != "0" ) then
endif

if ( "$CLEANSMEAR" == "1" ) then
rm *_smeared.hddm
rm $STANDARD_NAME'_geant'$GEANTVER'_smeared.hddm'
rm smear.root
endif

Expand All @@ -443,11 +445,16 @@ if ( "$GENR" != "0" ) then

set rootfiles=`ls *.root`
set filename_root=""

foreach rootfile ($rootfiles)
set filename_root=`echo $rootfile | sed -r 's/.{5}$//'`
set filetomv="$rootfile"
mv $filetomv $filename_root\_$STANDARD_NAME.root
mv $PWD/$filename_root\_$STANDARD_NAME.root $OUTDIR/root/
set filename_root=`echo $rootfile | sed -r 's/.{5}$//'`
set filetomv="$rootfile"
set filecheck=`echo $current_files | grep -c $filetomv`

if ( "$filecheck" == "0" ) then
mv $filetomv $filename_root\_$STANDARD_NAME.root
mv $PWD/$filename_root\_$STANDARD_NAME.root $OUTDIR/root/
endif
end


Expand All @@ -463,7 +470,13 @@ endif
set hddmfiles=`ls | grep .hddm`

if ( "$hddmfiles" != "" ) then
mv $PWD/*.hddm $OUTDIR/hddm/
foreach hddmfile ($hddmfiles)
set filetomv="$hddmfile"
set filecheck=`echo $current_files | grep -c $filetomv`
if ( "$filecheck" == "0" ) then
mv $hddmfile $OUTDIR/hddm/
endif
end
endif

# mv $PWD/*.root $OUTDIR/root/ #just in case
Expand Down
22 changes: 17 additions & 5 deletions MCwrapper/MakeMC.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ if [[ "$MCSWIF" == "1" ]]; then
mkdir -p $OUTDIR/log
fi

current_files=`find . -maxdepth 1 -type f`

if [[ "$CUSTOM_GCONTROL" == "0" ]]; then
cp $MCWRAPPER_CENTRAL/Gcontrol.in ./temp_Gcontrol.in
chmod 777 ./temp_Gcontrol.in
Expand Down Expand Up @@ -431,7 +433,7 @@ if [[ "$GENR" != "0" ]]; then


if [[ "$CLEANGEANT" == "1" ]]; then
rm *_geant$GEANTVER.hddm
rm $STANDARD_NAME'_geant'$GEANTVER'.hddm'
rm control.in
rm -f geant.hbook
rm -f hdgeant.rz
Expand All @@ -442,7 +444,7 @@ if [[ "$GENR" != "0" ]]; then
fi

if [[ "$CLEANSMEAR" == "1" ]]; then
rm *_smeared.hddm
rm $STANDARD_NAME'_geant'$GEANTVER'_smeared.hddm'
rm smear.root
fi

Expand All @@ -455,8 +457,12 @@ if [[ "$GENR" != "0" ]]; then
for rootfile in $rootfiles; do
filename_root=`echo $rootfile | sed -r 's/.{5}$//'`
filetomv="$rootfile"
mv $filetomv $filename_root\_$STANDARD_NAME.root
mv $PWD/$filename_root\_$STANDARD_NAME.root $OUTDIR/root/
filecheck=`echo $current_files | grep -c $filetomv`

if [[ "$filecheck" == "0" ]]; then
mv $filetomv $filename_root\_$STANDARD_NAME.root
mv $PWD/$filename_root\_$STANDARD_NAME.root $OUTDIR/root/
fi
done
fi
fi
Expand All @@ -467,6 +473,12 @@ if [[ "$gen_pre" != "file" ]]; then
fi
hddmfiles=$(ls | grep .hddm)
if [[ "$hddmfiles" != "" ]]; then
mv $PWD/*.hddm $OUTDIR/hddm/
for hddmfile in $hddmfiles; do
filetomv="$hddmfile"
filecheck=`echo $current_files | grep -c $filetomv`
if [[ "$filecheck" == "0" ]]; then
mv $hddmfile $OUTDIR/hddm/
fi
done
fi
#mv $PWD/*.root $OUTDIR/root/ #just in case
5 changes: 2 additions & 3 deletions MCwrapper/gluex_MC.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def main(argv):

print "*********************************"
print "Welcome to v1.4 of the MCwrapper"
print "Thomas Britton 04/20/17"
print "Thomas Britton 04/21/17"
print "*********************************"


Expand Down Expand Up @@ -356,5 +356,4 @@ def main(argv):
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:])

main(sys.argv[1:])

0 comments on commit 314d968

Please sign in to comment.