11 #include "Pythia8/Pythia.h"
13 using namespace Pythia8;
25 pdtPtr = pdtPtrIn; rndmPtr = rndmPtrIn;}
28 bool decay(vector<int>& idProd, vector<double>& mProd,
29 vector<Vec4>& pProd,
int iDec,
const Event& event);
49 bool JpsiDecay::decay(vector<int>& idProd, vector<double>& mProd,
50 vector<Vec4>& pProd,
int iDec,
const Event& event) {
53 idProd.push_back(-13);
57 double mMuon = pdtPtr->m0(13);
58 mProd.push_back(mMuon);
59 mProd.push_back(mMuon);
62 double eMuon = 0.5 * mProd[0];
63 double pAbsMuon = sqrt(eMuon * eMuon - mMuon * mMuon);
66 double cosTheta = 2. * rndmPtr->flat() - 1.;
67 double sinTheta = sqrt(max(0., 1. - cosTheta * cosTheta));
68 double phi = 2. * M_PI * rndmPtr->flat();
69 double pxMuon = pAbsMuon * sinTheta * cos(phi);
70 double pyMuon = pAbsMuon * sinTheta * sin(phi);
71 double pzMuon = pAbsMuon * cosTheta;
74 Vec4 pMuPlus( pxMuon, pyMuon, pzMuon, eMuon);
75 Vec4 pMuMinus( -pxMuon, -pyMuon, -pzMuon, eMuon);
78 pMuPlus.bst(pProd[0]);
79 pMuMinus.bst(pProd[0]);
80 pProd.push_back(pMuPlus);
81 pProd.push_back(pMuMinus);
85 int iMother =
event[iDec].mother1();
86 int idMother =
event[iMother].id();
87 cout <<
"\n J/psi decay performed, J/psi in line " << iDec
88 <<
", mother id = " << idMother <<
"\n";
109 pythia.readString(
"Charmonium:all = on");
110 pythia.readString(
"Beams:eCM = 7000.");
113 pythia.readString(
"PhaseSpace:pTHatMin = 0.5");
114 pythia.readString(
"PhaseSpace:pTHatMinDiverge = 0.5");
125 pythia.setUserHooksPtr( oniumUserHook);
132 vector<int> handledParticles;
133 handledParticles.push_back(443);
136 pythia.setDecayPtr( handleDecays, handledParticles);
139 pythia.readString(
"Next:numberShowInfo = 0");
140 pythia.readString(
"Next:numberShowProcess = 0");
141 pythia.readString(
"Next:numberShowEvent = 0");
147 Hist pThard(
"pTHat of hard subprocess", 100, 0., 50.);
148 Hist pTJPsi(
"pT of J/Psi", 100, 0., 50.);
153 for (
int iEvent = 0; iEvent < nEvent; ++iEvent) {
156 if (!pythia.next()) {
157 if (++iAbort < nAbort)
continue;
158 cout <<
" Event generation aborted prematurely, owing to error!\n";
163 double pTHat = pythia.info.pTHat();
164 pThard.fill( pTHat );
167 bool externalDecay =
false;
168 for (
int i = 0; i < pythia.event.size(); ++i) {
169 int status = pythia.event[i].statusAbs();
170 if (status == 93 || status == 94) {externalDecay =
true;
break;}
174 if (externalDecay && ++iList <= nList) {
175 pythia.process.list();
180 for (
int i = 0; i < pythia.event.size(); ++i)
181 if (pythia.event[i].id() == 443) pTJPsi.fill( pythia.event[i].pT() );
188 cout << pThard << pTJPsi;
192 delete oniumUserHook;