Exercise N

Special notes for Wed March 13

There are changes committed to art-workbook overnight.

  1. Added exercise ExN
  2. Added a script ups/setup_dep that will permit you to see the environment variables in the source window.

How to update from the repository

Log out from all sessions on ds50 ( not always necessary but its way to complicated to describe when you don't have ).

In your source window:

  1. login to ds50
  2. source /ds50/app/ds50/
  3. cd art-workbook
  4. git stash
  5. git pull
  6. git stash pop
  7. source ups/setup_deps -d
  8. printenv ART_INC

This last step should produce


The above steps did this:
  1. git stash: told git to find any changes you made, store them somewhere and restore your copy of the repository to the state it was in right after checkout.
  2. git pull: told git to update your code so that it matches the repository
  3. git stash pop: move your changes back in

If you only added files, and did not change anything, this will work fine. If you editted some existing files it's unlikely that your changes will collide with anything changed in the respostory.

After you have done the above, go to your build window:
  1. source /home/darkside/ds50app/
  2. cd build-workbook
  3. source ../art-workbook/ups/setup_for_development -d
  4. buildtool -c

With one exception, these are the standard instructions. The exception is that the last step asks for a clean build - ie delete everything and start again. It's possible that an incremental build will work but the time penalty for a clean build is small and it would take too long to describe when an incremental build is OK after a pull.

Running ExN

In your build window, after completing the previous steps:

  1. art -c ExN/exn.fcl
  2. ls output

You will see that this job made 4 output files:

output/allEvents_data.root  output/failTight_data.root  output/passLoose_data.root   output/passTight_data.root

We can look together at exn.fcl and talk about it.

You can readback any of these files, using, for example,

  1. art -c ExN/read.fcl output/passTight_data.root -T output/passTight_hist.root
  2. art -c ExN/read.fcl output/failTight_data.root -T output/failTight_hist.root

There are two other .fcl files that do the same thing as exn.fcl but which exercise some other features of .fcl to ensure that

  1. repeated blocks can be defined in one place and repeated as many time as needed
  2. You can define a repeated block with a parameter whose value is nil. You can then repeat this block as needed. Then you can override the nil values with real ones. This is conceptually similar to the concept of a pure virtual function.