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 42 and Version 43 of HowToAddSample


Ignore:
Timestamp:
Jan 6, 2017, 2:30:21 PM (7 years ago)
Author:
Clarence Wret
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowToAddSample

    v42 v43  
    33= How to add a sample in NUISANCE =
    44
    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.
     5This 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.
    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.
     
    111111Now that we have the rough structure set-up, we can finally start writing some code.
    112112
    113 
     113[=#point_header]
    114114== Writing the header ==
    115115
     
    152152
    153153[=#point_const]
    154 == Making the constructor ==
     154== Writing the constructor ==
    155155
    156156NUISANCE 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.
     
    249249== Specifying the event-level dependent variable(s) ==
    250250
     251We 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
     253This is where the p,,mu,, and E^rec^,,nu,, implementations differ.
     254
     255The `FitEvent` class provides numerous getter functions to make `FillEventVariables` as simple as possible.
     256
     257=== For the p,,mu,, ===
     258
     259To 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
     266To 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
    251276[=#point_signaldef]
    252277== Specifying a signal definition ==
     
    333358}}}
    334359
    335 === Make NUISANCE aware of the sample ===
     360= Make NUISANCE aware of the sample =
    336361FCN/SampleList
    337362
    338 === Add the sample to the makefile ===
     363= Add the sample to the makefile =
    339364CMake
     365
     366= Possible extensions =
     3672D is similar