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, 2:30:21 PM (8 years ago)
- Author:
-
Clarence Wret
- Comment:
-
--
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v42
|
v43
|
|
3 | 3 | = How to add a sample in NUISANCE = |
4 | 4 | |
5 | | 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 already implemented measurements, and I'd advise potential readers to have a look around in the `src` directory in addition to reading this guide. |
| 5 | 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. |
6 | 6 | |
7 | 7 | For 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. |
… |
… |
|
111 | 111 | Now that we have the rough structure set-up, we can finally start writing some code. |
112 | 112 | |
113 | | |
| 113 | [=#point_header] |
114 | 114 | == Writing the header == |
115 | 115 | |
… |
… |
|
152 | 152 | |
153 | 153 | [=#point_const] |
154 | | == Making the constructor == |
| 154 | == Writing the constructor == |
155 | 155 | |
156 | 156 | 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. |
… |
… |
|
249 | 249 | == Specifying the event-level dependent variable(s) == |
250 | 250 | |
| 251 | 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. |
| 252 | |
| 253 | This is where the p,,mu,, and E^rec^,,nu,, implementations differ. |
| 254 | |
| 255 | The `FitEvent` class provides numerous getter functions to make `FillEventVariables` as simple as possible. |
| 256 | |
| 257 | === For the p,,mu,, === |
| 258 | |
| 259 | To get the muon momentum, we first need a muon in the event. The function `FitEvent::NumFSParticle(int pdg)` counts the number of final-state particles with pdg-code `pdg` and returns that number. So our first check is |
| 260 | |
| 261 | {{{ |
| 262 | // Need to make sure there's a muon |
| 263 | if (event->NumFSParticle(13) == 0) return; |
| 264 | }}} |
| 265 | |
| 266 | To then get the muon kinematics in the `FitEvent` we use `FitEvent::GetHMFSParticle(int pdg)` to get the '''H'''ighest'''M'''omentum'''F'''inal'''S'''tate'''Particle''', which return a `FitParticle` object. The implementation for the `FitParticle` is in `FitBase/FitParticle.cxx`. We can now access the ROOT object `TLorentzVector` which stores the kinematics for the muon. So to get the muon we do: |
| 267 | |
| 268 | {{{ |
| 269 | // Get the muon |
| 270 | TLorentzVector Pmu = event->GetHMFSParticle(13)->fP; |
| 271 | }}} |
| 272 | === For the E^rec^,,nu,, === |
| 273 | |
| 274 | |
| 275 | |
251 | 276 | [=#point_signaldef] |
252 | 277 | == Specifying a signal definition == |
… |
… |
|
333 | 358 | }}} |
334 | 359 | |
335 | | === Make NUISANCE aware of the sample === |
| 360 | = Make NUISANCE aware of the sample = |
336 | 361 | FCN/SampleList |
337 | 362 | |
338 | | === Add the sample to the makefile === |
| 363 | = Add the sample to the makefile = |
339 | 364 | CMake |
| 365 | |
| 366 | = Possible extensions = |
| 367 | 2D is similar |