SKInteractionListGenerator.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  Authors: Chris Marshall <marshall \at pas.rochester.edu>
8  University of Rochester
9 
10  Martti Nirkko
11  University of Berne
12 
13  For the class documentation see the corresponding header file.
14 
15 */
16 //____________________________________________________________________________
17 
24 
25 using namespace genie;
26 
27 //___________________________________________________________________________
29 InteractionListGeneratorI("genie::SKInteractionListGenerator")
30 {
31 
32 }
33 //___________________________________________________________________________
35 InteractionListGeneratorI("genie::SKInteractionListGenerator", config)
36 {
37 
38 }
39 //___________________________________________________________________________
41 {
42 
43 }
44 //___________________________________________________________________________
46  const InitialState & init_state) const
47 {
48  LOG("IntLst", pINFO)
49  << "InitialState = " << init_state.AsString();
50 
51  if (fIsNC) {
52  // deltaS = deltaQ and deltaS = 1 for this process -- no NC
53  LOG("IntLst", pWARN)
54  << "Interaction type is NC for deltaS = 1 process! Returning NULL InteractionList "
55  << "for init-state: " << init_state.AsString();
56  return 0;
57  }
58  else if (!fIsCC) {
59  // shouldn't happen... warn
60  LOG("IntLst", pWARN)
61  << "Unknown InteractionType! Returning NULL InteractionList "
62  << "for init-state: " << init_state.AsString();
63  return 0;
64  }
65 
66  int probe_pdg = init_state.ProbePdg();
67  bool isnu = pdg::IsNeutrino(probe_pdg);
68  if( !isnu ) {
69  // shouldn't happen... warn
70  LOG("IntLst", pWARN)
71  << "Can not handle probe! Returning NULL InteractionList "
72  << "for init-state: " << init_state.AsString();
73  return 0;
74  }
75 
76  InteractionList * intlist = new InteractionList;
77 
78  const int nch = 3;
79  int inuclpdg[nch] = {0}; // hit nucleon pdg
80  int fnuclpdg[nch] = {0}; // FS nucleon pdg
81  int kaonpdg[nch] = {0}; // FS kaon pdg
82  if( pdg::IsNeutrino(probe_pdg) ) {
83  inuclpdg[0] = kPdgProton; inuclpdg[1] = kPdgNeutron; inuclpdg[2] = kPdgNeutron;
84  fnuclpdg[0] = kPdgProton; fnuclpdg[1] = kPdgNeutron; fnuclpdg[2] = kPdgProton;
85  kaonpdg[0] = kPdgKP; kaonpdg[1] = kPdgKP; kaonpdg[2] = kPdgK0;
86  } else {
87  inuclpdg[0] = kPdgProton; inuclpdg[1] = kPdgNeutron; inuclpdg[2] = kPdgProton;
88  fnuclpdg[0] = kPdgProton; fnuclpdg[1] = kPdgNeutron; fnuclpdg[2] = kPdgNeutron;
89  kaonpdg[0] = kPdgKM; kaonpdg[1] = kPdgKM; kaonpdg[2] = kPdgK0;
90  }
91 
92  for(int i=0; i<nch; i++) {
93 
95  Interaction * interaction = new Interaction(init_state, proc_info);
96 
97  Target * target = interaction->InitStatePtr()->TgtPtr();
98  bool hasP = (target->Z() > 0);
99  bool hasN = (target->N() > 0);
100 
101  XclsTag * xcls = interaction->ExclTagPtr();
102 
103  if(inuclpdg[i] == kPdgProton && !hasP) {
104  delete interaction;
105  continue;
106  }
107  if(inuclpdg[i] == kPdgNeutron && !hasN) {
108  delete interaction;
109  continue;
110  }
111  target->SetHitNucPdg(inuclpdg[i]);
112  xcls->SetStrange(kaonpdg[i]);
113  if( fnuclpdg[i] == kPdgProton ) xcls->SetNProtons(1);
114  else xcls->SetNNeutrons(1);
115 
116  intlist->push_back(interaction);
117  }
118 
119  return intlist;
120 }
121 //___________________________________________________________________________
123 {
124  Algorithm::Configure(config);
125  this->LoadConfigData();
126 }
127 //____________________________________________________________________________
129 {
130  Algorithm::Configure(config);
131  this->LoadConfigData();
132 }
133 //____________________________________________________________________________
135 {
136  this->GetParamDef("is-CC", fIsCC, false);
137  this->GetParamDef("is-NC", fIsNC, false);
138 }
139 //____________________________________________________________________________
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
Defines the InteractionListGeneratorI interface. Concrete implementations of this interface generate ...
Definition: config.py:1
Contains minimal information for tagging exclusive processes.
Definition: XclsTag.h:37
const int kPdgK0
Definition: PDGCodes.h:151
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
const int kPdgKM
Definition: PDGCodes.h:150
void SetStrange(int strange_pdgc=0)
Definition: XclsTag.cxx:85
A class encapsulating an enumeration of interaction types (EM, Weak-CC, Weak-NC) and scattering types...
Definition: ProcessInfo.h:44
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 kPdgKP
Definition: PDGCodes.h:149
void SetNNeutrons(int nn)
Definition: XclsTag.h:71
string AsString(void) const
int Z(void) const
Definition: Target.h:69
#define pINFO
Definition: Messenger.h:63
#define pWARN
Definition: Messenger.h:61
XclsTag * ExclTagPtr(void) const
Definition: Interaction.h:77
int N(void) const
Definition: Target.h:70
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
InteractionList * CreateInteractionList(const InitialState &init) const
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
const int kPdgNeutron
Definition: PDGCodes.h:67
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
void SetNProtons(int np)
Definition: XclsTag.h:70
Initial State information.
Definition: InitialState.h:49