-
Notifications
You must be signed in to change notification settings - Fork 39
CAFAna
NB: this page currently discusses the feature/cafana_srslice branch. This will be merged into develop soon.
CAFMaker produces one StandardRecord object per art::Event, i.e. one per beam spill / readout window.
However, most often you are interested in the properties of neutrino candidates, which are best represented as slices, of which there can be multiple per spill.
CAFAna provides SpillVar for when you want to fill one entry into your spectrum for each spill that passes certain cuts. It also provides SliceVar for when you want to fill your spectrum with a property of each slice that passes cuts. These are both, in fact, instances of the _Var template specialized over different parts of the StandardRecord structure, so they provide all the same functionality as each other.
Likewise, for selecting spills/slices there are SpillCut and SliceCut. Since many slice-based analyses need to also apply some quality cut on the spill, Spectrum provides several options as constructors:
-
SpillCut+SpillVar--SpectrumLoaderchecks each spill (StandardRecord) against the cut and then evaluates the var -
SliceCut+SliceVar-- in this caseSpectrumLoaderloops through each slice, checks it against the cut, and then evaluates the var for that slice -
SpillCut+SliceCut+SliceVar-- in this caseSpectrumLoaderchecks eachStandardRecordagainst the spill cut before looping through the slices as above
On occasion you may need to fill multiple values into your spectrum per spill or slice. For example filling one entry per track, or one entry per CRT hit. Or perhaps you have some complex requirements that can't be factorized as SpillCut+SliceCut. In this case you can use MultiVar, which behaves like Var but enables returning multiple values per slice. Or SpillMultiVar which returns multiple values per spill.
Note that if you want to make a selection of a subset of tracks/hits etc that can't be expressed with Cuts in this case. You must put that logic in your MultiVar and either fill into the output vector or not as appropriate.
The special-casing of slices, where looping over them and cutting on them is a built-in feature of SpectrumLoader is a little clunky. Ideally one could have, say, TrackCuts. This is in the works.
ROOT has trouble with nested vectors in data structures. This occurs, for example, where we have a vector of dE/dx values within a vector of showers within a vector of slices. CAFAna's solution to this problem is "flatCAFs". These can be produced along with the regular ("nested") CAFs by adding the FlatMaker module to the end of the job configuration. Or they can be produced after the fact using the convert_to_flat executable. FlatCAFs may be used in CAFAna exactly as if they were regular CAFs, no changes to your code required. They don't suffer from the nested vectors problem, and they are often faster to read. It's a win-win!
TODO
TODO