36 using namespace genie;
49 #ifdef _G_REWEIGHT_FGM_DEBUG_ 109 if(!kF_tweaked)
return 1.;
111 bool is_qe =
event.Summary()->ProcInfo().IsQuasiElastic();
112 bool is_cc =
event.Summary()->ProcInfo().IsWeakCC();
113 if(!is_qe || !is_cc)
return 1.;
115 const Target &
target =
event.Summary()->InitState().Tgt();
120 double A = target.
A();
125 int target_pdgc = target.
Pdg();
126 int struck_nucleon_pdgc = target.
HitNucPdg();
133 double kFi = kft->
FindClosestKF(target_pdgc, struck_nucleon_pdgc);
134 double kFf = kft->
FindClosestKF(target_pdgc, final_nucleon_pdgc );
140 const Kinematics & kine =
event.Summary()->Kine();
141 bool selected =
true;
142 double q2 = kine.
q2(selected);
144 const double pmax = 0.5;
153 double kFi_twk = kFi * (1 +
fKFTwkDial * kF_fracerr);
154 double kFf_twk = kFf * (1 +
fKFTwkDial * kF_fracerr);
167 #ifdef _G_REWEIGHT_FGM_DEBUG_ 168 fTestNtp->Fill(-q2,wght);
177 if(!momdistro_tweaked)
return 1.;
179 bool is_qe =
event.Summary()->ProcInfo().IsQuasiElastic();
180 bool is_cc =
event.Summary()->ProcInfo().IsWeakCC();
181 if(!is_qe || !is_cc)
return 1.;
184 if(!tgtnucleus)
return 1.;
187 if(!hitnucleon)
return 1.;
189 const double kPmax = 0.5;
190 double p = hitnucleon->
P4()->Vect().Mag();
191 if(p > kPmax)
return 1.;
196 int tgtpdg = tgtnucleus -> Pdg();
197 int nucpdg = hitnucleon -> Pdg();
203 it = mapfg.find(tgtpdg);
204 if(it != mapfg.end()) { hfg = it->second; }
205 it = mapsf.find(tgtpdg);
206 if(it != mapsf.end()) { hsf = it->second; }
208 bool have_weight_func = (hfg!=0) && (hsf!=0);
209 if(!have_weight_func) {
210 const int kNEv = 20000;
212 hfg =
new TH1D(
"",
"",kNP,0.,kPmax);
213 hsf =
new TH1D(
"",
"",kNP,0.,kPmax);
214 hfg -> SetDirectory(0);
215 hsf -> SetDirectory(0);
216 const Target & tgt =
event.Summary()->InitState().Tgt();
218 for(
int iev=0; iev<kNEv; iev++) {
227 for(
int iev=0; iev<kNEv; iev++) {
236 hfg->Scale(1. / hfg->Integral(
"width"));
237 hsf->Scale(1. / hsf->Integral(
"width"));
238 mapfg.insert(map<int,TH1D*>::value_type(tgtpdg,hfg));
239 mapsf.insert(map<int,TH1D*>::value_type(tgtpdg,hsf));
243 double f_fg = hfg->GetBinContent( hfg->FindBin(p) );
244 double f_sf = hsf->GetBinContent( hsf->FindBin(p) );
246 double wght = (f_sf * dial + f_fg * (1-dial)) / f_fg;
259 algf->
GetAlgorithm(
"genie::FGMBodekRitchie",
"Default"));
263 #ifdef _G_REWEIGHT_FGM_DEBUG_ 264 fTestFile =
new TFile(
"./fgm_reweight_test.root",
"recreate");
265 fTestNtp =
new TNtupleD(
"testntp",
"",
"Q2:wght");
double RewCCQEMomDistroFGtoSF(const EventRecord &event)
map< int, TH1D * > fMapFGp
virtual double Momentum(void) const
#include "Numerical/GSFunc.h"
int HitNucPdg(void) const
void Reconfigure(void)
propagate updated nuisance parameter values to actual MC, etc
bool IsNucleus(void) const
static FermiMomentumTablePool * Instance(void)
Generated/set kinematical variables for an event.
int SwitchProtonNeutron(int pdgc)
Pure abstract base class. Defines the NuclearModelI interface to be implemented by any physics model ...
A table of Fermi momentum constants.
map< int, TH1D * > fMapFGn
const NuclearModelI * fFG
bool IsHandled(GSyst_t syst)
does the current weight calculator handle the input nuisance param?
double OneSigmaErr(GSyst_t syst, int sign=0) const
map< int, TH1D * > fMapSFp
double RQEFG_generic(double q2, double Mn, double kFi, double kFf, double pmax)
double q2(bool selected=false) const
Singleton class to load & serve tables of Fermi momentum constants.
const FermiMomentumTable * GetTable(string name)
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
const Algorithm * GetAlgorithm(const AlgId &algid)
void Reset(void)
set all nuisance parameters to default values
static const double kASmallNum
double CalcWeight(const EventRecord &event)
calculate a weight for the input event using the current nuisance param values
An enumeration of systematic parameters.
map< int, TH1D * > fMapSFn
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
TLorentzVector * HitNucP4Ptr(void) const
static AlgFactory * Instance()
virtual bool GenerateNucleon(const Target &) const =0
static GSystUncertainty * Instance(void)
double FindClosestKF(int target_pdgc, int nucleon_pdgc) const
The GENIE Algorithm Factory.
TLorentzVector * P4(void) const
void SetSystematic(GSyst_t syst, double val)
update the value for the specified nuisance param
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
STDHEP-like event record entry that can fit a particle or a nucleus.
double RewCCQEPauliSupViaKF(const EventRecord &event)
Root of GENIE utility namespaces.
Event finding and building.
const NuclearModelI * fSF
GENIE event reweighting engine ABC.