Public Member Functions | Private Member Functions | Private Attributes | List of all members
genie::rew::GReWeightFGM Class Reference

Reweighting the Fermi Gas nuclear model. More...

#include <GReWeightFGM.h>

Inheritance diagram for genie::rew::GReWeightFGM:
genie::rew::GReWeightI

Public Member Functions

 GReWeightFGM ()
 
 ~GReWeightFGM ()
 
bool IsHandled (GSyst_t syst)
 does the current weight calculator handle the input nuisance param? More...
 
void SetSystematic (GSyst_t syst, double val)
 update the value for the specified nuisance param More...
 
void Reset (void)
 set all nuisance parameters to default values More...
 
void Reconfigure (void)
 propagate updated nuisance parameter values to actual MC, etc More...
 
double CalcWeight (const EventRecord &event)
 calculate a weight for the input event using the current nuisance param values More...
 
- Public Member Functions inherited from genie::rew::GReWeightI
virtual ~GReWeightI ()
 

Private Member Functions

void Init (void)
 
double RewCCQEPauliSupViaKF (const EventRecord &event)
 
double RewCCQEMomDistroFGtoSF (const EventRecord &event)
 

Private Attributes

double fKFTwkDial
 
double fMomDistroTwkDial
 
const NuclearModelIfFG
 
const NuclearModelIfSF
 
map< int, TH1D * > fMapFGn
 
map< int, TH1D * > fMapFGp
 
map< int, TH1D * > fMapSFn
 
map< int, TH1D * > fMapSFp
 

Additional Inherited Members

- Protected Member Functions inherited from genie::rew::GReWeightI
 GReWeightI ()
 

Detailed Description

Reweighting the Fermi Gas nuclear model.

Author
Jim Dobson <J.Dobson07 imperial.ac.uk> Imperial College London

Costas Andreopoulos <costas.andreopoulos stfc.ac.uk> University of Liverpool & STFC Rutherford Appleton Lab

Apr 26, 2010

Copyright (c) 2003-2017, GENIE Neutrino MC Generator Collaboration For the full text of the license visit http://copyright.genie-mc.org or see $GENIE/LICENSE

Definition at line 46 of file GReWeightFGM.h.

Constructor & Destructor Documentation

GReWeightFGM::GReWeightFGM ( )

Definition at line 41 of file GReWeightFGM.cxx.

41  :
42 GReWeightI()
43 {
44  this->Init();
45 }
GReWeightFGM::~GReWeightFGM ( )

Definition at line 47 of file GReWeightFGM.cxx.

48 {
49 #ifdef _G_REWEIGHT_FGM_DEBUG_
50  fTestFile->cd();
51  fTestNtp ->Write();
52  fTestFile->Close();
53  delete fTestFile;
54 #endif
55 }

Member Function Documentation

double GReWeightFGM::CalcWeight ( const EventRecord event)
virtual

calculate a weight for the input event using the current nuisance param values

Implements genie::rew::GReWeightI.

Definition at line 97 of file GReWeightFGM.cxx.

98 {
99  double wght =
100  this->RewCCQEPauliSupViaKF (event) *
101  this->RewCCQEMomDistroFGtoSF (event);
102 
103  return wght;
104 }
double RewCCQEMomDistroFGtoSF(const EventRecord &event)
double RewCCQEPauliSupViaKF(const EventRecord &event)
void GReWeightFGM::Init ( void  )
private

Definition at line 251 of file GReWeightFGM.cxx.

252 {
253  fKFTwkDial = 0.;
254  fMomDistroTwkDial = 0.;
255 
256  AlgFactory * algf = AlgFactory::Instance();
257 
258  fFG = dynamic_cast<const NuclearModelI*> (
259  algf->GetAlgorithm("genie::FGMBodekRitchie","Default"));
260  fSF = dynamic_cast<const NuclearModelI*> (
261  algf->GetAlgorithm("genie::SpectralFunc","Default"));
262 
263 #ifdef _G_REWEIGHT_FGM_DEBUG_
264  fTestFile = new TFile("./fgm_reweight_test.root","recreate");
265  fTestNtp = new TNtupleD("testntp","","Q2:wght");
266 #endif
267 }
Pure abstract base class. Defines the NuclearModelI interface to be implemented by any physics model ...
Definition: NuclearModelI.h:42
const NuclearModelI * fFG
Definition: GReWeightFGM.h:69
const Algorithm * GetAlgorithm(const AlgId &algid)
Definition: AlgFactory.cxx:86
static AlgFactory * Instance()
Definition: AlgFactory.cxx:75
The GENIE Algorithm Factory.
Definition: AlgFactory.h:40
const NuclearModelI * fSF
Definition: GReWeightFGM.h:70
bool GReWeightFGM::IsHandled ( GSyst_t  syst)
virtual

does the current weight calculator handle the input nuisance param?

Implements genie::rew::GReWeightI.

Definition at line 57 of file GReWeightFGM.cxx.

58 {
59  switch(syst) {
60  case ( kSystNucl_CCQEPauliSupViaKF ) :
62  return true;
63  break;
64  default:
65  return false;
66  break;
67  }
68  return false;
69 }
void GReWeightFGM::Reconfigure ( void  )
virtual

propagate updated nuisance parameter values to actual MC, etc

Implements genie::rew::GReWeightI.

Definition at line 92 of file GReWeightFGM.cxx.

93 {
94 
95 }
void GReWeightFGM::Reset ( void  )
virtual

set all nuisance parameters to default values

Implements genie::rew::GReWeightI.

Definition at line 86 of file GReWeightFGM.cxx.

87 {
88  fKFTwkDial = 0.;
89  fMomDistroTwkDial = 0.;
90 }
double GReWeightFGM::RewCCQEMomDistroFGtoSF ( const EventRecord event)
private

Definition at line 174 of file GReWeightFGM.cxx.

175 {
176  bool momdistro_tweaked = (TMath::Abs(fMomDistroTwkDial) > controls::kASmallNum);
177  if(!momdistro_tweaked) return 1.;
178 
179  bool is_qe = event.Summary()->ProcInfo().IsQuasiElastic();
180  bool is_cc = event.Summary()->ProcInfo().IsWeakCC();
181  if(!is_qe || !is_cc) return 1.;
182 
183  GHepParticle * tgtnucleus = event.TargetNucleus();
184  if(!tgtnucleus) return 1.; // scattering off free-nucleon
185 
186  GHepParticle * hitnucleon = event.HitNucleon();
187  if(!hitnucleon) return 1.;
188 
189  const double kPmax = 0.5;
190  double p = hitnucleon->P4()->Vect().Mag();
191  if(p > kPmax) return 1.;
192 
193  TH1D * hfg = 0;
194  TH1D * hsf = 0;
195 
196  int tgtpdg = tgtnucleus -> Pdg();
197  int nucpdg = hitnucleon -> Pdg();
198 
199  map<int, TH1D*> & mapfg = pdg::IsNeutron(nucpdg) ? fMapFGn : fMapFGp;
200  map<int, TH1D*> & mapsf = pdg::IsNeutron(nucpdg) ? fMapSFn : fMapSFp;
201 
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; }
207 
208  bool have_weight_func = (hfg!=0) && (hsf!=0);
209  if(!have_weight_func) {
210  const int kNEv = 20000;
211  const int kNP = 500;
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();
217  bool ok = true;
218  for(int iev=0; iev<kNEv; iev++) {
219  ok = fFG->GenerateNucleon(tgt);
220  if(!ok) {
221  delete hfg;
222  delete hsf;
223  return 1.;
224  }
225  hfg->Fill(fFG->Momentum());
226  }//fg
227  for(int iev=0; iev<kNEv; iev++) {
228  ok = fSF->GenerateNucleon(tgt);
229  if(!ok) {
230  delete hfg;
231  delete hsf;
232  return 1.;
233  }
234  hsf->Fill(fSF->Momentum());
235  }//sf
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));
240  }//create & store momentum distributions
241 
242 
243  double f_fg = hfg->GetBinContent( hfg->FindBin(p) );
244  double f_sf = hsf->GetBinContent( hsf->FindBin(p) );
245  double dial = fMomDistroTwkDial;
246  double wght = (f_sf * dial + f_fg * (1-dial)) / f_fg;
247 
248  return wght;
249 }
map< int, TH1D * > fMapFGp
Definition: GReWeightFGM.h:73
int kNP
virtual double Momentum(void) const
Definition: NuclearModelI.h:55
intermediate_table::iterator iterator
map< int, TH1D * > fMapFGn
Definition: GReWeightFGM.h:72
const NuclearModelI * fFG
Definition: GReWeightFGM.h:69
map< int, TH1D * > fMapSFp
Definition: GReWeightFGM.h:75
bool IsNeutron(int pdgc)
Definition: PDGUtils.cxx:311
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
Definition: Target.h:41
static const double kASmallNum
Definition: Controls.h:40
map< int, TH1D * > fMapSFn
Definition: GReWeightFGM.h:74
p
Definition: test.py:228
virtual bool GenerateNucleon(const Target &) const =0
TLorentzVector * P4(void) const
Definition: GHepParticle.h:79
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition: GHepParticle.h:40
const NuclearModelI * fSF
Definition: GReWeightFGM.h:70
double GReWeightFGM::RewCCQEPauliSupViaKF ( const EventRecord event)
private

Definition at line 106 of file GReWeightFGM.cxx.

107 {
108  bool kF_tweaked = (TMath::Abs(fKFTwkDial) > controls::kASmallNum);
109  if(!kF_tweaked) return 1.;
110 
111  bool is_qe = event.Summary()->ProcInfo().IsQuasiElastic();
112  bool is_cc = event.Summary()->ProcInfo().IsWeakCC();
113  if(!is_qe || !is_cc) return 1.;
114 
115  const Target & target = event.Summary()->InitState().Tgt();
116  if (!target.IsNucleus()) {
117  return 1.;
118  }
119 
120  double A = target.A();
121  if(A <= 4) {
122  return 1.;
123  }
124 
125  int target_pdgc = target.Pdg();
126  int struck_nucleon_pdgc = target.HitNucPdg();
127  int final_nucleon_pdgc = pdg::SwitchProtonNeutron(struck_nucleon_pdgc);
128 
130  const FermiMomentumTable * kft = kftp->GetTable("Default");
131 
132  // Fermi momentum for initial, final nucleons
133  double kFi = kft->FindClosestKF(target_pdgc, struck_nucleon_pdgc);
134  double kFf = kft->FindClosestKF(target_pdgc, final_nucleon_pdgc );
135 
136  // hit nucleon mass
137  double Mn = target.HitNucP4Ptr()->M(); // can be off m/shell
138 
139  // momentum transfer
140  const Kinematics & kine = event.Summary()->Kine();
141  bool selected = true;
142  double q2 = kine.q2(selected);
143 
144  const double pmax = 0.5; // GeV
145 
146  // default nuclear suppression
147  double R = utils::nuclear::RQEFG_generic(q2, Mn, kFi, kFf, pmax);
148 
149  // tweak kF
151  double kF_fracerr = uncertainty->OneSigmaErr(kSystNucl_CCQEPauliSupViaKF);
152 
153  double kFi_twk = kFi * (1 + fKFTwkDial * kF_fracerr);
154  double kFf_twk = kFf * (1 + fKFTwkDial * kF_fracerr);
155 
156  // calculate tweaked nuclear suppression factor
157  double Rtwk = nuclear::RQEFG_generic(q2, Mn, kFi_twk, kFf_twk, pmax);
158 
159  // calculate weight (ratio of suppression factors)
160 
161  double wght = 1.0;
162 
163  if(R>0 && Rtwk>0) {
164  wght = Rtwk/R;
165  }
166 
167 #ifdef _G_REWEIGHT_FGM_DEBUG_
168  fTestNtp->Fill(-q2,wght);
169 #endif
170 
171  return wght;
172 }
int HitNucPdg(void) const
Definition: Target.cxx:311
int A(void) const
Definition: Target.h:71
bool IsNucleus(void) const
Definition: Target.cxx:279
int Pdg(void) const
Definition: Target.h:72
static FermiMomentumTablePool * Instance(void)
Generated/set kinematical variables for an event.
Definition: Kinematics.h:40
int SwitchProtonNeutron(int pdgc)
Definition: PDGUtils.cxx:326
A table of Fermi momentum constants.
double OneSigmaErr(GSyst_t syst, int sign=0) const
double RQEFG_generic(double q2, double Mn, double kFi, double kFf, double pmax)
double q2(bool selected=false) const
Definition: Kinematics.cxx:151
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...
Definition: Target.h:41
static const double kASmallNum
Definition: Controls.h:40
static const double A
Definition: Units.h:82
TLorentzVector * HitNucP4Ptr(void) const
Definition: Target.cxx:254
static GSystUncertainty * Instance(void)
double FindClosestKF(int target_pdgc, int nucleon_pdgc) const
void GReWeightFGM::SetSystematic ( GSyst_t  syst,
double  val 
)
virtual

update the value for the specified nuisance param

Implements genie::rew::GReWeightI.

Definition at line 71 of file GReWeightFGM.cxx.

72 {
73  switch(syst) {
74  case ( kSystNucl_CCQEPauliSupViaKF ) :
75  fKFTwkDial = val;
76  break;
79  break;
80  default:
81  return;
82  break;
83  }
84 }

Member Data Documentation

const NuclearModelI* genie::rew::GReWeightFGM::fFG
private

Definition at line 69 of file GReWeightFGM.h.

double genie::rew::GReWeightFGM::fKFTwkDial
private

Definition at line 66 of file GReWeightFGM.h.

map<int, TH1D *> genie::rew::GReWeightFGM::fMapFGn
private

Definition at line 72 of file GReWeightFGM.h.

map<int, TH1D *> genie::rew::GReWeightFGM::fMapFGp
private

Definition at line 73 of file GReWeightFGM.h.

map<int, TH1D *> genie::rew::GReWeightFGM::fMapSFn
private

Definition at line 74 of file GReWeightFGM.h.

map<int, TH1D *> genie::rew::GReWeightFGM::fMapSFp
private

Definition at line 75 of file GReWeightFGM.h.

double genie::rew::GReWeightFGM::fMomDistroTwkDial
private

Definition at line 67 of file GReWeightFGM.h.

const NuclearModelI* genie::rew::GReWeightFGM::fSF
private

Definition at line 70 of file GReWeightFGM.h.


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