DFRInteractionListGenerator.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 - Feb 15, 2009
9 
10  For the class documentation see the corresponding header file.
11 
12  Important revisions after version 2.0.0 :
13  @ Feb 15, 2009 - CA
14  This class was first added in version 2.5.1.
15 
16 */
17 //____________________________________________________________________________
18 
25 
26 using namespace genie;
27 
28 //___________________________________________________________________________
30 InteractionListGeneratorI("genie::DFRInteractionListGenerator")
31 {
32 
33 }
34 //___________________________________________________________________________
36 InteractionListGeneratorI("genie::DFRInteractionListGenerator", config)
37 {
38 
39 }
40 //___________________________________________________________________________
42 {
43 
44 }
45 //___________________________________________________________________________
47  const InitialState & init_state) const
48 {
49  LOG("IntLst", pINFO)
50  << "InitialState = " << init_state.AsString();
51 
52  LOG("IntLst", pINFO)
53  << "InitialState = " << init_state.AsString();
54 
55  InteractionType_t inttype;
56  if (fIsCC) inttype = kIntWeakCC;
57  else if (fIsNC) inttype = kIntWeakNC;
58  else {
59  LOG("IntLst", pWARN)
60  << "Unknown InteractionType! Returning NULL InteractionList "
61  << "for init-state: " << init_state.AsString();
62  return 0;
63  }
64 
65  int nupdg = init_state.ProbePdg();
66  if( !pdg::IsNeutrino(nupdg) && !pdg::IsAntiNeutrino(nupdg) ) {
67  LOG("IntLst", pWARN)
68  << "Can not handle probe! Returning NULL InteractionList "
69  << "for init-state: " << init_state.AsString();
70  return 0;
71  }
72 
73  // at least for now, we don't have any models
74  // that provide diffractive scattering from nuclear targets--
75  // just free protons
76  const Target & target = init_state.Tgt();
77  if( !target.IsProton() ) {
78  LOG("IntLst", pINFO)
79  << "Target is not free proton -- Returning NULL InteractionList "
80  << "for init-state: " << init_state.AsString();
81  return 0;
82  }
83 
84 
85  // The code below does way more work than necessary
86  // to assign the final state when scattering
87  // is just for free protons (as ensured by the checks above).
88  // However, it does the correct thing,
89  // and we leave it here in the event that someday we
90  // introduce a diffractive model that can handle other targets.
91  InteractionList * intlist = new InteractionList;
92 
93  ProcessInfo proc_info(kScDiffractive, inttype);
94 
95  bool hasP = (init_state.Tgt().Z() > 0);
96  bool hasN = (init_state.Tgt().N() > 0);
97 
98  int hit_nucleon[2] = {kPdgProton, kPdgNeutron};
99 
100  for(int i=0; i<2; i++) {
101 
102  Interaction * interaction = new Interaction(init_state, proc_info);
103 
104  int nuc = hit_nucleon[i];
105 
106  if(nuc == kPdgProton && !hasP) continue;
107  if(nuc == kPdgNeutron && !hasN) continue;
108 
109  if(fIsCC) {
110  if(pdg::IsNeutrino(nupdg)) {
111  //v N -> l- N pi+
112  interaction->ExclTagPtr()->SetNPions(1,0,0);
113  } else {
114  //vbar N -> l+ N pi-
115  interaction->ExclTagPtr()->SetNPions(0,0,1);
116  }
117  }
118  else {
119  //v N -> v N pi0
120  interaction->ExclTagPtr()->SetNPions(0,1,0);
121  }
122 
123  if (nuc == kPdgProton)
124  interaction->ExclTagPtr()->SetNProtons(1);
125  else if (nuc == kPdgNeutron)
126  interaction->ExclTagPtr()->SetNNeutrons(1);
127 
128  interaction->InitStatePtr()->TgtPtr()->SetHitNucPdg(nuc);
129  intlist->push_back(interaction);
130  }
131 
132  return intlist;
133 }
134 //___________________________________________________________________________
136 {
137  Algorithm::Configure(config);
138  this->LoadConfigData();
139 }
140 //____________________________________________________________________________
142 {
143  Algorithm::Configure(config);
144  this->LoadConfigData();
145 }
146 //____________________________________________________________________________
148 {
149  GetParamDef( "is-CC",fIsCC, false ) ;
150  GetParamDef( "is-NC",fIsNC, false ) ;
151 }
152 //____________________________________________________________________________
153 
154 
void SetNPions(int npi_plus, int npi_0, int npi_minus)
Definition: XclsTag.cxx:97
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
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
bool IsAntiNeutrino(int pdgc)
Definition: PDGUtils.cxx:116
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
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
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 Target & Tgt(void) const
Definition: InitialState.h:67
bool IsProton(void) const
Definition: Target.cxx:279
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
void SetNProtons(int np)
Definition: XclsTag.h:70
Initial State information.
Definition: InitialState.h:49