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( Info* infoPtrIn, Settings& settings,
45 ParticleData* particleDataPtrIn, Rndm* rndmPtrIn,
46 BeamParticle* beamAPtrIn, BeamParticle* beamBPtrIn,
47 BeamParticle* beamGamAPtrIn, BeamParticle* beamGamBPtrIn,
48 BeamParticle* beamVMDAPtrIn, BeamParticle* beamVMDBPtrIn,
49 Couplings* couplingsPtrIn, SigmaTotal* sigmaTotPtrIn,
bool doLHA,
50 SLHAinterface* slhaInterfacePtrIn, UserHooks* userHooksPtrIn,
51 vector<SigmaProcess*>& sigmaPtrs, vector<PhaseSpace*>& phaseSpacePtrs) {
55 particleDataPtr = particleDataPtrIn;
57 beamAPtr = beamAPtrIn;
58 beamBPtr = beamBPtrIn;
59 couplingsPtr = couplingsPtrIn;
60 sigmaTotPtr = sigmaTotPtrIn;
61 userHooksPtr = userHooksPtrIn;
62 slhaInterfacePtr = slhaInterfacePtrIn;
65 beamHasGamma = settings.flag(
"PDF:lepton2gamma");
66 gammaMode = settings.mode(
"Photon:ProcessType");
67 bool beamA2gamma = beamAPtr->isLepton() && beamHasGamma;
68 bool beamB2gamma = beamBPtr->isLepton() && beamHasGamma;
72 gammaKin.init(infoPtr, &settings, rndmPtr, beamAPtr, beamBPtr);
75 beamGamAPtr = beamGamAPtrIn;
76 beamGamBPtr = beamGamBPtrIn;
79 beamVMDAPtr = beamVMDAPtrIn;
80 beamVMDBPtr = beamVMDBPtrIn;
83 resonanceDecays.init( infoPtr, particleDataPtr, rndmPtr);
86 sigmaTotPtr->init( infoPtr, settings, particleDataPtr, rndmPtr);
87 int idA = infoPtr->idA();
88 int idB = infoPtr->idB();
89 double eCM = infoPtr->eCM();
91 int idAin = beamA2gamma ? 22 : idA;
92 int idBin = beamB2gamma ? 22 : idB;
93 sigmaTotPtr->calc( idAin, idBin, eCM);
95 else sigmaTotPtr->calc( idA, idB, eCM);
96 sigmaND = sigmaTotPtr->sigmaND();
99 doSecondHard = settings.flag(
"SecondHard:generate");
100 doSameCuts = settings.flag(
"PhaseSpace:sameForSecond");
101 doResDecays = settings.flag(
"ProcessLevel:resonanceDecays");
102 startColTag = settings.mode(
"Event:startColTag");
105 doISR = ( settings.flag(
"PartonLevel:ISR")
106 && settings.flag(
"PartonLevel:all") );
107 doMPI = ( settings.flag(
"PartonLevel:MPI")
108 && settings.flag(
"PartonLevel:all") );
111 if (doSecondHard && userHooksPtr != 0
112 && userHooksPtr->canBiasSelection()) {
113 infoPtr->errorMsg(
"Error in ProcessLevel::init: "
114 "cannot combine second interaction with biased phase space");
119 mHatMin1 = settings.parm(
"PhaseSpace:mHatMin");
120 mHatMax1 = settings.parm(
"PhaseSpace:mHatMax");
121 if (mHatMax1 < mHatMin1) mHatMax1 = eCM;
122 pTHatMin1 = settings.parm(
"PhaseSpace:pTHatMin");
123 pTHatMax1 = settings.parm(
"PhaseSpace:pTHatMax");
124 if (pTHatMax1 < pTHatMin1) pTHatMax1 = eCM;
125 mHatMin2 = settings.parm(
"PhaseSpace:mHatMinSecond");
126 mHatMax2 = settings.parm(
"PhaseSpace:mHatMaxSecond");
127 if (mHatMax2 < mHatMin2) mHatMax2 = eCM;
128 pTHatMin2 = settings.parm(
"PhaseSpace:pTHatMinSecond");
129 pTHatMax2 = settings.parm(
"PhaseSpace:pTHatMaxSecond");
130 if (pTHatMax2 < pTHatMin2) pTHatMax2 = eCM;
133 cutsAgree = doSameCuts;
134 if (mHatMin2 == mHatMin1 && mHatMax2 == mHatMax1 && pTHatMin2 == pTHatMin1
135 && pTHatMax2 == pTHatMax1) cutsAgree =
true;
136 cutsOverlap = cutsAgree;
138 bool mHatOverlap = (max( mHatMin1, mHatMin2)
139 < min( mHatMax1, mHatMax2));
140 bool pTHatOverlap = (max( pTHatMin1, pTHatMin2)
141 < min( pTHatMax1, pTHatMax2));
142 if (mHatOverlap && pTHatOverlap) cutsOverlap =
true;
146 SetupContainers setupContainers;
147 setupContainers.init(containerPtrs, infoPtr, settings, particleDataPtr,
151 if (sigmaPtrs.size() > 0) {
152 for (
int iSig = 0; iSig < int(sigmaPtrs.size()); ++iSig)
153 containerPtrs.push_back(
new ProcessContainer(sigmaPtrs[iSig],
154 true, phaseSpacePtrs[iSig]) );
159 SigmaProcess* sigmaPtr =
new SigmaLHAProcess();
160 containerPtrs.push_back(
new ProcessContainer(sigmaPtr) );
163 iLHACont = containerPtrs.size() - 1;
164 containerPtrs[iLHACont]->setLHAPtr(lhaUpPtr);
168 if (
int(containerPtrs.size()) == 0) {
169 infoPtr->errorMsg(
"Error in ProcessLevel::init: "
170 "no process switched on");
175 if (settings.flag(
"PhaseSpace:bias2Selection")) {
176 bool bias2Sel =
false;
177 if (sigmaPtrs.size() == 0 && !doLHA && !doSecondHard) {
179 for (
int i = 0; i < int(containerPtrs.size()); ++i) {
180 if (containerPtrs[i]->nFinal() != 2) bias2Sel =
false;
181 int code = containerPtrs[i]->code();
182 if (code > 100 && code < 110) bias2Sel =
false;
186 infoPtr->errorMsg(
"Error in ProcessLevel::init: "
187 "requested event weighting not possible");
193 bool hasSUSY =
false;
194 for (
int i = 0; i < int(containerPtrs.size()); ++i)
195 if (containerPtrs[i]->isSUSY()) hasSUSY =
true;
198 if (hasSUSY && !couplingsPtr->isSUSY) {
199 infoPtr->errorMsg(
"Error in ProcessLevel::init: "
200 "SUSY process switched on but no SUSY couplings found");
205 slhaInterfacePtr->pythia2slha(particleDataPtr);
209 for (
int i = 0; i < int(containerPtrs.size()); ++i)
210 if (containerPtrs[i]->init(
true, infoPtr, settings, particleDataPtr,
211 rndmPtr, beamAPtr, beamBPtr, couplingsPtr, sigmaTotPtr,
212 &resonanceDecays, slhaInterfacePtr, userHooksPtr, &gammaKin))
217 for (
int i = 0; i < int(containerPtrs.size()); ++i)
218 sigmaMaxSum += containerPtrs[i]->sigmaMax();
223 setupContainers.init2(container2Ptrs, settings);
224 if (
int(container2Ptrs.size()) == 0) {
225 infoPtr->errorMsg(
"Error in ProcessLevel::init: "
226 "no second hard process switched on");
229 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2)
230 if (container2Ptrs[i2]->init(
false, infoPtr, settings, particleDataPtr,
231 rndmPtr, beamAPtr, beamBPtr, couplingsPtr, sigmaTotPtr,
232 &resonanceDecays, slhaInterfacePtr, userHooksPtr, &gammaKin))
236 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2)
237 sigma2MaxSum += container2Ptrs[i2]->sigmaMax();
241 if (settings.flag(
"Init:showProcesses")) {
244 string collision =
"We collide " + particleDataPtr->name(idA)
245 +
" with " + particleDataPtr->name(idB) +
" at a CM energy of ";
246 string pad( max( 0, 51 -
int(collision.length())),
' ');
249 cout <<
"\n *------- PYTHIA Process Initialization ---------"
250 <<
"-----------------*\n"
253 <<
" | " << collision << scientific << setprecision(3)
254 << setw(9) << eCM <<
" GeV" << pad <<
" |\n"
257 <<
" |---------------------------------------------------"
258 <<
"---------------|\n"
261 <<
" | Subprocess Code"
262 <<
" | Estimated |\n"
267 <<
" |---------------------------------------------------"
268 <<
"---------------|\n"
273 map<int, double> sigmaMaxM;
274 map<int, string> nameM;
275 for (
int i = 0; i < int(containerPtrs.size()); ++i) {
276 int code = containerPtrs[i]->code();
277 nameM[code] = containerPtrs[i]->name();
278 sigmaMaxM[code] = containerPtrs[i]->sigmaMax() > sigmaMaxM[code] ?
279 containerPtrs[i]->sigmaMax() : sigmaMaxM[code];
281 for (map<int, string>::iterator i = nameM.begin(); i != nameM.end(); ++i)
282 cout <<
" | " << left << setw(45) << i->second
283 << right << setw(5) << i->first <<
" | "
284 << scientific << setprecision(3) << setw(11)
285 << sigmaMaxM[i->first] <<
" |\n";
291 <<
" |---------------------------------------------------"
292 <<
"---------------|\n"
297 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2) {
298 int code = container2Ptrs[i2]->code();
299 nameM[code] = container2Ptrs[i2]->name();
300 sigmaMaxM[code] = container2Ptrs[i2]->sigmaMax() > sigmaMaxM[code] ?
301 container2Ptrs[i2]->sigmaMax() : sigmaMaxM[code];
303 for (map<int, string>::iterator i2 = nameM.begin(); i2 != nameM.end();
305 cout <<
" | " << left << setw(45) << i2->second
306 << right << setw(5) << i2->first <<
" | "
307 << scientific << setprecision(3) << setw(11)
308 << sigmaMaxM[i2->first] <<
" |\n";
314 <<
" *------- End PYTHIA Process Initialization ----------"
315 <<
"-------------*" << endl;
319 if ( numberOn == 0 || sigmaMaxSum <= 0.) {
320 infoPtr->errorMsg(
"Error in ProcessLevel::init: "
321 "all processes have vanishing cross sections");
324 if ( doSecondHard && (number2On == 0 || sigma2MaxSum <= 0.) ) {
325 infoPtr->errorMsg(
"Error in ProcessLevel::init: "
326 "all second hard processes have vanishing cross sections");
334 bool foundMatch =
false;
337 for (
int i = 0; i < int(containerPtrs.size()); ++i) {
340 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2)
341 if (container2Ptrs[i2]->code() == containerPtrs[i]->code())
343 containerPtrs[i]->isSame( foundMatch );
344 if (!foundMatch) allHardSame =
false;
345 if ( foundMatch) noneHardSame =
false;
349 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2) {
352 for (
int i = 0; i < int(containerPtrs.size()); ++i)
353 if (containerPtrs[i]->code() == container2Ptrs[i2]->code())
355 container2Ptrs[i2]->isSame( foundMatch );
356 if (!foundMatch) allHardSame =
false;
357 if ( foundMatch) noneHardSame =
false;
362 if (!cutsAgree) allHardSame =
false;
363 someHardSame = !allHardSame && !noneHardSame;
373 bool ProcessLevel::next(
Event& process) {
376 bool physical = (doSecondHard) ? nextTwo( process) : nextOne( process);
379 if (physical) physical = checkColours( process);
389 bool ProcessLevel::nextLHAdec(
Event& process) {
392 infoPtr->setEndOfFile(
false);
393 if (!lhaUpPtr->setEvent()) {
394 infoPtr->setEndOfFile(
true);
399 containerLHAdec.constructDecays( process);
409 void ProcessLevel::accumulate(
bool doAccumulate) {
412 if (doAccumulate) containerPtrs[iContainer]->accumulate();
418 double sigmaSum = 0.;
419 double delta2Sum = 0.;
420 double sigSelSum = 0.;
421 double weightSum = 0.;
423 long nTryNow, nSelNow, nAccNow;
424 double sigmaNow, deltaNow, sigSelNow, weightNow;
425 map<int, bool> duplicate;
426 for (
int i = 0; i < int(containerPtrs.size()); ++i)
427 if (containerPtrs[i]->sigmaMax() != 0.) {
428 codeNow = containerPtrs[i]->code();
429 nTryNow = containerPtrs[i]->nTried();
430 nSelNow = containerPtrs[i]->nSelected();
431 nAccNow = containerPtrs[i]->nAccepted();
432 sigmaNow = containerPtrs[i]->sigmaMC(doAccumulate);
433 deltaNow = containerPtrs[i]->deltaMC(doAccumulate);
434 sigSelNow = containerPtrs[i]->sigmaSelMC(doAccumulate);
435 weightNow = containerPtrs[i]->weightSum();
439 sigmaSum += sigmaNow;
440 delta2Sum += pow2(deltaNow);
441 sigSelSum += sigSelNow;
442 weightSum += weightNow;
444 if (!duplicate[codeNow])
445 infoPtr->setSigma( codeNow, containerPtrs[i]->name(),
446 nTryNow, nSelNow, nAccNow, sigmaNow, deltaNow, weightNow);
448 infoPtr->addSigma( codeNow, nTryNow, nSelNow, nAccNow, sigmaNow,
450 duplicate[codeNow] =
true;
456 double deltaSum = sqrtpos(delta2Sum);
457 infoPtr->setSigma( 0,
"sum", nTrySum, nSelSum, nAccSum, sigmaSum, deltaSum,
463 if (doAccumulate) container2Ptrs[i2Container]->accumulate();
466 double sigma2Sum = 0.;
467 double sig2SelSum = 0.;
468 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2)
469 if (container2Ptrs[i2]->sigmaMax() != 0.) {
470 nTrySum += container2Ptrs[i2]->nTried();
471 if (doAccumulate) sigma2Sum += container2Ptrs[i2]->sigmaMC();
472 if (doAccumulate) sig2SelSum += container2Ptrs[i2]->sigmaSelMC();
476 double impactFac = max( 1., infoPtr->enhanceMPIavg() );
480 double sigmaComb = 0.5 * (sigmaSum * sig2SelSum + sigSelSum * sigma2Sum);
481 sigmaComb *= impactFac / sigmaND;
482 if (allHardSame) sigmaComb *= 0.5;
483 double deltaComb = (nAccSum == 0) ? 0. : sqrtpos(2. / nAccSum) * sigmaComb;
486 infoPtr->setSigma( 0,
"sum", nTrySum, nSelSum, nAccSum, sigmaComb, deltaComb,
495 void ProcessLevel::statistics(
bool reset) {
504 cout <<
"\n *------- PYTHIA Event and Cross Section Statistics ------"
505 <<
"-------------------------------------------------------*\n"
508 <<
" | Subprocess Code | "
509 <<
" Number of events | sigma +- delta |\n"
511 <<
"Tried Selected Accepted | (estimated) (mb) |\n"
514 <<
" |------------------------------------------------------------"
515 <<
"-----------------------------------------------------|\n"
523 double sigmaSum = 0.;
524 double delta2Sum = 0.;
527 map<int, string> nameM;
528 map<int, long> nTryM, nSelM, nAccM;
529 map<int, double> sigmaM, delta2M;
530 vector<ProcessContainer*> lheContainerPtrs;
533 for (
int i = 0; i < int(containerPtrs.size()); ++i)
534 if (containerPtrs[i]->sigmaMax() != 0.) {
537 nTrySum += containerPtrs[i]->nTried();
538 nSelSum += containerPtrs[i]->nSelected();
539 nAccSum += containerPtrs[i]->nAccepted();
540 sigmaSum += containerPtrs[i]->sigmaMC();
541 delta2Sum += pow2(containerPtrs[i]->deltaMC());
544 if (containerPtrs[i]->code() == 9999) {
545 lheContainerPtrs.push_back(containerPtrs[i]);
550 int code = containerPtrs[i]->code();
551 nameM[code] = containerPtrs[i]->name();
552 nTryM[code] += containerPtrs[i]->nTried();
553 nSelM[code] += containerPtrs[i]->nSelected();
554 nAccM[code] += containerPtrs[i]->nAccepted();
555 sigmaM[code] += containerPtrs[i]->sigmaMC();
556 delta2M[code]+= pow2(containerPtrs[i]->deltaMC());
560 for (map<int, string>::iterator i = nameM.begin(); i != nameM.end(); ++i) {
562 cout <<
" | " << left << setw(45) << i->second
563 << right << setw(5) << code <<
" | "
564 << setw(11) << nTryM[code] <<
" " << setw(10) << nSelM[code] <<
" "
565 << setw(10) << nAccM[code] <<
" | " << scientific << setprecision(3)
566 << setw(11) << sigmaM[code]
567 << setw(11) << sqrtpos(delta2M[code]) <<
" |\n";
571 for (
int i = 0; i < int(lheContainerPtrs.size()); ++i) {
572 ProcessContainer *ptr = lheContainerPtrs[i];
573 cout <<
" | " << left << setw(45) << ptr->name()
574 << right << setw(5) << ptr->code() <<
" | "
575 << setw(11) << ptr->nTried() <<
" " << setw(10) << ptr->nSelected()
576 <<
" " << setw(10) << ptr->nAccepted() <<
" | " << scientific
577 << setprecision(3) << setw(11) << ptr->sigmaMC() << setw(11)
578 << ptr->deltaMC() <<
" |\n";
581 for (
int j = 0; j < ptr->codeLHASize(); ++j)
582 cout <<
" | ... whereof user classification code " << setw(10)
583 << ptr->subCodeLHA(j) <<
" | " << setw(11) << ptr->nTriedLHA(j)
584 <<
" " << setw(10) << ptr->nSelectedLHA(j) <<
" " << setw(10)
585 << ptr->nAcceptedLHA(j) <<
" | | \n";
591 <<
" | " << left << setw(50) <<
"sum" << right <<
" | " << setw(11)
592 << nTrySum <<
" " << setw(10) << nSelSum <<
" " << setw(10)
593 << nAccSum <<
" | " << scientific << setprecision(3) << setw(11)
594 << sigmaSum << setw(11) << sqrtpos(delta2Sum) <<
" |\n";
599 <<
" *------- End PYTHIA Event and Cross Section Statistics -----"
600 <<
"-----------------------------------------------------*" << endl;
603 if (reset) resetStatistics();
611 void ProcessLevel::resetStatistics() {
613 for (
int i = 0; i < int(containerPtrs.size()); ++i)
614 containerPtrs[i]->reset();
616 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2)
617 container2Ptrs[i2]->reset();
625 bool ProcessLevel::nextOne(
Event& process) {
628 double eCM = infoPtr->eCM();
629 for (
int i = 0; i < int(containerPtrs.size()); ++i)
630 containerPtrs[i]->newECM(eCM);
633 bool physical =
true;
634 for (
int loop = 0; loop < MAXLOOP; ++loop) {
635 if (!physical) process.clear();
642 double sigmaMaxNow = sigmaMaxSum * rndmPtr->flat();
643 int iMax = containerPtrs.size() - 1;
645 do sigmaMaxNow -= containerPtrs[++iContainer]->sigmaMax();
646 while (sigmaMaxNow > 0. && iContainer < iMax);
649 if (containerPtrs[iContainer]->trialProcess())
break;
652 if (infoPtr->atEndOfFile())
return false;
656 if (containerPtrs[iContainer]->newSigmaMax()) {
658 for (
int i = 0; i < int(containerPtrs.size()); ++i)
659 sigmaMaxSum += containerPtrs[i]->sigmaMax();
663 containerPtrs[iContainer]->constructState();
664 if ( !containerPtrs[iContainer]->constructProcess( process) )
669 beamGamAPtr->setGammaMode(beamAPtr->getGammaMode());
670 beamGamBPtr->setGammaMode(beamBPtr->getGammaMode());
674 if ( physical && doResDecays
675 && !containerPtrs[iContainer]->decayResonances( process) )
679 for (
int i =1; i < process.size(); ++i)
680 if (process[i].e() < 0.) {
681 infoPtr->errorMsg(
"Error in ProcessLevel::nextOne: "
682 "Constructed particle with negative energy.");
687 if (physical) findJunctions( process);
692 if ( ( ( ( beamAPtr->isGamma() && !beamAPtr->isUnresolved() )
693 || ( beamBPtr->isGamma() && !beamBPtr->isUnresolved() ) )
694 || ( beamAPtr->hasResGamma() || beamBPtr->hasResGamma() ) )
695 && !containerPtrs[iContainer]->isSoftQCD() ) {
696 if ( !roomForRemnants() ) {
707 if (infoPtr->isVMDstateA()) {
708 beamVMDAPtr->setGammaMode(beamAPtr->getGammaMode());
709 beamVMDAPtr->setVMDstate(
true, infoPtr->idVMDA(), infoPtr->mVMDA(),
710 infoPtr->scaleVMDA(),
true);
712 if (infoPtr->isVMDstateB()) {
713 beamVMDBPtr->setGammaMode(beamBPtr->getGammaMode());
714 beamVMDBPtr->setVMDstate(
true, infoPtr->idVMDB(), infoPtr->mVMDB(),
715 infoPtr->scaleVMDB(),
true);
726 bool ProcessLevel::nextTwo(
Event& process) {
729 double eCM = infoPtr->eCM();
730 for (
int i = 0; i < int(containerPtrs.size()); ++i)
731 containerPtrs[i]->newECM(eCM);
732 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2)
733 container2Ptrs[i2]->newECM(eCM);
736 bool physical =
true;
737 for (
int loop = 0; loop < MAXLOOP; ++loop) {
738 if (!physical) process.clear();
748 double sigmaMaxNow = sigmaMaxSum * rndmPtr->flat();
749 int iMax = containerPtrs.size() - 1;
751 do sigmaMaxNow -= containerPtrs[++iContainer]->sigmaMax();
752 while (sigmaMaxNow > 0. && iContainer < iMax);
755 if (containerPtrs[iContainer]->trialProcess())
break;
758 if (infoPtr->atEndOfFile())
return false;
762 if (containerPtrs[iContainer]->newSigmaMax()) {
764 for (
int i = 0; i < int(containerPtrs.size()); ++i)
765 sigmaMaxSum += containerPtrs[i]->sigmaMax();
772 double sigma2MaxNow = sigma2MaxSum * rndmPtr->flat();
773 int i2Max = container2Ptrs.size() - 1;
775 do sigma2MaxNow -= container2Ptrs[++i2Container]->sigmaMax();
776 while (sigma2MaxNow > 0. && i2Container < i2Max);
779 if (container2Ptrs[i2Container]->trialProcess())
break;
783 if (container2Ptrs[i2Container]->newSigmaMax()) {
785 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2)
786 sigma2MaxSum += container2Ptrs[i2]->sigmaMax();
790 containerPtrs[iContainer]->constructState();
791 container2Ptrs[i2Container]->constructState();
794 double xA1 = containerPtrs[iContainer]->x1();
795 double xB1 = containerPtrs[iContainer]->x2();
796 double xA2 = container2Ptrs[i2Container]->x1();
797 double xB2 = container2Ptrs[i2Container]->x2();
798 if (xA1 + xA2 >= 1. || xB1 + xB2 >= 1.)
continue;
804 int idA1 = containerPtrs[iContainer]->id1();
805 int idB1 = containerPtrs[iContainer]->id2();
806 int idA2 = container2Ptrs[i2Container]->id1();
807 int idB2 = container2Ptrs[i2Container]->id2();
808 double Q2Fac1 = containerPtrs[iContainer]->Q2Fac();
809 double Q2Fac2 = container2Ptrs[i2Container]->Q2Fac();
810 double pdfA2Raw = beamAPtr->xf( idA2, xA2,Q2Fac2);
811 double pdfB2Raw = beamBPtr->xf( idB2, xB2,Q2Fac2);
814 beamAPtr->append( 3, idA1, xA1);
815 beamAPtr->xfISR( 0, idA1, xA1, Q2Fac1);
816 beamAPtr->pickValSeaComp();
817 beamBPtr->append( 4, idB1, xB1);
818 beamBPtr->xfISR( 0, idB1, xB1, Q2Fac1);
819 beamBPtr->pickValSeaComp();
822 double pdfA2Mod = beamAPtr->xfMPI( idA2, xA2,Q2Fac2);
823 double pdfB2Mod = beamBPtr->xfMPI( idB2, xB2,Q2Fac2);
824 double wtPdfMod = (pdfA2Mod * pdfB2Mod) / (pdfA2Raw * pdfB2Raw);
825 if (wtPdfMod < rndmPtr->flat())
continue;
830 if ( someHardSame && containerPtrs[iContainer]->isSame()
831 && container2Ptrs[i2Container]->isSame()) {
833 if (rndmPtr->flat() > 0.5) toLoop =
true;
835 double mHat1 = containerPtrs[iContainer]->mHat();
836 double pTHat1 = containerPtrs[iContainer]->pTHat();
837 double mHat2 = container2Ptrs[i2Container]->mHat();
838 double pTHat2 = container2Ptrs[i2Container]->pTHat();
839 if (mHat1 > mHatMin2 && mHat1 < mHatMax2
840 && pTHat1 > pTHatMin2 && pTHat1 < pTHatMax2
841 && mHat2 > mHatMin1 && mHat2 < mHatMax1
842 && pTHat2 > pTHatMin1 && pTHat2 < pTHatMax1
843 && rndmPtr->flat() > 0.5) toLoop =
true;
846 if (toLoop)
continue;
854 process2.init(
"(second hard)", particleDataPtr, startColTag);
855 process2.initColTag();
856 if ( !containerPtrs[iContainer]->constructProcess( process) )
858 if (physical && !container2Ptrs[i2Container]->constructProcess( process2,
859 false) ) physical =
false;
862 if ( physical && doResDecays
863 && !containerPtrs[iContainer]->decayResonances( process) )
865 if ( physical && doResDecays
866 && !container2Ptrs[i2Container]->decayResonances( process2) )
870 if (physical) combineProcessRecords( process, process2);
873 if (physical) findJunctions( process);
888 bool ProcessLevel::roomForRemnants() {
891 bool beamAhasResGamma = beamAPtr->hasResGamma();
892 bool beamBhasResGamma = beamBPtr->hasResGamma();
893 bool beamHasResGamma = beamAhasResGamma || beamBhasResGamma;
894 BeamParticle* tmpBeamAPtr = beamAhasResGamma ? beamGamAPtr : beamAPtr;
895 BeamParticle* tmpBeamBPtr = beamBhasResGamma ? beamGamBPtr : beamBPtr;
898 bool resGammaA = !(beamGamAPtr->isUnresolved());
899 bool resGammaB = !(beamGamBPtr->isUnresolved());
902 double xGamma1 = beamAPtr->xGamma();
903 double xGamma2 = beamBPtr->xGamma();
906 tmpBeamAPtr->posVal(-1);
907 tmpBeamBPtr->posVal(-1);
910 int id1 = containerPtrs[iContainer]->id1();
911 int id2 = containerPtrs[iContainer]->id2();
912 double x1 = containerPtrs[iContainer]->x1();
913 double x2 = containerPtrs[iContainer]->x2();
914 double Q2 = containerPtrs[iContainer]->Q2Fac();
917 double eCMgmgm = infoPtr->eCM();
920 if (beamHasResGamma) eCMgmgm = infoPtr->eCMsub();
926 if ( ( (resGammaA && !resGammaB) || (!resGammaA && resGammaB) )
927 && beamHasResGamma ) {
928 double wTot = infoPtr->eCMsub();
929 double w2scat = infoPtr->sHatNew();
930 mTRem = wTot - sqrt(w2scat);
933 }
else if ( tmpBeamAPtr->isUnresolved() && !tmpBeamBPtr->isUnresolved() ) {
934 mTRem = eCMgmgm*( 1. - sqrt( x2) );
935 }
else if ( !tmpBeamAPtr->isUnresolved() && tmpBeamBPtr->isUnresolved() ) {
936 mTRem = eCMgmgm*( 1. - sqrt( x1) );
942 if ( beamAhasResGamma && beamBhasResGamma) {
946 double sCM = infoPtr->s();
947 x1 /= xGamma1 * pow2(eCMgmgm) / ( xGamma1 * xGamma2 * sCM);
948 x2 /= xGamma2 * pow2(eCMgmgm) / ( xGamma1 * xGamma2 * sCM);
952 mTRem = eCMgmgm * sqrt( (1. - x1)*(1. - x2) );
956 double m1 = 0, m2 = 0;
957 bool physical =
false;
960 if ( !doISR && !doMPI ) {
963 int nTry = 0, maxTry = 4;
969 bool init1Val = tmpBeamAPtr->isGamma() ?
970 tmpBeamAPtr->gammaInitiatorIsVal(0, id1, x1, Q2) :
false;
971 bool init2Val = tmpBeamBPtr->isGamma() ?
972 tmpBeamBPtr->gammaInitiatorIsVal(0, id2, x2, Q2) :
false;
980 if ( tmpBeamAPtr->isGamma() ) {
983 }
else if (init1Val) {
984 m1 = particleDataPtr->m0(id1);
986 m1 = 2*( particleDataPtr->m0( tmpBeamAPtr->getGammaValFlavour() ) );
987 if (id1 != 21) m1 += particleDataPtr->m0(id1);
991 }
else if ( tmpBeamAPtr->isHadron() ) {
992 m1 = particleDataPtr->m0(tmpBeamAPtr->id());
995 int valSign1 = (tmpBeamAPtr->nValence(id1) > 0) ? -1 : 1;
996 m1 = m1 + valSign1 * particleDataPtr->m0(id1);
1000 if ( tmpBeamBPtr->isGamma() ) {
1003 }
else if (init2Val) {
1004 m2 = particleDataPtr->m0(id2);
1006 m2 = 2*( particleDataPtr->m0( tmpBeamBPtr->getGammaValFlavour() ) );
1007 if (id2 != 21) m2 += particleDataPtr->m0(id2);
1011 }
else if ( tmpBeamBPtr->isHadron() ) {
1012 m2 = particleDataPtr->m0(tmpBeamBPtr->id());
1015 int valSign2 = (tmpBeamBPtr->nValence(id2) > 0) ? -1 : 1;
1016 m2 = m2 + valSign2 * particleDataPtr->m0(id2);
1020 physical = ( (m1 + m2) < mTRem );
1024 if (nTry == maxTry) {
1025 if ( abs(id1) == 5 || abs(id2) == 5 ) {
1026 infoPtr->errorMsg(
"Warning in ProcessLevel::roomForRemnants: "
1027 "No room for bottom quarks in beam remnants");
1028 }
else if ( abs(id1) == 4 || abs(id2) == 4 ) {
1029 infoPtr->errorMsg(
"Warning in ProcessLevel::roomForRemnants: "
1030 "No room for charm quarks in beam remnants");
1032 infoPtr->errorMsg(
"Warning in ProcessLevel::roomForRemnants: "
1033 "No room for light quarks in beam remnants");
1047 if ( tmpBeamAPtr->isGamma() ) {
1048 m1 = (id1 == 21) ? 2*( particleDataPtr->m0( idLight ) ) :
1049 particleDataPtr->m0( id1 );
1050 }
else if ( tmpBeamAPtr->isHadron() ) {
1051 m1 = particleDataPtr->m0( tmpBeamAPtr->id() );
1052 int valSign1 = (tmpBeamAPtr->nValence(id1) > 0) ? -1 : 1;
1053 m1 = m1 + valSign1 * particleDataPtr->m0(id1);
1057 if ( tmpBeamBPtr->isGamma() ) {
1058 m2 = (id2 == 21) ? 2*( particleDataPtr->m0( idLight ) ) :
1059 particleDataPtr->m0( id2 );
1060 }
else if ( tmpBeamBPtr->isHadron() ) {
1061 m2 = particleDataPtr->m0( tmpBeamBPtr->id() );
1062 int valSign2 = (tmpBeamBPtr->nValence(id2) > 0) ? -1 : 1;
1063 m2 = m2 + valSign2 * particleDataPtr->m0(id2);
1067 if ( !resGammaA && !(tmpBeamAPtr->isHadron()) ) m1 = 0;
1068 if ( !resGammaB && !(tmpBeamBPtr->isHadron()) ) m2 = 0;
1071 physical = ( (m1 + m2) < mTRem );
1072 if (physical ==
false) {
1073 if ( abs(id1) == 5 || abs(id2) == 5 ) {
1074 infoPtr->errorMsg(
"Warning in ProcessLevel::roomForRemnants: "
1075 "No room for bottom quarks in beam remnants");
1076 }
else if ( abs(id1) == 4 || abs(id2) == 4 ) {
1077 infoPtr->errorMsg(
"Warning in ProcessLevel::roomForRemnants: "
1078 "No room for charm quarks in beam remnants");
1080 infoPtr->errorMsg(
"Warning in ProcessLevel::roomForRemnants: "
1081 "No room for light quarks in beam remnants");
1094 void ProcessLevel::combineProcessRecords(
Event& process,
Event& process2) {
1097 int nSize = process.size();
1099 while (nHard < nSize && process[nHard].mother1() == 3) ++nHard;
1102 vector<Particle> resProd;
1103 if (nSize > nHard) {
1104 for (
int i = nHard; i < nSize; ++i) resProd.push_back( process[i] );
1105 process.popBack(nSize - nHard);
1109 int nSize2 = process2.size();
1111 while (nHard2 < nSize2 && process2[nHard2].mother1() == 3) ++nHard2;
1114 int addPos = nHard - 3;
1115 int addCol = process.lastColTag() - startColTag;
1118 for (
int i = 3; i < nSize2; ++i) {
1121 process2[i].offsetHistory( 2, addPos, 2, addPos);
1122 process2[i].offsetCol( addCol);
1125 if (i < nHard2) process.append( process2[i] );
1129 int addPos2 = nHard2 - 3;
1130 if (nHard < nSize) {
1133 for (
int i = 5; i < nHard; ++i)
1134 process[i].offsetHistory( 0, 0, nHard - 1, addPos2);
1137 for (
int i = 0; i < int(resProd.size()); ++i) {
1138 resProd[i].offsetHistory( nHard - 1, addPos2, nHard - 1, addPos2);
1139 process.append( resProd[i] );
1144 if (nHard2 < nSize2) {
1145 int nHard3 = nHard + nHard2 - 3;
1146 int addPos3 = nSize - nHard;
1149 for (
int i = nHard + 2; i < nHard3; ++i)
1150 process[i].offsetHistory( 0, 0, nHard3 - 1, addPos3);
1153 for (
int i = nHard2; i < nSize2; ++i) {
1154 process2[i].offsetHistory( nHard3 - 1, addPos3, nHard3 - 1, addPos3);
1155 process.append( process2[i] );
1160 process.scaleSecond( process2.scale() );
1169 void ProcessLevel::findJunctions(
Event& junEvent) {
1172 for (
int i = 1; i<junEvent.size(); i++) {
1176 if (abs(junEvent[i].status()) <= 21 || junEvent[i].colType() == 0)
1178 vector<int> motherList = junEvent[i].motherList();
1179 int iMot1 = motherList[0];
1180 vector<int> sisterList = junEvent[iMot1].daughterList();
1184 map<int,int> colVertex, acolVertex;
1187 for (
unsigned int indx = 0; indx < motherList.size(); indx++) {
1188 int iMot = motherList[indx];
1189 if ( abs(junEvent[iMot].colType()) == 1 )
1190 barSum -= junEvent[iMot].colType();
1191 else if ( abs(junEvent[iMot].colType()) == 3)
1192 barSum -= 2*junEvent[iMot].colType()/3;
1193 int col = junEvent[iMot].acol();
1194 int acol = junEvent[iMot].col();
1198 if (acolVertex.find(col) == acolVertex.end() ) colVertex[col] = iMot;
1199 else acolVertex.erase(col);
1200 }
else if (col < 0) {
1201 if (colVertex.find(-col) == colVertex.end() ) acolVertex[-col] = iMot;
1202 else colVertex.erase(-col);
1205 if (colVertex.find(acol) == colVertex.end()) acolVertex[acol] = iMot;
1206 else colVertex.erase(acol);
1207 }
else if (acol < 0) {
1208 if (acolVertex.find(-acol) == acolVertex.end())
1209 colVertex[-acol] = iMot;
1210 else acolVertex.erase(-acol);
1215 for (
unsigned int indx = 0; indx < sisterList.size(); indx++) {
1216 int iDau = sisterList[indx];
1217 if ( abs(junEvent[iDau].colType()) == 1 )
1218 barSum += junEvent[iDau].colType();
1219 else if ( abs(junEvent[iDau].colType()) == 3)
1220 barSum += 2*junEvent[iDau].colType()/3;
1221 int col = junEvent[iDau].col();
1222 int acol = junEvent[iDau].acol();
1226 if (acolVertex.find(col) == acolVertex.end() ) colVertex[col] = iDau;
1227 else acolVertex.erase(col);
1228 }
else if (col < 0) {
1229 if (colVertex.find(-col) == colVertex.end() ) acolVertex[-col] = iDau;
1230 else colVertex.erase(-col);
1233 if (colVertex.find(acol) == colVertex.end()) acolVertex[acol] = iDau;
1234 else colVertex.erase(acol);
1235 }
else if (acol < 0) {
1236 if (acolVertex.find(-acol) == acolVertex.end())
1237 colVertex[-acol] = iDau;
1238 else acolVertex.erase(-acol);
1244 if (barSum == 0)
continue;
1247 for (
int iJun = 0; iJun < junEvent.sizeJunction(); ++iJun) {
1249 for (
int j = 0; j < 3; ++j) {
1250 int colNow = junEvent.colJunction(iJun, j);
1251 if (junEvent.kindJunction(iJun) % 2 == 1) colVertex.erase(colNow);
1252 else acolVertex.erase(colNow);
1257 if (colVertex.size() == 0 && acolVertex.size() == 0)
continue;
1261 if (colVertex.size() == 3 && acolVertex.size() == 0) kindJun = 1;
1262 else if (colVertex.size() == 0 && acolVertex.size() == 3) kindJun = 2;
1264 infoPtr->errorMsg(
"Error in ProcessLevel::findJunctions: "
1265 "N(unmatched (anti)colour tags) != 3");
1270 map<int,int> colJun = (kindJun == 1) ? colVertex : acolVertex;
1274 for (map<int,int>::iterator it = colJun.begin();
1275 it != colJun.end(); it++) {
1276 int col = it->first;
1277 int iCol = it->second;
1282 while (junEvent[iColNow].isFinal() && junEvent[iColNow].id() == 21) {
1283 colNow = (kindJun % 2 == 1) ? junEvent[iColNow].acol()
1284 : junEvent[iColNow].col();
1286 for (
int j=0; j<(int)junEvent.size(); ++j) {
1288 if ( !junEvent[j].isFinal() ) {
1289 if ( (kindJun%2 == 1 && junEvent[j].acol() == colNow)
1290 || (kindJun%2 == 0 && junEvent[j].col() == colNow) ) {
1296 else if ( (kindJun%2 == 1 && junEvent[j].col() == colNow)
1297 || (kindJun%2 == 0 && junEvent[j].acol() == colNow) ) {
1303 if (nLoop > (
int)junEvent.size()) {
1304 infoPtr->errorMsg(
"Error in ProcessLevel::findJunctions: "
1305 "failed to trace across final-state gluons");
1310 for (
unsigned int indx = 0; indx < motherList.size(); indx++) {
1311 if (iColNow == motherList[indx]) {
1313 colVec.insert(colVec.begin(),col);
1316 if (colVec.size() == 0 || colVec[0] != col) colVec.push_back(col);
1320 junEvent.appendJunction( kindJun, colVec[0], colVec[1], colVec[2]);
1327 bool foundMatch =
true;
1328 while (foundMatch) {
1330 for (
int iJun=0; iJun<junEvent.sizeJunction(); ++iJun) {
1331 int kindJunA = junEvent.kindJunction(iJun);
1332 for (
int jJun=iJun+1; jJun<junEvent.sizeJunction(); ++jJun) {
1333 int kindJunB = junEvent.kindJunction(jJun);
1335 if ( kindJunA % 2 == kindJunB % 2 )
continue;
1338 for (
int iLeg=0; iLeg<3; ++iLeg)
1339 for (
int jLeg=0; jLeg<3; ++jLeg)
1340 if (junEvent.colJunction(iJun, iLeg) ==
1341 junEvent.colJunction(jJun, jLeg)) ++nMatch;
1347 if (kindJunA >= 5 || kindJunA <= 2) kJun = jJun;
1349 int kindJun = junEvent.kindJunction(kJun);
1350 int col = junEvent.colJunction(kJun,0);
1352 for (
int i=0; i<junEvent.size(); ++i) {
1354 if ( kindJun % 2 == 0 && junEvent[i].col() != col )
continue;
1355 else if ( kindJun % 2 == 1 && junEvent[i].acol() != col )
continue;
1356 else if ( junEvent[i].status() != -22 )
continue;
1358 int iDau1 = junEvent[i].daughter1();
1359 int iDau2 = junEvent[i].daughter2();
1361 for (
int iDau = iDau1; iDau <= iDau2; ++iDau)
1362 if ( (kindJun % 2 == 0 && junEvent[iDau].col() == col)
1363 || (kindJun % 2 == 1 && junEvent[iDau].acol() == col) )
1365 if ( !isBNV )
continue;
1366 vector<int> daughters = junEvent[i].daughterListRecursive();
1367 int lastColTag = junEvent.lastColTag();
1368 for (
int iLeg = 1; iLeg <= 2; ++iLeg) {
1371 int colOld = junEvent.colJunction(kJun, iLeg);
1372 int colNew = (lastColTag/10) * 10 + 10 + colOld % 10 ;
1374 while (junEvent.lastColTag() < colNew) junEvent.nextColTag();
1375 junEvent.colJunction(kJun,iLeg,colNew);
1376 for (
int jDau = 0; jDau < (int)daughters.size(); ++jDau) {
1377 int iDau = daughters[jDau];
1378 if ( kindJun % 2 == 1 && junEvent[iDau].col() == colOld)
1379 junEvent[iDau].col(colNew);
1380 else if ( kindJun % 2 == 0 && junEvent[iDau].acol() == colOld)
1381 junEvent[iDau].acol(colNew);
1396 bool ProcessLevel::checkColours(
Event& process) {
1399 bool physical =
true;
1401 int colType, col, acol, iPos, iNow, iNowA;
1402 vector<int> colTags, colPos, acolPos;
1405 for (
int i = 0; i < process.size(); ++i) {
1406 colType = process[i].colType();
1407 col = process[i].col();
1408 acol = process[i].acol();
1409 if (colType == 0 && (col != 0 || acol != 0)) physical =
false;
1410 else if (colType == 1 && (col <= 0 || acol != 0)) physical =
false;
1411 else if (colType == -1 && (col != 0 || acol <= 0)) physical =
false;
1412 else if (colType == 2 && (col <= 0 || acol <= 0)) physical =
false;
1416 else if (colType == 3 && (col <= 0 || acol >= 0)) physical =
false;
1417 else if (colType == -3 && (col >= 0 || acol <= 0)) physical =
false;
1419 else if (colType == -2 || colType < -3 || colType > 3) physical =
false;
1424 for (
int ic = 0; ic < int(colTags.size()) ; ++ic)
1425 if (col == colTags[ic]) match =
true;
1426 if (!match) colTags.push_back(col);
1427 }
else if (acol > 0) {
1429 for (
int ic = 0; ic < int(colTags.size()) ; ++ic)
1430 if (acol == colTags[ic]) match =
true;
1431 if (!match) colTags.push_back(acol);
1436 for (
int ic = 0; ic < int(colTags.size()) ; ++ic)
1437 if (-col == colTags[ic]) match =
true;
1438 if (!match) colTags.push_back(-col);
1439 }
else if (acol < 0) {
1441 for (
int ic = 0; ic < int(colTags.size()) ; ++ic)
1442 if (-acol == colTags[ic]) match =
true;
1443 if (!match) colTags.push_back(-acol);
1449 infoPtr->errorMsg(
"Error in ProcessLevel::checkColours: "
1450 "incorrect colour assignment");
1455 for (
int iJun = 0; iJun < process.sizeJunction(); ++iJun) {
1456 for (
int j = 0; j < 3; ++j) {
1457 int colJun = process.colJunction(iJun, j);
1458 for (
int ic = 0; ic < int(colTags.size()) ; ++ic)
1459 if (colJun == colTags[ic]) {
1460 colTags[ic] = colTags[colTags.size() - 1];
1468 for (
int ic = 0; ic < int(colTags.size()); ++ic) {
1472 for (
int i = 0; i < process.size(); ++i) {
1473 if (process[i].col() == col || process[i].acol() == -col)
1474 colPos.push_back(i);
1475 if (process[i].acol() == col || process[i].col() == -col)
1476 acolPos.push_back(i);
1480 while (colPos.size() > 1) {
1481 iPos = colPos.size() - 1;
1482 iNow = colPos[iPos];
1483 if ( process[iNow].mother1() == colPos[iPos - 1]
1484 && process[iNow].mother2() == 0) colPos.pop_back();
1487 while (acolPos.size() > 1) {
1488 iPos = acolPos.size() - 1;
1489 iNow = acolPos[iPos];
1490 if ( process[iNow].mother1() == acolPos[iPos - 1]
1491 && process[iNow].mother2() == 0) acolPos.pop_back();
1496 if (colPos.size() + acolPos.size() != 2) physical =
false;
1499 else if (colPos.size() == 2) {
1501 if ( process[iNow].mother1() != colPos[0]
1502 && process[iNow].mother2() != colPos[0] ) physical =
false;
1504 else if (acolPos.size() == 2) {
1506 if ( process[iNowA].mother1() != acolPos[0]
1507 && process[iNowA].mother2() != acolPos[0] ) physical =
false;
1514 if ( process[iNow].status() == -21 && process[iNowA].status() == -21 );
1515 else if ( (process[iNow].mother1() != process[iNowA].mother1())
1516 || (process[iNow].mother2() != process[iNowA].mother2()) )
1523 if (!physical) infoPtr->errorMsg(
"Error in ProcessLevel::checkColours: "
1524 "unphysical colour flow");
1533 void ProcessLevel::statistics2(
bool reset) {
1536 double impactFac = max( 1., infoPtr->enhanceMPIavg() );
1539 double sigma2SelSum = 0.;
1541 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2) {
1542 sigma2SelSum += container2Ptrs[i2]->sigmaSelMC();
1543 n2SelSum += container2Ptrs[i2]->nSelected();
1545 double factor1 = impactFac * sigma2SelSum / sigmaND;
1546 double rel1Err = sqrt(1. / max(1, n2SelSum));
1547 if (allHardSame) factor1 *= 0.5;
1550 double sigma1SelSum = 0.;
1552 for (
int i = 0; i < int(containerPtrs.size()); ++i) {
1553 sigma1SelSum += containerPtrs[i]->sigmaSelMC();
1554 n1SelSum += containerPtrs[i]->nSelected();
1556 double factor2 = impactFac * sigma1SelSum / sigmaND;
1557 if (allHardSame) factor2 *= 0.5;
1558 double rel2Err = sqrt(1. / max(1, n1SelSum));
1561 cout <<
"\n *------- PYTHIA Event and Cross Section Statistics ------"
1562 <<
"--------------------------------------------------*\n"
1565 <<
" | Subprocess Code | "
1566 <<
"Number of events | sigma +- delta |\n"
1568 <<
" Selected Accepted | (estimated) (mb) |\n"
1571 <<
" |------------------------------------------------------------"
1572 <<
"------------------------------------------------|\n"
1575 <<
" | First hard process: | "
1584 double sigmaSum = 0.;
1585 double delta2Sum = 0.;
1588 map<int, string> nameM;
1589 map<int, long> nTryM, nSelM, nAccM;
1590 map<int, double> sigmaM, delta2M;
1593 for (
int i = 0; i < int(containerPtrs.size()); ++i)
1594 if (containerPtrs[i]->sigmaMax() != 0.) {
1597 int code = containerPtrs[i]->code();
1598 nTrySum += containerPtrs[i]->nTried();
1599 nSelSum += containerPtrs[i]->nSelected();
1600 nAccSum += containerPtrs[i]->nAccepted();
1601 sigmaSum += containerPtrs[i]->sigmaMC() * factor1;
1602 delta2Sum += pow2(containerPtrs[i]->deltaMC() * factor1);
1603 nameM[code] = containerPtrs[i]->name();
1604 nTryM[code] += containerPtrs[i]->nTried();
1605 nSelM[code] += containerPtrs[i]->nSelected();
1606 nAccM[code] += containerPtrs[i]->nAccepted();
1607 sigmaM[code] += containerPtrs[i]->sigmaMC() * factor1;
1608 delta2M[code] += pow2(containerPtrs[i]->deltaMC() * factor1);
1609 delta2M[code] += pow2(containerPtrs[i]->sigmaMC() * factor1 * rel1Err);
1613 for (map<int, string>::iterator i = nameM.begin(); i != nameM.end(); ++i) {
1614 int code = i->first;
1615 cout <<
" | " << left << setw(40) << i->second
1616 << right << setw(5) << code <<
" | "
1617 << setw(11) << nTryM[code] <<
" " << setw(10) << nSelM[code] <<
" "
1618 << setw(10) << nAccM[code] <<
" | " << scientific << setprecision(3)
1619 << setw(11) << sigmaM[code]
1620 << setw(11) << sqrtpos(delta2M[code]) <<
" |\n";
1624 delta2Sum += pow2( sigmaSum * rel1Err );
1627 <<
" | " << left << setw(45) <<
"sum" << right <<
" | " << setw(11)
1628 << nTrySum <<
" " << setw(10) << nSelSum <<
" " << setw(10)
1629 << nAccSum <<
" | " << scientific << setprecision(3) << setw(11)
1630 << sigmaSum << setw(11) << sqrtpos(delta2Sum) <<
" |\n";
1635 <<
" |------------------------------------------------------------"
1636 <<
"------------------------------------------------|\n"
1639 <<
" | Second hard process: | "
1660 for (
int i2 = 0; i2 < int(container2Ptrs.size()); ++i2)
1661 if (container2Ptrs[i2]->sigmaMax() != 0.) {
1664 int code = container2Ptrs[i2]->code();
1665 nTrySum += container2Ptrs[i2]->nTried();
1666 nSelSum += container2Ptrs[i2]->nSelected();
1667 nAccSum += container2Ptrs[i2]->nAccepted();
1668 sigmaSum += container2Ptrs[i2]->sigmaMC() * factor2;
1669 delta2Sum += pow2(container2Ptrs[i2]->deltaMC() * factor2);
1670 nameM[code] = container2Ptrs[i2]->name();
1671 nTryM[code] += container2Ptrs[i2]->nTried();
1672 nSelM[code] += container2Ptrs[i2]->nSelected();
1673 nAccM[code] += container2Ptrs[i2]->nAccepted();
1674 sigmaM[code] += container2Ptrs[i2]->sigmaMC() * factor2;
1675 delta2M[code] += pow2(container2Ptrs[i2]->deltaMC() * factor2);
1676 delta2M[code] += pow2(container2Ptrs[i2]->sigmaMC() * factor2 * rel2Err);
1680 for (map<int, string>::iterator i2 = nameM.begin(); i2 != nameM.end();
1682 int code = i2->first;
1683 cout <<
" | " << left << setw(40) << i2->second
1684 << right << setw(5) << code <<
" | "
1685 << setw(11) << nTryM[code] <<
" " << setw(10) << nSelM[code] <<
" "
1686 << setw(10) << nAccM[code] <<
" | " << scientific << setprecision(3)
1687 << setw(11) << sigmaM[code]
1688 << setw(11) << sqrtpos(delta2M[code]) <<
" |\n";
1692 delta2Sum += pow2( sigmaSum * rel2Err );
1695 <<
" | " << left << setw(45) <<
"sum" << right <<
" | " << setw(11)
1696 << nTrySum <<
" " << setw(10) << nSelSum <<
" " << setw(10)
1697 << nAccSum <<
" | " << scientific << setprecision(3) << setw(11)
1698 << sigmaSum << setw(11) << sqrtpos(delta2Sum) <<
" |\n";
1703 <<
" |------------------------------------------------------------"
1704 <<
"------------------------------------------------|\n"
1707 <<
" | Uncombined cross sections for the two event sets were "
1708 << setw(10) << sigma1SelSum <<
" and " << sigma2SelSum <<
" mb, "
1709 <<
"respectively, combined |\n"
1710 <<
" | using a sigma(nonDiffractive) of " << setw(10) << sigmaND
1711 <<
" mb and an impact-parameter enhancement factor of "
1712 << setw(10) << impactFac <<
". |\n";
1717 <<
" *------- End PYTHIA Event and Cross Section Statistics -----"
1718 <<
"------------------------------------------------*" << endl;
1721 if (reset) resetStatistics();