HEDISInteractionListGenerator.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2018, 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: Alfonso Garcia <alfonsog \at nikhef.nl>
8  NIKHEF
9 
10  For the class documentation see the corresponding header file.
11 
12 */
13 //____________________________________________________________________________
14 
20 
21 using namespace genie;
22 
23 //___________________________________________________________________________
25 InteractionListGeneratorI("genie::HEDISInteractionListGenerator")
26 {
27 
28 }
29 //___________________________________________________________________________
31 InteractionListGeneratorI("genie::HEDISInteractionListGenerator", config)
32 {
33 
34 }
35 //___________________________________________________________________________
37 {
38 
39 }
40 //___________________________________________________________________________
42  const InitialState & init_state) const
43 {
44  LOG("IntLst", pINFO)
45  << "InitialState = " << init_state.AsString();
46 
47  vector<InteractionType_t> inttype;
48  if (fIsCC) inttype.push_back(kIntWeakCC);
49  else if (fIsNC) inttype.push_back(kIntWeakNC);
50  else {
51  LOG("IntLst", pWARN)
52  << "Unknown InteractionType! Returning NULL InteractionList "
53  << "for init-state: " << init_state.AsString();
54  return 0;
55  }
56 
57  int ppdg = init_state.ProbePdg();
58  if( !pdg::IsLepton(ppdg) ) {
59  LOG("IntLst", pWARN)
60  << "Can not handle probe! Returning NULL InteractionList "
61  << "for init-state: " << init_state.AsString();
62  return 0;
63  }
64 
65  vector<InitialState> init;
66  init.push_back(init_state);
67  InteractionList * intlist = this->CreateHEDISlist(init,inttype);
68 
69  if(intlist->size() == 0) {
70  LOG("IntLst", pERROR)
71  << "Returning NULL InteractionList for init-state: "
72  << init_state.AsString();
73  delete intlist;
74  return 0;
75  }
76  return intlist;
77 
78 }
79 //____________________________________________________________________________
81  vector<InitialState> vinit, vector<InteractionType_t> vinttype) const
82 {
83 
84  InteractionList * intlist = new InteractionList;
85 
87  for( ; init != vinit.end(); ++init) {
88 
90  if (init->Tgt().Z()>0) nucl.push_back(kPdgProton);
91  if (init->Tgt().A()-init->Tgt().Z()>0) nucl.push_back(kPdgNeutron);
92 
93  vector<int>::const_iterator inucl = nucl.begin();
94  for( ; inucl != nucl.end(); ++inucl) {
95 
96  vector<InteractionType_t>::const_iterator inttype = vinttype.begin();
97  for( ; inttype != vinttype.end(); ++inttype) {
98 
99  ProcessInfo proc(kScDeepInelastic,*inttype);
100  Interaction * interaction = new Interaction(*init, proc);
101  interaction->InitStatePtr()->TgtPtr()->SetHitNucPdg(*inucl);
102  multimap<int,bool> hq = this->GetHitQuarks(interaction);
103  multimap<int,bool>::const_iterator hqi = hq.begin();
104  for( ; hqi != hq.end(); ++hqi) {
105  int quark_code = hqi->first;
106  bool from_sea = hqi->second;
107  interaction->InitStatePtr()->TgtPtr()->SetHitQrkPdg(quark_code);
108  interaction->InitStatePtr()->TgtPtr()->SetHitSeaQrk(from_sea);
109  vector<int> fq = this->GetFinalQuarks(interaction);
110  vector<int>::const_iterator fqi = fq.begin();
111  for( ; fqi != fq.end(); ++fqi) {
112  XclsTag exclusive_tag;
113  exclusive_tag.SetFinalQuark (*fqi);
114  interaction->SetExclTag(exclusive_tag);
115  Interaction * intq = new Interaction(*interaction);
116  intlist->push_back(intq);
117  }
118  }
119  delete interaction;
120  }
121  }
122  }
123 
124  return intlist;
125 
126 }
127 //____________________________________________________________________________
129  const Interaction * interaction) const
130 {
131 // Set (PDG code, from-sea flag) for all possible hit and final quarks for the
132 // input interaction
133 
134  multimap<int,bool> hq;
135 
136  const ProcessInfo & proc = interaction->ProcInfo();
137 
138  if(proc.IsWeakNC()) {
139  //
140  // NC - includes both v+N, vbar+N
141  //
142  hq.insert(pair<int,bool>(kPdgDQuark, false));
143  hq.insert(pair<int,bool>(kPdgUQuark, false));
144  hq.insert(pair<int,bool>(kPdgDQuark, true ));
145  hq.insert(pair<int,bool>(kPdgUQuark, true ));
146  hq.insert(pair<int,bool>(kPdgSQuark, true ));
147  hq.insert(pair<int,bool>(kPdgCQuark, true ));
148  hq.insert(pair<int,bool>(kPdgBQuark, true ));
149  hq.insert(pair<int,bool>(kPdgAntiDQuark, true ));
150  hq.insert(pair<int,bool>(kPdgAntiUQuark, true ));
151  hq.insert(pair<int,bool>(kPdgAntiSQuark, true ));
152  hq.insert(pair<int,bool>(kPdgAntiCQuark, true ));
153  hq.insert(pair<int,bool>(kPdgAntiBQuark, true ));
154 
155  } else if (proc.IsWeakCC()) {
156  //
157  // CC - only I=-1/2 quarks for v+N & I=1/2 quarks for vbar+N
158  //
159  int ppdg = interaction->InitState().ProbePdg();
160 
161  if (pdg::IsNeutrino(ppdg)){
162  hq.insert(pair<int,bool>(kPdgDQuark, false));
163  hq.insert(pair<int,bool>(kPdgDQuark, true ));
164  hq.insert(pair<int,bool>(kPdgSQuark, true ));
165  hq.insert(pair<int,bool>(kPdgBQuark, true ));
166  hq.insert(pair<int,bool>(kPdgAntiUQuark, true ));
167  hq.insert(pair<int,bool>(kPdgAntiCQuark, true ));
168  }
169  else if (pdg::IsAntiNeutrino(ppdg)){
170  hq.insert(pair<int,bool>(kPdgUQuark, false));
171  hq.insert(pair<int,bool>(kPdgUQuark, true ));
172  hq.insert(pair<int,bool>(kPdgCQuark, true ));
173  hq.insert(pair<int,bool>(kPdgAntiDQuark, true ));
174  hq.insert(pair<int,bool>(kPdgAntiSQuark, true ));
175  hq.insert(pair<int,bool>(kPdgAntiBQuark, true ));
176  }
177  }//CC or NC
178 
179  return hq;
180 }
181 //____________________________________________________________________________
183  const Interaction * interaction) const
184 {
185 
186  const ProcessInfo & proc = interaction->ProcInfo();
187  int hitquark = interaction->InitState().Tgt().HitQrkPdg();
188 
189  vector<int> fq;
190  if(proc.IsWeakCC()) {
191  int abshq = TMath::Abs(hitquark);
192  int sign = hitquark/abshq;
193  if (abshq==kPdgUQuark || abshq==kPdgCQuark) {
194  fq.push_back(sign*kPdgDQuark);
195  fq.push_back(sign*kPdgSQuark);
196  fq.push_back(sign*kPdgBQuark);
197  }
198  else if (abshq==kPdgDQuark || abshq==kPdgSQuark || abshq==kPdgBQuark) {
199  fq.push_back(sign*kPdgUQuark);
200  fq.push_back(sign*kPdgCQuark);
201  fq.push_back(sign*kPdgTQuark);
202  }
203  }
204  else if (proc.IsWeakNC()) {
205  fq.push_back(hitquark);
206  }
207 
208  return fq;
209 }
210 //___________________________________________________________________________
212 {
213  Algorithm::Configure(config);
214  this->LoadConfigData();
215 }
216 //____________________________________________________________________________
218 {
219  Algorithm::Configure(config);
220  this->LoadConfigData();
221 }
222 //____________________________________________________________________________
224 {
225 
226  GetParamDef("is-CC", fIsCC, false ) ;
227  GetParamDef("is-NC", fIsNC, false ) ;
228 
229 }
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 kPdgBQuark
Definition: PDGCodes.h:50
int HitQrkPdg(void) const
Definition: Target.cxx:242
const int kPdgUQuark
Definition: PDGCodes.h:42
void SetHitQrkPdg(int pdgc)
Definition: Target.cxx:184
intermediate_table::const_iterator const_iterator
init
Definition: train.py:42
Contains minimal information for tagging exclusive processes.
Definition: XclsTag.h:39
const int kPdgSQuark
Definition: PDGCodes.h:46
InteractionList * CreateInteractionList(const InitialState &init) const
const int kPdgCQuark
Definition: PDGCodes.h:48
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
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
int ProbePdg(void) const
Definition: InitialState.h:64
vector< int > GetFinalQuarks(const Interaction *interaction) const
string AsString(void) const
const int kPdgDQuark
Definition: PDGCodes.h:44
const int kPdgTQuark
Definition: PDGCodes.h:52
#define pINFO
Definition: Messenger.h:62
InteractionList * CreateHEDISlist(vector< InitialState > vinit, vector< InteractionType_t > vinttype) const
#define pWARN
Definition: Messenger.h:60
multimap< int, bool > GetHitQuarks(const Interaction *interaction) const
const int kPdgAntiSQuark
Definition: PDGCodes.h:47
void SetExclTag(const XclsTag &xcls)
int sign(double val)
Definition: UtilFunc.cxx:104
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:65
void SetHitNucPdg(int pdgc)
Definition: Target.cxx:171
const int kPdgAntiCQuark
Definition: PDGCodes.h:49
Target * TgtPtr(void) const
Definition: InitialState.h:67
const int kPdgAntiBQuark
Definition: PDGCodes.h:51
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
std::string nucl(const std::string &A, const std::string &elem)
Definition: TruthText.cxx:114
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
void SetFinalQuark(int finalquark_pdgc=0)
Definition: XclsTag.cxx:138
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...
bool IsLepton(int pdgc)
Definition: PDGUtils.cxx:83
Initial State information.
Definition: InitialState.h:48