This package contains code that shows you how to use d0root in the TMB, TMBTree, and top_analyze (object reader) environments. This page contains instructions for how to build and run in each of the environments, and a short list of what directions I'm hoping to push this package. In particular, several d0root based source files are run on all formats of data.
The directories
There are two functions with d0root code that you can start with to do various tasks. Both are located in the src directory. Both are passed the ReadEvent object as an argument. The ReadEvent header can be found in d0root_analysis/read_event/ReadEvent.h -- it is an abstract class. Use it to get lists of jets, tracks, etc. The objects themselves can be found in d0root_analysis/objects.
Each environment -- TMB, TMBTree, and top_tree -- requires different infrastructure code to load in the event, loop over the events, and convert the events to d0root format. This code is unique to each environment and calls the common code routines listed above.
While d0root is undergoing development, it can be hard to get a working set of packages together. And getting them checked out is even more painful. We used to maintain a list below, but it turns out it was often out of date vs the what really worked. In stead, we've moved the information into a file called checkout_bid.sh that resides in the btags_cert package. It is a script that will automatically check out the required packages for you for a given format.
Package Tag d0root_example v00-02-03 btags_cert (p16) v00-02-09 btags_cert(p14) p14cert-br-07
Notes:
Scripts have been created to aid with downloading and running these packages. For all formats, follow the following instructions. Replace <format> with either tmb, tmb_tree, or top_tree. Release shoudl be the release this is used for. For p14 this was last tested on p14.06.00, and for p16 it was last tested on p16.06.00.
setup D0RunII <release> setup d0cvs newrel -t <release> root_example cd root_example d0setwa addpkg d0root_example <tag-from-table> addpkg btags_cert <tag-from-table> d0root_example/checkout.sh <format> btags_cert/checkout_bid.sh <format>
Next follow instructions for the particular format. Make sure you do the d0setwa or you'll be sorry 9-ways to heck. When you forget this a lot of times the error messages you get later are... weird.
This code was last tested on p14.06.00. The code is known not to work on some earlier versions of p14 due to muo_candidate versioning problems (before p14.05.01). You'll need a TMB file stored somewhere.
gmake setup d0tools rund0exe -exe=D0RootExample_x -rcp=runD0RootExampleTMB.rcp \ -rcppkg=d0root_example -localbuild -localrcp -localfwkrcp \ -filelist=test.dat -num=10
The file test.dat contains the listing of the TMB files you want to run over (the standard rund0exe format). When you run you should see an output buried in your .out file that looks something like this one. Use the framework rcp file runD0RootExampleBTagTMB.rcp to run the btagging instead of the simple jet looping.
The setenv command is required only when running the btagging code. d0root_btag is built as a shareable library, and so must be in the executable path or it won't be found when running. We are working to see how we can get around this without breaking too much code.
During the build of d0root_analysis, under KCC, you'll get a large number of warnings for unreachable code. This is known, and is an incompatibility between the compiler and rootcint, the code generator in root. Ignore them. Under gcc this works fine.
The infrastructure code is in the D0RootExample.cpp class.
When you are ready to create your own analysis environment, copy the package D0RootExample, and make sure to copy the OBJECTS file from the bin area, and the run rcp from the rcp area. In particular, you must include the d0root_tmb package d0rootPkg in the execution stream before your new package (see the file d0root_example/rcp/runD0RootExampleTMB.rcp).
The packages:
It shouldn't be a problem to run on the DST. Modify the runD0RootExample.rcp or runD0RootExampleBTag.rcp so that it doesn't do the unpacking.
The code is known not to work on earlier versions of p14 than p14.06.00 due to muo_candidate versioning problems.
You'll need a TMBTree file stored somewhere. Start with the following:
gmake d0root_btag.all gmake d0root_jlip.codegen gmake d0root_analysis.codegen [p14]cp tmb_analyze/macros/MakeTMBTreeClasses_so.C . [p16]cp $SRT_PUBLIC_CONTEXT/tmb_tree/macros/MakeTMBTreeClasses_so.C . root -l -q MakeTMBTreeClasses_so.C root -l -q d0root_example/macros/loop_over_jets.C
You need repeat only the last line each time you want to run your analysis code. The first three lines are all initialization that is needed only once per directory (note that you'll get some warnings you can ignore!). You'll have a screen full of lines that looks like this. Use the loop_over_btags.C file to run simple btagging instead of simple jet looping. Use the loop_over_PV.C file to run a simple PV finder example.
The d0setwa command is crucial. You'll be very sorry if you don't issue it, and the errors you get will never lead you to think that this is what you've forgotten!
The two infrastructure files, loop_over_jets.C and loop_over_btags.C differ only in loading the d0root_btag sharable library.
The current version is known not to work on p15 and the head because of the change in the location of the TMB MC classes (moved from the mc_analyze to the tmb_tree package). This is easy enough to change. Also, the MakeTMBTreeClasses_so.C has moved from tmb_analyze to tmb_tree in p15 and the head.
The packages:
This code was last tested on p14.08.00. The code is known not to work on earlier versions of p14 due to muo_candidate versioning problems. You'll need a top_analyze file stored somewhere.
gmake top_tree_example \ /rooms/barbershop/projects/MUqcd/p14.03.02/sk70/output_00.root
The gmake will have a few warnings about bad conversions and unreachable code, but you can ignore them. The executable takes one command-line-argument -- the location of the top-tree file.
Use top_tree_btag_example to run the btagging code.
The setenv command is required only when running the btagging code. d0root_btag is built as a shareable library, and so must be in the executable path or it won't be found when running. We are working to see how we can get around this without breaking too much code.
The infrastructure code can be found in top_tree/top_tree_example.cpp and its btag counterpart (they are almost identical, of course).
The Packages:
To build an executable that runs on TMBTrees as input, follow the below instructions. The below instructions should work, but they fail when building linked_physobj. I'll update as soon as I found out why this is failing.
setup D0RunII p14.06.00 newrel -t p14.06.00 root_example cd root_example d0setwa addpkg xxx <tag> All tags marked "Y" in the "Required to build d0root example and sa TMBTree*" column? gmake run the resulting executable.
This process currently hangs when trying to build linked_physobj -- actually it doesn't hang, it just takes more than 20 minutes to generate the d0om files (see the p14.06.00 log file <works only if you are in the fnal.gov domain). I'm afraid I didn't have the patience to wait this out.
This information is preliminary; d0root isn't officially supported on p15 or the head yet (p14 is the BID's focus right now). All testing was done in p15.07.00
This is a short list of things that are (I hope) coming for this package.