178 LOG(
"CharmHad",
pNOTICE) <<
"** Running CHARM hadronizer";
186 const InitialState & init_state = interaction -> InitState();
187 const Kinematics & kinematics = interaction -> Kine();
190 const TLorentzVector & p4Had = kinematics.
HadSystP4();
193 double W = kinematics.
W(
true);
195 TVector3 beta = -1 * p4Had.BoostVector();
196 TLorentzVector p4H(0,0,0,W);
198 double Eh = p4Had.Energy();
200 LOG(
"CharmHad",
pNOTICE) <<
"Ehad (LAB) = " << Eh <<
", W = " <<
W;
216 TLorentzVector p4C(0,0,0,0);
219 bool got_charmed_hadron =
false;
226 double mc = pdglib->
Find(pdg)->Mass();
229 <<
"Trying charm hadron = " << pdg <<
"(m = " << mc <<
")";
237 double mc2 = TMath::Power(mc,2);
238 double Ec2 = TMath::Power(Ec,2);
239 double pc2 = Ec2-mc2;
242 <<
"Trying charm hadron z = " << z <<
", E = " << Ec;
249 double plc2 = Ec2 - ptc2 - mc2;
251 <<
"Trying charm hadron pT^2 (tranv to pHad) = " << ptc2;
255 double ptc = TMath::Sqrt(ptc2);
256 double plc = TMath::Sqrt(plc2);
258 double pxc = ptc * TMath::Cos(phi);
259 double pyc = ptc * TMath::Sin(phi);
262 p4C.SetPxPyPzE(pxc,pyc,pzc,Ec);
275 TLorentzVector p4 = p4H - p4C;
278 <<
"Invariant mass of remnant hadronic system= " << wr;
280 LOG(
"CharmHad",
pINFO) <<
"Too small hadronic remnant mass!";
285 got_charmed_hadron =
true;
288 <<
"Generated charm hadron = " << pdg <<
"(m = " << mc <<
")";
290 <<
"Generated charm hadron z = " << z <<
", E = " << Ec;
301 bool used_lowW_strategy =
false;
302 int fs_nucleon_pdg = -1;
303 if(ch_pdg==-1 && W < 3.){
305 <<
"Had difficulty generating charm hadronic system near W threshold";
307 <<
"Trying an alternative strategy";
309 double qfsl = interaction->
FSPrimLepton()->Charge() / 3.;
310 double qinit = pdglib->
Find(nuc_pdg)->Charge() / 3.;
311 int qhad = (
int) (qinit - qfsl);
320 }
else if(qhad == 1) {
326 }
else if(qhad == 0) {
328 }
else if(qhad == -1) {
332 double mc = pdglib->
Find(chrm_pdg)->Mass();
333 double mn = pdglib->
Find(remn_pdg)->Mass();
337 double mass[2] = {mc, mn};
343 for(
int i=0; i<200; i++) {
345 wmax = TMath::Max(wmax,w);
352 bool accept_decay=
false;
353 unsigned int idecay_try=0;
360 <<
"Couldn't generate an unweighted phase space decay after " 361 << idecay_try <<
" attempts";
366 <<
"Decay weight = " << w <<
" > max decay weight = " << wmax;
368 double gw = wmax * rnd->
RndHadro().Rndm();
369 accept_decay = (gw<=
w);
372 used_lowW_strategy =
true;
376 fs_nucleon_pdg = remn_pdg;
390 <<
"Couldn't generate charm hadron for: " << *
interaction;
394 TLorentzVector p4R = p4H - p4C;
398 LOG(
"CharmHad",
pNOTICE) <<
"Remnant hadronic system mass = " << WR;
406 TClonesArray * particle_list =
new TClonesArray(
"genie::GHepParticle", 2);
407 particle_list->SetOwner(
true);
411 -1,-1,-1,-1, p4C.Px(),p4C.Py(),p4C.Pz(),p4C.E(), 0,0,0,0);
413 -1,-1,-1,-1, p4R.Px(),p4R.Py(),p4R.Pz(),p4R.E(), 0,0,0,0);
415 return particle_list;
423 if(used_lowW_strategy) {
425 TClonesArray * particle_list =
new TClonesArray(
"genie::GHepParticle", 3);
426 particle_list->SetOwner(
true);
430 -1,-1,-1,-1, p4C.Px(),p4C.Py(),p4C.Pz(),p4C.E(), 0,0,0,0);
432 -1,-1,2,2, p4R.Px(),p4R.Py(),p4R.Pz(),p4R.E(), 0,0,0,0);
434 1,1,-1,-1, p4R.Px(),p4R.Py(),p4R.Pz(),p4R.E(), 0,0,0,0);
436 return particle_list;
449 TClonesArray * particle_list =
new TClonesArray(
"genie::GHepParticle");
450 particle_list->SetOwner(
true);
453 -1,-1,-1,-1, p4C.Px(),p4C.Py(),p4C.Pz(),p4C.E(), 0,0,0,0);
455 -1,-1,2,3, p4R.Px(),p4R.Py(),p4R.Pz(),p4R.E(), 0,0,0,0);
457 unsigned int rpos =2;
459 bool use_pythia = (WR>1.5);
567 if(qrkSyst1 == 0 && qrkSyst2 == 0) {
569 <<
"Couldn't generate quark systems for PYTHIA in: " << *
interaction;
585 py2ent_(&ip, &qrkSyst1, &qrkSyst2, &WR);
590 TClonesArray * pythia_remnants = 0;
592 pythia_remnants =
dynamic_cast<TClonesArray *
>(
fPythia->ImportParticles(
"All"));
593 if(!pythia_remnants) {
594 LOG(
"CharmHad",
pWARN) <<
"Couldn't hadronize (non-charm) remnants!";
598 int np = pythia_remnants->GetEntries();
606 TVector3 rmnbeta = +1 * p4R.BoostVector();
608 TMCParticle * pythia_remn = 0;
610 TIter remn_iter(pythia_remnants);
611 while( (pythia_remn = (TMCParticle *) remn_iter.Next()) ) {
614 bremn =
new ((*particle_list)[rpos++])
GHepParticle ( pythia_remn->GetKF(),
616 pythia_remn->GetParent(),
618 pythia_remn->GetFirstChild(),
619 pythia_remn->GetLastChild(),
620 pythia_remn -> GetPx(),
621 pythia_remn -> GetPy(),
622 pythia_remn -> GetPz(),
623 pythia_remn -> GetEnergy(),
624 pythia_remn->GetVx(),
625 pythia_remn->GetVy(),
626 pythia_remn->GetVz(),
627 pythia_remn->GetTime()
631 bremn -> P4() -> Boost( rmnbeta ) ;
638 bremn -> SetFirstMother( (jp == 0 ? 1 : jp +1) );
639 bremn -> SetFirstDaughter ( (ifc == 0 ? -1 : ifc+1) );
640 bremn -> SetLastDaughter ( (ilc == 0 ? -1 : ilc+1) );
660 double qfsl = interaction->
FSPrimLepton()->Charge() / 3.;
661 double qinit = pdglib->
Find(nuc_pdg)->Charge() / 3.;
662 double qch = pdglib->
Find(ch_pdg)->Charge() / 3.;
663 int Q = (
int) (qinit - qfsl - qch);
685 pdglib->
Find(pd[0])->Mass(), pdglib->
Find(pd[1])->Mass()
691 LOG(
"CharmHad",
pERROR) <<
" *** Phase space decay is not permitted";
696 for(
int i=0; i<200; i++) {
698 wmax = TMath::Max(wmax,w);
701 LOG(
"CharmHad",
pERROR) <<
" *** Non-positive maximum weight";
702 LOG(
"CharmHad",
pERROR) <<
" *** Can not generate an unweighted phase space decay";
707 <<
"Max phase space gen. weight @ current hadronic system: " << wmax;
711 bool accept_decay=
false;
712 unsigned int idectry=0;
719 <<
"Couldn't generate an unweighted phase space decay after " 720 << itry <<
" attempts";
726 <<
"Decay weight = " << w <<
" > max decay weight = " << wmax;
728 double gw = wmax * rnd->
RndHadro().Rndm();
729 accept_decay = (gw<=
w);
731 <<
"Decay weight = " << w <<
" / R = " << gw <<
" - accepted: " << accept_decay;
733 for(
unsigned int i=0; i<2; i++) {
737 pdgc,
kIStStableFinalState,1,1,-1,-1,p4d->Px(),p4d->Py(),p4d->Pz(),p4d->Energy(),
744 return particle_list;
const int kPdgP33m1232_DeltaPP
const int kPdgUUDiquarkS1
double W(bool selected=false) const
TPythia6 * fPythia
remnant (non-charm) hadronizer
bool IsNeutrino(int pdgc)
static const double kNucleonMass
static RandomGen * Instance()
Access instance.
int HitNucPdg(void) const
virtual double GenerateZ(void) const =0
int FirstDaughter(void) const
const int kPdgHadronicBlob
enum genie::EGHepStatus GHepStatus_t
Generated/set kinematical variables for an event.
string P4AsString(const TLorentzVector *p)
static const unsigned int kMaxUnweightDecayIterations
bool IsDarkMatter(int pdgc)
const TLorentzVector & HadSystP4(void) const
A singleton holding random number generator classes. All random number generation in GENIE should tak...
void py2ent_(int *, int *, int *, double *)
const int kPdgP33m1232_DeltaP
const int kPdgP33m1232_DeltaM
int FirstMother(void) const
int LastDaughter(void) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
const int kPdgUDDiquarkS1
bool IsAntiNeutrino(int pdgc)
A Neutrino Interaction Target. Is a transparent encapsulation of quite different physical systems suc...
const FragmentationFunctionI * fFragmFunc
charm hadron fragmentation func
static const double kASmallNum
const int kPdgUDDiquarkS0
const int kPdgP33m1232_Delta0
bool fCharmOnly
don't hadronize non-charm blob
TParticlePDG * FSPrimLepton(void) const
final state primary lepton
TRandom3 & RndHadro(void) const
rnd number generator used by hadronization models
static PDGLibrary * Instance(void)
static const double kPionMass
Singleton class to load & serve a TDatabasePDG.
int GenerateCharmHadron(int nupdg, double EvLab) const
TParticlePDG * Find(int pdgc)
const Target & Tgt(void) const
static const unsigned int kRjMaxIterations
double ProbeE(RefFrame_t rf) const
STDHEP-like event record entry that can fit a particle or a nucleus.
TF1 * fCharmPT2pdf
charm hadron pT^2 pdf
TGenPhaseSpace fPhaseSpaceGenerator
a phase space generator
Initial State information.
const int kPdgDDDiquarkS1