.sh Files for simulation launching

This page is simulation specific in building .sh HTCondor scripts

In order to properly launch simulations in SNDSW, the basic usage is:

NEVENTS=100
STARTEVENT=$((ProcId*NEVENTS))
LSB_JOBINDEX=$((ProcId+1))
echo $LSB_JOBINDEX

If one would start from a certain event number one can write:

NEVENTS=100
EVT_OFFSET=111
STARTEVENT=$((ProcId*NEVENTS+EVT_OFFSET*100))
LSB_JOBINDEX=$((ProcId+1+EVT_OFFSET))
echo $LSB_JOBINDEX

Then you add sleep $ProcId.

One may want to show on screen from which STARTEVENT we are starting the .sh script:

echo "Starting script, from event number $STARTEVENT"

Background passing muons simulations

Now input files, one can use the FLUKA default input files from EOS experiment repository:

INPUTFILE=/eos/experiment/sndlhc/MonteCarlo/FLUKA/muons_up/version1/unit30_Nm.root
INPUTFILE=/eos/experiment/sndlhc/MonteCarlo/FLUKA/muons_up/version1/unit30_Pm.root

NOTE: these are files regarding upward crossing angle, the other configuration is in muons_down directory

Or input files made by me used to make the muon densities made with the script:

INPUTFILE=/afs/cern.ch/work/d/dannc/public/MuonBackground/unit30_Nm_z290.736831_WALL1.1.root

NOTE: this file in particular use as input muons centered at WALL1_B1

You have to set the OUTPUTDIR too, by for example:

OUTPUTDIR=/eos/user/d/dannc/<yourdirectory>

And eventualy launch the python script:

python $SNDLHC_mymaster/sndsw/shipLHC/run_simSND.py --Ntuple --eMin 1.0 -n $NEVENTS -i $STARTEVENT -f $INPUTFILE -o $OUTPUTDIR/$LSB_JOBINDEX

Background muon DIS simulations

The muon DIS simulation recipe is slightly different from the previous one, it uses a wrapper file in order to set the correct behaviour of the files generation. It basically uses pre-existing muon DIS files located in /eos/experiment/sndlhc/MonteCarlo/Pythia6/MuonDIS/muonDis_XXX.root where XXX is the production coding, written as follows: prod=(run+cycle*100).

So it uses an Ad-hoc function made by me in the script called HTCondor_muonDisGeant4. The first thing to do is to set the proper environment variables:

ProcId=$2
ClusterId=$1
RUN=`expr $ProcId / 200 + 1`
JOB=`expr $ProcId % 200`

Then one can add the usual SNDSW environment setup written here.

And finally the python script launching:

echo "Starting script, executing RUN number"
echo $RUN
echo "JOB number"
echo $JOB
cd /afs/cern.ch/work/d/dannc/public/MuonBackground/muonDis_sim
/cvmfs/sndlhc.cern.ch/SNDLHC-2021/June/15/sw/slc7_x86-64/Python/v3.6.8-local1/bin/python3 -i <<EOC
import run
run.HTCondor_muonDisGeant4(cycle=1,ecut=1.0,procID=$ProcId)
EOC

NOTE1: in this way you launch muon DIS simulation taking into account an energy cut of 1.0 (GeV??).

NOTE2: cycle is set to 1, this means you are simulating muon DIS on protons, cycle = 6 will lead to muons on neutrons.

NOTE3: As written by Thomas, this files make use of incoming muons 10 times, this means that you will have a diffrent incoming muon every 10 events.

Background digitized simulations

The simulation digitizing script is named run_digiSND.py located in sndsw/shipLHC . It uses existing simulation to add digitized information of SND@LHC electronic detectors. by specifing the simulation and geometry input files, in the HTCondor .sh file one can write:

SIMFILE=$OUTPUTDIR/$LSB_JOBINDEX/sndLHC.Ntuple-TGeant4.root
GEOFILE=$OUTPUTDIR/$LSB_JOBINDEX/geofile_full.Ntuple-TGeant4.root

Just after the usual simulation has been launched and using its output files. Then, in an automated process one can check the existence of the files before launching the digitizing script, this can be done with an if statement in the bash script:

if [ -f "$SIMFILE" ] && [ -f "$GEOFILE" ]; 
then
	echo "Running digitization for $SIMFILE using geofile:$GEOFILE."
	/cvmfs/sndlhc.cern.ch/SNDLHC-2022/March10/sw/slc7_x86-64/Python/v3.6.8-local1/bin/python3 $SNDLHC_mymaster/sndsw/shipLHC/run_digiSND.py -n $NEVENTS -g $GEOFILE -f $SIMFILE
else 	
	echo "WARNING, files not found."
	return
fi

NOTE: the command above launches the script with default detector thresholds: 3.5 KeV for Scifi and 0.0 KeV for MuonSystem L & MuonSystem S.

As far as I understood such a digitizing script can be applied to all kind of simulations either being passing muons simulations or muon DIS simulations or whatever.

Last updated