SBND Guide for Summer 2020 » History » Version 21
SBND Guide for Summer 2020¶
- Table of contents
- SBND Guide for Summer 2020
- 1. Setup the SBND environment
- 2. Run existing larsoft software
- 3. Install and develop larsoft software
- 4. Generate Single Particle Events
- 5. Look at the Generated Events in the Event Display
- 6. Generate an Analysis TTree
Log in to an SBND virtual machine:
You will land in an area called
nashome, from there you have two main other areas available:
/sbnd/app/users/$USER/: Here you should store your software (if this directory doesn't exist, you can create it with
/sbnd/data/users/$USER/: Here you should store your files (if this directory doesn't exist, you can create it with
Remember that the
apparea has limited disk space, so please do not store any data file there, but only the code you need.
1. Setup the SBND environment¶
Go to the
app area, where we can install and develop software:
Setup the SBND environment first:
It is good practice to move to a custom working directory (you can give it a name of your choice):
MY_WORKDIR=/sbnd/app/users/$USER/workdir mkdir $MY_WORKDIR cd $MY_WORKDIR
2. Run existing larsoft software¶
setup sbndcode v08_43_00 -q e19:prof
This setup allows you to have the full sbnd software available, without the need to build it yourself.
This is useful if you need to run existing software. If instead you need to modify existing code (or create new one), you will have to download sbndcode in your area, develop, and build your version of sbndcode. Instructions to do this are in the section below.
You can also list existing sbndcode versions by running
ups list -aK+ sbndcode
In general, you should select the latest version.
3. Install and develop larsoft software¶
You can skip this section if you don't need to develop sbndcode.
4. Generate Single Particle Events¶
This section will show you how to generate particles in the SBND detector to simulate a sample of single-particle generated events.
"Single-particle" means that every event will contain an initial generated particle, with the kinematics of your choice. The event will not contain a simulated neutrino event.
Note that the initial particle is then propagated though GEANT4, which might then create additional other particles in the event (delta-rays, electromagnetic showers, etc.).
Once you have done steps 1 and 2, open a new file (call it, for example,
prodsingle_muon_sbnd.fcl) and add the following lines in it:
#include "prodsingle_sbnd_proj.fcl" physics.producers.generator.PDG:  # Generate muons (1 muon per event) physics.producers.generator.P0:  # With an initial momentum of 3 GeV physics.producers.generator.X0:  # At a starting X position = 155 cm physics.producers.generator.Y0:  # At a starting Y position = 0 physics.producers.generator.Z0:[-25] # At a starting Z position = -25 cm physics.producers.generator.Theta0XZ: [-11.] # With an initial angle of -11 degrees in the X-Z plane, from the Z axis physics.producers.generator.Theta0YZ:  # With an initial angle of 0 degrees in the Y-Z plane, from the Z axis physics.producers.generator.SigmaThetaXZ:  # With an angular spread of 20 degrees in the Y-Z plan physics.producers.generator.SigmaThetaYZ:  # With an angular spread of 20 degrees in the Y-Z plan physics.producers.generator.AngleDist: 1 # With angles Gaussian distributed
(More information on all the settable parameters can be found here)
prodsingle_muon_sbnd.fcl is your driver to run larsoft jobs.
You can run via:
lar -c prodsingle_sbnd_proj.fcl -n 10
where the option
-n 10 means that we are generating 10 events.
If you now look in the directory (can do it via
ls -ltrh), you can see that several files have been produced. One of them is called
prodsingle_sbnd_SinglesGen-XXX.root. This is the file that contains the generated events, with our muons in them. The events in this file have not been propagated in the detector using GEANT4 just yet, and the detector simulation has also not happened. We need to run this ourself.
Here is how to do it:
lar -c standard_g4_sbnd.fcl -s prodsingle_sbnd_SinglesGen-*.root -n 10
This job will produce an output file called
prodsingle_sbnd_SinglesGen-XXX_G4-XXX.root, which now contains the all the particles propagated by GEANT4.
Finally, we can run the detector simulation:
lar -c standard_detsim_sbnd.fcl -s prodsingle_sbnd_SinglesGen-*_G4-*.root -n 10
The output file
prodsingle_sbnd_SinglesGen-XXX_G4-XXX_DetSim-XXX.root contains your generated events runt through detector simulation.
5. Look at the Generated Events in the Event Display¶
More information on how to use the event display are here.
Log in to
sbndgpvm04 and run
source /sbnd/app/users/mdeltutt/static_evd/setup.sh evd.py -s $MY_WORKDIR/prodsingle_sbnd_SinglesGen-XXX_G4-XXX_DetSim-XXX.root
Click on "Raw Digit" in the top right, and you will the waveforms from your generated events.
6. Generate an Analysis TTree¶
Now that you have generated your own events, you can run one last job, which will extract all the relevant information for you and place then in an output ROOT TTree.
You can run:
cd $MY_WORKDIR lar -c run_hitdumper.fcl -s prodsingle_sbnd_SinglesGen-XXX_G4-XXX_DetSim-XXX.root
This will create a file called
hitdumper_tree.root. You can explore what is in the file:
root -l hitdumper_tree.root root hitdumper->cd() root hitdumper->Print()
Let's look at the hit time vs. hit wire for TPC 1 and only for the collection plane:
root -l hitdumper_tree.root root hitdumper->cd() root hitdumpertree->Draw("hit_peakT:hit_wire", "hit_tpc == 1 && hit_plane == 2")
Or you can look at the optical hits. For example, let's look at the Y and Z position of the stored optical hits in TPC 0. These correspond to the PMTs positions:
root -l hitdumper_tree.root root hitdumper->cd() root hitdumpertree->Draw("ophit_opdet_y:ophit_opdet_z", "ophit_opdet_x<0 && ophit_opdet_x != -9999", "colz")
What are all the information stored in the TTree?¶
All the variables stored are described here.