Original author: J. Wolcott jwolcott@fnal.gov
Last update to this document: May 2020
This document briefly describes the configuration and usage of the NOvA reweighting tools contained in this package.
For build and installation instructions, see INSTALL.md
.
Contents:
- Getting and installing NOvARWGT
- How to use
- Contributing to NOvARwgt
- Support
Please see INSTALL.md for further instructions.
-
PATH SETUP
No matter how you have obtained the package, you will need to do the following:
- include
NOvARwgt
'sinc
directory in your C++ header path (e.g.,-I/path/to/NOvARwgt/inc
) - load
NOvARwgt
's library during linking (e.g.,-L/path/to/NOvARwgt/lib -lNOvARwgt
) - ensure
NOvARwgt
's library is accessible when your compiled code is run (e.g., add/path/to/NOvARwgt/lib
to$LD_LIBRARY_PATH
). - ensure the environment variable
$NOVARWGT_DATA
points to thedata
subdirectory of your installation and is available at runtime
If you are using an installation of
NOvARwgt
in FNAL UPS activated viasetup novarwgt
, these paths can be simplified by using/path/to/NOvARwgt/inc
-->${NOVARWGT_INC}
/path/to/NOvARwgt/lib
-->${NOVARWGT_LIB}
and
$LD_LIBRARY_PATH
,$NOVARWGT_DATA
should be set for you automatically. - include
-
WRITING CODE USING NOVARWGT
-
External users
Users external to the NOvA collaboration will likely be most interested in the
novarwgt::Tune
interface. Named tunes (which correspond to specific public analyses) can be accessed via#include "NOvARwgt/rwgt/tunes/Tunes<year of tune>.h"
Then, either construct a
novarwgt::EventRecord
(seeinc/NOvARwgt/rwgt/EventRecord.h
) directly, or use one of the interfaces (see the headers ininc/NOvARwgt/interfaces
) to convert an event record you already have into anovarwgt::EventRecord
.Obtaining event weights is then simple:
#include "NOvARwgt/interfaces/GenieInterface.h ... double GetWeight(const genie::EventRecord * genieEvt) { return novarwgt::kCVTune2018.EventWeight(novarwgt::ConvertGenieEvent(genieEvt)); } // note that you probably want to cache the converted event record // rather than repeating it from above, but this is just an example double GetSystsWgt(const genie::EventRecord * genieEvt, const std::map<std::string, double> & systPulls) { double wgt = 1.0; auto evt = novarwgt::ConvertGenieEvent(genieEvt); for (const auto & pullPair : systPulls) { if (pullPair.second == 0) continue; wgt *= novarwgt::kCVTune2018.SystKnobs().at(pullPair.first)->GetWeight(pullPair.second, evt); } return wgt; }
If desired,
novarwgt::Tune
can also return a vector of the individual weights that contribute to the total for an individual event by callingTune::EventWeightComponents()
on the event (seeinc/NOvARwgt/rwgt/Tune.h
). This returns a vector ofnovarwgt::NamedWeight
objects, each of which contains the weight itself as well as a short name to identify the knob. Similarly, thenovarwgt::Tune
contains a collections of the names of the systematic knobs it supports, which can be retrieved withTune::KnobNames()
. The knobs can then be addressed individually by name as in the code example above. -
NOvA users
NOvA users can of course use the
Tune
interface above. This is encouraged for the final tune used for major analyses. (BothCAFAna/Vars/XsecTunes.h
and the artMCReweight
service expose these tunes, so check there to see if you can reuse what's already available.)However, there may be situations where the individual weighters or systematic knobs themselves are desired. The best way to obtain them is to use the
const
instances of the various types sprinkled throughout the header files. Please seeCAFAna/Vars/GenieWeights.h
andCAFAna/Systs/XSecSysts.h
for examples of how to do this.(You can also make use of the
GetWeighter()
function ininc/NOvARwgt/rwgt/IWeightGenerator.h
, or the analogousGetSystKnob()
ininc/NOvARwgt/rwgt/ISystKnob.h
, which ensures there are not duplicate instances of any individual object, if the one you need was not instantiated. However, if the one you need is not available, also consider submitting a GitHub issue to request it be included in a future version.)Please see HACKING.md for instructions on how to prototype new weights or syst knobs that are not yet ready to be deployed publicly in NOvARwgt.
-
Please see HACKING.md for discussion on how to contribute to NOvARwgt.
If you are a user of NOvARwgt outside of the NOvA collaboration, and need help or clarification regarding the package, please contact the conveners of the NOvA Cross Section Tuning working group. As of May 2020, they are:
- Kirk Bays kirk.r.bays@gmail.com
- Aaron Mislivec misli002@umn.edu
If you are unable to reach the conveners, the NOvA co-spokespersons can direct you to the correct experts. The current co-spokespersons and their contact information are listed at http://novaexperiment.fnal.gov/collaboration.
If you are a member of the NOvA collaboration, please consult with the Cross Section Tuning working group via the mailing list or Slack.