Skip to content

Latest commit

 

History

History
72 lines (60 loc) · 4.3 KB

developers.md

File metadata and controls

72 lines (60 loc) · 4.3 KB

Notes for Developers

This page contains some miscellanous notes for developers

On this page:

Structure of the Code

The code is structured in the following way:

  • src/EventNtupleMaker_module.cc contains the art analyzer module that creates the TTree
  • inc/*Info*.hh contain C++-style structs (which we call "InfoStructs"). Each InfoStruct corresponds to a branch and the struct members correspond to leaves
  • src/InfoStructHelper.cc and src/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

Setting up your Development Area

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.

Before making any changes

Create an EventNtuple and validation file following these instructions

Adding a branch to EventNtuple

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:

  1. Create a new InfoStruct in inc/ (or identify one that can be re-used)
    • make sure to add a comment line like // NameOfStruct: description for ntuplehelper 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
  2. Add fill functions to either InfoStructHelper or InfoMCStructHelper depending on whether these are reco or MC data products
    • make sure to pass by reference
  3. In src/EventNtuple_module.cc:
    • add a #include to your new InfoStruct (if applicable)
    • in struct Config add a fhicl::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 (or std::vector<InfoStruct>) to hold the data for the EventNtuple
    • 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
    • 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 the art::InputTag
      • fill in your InfoStructs with the _infoStructHelper
  4. In src/classes.h add your new InfoStruct header file
  5. In src/classes_def.xml add your InfoStruct and vector etc. if applicable
  6. In fcl/prolog.fcl add your new input tag fhicl parameter
  7. Compile and test:
muse build -j4 --mu2eCompactPrint
mu2e -c EventNtuple/fcl/from_mcs-mockdata.fcl -s test-art-file.art -n 10
  1. Add to ntuplehelper
  2. Add to validation, RooUtil, and PyUtil
    • [instructions to be completed... for the time being contact Andy and Sophie for this]
  3. Run validation
  4. Update documentation
    • update doc/branches.md using ntuplehelper (see here)
    • add an example script somewhere that uses the new branch