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

Helper class for cross section model reweighting. More...

#include <GReWeightNuXSecHelper.h>

Public Member Functions

 GReWeightNuXSecHelper ()
 
 ~GReWeightNuXSecHelper ()
 
void HandleInitState (const InitialState &init_state)
 
void DiffCrossSecType (ScatteringType_t sct, KinePhaseSpace_t kps)
 
double NewWeight (const EventRecord &event, bool shape_only=false)
 

Private Member Functions

void Initialize ()
 

Private Attributes

GEVGPool fGPool
 
map< ScatteringType_t, KinePhaseSpace_tfCrossSecModelPhSp
 

Detailed Description

Helper class for cross section model reweighting.

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

October 22, 2005

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 36 of file GReWeightNuXSecHelper.h.

Constructor & Destructor Documentation

GReWeightNuXSecHelper::GReWeightNuXSecHelper ( void  )

Definition at line 38 of file GReWeightNuXSecHelper.cxx.

39 {
40  this->Initialize();
41 }
GReWeightNuXSecHelper::~GReWeightNuXSecHelper ( void  )

Definition at line 43 of file GReWeightNuXSecHelper.cxx.

44 {
45 
46 }

Member Function Documentation

void GReWeightNuXSecHelper::DiffCrossSecType ( ScatteringType_t  sct,
KinePhaseSpace_t  kps 
)

Definition at line 75 of file GReWeightNuXSecHelper.cxx.

77 {
78  fCrossSecModelPhSp.insert(
79  map<ScatteringType_t,KinePhaseSpace_t>::value_type(sct,kps));
80 }
map< ScatteringType_t, KinePhaseSpace_t > fCrossSecModelPhSp
void GReWeightNuXSecHelper::HandleInitState ( const InitialState init_state)

Definition at line 56 of file GReWeightNuXSecHelper.cxx.

57 {
58  // form initial state filtering out any unwanted info
59  InitialState init_state(is.TgtPdg(), is.ProbePdg());
60 
61  // check for an event generation configured for that initial state
62  GEVGDriver * evg_driver = fGPool.FindDriver(init_state);
63 
64  // if none was found then create/configure/store one now
65  if(!evg_driver) {
66  LOG("ReW", pNOTICE)
67  << "Adding event generation driver for initial state = "
68  << init_state.AsString();
69  evg_driver = new GEVGDriver;
70  evg_driver->Configure(init_state);
71  fGPool.insert( GEVGPool::value_type(init_state.AsString(), evg_driver) );
72  }
73 }
GEVGDriver * FindDriver(const InitialState &init) const
Definition: GEVGPool.cxx:50
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:87
string AsString(void) const
GENIE Event Generation Driver. A minimalist user interface object for generating neutrino interaction...
Definition: GEVGDriver.h:55
void Configure(int nu_pdgc, int Z, int A)
Definition: GEVGDriver.cxx:173
#define pNOTICE
Definition: Messenger.h:52
Initial State information.
Definition: InitialState.h:42
void GReWeightNuXSecHelper::Initialize ( void  )
private
double GReWeightNuXSecHelper::NewWeight ( const EventRecord event,
bool  shape_only = false 
)

Definition at line 82 of file GReWeightNuXSecHelper.cxx.

84 {
85  // Get event summary (Interaction) from the input event
86  assert(event.Summary());
87  Interaction & interaction = * event.Summary();
88 
89  //LOG("ReW", pDEBUG) << "Computing new weight for: \n" << interaction;
90 
91  // Find the event generation driver that handles the given initial state
92  const InitialState & init_state = interaction.InitState();
93  GEVGDriver * evg_driver = fGPool.FindDriver(init_state);
94  if(!evg_driver) {
95  LOG("ReW", pINFO)
96  << "Adding generator driver for init state: " << init_state.AsString();
97  evg_driver = new GEVGDriver;
98  evg_driver->Configure(init_state);
99  fGPool.insert( GEVGPool::value_type(init_state.AsString(), evg_driver) );
100  }
101  assert(evg_driver);
102 
103  // Find the event generation thread that handles the given interaction
104  const EventGeneratorI * evg_thread = evg_driver->FindGenerator(&interaction);
105  if(!evg_thread) {
106  LOG("ReW", pERROR)
107  << "No event generator thread for interaction: " << interaction;
108  return 0;
109  }
110 
111  // Get the cross section model associated with that thread
112  const XSecAlgorithmI * xsec_model = evg_thread->CrossSectionAlg();
113  if(!xsec_model) {
114  LOG("ReW", pERROR)
115  << "No cross section model for interaction: " << interaction;
116  return 0;
117  }
118 
119  // Get the kinematical phase space used for computing the differential
120  // cross sections stored in the event
121  ScatteringType_t sct = interaction.ProcInfo().ScatteringTypeId();
123  kpsi = fCrossSecModelPhSp.find(sct);
124 
125  if(kpsi == fCrossSecModelPhSp.end()) return 1;
126  KinePhaseSpace_t kps = kpsi->second;
127  if(kps==kPSNull) return 1;
128 
129  // Copy the 'selected' kinematics into the 'running' kinematics
130  interaction.KinePtr()->UseSelectedKinematics();
131 
132  // hack to match what was stored during event generation
133  // -- is currently revisited --
134  if(interaction.ProcInfo().IsQuasiElastic())
135  interaction.SetBit(kIAssumeFreeNucleon);
136 
137  double old_xsec = event.DiffXSec();
138  double old_weight = event.Weight();
139  double new_xsec = xsec_model->XSec(&interaction,kps);
140  double new_weight = old_weight * (new_xsec/old_xsec);
141 
142  if(shape_only) {
143  double old_integrated_xsec = event.XSec();
144  double new_integrated_xsec = xsec_model->Integral(&interaction);
145  assert(new_integrated_xsec > 0);
146  new_weight *= (old_integrated_xsec/new_integrated_xsec);
147  }
148 
149  // hack - closing parenthesis
150  if(interaction.ProcInfo().IsQuasiElastic())
151  interaction.ResetBit(kIAssumeFreeNucleon);
152 
153  // Clear the 'running' kinematics buffer
154  interaction.KinePtr()->ClearRunningValues();
155 
156  LOG("ReW", pINFO)
157  << "Event d{xsec}/dK : " << old_xsec << " --> " << new_xsec;
158  LOG("ReW", pINFO)
159  << "Event weight : " << old_weight << " ---> " << new_weight;
160 
161  return new_weight;
162 }
Cross Section Calculation Interface.
#define pERROR
Definition: Messenger.h:50
virtual Interaction * Summary(void) const
Definition: GHepRecord.cxx:135
virtual double XSec(const Interaction *i, KinePhaseSpace_t k=kPSfE) const =0
Compute the cross section for the input interaction.
const EventGeneratorI * FindGenerator(const Interaction *interaction) const
Definition: GEVGDriver.cxx:393
Defines the EventGeneratorI interface.
GEVGDriver * FindDriver(const InitialState &init) const
Definition: GEVGPool.cxx:50
enum genie::EKinePhaseSpace KinePhaseSpace_t
Summary information for an interaction.
Definition: Interaction.h:53
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:87
intermediate_table::const_iterator const_iterator
virtual double Integral(const Interaction *i) const =0
string AsString(void) const
GENIE Event Generation Driver. A minimalist user interface object for generating neutrino interaction...
Definition: GEVGDriver.h:55
#define pINFO
Definition: Messenger.h:53
virtual const XSecAlgorithmI * CrossSectionAlg(void) const =0
enum genie::EScatteringType ScatteringType_t
const UInt_t kIAssumeFreeNucleon
Definition: Interaction.h:46
void Configure(int nu_pdgc, int Z, int A)
Definition: GEVGDriver.cxx:173
map< ScatteringType_t, KinePhaseSpace_t > fCrossSecModelPhSp
Initial State information.
Definition: InitialState.h:42

Member Data Documentation

map<ScatteringType_t, KinePhaseSpace_t> genie::rew::GReWeightNuXSecHelper::fCrossSecModelPhSp
private

Definition at line 51 of file GReWeightNuXSecHelper.h.

GEVGPool genie::rew::GReWeightNuXSecHelper::fGPool
private

Definition at line 50 of file GReWeightNuXSecHelper.h.


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