MaCh3  2.8.0
Reference Guide
Classes | Namespaces | Enumerations | Functions
SampleStructs.h File Reference
#include <set>
#include <list>
#include <unordered_map>
#include "Manager/MaCh3Exception.h"
#include "Manager/MaCh3Logger.h"
#include "Manager/Core.h"
#include "Parameters/ParameterStructs.h"
#include "Utils/PhysicsUtils.h"
#include "TSpline.h"
#include "TObjString.h"
#include "TFile.h"
#include "TF1.h"
#include "TH2Poly.h"
#include "TH1.h"
#include "Constants/OscillatorConstants.h"
Include dependency graph for SampleStructs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  KinematicCut
 KS: Small struct used for applying kinematic cuts. More...
 
struct  BinShiftLookup
 KS: Store bin lookups allowing to quickly find bin after migration. More...
 
struct  BinInfo
 KS: This hold bin extents in N-Dimensions allowing to check if Bin falls into. More...
 
struct  SampleBinningInfo
 KS: Struct storing all information required for sample binning. More...
 

Namespaces

 M3
 Main namespace for MaCh3 software.
 
 M3::Utils
 Utility helpers used across MaCh3.
 

Enumerations

enum  TargetMat {
  kTarget_H = 1 , kTarget_C = 12 , kTarget_N = 14 , kTarget_O = 16 ,
  kTarget_Al = 27 , kTarget_Ar = 40 , kTarget_Ti = 48 , kTarget_Fe = 56 ,
  kTarget_Pb = 207
}
 Enum to track the target material. More...
 
enum  NuPDG {
  kNue = 12 , kNumu = 14 , kNutau = 16 , kNueBar = -12 ,
  kNumuBar = -14 , kNutauBar = -16
}
 Enum to track the incoming neutrino species. More...
 
enum  TestStatistic {
  kPoisson , kBarlowBeeston , kIceCube , kPearson ,
  kDembinskiAbdelmotteleb , kNTestStatistics
}
 Make an enum of the test statistic that we're using. More...
 

Functions

std::string TargetMat_ToString (const TargetMat i)
 Converted the Target Mat to a string. More...
 
std::string TestStatistic_ToString (const TestStatistic TestStat)
 Convert a LLH type to a string. More...
 
TestStatistic TestStatFromString (const std::string &likelihood)
 Convert a string to a TestStatistic enum. More...
 
int GetSampleFromGlobalBin (const std::vector< SampleBinningInfo > &BinningInfo, const int GlobalBin)
 Get the sample index corresponding to a global bin number. More...
 
int GetLocalBinFromGlobalBin (const std::vector< SampleBinningInfo > &BinningInfo, const int GlobalBin)
 Get the local (sample) bin index from a global bin number. More...
 
int M3::Utils::PDGToNuOscillatorFlavour (const int NuPdg)
 Convert from PDG flavour to NuOscillator type beware that in the case of anti-neutrinos the NuOscillator type simply gets multiplied by -1. More...
 
std::string M3::Utils::FormatDouble (const double value, const int precision)
 Convert double into string for precision, useful for playing with yaml if you don't want to have in config floating point precision... More...
 

Detailed Description

Author
Asher Kaboth
Clarence Wret
Patrick Dunne
Dan Barrow
Ed Atkin
Kamil Skwarczynski

Definition in file SampleStructs.h.

Enumeration Type Documentation

◆ NuPDG

enum NuPDG

Enum to track the incoming neutrino species.

Enumerator
kNue 

Electron neutrino.

kNumu 

Muon neutrino.

kNutau 

Tau neutrino.

kNueBar 

Electron antineutrino.

kNumuBar 

Muon antineutrino.

kNutauBar 

Tau antineutrino.

Definition at line 95 of file SampleStructs.h.

95  {
96 // *****************
97  kNue = 12,
98  kNumu = 14,
99  kNutau = 16,
100  kNueBar = -12,
101  kNumuBar = -14,
102  kNutauBar = -16
103 };
@ kNutauBar
Tau antineutrino.
@ kNutau
Tau neutrino.
Definition: SampleStructs.h:99
@ kNumuBar
Muon antineutrino.
@ kNueBar
Electron antineutrino.
@ kNue
Electron neutrino.
Definition: SampleStructs.h:97
@ kNumu
Muon neutrino.
Definition: SampleStructs.h:98

◆ TargetMat

enum TargetMat

Enum to track the target material.

Enumerator
kTarget_H 

Hydrogen (Atomic number 1)

kTarget_C 

Carbon 12 (Atomic number 6)

kTarget_N 

Nitrogen (Atomic number 7)

kTarget_O 

Oxygen 16 (Atomic number 8)

kTarget_Al 

Aluminum (Atomic number 13)

kTarget_Ar 

Argon (Atomic number 18)

kTarget_Ti 

Titanium (Atomic number 22)

kTarget_Fe 

Iron (Atomic number 26)

kTarget_Pb 

Lead (Atomic number 82)

Definition at line 38 of file SampleStructs.h.

38  {
39 // *****************
40  kTarget_H = 1,
41  kTarget_C = 12,
42  kTarget_N = 14,
43  kTarget_O = 16,
44  kTarget_Al = 27,
45  kTarget_Ar = 40,
46  kTarget_Ti = 48,
47  kTarget_Fe = 56,
48  kTarget_Pb = 207
49 };
@ kTarget_Fe
Iron (Atomic number 26)
Definition: SampleStructs.h:47
@ kTarget_C
Carbon 12 (Atomic number 6)
Definition: SampleStructs.h:41
@ kTarget_Al
Aluminum (Atomic number 13)
Definition: SampleStructs.h:44
@ kTarget_H
Hydrogen (Atomic number 1)
Definition: SampleStructs.h:40
@ kTarget_Ti
Titanium (Atomic number 22)
Definition: SampleStructs.h:46
@ kTarget_Ar
Argon (Atomic number 18)
Definition: SampleStructs.h:45
@ kTarget_N
Nitrogen (Atomic number 7)
Definition: SampleStructs.h:42
@ kTarget_Pb
Lead (Atomic number 82)
Definition: SampleStructs.h:48
@ kTarget_O
Oxygen 16 (Atomic number 8)
Definition: SampleStructs.h:43

◆ TestStatistic

Make an enum of the test statistic that we're using.

Enumerator
kPoisson 

Standard Poisson likelihood [3].

kBarlowBeeston 

Barlow-Beeston ([4]) following Conway approximation ([7])

kIceCube 

Based on [2].

kPearson 

Standard Pearson likelihood [30].

kDembinskiAbdelmotteleb 

Based on [8].

kNTestStatistics 

Number of test statistics.

Definition at line 106 of file SampleStructs.h.

106  {
107  kPoisson,
109  kIceCube,
110  kPearson,
113 };
@ kNTestStatistics
Number of test statistics.
@ kPearson
Standard Pearson likelihood .
@ kBarlowBeeston
Barlow-Beeston () following Conway approximation ()
@ kIceCube
Based on .
@ kDembinskiAbdelmotteleb
Based on .
@ kPoisson
Standard Poisson likelihood .

Function Documentation

◆ GetLocalBinFromGlobalBin()

int GetLocalBinFromGlobalBin ( const std::vector< SampleBinningInfo > &  BinningInfo,
const int  GlobalBin 
)
inline

Get the local (sample) bin index from a global bin number.

Parameters
BinningInfoVector of SampleBinningInfo structs.
GlobalBinThe global bin number.
Returns
The bin index within the sample.

Definition at line 711 of file SampleStructs.h.

712  {
713  for (size_t iSample = 0; iSample < BinningInfo.size(); ++iSample) {
714  const SampleBinningInfo& info = BinningInfo[iSample];
715 
716  if (GlobalBin >= info.GlobalOffset &&
717  GlobalBin < info.GlobalOffset + info.nBins)
718  {
719  return GlobalBin - info.GlobalOffset;
720  }
721  }
722 
723  MACH3LOG_ERROR("Couldn't find local bin corresponding to bin {}", GlobalBin);
724  throw MaCh3Exception(__FILE__, __LINE__);
725 
726  return M3::_BAD_INT_;
727 }
#define MACH3LOG_ERROR
Definition: MaCh3Logger.h:37
Custom exception class used throughout MaCh3.
constexpr static const int _BAD_INT_
Default value used for int initialisation.
Definition: Core.h:55
KS: Struct storing all information required for sample binning.
int GlobalOffset
If you have binning for multiple samples and trying to define 1D vector let's.
int nBins
Number of total bins.

◆ GetSampleFromGlobalBin()

int GetSampleFromGlobalBin ( const std::vector< SampleBinningInfo > &  BinningInfo,
const int  GlobalBin 
)
inline

Get the sample index corresponding to a global bin number.

Parameters
BinningInfoVector of SampleBinningInfo structs.
GlobalBinThe global bin number.
Returns
The index of the sample, or garbage if not found.

Definition at line 692 of file SampleStructs.h.

692  {
693  for (size_t iSample = 0; iSample < BinningInfo.size(); ++iSample) {
694  const SampleBinningInfo& info = BinningInfo[iSample];
695  if (GlobalBin >= info.GlobalOffset && GlobalBin < info.GlobalOffset + info.nBins) {
696  return static_cast<int>(iSample);
697  }
698  }
699 
700  MACH3LOG_ERROR("Couldn't find sample corresponding to bin {}", GlobalBin);
701  throw MaCh3Exception(__FILE__, __LINE__);
702 
703  // GlobalBin is out of range for all samples
704  return M3::_BAD_INT_;
705 }

◆ TargetMat_ToString()

std::string TargetMat_ToString ( const TargetMat  i)
inline

Converted the Target Mat to a string.

Definition at line 53 of file SampleStructs.h.

53  {
54 // *****************
55  std::string name;
56 
57  switch(i) {
58  case kTarget_H:
59  name = "Hydrogen";
60  break;
61  case kTarget_C:
62  name = "Carbon";
63  break;
64  case kTarget_N:
65  name = "Nitrogen";
66  break;
67  case kTarget_O:
68  name = "Oxygen";
69  break;
70  case kTarget_Al:
71  name = "Aluminium";
72  break;
73  case kTarget_Ar:
74  name = "Argon";
75  break;
76  case kTarget_Ti:
77  name = "Titanium";
78  break;
79  case kTarget_Fe:
80  name = "Iron";
81  break;
82  case kTarget_Pb:
83  name = "Lead";
84  break;
85  default:
86  name = "TargetMat_Undefined";
87  break;
88  }
89 
90  return name;
91 }

◆ TestStatFromString()

TestStatistic TestStatFromString ( const std::string &  likelihood)
inline

Convert a string to a TestStatistic enum.

Definition at line 150 of file SampleStructs.h.

150  {
151 // **************************************************
152  for(int i = 0; i < kNTestStatistics; i++) {
153  if(likelihood == TestStatistic_ToString(TestStatistic(i))) {
154  return TestStatistic(i);
155  }
156  }
157 
158  MACH3LOG_ERROR("Wrong form of test-statistic specified!");
159  MACH3LOG_ERROR("You gave {} and I only support:", likelihood);
160  for(int i = 0; i < kNTestStatistics; i++)
161  {
163  }
164  throw MaCh3Exception(__FILE__ , __LINE__ );
165 }
std::string TestStatistic_ToString(const TestStatistic TestStat)
Convert a LLH type to a string.
TestStatistic
Make an enum of the test statistic that we're using.

◆ TestStatistic_ToString()

std::string TestStatistic_ToString ( const TestStatistic  TestStat)
inline

Convert a LLH type to a string.

Definition at line 117 of file SampleStructs.h.

117  {
118 // **************************************************
119  std::string name = "";
120 
121  switch(TestStat) {
123  name = "Poisson";
124  break;
126  name = "Barlow-Beeston";
127  break;
129  name = "IceCube";
130  break;
132  name = "Pearson";
133  break;
135  name = "Dembinski-Abdelmotteleb";
136  break;
138  MACH3LOG_ERROR("kNTestStatistics is not a valid TestStatistic!");
139  throw MaCh3Exception(__FILE__, __LINE__);
140  default:
141  MACH3LOG_ERROR("UNKNOWN LIKELIHOOD SPECIFIED!");
142  MACH3LOG_ERROR("You gave test-statistic {}", static_cast<int>(TestStat));
143  throw MaCh3Exception(__FILE__ , __LINE__ );
144  }
145  return name;
146 }