8 #include "Pythia8/ProcessLevel.h"
22 const int ProcessLevel::MAXLOOP = 5;
28 ProcessLevel::~ProcessLevel() {
31 for (
int i = 0; i < int(containerPtrs.size()); ++i)
32 delete containerPtrs[i];
35 for (
int i = 0; i < int(container2Ptrs.size()); ++i)
36 delete container2Ptrs[i];
44 bool ProcessLevel::init(
bool doLHA, SLHAinterface* slhaInterfacePtrIn,
45 vector<SigmaProcess*>& sigmaPtrs, vector<PhaseSpace*>& phaseSpacePtrs) {
48 slhaInterfacePtr = slhaInterfacePtrIn;
51 Settings& settings = *settingsPtr;
54 bool beamA2gamma = settings.flag(
"PDF:beamA2gamma");
55 bool beamB2gamma = settings.flag(
"PDF:beamB2gamma");
56 beamHasGamma = beamA2gamma || beamB2gamma;
57 gammaMode = settings.mode(
"Photon:ProcessType");
64 resonanceDecays.init();
67 int idA = infoPtr->idA();
68 int idB = infoPtr->idB();
69 double eCM = infoPtr->eCM();
71 int idAin = beamA2gamma ? 22 : idA;
72 int idBin = beamB2gamma ? 22 : idB;
73 sigmaTotPtr->calc( idAin, idBin, eCM);
75 else sigmaTotPtr->calc( idA, idB, eCM);
76 sigmaND = sigmaTotPtr->sigmaND();
79 doSecondHard = settings.flag(
"SecondHard:generate");
80 doSameCuts = settings.flag(
"PhaseSpace:sameForSecond");
81 doResDecays = settings.flag(
"ProcessLevel:resonanceDecays");
82 startColTag = settings.mode(
"Event:startColTag");
83 maxPDFreweight = settings.parm(
"SecondHard:maxPDFreweight");
86 doISR = ( settings.flag(
"PartonLevel:ISR")
87 && settings.flag(
"PartonLevel:all") );
88 doMPI = ( settings.flag(
"PartonLevel:MPI")
89 && settings.flag(
"PartonLevel:all") );
92 if (doSecondHard && userHooksPtr != 0
93 && userHooksPtr->canBiasSelection()) {
94 infoPtr->errorMsg(
"Error in ProcessLevel::init: "
95 "cannot combine second interaction with biased phase space");
100 mHatMin1 = settings.parm(
"PhaseSpace:mHatMin");
101 mHatMax1 = settings.parm(
"PhaseSpace:mHatMax");
102 if (mHatMax1 < mHatMin1) mHatMax1 = eCM;
103 pTHatMin1 = settings.parm(
"PhaseSpace:pTHatMin");
104 pTHatMax1 = settings.parm(
"PhaseSpace:pTHatMax");
105 if (pTHatMax1 < pTHatMin1) pTHatMax1 = eCM;
106 mHatMin2 = settings.parm(
"PhaseSpace:mHatMinSecond");
107 mHatMax2 = settings.parm(
"PhaseSpace:mHatMaxSecond");
108 if (mHatMax2 < mHatMin2) mHatMax2 = eCM;
109 pTHatMin2 = settings.parm(
"PhaseSpace:pTHatMinSecond");
110 pTHatMax2 = settings.parm(
"PhaseSpace:pTHatMaxSecond");
111 if (pTHatMax2 < pTHatMin2) pTHatMax2 = eCM;
114 cutsAgree = doSameCuts;
115 if (mHatMin2 == mHatMin1 && mHatMax2 == mHatMax1 && pTHatMin2 == pTHatMin1
116 && pTHatMax2 == pTHatMax1) cutsAgree =
true;
117 cutsOverlap = cutsAgree;
119 bool mHatOverlap = (max( mHatMin1, mHatMin2)
120 < min( mHatMax1, mHatMax2));
121 bool pTHatOverlap = (max( pTHatMin1, pTHatMin2)
122 < min( pTHatMax1, pTHatMax2));
123 if (mHatOverlap && pTHatOverlap) cutsOverlap =
true;
127 SetupContainers setupContainers;
128 setupContainers.init(containerPtrs, infoPtr);
131 if (sigmaPtrs.size() > 0) {
132 for (
int iSig = 0; iSig < int(sigmaPtrs.size()); ++iSig) {
133 containerPtrs.push_back(
new ProcessContainer(sigmaPtrs[iSig],
134 true, phaseSpacePtrs[iSig]) );
135 containerPtrs.back()->initInfoPtr(*infoPtr);
141 SigmaProcess* sigmaPtr =
new SigmaLHAProcess();
142 containerPtrs.push_back(
new ProcessContainer(sigmaPtr) );
143 containerPtrs.back()->initInfoPtr(*infoPtr);
146 iLHACont = containerPtrs.size() - 1;
147 containerPtrs[iLHACont]->setLHAPtr(lhaUpPtr);
151 if (
int(containerPtrs.size()) == 0) {
152 infoPtr->errorMsg(
"Error in ProcessLevel::init: "
153 "no process switched on");
158 bool bias2Sel =
false;
159 if (settings.flag(
"PhaseSpace:bias2Selection")) {
160 if (sigmaPtrs.size() == 0 && !doLHA && !doSecondHard) {
162 for (
int i = 0; i < int(containerPtrs.size()); ++i) {
163 if (containerPtrs[i]->nFinal() != 2) bias2Sel =
false;
164 int code = containerPtrs[i]->code();
165 if (code > 100 && code < 110) bias2Sel =
false;
169 infoPtr->errorMsg(
"Error in ProcessLevel::init: "
170 "requested event weighting not possible");
176 bool hasSUSY =
false;
177 for (
int i = 0; i < int(containerPtrs.size()); ++i)
178 if (containerPtrs[i]->isSUSY()) hasSUSY =
true;
181 if (hasSUSY && !coupSUSYPtr->isSUSY) {
182 infoPtr->errorMsg(
"Error in ProcessLevel::init: "
183 "SUSY process switched on but no SUSY couplings found");
188 slhaInterfacePtr->pythia2slha();
192 for (
int i = 0; i < int(containerPtrs.size()); ++i)
193 if (containerPtrs[i]->init(
true, &resonanceDecays, slhaInterfacePtr,
199 for (
int i = 0; i < int(containerPtrs.size()); ++i)
200 sigmaMaxSum += containerPtrs[i]->sigmaMax();
205 setupContainers.init2(container2Ptrs, infoPtr);
206 if (
int(container2Ptrs.size()) == 0) {
207 infoPtr->errorMsg(
"Error in ProcessLevel::init: "
208 "no second hard process switched on");
211 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2)
212 if (container2Ptrs[i2]->init(
false, &resonanceDecays,
213 slhaInterfacePtr, &gammaKin)) ++number2On;
216 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2)
217 sigma2MaxSum += container2Ptrs[i2]->sigmaMax();
221 doWt2 = !doLHA && !bias2Sel && !settings.flag(
"PhaseSpace:increaseMaximum");
224 if (settings.flag(
"Init:showProcesses")) {
227 string collision =
"We collide " + particleDataPtr->name(idA)
228 +
" with " + particleDataPtr->name(idB) +
" at a CM energy of ";
229 string pad( max( 0, 51 -
int(collision.length())),
' ');
232 cout <<
"\n *------- PYTHIA Process Initialization ---------"
233 <<
"-----------------*\n"
236 <<
" | " << collision << scientific << setprecision(3)
237 << setw(9) << eCM <<
" GeV" << pad <<
" |\n"
240 <<
" |---------------------------------------------------"
241 <<
"---------------|\n"
244 <<
" | Subprocess Code"
245 <<
" | Estimated |\n"
250 <<
" |---------------------------------------------------"
251 <<
"---------------|\n"
256 map<int, double> sigmaMaxM;
257 map<int, string> nameM;
258 for (
int i = 0; i < int(containerPtrs.size()); ++i) {
259 int code = containerPtrs[i]->code();
260 nameM[code] = containerPtrs[i]->name();
261 sigmaMaxM[code] = containerPtrs[i]->sigmaMax() > sigmaMaxM[code] ?
262 containerPtrs[i]->sigmaMax() : sigmaMaxM[code];
264 for (map<int, string>::iterator i = nameM.begin(); i != nameM.end(); ++i)
265 cout <<
" | " << left << setw(45) << i->second
266 << right << setw(5) << i->first <<
" | "
267 << scientific << setprecision(3) << setw(11)
268 << sigmaMaxM[i->first] <<
" |\n";
274 <<
" |---------------------------------------------------"
275 <<
"---------------|\n"
280 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2) {
281 int code = container2Ptrs[i2]->code();
282 nameM[code] = container2Ptrs[i2]->name();
283 sigmaMaxM[code] = container2Ptrs[i2]->sigmaMax() > sigmaMaxM[code] ?
284 container2Ptrs[i2]->sigmaMax() : sigmaMaxM[code];
286 for (map<int, string>::iterator i2 = nameM.begin(); i2 != nameM.end();
288 cout <<
" | " << left << setw(45) << i2->second
289 << right << setw(5) << i2->first <<
" | "
290 << scientific << setprecision(3) << setw(11)
291 << sigmaMaxM[i2->first] <<
" |\n";
297 <<
" *------- End PYTHIA Process Initialization ----------"
298 <<
"-------------*" << endl;
302 if ( numberOn == 0 || sigmaMaxSum <= 0.) {
303 infoPtr->errorMsg(
"Error in ProcessLevel::init: "
304 "all processes have vanishing cross sections");
307 if ( doSecondHard && (number2On == 0 || sigma2MaxSum <= 0.) ) {
308 infoPtr->errorMsg(
"Error in ProcessLevel::init: "
309 "all second hard processes have vanishing cross sections");
317 bool foundMatch =
false;
320 for (
int i = 0; i < int(containerPtrs.size()); ++i) {
323 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2)
324 if (container2Ptrs[i2]->code() == containerPtrs[i]->code())
326 containerPtrs[i]->isSame( foundMatch );
327 if (!foundMatch) allHardSame =
false;
328 if ( foundMatch) noneHardSame =
false;
332 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2) {
335 for (
int i = 0; i < int(containerPtrs.size()); ++i)
336 if (containerPtrs[i]->code() == container2Ptrs[i2]->code())
338 container2Ptrs[i2]->isSame( foundMatch );
339 if (!foundMatch) allHardSame =
false;
340 if ( foundMatch) noneHardSame =
false;
345 if (!cutsAgree) allHardSame =
false;
346 someHardSame = !allHardSame && !noneHardSame;
356 bool ProcessLevel::next(
Event& process) {
359 bool physical = (doSecondHard) ? nextTwo( process) : nextOne( process);
362 if (physical) physical = checkColours( process);
372 bool ProcessLevel::nextLHAdec(
Event& process) {
375 infoPtr->setEndOfFile(
false);
376 if (!lhaUpPtr->setEvent()) {
377 infoPtr->setEndOfFile(
true);
382 containerLHAdec.constructDecays( process);
392 void ProcessLevel::accumulate(
bool doAccumulate) {
395 if (doAccumulate) containerPtrs[iContainer]->accumulate();
401 double sigmaSum = 0.;
402 double delta2Sum = 0.;
403 double sigSelSum = 0.;
404 double weightSum = 0.;
406 long nTryNow, nSelNow, nAccNow;
407 double sigmaNow, deltaNow, sigSelNow, weightNow;
408 map<int, bool> duplicate;
409 for (
int i = 0; i < int(containerPtrs.size()); ++i)
410 if (containerPtrs[i]->sigmaMax() != 0.) {
411 codeNow = containerPtrs[i]->code();
412 nTryNow = containerPtrs[i]->nTried();
413 nSelNow = containerPtrs[i]->nSelected();
414 nAccNow = containerPtrs[i]->nAccepted();
415 sigmaNow = containerPtrs[i]->sigmaMC(doAccumulate);
416 deltaNow = containerPtrs[i]->deltaMC(doAccumulate);
417 sigSelNow = containerPtrs[i]->sigmaSelMC(doAccumulate);
418 weightNow = containerPtrs[i]->weightSum();
422 sigmaSum += sigmaNow;
423 delta2Sum += pow2(deltaNow);
424 sigSelSum += sigSelNow;
425 weightSum += weightNow;
427 if (!duplicate[codeNow])
428 infoPtr->setSigma( codeNow, containerPtrs[i]->name(),
429 nTryNow, nSelNow, nAccNow, sigmaNow, deltaNow, weightNow);
431 infoPtr->addSigma( codeNow, nTryNow, nSelNow, nAccNow, sigmaNow,
433 duplicate[codeNow] =
true;
439 double deltaSum = sqrtpos(delta2Sum);
440 infoPtr->setSigma( 0,
"sum", nTrySum, nSelSum, nAccSum, sigmaSum,
441 deltaSum, weightSum);
446 if (doAccumulate) container2Ptrs[i2Container]->accumulate();
449 double sigma2Sum = 0.;
450 double sig2SelSum = 0.;
451 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2)
452 if (container2Ptrs[i2]->sigmaMax() != 0.) {
453 nTrySum += container2Ptrs[i2]->nTried();
455 sigma2Sum += container2Ptrs[i2]->sigmaMC();
456 sig2SelSum += container2Ptrs[i2]->sigmaSelMC();
461 double impactFac = max( 1., infoPtr->enhanceMPIavg() );
465 double sigmaComb = 0.5 * (sigmaSum * sig2SelSum + sigSelSum * sigma2Sum);
466 sigmaComb *= impactFac * maxPDFreweight / sigmaND;
467 if (allHardSame) sigmaComb *= 0.5;
468 double deltaComb = (nAccSum == 0) ? 0. : sqrtpos(2. / nAccSum) * sigmaComb;
471 infoPtr->setSigma( 0,
"sum", nTrySum, nSelSum, nAccSum, sigmaComb,
472 deltaComb, weightSum);
480 void ProcessLevel::statistics(
bool reset) {
489 cout <<
"\n *------- PYTHIA Event and Cross Section Statistics ------"
490 <<
"-------------------------------------------------------*\n"
493 <<
" | Subprocess Code | "
494 <<
" Number of events | sigma +- delta |\n"
496 <<
"Tried Selected Accepted | (estimated) (mb) |\n"
499 <<
" |------------------------------------------------------------"
500 <<
"-----------------------------------------------------|\n"
508 double sigmaSum = 0.;
509 double delta2Sum = 0.;
512 map<int, string> nameM;
513 map<int, long> nTryM, nSelM, nAccM;
514 map<int, double> sigmaM, delta2M;
515 vector<ProcessContainer*> lheContainerPtrs;
518 for (
int i = 0; i < int(containerPtrs.size()); ++i)
519 if (containerPtrs[i]->sigmaMax() != 0.) {
522 nTrySum += containerPtrs[i]->nTried();
523 nSelSum += containerPtrs[i]->nSelected();
524 nAccSum += containerPtrs[i]->nAccepted();
525 sigmaSum += containerPtrs[i]->sigmaMC();
526 delta2Sum += pow2(containerPtrs[i]->deltaMC());
529 if (containerPtrs[i]->code() == 9999) {
530 lheContainerPtrs.push_back(containerPtrs[i]);
535 int code = containerPtrs[i]->code();
536 nameM[code] = containerPtrs[i]->name();
537 nTryM[code] += containerPtrs[i]->nTried();
538 nSelM[code] += containerPtrs[i]->nSelected();
539 nAccM[code] += containerPtrs[i]->nAccepted();
540 sigmaM[code] += containerPtrs[i]->sigmaMC();
541 delta2M[code]+= pow2(containerPtrs[i]->deltaMC());
545 for (map<int, string>::iterator i = nameM.begin(); i != nameM.end(); ++i) {
547 cout <<
" | " << left << setw(45) << i->second
548 << right << setw(5) << code <<
" | "
549 << setw(11) << nTryM[code] <<
" " << setw(10) << nSelM[code] <<
" "
550 << setw(10) << nAccM[code] <<
" | " << scientific << setprecision(3)
551 << setw(11) << sigmaM[code]
552 << setw(11) << sqrtpos(delta2M[code]) <<
" |\n";
556 for (
int i = 0; i < int(lheContainerPtrs.size()); ++i) {
557 ProcessContainer *ptr = lheContainerPtrs[i];
558 cout <<
" | " << left << setw(45) << ptr->name()
559 << right << setw(5) << ptr->code() <<
" | "
560 << setw(11) << ptr->nTried() <<
" " << setw(10) << ptr->nSelected()
561 <<
" " << setw(10) << ptr->nAccepted() <<
" | " << scientific
562 << setprecision(3) << setw(11) << ptr->sigmaMC() << setw(11)
563 << ptr->deltaMC() <<
" |\n";
566 for (
int j = 0; j < ptr->codeLHASize(); ++j)
567 cout <<
" | ... whereof user classification code " << setw(10)
568 << ptr->subCodeLHA(j) <<
" | " << setw(11) << ptr->nTriedLHA(j)
569 <<
" " << setw(10) << ptr->nSelectedLHA(j) <<
" " << setw(10)
570 << ptr->nAcceptedLHA(j) <<
" | | \n";
576 <<
" | " << left << setw(50) <<
"sum" << right <<
" | " << setw(11)
577 << nTrySum <<
" " << setw(10) << nSelSum <<
" " << setw(10)
578 << nAccSum <<
" | " << scientific << setprecision(3) << setw(11)
579 << sigmaSum << setw(11) << sqrtpos(delta2Sum) <<
" |\n";
584 <<
" *------- End PYTHIA Event and Cross Section Statistics -----"
585 <<
"-----------------------------------------------------*" << endl;
588 if (reset) resetStatistics();
596 void ProcessLevel::resetStatistics() {
598 for (
int i = 0; i < int(containerPtrs.size()); ++i)
599 containerPtrs[i]->reset();
601 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2)
602 container2Ptrs[i2]->reset();
610 bool ProcessLevel::nextOne(
Event& process) {
613 double eCM = infoPtr->eCM();
614 for (
int i = 0; i < int(containerPtrs.size()); ++i)
615 containerPtrs[i]->newECM(eCM);
618 bool physical =
true;
619 for (
int loop = 0; loop < MAXLOOP; ++loop) {
620 if (!physical) process.clear();
627 double sigmaMaxNow = sigmaMaxSum * rndmPtr->flat();
628 int iMax = containerPtrs.size() - 1;
630 do sigmaMaxNow -= containerPtrs[++iContainer]->sigmaMax();
631 while (sigmaMaxNow > 0. && iContainer < iMax);
634 if (containerPtrs[iContainer]->trialProcess())
break;
637 if (infoPtr->atEndOfFile())
return false;
641 if (containerPtrs[iContainer]->newSigmaMax()) {
643 for (
int i = 0; i < int(containerPtrs.size()); ++i)
644 sigmaMaxSum += containerPtrs[i]->sigmaMax();
648 containerPtrs[iContainer]->constructState();
649 if ( !containerPtrs[iContainer]->constructProcess( process) )
654 beamGamAPtr->setGammaMode(beamAPtr->getGammaMode());
655 beamGamBPtr->setGammaMode(beamBPtr->getGammaMode());
659 if ( physical && doResDecays
660 && !containerPtrs[iContainer]->decayResonances( process) )
664 for (
int i =1; i < process.size(); ++i)
665 if (process[i].e() < 0.) {
666 infoPtr->errorMsg(
"Error in ProcessLevel::nextOne: "
667 "Constructed particle with negative energy.");
672 if (physical) findJunctions( process);
677 if ( ( ( ( beamAPtr->isGamma() && !beamAPtr->isUnresolved() )
678 || ( beamBPtr->isGamma() && !beamBPtr->isUnresolved() ) )
679 || ( beamAPtr->hasResGamma() || beamBPtr->hasResGamma() ) )
680 && !containerPtrs[iContainer]->isSoftQCD() ) {
681 if ( !roomForRemnants() ) {
692 if (infoPtr->isVMDstateA()) {
693 beamVMDAPtr->setGammaMode(beamAPtr->getGammaMode());
694 beamVMDAPtr->setVMDstate(
true, infoPtr->idVMDA(), infoPtr->mVMDA(),
695 infoPtr->scaleVMDA(),
true);
697 if (infoPtr->isVMDstateB()) {
698 beamVMDBPtr->setGammaMode(beamBPtr->getGammaMode());
699 beamVMDBPtr->setVMDstate(
true, infoPtr->idVMDB(), infoPtr->mVMDB(),
700 infoPtr->scaleVMDB(),
true);
711 bool ProcessLevel::nextTwo(
Event& process) {
714 double eCM = infoPtr->eCM();
715 for (
int i = 0; i < int(containerPtrs.size()); ++i)
716 containerPtrs[i]->newECM(eCM);
717 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2)
718 container2Ptrs[i2]->newECM(eCM);
721 bool physical =
true;
724 for (
int loop = 0; loop < MAXLOOP; ++loop) {
725 if (!physical) process.clear();
735 double sigmaMaxNow = sigmaMaxSum * rndmPtr->flat();
736 int iMax = containerPtrs.size() - 1;
738 do sigmaMaxNow -= containerPtrs[++iContainer]->sigmaMax();
739 while (sigmaMaxNow > 0. && iContainer < iMax);
742 if (containerPtrs[iContainer]->trialProcess())
break;
745 if (infoPtr->atEndOfFile())
return false;
749 if (containerPtrs[iContainer]->newSigmaMax()) {
751 for (
int i = 0; i < int(containerPtrs.size()); ++i)
752 sigmaMaxSum += containerPtrs[i]->sigmaMax();
754 wtViol1 = (doWt2) ? infoPtr->weight() : 1.;
760 double sigma2MaxNow = sigma2MaxSum * rndmPtr->flat();
761 int i2Max = container2Ptrs.size() - 1;
763 do sigma2MaxNow -= container2Ptrs[++i2Container]->sigmaMax();
764 while (sigma2MaxNow > 0. && i2Container < i2Max);
767 if (container2Ptrs[i2Container]->trialProcess())
break;
771 if (container2Ptrs[i2Container]->newSigmaMax()) {
773 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2)
774 sigma2MaxSum += container2Ptrs[i2]->sigmaMax();
776 wtViol2 = (doWt2) ? infoPtr->weight() : 1.;
779 containerPtrs[iContainer]->constructState();
780 container2Ptrs[i2Container]->constructState();
783 double xA1 = containerPtrs[iContainer]->x1();
784 double xB1 = containerPtrs[iContainer]->x2();
785 double xA2 = container2Ptrs[i2Container]->x1();
786 double xB2 = container2Ptrs[i2Container]->x2();
787 if (xA1 + xA2 >= 1. || xB1 + xB2 >= 1.)
continue;
790 int idA1 = containerPtrs[iContainer]->id1();
791 int idB1 = containerPtrs[iContainer]->id2();
792 int idA2 = container2Ptrs[i2Container]->id1();
793 int idB2 = container2Ptrs[i2Container]->id2();
794 double Q2Fac1 = containerPtrs[iContainer]->Q2Fac();
795 double Q2Fac2 = container2Ptrs[i2Container]->Q2Fac();
796 double pdfA1Raw = beamAPtr->xf( idA1, xA1,Q2Fac1);
797 double pdfB1Raw = beamBPtr->xf( idB1, xB1,Q2Fac1);
798 double pdfA2Raw = beamAPtr->xf( idA2, xA2,Q2Fac2);
799 double pdfB2Raw = beamBPtr->xf( idB2, xB2,Q2Fac2);
805 beamAPtr->append( 3, idA2, xA2);
806 beamAPtr->xfISR( 0, idA2, xA2, Q2Fac2);
807 beamAPtr->pickValSeaComp();
808 beamBPtr->append( 4, idB2, xB2);
809 beamBPtr->xfISR( 0, idB2, xB2, Q2Fac2);
810 beamBPtr->pickValSeaComp();
811 double pdfA1Mod = beamAPtr->xfMPI( idA1, xA1,Q2Fac1);
812 double pdfB1Mod = beamBPtr->xfMPI( idB1, xB1,Q2Fac1);
818 beamAPtr->append( 3, idA1, xA1);
819 beamAPtr->xfISR( 0, idA1, xA1, Q2Fac1);
820 beamAPtr->pickValSeaComp();
821 beamBPtr->append( 4, idB1, xB1);
822 beamBPtr->xfISR( 0, idB1, xB1, Q2Fac1);
823 beamBPtr->pickValSeaComp();
824 double pdfA2Mod = beamAPtr->xfMPI( idA2, xA2,Q2Fac2);
825 double pdfB2Mod = beamBPtr->xfMPI( idB2, xB2,Q2Fac2);
828 double wtPdf1 = (pdfA1Mod * pdfB1Mod) / (pdfA1Raw * pdfB1Raw);
829 double wtPdf2 = (pdfA2Mod * pdfB2Mod) / (pdfA2Raw * pdfB2Raw);
830 double wtPdfSame = 0.5 * (wtPdf1 + wtPdf2);
834 if ( someHardSame && containerPtrs[iContainer]->isSame()
835 && container2Ptrs[i2Container]->isSame()) {
836 if (cutsAgree) wtPdfSame *= 0.5;
838 double mHat1 = containerPtrs[iContainer]->mHat();
839 double pTHat1 = containerPtrs[iContainer]->pTHat();
840 double mHat2 = container2Ptrs[i2Container]->mHat();
841 double pTHat2 = container2Ptrs[i2Container]->pTHat();
842 if (mHat1 > mHatMin2 && mHat1 < mHatMax2
843 && pTHat1 > pTHatMin2 && pTHat1 < pTHatMax2
844 && mHat2 > mHatMin1 && mHat2 < mHatMax1
845 && pTHat2 > pTHatMin1 && pTHat2 < pTHatMax1) wtPdfSame *= 0.5;
850 wtPdfSame *= wtViol1 * wtViol2 / maxPDFreweight;
851 if (doWt2) infoPtr->setWeight( max( 1., wtPdfSame), 0 );
852 if (wtPdfSame > 1.) infoPtr->errorMsg(
"Warning in ProcessLevel::next"
853 "Two: joint PDF correction gives weight above unity");
854 if (wtPdfSame < rndmPtr->flat())
continue;
862 process2.init(
"(second hard)", particleDataPtr, startColTag);
863 process2.initColTag();
864 if ( !containerPtrs[iContainer]->constructProcess( process) )
866 if (physical && !container2Ptrs[i2Container]->constructProcess( process2,
867 false) ) physical =
false;
870 if ( physical && doResDecays
871 && !containerPtrs[iContainer]->decayResonances( process) )
873 if ( physical && doResDecays
874 && !container2Ptrs[i2Container]->decayResonances( process2) )
879 combineProcessRecords( process, process2);
882 findJunctions( process);
898 bool ProcessLevel::roomForRemnants() {
901 bool beamAhasResGamma = beamAPtr->hasResGamma();
902 bool beamBhasResGamma = beamBPtr->hasResGamma();
903 bool beamHasResGamma = beamAhasResGamma || beamBhasResGamma;
904 BeamParticle* tmpBeamAPtr = beamAhasResGamma ? beamGamAPtr : beamAPtr;
905 BeamParticle* tmpBeamBPtr = beamBhasResGamma ? beamGamBPtr : beamBPtr;
908 bool resGammaA = !(beamGamAPtr->isUnresolved());
909 bool resGammaB = !(beamGamBPtr->isUnresolved());
912 double xGamma1 = beamAPtr->xGamma();
913 double xGamma2 = beamBPtr->xGamma();
916 tmpBeamAPtr->posVal(-1);
917 tmpBeamBPtr->posVal(-1);
920 int id1 = containerPtrs[iContainer]->id1();
921 int id2 = containerPtrs[iContainer]->id2();
922 double x1 = containerPtrs[iContainer]->x1();
923 double x2 = containerPtrs[iContainer]->x2();
924 double Q2 = containerPtrs[iContainer]->Q2Fac();
927 double eCMgmgm = infoPtr->eCM();
930 if (beamHasResGamma) eCMgmgm = infoPtr->eCMsub();
936 if ( resGammaA != resGammaB && beamHasResGamma ) {
937 double wTot = infoPtr->eCMsub();
938 double w2scat = infoPtr->sHatNew();
939 mTRem = wTot - sqrt(w2scat);
942 }
else if ( tmpBeamAPtr->isUnresolved() && !tmpBeamBPtr->isUnresolved() ) {
943 mTRem = eCMgmgm*( 1. - sqrt( x2) );
944 }
else if ( !tmpBeamAPtr->isUnresolved() && tmpBeamBPtr->isUnresolved() ) {
945 mTRem = eCMgmgm*( 1. - sqrt( x1) );
951 if ( beamAhasResGamma && beamBhasResGamma) {
955 double sCM = infoPtr->s();
956 x1 /= xGamma1 * pow2(eCMgmgm) / ( xGamma1 * xGamma2 * sCM);
957 x2 /= xGamma2 * pow2(eCMgmgm) / ( xGamma1 * xGamma2 * sCM);
961 mTRem = eCMgmgm * sqrt( (1. - x1)*(1. - x2) );
965 double m1 = 0, m2 = 0;
966 bool physical =
false;
969 if ( !doISR && !doMPI ) {
972 int nTry = 0, maxTry = 4;
978 bool init1Val = tmpBeamAPtr->isGamma() ?
979 tmpBeamAPtr->gammaInitiatorIsVal(0, id1, x1, Q2) :
false;
980 bool init2Val = tmpBeamBPtr->isGamma() ?
981 tmpBeamBPtr->gammaInitiatorIsVal(0, id2, x2, Q2) :
false;
989 if ( tmpBeamAPtr->isGamma() ) {
992 }
else if (init1Val) {
993 m1 = particleDataPtr->m0(id1);
995 m1 = 2*( particleDataPtr->m0( tmpBeamAPtr->getGammaValFlavour() ) );
996 if (id1 != 21) m1 += particleDataPtr->m0(id1);
1000 }
else if ( tmpBeamAPtr->isHadron() ) {
1001 m1 = particleDataPtr->m0(tmpBeamAPtr->id());
1004 int valSign1 = (tmpBeamAPtr->nValence(id1) > 0) ? -1 : 1;
1005 m1 = m1 + valSign1 * particleDataPtr->m0(id1);
1009 if ( tmpBeamBPtr->isGamma() ) {
1012 }
else if (init2Val) {
1013 m2 = particleDataPtr->m0(id2);
1015 m2 = 2*( particleDataPtr->m0( tmpBeamBPtr->getGammaValFlavour() ) );
1016 if (id2 != 21) m2 += particleDataPtr->m0(id2);
1020 }
else if ( tmpBeamBPtr->isHadron() ) {
1021 m2 = particleDataPtr->m0(tmpBeamBPtr->id());
1024 int valSign2 = (tmpBeamBPtr->nValence(id2) > 0) ? -1 : 1;
1025 m2 = m2 + valSign2 * particleDataPtr->m0(id2);
1029 physical = ( (m1 + m2) < mTRem );
1033 if (nTry == maxTry) {
1034 if ( abs(id1) == 5 || abs(id2) == 5 ) {
1035 infoPtr->errorMsg(
"Warning in ProcessLevel::roomForRemnants: "
1036 "No room for bottom quarks in beam remnants");
1037 }
else if ( abs(id1) == 4 || abs(id2) == 4 ) {
1038 infoPtr->errorMsg(
"Warning in ProcessLevel::roomForRemnants: "
1039 "No room for charm quarks in beam remnants");
1041 infoPtr->errorMsg(
"Warning in ProcessLevel::roomForRemnants: "
1042 "No room for light quarks in beam remnants");
1056 if ( tmpBeamAPtr->isGamma() ) {
1057 m1 = (id1 == 21) ? 2*( particleDataPtr->m0( idLight ) ) :
1058 particleDataPtr->m0( id1 );
1059 }
else if ( tmpBeamAPtr->isHadron() ) {
1060 m1 = particleDataPtr->m0( tmpBeamAPtr->id() );
1061 int valSign1 = (tmpBeamAPtr->nValence(id1) > 0) ? -1 : 1;
1062 m1 = m1 + valSign1 * particleDataPtr->m0(id1);
1066 if ( tmpBeamBPtr->isGamma() ) {
1067 m2 = (id2 == 21) ? 2*( particleDataPtr->m0( idLight ) ) :
1068 particleDataPtr->m0( id2 );
1069 }
else if ( tmpBeamBPtr->isHadron() ) {
1070 m2 = particleDataPtr->m0( tmpBeamBPtr->id() );
1071 int valSign2 = (tmpBeamBPtr->nValence(id2) > 0) ? -1 : 1;
1072 m2 = m2 + valSign2 * particleDataPtr->m0(id2);
1076 if ( !resGammaA && !(tmpBeamAPtr->isHadron()) ) m1 = 0;
1077 if ( !resGammaB && !(tmpBeamBPtr->isHadron()) ) m2 = 0;
1080 physical = ( (m1 + m2) < mTRem );
1081 if (physical ==
false) {
1082 if ( abs(id1) == 5 || abs(id2) == 5 ) {
1083 infoPtr->errorMsg(
"Warning in ProcessLevel::roomForRemnants: "
1084 "No room for bottom quarks in beam remnants");
1085 }
else if ( abs(id1) == 4 || abs(id2) == 4 ) {
1086 infoPtr->errorMsg(
"Warning in ProcessLevel::roomForRemnants: "
1087 "No room for charm quarks in beam remnants");
1089 infoPtr->errorMsg(
"Warning in ProcessLevel::roomForRemnants: "
1090 "No room for light quarks in beam remnants");
1103 void ProcessLevel::combineProcessRecords(
Event& process,
Event& process2) {
1106 int nSize = process.size();
1108 while (nHard < nSize && process[nHard].mother1() == 3) ++nHard;
1111 vector<Particle> resProd;
1112 if (nSize > nHard) {
1113 for (
int i = nHard; i < nSize; ++i) resProd.push_back( process[i] );
1114 process.popBack(nSize - nHard);
1118 int nSize2 = process2.size();
1120 while (nHard2 < nSize2 && process2[nHard2].mother1() == 3) ++nHard2;
1123 int addPos = nHard - 3;
1124 int addCol = process.lastColTag() - startColTag;
1127 for (
int i = 3; i < nSize2; ++i) {
1130 process2[i].offsetHistory( 2, addPos, 2, addPos);
1131 process2[i].offsetCol( addCol);
1134 if (i < nHard2) process.append( process2[i] );
1138 int addPos2 = nHard2 - 3;
1139 if (nHard < nSize) {
1142 for (
int i = 5; i < nHard; ++i)
1143 process[i].offsetHistory( 0, 0, nHard - 1, addPos2);
1146 for (
int i = 0; i < int(resProd.size()); ++i) {
1147 resProd[i].offsetHistory( nHard - 1, addPos2, nHard - 1, addPos2);
1148 process.append( resProd[i] );
1153 if (nHard2 < nSize2) {
1154 int nHard3 = nHard + nHard2 - 3;
1155 int addPos3 = nSize - nHard;
1158 for (
int i = nHard + 2; i < nHard3; ++i)
1159 process[i].offsetHistory( 0, 0, nHard3 - 1, addPos3);
1162 for (
int i = nHard2; i < nSize2; ++i) {
1163 process2[i].offsetHistory( nHard3 - 1, addPos3, nHard3 - 1, addPos3);
1164 process.append( process2[i] );
1169 process.scaleSecond( process2.scale() );
1178 void ProcessLevel::findJunctions(
Event& junEvent) {
1181 for (
int i = 1; i<junEvent.size(); i++) {
1185 if (abs(junEvent[i].status()) <= 21 || junEvent[i].colType() == 0)
1187 vector<int> motherList = junEvent[i].motherList();
1188 int iMot1 = motherList[0];
1189 vector<int> sisterList = junEvent[iMot1].daughterList();
1193 map<int,int> colVertex, acolVertex;
1196 for (
unsigned int indx = 0; indx < motherList.size(); indx++) {
1197 int iMot = motherList[indx];
1198 if ( abs(junEvent[iMot].colType()) == 1 )
1199 barSum -= junEvent[iMot].colType();
1200 else if ( abs(junEvent[iMot].colType()) == 3)
1201 barSum -= 2*junEvent[iMot].colType()/3;
1202 int col = junEvent[iMot].acol();
1203 int acol = junEvent[iMot].col();
1207 if (acolVertex.find(col) == acolVertex.end() ) colVertex[col] = iMot;
1208 else acolVertex.erase(col);
1209 }
else if (col < 0) {
1210 if (colVertex.find(-col) == colVertex.end() ) acolVertex[-col] = iMot;
1211 else colVertex.erase(-col);
1214 if (colVertex.find(acol) == colVertex.end()) acolVertex[acol] = iMot;
1215 else colVertex.erase(acol);
1216 }
else if (acol < 0) {
1217 if (acolVertex.find(-acol) == acolVertex.end())
1218 colVertex[-acol] = iMot;
1219 else acolVertex.erase(-acol);
1224 for (
unsigned int indx = 0; indx < sisterList.size(); indx++) {
1225 int iDau = sisterList[indx];
1226 if ( abs(junEvent[iDau].colType()) == 1 )
1227 barSum += junEvent[iDau].colType();
1228 else if ( abs(junEvent[iDau].colType()) == 3)
1229 barSum += 2*junEvent[iDau].colType()/3;
1230 int col = junEvent[iDau].col();
1231 int acol = junEvent[iDau].acol();
1235 if (acolVertex.find(col) == acolVertex.end() ) colVertex[col] = iDau;
1236 else acolVertex.erase(col);
1237 }
else if (col < 0) {
1238 if (colVertex.find(-col) == colVertex.end() ) acolVertex[-col] = iDau;
1239 else colVertex.erase(-col);
1242 if (colVertex.find(acol) == colVertex.end()) acolVertex[acol] = iDau;
1243 else colVertex.erase(acol);
1244 }
else if (acol < 0) {
1245 if (acolVertex.find(-acol) == acolVertex.end())
1246 colVertex[-acol] = iDau;
1247 else acolVertex.erase(-acol);
1253 if (barSum == 0)
continue;
1256 for (
int iJun = 0; iJun < junEvent.sizeJunction(); ++iJun) {
1258 for (
int j = 0; j < 3; ++j) {
1259 int colNow = junEvent.colJunction(iJun, j);
1260 if (junEvent.kindJunction(iJun) % 2 == 1) colVertex.erase(colNow);
1261 else acolVertex.erase(colNow);
1266 if (colVertex.size() == 0 && acolVertex.size() == 0)
continue;
1270 if (colVertex.size() == 3 && acolVertex.size() == 0) kindJun = 1;
1271 else if (colVertex.size() == 0 && acolVertex.size() == 3) kindJun = 2;
1273 infoPtr->errorMsg(
"Error in ProcessLevel::findJunctions: "
1274 "N(unmatched (anti)colour tags) != 3");
1279 map<int,int> colJun = (kindJun == 1) ? colVertex : acolVertex;
1283 for (map<int,int>::iterator it = colJun.begin();
1284 it != colJun.end(); it++) {
1285 int col = it->first;
1286 int iCol = it->second;
1291 while (junEvent[iColNow].isFinal() && junEvent[iColNow].id() == 21) {
1292 colNow = (kindJun % 2 == 1) ? junEvent[iColNow].acol()
1293 : junEvent[iColNow].col();
1295 for (
int j=0; j<(int)junEvent.size(); ++j) {
1297 if ( !junEvent[j].isFinal() ) {
1298 if ( (kindJun%2 == 1 && junEvent[j].acol() == colNow)
1299 || (kindJun%2 == 0 && junEvent[j].col() == colNow) ) {
1305 else if ( (kindJun%2 == 1 && junEvent[j].col() == colNow)
1306 || (kindJun%2 == 0 && junEvent[j].acol() == colNow) ) {
1312 if (nLoop > (
int)junEvent.size()) {
1313 infoPtr->errorMsg(
"Error in ProcessLevel::findJunctions: "
1314 "failed to trace across final-state gluons");
1319 for (
unsigned int indx = 0; indx < motherList.size(); indx++) {
1320 if (iColNow == motherList[indx]) {
1322 colVec.insert(colVec.begin(),col);
1325 if (colVec.size() == 0 || colVec[0] != col) colVec.push_back(col);
1329 junEvent.appendJunction( kindJun, colVec[0], colVec[1], colVec[2]);
1336 bool foundMatch =
true;
1337 while (foundMatch) {
1339 for (
int iJun=0; iJun<junEvent.sizeJunction(); ++iJun) {
1340 int kindJunA = junEvent.kindJunction(iJun);
1341 for (
int jJun=iJun+1; jJun<junEvent.sizeJunction(); ++jJun) {
1342 int kindJunB = junEvent.kindJunction(jJun);
1344 if ( kindJunA % 2 == kindJunB % 2 )
continue;
1347 for (
int iLeg=0; iLeg<3; ++iLeg)
1348 for (
int jLeg=0; jLeg<3; ++jLeg)
1349 if (junEvent.colJunction(iJun, iLeg) ==
1350 junEvent.colJunction(jJun, jLeg)) ++nMatch;
1356 if (kindJunA >= 5 || kindJunA <= 2) kJun = jJun;
1358 int kindJun = junEvent.kindJunction(kJun);
1359 int col = junEvent.colJunction(kJun,0);
1361 for (
int i=0; i<junEvent.size(); ++i) {
1363 if ( kindJun % 2 == 0 && junEvent[i].col() != col )
continue;
1364 else if ( kindJun % 2 == 1 && junEvent[i].acol() != col )
continue;
1365 else if ( junEvent[i].status() != -22 )
continue;
1367 int iDau1 = junEvent[i].daughter1();
1368 int iDau2 = junEvent[i].daughter2();
1370 for (
int iDau = iDau1; iDau <= iDau2; ++iDau)
1371 if ( (kindJun % 2 == 0 && junEvent[iDau].col() == col)
1372 || (kindJun % 2 == 1 && junEvent[iDau].acol() == col) )
1374 if ( !isBNV )
continue;
1375 vector<int> daughters = junEvent[i].daughterListRecursive();
1376 int lastColTag = junEvent.lastColTag();
1377 for (
int iLeg = 1; iLeg <= 2; ++iLeg) {
1380 int colOld = junEvent.colJunction(kJun, iLeg);
1381 int colNew = (lastColTag/10) * 10 + 10 + colOld % 10 ;
1383 while (junEvent.lastColTag() < colNew) junEvent.nextColTag();
1384 junEvent.colJunction(kJun,iLeg,colNew);
1385 for (
int jDau = 0; jDau < (int)daughters.size(); ++jDau) {
1386 int iDau = daughters[jDau];
1387 if ( kindJun % 2 == 1 && junEvent[iDau].col() == colOld)
1388 junEvent[iDau].col(colNew);
1389 else if ( kindJun % 2 == 0 && junEvent[iDau].acol() == colOld)
1390 junEvent[iDau].acol(colNew);
1405 bool ProcessLevel::checkColours(
Event& process) {
1408 bool physical =
true;
1410 int colType, col, acol, iPos, iNow, iNowA;
1411 vector<int> colTags, colPos, acolPos;
1414 for (
int i = 0; i < process.size(); ++i) {
1415 colType = process[i].colType();
1416 col = process[i].col();
1417 acol = process[i].acol();
1418 if (colType == 0 && (col != 0 || acol != 0)) physical =
false;
1419 else if (colType == 1 && (col <= 0 || acol != 0)) physical =
false;
1420 else if (colType == -1 && (col != 0 || acol <= 0)) physical =
false;
1421 else if (colType == 2 && (col <= 0 || acol <= 0)) physical =
false;
1425 else if (colType == 3 && (col <= 0 || acol >= 0)) physical =
false;
1426 else if (colType == -3 && (col >= 0 || acol <= 0)) physical =
false;
1428 else if (colType == -2 || colType < -3 || colType > 3) physical =
false;
1433 for (
int ic = 0; ic < int(colTags.size()) ; ++ic)
1434 if (col == colTags[ic]) match =
true;
1435 if (!match) colTags.push_back(col);
1436 }
else if (acol > 0) {
1438 for (
int ic = 0; ic < int(colTags.size()) ; ++ic)
1439 if (acol == colTags[ic]) match =
true;
1440 if (!match) colTags.push_back(acol);
1445 for (
int ic = 0; ic < int(colTags.size()) ; ++ic)
1446 if (-col == colTags[ic]) match =
true;
1447 if (!match) colTags.push_back(-col);
1448 }
else if (acol < 0) {
1450 for (
int ic = 0; ic < int(colTags.size()) ; ++ic)
1451 if (-acol == colTags[ic]) match =
true;
1452 if (!match) colTags.push_back(-acol);
1458 infoPtr->errorMsg(
"Error in ProcessLevel::checkColours: "
1459 "incorrect colour assignment");
1464 for (
int iJun = 0; iJun < process.sizeJunction(); ++iJun) {
1465 for (
int j = 0; j < 3; ++j) {
1466 int colJun = process.colJunction(iJun, j);
1467 for (
int ic = 0; ic < int(colTags.size()) ; ++ic)
1468 if (colJun == colTags[ic]) {
1469 colTags[ic] = colTags[colTags.size() - 1];
1477 for (
int ic = 0; ic < int(colTags.size()); ++ic) {
1481 for (
int i = 0; i < process.size(); ++i) {
1482 if (process[i].col() == col || process[i].acol() == -col)
1483 colPos.push_back(i);
1484 if (process[i].acol() == col || process[i].col() == -col)
1485 acolPos.push_back(i);
1489 while (colPos.size() > 1) {
1490 iPos = colPos.size() - 1;
1491 iNow = colPos[iPos];
1492 if ( process[iNow].mother1() == colPos[iPos - 1]
1493 && process[iNow].mother2() == 0) colPos.pop_back();
1496 while (acolPos.size() > 1) {
1497 iPos = acolPos.size() - 1;
1498 iNow = acolPos[iPos];
1499 if ( process[iNow].mother1() == acolPos[iPos - 1]
1500 && process[iNow].mother2() == 0) acolPos.pop_back();
1505 if (colPos.size() + acolPos.size() != 2) physical =
false;
1508 else if (colPos.size() == 2) {
1510 if ( process[iNow].mother1() != colPos[0]
1511 && process[iNow].mother2() != colPos[0] ) physical =
false;
1513 else if (acolPos.size() == 2) {
1515 if ( process[iNowA].mother1() != acolPos[0]
1516 && process[iNowA].mother2() != acolPos[0] ) physical =
false;
1523 if ( process[iNow].status() == -21 && process[iNowA].status() == -21 );
1524 else if ( (process[iNow].mother1() != process[iNowA].mother1())
1525 || (process[iNow].mother2() != process[iNowA].mother2()) )
1532 if (!physical) infoPtr->errorMsg(
"Error in ProcessLevel::checkColours: "
1533 "unphysical colour flow");
1542 void ProcessLevel::statistics2(
bool reset) {
1545 double impactFac = max( 1., infoPtr->enhanceMPIavg() );
1548 double sigma2SelSum = 0.;
1550 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2) {
1551 sigma2SelSum += container2Ptrs[i2]->sigmaSelMC();
1552 n2SelSum += container2Ptrs[i2]->nSelected();
1554 double factor1 = impactFac * maxPDFreweight * sigma2SelSum / sigmaND;
1555 double rel1Err = sqrt(1. / max(1, n2SelSum));
1556 if (allHardSame) factor1 *= 0.5;
1559 double sigma1SelSum = 0.;
1561 for (
int i = 0; i < int(containerPtrs.size()); ++i) {
1562 sigma1SelSum += containerPtrs[i]->sigmaSelMC();
1563 n1SelSum += containerPtrs[i]->nSelected();
1565 double factor2 = impactFac * maxPDFreweight * sigma1SelSum / sigmaND;
1566 if (allHardSame) factor2 *= 0.5;
1567 double rel2Err = sqrt(1. / max(1, n1SelSum));
1570 cout <<
"\n *------- PYTHIA Event and Cross Section Statistics ------"
1571 <<
"--------------------------------------------------*\n"
1574 <<
" | Subprocess Code | "
1575 <<
"Number of events | sigma +- delta |\n"
1577 <<
" Selected Accepted | (estimated) (mb) |\n"
1580 <<
" |------------------------------------------------------------"
1581 <<
"------------------------------------------------|\n"
1584 <<
" | First hard process: | "
1593 double sigmaSum = 0.;
1594 double delta2Sum = 0.;
1597 map<int, string> nameM;
1598 map<int, long> nTryM, nSelM, nAccM;
1599 map<int, double> sigmaM, delta2M;
1602 for (
int i = 0; i < int(containerPtrs.size()); ++i)
1603 if (containerPtrs[i]->sigmaMax() != 0.) {
1606 int code = containerPtrs[i]->code();
1607 nTrySum += containerPtrs[i]->nTried();
1608 nSelSum += containerPtrs[i]->nSelected();
1609 nAccSum += containerPtrs[i]->nAccepted();
1610 sigmaSum += containerPtrs[i]->sigmaMC() * factor1;
1611 delta2Sum += pow2(containerPtrs[i]->deltaMC() * factor1);
1612 nameM[code] = containerPtrs[i]->name();
1613 nTryM[code] += containerPtrs[i]->nTried();
1614 nSelM[code] += containerPtrs[i]->nSelected();
1615 nAccM[code] += containerPtrs[i]->nAccepted();
1616 sigmaM[code] += containerPtrs[i]->sigmaMC() * factor1;
1617 delta2M[code] += pow2(containerPtrs[i]->deltaMC() * factor1);
1618 delta2M[code] += pow2(containerPtrs[i]->sigmaMC() * factor1 * rel1Err);
1622 for (map<int, string>::iterator i = nameM.begin(); i != nameM.end(); ++i) {
1623 int code = i->first;
1624 cout <<
" | " << left << setw(40) << i->second
1625 << right << setw(5) << code <<
" | "
1626 << setw(11) << nTryM[code] <<
" " << setw(10) << nSelM[code] <<
" "
1627 << setw(10) << nAccM[code] <<
" | " << scientific << setprecision(3)
1628 << setw(11) << sigmaM[code]
1629 << setw(11) << sqrtpos(delta2M[code]) <<
" |\n";
1633 delta2Sum += pow2( sigmaSum * rel1Err );
1636 <<
" | " << left << setw(45) <<
"sum" << right <<
" | " << setw(11)
1637 << nTrySum <<
" " << setw(10) << nSelSum <<
" " << setw(10)
1638 << nAccSum <<
" | " << scientific << setprecision(3) << setw(11)
1639 << sigmaSum << setw(11) << sqrtpos(delta2Sum) <<
" |\n";
1644 <<
" |------------------------------------------------------------"
1645 <<
"------------------------------------------------|\n"
1648 <<
" | Second hard process: | "
1669 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2)
1670 if (container2Ptrs[i2]->sigmaMax() != 0.) {
1673 int code = container2Ptrs[i2]->code();
1674 nTrySum += container2Ptrs[i2]->nTried();
1675 nSelSum += container2Ptrs[i2]->nSelected();
1676 nAccSum += container2Ptrs[i2]->nAccepted();
1677 sigmaSum += container2Ptrs[i2]->sigmaMC() * factor2;
1678 delta2Sum += pow2(container2Ptrs[i2]->deltaMC() * factor2);
1679 nameM[code] = container2Ptrs[i2]->name();
1680 nTryM[code] += container2Ptrs[i2]->nTried();
1681 nSelM[code] += container2Ptrs[i2]->nSelected();
1682 nAccM[code] += container2Ptrs[i2]->nAccepted();
1683 sigmaM[code] += container2Ptrs[i2]->sigmaMC() * factor2;
1684 delta2M[code] += pow2(container2Ptrs[i2]->deltaMC() * factor2);
1685 delta2M[code] += pow2(container2Ptrs[i2]->sigmaMC() * factor2 * rel2Err);
1689 for (map<int, string>::iterator i2 = nameM.begin(); i2 != nameM.end();
1691 int code = i2->first;
1692 cout <<
" | " << left << setw(40) << i2->second
1693 << right << setw(5) << code <<
" | "
1694 << setw(11) << nTryM[code] <<
" " << setw(10) << nSelM[code] <<
" "
1695 << setw(10) << nAccM[code] <<
" | " << scientific << setprecision(3)
1696 << setw(11) << sigmaM[code]
1697 << setw(11) << sqrtpos(delta2M[code]) <<
" |\n";
1701 delta2Sum += pow2( sigmaSum * rel2Err );
1704 <<
" | " << left << setw(45) <<
"sum" << right <<
" | " << setw(11)
1705 << nTrySum <<
" " << setw(10) << nSelSum <<
" " << setw(10)
1706 << nAccSum <<
" | " << scientific << setprecision(3) << setw(11)
1707 << sigmaSum << setw(11) << sqrtpos(delta2Sum) <<
" |\n";
1712 <<
" |------------------------------------------------------------"
1713 <<
"------------------------------------------------|\n"
1716 <<
" | Uncombined cross sections for the two event sets were "
1717 << setw(10) << sigma1SelSum <<
" and " << sigma2SelSum <<
" mb, "
1718 <<
"respectively, combined |\n"
1719 <<
" | using a sigma(nonDiffractive) of " << setw(10) << sigmaND
1720 <<
" mb and an impact-parameter enhancement factor of "
1721 << setw(10) << impactFac <<
". |\n";
1726 <<
" *------- End PYTHIA Event and Cross Section Statistics -----"
1727 <<
"------------------------------------------------*" << endl;
1730 if (reset) resetStatistics();