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 34 and Version 35 of HowToAddSample


Ignore:
Timestamp:
Jan 6, 2017, 1:13:51 PM (8 years ago)
Author:
Clarence Wret
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowToAddSample

    v34 v35  
    109109= Coding up a sample =
    110110
    111 Now that we have the rough structure set-up, we can finally start writing some code! :)
     111Now that we have the rough structure set-up, we can finally start writing some code.
    112112
    113113
     
    116116In the case of our T2K CC1pi+ H,,2,,O data, we're dealing with 1D distributions. They should therefore inherit from the `Measurement1D` base class, as mentioned  [#point_base earlier]. The `Measurement1D` class is implemented in `src/FitBase/Measurement1D.cxx`.
    117117
    118 
    119 We 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). The `MeasurementBase` functions which we need to overload are `MeasurementBase::isSignal(FitEvent *event)` and `MeasurementBase::FillEventVariables(FitEvent *event)`.
     118NUISANCE requires 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). The `MeasurementBase` functions which we need to overload are `MeasurementBase::isSignal(FitEvent *event)` and `MeasurementBase::FillEventVariables(FitEvent *event)`.
    120119
    121120The `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.  The `FitEvent` class is implemented in `src/FitBase/FitEvent.cxx` and essentially the generator-independent common event format which NUISANCE uses for the generator events.
    122121
    123 Our header file then looks something like:
     122[=!point_signal]
     123We 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,,mu,, and dSig/dcosmu) 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].
     124
     125Our header file now looks like:
    124126
    125127{{{
     
    144146}}}
    145147
    146 where we've copied the constructor arguments from some other class we're using as a template.
    147 
    148 == Making the constructor ==
    149 
    150 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.
     148where we've copied the constructor arguments from some other class we're using as a template. I'll mention why this structure [#point_const below].
     149
     150
     151== Making the constructor == [=#point_const]
     152
     153NUISANCE 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 executables.
    151154
    152155Most of the automated setting up is done in `Measurement1D::SetupMeasurement(std::string inputfile, std::string type, FitWeight *rw, std::string fakeDataFile)`, so it makes sense to have a class constructor which passes all of these on to `SetupMeasurement`.
     156
     157The arguments to `Measurement1D::SetupMeasurement` are:
    153158
    154159 * inputfile: the location of the input file containing generated events
     
    192197== Specifying the event-level dependent variable(s) ==
    193198
     199[=#point_signaldef]
    194200== Specifying a signal definition ==
    195201