MaCh3 2.2.1
Reference Guide
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
SampleBinningInfo Struct Reference

KS: Small struct storying info about used binning. More...

#include <Samples/SampleStructs.h>

Collaboration diagram for SampleBinningInfo:
[legend]

Public Member Functions

int FindXBin (const double XVar, const int NomXBin) const
 DB Find the relevant bin in the PDF for each event.
 

Public Attributes

std::vector< double > XBinEdges
 Vector to hold x-axis bin-edges.
 
std::vector< double > YBinEdges
 Vector to hold y-axis bin-edges.
 
size_t nXBins = M3::_BAD_INT_
 Number of X axis bins in the histogram used for likelihood calculation.
 
size_t nYBins = M3::_BAD_INT_
 Number of Y axis bins in the histogram used for likelihood calculation.
 
std::vector< double > rw_lower_xbinedge
 lower to check if Eb has moved the erec bin
 
std::vector< double > rw_lower_lower_xbinedge
 lower to check if Eb has moved the erec bin
 
std::vector< double > rw_upper_xbinedge
 upper to check if Eb has moved the erec bin
 
std::vector< double > rw_upper_upper_xbinedge
 upper to check if Eb has moved the erec bin
 

Detailed Description

KS: Small struct storying info about used binning.

Definition at line 168 of file SampleStructs.h.

Member Function Documentation

◆ FindXBin()

int SampleBinningInfo::FindXBin ( const double  XVar,
const int  NomXBin 
) const
inline

DB Find the relevant bin in the PDF for each event.

Definition at line 190 of file SampleStructs.h.

190 {
191 //DB Check to see if momentum shift has moved bins
192 //DB - First , check to see if the event is outside of the binning range and skip event if it is
193 if (XVar < XBinEdges[0] || XVar >= XBinEdges[nXBins]) {
194 return -1;
195 }
196 //DB - Second, check to see if the event is still in the nominal bin
197 else if (XVar < rw_upper_xbinedge[NomXBin] && XVar >= rw_lower_xbinedge[NomXBin]) {
198 return NomXBin;
199 }
200 //DB - Thirdly, check the adjacent bins first as Eb+CC+EScale shifts aren't likely to move an Erec more than 1bin width
201 //Shifted down one bin from the event bin at nominal
202 else if (XVar < rw_lower_xbinedge[NomXBin] && XVar >= rw_lower_lower_xbinedge[NomXBin]) {
203 return NomXBin-1;
204 }
205 //Shifted up one bin from the event bin at nominal
206 else if (XVar < rw_upper_upper_xbinedge[NomXBin] && XVar >= rw_upper_xbinedge[NomXBin]) {
207 return NomXBin+1;
208 }
209 //DB - If we end up in this loop, the event has been shifted outside of its nominal bin, but is still within the allowed binning range
210 else {
211 // KS: Perform binary search to find correct bin. We already checked if isn't outside of bounds
212 return static_cast<int>(std::distance(XBinEdges.begin(), std::upper_bound(XBinEdges.begin(), XBinEdges.end(), XVar)) - 1);
213 }
214 }
std::vector< double > rw_upper_xbinedge
upper to check if Eb has moved the erec bin
size_t nXBins
Number of X axis bins in the histogram used for likelihood calculation.
std::vector< double > rw_lower_lower_xbinedge
lower to check if Eb has moved the erec bin
std::vector< double > rw_lower_xbinedge
lower to check if Eb has moved the erec bin
std::vector< double > rw_upper_upper_xbinedge
upper to check if Eb has moved the erec bin
std::vector< double > XBinEdges
Vector to hold x-axis bin-edges.

Member Data Documentation

◆ nXBins

size_t SampleBinningInfo::nXBins = M3::_BAD_INT_

Number of X axis bins in the histogram used for likelihood calculation.

Definition at line 176 of file SampleStructs.h.

◆ nYBins

size_t SampleBinningInfo::nYBins = M3::_BAD_INT_

Number of Y axis bins in the histogram used for likelihood calculation.

Definition at line 178 of file SampleStructs.h.

◆ rw_lower_lower_xbinedge

std::vector<double> SampleBinningInfo::rw_lower_lower_xbinedge

lower to check if Eb has moved the erec bin

Definition at line 183 of file SampleStructs.h.

◆ rw_lower_xbinedge

std::vector<double> SampleBinningInfo::rw_lower_xbinedge

lower to check if Eb has moved the erec bin

Definition at line 181 of file SampleStructs.h.

◆ rw_upper_upper_xbinedge

std::vector<double> SampleBinningInfo::rw_upper_upper_xbinedge

upper to check if Eb has moved the erec bin

Definition at line 187 of file SampleStructs.h.

◆ rw_upper_xbinedge

std::vector<double> SampleBinningInfo::rw_upper_xbinedge

upper to check if Eb has moved the erec bin

Definition at line 185 of file SampleStructs.h.

◆ XBinEdges

std::vector<double> SampleBinningInfo::XBinEdges

Vector to hold x-axis bin-edges.

Definition at line 171 of file SampleStructs.h.

◆ YBinEdges

std::vector<double> SampleBinningInfo::YBinEdges

Vector to hold y-axis bin-edges.

Definition at line 173 of file SampleStructs.h.


The documentation for this struct was generated from the following file: