Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-12 08:16:33

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 source setup.csh
0006 
0007 echo""
0008 echo "This file is intended to be run as part of a batch job submission, however, you can also run it on its own."
0009 echo "Expected input is - FileNumber NumberOfEvents ElectronBeamEnergy HadronBeamEnergy RandomSeed OutputType IP Ejectile RecoilHadron(Optional, for K+)"
0010 echo "Please see the README for more info."
0011 echo ""
0012 
0013 if ($#argv != 8 && $#argv != 9) then
0014     echo "! ERROR !"
0015     echo "! ERROR ! - Expected 8 or 9 arguments, please see the opening information -! ERROR !"
0016     echo "! ERROR !"
0017     exit 0
0018 endif
0019 
0020 set FileNum=$1
0021 set NumEvents=$2
0022 set EBeamE=$3
0023 set HBeamE=$4
0024 set RandomSeed=$5
0025 set OutputType=$6
0026 set InteractionPoint=$7
0027 set Ejectile=$8
0028 
0029 if ($Ejectile == "K+" && $#argv == 8 ) then
0030     echo "! WARNING !"
0031     echo "! WARNING ! - For K+ production expect a hadron specified, defaulting to Lambda - ! WARNING !"
0032     echo "! WARNING !"
0033     set RecoilHadron="Lambda"
0034 else if ($Ejectile == "K+" && $#argv == 9 ) then
0035     set RecoilHadron=$9
0036 else 
0037     set RecoilHadron=""
0038 endif
0039 
0040 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."
0041     
0042 # Set the config file name based upon inputs
0043 set ConfigFilename = 'Config_EIC_'$EBeamE'on'$HBeamE'_'$InteractionPoint'_'$Ejectile$RecoilHadron'_'$NumEvents'_'$FileNum'.json'
0044 
0045 # Copy the default config file to our constructed filename
0046 cp Config_EIC.json $ConfigFilename
0047 
0048 # Use sed commands to change our config file based upon inputs
0049 sed -i 's/"file_name" \:.*/"file_name" \: "DEMPgen_'$EBeamE'on'$HBeamE'_'$InteractionPoint'_'$Ejectile$RecoilHadron'_'$NumEvents'_'$FileNum'",/' $ConfigFilename
0050 sed -i 's/"n_events" \:.*/"n_events" \: '$NumEvents',/' $ConfigFilename
0051 sed -i 's/"generator_seed"\:.*/"generator_seed" \: '$RandomSeed',/' $ConfigFilename
0052 sed -i 's/"ebeam"\:.*/"ebeam" \: '$EBeamE',/' $ConfigFilename
0053 sed -i 's/"hbeam"\:.*/"hbeam" \: '$HBeamE',/' $ConfigFilename
0054 sed -i 's/"ejectile"\:.*/"ejectile" \: "'$Ejectile'",/' $ConfigFilename
0055 sed -i 's/"recoil_hadron"\:.*/"recoil_hadron" \: "'$RecoilHadron'",/' $ConfigFilename
0056 sed -i 's/"det_location"\:.*/"det_location" \: "'$InteractionPoint'",/' $ConfigFilename
0057 sed -i 's/"OutputType"\:.*/"OutputType"\: "'$OutputType'",/' $ConfigFilename
0058 
0059 # Run our new config file
0060 ./build/DEMPgen $ConfigFilename
0061 sleep 5
0062 
0063 rm $ConfigFilename