|
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.
- Timestamp:
-
Jan 6, 2017, 11:16:07 PM (8 years ago)
- Author:
-
Clarence Wret
- Comment:
-
--
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v68
|
v69
|
|
3 | 3 | This is an informal step-by-step guide on how to add samples into the NUISANCE framework. Most of this can be derived by looking at the recently [https://nuisance.hepforge.org/trac/browser/src?order=date&desc=1 implemented measurements] for up-to-date references. |
4 | 4 | |
5 | | For this tutorial I'll be adding the '''T2K CC1π^+^ 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 [http://t2k-experiment.org/wp-content/uploads/nd280data-numu-cc1pi-xs-on-h2o-2015.tar both in a ROOT file and a number of .csv files]: I'll be using the ROOT file here but very similar steps apply when using .csv or .txt. files. |
| 5 | For this tutorial I'll be adding the '''T2K CC1π^+^ 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 [http://t2k-experiment.org/wp-content/uploads/nd280data-numu-cc1pi-xs-on-h2o-2015.tar both in a ROOT file and a number of .csv files]: I'll be using the ROOT file here but very similar steps apply when using .csv or .txt files. |
6 | 6 | |
7 | 7 | After implementing we'll be able to make data/MC comparisons to the T2K CC1π^+^ H,,2,,O data for NEUT, GENIE, GiBUU and !NuWro, all in the same framework. We'll get MC predictions, χ^2^ values, interaction mode contributions, and more using a consistent signal definition, guaranteed the same across the generators. |
… |
… |
|
78 | 78 | '''What to do:''' |
79 | 79 | |
80 | | Following the above convention, we end up with '''`T2K_CC1pip_H2O_XSec_1Dpmu_nu`'''. |
| 80 | Following the above convention, we end up with '''`T2K_CC1pip_H2O_XSec_1Dpmu_nu`''' and '''`T2K_CC1pip_H2O_XSec_1DEnuMB_nu`'''. |
81 | 81 | |
82 | 82 | This is a sufficient name: there is no ambiguity what the class describes and there is no way of confusing it with other classes in NUISANCE. |
… |
… |
|
94 | 94 | '''What to do:''' |
95 | 95 | |
96 | | Make the new files '''`src/T2K/T2K_CC1pip_H2O_XSec_1Dpmu_nu.cxx`''' and '''`src/T2K/T2K_CC1pip_H2O_1Dpmu_nu.h`'''. These are the implementation and header files for the new measurement. |
| 96 | Make the new files '''`src/T2K/T2K_CC1pip_H2O_XSec_1Dpmu_nu.cxx`''' and '''`src/T2K/T2K_CC1pip_H2O_1Dpmu_nu.h`'''. These are the implementation and header files for the new measurement and similar goes for the `1DEnuMB` implementation. |
97 | 97 | |
98 | 98 | |
… |
… |
|
124 | 124 | == Writing the header == |
125 | 125 | |
126 | | The T2K CC1π^+^ H,,2,,O data is all 1D distributions. The new classes should therefore inherit from the `Measurement1D` base class, as mentioned [#point_base earlier]. The `Measurement1D` class is implemented in `src/FitBase/Measurement1D.cxx`. |
| 126 | The T2K CC1π^+^ H,,2,,O data are all 1D distributions. The new classes should therefore inherit from the `Measurement1D` base class, as mentioned [#point_base earlier]. The `Measurement1D` class is implemented in `src/FitBase/Measurement1D.cxx`. |
127 | 127 | |
128 | 128 | NUISANCE requires a `constructor` and `destructor` for the class, and we'll need to overload `MeasurementBase` methods which define the dependent variable(s) (p,,µ,, and E^rec^,,ν,, 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). The `MeasurementBase` functions which we need to overload are `MeasurementBase::isSignal(FitEvent *event)` and `MeasurementBase::FillEventVariables(FitEvent *event)`. |
… |
… |
|
131 | 131 | |
132 | 132 | [=#point_signal] |
133 | | We see that the `src/T2K` directory contains `T2K_SignalDef.cxx`. This extends the `SignalDef` namespace which holds many of the signal definitions for the classes. If you're implementing multiple distributions for the same measurement (e.g. dSig/dp,,µ,, and dSig/dcosθ,,µ,,) we recommend adding the signal definition to the namespace rather than directly in the `isSignal(FitEvent *event)` function in the class implementation. We'll talk about implementing a signal definition [#point_signaldef later]. |
| 133 | We also note that the `src/T2K` directory contains `T2K_SignalDef.cxx`. This extends the `SignalDef` namespace which holds many of the signal definitions for the classes. `SignalDef` itself lives in `src/Utils/SignalDef.cxx`, but may see additions from experiment folders such as `src/T2K/T2K_SignalDef.cxx`. |
| 134 | |
| 135 | If you're implementing multiple distributions for the same measurement (e.g. dσ/dp,,µ,, and dσ/dcosθ,,µ,,) we recommend adding the signal definition to the namespace rather than directly in the `isSignal(FitEvent *event)` function in the class implementation. We'll talk about implementing a signal definition [#point_signaldef later]. |
134 | 136 | |
135 | 137 | |
… |
… |
|
160 | 162 | where we've copied the constructor arguments from some other class we're using as a template. I'll elaborate more on this [#point_const below]. |
161 | 163 | |
| 164 | Note the simple structure for the sample: we really only need to set up three functions. The inheritance from `Measurement1D` and helper function within it does most of the heavy lifting. |
| 165 | |
162 | 166 | |
163 | 167 | [=#point_const] |
164 | 168 | == Writing the constructor == |
165 | 169 | |
166 | | NUISANCE loads samples through `FCN/SampleList.cxx` in the function `SampleUtils::LoadSample`, which makes a `std::list` of `MeasurementBase` pointers which it later loops over from the executables. |
| 170 | NUISANCE loads samples through `FCN/SampleList.cxx` in the function `SampleUtils::LoadSample`. This function makes a `std::list` of `MeasurementBase` pointers which it later loops over in calls from the executables. |
167 | 171 | |
168 | 172 | Most of the automated setting up of histograms, titles, and so on is done in `Measurement1D::SetupMeasurement(std::string inputfile, std::string type, FitWeight *rw, std::string fakeDataFile)`. It hence makes sense to have a class constructor which passes all of these on to `SetupMeasurement`. |
… |
… |
|
225 | 229 | The data and covariance matrix are available in a ROOT file for the sample, so I used `Measurement1D::SetDataFromFile` to set up the data and `Measurement1D::SetCovarFromDataFile` to set up the covariances. |
226 | 230 | |
227 | | `fName` and the other `std::string`s were set to reasonable names and `fScaleFactor` was |
| 231 | `fName` and the other `std::string`s were set to reasonable names and `fScaleFactor` was set to the default mentioned above. |
228 | 232 | |
229 | 233 | The `constructor` for the class now looks like: |
… |
… |
|
263 | 267 | We are now at the point where we can write the `FillEventVariables(FitEvent *event)` implementation mentioned [=#point_header above]. This function defines the dependent variable(s) and how to get them from each `FitEvent` object that gets passed. |
264 | 268 | |
265 | | This is where the p,,μ,, and E^rec^,,ν,, implementations differ. |
266 | | |
267 | | The `FitEvent` class provides numerous getter functions to make `FillEventVariables` as simple as possible. |
| 269 | The `FitEvent` class provides numerous getter functions to make `FillEventVariables` implementation as simple as possible. |
| 270 | |
| 271 | This is the only major point where the p,,μ,, and E^rec^,,ν,, implementations differ. |
268 | 272 | |
269 | 273 | [=#point_muon_dist] |
… |
… |
|
337 | 341 | }}} |
338 | 342 | |
339 | | We should now write a helper function in the `FitUtils` namespace to get `E^rec^,,ν,,` from the muon, pion and neutrino `TLorentzVector`s. [https://arxiv.org/pdf/1605.07964v2.pdf The paper] specifies the exact form in equation 1. The `FitUtils` implementation lives in `src/Utils/FitUtils.cxx`. |
| 343 | We should now write a helper function in the `FitUtils` namespace to get E^rec^,,ν,, from the muon, pion and neutrino `TLorentzVector`s. [https://arxiv.org/pdf/1605.07964v2.pdf The paper] specifies the exact form in equation 1. The `FitUtils` implementation lives in `src/Utils/FitUtils.cxx`. |
340 | 344 | |
341 | 345 | {{{ |
|