File indexing completed on 2024-09-27 07:03:41
0001 #include "pythiadecayer.h"
0002 #include "reportingUtils.h"
0003 #include "starlightconfig.h"
0004 using namespace Pythia8;
0005
0006
0007
0008 pythiaDecayer::pythiaDecayer() :
0009 _pythia(PYTHIA8_SETTINGS_DIR)
0010 {}
0011 pythiaDecayer::~pythiaDecayer()
0012 {}
0013 void pythiaDecayer::init()
0014 {
0015 _pythia.readString("ProcessLevel:all = off");
0016
0017 _pythia.readString("Next:numberShowEvent = 0");
0018 _pythia.init();
0019 _pythia.event.reset();
0020 }
0021
0022 void pythiaDecayer::addParticle(const starlightParticle &p)
0023 {
0024
0025 Event &pyEvent = _pythia.event;
0026 int status = 23;
0027 int col = 0;
0028 int acol = 0;
0029 int code = p.getPdgCode();
0030
0031 pyEvent.append(code, status, col, acol, p.GetPx(), p.GetPy(), p.GetPz(), p.GetE(), p.M());
0032
0033 }
0034
0035 eXEvent pythiaDecayer::execute()
0036 {
0037 eXEvent slEvent;
0038
0039 Event &pyEvent = _pythia.event;
0040 _pythia.forceTimeShower(1, 2, 100000.0);
0041 if(!_pythia.next())
0042 {
0043 printWarn << "Pythia::next() failed" << std::endl;
0044 return eXEvent();
0045 }
0046
0047 for(int i = 0; i < pyEvent.size(); ++i)
0048 {
0049
0050 Particle p = pyEvent[i];
0051 starlightParticle slPart(p.px(), p.py(), p.pz(), p.e(), p.m(), p.idAbs()*(p.charge()<0?-1:1), p.charge(),
0052 p.xProd(), p.yProd(), p.zProd(), p.tProd(),
0053 p.mother1(), p.mother2(), p.daughter1(), p.daughter2(), p.status());
0054 slEvent.addParticle(slPart);
0055 }
0056 pyEvent.clear();
0057 pyEvent.reset();
0058 return slEvent;
0059
0060 }