nuisance is hosted by Hepforge, IPPP Durham
close Warning: Can't synchronize with repository "(default)" ("(default)" is not readable or not a Git repository.). Look in the Trac log for more information.

Changes between Version 21 and Version 22 of HowToAddSample


Ignore:
Timestamp:
Jan 5, 2017, 4:35:42 PM (7 years ago)
Author:
Clarence Wret
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowToAddSample

    v21 v22  
    66
    77For this tutorial I'll be adding the T2K CC1pi+ H,,2,,O data. The data comes from the [http://t2k-experiment.org/results/nd280data-numu-cc1pi-xs-on-h2o-2015/ T2K site] and [https://arxiv.org/abs/1605.07964 arxiv]. The data is supplied both in a ROOT file and a number of .csv files: I'll be using the ROOT file here.
     8
     9After this we'll be able to make data/MC comparisons to the T2K CC1pi+ H,,2,,O data-set for NEUT, GENIE, GiBUU and NuWro; all in the same framework. We'll get MC predictions, chi2 values, interaction mode contributions, and more using a consistent signal definition, guaranteed the same across the generators.
    810
    911{{{
     
    2729
    2830
    29 === Choosing a distribution ===
     31=== Choosing a cross-section distribution ===
    3032
    3133The T2K CC1pi+ H,,2,,O data release contains various distributions in FIG 4. In this tutorial I'll look at adding one kinematic distribution and one derived distribution: p,,mu,, and E^rec^,,nu,, shown below.
     
    4042NUISANCE is designed to easily allow adding new samples.
    4143
    42 Each experimental measurement is its own class. To simplify including new samples we supply a base class for 1D (`Measurement1D`) and 2D (`Measurement2D`) measurements, which in turn inherits from the virtual base class (`MeasurementBase`).
    43 
    44 These `MeasurementBase` classes are then looped over in the executables and data/MC comparisons are the result.
     44[=#point_base]
     45Each experimental measurement is its own class. To simplify including new samples we supply a base class for 1D (`Measurement1D`) and 2D (`Measurement2D`) measurements, which in turn inherits from the virtual base class (`MeasurementBase`).
     46
     47These `MeasurementBase` classes are then looped over in the executables and data/MC comparisons are the result. A class has to at least inherit from `MeasurementBase` and implement the necessary methods to be "looped over". The recommended method is to use and expand the supplied `Measurement1D` and `Measurement2D` classes; anything else may require expert knowledge and won't be covered here.
    4548
    4649The inheritance tree is simple and goes `Specific_Measurement -> MeasurementXD -> MeasurementBase`
     
    5053
    5154Some automatic processing is done on loading up the samples to set up generator scaling factors, chi2 calculations and so on. These are simple string comparisons done in the base class constructors, but do '''place responsibility on the user'''.
     55
    5256
    5357The structure is `Experiment_Measurement_Target_DataType_DimensionVar_Neutrino`:
     
    101105Now that we have the rough structure set-up, we can finally start writing some code! :)
    102106
    103 In the case of our T2K CC1pi+ H,,2,,O data, we're dealing with 1D distributions. They should therefore inherit from the `Measurement1D` class.
    104 
    105 Starting at the header we do
     107In the case of our T2K CC1pi+ H,,2,,O data, we're dealing with 1D distributions. They should therefore inherit from the `Measurement1D` class, as mentioned  [#point_base earlier].
     108
     109We will also require a `constructor` and `destructor` for the class, and we'll need to overload `MeasurementBase` methods which define the dependent variable(s) (p,,mu,, in our case) and what our signal is (CC interaction with one muon and one positive pion with no other pions or mesons and any number of nucleons in our case).
     110
     111The `MeasurementBase` functions which we need to overload are `isSignal(FitEvent *event)` and `FillEventVariables(FitEvent *event)`. The `FitEvent` class is an object which contains information about one single event: all the particles, their kinematics and their status after the interaction, the interaction channel which produced the final state, possible secondary interactions, the interaction target, and so on.
     112
     113The `FitEvent` class is implemented in `src/FitBase/FitEvent.cxx` and essentially the native format which NUISANCE uses.
     114
     115The signal is defined in the
    106116
    107117{{{
     
    110120
    111121#include "Measurement1D.h"
    112 
    113 class T2K_CC1pip_H2O_XSec_1Dpmu_nu : public Measurement1D
    114 #endif
    115 }}}
    116 
    117 to set up the inheritance. The `Measurement1D` class is implemented in `src/FitBase/Measurement1D.cxx`.
    118 
     122#include "T2K_SignalDef.h"
     123
     124class T2K_CC1pip_H2O_XSec_1Dpmu_nu : public Measurement1D {
     125public:
     126  T2K_CC1pip_H2O_XSec_1Dpmu_nu(std::string inputfile, FitWeight *rw, std::string  type, std::string fakeDataFile);
     127  virtual ~T2K_CC1pip_H2O_XSec_1Dpmu_nu() {};
     128
     129  void FillEventVariables(FitEvent *event);
     130  bool isSignal(FitEvent *event);
     131
     132  private:
     133};
     134
     135#endif
     136}}}
     137
     138The `Measurement1D` class is implemented in `src/FitBase/Measurement1D.cxx`.
    119139
    120140=== Making the constructor ===
     
    184204
    185205`T2K_CC1pip_H2O_XSec_1Dpmu_nu.h`:
    186 
     206{{{
    187207#ifndef T2K_CC1PIP_H2O_XSEC_1DPMU_NU_H_SEEN
    188208#define T2K_CC1PIP_H2O_XSEC_1DPMU_NU_H_SEEN
     
    203223
    204224#endif
    205 
     225}}}
    206226
    207227=== Make NUISANCE aware of the sample ===