GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
QELInteractionListGenerator.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 
17 
18 using namespace genie;
19 
20 //___________________________________________________________________________
22 InteractionListGeneratorI("genie::QELInteractionListGenerator")
23 {
24 
25 }
26 //___________________________________________________________________________
28 InteractionListGeneratorI("genie::QELInteractionListGenerator", config)
29 {
30 
31 }
32 //___________________________________________________________________________
34 {
35 
36 }
37 //___________________________________________________________________________
39  const InitialState & init_state) const
40 {
41  LOG("IntLst", pINFO)
42  << "InitialState = " << init_state.AsString();
43 
44  if (fIsCC && !fIsCharm && !fIsStrange)
45  return this->CreateInteractionListCC(init_state);
46  else
47  if (fIsNC && !fIsCharm && !fIsStrange)
48  return this->CreateInteractionListNC(init_state);
49  else
50  if (fIsEM)
51  return this->CreateInteractionListEM(init_state);
52  else
53  if (fIsCC && fIsCharm)
54  return this->CreateInteractionListCharmCC(init_state);
55  else
56  if (fIsCC && fIsStrange)
57  return this->CreateInteractionListStrangeCC(init_state);
58  else {
59  LOG("IntLst", pWARN)
60  << "Unknown InteractionType! Returning NULL InteractionList "
61  << "for init-state: " << init_state.AsString();
62  return 0;
63  }
64  return 0;
65 }
66 //___________________________________________________________________________
68  const InitialState & init_state) const
69 {
70  InteractionList * intlist = new InteractionList;
71 
73  Interaction * interaction = new Interaction(init_state, proc_info);
74 
75  int nupdg = init_state.ProbePdg();
76  bool isnu = pdg::IsNeutrino (nupdg);
77  bool isnubar = pdg::IsAntiNeutrino (nupdg);
78 
79  Target * target = interaction->InitStatePtr()->TgtPtr();
80  bool hasP = (target->Z() > 0);
81  bool hasN = (target->N() > 0);
82 
83  if(!isnu && !isnubar) {
84  LOG("IntLst", pWARN)
85  << "Can not handle probe! Returning NULL InteractionList "
86  << "for init-state: " << init_state.AsString();
87  delete intlist;
88  return 0;
89  }
90 
91  if (isnu && hasN) {
92  target->SetHitNucPdg(kPdgNeutron);
93  intlist->push_back(interaction);
94 
95  } else if (isnubar && hasP) {
96  target->SetHitNucPdg(kPdgProton);
97  intlist->push_back(interaction);
98 
99  } else {
100  LOG("IntLst", pINFO)
101  << "Returning NULL InteractionList for init-state: "
102  << init_state.AsString();
103  delete interaction;
104  delete intlist;
105  return 0;
106  }
107  return intlist;
108 }
109 //___________________________________________________________________________
111  const InitialState & init_state) const
112 {
113  InteractionList * intlist = new InteractionList;
114 
115  int nuclpdg[2] = { kPdgProton, kPdgNeutron };
116 
117  int nupdg = init_state.ProbePdg();
118  bool isnu = pdg::IsNeutrino (nupdg);
119  bool isnubar = pdg::IsAntiNeutrino (nupdg);
120 
121  if(!isnu && !isnubar) {
122  LOG("IntLst", pWARN)
123  << "Can not handle probe! Returning NULL InteractionList "
124  << "for init-state: " << init_state.AsString();
125  delete intlist;
126  return 0;
127  }
128 
129  for(int i=0; i<2; i++) {
130 
132  Interaction * interaction = new Interaction(init_state, proc_info);
133 
134  Target * target = interaction->InitStatePtr()->TgtPtr();
135  bool hasP = (target->Z() > 0);
136  bool hasN = (target->N() > 0);
137 
138  if(nuclpdg[i] == kPdgProton && !hasP) {
139  delete interaction;
140  continue;
141  }
142  if(nuclpdg[i] == kPdgNeutron && !hasN) {
143  delete interaction;
144  continue;
145  }
146  target->SetHitNucPdg(nuclpdg[i]);
147  intlist->push_back(interaction);
148  }
149 
150  if(intlist->size() == 0) {
151  LOG("IntLst", pINFO)
152  << "Returning NULL InteractionList for init-state: "
153  << init_state.AsString();
154  delete intlist;
155  return 0;
156  }
157  return intlist;
158 }
159 //___________________________________________________________________________
161  const InitialState & init_state) const
162 {
163  InteractionList * intlist = new InteractionList;
164 
165  int tgtpdg = init_state.Tgt().Pdg();
166  int ppdg = init_state.ProbePdg();
167 
168  bool ischgl = pdg::IsChargedLepton(ppdg);
169  if(!ischgl) {
170  LOG("IntLst", pWARN)
171  << "Can not handle probe! Returning NULL InteractionList "
172  << "for init-state: " << init_state.AsString();
173  delete intlist;
174  return 0;
175  }
176 
177  bool hasP = (init_state.Tgt().Z() > 0);
178  if(hasP) {
179  Interaction * interaction = Interaction::QELEM(tgtpdg,kPdgProton,ppdg);
180  intlist->push_back(interaction);
181  }
182  bool hasN = (init_state.Tgt().N() > 0);
183  if(hasN) {
184  Interaction * interaction = Interaction::QELEM(tgtpdg,kPdgNeutron,ppdg);
185  intlist->push_back(interaction);
186  }
187 
188  if(intlist->size() == 0) {
189  delete intlist;
190  return 0;
191  }
192 
193  return intlist;
194 }
195 //___________________________________________________________________________
198  const InitialState & init_state) const
199 {
200  // vl + n --> l- + Lambda_{c}^{+} (2285)
201  // vl + n --> l- + Sigma_{c}^{+} (2455)
202  // vl + p --> l- + Sigma_{c}^{++} (2455)
203 
204  int nupdg = init_state.ProbePdg();
205  bool isnu = pdg::IsNeutrino(nupdg);
206  if(!isnu) {
207  LOG("IntLst", pINFO)
208  << "Returning NULL InteractionList for init-state: "
209  << init_state.AsString();
210  return 0;
211  }
212 
213  const int nch = 3;
214  int nuclpdg [nch] = { kPdgNeutron, kPdgNeutron, kPdgProton };
215  int charmpdg[nch] = { kPdgLambdaPc, kPdgSigmaPc, kPdgSigmaPPc };
216 
217  InteractionList * intlist = new InteractionList;
218 
219  for(int i=0; i<nch; i++) {
220 
222  Interaction * interaction = new Interaction(init_state, proc_info);
223 
224  Target * target = interaction->InitStatePtr()->TgtPtr();
225  bool hasP = (target->Z() > 0);
226  bool hasN = (target->N() > 0);
227 
228  XclsTag * xcls = interaction->ExclTagPtr();
229 
230  if(nuclpdg[i] == kPdgProton && !hasP) {
231  delete interaction;
232  continue;
233  }
234  if(nuclpdg[i] == kPdgNeutron && !hasN) {
235  delete interaction;
236  continue;
237  }
238  target->SetHitNucPdg(nuclpdg[i]);
239  xcls->SetCharm(charmpdg[i]);
240 
241  intlist->push_back(interaction);
242  }
243  return intlist;
244 }
245 //___________________________________________________________________________
248  const InitialState & init_state) const
249 {
250  // v + n --> mu+ + Sigma^{-}
251  // v + p --> mu+ + Lambda^{0}
252  // v + p --> mu+ + Sigma^{0}
253 
254  int nupdg = init_state.ProbePdg();
255  bool isnu = pdg::IsNeutrino(nupdg);
256  if(isnu) {
257  LOG("IntLst", pERROR)
258  << "Returning NULL InteractionList for init-state: "
259  << init_state.AsString();
260  return 0;
261  }
262 
263  const int nch = 3;
264  int nuclpdg [nch] = { kPdgNeutron, kPdgProton, kPdgProton };
265  int strangepdg[nch] = { kPdgSigmaM , kPdgLambda, kPdgSigma0 };
266 
267  InteractionList * intlist = new InteractionList;
268 
269  for(int i=0; i<nch; i++) {
270 
272  Interaction * interaction = new Interaction(init_state, proc_info);
273 
274  Target * target = interaction->InitStatePtr()->TgtPtr();
275  bool hasP = (target->Z() > 0);
276  bool hasN = (target->N() > 0);
277 
278  XclsTag * xcls = interaction->ExclTagPtr();
279 
280  if(nuclpdg[i] == kPdgProton && !hasP) {
281  delete interaction;
282  continue;
283  }
284  if(nuclpdg[i] == kPdgNeutron && !hasN) {
285  delete interaction;
286  continue;
287  }
288  target->SetHitNucPdg(nuclpdg[i]);
289  xcls->SetStrange(strangepdg[i]);
290 
291  intlist->push_back(interaction);
292  }
293  return intlist;
294 }
295 //____________________________________________________________________________
297 {
298  Algorithm::Configure(config);
299  this->LoadConfigData();
300 }
301 //____________________________________________________________________________
303 {
304  Algorithm::Configure(config);
305  this->LoadConfigData();
306 }
307 //____________________________________________________________________________
309 {
310  GetParamDef( "is-CC", fIsCC, false ) ;
311  GetParamDef( "is-NC", fIsNC, false ) ;
312  GetParamDef( "is-EM", fIsEM, false ) ;
313  GetParamDef( "is-Charm", fIsCharm, false ) ;
314  GetParamDef( "is-Strange", fIsStrange, false ) ;
315 }
316 //____________________________________________________________________________
bool IsNeutrino(int pdgc)
Definition: PDGUtils.cxx:110
#define pERROR
Definition: Messenger.h:59
const int kPdgLambda
Definition: PDGCodes.h:85
Defines the InteractionListGeneratorI interface. Concrete implementations of this interface generate ...
InteractionList * CreateInteractionListCharmCC(const InitialState &init) const
int Pdg(void) const
Definition: Target.h:71
const int kPdgSigma0
Definition: PDGCodes.h:88
bool IsChargedLepton(int pdgc)
Definition: PDGUtils.cxx:101
Contains minimal information for tagging exclusive processes.
Definition: XclsTag.h:39
const int kPdgSigmaPPc
Definition: PDGCodes.h:102
void SetCharm(int charm_pdgc=0)
Definition: XclsTag.cxx:59
InteractionList * CreateInteractionList(const InitialState &init) const
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
void SetStrange(int strange_pdgc=0)
Definition: XclsTag.cxx:76
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 kPdgLambdaPc
Definition: PDGCodes.h:99
InteractionList * CreateInteractionListNC(const InitialState &init) const
string AsString(void) const
int Z(void) const
Definition: Target.h:68
#define pINFO
Definition: Messenger.h:62
#define pWARN
Definition: Messenger.h:60
const int kPdgSigmaM
Definition: PDGCodes.h:89
XclsTag * ExclTagPtr(void) const
Definition: Interaction.h:77
InteractionList * CreateInteractionListStrangeCC(const InitialState &init) const
int N(void) const
Definition: Target.h:69
const int kPdgSigmaPc
Definition: PDGCodes.h:101
static Interaction * QELEM(int tgt, int nuc, int probe, double E=0)
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
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
const Target & Tgt(void) const
Definition: InitialState.h:66
const int kPdgNeutron
Definition: PDGCodes.h:83
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
InteractionList * CreateInteractionListEM(const InitialState &init) const
InteractionList * CreateInteractionListCC(const InitialState &init) const
Initial State information.
Definition: InitialState.h:48