Project

General

Profile

Getting started using v06 of LArSoft

Please follow this link

Getting Started Tutorial (v04_35_00, updated on February 2, 2016)

Step 0: Some background reading...

Read the following page for helpful pointers on building/running/developing/committing DUNE code in LArSoft.

https://cdcvs.fnal.gov/redmine/projects/dunetpc/wiki/_Tutorial_

The rest of this page contains some specific instructions on getting started with 35t reconstruction and analysis.

Step 1: Set up your working area

First, set up the DUNE software:

source /grid/fermiapp/products/dune/setup_dune.sh

Create a new working area if you don't already have one (inserting your own directory name into the example below):

my_name=mstancar
my_dir=tutorial
my_installation=/dune/app/users/${my_name}/${my_dir}
mkdir -p ${my_installation}

Set up the working area (the example below uses LArSoft v04.06.01), then grab and build the corresponding version of dunetpc:

my_version=v04_35_00
my_compiler=e9
my_type=debug

cd ${my_installation}
mrb newDev -v ${my_version} -q ${my_type}:${my_compiler} 
source localProducts_larsoft_${my_version}_${my_type}_${my_compiler}/setup
cd srcs ; mrb g -t ${my_version} dunetpc ; cd ../
cd $MRB_BUILDDIR ; mrbsetenv ; mrb i ; cd ../
mrbslp

Or, if you already have a working area, set up your existing area:

my_version=v04_35_00
my_compiler=e9
my_type=debug

cd ${my_installation}
source localProducts_larsoft_${my_version}_${my_type}_${my_compiler}/setup
mrbslp

You can get a list of versions of a ups product with this command (using larsoft as the exmaple):

ups list -aK+ larsoft

The resulting list is not necessarily sorted.

Step 2: Generate a sample of events

We'll use the single-particle generator to simulate a sample of events in the 35t detector. This uses the GEANT4 Particle Gun to inject particles into the 35t detector. By default, a sample of single muons is simulated.

lar -c prodsingle_dune35t.fcl
ls -ltr # see the files that you made, single35t_gen.root and single35t_hist.root

The particle gun can be configured with the type of particles, their distribution of energy and angle, and their distribution of vertex positions. A great manual for DUNE users can be found here: http://lbne2-docdb.fnal.gov:8080/cgi-bin/ShowDocument?docid=9645

You can change the configuration of the particle gun by creating your own local version of the "prodsingle_dune35t.fcl" file:

cd $MRB_TOP
mkdir job # if you haven't already created this directory
cp srcs/dunetpc/dune/EventGenerator/prodsingle_dune35t.fcl ./job

For example, to change the angle of incident particles in the XZ plane, open up "job/prodsingle_dune35t.fcl" in a text editor and add the following line to the end of the file:

physics.producers.generator.Theta0XZ: [ 30.0 ]  # change the thetaXZ angle from 0 to 30 degrees

Step 3: Look at the event sample in an event display

Use the 35t event display to scan through your events:

lar -c evd_dune35t.fcl single35t_gen.root

You can modify the event display by creating your own local version of the "evd_dune35t.fcl" file.

cd $MRB_TOP
mkdir job # if you haven't already created this directory
cp $DUNETPC_DIR/job/evd_dune35t.fcl ./job

Open up the file "job/evd_dune35t.fcl" in a text editor and add the following line at the end of the file:

services.user.ColorDrawingOptions.ColorOrGrayScale:  1

Re-run the event display, and see what changed (it's now grey!). The colour version is shown below. The top panel show the collection plane, and the two lower panels show the induction planes. Note the effect of wire-wrapping in the induction planes.

Step 4: Reconstruction and analysis

Now we'll run the 35t reconstruction up to the hit-finding level, and make an analysis tree containing the hit information.

Some background information (last updated in April 2014)

First, a little larsoft/git/mrb discussion! The larsoft code is currently divided into nine pieces, and each piece is a separate git repository. The nine repositories currently are larana, larcore, lariat, lareventdisplay, larevt, larexamples, larpandora, larreco, and larsim. In addition, each experiment has at least one repository that contains experiment specific code, in our case "dunetpc". For each repository, git keeps a "master" version of the code (the master branch) that is safe - only certain competent people change things here. The working version that all users can modify is called "develop" or "the development branch" and it is this branch that you pulled down (or copied, or checked out) for dunetpc. If you type "ls ${MRB_SOURCE}" you will see one directory for each repository you pulled down, only "dunetpc" if you followed this example to the letter. If you go to the directory $MRB_SOURCE/dunetpc, and type "git status", it will tell you which branch you pulled down.

But now, you want to add something to what you pulled down, namely code that makes a tree with information about the events for you to do some analysis. Anything you add has to be associated with one of the repositories, even if it stays only in your own private copy of that repository and is never incorporated into the public development branch. The appropriate place for personal analysis code is the dunetpc repository. Note that the instructions below won't tell you how to commit code back to dunetpc yet.

If you want to know more about larsoft/git/mrb stuff, feel free to corner an expert and interrogate them!

Building and running the analysis tree code

Back to our analysis tree and the list of hits . . .

The analysis tree code and scripts are attached to this wiki page. Copy these files in to your working area as follows:

cd $MRB_TOP/srcs/dunetpc/dune/
mkdir HitDumper
cp CMakeLists.txt HitDumper/
cp HitDumper_module.cc HitDumper/

cd $MRB_TOP 
mkdir job # if you haven't already created this directory
cp hitdumper.fcl ./job
cp hitdump_35ton.fcl ./job
cp evd_35t_hit.fcl ./job
cp evd_35t.fcl ./job

You need to tell the builder to include new analysis module called "HitDumper". To do this, open the file "$MRB_TOP/srcs/dunetpc/dune/CMakeLists.txt" in a text editor and add the line add_subdirectory(HitDumper) to the end of the add_subdirectory list. Then, build the code as follows:

cd $MRB_BUILDDIR ; mrbsetenv ; mrb i
cd ../

Next, run the code over your simulated events as follows:

lar -c hitdump_35ton.fcl -o single35t_hits.root single35t_gen.root 
ls -ltr # see the files that you made, single35t_hits.root and reco_hist.root

Note that this script has been configured to cheat both the hit-finding and disambiguation! The output file "single35t_hits.root" contains the raw event, its Monte Carlo truth, and the reconstructed hits. take a moment to appreciate the large size of this file (several megabytes per event - Liquid Argon TPCs, assisted by LArSoft, output large volumes of data!). This output file can be switched off by opening "hitdump_35ton.fcl" in a text editor and removing "stream1" from "end_paths".

Looking at the reconstructed hits

You can take a look at the reconstructed hits in the event display as follows:

lar -c evd_35t_hit.fcl single35t_hits.root

An example display is shown below. The hits are shown with open black squares. You can toggle the raw signals onto the display by selection "Both" in the radio buttons at the bottom. You may need to zoom in on the vertical axis to see the squares. Note that the wrapped-wire ambiguities have now been disambiguated.

Looking at the analysis tree

Open the analysis tree in ROOT as follows:

root -l reco_hist.root
root [0]
Attaching file reco_hist.root as _file0..
root [1] hitdumper->cd()
root [2] hitdumper->Draw("hit_peakT:hit_wire","hit_tpc ==1 && hit_plane == 0") // tdc vs wire (TPC 1, Plane 0)
root [3] hitdumper->Draw("hit_peakT:hit_wire") // tdc vs wire (all TPCs and views superimposed)

The second plot should look something like this:

Things specific to v03_00_00

These parameters may not be set correctly in the default fcl files. You can add these lines at the end of your main fcl file to modify them.

services.user.DetectorProperties.TimeOffsetU:       0.
services.user.DetectorProperties.TimeOffsetV:       0.
services.user.DetectorProperties.ReadOutWindowSize: 3200
services.user.DetectorProperties.NumberTimeSamples: 3200
services.user.LArProperties.Electronlifetime:  99e3              #microseconds
services.user.TimeService.TriggerOffsetTPC:   30.

Note you need to add these lines to both the file that generates events (i.e. prodsingle_dune35t.fcl) and the file that analyses them (i.e. hitdump_35ton.fcl)

Older links and info.

Obsolete LBNE code getting-started wiki page:

https://cdcvs.fnal.gov/redmine/projects/lbnecode/wiki/_Tutorial_

Any questions?

Ask Michelle and Tom - they will be happy to help!

Attachments