|
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, 1:13:51 PM (8 years ago)
- Author:
-
Clarence Wret
- Comment:
-
--
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v34
|
v35
|
|
109 | 109 | = Coding up a sample = |
110 | 110 | |
111 | | Now that we have the rough structure set-up, we can finally start writing some code! :) |
| 111 | Now that we have the rough structure set-up, we can finally start writing some code. |
112 | 112 | |
113 | 113 | |
… |
… |
|
116 | 116 | In 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`. |
117 | 117 | |
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)`. |
| 118 | NUISANCE 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)`. |
120 | 119 | |
121 | 120 | The `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. |
122 | 121 | |
123 | | Our header file then looks something like: |
| 122 | [=!point_signal] |
| 123 | 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,,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 | |
| 125 | Our header file now looks like: |
124 | 126 | |
125 | 127 | {{{ |
… |
… |
|
144 | 146 | }}} |
145 | 147 | |
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. |
| 148 | where 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 | |
| 153 | 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 executables. |
151 | 154 | |
152 | 155 | Most 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 | |
| 157 | The arguments to `Measurement1D::SetupMeasurement` are: |
153 | 158 | |
154 | 159 | * inputfile: the location of the input file containing generated events |
… |
… |
|
192 | 197 | == Specifying the event-level dependent variable(s) == |
193 | 198 | |
| 199 | [=#point_signaldef] |
194 | 200 | == Specifying a signal definition == |
195 | 201 | |
|