20 #include <TLorentzVector.h> 21 #include <TGenPhaseSpace.h> 39 using namespace genie;
57 #ifdef _G_REWEIGHT_AGKY_DEBUG_ 112 if(is_cc && !
fRewCC)
return 1.;
113 if(is_nc && !
fRewNC)
return 1.;
142 bool tweaked = (PT2tweaked || XFtweaked);
143 if(!tweaked)
return 1.;
151 TIter event_iter(&event);
152 int i=-1, ihadsyst = -1;
153 while ( (p = dynamic_cast<GHepParticle *>(event_iter.Next())) ) {
159 if(ihadsyst<0)
return 1.;
162 <<
"Found HadronicSystem pseudo-particle at position = " << ihadsyst;
164 int fd =
event.Particle(ihadsyst)->FirstDaughter();
165 int ld =
event.Particle(ihadsyst)->LastDaughter();
169 <<
"HadronicSystem pseudo-particle's num. of daughters = " << nd
170 <<
" at positions (" << fd <<
", " << ld <<
")";
175 int fdpdg =
event.Particle(fd)->Pdg();
176 int ldpdg =
event.Particle(ld)->Pdg();
187 if(!is_Npi)
return 1.;
190 <<
"A DIS event with a 'nucleon+pion' primary hadronic state";
194 TLorentzVector p4N(N->
Px(), N->
Py(), N->
Pz(), N->
E());
195 TVector3 p3N = p4N.Vect();
197 <<
"4-p @ LAB: px = " << p4N.Px() <<
", py = " << p4N.Py()
198 <<
", pz = " << p4N.Pz() <<
", E = " << p4N.Energy();
202 TVector3 p3had = p4had.Vect();
206 double pTlabp = p3N.Pt(p3had);
207 double pLlabp = TMath::Sqrt(p3N.Mag2()-pTlabp*pTlabp);
208 double Elabp = p4N.Energy();
209 TLorentzVector p4Nr(0,pTlabp,pLlabp,Elabp);
212 TVector3 bv(0,0,-1.*p4had.P()/p4had.Energy());
218 bool selected =
true;
219 double W =
event.Summary()->Kine().W(selected);
221 double XF = p4Nr.Pz() / PZmax;
222 double PT2 = p4Nr.Perp2();
225 <<
"@ HCM: pT2 = " << PT2 <<
", xF = " << XF;
229 bool inrange = XFinrange && PT2inrange;
230 if(!inrange)
return 1.;
262 TLorentzVector ph(0,0,0,W);
263 TGenPhaseSpace phspgen;
264 phspgen.SetDecay(ph, 2, masses);
267 for (Int_t
n=0;
n<ndec;
n++) {
268 double dec_weight = phspgen.Generate();
269 TLorentzVector * nucp4 = phspgen.GetDecay(0);
270 double dec_px=nucp4->Px();
271 double dec_py=nucp4->Py();
272 double dec_pz=nucp4->Pz();
273 double dec_pT2 = dec_px*dec_px+dec_py*dec_py;
274 double dec_xF = dec_pz/(W/2.);
278 double fpT2rnd = fpT2max * rnd->
RndHadro().Rndm();
279 double fxFrnd = fxFmax * rnd->
RndHadro().Rndm();
282 if(fxFrnd < fxFpdf && fpT2rnd < fpT2pdf) {
283 hdef.Fill(dec_xF, dec_pT2, dec_weight);
288 fpT2rnd = fpT2max * rnd->
RndHadro().Rndm();
289 fxFrnd = fxFmax * rnd->
RndHadro().Rndm();
292 if(fxFrnd < fxFpdf && fpT2rnd < fpT2pdf) {
293 htwk.Fill(dec_xF, dec_pT2, dec_weight);
297 double Idef = hdef.Integral(
"width");
298 double Itwk = htwk.Integral(
"width");
299 if(Idef > 0 && Itwk > 0) {
300 hdef.Scale(1./hdef.Integral(
"width"));
301 htwk.Scale(1./htwk.Integral(
"width"));
306 int xfbin = hdef.GetXaxis()->FindBin(XF);
307 int pt2bin = hdef.GetYaxis()->FindBin(PT2);
309 double prob_def = hdef.GetBinContent(xfbin,pt2bin);
310 double prob_twk = htwk.GetBinContent(xfbin,pt2bin);
311 if(prob_def <= 0 || prob_twk < 0) {
315 double wght = prob_twk/prob_def;
317 #ifdef _G_REWEIGHT_AGKY_DEBUG_ 343 "0.083*exp(-0.5*pow(x+0.385,2.)/0.131)",
fXFmin,
fXFmax);
358 "[0]*0.083*exp(-0.5*pow(x-[1],2.)/0.131)",
fXFmin,
fXFmax);
372 #ifdef _G_REWEIGHT_AGKY_DEBUG_ 373 fTestFile =
new TFile(
"./agky_reweight_test.root",
"recreate");
374 fTestNtp =
new TNtupleD(
"testntp",
"",
"W:xF:pT2:xFtwkdial:pT2twkdial:wght");
bool fRewNue
reweight nu_e?
bool IsWeakCC(void) const
#include "Numerical/GSFunc.h"
double E(void) const
Get energy.
bool fRewNumu
reweight nu_mu?
static const double kNucleonMass
static RandomGen * Instance()
Access instance.
void Reconfigure(void)
propagate updated nuisance parameter values to actual MC, etc
tweak xF distribution for low multiplicity (N + pi) DIS f/s produced by AGKY
TLorentzVector Hadronic4pLAB(const EventRecord &event)
double CalcWeight(const EventRecord &event)
calculate a weight for the input event using the current nuisance param values
bool fRewNuebar
reweight nu_e_bar?
A singleton holding random number generator classes. All random number generation in GENIE should tak...
double Pz(void) const
Get Pz.
bool fRewNumubar
reweight nu_mu_bar?
tweak pT distribution for low multiplicity (N + pi) DIS f/s produced by AGKY
double Px(void) const
Get Px.
double OneSigmaErr(GSyst_t syst, int sign=0) const
Summary information for an interaction.
double fPeakBaryonXFTwkDial
bool IsWeakNC(void) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
bool HadronizedByAGKY(const EventRecord &event)
static const double kASmallNum
An enumeration of systematic parameters.
double RewxFpT1pi(const EventRecord &event)
auto norm(Vector const &v)
Return norm of the specified vector.
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
TRandom3 & RndHadro(void) const
rnd number generator used by hadronization models
bool HadronizedByAGKYPythia(const EventRecord &event)
static const double kPionMass
bool IsHandled(GSyst_t syst)
does the current weight calculator handle the input nuisance param?
void Reset(void)
set all nuisance parameters to default values
const InitialState & InitState(void) const
const ProcessInfo & ProcInfo(void) const
static GSystUncertainty * Instance(void)
const int kPdgHadronicSyst
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.
Event finding and building.
GENIE event reweighting engine ABC.
double Py(void) const
Get Py.