Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Static Private Attributes | List of all members
NeutrinoFluxReweight::MIPPNumiYieldsBins Class Reference

A class to manage the bin definitions for MIPP Numi Yields. More...

#include <MIPPNumiYieldsBins.h>

Public Member Functions

void pip_data_from_xml (const char *filename)
 Read a xml pip file name to parse the bins. More...
 
void pim_data_from_xml (const char *filename)
 Read a xml pim file name to parse the bins. More...
 
void k_pi_data_from_xml (const char *filename)
 Read a xml kaons over pions file name to parse the bins. More...
 
int BinID (double pz, double pt, int pdgcode)
 Return the Bin ID for this data. More...
 
int GetNbins_pip_MIPPNuMI ()
 
int GetNbins_pim_MIPPNuMI ()
 
int GetNbins_K_MIPPNuMI ()
 

Static Public Member Functions

static MIPPNumiYieldsBinsgetInstance ()
 

Public Attributes

std::vector< double > pip_data_pzmin
 
std::vector< double > pim_data_pzmin
 
std::vector< double > k_pi_data_pzmin
 
std::vector< double > pip_data_pzmax
 
std::vector< double > pim_data_pzmax
 
std::vector< double > k_pi_data_pzmax
 
std::vector< double > pip_data_ptmin
 
std::vector< double > pim_data_ptmin
 
std::vector< double > k_pi_data_ptmin
 
std::vector< double > pip_data_ptmax
 
std::vector< double > pim_data_ptmax
 
std::vector< double > k_pi_data_ptmax
 

Private Member Functions

 MIPPNumiYieldsBins ()
 

Static Private Attributes

static MIPPNumiYieldsBinsinstance = 0
 

Detailed Description

A class to manage the bin definitions for MIPP Numi Yields.

Definition at line 13 of file MIPPNumiYieldsBins.h.

Constructor & Destructor Documentation

NeutrinoFluxReweight::MIPPNumiYieldsBins::MIPPNumiYieldsBins ( )
private

Definition at line 15 of file MIPPNumiYieldsBins.cpp.

15  {
16  }

Member Function Documentation

int NeutrinoFluxReweight::MIPPNumiYieldsBins::BinID ( double  pz,
double  pt,
int  pdgcode 
)

Return the Bin ID for this data.

Definition at line 105 of file MIPPNumiYieldsBins.cpp.

105  {
106 
107  int ibinID = -1;
108 
109  int size = 0;
110  if(pdgcode==211){
111  size = pip_data_pzmin.size();
112  for(int ii=0;ii<size;++ii){
113  if(pz>pip_data_pzmin[ii] && pz<pip_data_pzmax[ii] && pt>pip_data_ptmin[ii] && pt<pip_data_ptmax[ii]){
114  ibinID = ii;
115  }
116  }
117 
118  }
119  if(pdgcode==-211){
120  size = pim_data_pzmin.size();
121  for(int ii=0;ii<size;++ii){
122  if(pz>pim_data_pzmin[ii] && pz<pim_data_pzmax[ii] && pt>pim_data_ptmin[ii] && pt<pim_data_ptmax[ii]){
123  ibinID = ii;
124  }
125  }
126 
127  }
128  if(pdgcode==321 || pdgcode==-321 || pdgcode==130 || pdgcode==310){
129  size = k_pi_data_pzmin.size();
130  for(int ii=0;ii<size;++ii){
131  if(pz>k_pi_data_pzmin[ii] && pz<k_pi_data_pzmax[ii] && pt>k_pi_data_ptmin[ii] && pt<k_pi_data_ptmax[ii]){
132  ibinID = ii;
133  }
134  }
135  }
136  return ibinID;
137 
138  }
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
MIPPNumiYieldsBins * NeutrinoFluxReweight::MIPPNumiYieldsBins::getInstance ( )
static

Definition at line 153 of file MIPPNumiYieldsBins.cpp.

153  {
154  if (instance == 0) instance = new MIPPNumiYieldsBins;
155  return instance;
156  }
int NeutrinoFluxReweight::MIPPNumiYieldsBins::GetNbins_K_MIPPNuMI ( )

Definition at line 148 of file MIPPNumiYieldsBins.cpp.

148  {
149  if(k_pi_data_pzmin.size()==0)throw std::runtime_error("MIPPNumiYieldsBins has not been initialized!!");
150  return k_pi_data_pzmin.size();
151  }
int NeutrinoFluxReweight::MIPPNumiYieldsBins::GetNbins_pim_MIPPNuMI ( )

Definition at line 144 of file MIPPNumiYieldsBins.cpp.

144  {
145  if(pip_data_pzmin.size()==0)throw std::runtime_error("MIPPNumiYieldsBins has not been initialized!!");
146  return pim_data_pzmin.size();
147  }
int NeutrinoFluxReweight::MIPPNumiYieldsBins::GetNbins_pip_MIPPNuMI ( )

Definition at line 140 of file MIPPNumiYieldsBins.cpp.

140  {
141  if(pip_data_pzmin.size()==0)throw std::runtime_error("MIPPNumiYieldsBins has not been initialized!!");
142  return pip_data_pzmin.size();
143  }
void NeutrinoFluxReweight::MIPPNumiYieldsBins::k_pi_data_from_xml ( const char *  filename)

Read a xml kaons over pions file name to parse the bins.

Definition at line 77 of file MIPPNumiYieldsBins.cpp.

77  {
78  using boost::property_tree::ptree;
79  ptree top;
80 
81  read_xml(filename,top,2);
82 
83  ptree& binsK_PI = top.get_child("bins.MIPP_Numi_k_pi");
84 
85  ptree::iterator it = binsK_PI.begin();
86  //int idx=0;
87  double aux_pzmin,aux_pzmax,aux_ptmin,aux_ptmax;
88 
89  for(; it!=binsK_PI.end(); ++it){
90  std::string pz_string=it->second.get<std::string>("pzrange");
91  std::string pt_string=it->second.get<std::string>("ptrange");
92 
93  std::stringstream ss1(pz_string);
94  std::stringstream ss2(pt_string);
95  ss1 >> aux_pzmin >> aux_pzmax;
96  ss2 >> aux_ptmin >> aux_ptmax;
97 
98  k_pi_data_pzmin.push_back(aux_pzmin);
99  k_pi_data_pzmax.push_back(aux_pzmax);
100  k_pi_data_ptmin.push_back(aux_ptmin);
101  k_pi_data_ptmax.push_back(aux_ptmax);
102  }
103  }
intermediate_table::iterator iterator
std::string string
Definition: nybbler.cc:12
string filename
Definition: train.py:213
void NeutrinoFluxReweight::MIPPNumiYieldsBins::pim_data_from_xml ( const char *  filename)

Read a xml pim file name to parse the bins.

Definition at line 48 of file MIPPNumiYieldsBins.cpp.

48  {
49  using boost::property_tree::ptree;
50  ptree top;
51 
52  read_xml(filename,top,2); // option 2 removes comment strings
53 
54  ptree& binsPIM = top.get_child("bins.MIPP_Numi_pim");
55 
56  ptree::iterator it = binsPIM.begin();
57  double aux_pzmin,aux_pzmax,aux_ptmin,aux_ptmax;
58 
59  for(; it!=binsPIM.end(); ++it){
60  // it->first is the name
61  // it->second is the child property tree
62  std::string pz_string=it->second.get<std::string>("pzrange");
63  std::string pt_string=it->second.get<std::string>("ptrange");
64 
65  std::stringstream ss1(pz_string);
66  std::stringstream ss2(pt_string);
67  ss1 >> aux_pzmin >> aux_pzmax;
68  ss2 >> aux_ptmin >> aux_ptmax;
69 
70  pim_data_pzmin.push_back(aux_pzmin);
71  pim_data_pzmax.push_back(aux_pzmax);
72  pim_data_ptmin.push_back(aux_ptmin);
73  pim_data_ptmax.push_back(aux_ptmax);
74  }
75  }
intermediate_table::iterator iterator
std::string string
Definition: nybbler.cc:12
string filename
Definition: train.py:213
void NeutrinoFluxReweight::MIPPNumiYieldsBins::pip_data_from_xml ( const char *  filename)

Read a xml pip file name to parse the bins.

Definition at line 18 of file MIPPNumiYieldsBins.cpp.

18  {
19  using boost::property_tree::ptree;
20  ptree top;
21 
22  read_xml(filename,top,2); // option 2 removes comment strings
23 
24  ptree& binsPIP = top.get_child("bins.MIPP_Numi_pip");
25 
26  ptree::iterator it = binsPIP.begin();
27  //int idx=0;
28  double aux_pzmin,aux_pzmax,aux_ptmin,aux_ptmax;
29 
30  for(; it!=binsPIP.end(); ++it){
31  // it->first is the name
32  // it->second is the child property tree
33  std::string pz_string=it->second.get<std::string>("pzrange");
34  std::string pt_string=it->second.get<std::string>("ptrange");
35 
36  std::stringstream ss1(pz_string);
37  std::stringstream ss2(pt_string);
38  ss1 >> aux_pzmin >> aux_pzmax;
39  ss2 >> aux_ptmin >> aux_ptmax;
40 
41  pip_data_pzmin.push_back(aux_pzmin);
42  pip_data_pzmax.push_back(aux_pzmax);
43  pip_data_ptmin.push_back(aux_ptmin);
44  pip_data_ptmax.push_back(aux_ptmax);
45  }
46  }
intermediate_table::iterator iterator
std::string string
Definition: nybbler.cc:12
string filename
Definition: train.py:213

Member Data Documentation

MIPPNumiYieldsBins * NeutrinoFluxReweight::MIPPNumiYieldsBins::instance = 0
staticprivate

Definition at line 44 of file MIPPNumiYieldsBins.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiYieldsBins::k_pi_data_ptmax

Definition at line 36 of file MIPPNumiYieldsBins.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiYieldsBins::k_pi_data_ptmin

Definition at line 35 of file MIPPNumiYieldsBins.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiYieldsBins::k_pi_data_pzmax

Definition at line 34 of file MIPPNumiYieldsBins.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiYieldsBins::k_pi_data_pzmin

Definition at line 33 of file MIPPNumiYieldsBins.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiYieldsBins::pim_data_ptmax

Definition at line 36 of file MIPPNumiYieldsBins.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiYieldsBins::pim_data_ptmin

Definition at line 35 of file MIPPNumiYieldsBins.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiYieldsBins::pim_data_pzmax

Definition at line 34 of file MIPPNumiYieldsBins.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiYieldsBins::pim_data_pzmin

Definition at line 33 of file MIPPNumiYieldsBins.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiYieldsBins::pip_data_ptmax

Definition at line 36 of file MIPPNumiYieldsBins.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiYieldsBins::pip_data_ptmin

Definition at line 35 of file MIPPNumiYieldsBins.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiYieldsBins::pip_data_pzmax

Definition at line 34 of file MIPPNumiYieldsBins.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiYieldsBins::pip_data_pzmin

Definition at line 33 of file MIPPNumiYieldsBins.h.


The documentation for this class was generated from the following files: