Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-17 09:02:54

0001 #!/bin/csh
0002 
0003 # SJDK - 09/02/22 - New script which takes in a whole bunch of inputs to create jobs/config files. Note that I'm not 100% happy with the pathing in this file so it should be tweaked and optimised at some point
0004 
0005 echo""
0006 echo "This file is intended to be run as part of a batch job submission, however, you can also run it on its own."
0007 echo "Expected input is - FileNumber NumberOfEvents ElectronBeamEnergy HadronBeamEnergy RandomSeed OutputType IP Ejectile RecoilHadron(Optional, for K+)"
0008 echo "Please see the README for more info."
0009 echo ""
0010 
0011 if ($#argv != 8 && $#argv != 9) then
0012     echo "! ERROR !"
0013     echo "! ERROR ! - Expected 8 or 9 arguments, please see the opening information -! ERROR !"
0014     echo "! ERROR !"
0015     exit 0
0016 endif
0017 
0018 set FileNum=$1
0019 set NumEvents=$2
0020 set EBeamE=$3
0021 set HBeamE=$4
0022 set RandomSeed=$5
0023 set OutputType=$6
0024 set InteractionPoint=$7
0025 set Ejectile=$8
0026 
0027 if ($Ejectile == "K+" && $#argv == 8 ) then
0028     echo "! WARNING !"
0029     echo "! WARNING ! - For K+ production expect a hadron specified, defaulting to Lambda - ! WARNING !"
0030     echo "! WARNING !"
0031     set RecoilHadron="Lambda"
0032 else if ($Ejectile == "K+" && $#argv == 9 ) then
0033     set RecoilHadron=$9
0034 else 
0035     set RecoilHadron=""
0036 endif
0037 
0038 echo "Running file $FileNum with $NumEvents events per file for $EBeamE GeV e- on $HBeamE GeV p using random seed $RandomSeed, using $OutputType format output for $Ejectile $RecoilHadron events."
0039     
0040 # Set the config file name based upon inputs
0041 set ConfigFilename = 'Config_EIC_'$EBeamE'on'$HBeamE'_'$InteractionPoint'_'$Ejectile$RecoilHadron'_'$NumEvents'_'$FileNum'.json'
0042 
0043 # Copy the default config file to our constructed filename
0044 cp Config_EIC.json $ConfigFilename
0045 
0046 # Use sed commands to change our config file based upon inputs
0047 sed -i 's/"file_name" \:.*/"file_name" \: "DEMPgen_'$EBeamE'on'$HBeamE'_'$InteractionPoint'_'$Ejectile$RecoilHadron'_'$NumEvents'_'$FileNum'",/' $ConfigFilename
0048 sed -i 's/"n_events" \:.*/"n_events" \: '$NumEvents',/' $ConfigFilename
0049 sed -i 's/"generator_seed"\:.*/"generator_seed" \: '$RandomSeed',/' $ConfigFilename
0050 sed -i 's/"ebeam"\:.*/"ebeam" \: '$EBeamE',/' $ConfigFilename
0051 sed -i 's/"hbeam"\:.*/"hbeam" \: '$HBeamE',/' $ConfigFilename
0052 sed -i 's/"ejectile"\:.*/"ejectile" \: "'$Ejectile'",/' $ConfigFilename
0053 sed -i 's/"recoil_hadron"\:.*/"recoil_hadron" \: "'$RecoilHadron'",/' $ConfigFilename
0054 sed -i 's/"det_location"\:.*/"det_location" \: "'$InteractionPoint'",/' $ConfigFilename
0055 sed -i 's/"OutputType"\:.*/"OutputType"\: "'$OutputType'",/' $ConfigFilename
0056 
0057 # Run our new config file
0058 cd data/
0059 ./../build/DEMPgen ../$ConfigFilename
0060 sleep 5
0061 
0062 # Filename as it's created is a bit odd, so rename it
0063 set OriginalOutput = 'eic_input_DEMPgen_'$EBeamE'on'$HBeamE'_'$InteractionPoint'_'$Ejectile$RecoilHadron'_'$NumEvents'_'$FileNum'.dat'
0064 set RenamedOutput = 'eic_DEMPgen_'$EBeamE'on'$HBeamE'_'$InteractionPoint'_'$Ejectile$RecoilHadron'_'$NumEvents'_'$FileNum'.dat'
0065 mv "OutputFiles/"$OriginalOutput "OutputFiles/"$RenamedOutput
0066 
0067 rm -rf ../$ConfigFilename