This page contains some miscellanous notes for developers
On this page:
- Structure of the Code
- Setting up your Development Area
- Before making any changes
- Adding a branch to EventNtuple
The code is structured in the following way:
src/EventNtupleMaker_module.cc
contains the art analyzer module that creates theTTree
inc/*Info*.hh
contain C++-stylestructs
(which we call "InfoStructs"). Each InfoStruct corresponds to a branch and the struct members correspond to leavessrc/InfoStructHelper.cc
andsrc/InfoMCStructHelper.cc
contain helper functions that take an Offline data product and an InfoStruct and fills the members of the InfoStruct with information from the Offline data product
We follow the general mu2e developer workflow given here. Namely, create your own fork on GitHub, clone it, and set up the central Mu2e/EventNtuple repository as a remote.
Create an EventNtuple and validation file following these instructions
Before adding a branch to the EventNtuple consider whether it will be a single-object branch (i.e. there will be one InfoStruct for a whole event), or whether it will be a vector branch or a vector-of-vector branch (i.e. there will be many InfoStructs per event). Examples are listed in doc/branches.md.
Here are the changes to make to the code:
- Create a new InfoStruct in
inc/
(or identify one that can be re-used)- make sure to add a comment line like
// NameOfStruct: description
forntuplehelper
compatibility - also make sure to add a description for every leaf as an in-line comment for
ntuplehelper
compatibility - all leaves should be initialized to default values (i.e.
type leafname = default_value;
) - there should be a
reset()
function
- make sure to add a comment line like
- Add fill functions to either
InfoStructHelper
orInfoMCStructHelper
depending on whether these are reco or MC data products- make sure to pass by reference
- In
src/EventNtuple_module.cc
:- add a
#include
to your new InfoStruct (if applicable) - in
struct Config
add afhicl::Atom<art::InputTag>
for the collection name - in the
private:
block, add- an
art::InputTag
for the collection name - an
art::Handle<DataProduct>
for the collection - an
InfoStruct
(orstd::vector<InfoStruct>
) to hold the data for the EventNtuple
- an
- in the constructor:
- get the tags from the input in the initializer list
- fill in empty InfoStructs
- in
beginJob()
create the branch- make sure to add a
.
to the end of the branch name so that the leaves can be accessed with ROOT
- make sure to add a
- in
analyze()
:- at the start, reset your InfoStructs so that data is not left in them from previous events
- get the
art::Handle
to your data product in the event using theart::InputTag
- fill in your InfoStructs with the
_infoStructHelper
- add a
- In
src/classes.h
add your new InfoStruct header file - In
src/classes_def.xml
add your InfoStruct and vector etc. if applicable - In
fcl/prolog.fcl
add your new input tag fhicl parameter - Compile and test:
muse build -j4 --mu2eCompactPrint
mu2e -c EventNtuple/fcl/from_mcs-mockdata.fcl -s test-art-file.art -n 10
- Add to
ntuplehelper
- instructions here
- Add to validation, RooUtil, and PyUtil
- [instructions to be completed... for the time being contact Andy and Sophie for this]
- Run validation
- both test_fcls.sh, and
- and valCompare steps
- Update documentation
- update
doc/branches.md
usingntuplehelper
(see here) - add an example script somewhere that uses the new branch
- update