DISInteractionListGenerator.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2020, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5 
6  Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
7  University of Liverpool & STFC Rutherford Appleton Laboratory
8 */
9 //____________________________________________________________________________
10 
17 
18 using namespace genie;
19 
20 //___________________________________________________________________________
22 InteractionListGeneratorI("genie::DISInteractionListGenerator")
23 {
24 
25 }
26 //___________________________________________________________________________
28 InteractionListGeneratorI("genie::DISInteractionListGenerator", 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  InteractionType_t inttype;
45  if (fIsCC) inttype = kIntWeakCC;
46  else if (fIsNC) inttype = kIntWeakNC;
47  else if (fIsEM) inttype = kIntEM;
48  else {
49  LOG("IntLst", pWARN)
50  << "Unknown InteractionType! Returning NULL InteractionList "
51  << "for init-state: " << init_state.AsString();
52  return 0;
53  }
54 
55  int ppdg = init_state.ProbePdg();
56  if( !pdg::IsLepton(ppdg) ) {
57  LOG("IntLst", pWARN)
58  << "Can not handle probe! Returning NULL InteractionList "
59  << "for init-state: " << init_state.AsString();
60  return 0;
61  }
62 
63  bool hasP = (init_state.Tgt().Z() > 0);
64  bool hasN = (init_state.Tgt().N() > 0);
65 
66  InteractionList * intlist = new InteractionList;
67 
68  int nuclpdg[2] = { kPdgProton, kPdgNeutron };
69 
70  for(int inucl=0; inucl<2; inucl++) {
71 
72  int struck_nucleon = nuclpdg[inucl];
73 
74  if( (struck_nucleon == kPdgProton && hasP) ||
75  (struck_nucleon == kPdgNeutron && hasN) ) {
76 
77  ProcessInfo proc_info(kScDeepInelastic, inttype);
78 
79  Interaction * interaction = new Interaction(init_state, proc_info);
80  Target * target = interaction->InitStatePtr()->TgtPtr();
81  target->SetHitNucPdg(struck_nucleon);
82 
83  if(fIsCharm) {
84  XclsTag exclusive_tag;
85  exclusive_tag.SetCharm();
86  interaction->SetExclTag(exclusive_tag);
87  }
88 
89  if(fSetHitQuark) {
90  // Add interactions for all possible hit (valence or sea) quarks
91 
92  multimap<int,bool> hq = this->GetHitQuarks(interaction);
93  multimap<int,bool>::const_iterator hqi = hq.begin();
94 
95  for( ; hqi != hq.end(); ++hqi) {
96 
97  int quark_code = hqi->first;
98  bool from_sea = hqi->second;
99 
100  target->SetHitQrkPdg(quark_code);
101  target->SetHitSeaQrk(from_sea);
102 
103  Interaction * intq = new Interaction(*interaction);
104  intlist->push_back(intq);
105  }
106  delete interaction;
107  }
108  else {
109  intlist->push_back(interaction);
110  }//set hit quark?
111 
112  }//current N exists in nuclear target
113  }//N
114 
115  if(intlist->size() == 0) {
116  LOG("IntLst", pERROR)
117  << "Returning NULL InteractionList for init-state: "
118  << init_state.AsString();
119  delete intlist;
120  return 0;
121  }
122  return intlist;
123 }
124 //___________________________________________________________________________
126 {
127  Algorithm::Configure(config);
128  this->LoadConfigData();
129 }
130 //____________________________________________________________________________
132 {
133  Algorithm::Configure(config);
134  this->LoadConfigData();
135 }
136 //____________________________________________________________________________
138 {
139  GetParamDef( "is-CC", fIsCC, false ) ;
140  GetParamDef( "is-NC", fIsNC, false ) ;
141  GetParamDef( "is-EM", fIsEM, false ) ;
142  GetParamDef( "is-Charm", fIsCharm, false ) ;
143  GetParamDef( "set-hit-quark", fSetHitQuark, false ) ;
144 
145 }
146 //____________________________________________________________________________
148  const Interaction * interaction) const
149 {
150 // Set (PDG code, from-sea flag) for all possible hit quarks for the input
151 // interaction
152 
153  multimap<int,bool> hq;
154 
155  const ProcessInfo & proc = interaction->ProcInfo();
156 
157  if(proc.IsWeakNC() || proc.IsEM()) {
158  //
159  // NC - includes both v+N, vbar+N
160  //
161  if(!fIsCharm) {
162  hq.insert(pair<int,bool>(kPdgUQuark, false));
163  hq.insert(pair<int,bool>(kPdgUQuark, true ));
164  hq.insert(pair<int,bool>(kPdgAntiUQuark, true ));
165  hq.insert(pair<int,bool>(kPdgDQuark, false));
166  hq.insert(pair<int,bool>(kPdgDQuark, true ));
167  hq.insert(pair<int,bool>(kPdgAntiDQuark, true ));
168  hq.insert(pair<int,bool>(kPdgSQuark, true ));
169  hq.insert(pair<int,bool>(kPdgAntiSQuark, true ));
170  }
171 
172  } else if (proc.IsWeakCC()) {
173  //
174  // CC - only I=-1/2 quarks for v+N & I=1/2 quarks for vbar+N
175  //
176  int ppdg = interaction->InitState().ProbePdg();
177 
178  if (pdg::IsNeutrino(ppdg)){
179  if(!fIsCharm) { hq.insert(pair<int,bool>(kPdgAntiUQuark, true )); }
180  hq.insert(pair<int,bool>(kPdgDQuark, false));
181  hq.insert(pair<int,bool>(kPdgDQuark, true ));
182  hq.insert(pair<int,bool>(kPdgSQuark, true ));
183  }
184  else if (pdg::IsAntiNeutrino(ppdg)){
185  if(!fIsCharm) { hq.insert(pair<int,bool>(kPdgUQuark, false)); }
186  if(!fIsCharm) { hq.insert(pair<int,bool>(kPdgUQuark, true )); }
187  hq.insert(pair<int,bool>(kPdgAntiDQuark, true ));
188  hq.insert(pair<int,bool>(kPdgAntiSQuark, true ));
189  }
190  }//CC or NC
191 
192  return hq;
193 }
194 //____________________________________________________________________________
bool IsWeakCC(void) const
bool IsNeutrino(int pdgc)
Definition: PDGUtils.cxx:107
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
#define pERROR
Definition: Messenger.h:59
Defines the InteractionListGeneratorI interface. Concrete implementations of this interface generate ...
const int kPdgUQuark
Definition: PDGCodes.h:42
void SetHitQrkPdg(int pdgc)
Definition: Target.cxx:184
intermediate_table::const_iterator const_iterator
Contains minimal information for tagging exclusive processes.
Definition: XclsTag.h:39
const int kPdgSQuark
Definition: PDGCodes.h:46
void SetCharm(int charm_pdgc=0)
Definition: XclsTag.cxx:59
Summary information for an interaction.
Definition: Interaction.h:56
const int kPdgAntiUQuark
Definition: PDGCodes.h:43
bool IsWeakNC(void) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
static Config * config
Definition: config.cpp:1054
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:115
const int kPdgAntiDQuark
Definition: PDGCodes.h:45
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
const int kPdgDQuark
Definition: PDGCodes.h:44
int Z(void) const
Definition: Target.h:68
#define pINFO
Definition: Messenger.h:62
#define pWARN
Definition: Messenger.h:60
bool IsEM(void) const
const int kPdgAntiSQuark
Definition: PDGCodes.h:47
void SetExclTag(const XclsTag &xcls)
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 InitialState & InitState(void) const
Definition: Interaction.h:69
const ProcessInfo & ProcInfo(void) const
Definition: Interaction.h:70
multimap< int, bool > GetHitQuarks(const Interaction *interaction) const
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
void SetHitSeaQrk(bool tf)
Definition: Target.cxx:195
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
bool IsLepton(int pdgc)
Definition: PDGUtils.cxx:83
Initial State information.
Definition: InitialState.h:48