DMELInteractionListGenerator.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 
7  Author: Joshua Berger <jberger \at physics.wisc.edu>
8  University of Wisconsin-Madison
9 
10  Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
11  University of Liverpool & STFC Rutherford Appleton Laboratory
12 */
13 //____________________________________________________________________________
14 
21 
22 using namespace genie;
23 
24 //___________________________________________________________________________
26 InteractionListGeneratorI("genie::DMELInteractionListGenerator")
27 {
28 
29 }
30 //___________________________________________________________________________
32 InteractionListGeneratorI("genie::DMELInteractionListGenerator", config)
33 {
34 
35 }
36 //___________________________________________________________________________
38 {
39 
40 }
41 //___________________________________________________________________________
43  const InitialState & init_state) const
44 {
45  LOG("IntLst", pINFO)
46  << "InitialState = " << init_state.AsString();
47 
48  if (fIsDM)
49  return this->CreateInteractionListDM(init_state);
50  else {
51  LOG("IntLst", pWARN)
52  << "Unknown InteractionType! Returning NULL InteractionList "
53  << "for init-state: " << init_state.AsString();
54  return 0;
55  }
56  return 0;
57 }
58 //___________________________________________________________________________
60  const InitialState & init_state) const
61 {
62  InteractionList * intlist = new InteractionList;
63 
64  int nuclpdg[2] = { kPdgProton, kPdgNeutron };
65 
66  int dmpdg = init_state.ProbePdg();
67  bool isdm = pdg::IsDarkMatter(dmpdg) || pdg::IsAntiDarkMatter(dmpdg);
68 
69  if(!isdm) {
70  LOG("IntLst", pWARN)
71  << "Can not handle probe! Returning NULL InteractionList "
72  << "for init-state: " << init_state.AsString();
73  delete intlist;
74  return 0;
75  }
76 
77  for(int i=0; i<2; i++) {
78 
80  Interaction * interaction = new Interaction(init_state, proc_info);
81 
82  Target * target = interaction->InitStatePtr()->TgtPtr();
83  bool hasP = (target->Z() > 0);
84  bool hasN = (target->N() > 0);
85 
86  if(nuclpdg[i] == kPdgProton && !hasP) {
87  delete interaction;
88  continue;
89  }
90  if(nuclpdg[i] == kPdgNeutron && !hasN) {
91  delete interaction;
92  continue;
93  }
94  target->SetHitNucPdg(nuclpdg[i]);
95  intlist->push_back(interaction);
96  }
97 
98  if(intlist->size() == 0) {
99  LOG("IntLst", pINFO)
100  << "Returning NULL InteractionList for init-state: "
101  << init_state.AsString();
102  delete intlist;
103  return 0;
104  }
105  return intlist;
106 }
107 //____________________________________________________________________________
109 {
110  Algorithm::Configure(config);
111  this->LoadConfigData();
112 }
113 //____________________________________________________________________________
115 {
116  Algorithm::Configure(config);
117  this->LoadConfigData();
118 }
119 //____________________________________________________________________________
121 {
122  GetParamDef( "is-DM", fIsDM, false );
123 }
124 //____________________________________________________________________________
125 
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
InteractionList * CreateInteractionListDM(const InitialState &init) const
Defines the InteractionListGeneratorI interface. Concrete implementations of this interface generate ...
InteractionList * CreateInteractionList(const InitialState &init) const
bool IsDarkMatter(int pdgc)
Definition: PDGUtils.cxx:124
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
bool IsAntiDarkMatter(int pdgc)
Definition: PDGUtils.cxx:130
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
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
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
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...
Initial State information.
Definition: InitialState.h:48