MaCh3  2.4.2
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 "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  FunctionalShifter
 Small struct used for applying shifts due to functional params. 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

 MaCh3Utils
 

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...
 
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...
 
double MaCh3Utils::GetMassFromPDG (const int PDG)
 Return mass for given PDG. More...
 
int MaCh3Utils::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 MaCh3Utils::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 94 of file SampleStructs.h.

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

◆ 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 37 of file SampleStructs.h.

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

◆ TestStatistic

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

Enumerator
kPoisson 

Standard Poisson likelihood [2].

kBarlowBeeston 

Barlow-Beeston ([3]) following Conway approximation ([5])

kIceCube 

Based on [1].

kPearson 

Standard Pearson likelihood [25].

kDembinskiAbdelmotteleb 

Based on [6].

kNTestStatistics 

Number of test statistics.

Definition at line 105 of file SampleStructs.h.

105  {
106  kPoisson,
108  kIceCube,
109  kPearson,
112 };
@ 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 699 of file SampleStructs.h.

700  {
701  for (size_t iSample = 0; iSample < BinningInfo.size(); ++iSample) {
702  const SampleBinningInfo& info = BinningInfo[iSample];
703 
704  if (GlobalBin >= info.GlobalOffset &&
705  GlobalBin < info.GlobalOffset + info.nBins)
706  {
707  return GlobalBin - info.GlobalOffset;
708  }
709  }
710 
711  MACH3LOG_ERROR("Couldn't find local bin corresponding to bin {}", GlobalBin);
712  throw MaCh3Exception(__FILE__, __LINE__);
713 
714  return M3::_BAD_INT_;
715 }
#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 680 of file SampleStructs.h.

680  {
681  for (size_t iSample = 0; iSample < BinningInfo.size(); ++iSample) {
682  const SampleBinningInfo& info = BinningInfo[iSample];
683  if (GlobalBin >= info.GlobalOffset && GlobalBin < info.GlobalOffset + info.nBins) {
684  return static_cast<int>(iSample);
685  }
686  }
687 
688  MACH3LOG_ERROR("Couldn't find sample corresponding to bin {}", GlobalBin);
689  throw MaCh3Exception(__FILE__, __LINE__);
690 
691  // GlobalBin is out of range for all samples
692  return M3::_BAD_INT_;
693 }

◆ TargetMat_ToString()

std::string TargetMat_ToString ( const TargetMat  i)
inline

Converted the Target Mat to a string.

Definition at line 52 of file SampleStructs.h.

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

◆ TestStatistic_ToString()

std::string TestStatistic_ToString ( const TestStatistic  TestStat)
inline

Convert a LLH type to a string.

Definition at line 116 of file SampleStructs.h.

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