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