ThinTargetnCPionReweighter.cpp
Go to the documentation of this file.
1 
3 #include <iostream>
4 #include "MakeReweight.h"
5 
6 namespace NeutrinoFluxReweight{
7 
8  ThinTargetnCPionReweighter::ThinTargetnCPionReweighter(int iuniv, const ParameterTable& cv_pars, const ParameterTable& univ_pars):iUniv(iuniv),cvPars(cv_pars),univPars(univ_pars){
9 
10  }
11 
13 
14  }
16 
18  if(iUniv==-1)tt_pCPionRew = (makerew->cv_rw)->THINTARGET_PC_PION_Universe;
19  else tt_pCPionRew = (makerew->vec_rws[iUniv])->THINTARGET_PC_PION_Universe;
20 
21  //checking:
22  std::string mode(getenv("MODE"));
23  if(aa.Inc_pdg != 2112)return false;
24  if(aa.Inc_P < 12.0)return false;
25  //volume check:
26  bool is_wrong_volume = aa.Vol != "TGT1" && aa.Vol != "BudalMonitor" && aa.Vol != "Budal_HFVS" && aa.Vol != "Budal_VFHS";
27  if( (mode=="REF") || (mode=="OPT") ){
28  // is_wrong_volume = aa.Vol != "TargetFinHorizontal" && aa.Vol != "TargetNoSplitSegment";
29  is_wrong_volume = aa.Vol != "TargetFinHorizontal" && aa.Vol != "TargetNoSplitSegment" && aa.Vol!="tCoreLog";
30  }
31  if(is_wrong_volume)return false;
32  //
33  if(aa.Prod_pdg != 211 && aa.Prod_pdg != -211)return false;
34 
35  double inc_mom[3] = {aa.Inc_P4[0], aa.Inc_P4[1], aa.Inc_P4[2]};
36  double prod_mom[3] = {aa.Prod_P4[0],aa.Prod_P4[1],aa.Prod_P4[2]};
37  double vtx_int[3] = {aa.Vtx[0],aa.Vtx[1],aa.Vtx[2]};
38 
39  InteractionData intData(aa.gen, inc_mom,2212,prod_mom,-1*aa.Prod_pdg,aa.Vol,aa.Proc,vtx_int);
40  return tt_pCPionRew->canReweight(intData);
41 
42  }
43 
45 
47  if(iUniv==-1)tt_pCPionRew = (makerew->cv_rw)->THINTARGET_PC_PION_Universe;
48  else tt_pCPionRew = (makerew->vec_rws[iUniv])->THINTARGET_PC_PION_Universe;
49 
50  double inc_mom[3] = {aa.Inc_P4[0], aa.Inc_P4[1], aa.Inc_P4[2]};
51  double prod_mom[3] = {aa.Prod_P4[0],aa.Prod_P4[1],aa.Prod_P4[2]};
52  double vtx_int[3] = {aa.Vtx[0],aa.Vtx[1],aa.Vtx[2]};
53  InteractionData intData(aa.gen, inc_mom,2212,prod_mom,-1*aa.Prod_pdg,aa.Vol,aa.Proc,vtx_int);
54 
55  double wgt = tt_pCPionRew->calculateWeight(intData);
56 
57  if(wgt<0)std::cout<<"TTNCPI check wgt(<0) "<<iUniv<<" "<<aa.Inc_P<<" "<<aa.xF<<" "<<aa.Pt<<" "<<aa.Prod_pdg<<std::endl;
58  return wgt;
59 
60  }
61 
62 
63 }
A list/table of parameter names and values.
ThinTargetnCPionReweighter(int iuniv, const ParameterTable &cv_pars, const ParameterTable &univ_pars)
A class to make the reweight event by event.
Definition: MakeReweight.h:32
std::string string
Definition: nybbler.cc:12
int Prod_pdg
pdg code of the produced particle
static MakeReweight * getInstance()
double Pt
Transversal momentum (GeV/c) of the produced particle.
double Vtx[3]
Location of the interaction.
The information about a hadronic interaction needed to calculate weights.
double Inc_P4[4]
Momentum 4 vector of the incident particle, E=p[3].
double xF
Feynmann-x of the produced particle: .
virtual double calculateWeight(const InteractionData &aa)
calculate a weight for this interaction given the central value parameters and the parameters for thi...
virtual double calculateWeight(const InteractionData &inter_data)
calculate a weight for this interaction given the central value parameters and the parameters for thi...
double Prod_P4[4]
Momentum 4 vector of the produced particle, E=p[3].
std::string getenv(std::string const &name)
Definition: getenv.cc:15
std::string Proc
Interaction process.
virtual bool canReweight(const InteractionData &aa)
can the particular instance of this class reweight this interaction?
double Inc_P
Momentum magnitude of the incident particle.
std::string Vol
Interaction volume.
virtual bool canReweight(const InteractionData &aa)
can the particular instance of this class reweight this interaction?
int Inc_pdg
pdg code of the incident particle
std::vector< ReweightDriver * > vec_rws
vector of Reweighter Drivers, one per universe
Definition: MakeReweight.h:65
ReweightDriver * cv_rw
Reweighter Drivers for the central value.
Definition: MakeReweight.h:68
QTextStream & endl(QTextStream &s)