RSPPInteractionListGenerator.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2019, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5  or see $GENIE/LICENSE
6 
7  Author: Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
8  University of Liverpool & STFC Rutherford Appleton Lab - May 13, 2005
9 
10  For the class documentation see the corresponding header file.
11 
12  Important revisions after version 2.0.0 :
13  @ Mar 03, 2009 - CA
14  Moved into the new RES package from its previous location (EVGModules).
15  @ Aug 25, 2009 - CA
16  The nunc_channels array was initialized with wrong size (n_nucc_channels
17  instead of n_nunc_channels).
18 
19 */
20 //____________________________________________________________________________
21 
26 
27 using namespace genie;
28 
29 //___________________________________________________________________________
31 InteractionListGeneratorI("genie::RSPPInteractionListGenerator")
32 {
33 
34 }
35 //___________________________________________________________________________
37 InteractionListGeneratorI("genie::RSPPInteractionListGenerator", config)
38 {
39 
40 }
41 //___________________________________________________________________________
43 {
44 
45 }
46 //___________________________________________________________________________
48  const InitialState & init_state) const
49 {
50  LOG("IntLst", pINFO) << "InitialState = " << init_state.AsString();
51 
52  // In the thread generating interactions from the list produced here (SPP),
53  // we can have (for free and nuclear targets):
54  //
55  // neutrino CC:
56  // v p -> l- p pi+
57  // v n -> l- p pi0
58  // v n -> l- n pi+
59  // neutrino NC:
60  // v p -> v p pi0
61  // v p -> v n pi+
62  // v n -> v n pi0
63  // v n -> v p pi-
64  // anti-neutrino CC:
65  // vb n -> l+ n pi-
66  // vb p -> l+ n pi0
67  // vb p -> l+ p pi-
68  // anti-neutrino NC:
69  // vb p -> vb p pi0
70  // vb p -> vb n pi+
71  // vb n -> vb n pi0
72  // vb n -> vb p pi-
73  //
74 
75  const int n_nucc_channels = 3;
76  const int n_nunc_channels = 4;
77 
78  SppChannel_t nucc_channels[n_nucc_channels] = {kSppNull};
79  SppChannel_t nunc_channels[n_nunc_channels] = {kSppNull};
80 
81  int nupdg = init_state.ProbePdg();
82 
83  if( pdg::IsNeutrino(nupdg) ) {
84  nucc_channels[0] = kSpp_vp_cc_10100;
85  nucc_channels[1] = kSpp_vn_cc_10010;
86  nucc_channels[2] = kSpp_vn_cc_01100;
87  nunc_channels[0] = kSpp_vp_nc_10010;
88  nunc_channels[1] = kSpp_vp_nc_01100;
89  nunc_channels[2] = kSpp_vn_nc_01010;
90  nunc_channels[3] = kSpp_vn_nc_10001;
91  }
92  else if ( pdg::IsAntiNeutrino(nupdg) ) {
93  nucc_channels[0] = kSpp_vbn_cc_01001;
94  nucc_channels[1] = kSpp_vbp_cc_01010;
95  nucc_channels[2] = kSpp_vbp_cc_10001;
96  nunc_channels[0] = kSpp_vbp_nc_10010;
97  nunc_channels[1] = kSpp_vbp_nc_01100;
98  nunc_channels[2] = kSpp_vbn_nc_01010;
99  nunc_channels[3] = kSpp_vbn_nc_10001;
100  }
101  else {
102  LOG("IntLst", pWARN)
103  << "Can not handle probe! Returning NULL InteractionList "
104  << "for init-state: " << init_state.AsString();
105  return 0;
106  }
107 
108  Target * inp_target = init_state.TgtPtr();
109  bool hasP = (inp_target->Z() > 0);
110  bool hasN = (inp_target->N() > 0);
111 
112  InteractionList * intlist = new InteractionList;
113 
114  if(fIsCC){
115 
116  // CC
117  for(int i=0; i<n_nucc_channels; i++) {
118  int struck_nucleon = SppChannel::InitStateNucleon(nucc_channels[i]);
119 
120  if( (struck_nucleon == kPdgProton && hasP) ||
121  (struck_nucleon == kPdgNeutron && hasN) ) {
122 
123  ProcessInfo proc_info(kScResonant, kIntWeakCC);
124  Interaction * interaction = new Interaction(init_state, proc_info);
125 
126  Target * target = interaction->InitStatePtr()->TgtPtr();
127 
128  target->SetHitNucPdg(struck_nucleon);
129  this->AddFinalStateInfo(interaction, nucc_channels[i]);
130 
131  intlist->push_back(interaction);
132  }
133  }//cc channels
134 
135  } else if (fIsNC) {
136 
137  // NC
138  for(int i=0; i<n_nunc_channels; i++) {
139  int struck_nucleon = SppChannel::InitStateNucleon(nunc_channels[i]);
140 
141  if( (struck_nucleon == kPdgProton && hasP) ||
142  (struck_nucleon == kPdgNeutron && hasN) ) {
143 
144  ProcessInfo proc_info(kScResonant, kIntWeakNC);
145  Interaction * interaction = new Interaction(init_state, proc_info);
146 
147  Target * target = interaction->InitStatePtr()->TgtPtr();
148 
149  target->SetHitNucPdg(struck_nucleon);
150  this->AddFinalStateInfo(interaction, nunc_channels[i]);
151 
152  intlist->push_back(interaction);
153  }
154  }//nc channels
155  }//cc/nc
156 
157  if(intlist->size() == 0) {
158  LOG("IntLst", pERROR)
159  << "Returning NULL InteractionList for init-state: "
160  << init_state.AsString();
161  delete intlist;
162  return 0;
163  }
164 
165  return intlist;
166 }
167 //___________________________________________________________________________
169  Interaction * interaction, SppChannel_t sppchan) const
170 {
171  int nproton = 0;
172  int nneutron = 0;
173  int npiplus = 0;
174  int npi0 = 0;
175  int npiminus = 0;
176 
177  int nucpdg = SppChannel::FinStateNucleon(sppchan);
178  int pipdg = SppChannel::FinStatePion(sppchan);
179 
180  if ( nucpdg == kPdgProton ) nproton = 1;
181  else if ( nucpdg == kPdgNeutron ) nneutron = 1;
182  else {
183  LOG("IntLst", pERROR)
184  << "Final state nucleon not a proton or a neutron! (pdg="
185  << nucpdg <<")";
186  }
187 
188  if ( pipdg == kPdgPiP ) npiplus = 1;
189  else if ( pipdg == kPdgPi0 ) npi0 = 1;
190  else if ( pipdg == kPdgPiM ) npiminus = 1;
191  else {
192  LOG("IntLst", pERROR)
193  << "Final state pion not a pi+/pi-/pi0! (pdg=" << pipdg <<")";
194  }
195 
196  XclsTag exclusive_tag;
197 
198  exclusive_tag.SetNNucleons (nproton, nneutron);
199  exclusive_tag.SetNPions (npiplus, npi0, npiminus);
200 
201  interaction->SetExclTag(exclusive_tag);
202 }
203 //___________________________________________________________________________
205 {
206  Algorithm::Configure(config);
207  this->LoadConfigData();
208 }
209 //____________________________________________________________________________
211 {
212  Algorithm::Configure(config);
213  this->LoadConfigData();
214 }
215 //____________________________________________________________________________
217 {
218  this->GetParamDef("is-CC", fIsCC, false);
219  this->GetParamDef("is-NC", fIsNC, false);
220 }
221 //____________________________________________________________________________
void SetNPions(int npi_plus, int npi_0, int npi_minus)
Definition: XclsTag.cxx:97
bool IsNeutrino(int pdgc)
Definition: PDGUtils.cxx:108
const XML_Char * target
Definition: expat.h:268
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
#define pERROR
Definition: Messenger.h:60
Defines the InteractionListGeneratorI interface. Concrete implementations of this interface generate ...
static int FinStateNucleon(SppChannel_t channel)
Definition: SppChannel.h:120
Definition: config.py:1
Contains minimal information for tagging exclusive processes.
Definition: XclsTag.h:37
enum genie::ESppChannel SppChannel_t
Summary information for an interaction.
Definition: Interaction.h:56
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
static int InitStateNucleon(SppChannel_t channel)
Definition: SppChannel.h:93
A class encapsulating an enumeration of interaction types (EM, Weak-CC, Weak-NC) and scattering types...
Definition: ProcessInfo.h:44
bool IsAntiNeutrino(int pdgc)
Definition: PDGUtils.cxx:116
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
Definition: Target.h:41
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:70
int ProbePdg(void) const
Definition: InitialState.h:65
const int kPdgPiP
Definition: PDGCodes.h:135
const int kPdgPi0
Definition: PDGCodes.h:137
string AsString(void) const
int Z(void) const
Definition: Target.h:69
#define pINFO
Definition: Messenger.h:63
void AddFinalStateInfo(Interaction *i, SppChannel_t chan) const
#define pWARN
Definition: Messenger.h:61
static int FinStatePion(SppChannel_t channel)
Definition: SppChannel.h:147
void SetExclTag(const XclsTag &xcls)
int N(void) const
Definition: Target.h:70
void SetNNucleons(int np, int nn)
Definition: XclsTag.cxx:104
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
void SetHitNucPdg(int pdgc)
Definition: Target.cxx:188
Target * TgtPtr(void) const
Definition: InitialState.h:68
const int kPdgPiM
Definition: PDGCodes.h:136
A vector of Interaction objects.
InitialState * InitStatePtr(void) const
Definition: Interaction.h:74
const int kPdgProton
Definition: PDGCodes.h:65
bool GetParamDef(const RgKey &name, T &p, const T &def) const
InteractionList * CreateInteractionList(const InitialState &init) const
const int kPdgNeutron
Definition: PDGCodes.h:67
Initial State information.
Definition: InitialState.h:49