9 #include "Pythia8/Event.h"
24 const double Particle::TINY = 1e-20;
30 void Particle::setPDEPtr(ParticleDataEntry* pdePtrIn) {
31 pdePtr = pdePtrIn;
if (pdePtrIn != 0 || evtPtr == 0)
return;
32 pdePtr = (*evtPtr).particleDataPtr->particleDataEntryPtr( idSave);}
38 double Particle::y()
const {
39 double temp = log( ( pSave.e() + abs(pSave.pz()) ) / max( TINY, mT() ) );
40 return (pSave.pz() > 0) ? temp : -temp;
43 double Particle::eta()
const {
44 double temp = log( ( pSave.pAbs() + abs(pSave.pz()) ) / max( TINY, pT() ) );
45 return (pSave.pz() > 0) ? temp : -temp;
52 int Particle::index()
const {
if (evtPtr == 0)
return -1;
53 return (
long(
this) -
long(&((*evtPtr)[0]))) /
sizeof(Particle);
60 int Particle::statusHepMC()
const {
63 if (statusSave > 0)
return 1;
64 if (statusSave == -12)
return 4;
65 if (evtPtr == 0)
return 0;
68 if (isHadron() || abs(idSave) == 13 || abs(idSave) == 15) {
70 if ( (*evtPtr)[daughter1Save].
id() != idSave) {
71 int statusDau = (*evtPtr)[daughter1Save].statusAbs();
72 if (statusDau > 90 && statusDau < 95)
return 2;
77 if (statusSave <= -11 && statusSave >= -200)
return -statusSave;
88 int Particle::iTopCopy()
const {
90 if (evtPtr == 0)
return -1;
92 while ( iUp > 0 && (*evtPtr)[iUp].mother2() == (*evtPtr)[iUp].mother1()
93 && (*evtPtr)[iUp].mother1() > 0) iUp = (*evtPtr)[iUp].mother1();
98 int Particle::iBotCopy()
const {
100 if (evtPtr == 0)
return -1;
102 while ( iDn > 0 && (*evtPtr)[iDn].daughter2() == (*evtPtr)[iDn].daughter1()
103 && (*evtPtr)[iDn].daughter1() > 0) iDn = (*evtPtr)[iDn].daughter1();
114 int Particle::iTopCopyId()
const {
116 if (evtPtr == 0)
return -1;
119 int mother1up = (*evtPtr)[iUp].mother1();
120 int id1up = (mother1up > 0) ? (*evtPtr)[mother1up].id() : 0;
121 int mother2up = (*evtPtr)[iUp].mother2();
122 int id2up = (mother2up > 0) ? (*evtPtr)[mother2up].id() : 0;
123 if (mother2up != mother1up && id2up == id1up)
break;
124 if (id1up == idSave) {
128 if (id2up == idSave) {
138 int Particle::iBotCopyId()
const {
140 if (evtPtr == 0)
return -1;
143 int daughter1dn = (*evtPtr)[iDn].daughter1();
144 int id1dn = (daughter1dn > 0) ? (*evtPtr)[daughter1dn].id() : 0;
145 int daughter2dn = (*evtPtr)[iDn].daughter2();
146 int id2dn = (daughter2dn > 0) ? (*evtPtr)[daughter2dn].id() : 0;
147 if (daughter2dn != daughter1dn && id2dn == id1dn)
break;
148 if (id1dn == idSave) {
152 if (id2dn == idSave) {
166 vector<int> Particle::motherList()
const {
169 vector<int> motherVec;
170 if (evtPtr == 0)
return motherVec;
173 int statusSaveAbs = abs(statusSave);
174 if (statusSaveAbs == 11 || statusSaveAbs == 12) ;
175 else if (mother1Save == 0 && mother2Save == 0) motherVec.push_back(0);
178 else if (mother2Save == 0 || mother2Save == mother1Save)
179 motherVec.push_back(mother1Save);
182 else if ( (statusSaveAbs > 80 && statusSaveAbs < 90)
183 || (statusSaveAbs > 100 && statusSaveAbs < 107) )
184 for (
int iRange = mother1Save; iRange <= mother2Save; ++iRange)
185 motherVec.push_back(iRange);
189 motherVec.push_back( min(mother1Save, mother2Save) );
190 motherVec.push_back( max(mother1Save, mother2Save) );
202 vector<int> Particle::daughterList()
const {
205 vector<int> daughterVec;
206 if (evtPtr == 0)
return daughterVec;
209 if (daughter1Save == 0 && daughter2Save == 0) ;
210 else if (daughter2Save == 0 || daughter2Save == daughter1Save)
211 daughterVec.push_back(daughter1Save);
214 else if (daughter2Save > daughter1Save)
215 for (
int iRange = daughter1Save; iRange <= daughter2Save; ++iRange)
216 daughterVec.push_back(iRange);
220 daughterVec.push_back(daughter2Save);
221 daughterVec.push_back(daughter1Save);
226 if (abs(statusSave) == 12 || abs(statusSave) == 13) {
228 for (
int iDau = i + 1; iDau < evtPtr->size(); ++iDau)
229 if ((*evtPtr)[iDau].mother1() == i) {
231 for (
int iIn = 0; iIn < int(daughterVec.size()); ++iIn)
232 if (iDau == daughterVec[iIn]) isIn =
true;
233 if (!isIn) daughterVec.push_back(iDau);
247 vector<int> Particle::sisterList(
bool traceTopBot)
const {
250 vector<int> sisterVec;
251 if (evtPtr == 0 || abs(statusSave) == 11)
return sisterVec;
254 int iUp = (traceTopBot) ? iTopCopy() : index();
255 int iMother = (*evtPtr)[iUp].mother1();
256 vector<int> daughterVec = (*evtPtr)[iMother].daughterList();
259 for (
int j = 0; j < int(daughterVec.size()); ++j) {
260 int iDau = daughterVec[j];
262 int iDn = (traceTopBot) ? (*evtPtr)[iDau].iBotCopy() : iDau;
263 sisterVec.push_back( iDn);
278 bool Particle::isAncestor(
int iAncestor)
const {
281 if (evtPtr == 0)
return false;
283 int sizeNow = (*evtPtr).size();
287 if (iUp == iAncestor)
return true;
290 if (iUp <= 0 || iUp > sizeNow)
return false;
293 int mother1up = (*evtPtr)[iUp].mother1();
294 int mother2up = (*evtPtr)[iUp].mother2();
295 if (mother2up == mother1up || mother2up == 0) {iUp = mother1up;
continue;}
298 int statusUp = (*evtPtr)[iUp].statusAbs();
299 if (statusUp < 81 || statusUp > 86)
return false;
302 if (statusUp == 82) {
303 iUp = (iUp + 1 < sizeNow && (*evtPtr)[iUp + 1].mother1() == mother1up)
304 ? mother1up : mother2up;
continue;
306 if (statusUp == 83) {
307 if ((*evtPtr)[iUp - 1].mother1() == mother1up)
return false;
308 iUp = mother1up;
continue;
310 if (statusUp == 84) {
311 if (iUp + 1 < sizeNow && (*evtPtr)[iUp + 1].mother1() == mother1up)
313 iUp = mother1up;
continue;
331 bool Particle::undoDecay() {
334 if (evtPtr == 0)
return false;
336 if (i < 0 || i >=
int((*evtPtr).size()))
return false;
337 if (colSave != 0 || acolSave != 0)
return false;
340 int dau1 = daughter1Save;
341 if (dau1 == 0)
return false;
342 int dau2 = daughter2Save;
343 if (dau2 == 0) dau2 = dau1;
346 for (
int j = dau1; j <= dau2; ++j)
if ((*evtPtr)[j].mother1() != i
347 || ((*evtPtr)[j].mother2() != i && (*evtPtr)[j].mother2() != 0) )
351 vector<int> dauBeg, dauEnd;
352 dauBeg.push_back( dau1);
353 dauEnd.push_back( dau2);
358 for (
int j = dauBeg[iRange]; j <= dauEnd[iRange]; ++j)
359 if ((*evtPtr)[j].status() < 0) {
362 dau1 = (*evtPtr)[j].daughter1();
363 if (dau1 == 0)
return false;
364 dau2 = (*evtPtr)[j].daughter2();
365 if (dau2 == 0) dau2 = dau1;
369 for (
int iR = 0; iR < int(dauBeg.size()); ++iR) {
370 if (dau1 == dauBeg[iR] && dau2 == dauEnd[iR]) isNew =
false;
371 else if (dau1 >= dauBeg[iR] && dau1 <= dauEnd[iR])
return false;
372 else if (dau2 >= dauBeg[iR] && dau2 <= dauEnd[iR])
return false;
377 dauBeg.push_back( dau1);
378 dauEnd.push_back( dau2);
379 for (
int iR =
int(dauBeg.size()) - 1; iR > 0; --iR) {
380 if (dauBeg[iR] < dauBeg[iR - 1]) {
381 swap( dauBeg[iR], dauBeg[iR - 1]);
382 swap( dauEnd[iR], dauEnd[iR - 1]);
389 }
while (++iRange <
int(dauBeg.size()));
392 if (
int(dauBeg.size()) > 1) {
395 if (dauEnd[iRJ] + 1 == dauBeg[iRJ + 1]) {
396 for (
int iRB = iRJ + 1; iRB < int(dauBeg.size()) - 1; ++iRB)
397 dauBeg[iRB] = dauBeg[iRB + 1];
398 for (
int iRE = iRJ; iRE < int(dauEnd.size()) - 1; ++iRE)
399 dauEnd[iRE] = dauEnd[iRE + 1];
403 }
while (iRJ <
int(dauBeg.size()) - 1);
407 for (
int iR =
int(dauBeg.size()) - 1; iR >= 0; --iR) {
410 int nRem = dau2 - dau1 + 1;
413 (*evtPtr).remove( dau1, dau2);
416 for (
int j = 0; j < int((*evtPtr).size()); ++j) {
417 if ((*evtPtr)[j].mother1() > dau2)
418 (*evtPtr)[j].mother1( (*evtPtr)[j].mother1() - nRem );
419 if ((*evtPtr)[j].mother2() > dau2)
420 (*evtPtr)[j].mother2( (*evtPtr)[j].mother2() - nRem );
421 if ((*evtPtr)[j].daughter1() > dau2)
422 (*evtPtr)[j].daughter1( (*evtPtr)[j].daughter1() - nRem );
423 if ((*evtPtr)[j].daughter2() > dau2)
424 (*evtPtr)[j].daughter2( (*evtPtr)[j].daughter2() - nRem );
429 statusSave = abs(statusSave);
442 string Particle::nameWithStatus(
int maxLen)
const {
444 if (pdePtr == 0)
return " ";
445 string temp = (statusSave > 0) ? pdePtr->name(idSave)
446 :
"(" + pdePtr->name(idSave) +
")";
447 while (
int(temp.length()) > maxLen) {
449 int iRem = temp.find_last_not_of(
")+-0");
459 void Particle::offsetHistory(
int minMother,
int addMother,
int minDaughter,
462 if (addMother < 0 || addDaughter < 0)
return;
463 if ( mother1Save > minMother ) mother1Save += addMother;
464 if ( mother2Save > minMother ) mother2Save += addMother;
465 if (daughter1Save > minDaughter) daughter1Save += addDaughter;
466 if (daughter2Save > minDaughter) daughter2Save += addDaughter;
474 void Particle::offsetCol(
int addCol) {
476 if (addCol < 0)
return;
477 if ( colSave > 0) colSave += addCol;
478 if (acolSave > 0) acolSave += addCol;
487 double m(
const Particle& pp1,
const Particle& pp2) {
488 double m2 = pow2(pp1.e() + pp2.e()) - pow2(pp1.px() + pp2.px())
489 - pow2(pp1.py() + pp2.py()) - pow2(pp1.pz() + pp2.pz());
490 return (m2 > 0. ? sqrt(m2) : 0.);
493 double m2(
const Particle& pp1,
const Particle& pp2) {
494 double m2 = pow2(pp1.e() + pp2.e()) - pow2(pp1.px() + pp2.px())
495 - pow2(pp1.py() + pp2.py()) - pow2(pp1.pz() + pp2.pz());
510 const int Event::IPERLINE = 20;
516 Event& Event::operator=(
const Event& oldEvent) {
519 if (
this != &oldEvent) {
525 particleDataPtr = oldEvent.particleDataPtr;
529 for (
int i = 0; i < oldEvent.size(); ++i) append( oldEvent[i] );
532 for (
int i = 0; i < oldEvent.sizeJunction(); ++i)
533 appendJunction( oldEvent.getJunction(i) );
536 startColTag = oldEvent.startColTag;
537 maxColTag = oldEvent.maxColTag;
538 savedSize = oldEvent.savedSize;
539 savedJunctionSize = oldEvent.savedJunctionSize;
540 scaleSave = oldEvent.scaleSave;
541 scaleSecondSave = oldEvent.scaleSecondSave;
542 headerList = oldEvent.headerList;
558 int Event::copy(
int iCopy,
int newStatus) {
562 if (iCopy < 0 || iCopy >= size())
return -1;
565 entry.push_back(entry[iCopy]);
566 int iNew = entry.size() - 1;
570 entry[iCopy].daughters(iNew,iNew);
571 entry[iCopy].statusNeg();
572 entry[iNew].mothers(iCopy, iCopy);
573 entry[iNew].status(newStatus);
576 }
else if (newStatus < 0) {
577 entry[iCopy].mothers(iNew,iNew);
578 entry[iNew].daughters(iCopy, iCopy);
579 entry[iNew].status(newStatus);
592 void Event::list()
const {
593 list(
false,
false, cout);
596 void Event::list(ostream& os)
const {
597 list(
false,
false, os);
600 void Event::list(
bool showScaleAndVertex,
bool showMothersAndDaughters)
602 list(showScaleAndVertex, showMothersAndDaughters, cout);
609 void Event::list(
bool showScaleAndVertex,
bool showMothersAndDaughters,
613 os <<
"\n -------- PYTHIA Event Listing " << headerList <<
"----------"
614 <<
"-------------------------------------------------\n \n no "
615 <<
" id name status mothers daughters colou"
616 <<
"rs p_x p_y p_z e m \n";
617 if (showScaleAndVertex)
619 <<
" xProd yProd zProd tProd "
623 bool useFixed = (entry.empty() || entry[0].e() < 1e5);
627 double chargeSum = 0.;
628 for (
int i = 0; i < int(entry.size()); ++i) {
629 const Particle& pt = entry[i];
632 os << setw(6) << i << setw(10) << pt.id() <<
" " << left
633 << setw(18) << pt.nameWithStatus(18) << right << setw(4)
634 << pt.status() << setw(6) << pt.mother1() << setw(6)
635 << pt.mother2() << setw(6) << pt.daughter1() << setw(6)
636 << pt.daughter2() << setw(6) << pt.col() << setw(6) << pt.acol()
637 << ( (useFixed) ? fixed : scientific ) << setprecision(3)
638 << setw(11) << pt.px() << setw(11) << pt.py() << setw(11)
639 << pt.pz() << setw(11) << pt.e() << setw(11) << pt.m() <<
"\n";
642 if (showScaleAndVertex)
643 os <<
" " << setw(11) << pt.scale()
644 <<
" " << fixed << setprecision(3) << setw(11) << pt.pol()
645 <<
" " << scientific << setprecision(3)
646 << setw(11) << pt.xProd() << setw(11) << pt.yProd()
647 << setw(11) << pt.zProd() << setw(11) << pt.tProd()
648 << setw(11) << pt.tau() <<
"\n";
651 if (showMothersAndDaughters) {
654 vector<int> allMothers = motherList(i);
655 for (
int j = 0; j < int(allMothers.size()); ++j) {
656 os <<
" " << allMothers[j];
657 if (++linefill == IPERLINE) {os <<
"\n "; linefill = 0;}
659 os <<
"; daughters:";
660 vector<int> allDaughters = daughterList(i);
661 for (
int j = 0; j < int(allDaughters.size()); ++j) {
662 os <<
" " << allDaughters[j];
663 if (++linefill == IPERLINE) {os <<
"\n "; linefill = 0;}
665 if (linefill !=0) os <<
"\n";
669 if (showScaleAndVertex || showMothersAndDaughters) os <<
"\n";
672 if (entry[i].status() > 0) {
673 pSum += entry[i].p();
674 chargeSum += entry[i].charge();
679 os << fixed << setprecision(3) <<
" "
680 <<
"Charge sum:" << setw(7) << chargeSum <<
" Momentum sum:"
681 << ( (useFixed) ? fixed : scientific ) << setprecision(3)
682 << setw(11) << pSum.px() << setw(11) << pSum.py() << setw(11)
683 << pSum.pz() << setw(11) << pSum.e() << setw(11) << pSum.mCalc()
687 os <<
"\n -------- End PYTHIA Event Listing ----------------------------"
688 <<
"-------------------------------------------------------------------"
698 bool Event::undoDecay(
int i) {
701 if (i < 0 || i >=
int(entry.size()))
return false;
702 if (entry[i].col() != 0 || entry[i].acol() != 0)
return false;
705 int dau1 = entry[i].daughter1();
706 if (dau1 == 0)
return false;
707 int dau2 = entry[i].daughter2();
708 if (dau2 == 0) dau2 = dau1;
711 for (
int j = dau1; j <= dau2; ++j)
if (entry[j].mother1() != i
712 || (entry[j].mother2() != i && entry[j].mother2() != 0) )
return false;
715 vector<int> dauBeg, dauEnd;
716 dauBeg.push_back( dau1);
717 dauEnd.push_back( dau2);
722 for (
int j = dauBeg[iRange]; j <= dauEnd[iRange]; ++j)
723 if (entry[j].status() < 0) {
726 dau1 = entry[j].daughter1();
727 if (dau1 == 0)
return false;
728 dau2 = entry[j].daughter2();
729 if (dau2 == 0) dau2 = dau1;
733 for (
int iR = 0; iR < int(dauBeg.size()); ++iR) {
734 if (dau1 == dauBeg[iR] && dau2 == dauEnd[iR]) isNew =
false;
735 else if (dau1 >= dauBeg[iR] && dau1 <= dauEnd[iR])
return false;
736 else if (dau2 >= dauBeg[iR] && dau2 <= dauEnd[iR])
return false;
741 dauBeg.push_back( dau1);
742 dauEnd.push_back( dau2);
743 for (
int iR =
int(dauBeg.size()) - 1; iR > 0; --iR) {
744 if (dauBeg[iR] < dauBeg[iR - 1]) {
745 swap( dauBeg[iR], dauBeg[iR - 1]);
746 swap( dauEnd[iR], dauEnd[iR - 1]);
753 }
while (++iRange <
int(dauBeg.size()));
756 if (
int(dauBeg.size()) > 1) {
759 if (dauEnd[iRJ] + 1 == dauBeg[iRJ + 1]) {
760 for (
int iRB = iRJ + 1; iRB < int(dauBeg.size()) - 1; ++iRB)
761 dauBeg[iRB] = dauBeg[iRB + 1];
762 for (
int iRE = iRJ; iRE < int(dauEnd.size()) - 1; ++iRE)
763 dauEnd[iRE] = dauEnd[iRE + 1];
767 }
while (iRJ <
int(dauBeg.size()) - 1);
771 for (
int iR =
int(dauBeg.size()) - 1; iR >= 0; --iR) {
774 int nRem = dau2 - dau1 + 1;
777 entry.erase( entry.begin() + dau1, entry.begin() + dau2 + 1);
780 for (
int j = 0; j < int(entry.size()); ++j) {
781 if (entry[j].mother1() > dau2)
782 entry[j].mother1( entry[j].mother1() - nRem );
783 if (entry[j].mother2() > dau2)
784 entry[j].mother2( entry[j].mother2() - nRem );
785 if (entry[j].daughter1() > dau2)
786 entry[j].daughter1( entry[j].daughter1() - nRem );
787 if (entry[j].daughter2() > dau2)
788 entry[j].daughter2( entry[j].daughter2() - nRem );
793 entry[i].statusPos();
794 entry[i].daughters();
805 vector<int> Event::motherList(
int i)
const {
811 int mother1 = entry[i].mother1();
812 int mother2 = entry[i].mother2();
813 int statusAbs = entry[i].statusAbs();
816 if (statusAbs == 11 || statusAbs == 12) ;
817 else if (mother1 == 0 && mother2 == 0) mothers.push_back(0);
820 else if (mother2 == 0 || mother2 == mother1) mothers.push_back(mother1);
823 else if ( (statusAbs > 80 && statusAbs < 90)
824 || (statusAbs > 100 && statusAbs < 107) )
825 for (
int iRange = mother1; iRange <= mother2; ++iRange)
826 mothers.push_back(iRange);
830 mothers.push_back( min(mother1, mother2) );
831 mothers.push_back( max(mother1, mother2) );
843 vector<int> Event::daughterList(
int i)
const {
846 vector<int> daughters;
849 int daughter1 = entry[i].daughter1();
850 int daughter2 = entry[i].daughter2();
853 if (daughter1 == 0 && daughter2 == 0) ;
854 else if (daughter2 == 0 || daughter2 == daughter1)
855 daughters.push_back(daughter1);
858 else if (daughter2 > daughter1)
859 for (
int iRange = daughter1; iRange <= daughter2; ++iRange)
860 daughters.push_back(iRange);
864 daughters.push_back(daughter2);
865 daughters.push_back(daughter1);
870 if (entry[i].statusAbs() == 12 || entry[i].statusAbs() == 13)
871 for (
int iDau = i + 1; iDau < size(); ++iDau)
872 if (entry[iDau].mother1() == i) {
874 for (
int iIn = 0; iIn < int(daughters.size()); ++iIn)
875 if (iDau == daughters[iIn]) isIn =
true;
876 if (!isIn) daughters.push_back(iDau);
888 int Event::statusHepMC(
int i)
const {
891 int statusNow = entry[i].status();
892 if (statusNow > 0)
return 1;
893 if (statusNow == -12)
return 4;
896 int idNow = entry[i].id();
897 if (entry[i].isHadron() || abs(idNow) == 13 || abs(idNow) == 15) {
898 int iDau = entry[i].daughter1();
900 if ( entry[iDau].
id() != idNow) {
901 int statusDau = entry[ iDau ].statusAbs();
902 if (statusDau > 90 && statusDau < 95)
return 2;
907 if (statusNow <= -11 && statusNow >= -200)
return -statusNow;
918 int Event::iTopCopy(
int i)
const {
921 while ( iUp > 0 && entry[iUp].mother2() == entry[iUp].mother1()
922 && entry[iUp].mother1() > 0) iUp = entry[iUp].mother1();
927 int Event::iBotCopy(
int i)
const {
930 while ( iDn > 0 && entry[iDn].daughter2() == entry[iDn].daughter1()
931 && entry[iDn].daughter1() > 0) iDn = entry[iDn].daughter1();
942 int Event::iTopCopyId(
int i)
const {
944 int id = entry[i].id();
947 int mother1 = entry[iUp].mother1();
948 int id1 = (mother1 > 0) ? entry[mother1].
id() : 0;
949 int mother2 = entry[iUp].mother2();
950 int id2 = (mother2 > 0) ? entry[mother2].
id() : 0;
951 if (mother2 != mother1 && id2 == id1)
break;
966 int Event::iBotCopyId(
int i)
const {
968 int id = entry[i].id();
971 int daughter1 = entry[iDn].daughter1();
972 int id1 = (daughter1 > 0) ? entry[daughter1].
id() : 0;
973 int daughter2 = entry[iDn].daughter2();
974 int id2 = (daughter2 > 0) ? entry[daughter2].
id() : 0;
975 if (daughter2 != daughter1 && id2 == id1)
break;
994 vector<int> Event::sisterList(
int i)
const {
998 if (entry[i].statusAbs() == 11)
return sisters;
1001 int iMother = entry[i].mother1();
1002 vector<int> daughters = daughterList(iMother);
1005 for (
int j = 0; j < int(daughters.size()); ++j)
1006 if (daughters[j] != i) sisters.push_back( daughters[j] );
1019 vector<int> Event::sisterListTopBot(
int i,
bool widenSearch)
const {
1022 vector<int> sisters;
1023 if (entry[i].statusAbs() == 11)
return sisters;
1026 int iUp = iTopCopy(i);
1029 int iMother = entry[iUp].mother1();
1030 vector<int> daughters = daughterList(iMother);
1033 for (
int jD = 0; jD < int(daughters.size()); ++jD)
1034 if (daughters[jD] != iUp)
1035 sisters.push_back( iBotCopy( daughters[jD] ) );
1039 while (jP <
int(sisters.size())) {
1040 if (entry[sisters[jP]].status() > 0) ++jP;
1042 sisters[jP] = sisters.back();
1048 if (sisters.size() == 0 && widenSearch) {
1049 for (
int jR = 0; jR < int(daughters.size()); ++jR)
1050 if (daughters[jR] != iUp)
1051 sisters.push_back( iBotCopy( daughters[jR] ) );
1054 for (
int jT = 0; jT < int(sisters.size()); ++jT) {
1055 daughters = daughterList( sisters[jT] );
1056 for (
int k = 0; k < int(daughters.size()); ++k)
1057 sisters.push_back( daughters[k] );
1062 while (jN <
int(sisters.size())) {
1063 if (entry[sisters[jN]].status() > 0) ++jN;
1065 sisters[jN] = sisters.back();
1082 bool Event::isAncestor(
int i,
int iAncestor)
const {
1089 if (iUp == iAncestor)
return true;
1092 if (iUp <= 0 || iUp > size())
return false;
1095 int mother1 = entry[iUp].mother1();
1096 int mother2 = entry[iUp].mother2();
1097 if (mother2 == mother1 || mother2 == 0) {iUp = mother1;
continue;}
1100 int status = entry[iUp].statusAbs();
1101 if (status < 81 || status > 86)
return false;
1105 iUp = (iUp + 1 < size() && entry[iUp + 1].mother1() == mother1)
1106 ? mother1 : mother2;
continue;
1109 if (entry[iUp - 1].mother1() == mother1)
return false;
1110 iUp = mother1;
continue;
1113 if (iUp + 1 < size() && entry[iUp + 1].mother1() == mother1)
1115 iUp = mother1;
continue;
1131 void Event::eraseJunction(
int i) {
1133 for (
int j = i; j < int(junction.size()) - 1; ++j)
1134 junction[j] = junction[j + 1];
1135 junction.pop_back();
1143 void Event::listJunctions(ostream& os)
const {
1146 os <<
"\n -------- PYTHIA Junction Listing "
1147 << headerList.substr(0,30) <<
"\n \n no kind col0 col1 col2 "
1148 <<
"endc0 endc1 endc2 stat0 stat1 stat2\n";
1151 for (
int i = 0; i < sizeJunction(); ++i)
1152 os << setw(6) << i << setw(6) << kindJunction(i) << setw(6)
1153 << colJunction(i, 0) << setw(6) << colJunction(i, 1) << setw(6)
1154 << colJunction(i, 2) << setw(6) << endColJunction(i, 0) << setw(6)
1155 << endColJunction(i, 1) << setw(6) << endColJunction(i, 2) << setw(6)
1156 << statusJunction(i, 0) << setw(6) << statusJunction(i, 1) << setw(6)
1157 << statusJunction(i, 2) <<
"\n";
1160 if (sizeJunction() == 0) os <<
" no junctions present \n";
1161 os <<
"\n -------- End PYTHIA Junction Listing --------------------"
1162 <<
"------" << endl;
1169 Event& Event::operator+=(
const Event& addEvent) {
1172 int offsetIdx = entry.size() - 1;
1173 int offsetCol = maxColTag;
1176 entry[0].p( entry[0].p() + addEvent[0].p() );
1177 entry[0].m( entry[0].mCalc() );
1181 for (
int i = 1; i < addEvent.size(); ++i) {
1185 if (temp.mother1() > 0) temp.mother1( temp.mother1() + offsetIdx );
1186 if (temp.mother2() > 0) temp.mother2( temp.mother2() + offsetIdx );
1187 if (temp.daughter1() > 0) temp.daughter1( temp.daughter1() + offsetIdx );
1188 if (temp.daughter2() > 0) temp.daughter2( temp.daughter2() + offsetIdx );
1189 if (temp.col() > 0) temp.col( temp.col() + offsetCol );
1190 if (temp.acol() > 0) temp.acol( temp.acol() + offsetCol );
1199 for (
int i = 0; i < addEvent.sizeJunction(); ++i) {
1200 tempJ = addEvent.getJunction(i);
1203 for (
int j = 0; j < 3; ++j) {
1204 begCol = tempJ.col(j);
1205 endCol = tempJ.endCol(j);
1206 if (begCol > 0) begCol += offsetCol;
1207 if (endCol > 0) endCol += offsetCol;
1208 tempJ.cols( j, begCol, endCol);
1212 appendJunction( tempJ );
1216 headerList =
"(combination of several events) -------";