GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RSPPInteractionListGenerator.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2024, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5 
6  Costas Andreopoulos <c.andreopoulos \at cern.ch>
7  University of Liverpool
8 */
9 //____________________________________________________________________________
10 
15 
16 using namespace genie;
17 
18 //___________________________________________________________________________
20 InteractionListGeneratorI("genie::RSPPInteractionListGenerator")
21 {
22 
23 }
24 //___________________________________________________________________________
26 InteractionListGeneratorI("genie::RSPPInteractionListGenerator", config)
27 {
28 
29 }
30 //___________________________________________________________________________
32 {
33 
34 }
35 //___________________________________________________________________________
37  const InitialState & init_state) const
38 {
39  LOG("IntLst", pINFO) << "InitialState = " << init_state.AsString();
40 
41  // In the thread generating interactions from the list produced here (SPP),
42  // we can have (for free and nuclear targets):
43  //
44  // neutrino CC:
45  // v p -> l- p pi+
46  // v n -> l- p pi0
47  // v n -> l- n pi+
48  // neutrino NC:
49  // v p -> v p pi0
50  // v p -> v n pi+
51  // v n -> v n pi0
52  // v n -> v p pi-
53  // anti-neutrino CC:
54  // vb n -> l+ n pi-
55  // vb p -> l+ n pi0
56  // vb p -> l+ p pi-
57  // anti-neutrino NC:
58  // vb p -> vb p pi0
59  // vb p -> vb n pi+
60  // vb n -> vb n pi0
61  // vb n -> vb p pi-
62  //
63 
64  const int n_nucc_channels = 3;
65  const int n_nunc_channels = 4;
66 
67  SppChannel_t nucc_channels[n_nucc_channels] = {kSppNull};
68  SppChannel_t nunc_channels[n_nunc_channels] = {kSppNull};
69 
70  int nupdg = init_state.ProbePdg();
71 
72  if( pdg::IsNeutrino(nupdg) ) {
73  nucc_channels[0] = kSpp_vp_cc_10100;
74  nucc_channels[1] = kSpp_vn_cc_10010;
75  nucc_channels[2] = kSpp_vn_cc_01100;
76  nunc_channels[0] = kSpp_vp_nc_10010;
77  nunc_channels[1] = kSpp_vp_nc_01100;
78  nunc_channels[2] = kSpp_vn_nc_01010;
79  nunc_channels[3] = kSpp_vn_nc_10001;
80  }
81  else if ( pdg::IsAntiNeutrino(nupdg) ) {
82  nucc_channels[0] = kSpp_vbn_cc_01001;
83  nucc_channels[1] = kSpp_vbp_cc_01010;
84  nucc_channels[2] = kSpp_vbp_cc_10001;
85  nunc_channels[0] = kSpp_vbp_nc_10010;
86  nunc_channels[1] = kSpp_vbp_nc_01100;
87  nunc_channels[2] = kSpp_vbn_nc_01010;
88  nunc_channels[3] = kSpp_vbn_nc_10001;
89  }
90  else {
91  LOG("IntLst", pWARN)
92  << "Can not handle probe! Returning NULL InteractionList "
93  << "for init-state: " << init_state.AsString();
94  return 0;
95  }
96 
97  Target * inp_target = init_state.TgtPtr();
98  bool hasP = (inp_target->Z() > 0);
99  bool hasN = (inp_target->N() > 0);
100 
101  InteractionList * intlist = new InteractionList;
102 
103  if(fIsCC){
104 
105  // CC
106  for(int i=0; i<n_nucc_channels; i++) {
107  int struck_nucleon = SppChannel::InitStateNucleon(nucc_channels[i]);
108 
109  if( (struck_nucleon == kPdgProton && hasP) ||
110  (struck_nucleon == kPdgNeutron && hasN) ) {
111 
113  Interaction * interaction = new Interaction(init_state, proc_info);
114 
115  Target * target = interaction->InitStatePtr()->TgtPtr();
116 
117  target->SetHitNucPdg(struck_nucleon);
118  this->AddFinalStateInfo(interaction, nucc_channels[i]);
119 
120  intlist->push_back(interaction);
121  }
122  }//cc channels
123 
124  } else if (fIsNC) {
125 
126  // NC
127  for(int i=0; i<n_nunc_channels; i++) {
128  int struck_nucleon = SppChannel::InitStateNucleon(nunc_channels[i]);
129 
130  if( (struck_nucleon == kPdgProton && hasP) ||
131  (struck_nucleon == kPdgNeutron && hasN) ) {
132 
134  Interaction * interaction = new Interaction(init_state, proc_info);
135 
136  Target * target = interaction->InitStatePtr()->TgtPtr();
137 
138  target->SetHitNucPdg(struck_nucleon);
139  this->AddFinalStateInfo(interaction, nunc_channels[i]);
140 
141  intlist->push_back(interaction);
142  }
143  }//nc channels
144  }//cc/nc
145 
146  if(intlist->size() == 0) {
147  LOG("IntLst", pERROR)
148  << "Returning NULL InteractionList for init-state: "
149  << init_state.AsString();
150  delete intlist;
151  return 0;
152  }
153 
154  return intlist;
155 }
156 //___________________________________________________________________________
158  Interaction * interaction, SppChannel_t sppchan) const
159 {
160  int nproton = 0;
161  int nneutron = 0;
162  int npiplus = 0;
163  int npi0 = 0;
164  int npiminus = 0;
165 
166  int nucpdg = SppChannel::FinStateNucleon(sppchan);
167  int pipdg = SppChannel::FinStatePion(sppchan);
168 
169  if ( nucpdg == kPdgProton ) nproton = 1;
170  else if ( nucpdg == kPdgNeutron ) nneutron = 1;
171  else {
172  LOG("IntLst", pERROR)
173  << "Final state nucleon not a proton or a neutron! (pdg="
174  << nucpdg <<")";
175  }
176 
177  if ( pipdg == kPdgPiP ) npiplus = 1;
178  else if ( pipdg == kPdgPi0 ) npi0 = 1;
179  else if ( pipdg == kPdgPiM ) npiminus = 1;
180  else {
181  LOG("IntLst", pERROR)
182  << "Final state pion not a pi+/pi-/pi0! (pdg=" << pipdg <<")";
183  }
184 
185  XclsTag exclusive_tag;
186 
187  exclusive_tag.SetNNucleons (nproton, nneutron);
188  exclusive_tag.SetNPions (npiplus, npi0, npiminus);
189 
190  interaction->SetExclTag(exclusive_tag);
191 }
192 //___________________________________________________________________________
194 {
195  Algorithm::Configure(config);
196  this->LoadConfigData();
197 }
198 //____________________________________________________________________________
200 {
201  Algorithm::Configure(config);
202  this->LoadConfigData();
203 }
204 //____________________________________________________________________________
206 {
207  this->GetParamDef("is-CC", fIsCC, false);
208  this->GetParamDef("is-NC", fIsNC, false);
209 }
210 //____________________________________________________________________________
void SetNPions(int npi_plus, int npi_0, int npi_minus)
Definition: XclsTag.cxx:88
bool IsNeutrino(int pdgc)
Definition: PDGUtils.cxx:110
#define pERROR
Definition: Messenger.h:59
Defines the InteractionListGeneratorI interface. Concrete implementations of this interface generate ...
static int FinStateNucleon(SppChannel_t channel)
Definition: SppChannel.h:130
Contains minimal information for tagging exclusive processes.
Definition: XclsTag.h:39
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:96
static int InitStateNucleon(SppChannel_t channel)
Definition: SppChannel.h:103
A class encapsulating an enumeration of interaction types (EM, Weak-CC, Weak-NC) and scattering types...
Definition: ProcessInfo.h:46
bool IsAntiNeutrino(int pdgc)
Definition: PDGUtils.cxx:118
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
Definition: Target.h:40
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
int ProbePdg(void) const
Definition: InitialState.h:64
const int kPdgPiP
Definition: PDGCodes.h:158
const int kPdgPi0
Definition: PDGCodes.h:160
string AsString(void) const
int Z(void) const
Definition: Target.h:68
#define pINFO
Definition: Messenger.h:62
void AddFinalStateInfo(Interaction *i, SppChannel_t chan) const
#define pWARN
Definition: Messenger.h:60
static int FinStatePion(SppChannel_t channel)
Definition: SppChannel.h:157
void SetExclTag(const XclsTag &xcls)
int N(void) const
Definition: Target.h:69
void SetNNucleons(int np, int nn)
Definition: XclsTag.cxx:95
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:65
void SetHitNucPdg(int pdgc)
Definition: Target.cxx:171
Target * TgtPtr(void) const
Definition: InitialState.h:67
const int kPdgPiM
Definition: PDGCodes.h:159
A vector of Interaction objects.
InitialState * InitStatePtr(void) const
Definition: Interaction.h:74
const int kPdgProton
Definition: PDGCodes.h:81
bool GetParamDef(const RgKey &name, T &p, const T &def) const
InteractionList * CreateInteractionList(const InitialState &init) const
const int kPdgNeutron
Definition: PDGCodes.h:83
Initial State information.
Definition: InitialState.h:48