GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SKInteractionListGenerator.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  Chris Marshall <marshall \at pas.rochester.edu>
7  University of Rochester
8 
9  Martti Nirkko
10  University of Berne
11 */
12 //____________________________________________________________________________
13 
20 
21 using namespace genie;
22 
23 //___________________________________________________________________________
25 InteractionListGeneratorI("genie::SKInteractionListGenerator")
26 {
27 
28 }
29 //___________________________________________________________________________
31 InteractionListGeneratorI("genie::SKInteractionListGenerator", config)
32 {
33 
34 }
35 //___________________________________________________________________________
37 {
38 
39 }
40 //___________________________________________________________________________
42  const InitialState & init_state) const
43 {
44  LOG("IntLst", pINFO)
45  << "InitialState = " << init_state.AsString();
46 
47  if (fIsNC) {
48  // deltaS = deltaQ and deltaS = 1 for this process -- no NC
49  LOG("IntLst", pWARN)
50  << "Interaction type is NC for deltaS = 1 process! Returning NULL InteractionList "
51  << "for init-state: " << init_state.AsString();
52  return 0;
53  }
54  else if (!fIsCC) {
55  // shouldn't happen... warn
56  LOG("IntLst", pWARN)
57  << "Unknown InteractionType! Returning NULL InteractionList "
58  << "for init-state: " << init_state.AsString();
59  return 0;
60  }
61 
62  int probe_pdg = init_state.ProbePdg();
63  bool isnu = pdg::IsNeutrino(probe_pdg);
64  if( !isnu ) {
65  // shouldn't happen... warn
66  LOG("IntLst", pWARN)
67  << "Can not handle probe! Returning NULL InteractionList "
68  << "for init-state: " << init_state.AsString();
69  return 0;
70  }
71 
72  InteractionList * intlist = new InteractionList;
73 
74  const int nch = 3;
75  int inuclpdg[nch] = {0}; // hit nucleon pdg
76  int fnuclpdg[nch] = {0}; // FS nucleon pdg
77  int kaonpdg[nch] = {0}; // FS kaon pdg
78  if( pdg::IsNeutrino(probe_pdg) ) {
79  inuclpdg[0] = kPdgProton; inuclpdg[1] = kPdgNeutron; inuclpdg[2] = kPdgNeutron;
80  fnuclpdg[0] = kPdgProton; fnuclpdg[1] = kPdgNeutron; fnuclpdg[2] = kPdgProton;
81  kaonpdg[0] = kPdgKP; kaonpdg[1] = kPdgKP; kaonpdg[2] = kPdgK0;
82  } else {
83  inuclpdg[0] = kPdgProton; inuclpdg[1] = kPdgNeutron; inuclpdg[2] = kPdgProton;
84  fnuclpdg[0] = kPdgProton; fnuclpdg[1] = kPdgNeutron; fnuclpdg[2] = kPdgNeutron;
85  kaonpdg[0] = kPdgKM; kaonpdg[1] = kPdgKM; kaonpdg[2] = kPdgK0;
86  }
87 
88  for(int i=0; i<nch; i++) {
89 
91  Interaction * interaction = new Interaction(init_state, proc_info);
92 
93  Target * target = interaction->InitStatePtr()->TgtPtr();
94  bool hasP = (target->Z() > 0);
95  bool hasN = (target->N() > 0);
96 
97  XclsTag * xcls = interaction->ExclTagPtr();
98 
99  if(inuclpdg[i] == kPdgProton && !hasP) {
100  delete interaction;
101  continue;
102  }
103  if(inuclpdg[i] == kPdgNeutron && !hasN) {
104  delete interaction;
105  continue;
106  }
107  target->SetHitNucPdg(inuclpdg[i]);
108  xcls->SetStrange(kaonpdg[i]);
109  if( fnuclpdg[i] == kPdgProton ) xcls->SetNProtons(1);
110  else xcls->SetNNeutrons(1);
111 
112  intlist->push_back(interaction);
113  }
114 
115  return intlist;
116 }
117 //___________________________________________________________________________
119 {
120  Algorithm::Configure(config);
121  this->LoadConfigData();
122 }
123 //____________________________________________________________________________
125 {
126  Algorithm::Configure(config);
127  this->LoadConfigData();
128 }
129 //____________________________________________________________________________
131 {
132  this->GetParamDef("is-CC", fIsCC, false);
133  this->GetParamDef("is-NC", fIsNC, false);
134 }
135 //____________________________________________________________________________
bool IsNeutrino(int pdgc)
Definition: PDGUtils.cxx:110
Defines the InteractionListGeneratorI interface. Concrete implementations of this interface generate ...
Contains minimal information for tagging exclusive processes.
Definition: XclsTag.h:39
const int kPdgK0
Definition: PDGCodes.h:174
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
const int kPdgKM
Definition: PDGCodes.h:173
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
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 kPdgKP
Definition: PDGCodes.h:172
void SetNNeutrons(int nn)
Definition: XclsTag.h:82
string AsString(void) const
int Z(void) const
Definition: Target.h:68
#define pINFO
Definition: Messenger.h:62
#define pWARN
Definition: Messenger.h:60
XclsTag * ExclTagPtr(void) const
Definition: Interaction.h:77
int N(void) const
Definition: Target.h:69
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
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:81
bool GetParamDef(const RgKey &name, T &p, const T &def) const
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...
void SetNProtons(int np)
Definition: XclsTag.h:81
Initial State information.
Definition: InitialState.h:48