Project

General

Profile

exercises » History » Version 7

« Previous - Version 7/42 (diff) - Next » - Current version
Eric Church, 02/08/2014 04:48 PM


LArSoft Exercises

Run a simple lar job to create mu-'s of momentum 1.5 GeV/c from a point source.

We will create a file containing events that each have a single muon using the code in a public place. That means you will not need to build any code at this stage. So, go to your test release, that is your working directory. You made this in the guide. Set yourself up to run there with an appropriate mrb working directory, which we call lgm here. All this is explained at https://cdcvs.fnal.gov/redmine/projects/uboonecode/wiki/Uboone_guide. In this first exercise you are going to run from fcl files and .so libraries -- files that form the heart of the framework -- that live in the official places. You will setup to run against uboonecode nightly (or v1_00_02, say) and against larsoft nightly (or v1_00_02). Namely, you are not using your own code. So, let's first show the setup, which we urge you perform via an alias, like the following. Have a line like the below line starting alias in your ~/.bashrc. (Use an alias and hand-execute the alias each login; do not execute this stuff in your shell-initiated start up scripts like ~/.profile or ~/.bashrc.)

<uboonegpvm02.fnal.gov> alias ulgmr='source /grid/fermiapp/uboone/software/setup_uboone.sh; cd /uboone/app/users/username/lgm/build; setup uboonecode nightly -qe4:prof; source mrb slp;'  # a potential setup alias
<uboonegpvm02.fnal.gov> ulgmr # actually execute the commands in the alias

And now, run the executable on this canned fcl job script file.

lar -c prodsingle_uboone.fcl

This fcl file will produce 5 muons through the set of modules SingleGen, LArG4, and DetSim. That's pretty cool. But where did it find prodsingle_uboone.fcl? How do I know it will run 5 events?
The answer comes from looking at our job script fcl file. We find our fcl files from sleuthing from the key environment variable $FHICL_FILE_PATH.

<uboonegpvm02.fnal.gov> echo $FHICL_FILE_PATH 
.:./job:/grid/fermiapp/uboone/software/products/uboonecode/nightly/job:.:./job:/grid/fermiapp/products/larsoft/larpandora/nightly/job:/grid/fermiapp/products/larsoft/larana/nightly/job:/grid/fermiapp/products/larsoft/larreco/nightly/job:/grid/fermiapp/products/larsoft/larexamples/nightly/job:/grid/fermiapp/products/larsoft/lareventdisplay/nightly/job:/grid/fermiapp/products/larsoft/larsim/nightly/job:/grid/fermiapp/products/larsoft/larevt/nightly/job:/grid/fermiapp/products/larsoft/lardata/nightly/job:/grid/fermiapp/products/larsoft/nutools/v1_01_05/fcl:/grid/fermiapp/products/larsoft/larcore/nightly/job:/grid/fermiapp/products/larsoft/art/v1_08_10/fcl
<uboonegpvm02.fnal.gov> more /grid/fermiapp/uboone/software/products/uboonecode/nightly/job/prodsingle_uboone.fcl 

The job starts each event with a clean slate as indicated by the EmptyEvent key word. If you're running a job with recon modules in it only, EmptyEvent instead says RootInput, as you'll be sucking up an already-written root file in a previous job. Note that in prodsingle_uboone.fcl maxEvents is 5. Note the output root file full of histograms (that we declared and filled in the source code) is specified to be at single_hist_uboone.root and the output ART root file (which serves is the one that we'll pass onto any further modules in subsequent lar jobs) is to be called single_gen_uboone.root. Note, that these did indeed appear in your directory!

How did I make 1.5GeV/c muons and not, say, Higgsinos? The answer comes from drilling down into the included fcl files. From the job script we note that for the generator we need the fcl parameter set called microboone_singlep. fcl parameter sets are in fcl files in the same places as the job script fcl files: at all possible directories in $FHICL_SEARCH_PATH. So, let's search

<uboonegpvm02.fnal.gov> grep microboone_singlep /grid/fermiapp/uboone/software/products/uboonecode/nightly/job/*
grep microboone_singlep /grid/fermiapp/products/larsoft/lar*/nightly/job/*
The relevant return line is from the second effort: /grid/fermiapp/products/larsoft/larsim/nightly/job/singles.fcl:microboone_singlep: @local::standard_singlep. That's the only place where microboone_singlep appears on the left hand side of a colon, and that's where the parameter set is defined. Although, what we've learned is that this parameter set is equated to standard_singlep, which we must now hunt down, in turn. Note that the return from the greps shows us that after defining microboone_singlep to be standard_singlep, we then proceed to over-write some parameters like X0 and Z0, meaning we force the particles to be generated from a particular point in the TPC. We will return to this idea. We grep the lar* job areas again for singlep and discover the motherlode at /grid/fermiapp/products/larsoft/larsim/nightly/job/singles.fcl, which upon investigation shows the full single particle parameter set, including the line PDG: [13]. Hence, we have generated mu-s.

Let's move to the next exercise.

Change the mu-'s to K+'s of lower momentum and originating throughout the TPC.

Here we want to still use canned code: stuff from the nightly's or the vX_YY_ZZ's.

But we have to get ahold of the prodsingle_uboone.fcl to alter a couple parameters to do what we want to do in this exercise. For now, let's just grab a copy and put it in our local area and use that. (We know this will work, cuz the very first item in $FHICL_SEARCH_PATH is "."). So, in your working area go cp /grid/fermiapp/uboone/software/products/uboonecode/nightly/job/prodsingle_uboone.fcl .

Remembering that we can overwrite parameters at this stage, and that the generator module lives in the producers clause of the physics parameter set, open an editor on your new copy of prodsingle_uboone.fcl and put this line at the bottom in order to run 0.2 GeV/c K+s generated throughout the TPC, and not 1.5 GeV/c mu-s from a fixed point:

 
physics.producers.generator.PDG: [321] # K+ 
physics.producers.generator.P0: [ 0.2 ]
physics.producers.generator.SigmaX: [ 125.0 ] # width of Gaussian distribution, in cm
physics.producers.generator.SigmaY: [ 125.0 ]
physics.producers.generator.SigmaZ: [ 500.0 ]

Parameters in brackets are vectors. If I say

 
@physics.producers.generator.PDG: [321, 13, 22, 2112] # K+, mu-, gamma, n 

I'll choose randomly (flat distribution) to generate any of those 4 particle types. However, if we do that, we should now go overwrite every possible parameter in that set, as inherited from standard_singlep and make sure all of them are 4-elements long.

Add a module to capture some truth information in histograms and TTree branches.