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 25 and Version 26 of HowToAddSample


Ignore:
Timestamp:
Jan 5, 2017, 5:22:53 PM (7 years ago)
Author:
Clarence Wret
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowToAddSample

    v25 v26  
    88
    99After 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.
     10
     11'''NUISANCE is currently fully written in C++03 and we would appreciate future contributions to adhere to this standard.'''
    1012
    1113{{{
     
    108110== Writing the header ==
    109111
    110 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, as mentioned  [#point_base earlier]. The `Measurement1D` class is implemented in `src/FitBase/Measurement1D.cxx`.
    111 
    112 
    113 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 `isSignal(FitEvent *event)` and `FillEventVariables(FitEvent *event)`.
     112In 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`.
     113
     114
     115We 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)`.
    114116
    115117The `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.
     
    138140}}}
    139141
     142
    140143== Making the constructor ==
    141144
    142 == Specifying the event-level dependent variable(s) ==
    143 
    144 == Specifying a signal definition ==
    145 
    146 
    147 = The final implementation =
    148 `T2K_CC1pip_H2O_XSec_1Dpmu_nu.cxx`:
    149 
    150 {{{
    151 #!cpp
     145NUISANCE loads samples through `FCN/SampleList.cxx` in the function `SampleUtils::LoadSample`, which makes a `std::list` of `MeasurementBase` pointers which it later loops over.
     146
     147Most 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`.
     148
     149 * inputfile: the location of the input file containing generated events
     150 * type: the type of comparison we want to make with this sample
     151 * rw: the reweighting engine which may or may not be used to reweight the sample
     152 * fakeDataFile: the location of a fake-data input file which is to be used as data instead of the actual data for fake-data studies
     153
     154
     155
     156
     157
     158{{{
    152159#include "T2K_CC1pip_H2O_XSec_1Dpmu_nu.h"
    153160
     
    160167  fName = "T2K_CC1pip_H2O_XSec_1Dpmu_nu";
    161168  fPlotTitles = "; p_{#mu} (GeV/c); d#sigma/dp_{#mu} (cm^{2}/(GeV/c)/nucleon)";
    162   EnuMin = 0.;
     169  EnuMin = 0.; 
    163170  EnuMax = 10.;
    164171  Measurement1D::SetupMeasurement(inputfile, type, rw, fakeDataFile);
     
    176183  fScaleFactor = (fEventHist->Integral("width")*1E-38)/double(fNEvents)/TotalIntegratedFlux("width");
    177184};
     185}}}
     186
     187== Specifying the event-level dependent variable(s) ==
     188
     189== Specifying a signal definition ==
     190
     191
     192= The final implementation =
     193`T2K_CC1pip_H2O_XSec_1Dpmu_nu.cxx`:
     194
     195{{{
     196#!cpp
     197#include "T2K_CC1pip_H2O_XSec_1Dpmu_nu.h"
     198
     199// The muon momentum
     200
     201//********************************************************************
     202T2K_CC1pip_H2O_XSec_1Dpmu_nu::T2K_CC1pip_H2O_XSec_1Dpmu_nu(std::string inputfile, FitWeight *rw, std::string  type, std::string fakeDataFile){
     203//********************************************************************
     204
     205  fName = "T2K_CC1pip_H2O_XSec_1Dpmu_nu";
     206  fPlotTitles = "; p_{#mu} (GeV/c); d#sigma/dp_{#mu} (cm^{2}/(GeV/c)/nucleon)";
     207  EnuMin = 0.;
     208  EnuMax = 10.;
     209  Measurement1D::SetupMeasurement(inputfile, type, rw, fakeDataFile);
     210
     211  // Data comes in ROOT file
     212  // hResultTot is cross-section with all errors
     213  // hResultStat is cross-section with stats-only errors
     214  // hTruthNEUT is the NEUT cross-section given by experimenter
     215  // hTruthGENIE is the GENIE cross-section given by experimenter
     216  SetDataFromFile(GeneralUtils::GetTopLevelDir()+"/data/T2K/CC1pip/H2O/nd280data-numu-cc1pi-xs-on-h2o-2015.root","MuMom/hResultTot");
     217  SetCovarFromDataFile(GeneralUtils::GetTopLevelDir()+"/data/T2K/CC1pip/H2O/nd280data-numu-cc1pi-xs-on-h2o-2015.root", "MuMom/TotalCovariance", true);
     218
     219  SetupDefaultHist();
     220
     221  fScaleFactor = (fEventHist->Integral("width")*1E-38)/double(fNEvents)/TotalIntegratedFlux("width");
     222};
    178223
    179224//********************************************************************