3 using namespace Pythia8;
33 sortIncomingProcess(event);
37 if ( doShowerKt )
return false;
42 cout << endl <<
"-------- Begin Madgraph Debug --------" << endl;
44 cout << endl <<
"Original incoming process:";
45 eventProcessOrig.list();
47 cout << endl <<
"Final-state incoming process:";
50 for (
size_t i = 0;
i < typeIdx[0].size();
i++)
51 cout << ((
i == 0) ?
"Light jets: " :
", ") << setw(3) << typeIdx[0][
i];
52 if( typeIdx[0].
size()== 0 )
53 cout <<
"Light jets: None";
55 for (
size_t i = 0;
i < typeIdx[1].size();
i++)
56 cout << ((
i == 0) ?
"\nHeavy jets: " :
", ") << setw(3) << typeIdx[1][
i];
57 for (
size_t i = 0;
i < typeIdx[2].size();
i++)
58 cout << ((
i == 0) ?
"\nOther: " :
", ") << setw(3) << typeIdx[2][
i];
60 cout << endl << endl <<
"Event:";
63 cout << endl <<
"Work event:";
68 int iTypeEnd = (typeIdx[1].empty()) ? 1 : 2;
69 for (
int iType = 0; iType < iTypeEnd; iType++) {
73 jetAlgorithmInput(event, iType);
78 cout << endl <<
"Jet algorithm event (iType = " << iType <<
"):";
87 if (matchPartonsToJets(iType) ==
true) {
90 cout << endl <<
"Event vetoed" << endl
91 <<
"---------- End MLM Debug ----------" << endl;
99 cout << endl <<
"Event accepted" << endl
100 <<
"---------- End MLM Debug ----------" << endl;
133 for (
size_t i = 0;
i < vecIn.size();
i++) {
135 double vMax = (jetAlgorithm == 1) ?
136 eventProcess[vecIn[
i]].eT() :
137 eventProcess[vecIn[
i]].pT();
138 for (
size_t j =
i + 1;
j < vecIn.size();
j++) {
139 double vNow = (jetAlgorithm == 1)
140 ? eventProcess[vecIn[
j]].eT() : eventProcess[vecIn[
j]].pT();
146 if (jMax !=
i)
swap(vecIn[
i], vecIn[jMax]);
158 doMerge = settingsPtr->flag(
"JetMatching:merge");
159 jetAlgorithm = settingsPtr->mode(
"JetMatching:jetAlgorithm");
160 nJet = settingsPtr->mode(
"JetMatching:nJet");
161 nJetMax = settingsPtr->mode(
"JetMatching:nJetMax");
162 eTjetMin = settingsPtr->parm(
"JetMatching:eTjetMin");
163 coneRadius = settingsPtr->parm(
"JetMatching:coneRadius");
164 etaJetMax = settingsPtr->parm(
"JetMatching:etaJetMax");
167 etaJetMaxAlgo = etaJetMax + coneRadius;
170 nEta = settingsPtr->mode(
"JetMatching:nEta");
171 nPhi = settingsPtr->mode(
"JetMatching:nPhi");
172 eTseed = settingsPtr->parm(
"JetMatching:eTseed");
173 eTthreshold = settingsPtr->parm(
"JetMatching:eTthreshold");
176 slowJetPower = settingsPtr->mode(
"JetMatching:slowJetPower");
177 coneMatchLight = settingsPtr->parm(
"JetMatching:coneMatchLight");
178 coneRadiusHeavy = settingsPtr->parm(
"JetMatching:coneRadiusHeavy");
179 if (coneRadiusHeavy < 0.) coneRadiusHeavy = coneRadius;
180 coneMatchHeavy = settingsPtr->parm(
"JetMatching:coneMatchHeavy");
183 jetAllow = settingsPtr->mode(
"JetMatching:jetAllow");
184 jetMatch = settingsPtr->mode(
"JetMatching:jetMatch");
185 exclusiveMode = settingsPtr->mode(
"JetMatching:exclusive");
188 if (!doMerge)
return true;
191 if (exclusiveMode == 2) {
194 if (nJet < 0 || nJetMax < 0) {
195 infoPtr->errorMsg(
"Warning in JetMatchingAlpgen:init: "
196 "missing jet multiplicity information; running in exclusive mode");
201 exclusive = (nJet == nJetMax) ?
false :
true;
206 exclusive = (exclusiveMode == 0) ?
false :
true;
210 if (jetAlgorithm == 1) {
215 int nSel = 2, smear = 0;
217 cellJet =
new CellJet(etaJetMaxAlgo, nEta, nPhi, nSel,
218 smear, resolution, upperCut, eTthreshold);
221 }
else if (jetAlgorithm == 2) {
222 slowJet =
new SlowJet(slowJetPower, coneRadius, eTjetMin, etaJetMaxAlgo);
226 if (jetAlgorithm == 1 && jetMatch == 2) {
227 infoPtr->errorMsg(
"Warning in JetMatchingAlpgen:init: "
228 "jetMatch = 2 only valid with SlowJet algorithm. "
229 "Reverting to jetMatch = 1");
234 eventProcessOrig.init(
"(eventProcessOrig)", particleDataPtr);
235 eventProcess.init(
"(eventProcess)", particleDataPtr);
236 workEventJet.init(
"(workEventJet)", particleDataPtr);
239 string jetStr = (jetAlgorithm == 1) ?
"CellJet" :
240 (slowJetPower == -1) ?
"anti-kT" :
241 (slowJetPower == 0) ?
"C/A" :
242 (slowJetPower == 1) ?
"kT" :
"unknown";
243 string modeStr = (exclusive) ?
"exclusive" :
"inclusive";
244 stringstream nJetStr, nJetMaxStr;
245 if (nJet >= 0) nJetStr << nJet;
else nJetStr <<
"unknown";
246 if (nJetMax >= 0) nJetMaxStr << nJetMax;
else nJetMaxStr <<
"unknown";
248 <<
" *------- MLM matching parameters -------*" << endl
249 <<
" | nJet | " << setw(14)
250 << nJetStr.str() <<
" |" << endl
251 <<
" | nJetMax | " << setw(14)
252 << nJetMaxStr.str() <<
" |" << endl
253 <<
" | Jet algorithm | " << setw(14)
254 << jetStr <<
" |" << endl
255 <<
" | eTjetMin | " << setw(14)
256 << eTjetMin <<
" |" << endl
257 <<
" | coneRadius | " << setw(14)
258 << coneRadius <<
" |" << endl
259 <<
" | etaJetMax | " << setw(14)
260 << etaJetMax <<
" |" << endl
261 <<
" | jetAllow | " << setw(14)
262 << jetAllow <<
" |" << endl
263 <<
" | jetMatch | " << setw(14)
264 << jetMatch <<
" |" << endl
265 <<
" | coneMatchLight | " << setw(14)
266 << coneMatchLight <<
" |" << endl
267 <<
" | coneRadiusHeavy | " << setw(14)
268 << coneRadiusHeavy <<
" |" << endl
269 <<
" | coneMatchHeavy | " << setw(14)
270 << coneMatchHeavy <<
" |" << endl
271 <<
" | Mode | " << setw(14)
272 << modeStr <<
" |" << endl
273 <<
" *-----------------------------------------*" << endl;
286 omitResonanceDecays(eventProcessOrig,
true);
287 eventProcess = workEvent;
298 for (
int i = 0;
i < 3;
i++) {
302 for (
int i = 0;
i < eventProcess.size();
i++) {
304 if (!eventProcess[
i].isFinal())
continue;
308 if (eventProcess[
i].
id() == ID_GLUON
309 || (eventProcess[
i].idAbs() <= ID_BOT
310 &&
abs(eventProcess[
i].
m()) < ZEROTHRESHOLD)) idx = 0;
313 else if (eventProcess[
i].idAbs() >= ID_CHARM
314 && eventProcess[
i].idAbs() <= ID_TOP) idx = 1;
317 typeIdx[
idx].push_back(
i);
318 typeSet[
idx].insert(eventProcess[
i].daughter1());
333 workEventJet = workEvent;
336 for (
int i = 0;
i < workEventJet.size(); ++
i) {
337 if (!workEventJet[
i].isFinal())
continue;
344 int id = workEventJet[
i].idAbs();
345 if ( (
id >= ID_LEPMIN &&
id <= ID_LEPMAX) ||
id == ID_TOP
346 ||
id == ID_PHOTON) {
347 workEventJet[
i].statusNeg();
353 int idx = workEventJet[
i].daughter1();
362 if (typeSet[1].
find(idx) != typeSet[1].
end() ||
363 typeSet[2].
find(idx) != typeSet[2].
end()) {
364 workEventJet[
i].statusNeg();
371 idx =
event[
idx].mother1();
374 }
else if (iType == 1) {
377 if (typeSet[1].
find(idx) != typeSet[1].
end())
break;
382 workEventJet[
i].statusNeg();
387 idx =
event[
idx].mother1();
396 for (
int i = 0;
i < int(typeIdx[iType].
size());
i++) {
398 Vec4 pIn = eventProcess[typeIdx[iType][
i]].p();
399 double y = pIn.rap();
400 double phi = pIn.phi();
403 double e = GHOSTENERGY;
404 double e2y =
exp(2. * y);
405 double pz = e * (e2y - 1.) / (e2y + 1.);
406 double pt =
sqrt(e*e - pz*pz);
407 double px = pt *
cos(phi);
408 double py = pt *
sin(phi);
409 workEventJet.append( ID_GLUON, 99, 0, 0, 0, 0, 0, 0, px, py, pz, e);
414 int lastIdx = workEventJet.size() - 1;
415 if (
abs(y - workEventJet[lastIdx].
y()) > ZEROTHRESHOLD ||
416 abs(phi - workEventJet[lastIdx].
phi()) > ZEROTHRESHOLD)
417 infoPtr->errorMsg(
"Warning in JetMatchingAlpgen:jetAlgorithmInput: "
418 "ghost particle y/phi mismatch");
432 if (jetAlgorithm == 1)
433 cellJet->analyze(workEventJet, eTjetMin, coneRadius, eTseed);
435 slowJet->analyze(workEventJet);
441 int iJet = (jetAlgorithm == 1) ? cellJet->size() - 1:
442 slowJet->sizeJet() - 1;
443 for (
int i = iJet;
i > -1;
i--) {
444 Vec4 jetMom = (jetAlgorithm == 1) ? cellJet->pMassive(
i) :
446 double eta = jetMom.eta();
448 if (
abs(eta) > etaJetMax) {
449 if (jetAlgorithm == 2) slowJet->removeJet(
i);
452 jetMomenta.push_back(jetMom);
456 reverse(jetMomenta.begin(), jetMomenta.end());
467 if (iType == 0)
return (matchPartonsToJetsLight() > 0);
468 else return (matchPartonsToJetsHeavy() > 0);
487 if (jetMomenta.size() < typeIdx[0].size())
return LESS_JETS;
489 if (exclusive && jetMomenta.size() > typeIdx[0].size())
return MORE_JETS;
492 sortTypeIdx(typeIdx[0]);
495 int nParton = typeIdx[0].size();
498 vector < bool > jetAssigned;
499 jetAssigned.assign(jetMomenta.size(),
false);
505 for (
int i = 0;
i < nParton;
i++) {
506 Vec4 p1 = eventProcess[typeIdx[0][
i]].p();
513 for (
int j = 0;
j < int(jetMomenta.size());
j++) {
514 if (jetAssigned[
j])
continue;
517 double dR = (jetAlgorithm == 1)
518 ? REtaPhi(p1, jetMomenta[j]) : RRapPhi(p1, jetMomenta[j]);
519 if (jMin < 0 || dR < dRmin) {
526 if (jMin >= 0 && dRmin < coneRadius * coneMatchLight) {
531 if (jMin >= nParton)
return HARD_JET;
534 jetAssigned[jMin] =
true;
537 }
else return UNMATCHED_PARTON;
545 for (
int i = workEventJet.size() - nParton;
546 i < workEventJet.size();
i++) {
547 int jMin = slowJet->jetAssignment(
i);
553 if (jMin >= nParton)
return HARD_JET;
554 if (jMin < 0 || jetAssigned[jMin])
return UNMATCHED_PARTON;
557 jetAssigned[jMin] =
true;
565 eTpTlightMin = (jetAlgorithm == 1) ? jetMomenta[nParton - 1].eT()
566 : jetMomenta[nParton - 1].pT();
587 if (jetMomenta.empty())
return NONE;
590 int nParton = typeIdx[1].size();
593 set < int > removeJets;
599 for (
int i = 0;
i < nParton;
i++) {
600 Vec4 p1 = eventProcess[typeIdx[1][
i]].p();
603 for (
int j = 0;
j < int(jetMomenta.size());
j++) {
604 double dR = (jetAlgorithm == 1) ?
605 REtaPhi(p1, jetMomenta[
j]) : RRapPhi(p1, jetMomenta[j]);
606 if (dR < coneRadiusHeavy * coneMatchHeavy)
607 removeJets.insert(j);
617 for (
int i = workEventJet.size() - nParton;
618 i < workEventJet.size();
i++) {
619 int jMin = slowJet->jetAssignment(
i);
620 if (jMin >= 0) removeJets.insert(jMin);
626 for (set < int >::reverse_iterator it = removeJets.rbegin();
627 it != removeJets.rend(); it++)
628 jetMomenta.erase(jetMomenta.begin() + *it);
631 if (!jetMomenta.empty()) {
634 if (exclusive)
return MORE_JETS;
637 else if (eTpTlightMin >= 0.)
638 for (
size_t j = 0;
j < jetMomenta.size();
j++) {
640 if ( (jetAlgorithm == 1 && jetMomenta[
j].eT() > eTpTlightMin) ||
641 (jetAlgorithm == 2 && jetMomenta[
j].pT() > eTpTlightMin) )
665 bool setMad = settingsPtr->flag(
"JetMatching:setMad");
669 string parStr = infoPtr->header(
"MGRunCard");
670 if (!parStr.empty()) {
679 settingsPtr->flag(
"JetMatching:merge", par.
getParam(
"ickkw"));
680 settingsPtr->parm(
"JetMatching:qCut", par.
getParam(
"xqcut"));
681 settingsPtr->mode(
"JetMatching:nQmatch",
683 settingsPtr->parm(
"JetMatching:clFact",
686 infoPtr->errorMsg(
"Error in JetMatchingMadgraph:init: "
687 "Madgraph file parameters are not set for merging");
691 infoPtr->errorMsg(
"Warning in JetMatchingMadgraph:init: "
692 "Madgraph merging parameters not found");
693 if (!par.
haveParam(
"xqcut")) infoPtr->errorMsg(
"Warning in "
694 "JetMatchingMadgraph:init: No xqcut");
695 if (!par.
haveParam(
"ickkw")) infoPtr->errorMsg(
"Warning in "
696 "JetMatchingMadgraph:init: No ickkw");
697 if (!par.
haveParam(
"maxjetflavor")) infoPtr->errorMsg(
"Warning in "
698 "JetMatchingMadgraph:init: No maxjetflavor");
699 if (!par.
haveParam(
"alpsfact")) infoPtr->errorMsg(
"Warning in "
700 "JetMatchingMadgraph:init: No alpsfact");
705 doFxFx = settingsPtr->flag(
"JetMatching:doFxFx");
706 nPartonsNow = settingsPtr->mode(
"JetMatching:nPartonsNow");
707 qCutME = settingsPtr->parm(
"JetMatching:qCutME");
708 qCutMESq =
pow(qCutME,2);
711 doMerge = settingsPtr->flag(
"JetMatching:merge");
712 doShowerKt = settingsPtr->flag(
"JetMatching:doShowerKt");
713 qCut = settingsPtr->parm(
"JetMatching:qCut");
714 nQmatch = settingsPtr->mode(
"JetMatching:nQmatch");
715 clFact = settingsPtr->parm(
"JetMatching:clFact");
718 jetAlgorithm = settingsPtr->mode(
"JetMatching:jetAlgorithm");
719 nJetMax = settingsPtr->mode(
"JetMatching:nJetMax");
720 eTjetMin = settingsPtr->parm(
"JetMatching:eTjetMin");
721 coneRadius = settingsPtr->parm(
"JetMatching:coneRadius");
722 etaJetMax = settingsPtr->parm(
"JetMatching:etaJetMax");
723 slowJetPower = settingsPtr->mode(
"JetMatching:slowJetPower");
726 jetAllow = settingsPtr->mode(
"JetMatching:jetAllow");
727 exclusiveMode = settingsPtr->mode(
"JetMatching:exclusive");
728 qCutSq =
pow(qCut,2);
729 etaJetMaxAlgo = etaJetMax;
732 if (!doMerge)
return true;
735 if (exclusiveMode == 2) {
739 infoPtr->errorMsg(
"Warning in JetMatchingMadgraph:init: "
740 "missing jet multiplicity information; running in exclusive mode");
750 slowJet =
new SlowJet(slowJetPower, coneRadius, eTjetMin,
751 etaJetMaxAlgo, 2, 2,
NULL,
false);
756 slowJetHard =
new SlowJet(slowJetPower, coneRadius, qCutME,
757 etaJetMaxAlgo, 2, 2,
NULL,
false);
760 slowJetDJR =
new SlowJet(slowJetPower, coneRadius, 0.0,
761 etaJetMaxAlgo, 2, 2,
NULL,
false);
764 eventProcessOrig.init(
"(eventProcessOrig)", particleDataPtr);
765 eventProcess.init(
"(eventProcess)", particleDataPtr);
766 workEventJet.init(
"(workEventJet)", particleDataPtr);
769 string jetStr = (jetAlgorithm == 1) ?
"CellJet" :
770 (slowJetPower == -1) ?
"anti-kT" :
771 (slowJetPower == 0) ?
"C/A" :
772 (slowJetPower == 1) ?
"kT" :
"unknown";
773 string modeStr = (exclusiveMode) ?
"exclusive" :
"inclusive";
775 <<
" *----- Madgraph matching parameters -----*" << endl
776 <<
" | qCut | " << setw(14)
777 << qCut <<
" |" << endl
778 <<
" | nQmatch | " << setw(14)
779 << nQmatch <<
" |" << endl
780 <<
" | clFact | " << setw(14)
781 << clFact <<
" |" << endl
782 <<
" | Jet algorithm | " << setw(14)
783 << jetStr <<
" |" << endl
784 <<
" | eTjetMin | " << setw(14)
785 << eTjetMin <<
" |" << endl
786 <<
" | etaJetMax | " << setw(14)
787 << etaJetMax <<
" |" << endl
788 <<
" | jetAllow | " << setw(14)
789 << jetAllow <<
" |" << endl
790 <<
" | Mode | " << setw(14)
791 << modeStr <<
" |" << endl
792 <<
" *-----------------------------------------*" << endl;
800 const Event&
event) {
803 if ( !doShowerKt )
return false;
807 if (
int(typeIdx[0].
size()) > nJetMax )
return false;
810 if ( nISR + nFSR > 1 )
return false;
813 if (iPos == 5)
return false;
817 sortIncomingProcess(event);
821 for (
int i = 0;
i < workEvent.size();
i++){
824 if ( workEvent[
i].isFinal()
825 && (workEvent[
i].statusAbs()==43 || workEvent[
i].statusAbs()==51)) {
828 bool QCDemission =
true;
829 while ( workEvent[iPos].statusAbs() > 23 ) {
830 if ( workEvent[iPos].
id() == 22 || workEvent[iPos].id() == 23
831 || workEvent[iPos].idAbs() == 24){
835 iPos = workEvent[iPos].mother1();
839 pTfirst = workEvent[
i].pT();
846 if ( doShowerKtVeto(pTfirst) )
return true;
858 if ( !doShowerKt )
return false;
865 int nParton = typeIdx[0].size();
867 for (
int i = 0;
i < nParton; ++
i)
868 pTminME =
min(pTminME,eventProcess[typeIdx[0][
i]].pT());
871 if ( nParton > 0 &&
pow(pTminME,2) < qCutSq ) doVeto =
true;
875 if ( exclusive &&
pow(pTfirst,2) > qCutSq ) {
879 }
else if ( !exclusive && nParton > 0 && pTfirst > pTminME ) {
896 omitResonanceDecays(eventProcessOrig,
true);
905 eventProcess.clear();
906 workEventJet.clear();
907 for(
int i=0;
i < workEvent.size(); ++
i) {
910 int id = workEvent[
i].idAbs();
911 if ((
id >= ID_LEPMIN &&
id <= ID_LEPMAX) ||
id == ID_TOP
912 ||
id == ID_PHOTON ||
id == 23 ||
id == 24 ||
id == 25) {
913 eventProcess.append(workEvent[
i]);
915 workEventJet.append(workEvent[
i]);
920 if (!slowJetHard->setup(workEventJet) ) {
921 infoPtr->errorMsg(
"Warning in JetMatchingMadgraph:sortIncomingProcess"
922 ": the SlowJet algorithm failed on setup");
927 double localQcutSq = qCutMESq;
929 while ( slowJetHard->sizeAll() - slowJetHard->sizeJet() > 0 ) {
931 if( slowJetHard->dNext() > localQcutSq )
break;
933 if( slowJetHard->sizeAll()-slowJetHard->sizeJet() <= nPartonsNow)
break;
934 slowJetHard->doStep();
940 int nJets = slowJetHard->sizeJet();
941 int nClus = slowJetHard->sizeAll();
943 for (
int i = nJets;
i < nClus; ++
i) {
945 if (
i < nClus-nJets) parts = slowJetHard->clusConstituents(
i);
946 else parts = slowJetHard->constituents(nClus-nJets-
i);
948 for(
int j=0;
j < int(parts.size()); ++
j)
949 if (workEventJet[parts[
j]].
id() == ID_BOT)
951 eventProcess.append( flavour, 98,
952 workEventJet[parts.back()].mother1(),
953 workEventJet[parts.back()].mother2(),
954 workEventJet[parts.back()].daughter1(),
955 workEventJet[parts.back()].daughter2(),
956 0, 0, slowJetHard->p(
i).px(), slowJetHard->p(
i).py(),
957 slowJetHard->p(
i).pz(), slowJetHard->p(
i).e() );
962 workEventJet.clear();
967 eventProcess = workEvent;
979 for (
int i = 0;
i < 3;
i++) {
982 origTypeIdx[
i].clear();
984 for (
int i = 0;
i < eventProcess.size();
i++) {
986 if (!eventProcess[
i].isFinal())
continue;
991 if (eventProcess[
i].
id() == ID_GLUON
992 || (eventProcess[
i].idAbs() <= nQmatch) ) {
996 if ( eventProcess[
i].
scale() < 1.999*
sqrt(infoPtr->eA()*infoPtr->eB()) )
1001 else if (eventProcess[
i].idAbs() > nQmatch
1002 && eventProcess[
i].idAbs() <= ID_TOP) {
1012 typeIdx[
idx].push_back(
i);
1013 typeSet[
idx].insert(eventProcess[
i].daughter1());
1014 origTypeIdx[orig_idx].push_back(
i);
1018 if (exclusiveMode == 2) {
1021 int nParton = origTypeIdx[0].size();
1022 exclusive = (nParton == nJetMax) ?
false :
true;
1026 exclusive = (exclusiveMode == 0) ?
false :
true;
1041 workEventJet = workEvent;
1044 for (
int i = 0;
i < workEventJet.size(); ++
i) {
1045 if (!workEventJet[
i].isFinal())
continue;
1048 if (jetAllow == 1) {
1052 int id = workEventJet[
i].idAbs();
1053 if ((
id >= ID_LEPMIN &&
id <= ID_LEPMAX) ||
id == ID_TOP
1054 ||
id == ID_PHOTON || (
id > nQmatch &&
id!=21)) {
1055 workEventJet[
i].statusNeg();
1061 int idx = workEventJet[
i].daughter1();
1070 if (typeSet[1].
find(idx) != typeSet[1].
end() ||
1071 typeSet[2].
find(idx) != typeSet[2].
end()) {
1072 workEventJet[
i].statusNeg();
1077 if (idx == 0)
break;
1079 idx =
event[
idx].mother1();
1082 }
else if (iType == 1) {
1085 if (typeSet[1].
find(idx) != typeSet[1].
end())
break;
1090 workEventJet[
i].statusNeg();
1095 idx =
event[
idx].mother1();
1119 SetDJR(workEventJet);
1121 return (matchPartonsToJetsLight() > 0);
1123 else return (matchPartonsToJetsHeavy() > 0);
1142 int nParton = typeIdx[0].size();
1143 if((
int)origTypeIdx[0].
size()>nJetMax)
return 1;
1146 if (!slowJet->setup(workEventJet) ) {
1147 infoPtr->errorMsg(
"Warning in JetMatchingMadgraph:matchPartonsToJets"
1148 "Light: the SlowJet algorithm failed on setup");
1151 double localQcutSq = qCutSq;
1154 while ( slowJet->sizeAll() - slowJet->sizeJet() > 0 ) {
1155 if( slowJet->dNext() > localQcutSq )
break;
1156 dOld = slowJet->dNext();
1159 int nJets = slowJet->sizeJet();
1160 int nClus = slowJet->sizeAll();
1163 if (MATCHINGDEBUG) slowJet->list(
true);
1166 int nCLjets = nClus - nJets;
1168 int nRequested = (doFxFx) ? nPartonsNow : nParton;
1171 if ( nCLjets < nRequested )
return LESS_JETS;
1174 if ( exclusive && !doFxFx ) {
1175 if ( nCLjets > nRequested )
return MORE_JETS;
1181 if ( doFxFx && nRequested < nJetMax && nCLjets > nRequested )
1188 if (!slowJet->setup(workEventJet) ) {
1189 infoPtr->errorMsg(
"Warning in JetMatchingMadgraph:matchPartonsToJets"
1190 "Light: the SlowJet algorithm failed on setup");
1197 while ( slowJet->sizeAll() - slowJet->sizeJet() > 0 ) {
1198 if( slowJet->dNext() > localQcutSq )
break;
1204 while ( slowJet->sizeAll() - slowJet->sizeJet() > nParton )
1211 if ( clFact >= 0. && nParton > 0 ) {
1212 vector<double> partonPt;
1213 for (
int i = 0;
i < nParton; ++
i)
1214 partonPt.push_back( eventProcess[typeIdx[0][
i]].pT2() );
1215 sort( partonPt.begin(), partonPt.end());
1216 localQcutSq =
max( qCutSq, partonPt[0]);
1218 nJets = slowJet->sizeJet();
1219 nClus = slowJet->sizeAll();
1222 if ( clFact != 0. ) localQcutSq *= pow2(clFact);
1225 tempEvent.init(
"(tempEvent)", particleDataPtr);
1227 double pTminEstimate = -1.;
1231 for (
int i = nJets;
i < nClus; ++
i) {
1232 tempEvent.append( ID_GLUON, 98, 0, 0, 0, 0, 0, 0, slowJet->p(
i).px(),
1233 slowJet->p(
i).py(), slowJet->p(
i).pz(), slowJet->p(
i).e() );
1235 pTminEstimate =
max( pTminEstimate, slowJet->pT(
i));
1236 if(nPass == nRequested)
break;
1239 int tempSize = tempEvent.size();
1241 vector<bool> jetAssigned;
1242 jetAssigned.assign( tempSize,
false);
1246 vector< vector<bool> > partonMatchesJet;
1247 for (
int i=0;
i < nParton; ++
i )
1248 partonMatchesJet.push_back( vector<bool>(tempEvent.size(),
false) );
1263 while ( doFxFx && iNow < tempSize ) {
1267 tempEventJet.init(
"(tempEventJet)", particleDataPtr);
1268 for (
int i=0;
i < nParton; ++
i ) {
1275 tempEventJet.clear();
1276 tempEventJet.append( ID_GLUON, 98, 0, 0, 0, 0, 0, 0,
1277 tempEvent[iNow].px(), tempEvent[iNow].py(),
1278 tempEvent[iNow].pz(), tempEvent[iNow].
e() );
1280 Vec4 pIn = eventProcess[typeIdx[0][
i]].p();
1281 tempEventJet.append( ID_GLUON, 99, 0, 0, 0, 0, 0, 0,
1282 pIn.px(), pIn.py(), pIn.pz(), pIn.e() );
1285 if ( !slowJet->setup(tempEventJet) ) {
1286 infoPtr->errorMsg(
"Warning in JetMatchingMadgraph:matchPartonsToJets"
1287 "Light: the SlowJet algorithm failed on setup");
1293 if ( slowJet->iNext() == tempEventJet.size() - 1
1294 && slowJet->jNext() > -1 && slowJet->dNext() < localQcutSq ) {
1295 jetAssigned[iNow] =
true;
1296 partonMatchesJet[
i][iNow] =
true;
1302 if ( !jetAssigned[iNow] )
return UNMATCHED_PARTON;
1316 while (!doFxFx && iNow < nParton ) {
1318 tempEventJet.init(
"(tempEventJet)", particleDataPtr);
1319 for (
int i = 0;
i < tempSize; ++
i) {
1320 if (jetAssigned[
i])
continue;
1321 Vec4 pIn = tempEvent[
i].p();
1323 tempEventJet.append( ID_GLUON, 98, 0, 0, 0, 0, 0, 0,
1324 pIn.px(), pIn.py(), pIn.pz(), pIn.e() );
1327 Vec4 pIn = eventProcess[typeIdx[0][iNow]].p();
1329 tempEventJet.append( ID_GLUON, 99, 0, 0, 0, 0, 0, 0,
1330 pIn.px(), pIn.py(), pIn.pz(), pIn.e() );
1331 if ( !slowJet->setup(tempEventJet) ) {
1332 infoPtr->errorMsg(
"Warning in JetMatchingMadgraph:matchPartonsToJets"
1333 "Light: the SlowJet algorithm failed on setup");
1338 if ( slowJet->iNext() == tempEventJet.size() - 1
1339 && slowJet->jNext() > -1 && slowJet->dNext() < localQcutSq ) {
1341 for (
int i = 0;
i != tempSize; ++
i) {
1342 if (jetAssigned[
i])
continue;
1345 if (iKnt == slowJet->jNext() ) jetAssigned[i] =
true;
1348 return UNMATCHED_PARTON;
1356 if (nParton > 0 && pTminEstimate > 0) eTpTlightMin = pTminEstimate;
1357 else eTpTlightMin = -1.;
1380 if (jetMomenta.empty())
return NONE;
void swap(ora::Record &rh, ora::Record &lh)
int getParamAsInt(const string ¶mIn)
int matchPartonsToJetsLight()
void jetAlgorithmInput(const Pythia8::Event &, int)
void jetAlgorithmInput(const Pythia8::Event &, int)
bool haveParam(const string ¶mIn)
Sin< T >::type sin(const T &t)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void sortTypeIdx(vector< int > &vecIn)
const T & max(const T &a, const T &b)
bool doShowerKtVeto(double pTfirst)
Cos< T >::type cos(const T &t)
int matchPartonsToJetsLight()
void sortIncomingProcess(const Pythia8::Event &)
Abs< T >::type abs(const T &t)
int matchPartonsToJetsHeavy()
bool matchPartonsToJets(int)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
bool doVetoStep(int, int, int, const Pythia8::Event &)
double getParam(const string ¶mIn)
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
static const double ZEROTHRESHOLD
void sortIncomingProcess(const Pythia8::Event &)
static const bool MATCHINGCHECK
int matchPartonsToJetsHeavy()
bool doVetoPartonLevelEarly(const Pythia8::Event &event)
int flavour(const Candidate &part)
bool matchPartonsToJets(int)
static const bool MATCHINGDEBUG
tuple size
Write out results.
Power< A, B >::type pow(const A &a, const B &b)
static const double GHOSTENERGY
bool parse(const string paramStr)