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

A class to manage the MC value for MIPP NuMI. More...

#include <MIPPNumiMC.h>

Public Member Functions

void pip_mc_from_xml (const char *filename)
 Read a xml file name to get the mc value for pip. More...
 
void pim_mc_from_xml (const char *filename)
 Read a xml file name to get the mc value for pim. More...
 
void kap_mc_from_xml (const char *filename)
 Read a xml file name to get the mc value for kap. More...
 
void kam_mc_from_xml (const char *filename)
 Read a xml file name to get the mc value for kam. More...
 
void k0l_mc_from_xml (const char *filename)
 Read a xml file name to get the mc value for k0l. More...
 
void k0s_mc_from_xml (const char *filename)
 Read a xml file name to get the mc value for k0s. More...
 
double getMCval (double pz, double pt, int pdgcode)
 MC value for this HP production. More...
 

Static Public Member Functions

static MIPPNumiMCgetInstance ()
 

Private Member Functions

 MIPPNumiMC ()
 

Private Attributes

std::vector< double > pip_cv
 
std::vector< double > pim_cv
 
std::vector< double > kap_cv
 
std::vector< double > kam_cv
 
std::vector< double > k0l_cv
 
std::vector< double > k0s_cv
 
std::vector< double > v_pzmin
 
std::vector< double > v_pzmax
 
std::vector< double > v_ptmin
 
std::vector< double > v_ptmax
 
bool ranges_already_filled
 
double proton_no_interacting
 

Static Private Attributes

static MIPPNumiMCinstance = 0
 

Detailed Description

A class to manage the MC value for MIPP NuMI.

Definition at line 16 of file MIPPNumiMC.h.

Constructor & Destructor Documentation

NeutrinoFluxReweight::MIPPNumiMC::MIPPNumiMC ( )
private

Definition at line 10 of file MIPPNumiMC.cpp.

10  {
11  ranges_already_filled = false;
12 
13  //FRaction of protons not interacting in the target or Budal Monitor for
14  //LE NuMI mode using FTFP.
15  proton_no_interacting = 0.13288294;
16  }

Member Function Documentation

MIPPNumiMC * NeutrinoFluxReweight::MIPPNumiMC::getInstance ( )
static

Definition at line 295 of file MIPPNumiMC.cpp.

295  {
296  if (instance == 0) instance = new MIPPNumiMC;
297  return instance;
298  }
static MIPPNumiMC * instance
Definition: MIPPNumiMC.h:50
double NeutrinoFluxReweight::MIPPNumiMC::getMCval ( double  pz,
double  pt,
int  pdgcode 
)

MC value for this HP production.

Definition at line 222 of file MIPPNumiMC.cpp.

222  {
223 
224  double cvmc = -1;
225  if(abs(pdgcode)!=211 && abs(pdgcode)!=321 && pdgcode!=130 && pdgcode!=310)return cvmc;
226  int size = 0;
227 
228  //pip:
229  if(pdgcode==211){
230  size = pip_cv.size();
231  for(int ii=0;ii<size;++ii){
232  if(pz>v_pzmin[ii] && pz<v_pzmax[ii] && pt>v_ptmin[ii] && pt<v_ptmax[ii]){
233  cvmc = pip_cv[ii];
234  }
235  }
236  }
237 
238  //pim:
239  if(pdgcode==-211){
240  size = pim_cv.size();
241  for(int ii=0;ii<size;++ii){
242  if(pz>v_pzmin[ii] && pz<v_pzmax[ii] && pt>v_ptmin[ii] && pt<v_ptmax[ii]){
243  cvmc = pim_cv[ii];
244  }
245  }
246  }
247 
248  //kap
249  if(pdgcode==321){
250  size = kap_cv.size();
251  for(int ii=0;ii<size;++ii){
252  if(pz>v_pzmin[ii] && pz<v_pzmax[ii] && pt>v_ptmin[ii] && pt<v_ptmax[ii]){
253  cvmc = kap_cv[ii];
254  }
255  }
256  }
257 
258  //kam:
259  if(pdgcode==-321){
260  size = kam_cv.size();
261  for(int ii=0;ii<size;++ii){
262  if(pz>v_pzmin[ii] && pz<v_pzmax[ii] && pt>v_ptmin[ii] && pt<v_ptmax[ii]){
263  cvmc = kam_cv[ii];
264  }
265  }
266  }
267  //k0l:
268  if(pdgcode== 130){
269  size = k0l_cv.size();
270  for(int ii=0;ii<size;++ii){
271  if(pz>v_pzmin[ii] && pz<v_pzmax[ii] && pt>v_ptmin[ii] && pt<v_ptmax[ii]){
272  cvmc = k0l_cv[ii];
273  }
274  }
275  }
276 
277  //k0s:
278  if(pdgcode== 310){
279  size = k0s_cv.size();
280  for(int ii=0;ii<size;++ii){
281  if(pz>v_pzmin[ii] && pz<v_pzmax[ii] && pt>v_ptmin[ii] && pt<v_ptmax[ii]){
282  cvmc = k0s_cv[ii];
283  }
284  }
285  }
286 
287  //The values store in the files correspond to the Number of hadron per POT.
288  // But we are going to trasform to Number of hadron per interaction.
289 
290  cvmc /= (1.0-proton_no_interacting);
291  return cvmc;
292 
293  }
std::vector< double > kap_cv
Definition: MIPPNumiMC.h:46
std::vector< double > kam_cv
Definition: MIPPNumiMC.h:46
std::vector< double > pip_cv
Definition: MIPPNumiMC.h:46
std::vector< double > k0l_cv
Definition: MIPPNumiMC.h:46
std::vector< double > v_ptmin
Definition: MIPPNumiMC.h:47
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
T abs(T value)
std::vector< double > v_pzmin
Definition: MIPPNumiMC.h:47
std::vector< double > v_pzmax
Definition: MIPPNumiMC.h:47
std::vector< double > v_ptmax
Definition: MIPPNumiMC.h:47
std::vector< double > k0s_cv
Definition: MIPPNumiMC.h:46
std::vector< double > pim_cv
Definition: MIPPNumiMC.h:46
void NeutrinoFluxReweight::MIPPNumiMC::k0l_mc_from_xml ( const char *  filename)

Read a xml file name to get the mc value for k0l.

Definition at line 156 of file MIPPNumiMC.cpp.

156  {
157  using boost::property_tree::ptree;
158  ptree top;
159  read_xml(filename,top,2);
160  ptree bins;
161  bins = top.get_child("mcbin.MIPPNuMI_MC_k0l");
162  ptree::iterator it;
163  // we know that pip, pim, kap, kam, k0l and k0s have the same binning
164  double cv,pzmin,pzmax,ptmin,ptmax;
165 
166  for(it = bins.begin(); it!=bins.end(); ++it){
167 
168  std::string cv_string=it->second.get<std::string>("cvmc");
169  std::string pz_string=it->second.get<std::string>("pzrange");
170  std::string pt_string=it->second.get<std::string>("ptrange");
171  std::stringstream ss1(cv_string);
172  std::stringstream ss2(pz_string);
173  std::stringstream ss3(pt_string);
174  ss1 >> cv;
175  ss2 >> pzmin >> pzmax;
176  ss3 >> ptmin >> ptmax;
177 
178  k0l_cv.push_back(cv);
179  if(ranges_already_filled==false){
180  v_pzmin.push_back(pzmin);
181  v_pzmax.push_back(pzmax);
182  v_ptmin.push_back(ptmin);
183  v_ptmax.push_back(ptmax);
184  }
185  }
187  }
intermediate_table::iterator iterator
std::string string
Definition: nybbler.cc:12
std::vector< double > k0l_cv
Definition: MIPPNumiMC.h:46
std::vector< double > v_ptmin
Definition: MIPPNumiMC.h:47
string filename
Definition: train.py:213
std::vector< double > v_pzmin
Definition: MIPPNumiMC.h:47
std::vector< double > v_pzmax
Definition: MIPPNumiMC.h:47
std::vector< double > v_ptmax
Definition: MIPPNumiMC.h:47
void NeutrinoFluxReweight::MIPPNumiMC::k0s_mc_from_xml ( const char *  filename)

Read a xml file name to get the mc value for k0s.

Definition at line 189 of file MIPPNumiMC.cpp.

189  {
190  using boost::property_tree::ptree;
191  ptree top;
192  read_xml(filename,top,2);
193  ptree bins;
194  bins = top.get_child("mcbin.MIPPNuMI_MC_k0s");
195  ptree::iterator it;
196  // we know that pip, pim, kap, kam, k0l and k0s have the same binning
197  double cv,pzmin,pzmax,ptmin,ptmax;
198 
199  for(it = bins.begin(); it!=bins.end(); ++it){
200 
201  std::string cv_string=it->second.get<std::string>("cvmc");
202  std::string pz_string=it->second.get<std::string>("pzrange");
203  std::string pt_string=it->second.get<std::string>("ptrange");
204  std::stringstream ss1(cv_string);
205  std::stringstream ss2(pz_string);
206  std::stringstream ss3(pt_string);
207  ss1 >> cv;
208  ss2 >> pzmin >> pzmax;
209  ss3 >> ptmin >> ptmax;
210 
211  k0s_cv.push_back(cv);
212  if(ranges_already_filled==false){
213  v_pzmin.push_back(pzmin);
214  v_pzmax.push_back(pzmax);
215  v_ptmin.push_back(ptmin);
216  v_ptmax.push_back(ptmax);
217  }
218  }
220  }
intermediate_table::iterator iterator
std::string string
Definition: nybbler.cc:12
std::vector< double > v_ptmin
Definition: MIPPNumiMC.h:47
string filename
Definition: train.py:213
std::vector< double > v_pzmin
Definition: MIPPNumiMC.h:47
std::vector< double > v_pzmax
Definition: MIPPNumiMC.h:47
std::vector< double > v_ptmax
Definition: MIPPNumiMC.h:47
std::vector< double > k0s_cv
Definition: MIPPNumiMC.h:46
void NeutrinoFluxReweight::MIPPNumiMC::kam_mc_from_xml ( const char *  filename)

Read a xml file name to get the mc value for kam.

Definition at line 123 of file MIPPNumiMC.cpp.

123  {
124  using boost::property_tree::ptree;
125  ptree top;
126  read_xml(filename,top,2);
127  ptree bins;
128  bins = top.get_child("mcbin.MIPPNuMI_MC_kam");
129  ptree::iterator it;
130  // we know that pip, pim, kap and kam have the same binning
131  double cv,pzmin,pzmax,ptmin,ptmax;
132 
133  for(it = bins.begin(); it!=bins.end(); ++it){
134 
135  std::string cv_string=it->second.get<std::string>("cvmc");
136  std::string pz_string=it->second.get<std::string>("pzrange");
137  std::string pt_string=it->second.get<std::string>("ptrange");
138  std::stringstream ss1(cv_string);
139  std::stringstream ss2(pz_string);
140  std::stringstream ss3(pt_string);
141  ss1 >> cv;
142  ss2 >> pzmin >> pzmax;
143  ss3 >> ptmin >> ptmax;
144 
145  kam_cv.push_back(cv);
146  if(ranges_already_filled==false){
147  v_pzmin.push_back(pzmin);
148  v_pzmax.push_back(pzmax);
149  v_ptmin.push_back(ptmin);
150  v_ptmax.push_back(ptmax);
151  }
152  }
154  }
intermediate_table::iterator iterator
std::vector< double > kam_cv
Definition: MIPPNumiMC.h:46
std::string string
Definition: nybbler.cc:12
std::vector< double > v_ptmin
Definition: MIPPNumiMC.h:47
string filename
Definition: train.py:213
std::vector< double > v_pzmin
Definition: MIPPNumiMC.h:47
std::vector< double > v_pzmax
Definition: MIPPNumiMC.h:47
std::vector< double > v_ptmax
Definition: MIPPNumiMC.h:47
void NeutrinoFluxReweight::MIPPNumiMC::kap_mc_from_xml ( const char *  filename)

Read a xml file name to get the mc value for kap.

Definition at line 89 of file MIPPNumiMC.cpp.

89  {
90  using boost::property_tree::ptree;
91  ptree top;
92  read_xml(filename,top,2);
93  ptree bins;
94  bins = top.get_child("mcbin.MIPPNuMI_MC_kap");
95  ptree::iterator it;
96  // we know that pip, pim, kap and kam have the same binning
97  double cv,pzmin,pzmax,ptmin,ptmax;
98 
99  for(it = bins.begin(); it!=bins.end(); ++it){
100 
101  std::string cv_string=it->second.get<std::string>("cvmc");
102  std::string pz_string=it->second.get<std::string>("pzrange");
103  std::string pt_string=it->second.get<std::string>("ptrange");
104 
105  std::stringstream ss1(cv_string);
106  std::stringstream ss2(pz_string);
107  std::stringstream ss3(pt_string);
108  ss1 >> cv;
109  ss2 >> pzmin >> pzmax;
110  ss3 >> ptmin >> ptmax;
111 
112  kap_cv.push_back(cv);
113  if(ranges_already_filled==false){
114  v_pzmin.push_back(pzmin);
115  v_pzmax.push_back(pzmax);
116  v_ptmin.push_back(ptmin);
117  v_ptmax.push_back(ptmax);
118  }
119  }
121  }
std::vector< double > kap_cv
Definition: MIPPNumiMC.h:46
intermediate_table::iterator iterator
std::string string
Definition: nybbler.cc:12
std::vector< double > v_ptmin
Definition: MIPPNumiMC.h:47
string filename
Definition: train.py:213
std::vector< double > v_pzmin
Definition: MIPPNumiMC.h:47
std::vector< double > v_pzmax
Definition: MIPPNumiMC.h:47
std::vector< double > v_ptmax
Definition: MIPPNumiMC.h:47
void NeutrinoFluxReweight::MIPPNumiMC::pim_mc_from_xml ( const char *  filename)

Read a xml file name to get the mc value for pim.

Definition at line 54 of file MIPPNumiMC.cpp.

54  {
55  using boost::property_tree::ptree;
56  ptree top;
57  read_xml(filename,top,2);
58  ptree bins;
59  bins = top.get_child("mcbin.MIPPNuMI_MC_pim");
60  ptree::iterator it;
61  // we know that pip, pim, kap and kam have the same binning
62  double cv,pzmin,pzmax,ptmin,ptmax;
63 
64  for(it = bins.begin(); it!=bins.end(); ++it){
65 
66  std::string cv_string=it->second.get<std::string>("cvmc");
67  std::string pz_string=it->second.get<std::string>("pzrange");
68  std::string pt_string=it->second.get<std::string>("ptrange");
69 
70  std::stringstream ss1(cv_string);
71  std::stringstream ss2(pz_string);
72  std::stringstream ss3(pt_string);
73  ss1 >> cv;
74  ss2 >> pzmin >> pzmax;
75  ss3 >> ptmin >> ptmax;
76 
77  pim_cv.push_back(cv);
78  if(ranges_already_filled==false){
79  v_pzmin.push_back(pzmin);
80  v_pzmax.push_back(pzmax);
81  v_ptmin.push_back(ptmin);
82  v_ptmax.push_back(ptmax);
83  }
84  }
86 }
intermediate_table::iterator iterator
std::string string
Definition: nybbler.cc:12
std::vector< double > v_ptmin
Definition: MIPPNumiMC.h:47
string filename
Definition: train.py:213
std::vector< double > v_pzmin
Definition: MIPPNumiMC.h:47
std::vector< double > v_pzmax
Definition: MIPPNumiMC.h:47
std::vector< double > v_ptmax
Definition: MIPPNumiMC.h:47
std::vector< double > pim_cv
Definition: MIPPNumiMC.h:46
void NeutrinoFluxReweight::MIPPNumiMC::pip_mc_from_xml ( const char *  filename)

Read a xml file name to get the mc value for pip.

Definition at line 18 of file MIPPNumiMC.cpp.

18  {
19  using boost::property_tree::ptree;
20  ptree top;
21  read_xml(filename,top,2);
22  ptree bins;
23  bins = top.get_child("mcbin.MIPPNuMI_MC_pip");
24  ptree::iterator it;
25  // we know that pip, pim, kap and kam have the same binning
26  double cv,pzmin,pzmax,ptmin,ptmax;
27 
28  for(it = bins.begin(); it!=bins.end(); ++it){
29 
30  std::string cv_string=it->second.get<std::string>("cvmc");
31  std::string pz_string=it->second.get<std::string>("pzrange");
32  std::string pt_string=it->second.get<std::string>("ptrange");
33 
34  std::stringstream ss1(cv_string);
35  std::stringstream ss2(pz_string);
36  std::stringstream ss3(pt_string);
37  ss1 >> cv;
38  ss2 >> pzmin >> pzmax;
39  ss3 >> ptmin >> ptmax;
40 
41  pip_cv.push_back(cv);
42  if(ranges_already_filled==false){
43  v_pzmin.push_back(pzmin);
44  v_pzmax.push_back(pzmax);
45  v_ptmin.push_back(ptmin);
46  v_ptmax.push_back(ptmax);
47  }
48 
49  }
51 
52  }
intermediate_table::iterator iterator
std::string string
Definition: nybbler.cc:12
std::vector< double > pip_cv
Definition: MIPPNumiMC.h:46
std::vector< double > v_ptmin
Definition: MIPPNumiMC.h:47
string filename
Definition: train.py:213
std::vector< double > v_pzmin
Definition: MIPPNumiMC.h:47
std::vector< double > v_pzmax
Definition: MIPPNumiMC.h:47
std::vector< double > v_ptmax
Definition: MIPPNumiMC.h:47

Member Data Documentation

MIPPNumiMC * NeutrinoFluxReweight::MIPPNumiMC::instance = 0
staticprivate

Definition at line 50 of file MIPPNumiMC.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiMC::k0l_cv
private

Definition at line 46 of file MIPPNumiMC.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiMC::k0s_cv
private

Definition at line 46 of file MIPPNumiMC.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiMC::kam_cv
private

Definition at line 46 of file MIPPNumiMC.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiMC::kap_cv
private

Definition at line 46 of file MIPPNumiMC.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiMC::pim_cv
private

Definition at line 46 of file MIPPNumiMC.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiMC::pip_cv
private

Definition at line 46 of file MIPPNumiMC.h.

double NeutrinoFluxReweight::MIPPNumiMC::proton_no_interacting
private

Definition at line 49 of file MIPPNumiMC.h.

bool NeutrinoFluxReweight::MIPPNumiMC::ranges_already_filled
private

Definition at line 48 of file MIPPNumiMC.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiMC::v_ptmax
private

Definition at line 47 of file MIPPNumiMC.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiMC::v_ptmin
private

Definition at line 47 of file MIPPNumiMC.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiMC::v_pzmax
private

Definition at line 47 of file MIPPNumiMC.h.

std::vector<double> NeutrinoFluxReweight::MIPPNumiMC::v_pzmin
private

Definition at line 47 of file MIPPNumiMC.h.


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