GENIEGenerator
Loading...
Searching...
No Matches
AGCharmPythia6Hadro2023.cxx
Go to the documentation of this file.
1//____________________________________________________________________________
2/*
3 Copyright (c) 2003-2025, The GENIE Collaboration
4 For the full text of the license visit http://copyright.genie-mc.org
5
6 Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
7 University of Liverpool & STFC Rutherford Appleton Laboratory
8
9 Changes required to implement the GENIE Boosted Dark Matter module
10 were installed by Josh Berger (Univ. of Wisconsin)
11*/
12//____________________________________________________________________________
13
14#include <RVersion.h>
15#include <TVector3.h>
16#include <TF1.h>
17#include <TROOT.h>
18
39
40#ifdef __GENIE_PYTHIA6_ENABLED__
41 #if ROOT_VERSION_CODE >= ROOT_VERSION(5,15,6)
42 #include <TMCParticle.h>
43 #else
44 #include <TMCParticle6.h>
45 #endif
46
47 #include <TPythia6.h>
48#endif
49
50using namespace genie;
51using namespace genie::constants;
52using namespace genie::controls;
53
54#ifdef __GENIE_PYTHIA6_ENABLED__
55extern "C" void py2ent_(int *, int *, int *, double *);
56#endif
57
58//____________________________________________________________________________
60AGCharmPythiaBaseHadro2023("genie::AGCharmPythia6Hadro2023")
61{
62 this->Initialize();
63}
64//____________________________________________________________________________
66AGCharmPythiaBaseHadro2023("genie::AGCharmPythia6Hadro2023", config)
67{
68 this->Initialize();
69}
70//____________________________________________________________________________
75//____________________________________________________________________________
77{
79#ifdef __GENIE_PYTHIA6_ENABLED__
80 fPythia = TPythia6::Instance();
81 // sync GENIE/PyTHIA6 seed number
82 // PYTHIA6 is a singleton, so do this from RandomGen for all
83 // GENIE algorithms that use PYTHIA6
85#else
86 LOG("AGCharmPythia6Hadro2023", pFATAL)
87 << "calling GENIE/PYTHIA6 charm hadronization without enabling PYTHIA6";
88 gAbortingInErr = true;
89 std::exit(1);
90#endif
91
92}
93//____________________________________________________________________________
94
95bool AGCharmPythia6Hadro2023::HadronizeRemnant (int qrkSyst1, int qrkSyst2,
96 double WR, TLorentzVector p4R,
97 unsigned int& rpos, TClonesArray * particle_list) const
98{
99#ifdef __GENIE_PYTHIA6_ENABLED__
100
101 //
102 // Run PYTHIA for the hadronization of remnant system
103 //
104 fPythia->SetMDCY(fPythia->Pycomp(kPdgPi0), 1,0); // don't decay pi0
105 fPythia->SetMDCY(fPythia->Pycomp(kPdgP33m1232_DeltaM), 1,1); // decay Delta+
106 fPythia->SetMDCY(fPythia->Pycomp(kPdgP33m1232_Delta0), 1,1); // decay Delta++
107 fPythia->SetMDCY(fPythia->Pycomp(kPdgP33m1232_DeltaP), 1,1); // decay Delta++
108 fPythia->SetMDCY(fPythia->Pycomp(kPdgP33m1232_DeltaPP), 1,1); // decay Delta++
109 // fPythia->SetMDCY(fPythia->Pycomp(kPdgDeltaP), 1,1); // decay Delta+
110 // fPythia->SetMDCY(fPythia->Pycomp(kPdgDeltaPP), 1,1); // decay Delta++
111 int ip = 0;
112 py2ent_(&ip, &qrkSyst1, &qrkSyst2, &WR); // hadronize
113
114 fPythia->SetMDCY(fPythia->Pycomp(kPdgPi0),1,1); // restore
115
116 //-- Get PYTHIA's LUJETS event record
117 TClonesArray * pythia_remnants = 0;
118 fPythia->GetPrimaries();
119 pythia_remnants = dynamic_cast<TClonesArray *>(fPythia->ImportParticles("All"));
120
121 int np = pythia_remnants->GetEntries();
122 assert(np>0);
123
124 // PYTHIA performs the hadronization at the *remnant hadrons* centre of mass
125 // frame (not the hadronic centre of mass frame).
126 // Boost all hadronic blob fragments to the HCM', fix their mother/daughter
127 // assignments and add them to the fragmentation record.
128
129 TVector3 rmnbeta = +1 * p4R.BoostVector(); // boost velocity
130
131 TMCParticle * pythia_remn = 0; // remnant
132 GHepParticle * bremn = 0; // boosted remnant
133 TIter remn_iter(pythia_remnants);
134 while( (pythia_remn = (TMCParticle *) remn_iter.Next()) ) {
135
136 // insert and get a pointer to inserted object for mods
137 bremn = new ((*particle_list)[rpos++]) GHepParticle ( pythia_remn->GetKF(), // pdg
138 GHepStatus_t(pythia_remn->GetKS()), // status
139 pythia_remn->GetParent(), // first parent
140 -1, // second parent
141 pythia_remn->GetFirstChild(), // first daughter
142 pythia_remn->GetLastChild(), // second daughter
143 pythia_remn -> GetPx(), // px
144 pythia_remn -> GetPy(), // py
145 pythia_remn -> GetPz(), // pz
146 pythia_remn -> GetEnergy(), // e
147 pythia_remn->GetVx(), // x
148 pythia_remn->GetVy(), // y
149 pythia_remn->GetVz(), // z
150 pythia_remn->GetTime() // t
151 );
152
153 // boost
154 bremn -> P4() -> Boost( rmnbeta ) ;
155
156 // handle insertion of charmed hadron
157 int jp = bremn->FirstMother();
158 int ifc = bremn->FirstDaughter();
159 int ilc = bremn->LastDaughter();
160
161 bremn -> SetFirstMother( (jp == 0 ? 1 : jp +1) );
162 bremn -> SetFirstDaughter ( (ifc == 0 ? -1 : ifc+1) );
163 bremn -> SetLastDaughter ( (ilc == 0 ? -1 : ilc+1) );
164 }
165 return true;
166#else
167 LOG("AGCharmPythia6Hadro2023", pFATAL)
168 << "calling GENIE/PYTHIA6 charm hadronization without enabling PYTHIA6"
169 << " qrkSyst " << qrkSyst1 << "," << qrkSyst2 << " WR " << WR;
170 gAbortingInErr = true;
171 std::exit(1);
172 return false;
173#endif
174
175
176}
177
178//____________________________________________________________________________
#define pFATAL
Definition Messenger.h:56
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
Most commonly used PDG codes. A set of utility functions to handle PDG codes is provided in PDGUtils.
void py2ent_(int *, int *, int *, double *)
bool HadronizeRemnant(int qrkSyst1, int qrkSyst2, double WR, TLorentzVector p4R, unsigned int &rpos, TClonesArray *particle_list) const
STDHEP-like event record entry that can fit a particle or a nucleus.
int FirstMother(void) const
int LastDaughter(void) const
int FirstDaughter(void) const
static RandomGen * Instance()
Access instance.
Definition RandomGen.cxx:74
Basic constants.
Misc GENIE control constants.
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25
bool gAbortingInErr
Definition Messenger.cxx:34
const int kPdgP33m1232_Delta0
Definition PDGCodes.h:105
const int kPdgPi0
Definition PDGCodes.h:160
const int kPdgP33m1232_DeltaPP
Definition PDGCodes.h:107
enum genie::EGHepStatus GHepStatus_t
const int kPdgP33m1232_DeltaM
Definition PDGCodes.h:104
const int kPdgP33m1232_DeltaP
Definition PDGCodes.h:106