RESInteractionListGenerator.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  @ Sep 21, 2009 - CA
16  Generate interaction lists for charge lepton scattering
17 
18 */
19 //____________________________________________________________________________
20 
29 
30 using namespace genie;
31 
32 //___________________________________________________________________________
34 InteractionListGeneratorI("genie::RESInteractionListGenerator")
35 {
36 
37 }
38 //___________________________________________________________________________
40 InteractionListGeneratorI("genie::RESInteractionListGenerator", config)
41 {
42 
43 }
44 //___________________________________________________________________________
46 {
47 
48 }
49 //___________________________________________________________________________
51  const InitialState & init_state) const
52 {
53  LOG("IntLst", pINFO) << "InitialState = " << init_state.AsString();
54 
55  // In the thread generating interactions from the list produced here (RES),
56  // we simulate (for free and nuclear targets) semi-inclusive resonance
57  // interactions: v + N -> v(l) + R -> v(l) + X
58  // Specifically, the RES thread generates:
59  //
60  // CC:
61  // nu + p (A) -> l- R (A), for all resonances with Q=+2
62  // nu + n (A) -> l- R (A), for all resonances with Q=+1
63  // \bar{nu} + p (A) -> l+ R (A), for all resonances with Q= 0
64  // \bar{nu} + n (A) -> l+ R (A), for all resonances with Q=-1
65  // NC:
66  // nu + p (A) -> nu R (A), for all resonances with Q=+1
67  // nu + n (A) -> nu R (A), for all resonances with Q= 0
68  // \bar{nu} + p (A) -> \bar{nu} R (A), for all resonances with Q=+1
69  // \bar{nu} + n (A) -> \bar{nu} R (A), for all resonances with Q= 0
70  //
71  // and then the resonance R should be allowed to decay to get the full
72  // hadronic final state X. All decay channels kinematically accessible
73  // to the (off the mass-shell produced) resonance can be allowed.
74 
75  // specify the requested interaction type
76  InteractionType_t inttype;
77  if (fIsCC) inttype = kIntWeakCC;
78  else if (fIsNC) inttype = kIntWeakNC;
79  else if (fIsEM) inttype = kIntEM;
80  else {
81  LOG("IntLst", pWARN)
82  << "Unknown InteractionType! Returning NULL InteractionList "
83  << "for init-state: " << init_state.AsString();
84  return 0;
85  }
86 
87  // create a process information object
88  ProcessInfo proc_info(kScResonant, inttype);
89 
90  // learn whether the input nuclear or free target has avail. p and n
91  const Target & inp_target = init_state.Tgt();
92  bool hasP = (inp_target.Z() > 0);
93  bool hasN = (inp_target.N() > 0);
94 
95  // possible hit nucleons
96  const int hit_nucleon[2] = {kPdgProton, kPdgNeutron};
97 
98  // create an interaction list
99  InteractionList * intlist = new InteractionList;
100 
101  // loop over all baryon resonances considered in current MC job
102  unsigned int nres = fResList.NResonances();
103  for(unsigned int ires = 0; ires < nres; ires++) {
104 
105  //get current resonance
106  Resonance_t res = fResList.ResonanceId(ires);
107 
108  // loop over hit nucleons
109  for(int i=0; i<2; i++) {
110 
111  // proceed only if the hit nucleon exists in the current init state
112  if(hit_nucleon[i]==kPdgProton && !hasP) continue;
113  if(hit_nucleon[i]==kPdgNeutron && !hasN) continue;
114 
115  // proceed only if the current resonance conserves charge
116  // (the only problematic case is when the RES charge has to be +2
117  // because then only Delta resonances are possible)
118  bool skip_res = proc_info.IsWeakCC() &&
119  pdg::IsNeutrino(init_state.ProbePdg()) &&
120  (hit_nucleon[i]==kPdgProton) &&
121  (!utils::res::IsDelta(res));
122  if(skip_res) continue;
123 
124  // create an interaction
125  Interaction * interaction = new Interaction(init_state, proc_info);
126 
127  // add the struck nucleon
128  Target * target = interaction->InitStatePtr()->TgtPtr();
129  target->SetHitNucPdg(hit_nucleon[i]);
130 
131  // add the baryon resonance in the exclusive tag
132  XclsTag * xcls = interaction->ExclTagPtr();
133  xcls->SetResonance(res);
134 
135  // add the interaction at the interaction list
136  intlist->push_back(interaction);
137 
138  }//hit nucleons
139  } //resonances
140 
141  if(intlist->size() == 0) {
142  LOG("IntLst", pERROR)
143  << "Returning NULL InteractionList for init-state: "
144  << init_state.AsString();
145  delete intlist;
146  return 0;
147  }
148 
149  return intlist;
150 }
151 //___________________________________________________________________________
153 {
154  Algorithm::Configure(config);
155  this->LoadConfigData();
156 }
157 //____________________________________________________________________________
159 {
160  Algorithm::Configure(config);
161  this->LoadConfigData();
162 }
163 //____________________________________________________________________________
165 {
166  string resonances = "";
167  this->GetParam("ResonanceNameList", resonances);
168  SLOG("IntLst", pDEBUG) << "Resonance list: " << resonances;
169 
170  fResList.Clear();
171  fResList.DecodeFromNameList(resonances);
172  LOG("IntLst", pDEBUG) << fResList;
173 
174  this->GetParamDef("is-CC", fIsCC, false);
175  this->GetParamDef("is-NC", fIsNC, false);
176  this->GetParamDef("is-EM", fIsEM, false);
177 }
178 //____________________________________________________________________________
bool IsDelta(Resonance_t res)
is it a Delta resonance?
bool IsWeakCC(void) const
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 ...
void DecodeFromNameList(string list, string delimiter=",")
Definition: config.py:1
enum genie::EResonance Resonance_t
unsigned int NResonances(void) const
void SetResonance(Resonance_t res)
Definition: XclsTag.cxx:123
Contains minimal information for tagging exclusive processes.
Definition: XclsTag.h:37
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:97
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
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
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
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
const Target & Tgt(void) const
Definition: InitialState.h:67
#define SLOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a short string (using the FUNCTION and...
Definition: Messenger.h:85
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...
enum genie::EInteractionType InteractionType_t
Initial State information.
Definition: InitialState.h:49
#define pDEBUG
Definition: Messenger.h:64
Resonance_t ResonanceId(unsigned int ires) const