HadronizationModelBase.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
9 
10  Changes required to implement the GENIE Boosted Dark Matter module
11  were installed by Josh Berger (Univ. of Wisconsin)
12 */
13 //____________________________________________________________________________
14 
15 #include <cstdlib>
16 
17 #include <TLorentzVector.h>
18 #include <TH1D.h>
19 #include <TMath.h>
20 
27 
28 using namespace genie;
29 using namespace genie::constants;
30 
31 //____________________________________________________________________________
34 {
35 
36 }
37 //____________________________________________________________________________
40 {
41 
42 }
43 //____________________________________________________________________________
45 HadronizationModelI(name, config)
46 {
47 
48 }
49 //____________________________________________________________________________
51 {
52 
53 }
54 //____________________________________________________________________________
55 double HadronizationModelBase::Wmin(void) const
56 {
57  return (kNucleonMass+kPionMass);
58 }
59 //____________________________________________________________________________
61 {
62  double W = interaction->Kine().W();
63 
64  double maxmult = TMath::Floor(1 + (W-kNeutronMass)/kPionMass);
65  return maxmult;
66 }
67 //____________________________________________________________________________
68 TH1D * HadronizationModelBase::CreateMultProbHist(double maxmult) const
69 {
70  double minmult = 2;
71  int nbins = TMath::Nint(maxmult-minmult+1);
72 
73  TH1D * mult_prob = new TH1D("mult_prob",
74  "hadronic multiplicity distribution", nbins, minmult-0.5, maxmult+0.5);
75  mult_prob->SetDirectory(0);
76 
77  return mult_prob;
78 }
79 //____________________________________________________________________________
81  const Interaction * interaction, bool norm, TH1D * mp) const
82 {
83 // Apply the NEUGEN multiplicity probability scaling factors
84 //
85  if(!mp) return;
86 
87  const InitialState & init_state = interaction->InitState();
88  int probe_pdg = init_state.ProbePdg();
89  int nuc_pdg = init_state.Tgt().HitNucPdg();
90 
91  const ProcessInfo & proc_info = interaction->ProcInfo();
92  bool is_CC = proc_info.IsWeakCC();
93  bool is_NC = proc_info.IsWeakNC();
94  bool is_EM = proc_info.IsEM();
95  // EDIT
96  bool is_dm = proc_info.IsDarkMatter();
97 
98  //
99  // get the R2, R3 factors
100  //
101 
102  double R2=1., R3=1.;
103 
104  // weak CC or NC case
105  // EDIT
106  if(is_CC || is_NC || is_dm) {
107  bool is_nu = pdg::IsNeutrino (probe_pdg);
108  bool is_nubar = pdg::IsAntiNeutrino (probe_pdg);
109  bool is_p = pdg::IsProton (nuc_pdg);
110  bool is_n = pdg::IsNeutron (nuc_pdg);
111  bool is_dmi = pdg::IsDarkMatter (probe_pdg); // EDIT
112  if((is_nu && is_p) || (is_dmi && is_p)) {
113  R2 = (is_CC) ? fRvpCCm2 : fRvpNCm2;
114  R3 = (is_CC) ? fRvpCCm3 : fRvpNCm3;
115  } else
116  if((is_nu && is_n) || (is_dmi && is_n)) {
117  R2 = (is_CC) ? fRvnCCm2 : fRvnNCm2;
118  R3 = (is_CC) ? fRvnCCm3 : fRvnNCm3;
119  } else
120  if(is_nubar && is_p) {
121  R2 = (is_CC) ? fRvbpCCm2 : fRvbpNCm2;
122  R3 = (is_CC) ? fRvbpCCm3 : fRvbpNCm3;
123  } else
124  if(is_nubar && is_n) {
125  R2 = (is_CC) ? fRvbnCCm2 : fRvbnNCm2;
126  R3 = (is_CC) ? fRvbnCCm3 : fRvbnNCm3;
127  } else {
128  LOG("BaseHad", pERROR)
129  << "Invalid initial state: " << init_state;
130  }
131  }//cc||nc?
132 
133  // EM case (apply the NC tuning factors)
134 
135  if(is_EM) {
136  bool is_l = pdg::IsNegChargedLepton (probe_pdg);
137  bool is_lbar = pdg::IsPosChargedLepton (probe_pdg);
138  bool is_p = pdg::IsProton (nuc_pdg);
139  bool is_n = pdg::IsNeutron (nuc_pdg);
140  if(is_l && is_p) {
141  R2 = fRvpNCm2;
142  R3 = fRvpNCm3;
143  } else
144  if(is_l && is_n) {
145  R2 = fRvnNCm2;
146  R3 = fRvnNCm3;
147  } else
148  if(is_lbar && is_p) {
149  R2 = fRvbpNCm2;
150  R3 = fRvbpNCm3;
151  } else
152  if(is_lbar && is_n) {
153  R2 = fRvbnNCm2;
154  R3 = fRvbnNCm3;
155  } else {
156  LOG("BaseHad", pERROR)
157  << "Invalid initial state: " << init_state;
158  }
159  }//em?
160 
161  //
162  // Apply to the multiplicity probability distribution
163  //
164 
165  int nbins = mp->GetNbinsX();
166  for(int i = 1; i <= nbins; i++) {
167  int n = TMath::Nint( mp->GetBinCenter(i) );
168 
169  double R=1;
170  if (n==2) R=R2;
171  else if (n==3) R=R3;
172 
173  if(n==2 || n==3) {
174  double P = mp->GetBinContent(i);
175  double Psc = R*P;
176  LOG("BaseHad", pDEBUG)
177  << "n=" << n << "/ Scaling factor R = "
178  << R << "/ P " << P << " --> " << Psc;
179  mp->SetBinContent(i, Psc);
180  }
181  if(n>3) break;
182  }
183 
184  // renormalize the histogram?
185  if(norm) {
186  double histo_norm = mp->Integral("width");
187  if(histo_norm>0) mp->Scale(1.0/histo_norm);
188  }
189 }
190 //____________________________________________________________________________
static QCString name
Definition: declinfo.cpp:673
double fRvnCCm3
neugen&#39;s Rijk: vn, CC, multiplicity = 3
double W(bool selected=false) const
Definition: Kinematics.cxx:167
double fRvbpCCm3
neugen&#39;s Rijk: vbp, CC, multiplicity = 3
Basic constants.
bool IsWeakCC(void) const
bool IsNeutrino(int pdgc)
Definition: PDGUtils.cxx:108
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:26
#define pERROR
Definition: Messenger.h:60
static const double kNucleonMass
Definition: Constants.h:78
double MaxMult(const Interaction *i) const
int HitNucPdg(void) const
Definition: Target.cxx:321
double fRvnNCm2
neugen&#39;s Rijk: vn, NC, multiplicity = 2
double fRvbpCCm2
neugen&#39;s Rijk: vbp, CC, multiplicity = 2
double fRvpCCm2
neugen&#39;s Rijk: vp, CC, multiplicity = 2
bool IsDarkMatter(int pdgc)
Definition: PDGUtils.cxx:125
double fRvbnNCm3
neugen&#39;s Rijk: vbn, NC, multiplicity = 3
double fRvpNCm2
neugen&#39;s Rijk: vp, NC, multiplicity = 2
TH1D * CreateMultProbHist(double maxmult) const
bool IsNeutron(int pdgc)
Definition: PDGUtils.cxx:304
bool IsPosChargedLepton(int pdgc)
Definition: PDGUtils.cxx:140
Summary information for an interaction.
Definition: Interaction.h:55
bool IsProton(int pdgc)
Definition: PDGUtils.cxx:299
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:97
double fRvpNCm3
neugen&#39;s Rijk: vp, NC, multiplicity = 3
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:43
bool IsAntiNeutrino(int pdgc)
Definition: PDGUtils.cxx:116
const Kinematics & Kine(void) const
Definition: Interaction.h:70
int ProbePdg(void) const
Definition: InitialState.h:65
static const double kNeutronMass
Definition: Constants.h:77
double fRvbnNCm2
neugen&#39;s Rijk: vbn, NC, multiplicity = 2
double fRvpCCm3
neugen&#39;s Rijk: vp, CC, multiplicity = 3
double fRvbpNCm2
neugen&#39;s Rijk: vbp, NC, multiplicity = 2
auto norm(Vector const &v)
Return norm of the specified vector.
bool IsEM(void) const
double fRvnNCm3
neugen&#39;s Rijk: vn, NC, multiplicity = 3
void ApplyRijk(const Interaction *i, bool norm, TH1D *mp) const
static const double kPionMass
Definition: Constants.h:74
double Wmin(void) const
Various utility methods common to hadronization models.
bool IsDarkMatter(void) const
Pure abstract base class. Defines the HadronizationModelI interface to be implemented by any algorith...
const InitialState & InitState(void) const
Definition: Interaction.h:68
const ProcessInfo & ProcInfo(void) const
Definition: Interaction.h:69
double fRvbnCCm3
neugen&#39;s Rijk: vbn, CC, multiplicity = 3
const Target & Tgt(void) const
Definition: InitialState.h:67
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils...
bool IsNegChargedLepton(int pdgc)
Definition: PDGUtils.cxx:131
double fRvbpNCm3
neugen&#39;s Rijk: vbp, NC, multiplicity = 3
double fRvnCCm2
neugen&#39;s Rijk: vn, CC, multiplicity = 2
Initial State information.
Definition: InitialState.h:49
#define pDEBUG
Definition: Messenger.h:64
double fRvbnCCm2
neugen&#39;s Rijk: vbn, CC, multiplicity = 2