Go to the documentation of this file.00001 #include "GeneratorInterface/Pythia8Interface/interface/EmissionVetoHook.h"
00002
00003 #include "FWCore/ServiceRegistry/interface/Service.h"
00004 void EmissionVetoHook::fatalEmissionVeto(string message) {
00005 throw edm::Exception(edm::errors::Configuration,"Pythia8Interface")
00006 << "EmissionVeto: " << message << endl;
00007 }
00008
00009
00010
00011 bool EmissionVetoHook::doVetoMPIStep(int, const Pythia8::Event &e) {
00012 int first=-1, myid;
00013 last = -1;
00014 for(int ip = 2; ip < e.size(); ip++) {
00015 myid = e[ip].id();
00016 if(abs(myid) < 6 || abs(myid) == 21) continue;
00017 first = ip;
00018 break;
00019 }
00020 if(first < 0) fatalEmissionVeto(string("signal particles not found"));
00021 for(int ip = first; ip < e.size(); ip++) {
00022 myid = e[ip].id();
00023 if(abs(myid) < 6 || abs(myid) == 21) continue;
00024 last = ip;
00025 }
00026 if(Verbosity)
00027 cout << "last before powheg emission = " << last << " , id = "
00028 << e[last].id() << " emission size = " << e.size() - 1 - last << endl;
00029
00030
00031 switch (e.size() - 1 - last) {
00032 case 0:
00033
00034 pTpowheg = -1.;
00035 pTveto = infoPtr->QFac();
00036 noRad = true;
00037
00038
00039 if (firstNoRad) {
00040 if(Verbosity)
00041 cout << "Info: no POWHEG radiation, Q = " << pTveto
00042 << " GeV" << endl;
00043 firstNoRad = false;
00044 }
00045 break;
00046
00047 case 1:
00048
00049 if (e[last+1].id() != 21 && e[last+1].idAbs() > 5) {
00050 cout << endl << "Emergency dump of the intermediate event: " << endl;
00051 e.list();
00052 fatalEmissionVeto(string("Error: jet is not quark/gluon"));
00053 }
00054
00055 pTpowheg = e[last+1].pT();
00056 pTveto = e[last+1].pT();
00057 noRad = false;
00058 break;
00059 }
00060
00061 if(Verbosity) cout << "veto pT = " << pTveto << " QFac = " << infoPtr->QFac() << endl;
00062
00063
00064 pTshower = -1.;
00065
00066
00067 return false;
00068 }
00069
00070
00071
00072 bool EmissionVetoHook::doVetoISREmission(int, const Pythia8::Event &e, int iSys) {
00073
00074 if (iSys != 0) return false;
00075
00076 if(last < 0) fatalEmissionVeto(string("Variable last is not filled"));
00077
00078
00079 int i;
00080 for (i = e.size() - 1; i > last; i--)
00081 if (e[i].isFinal() && e[i].status() == 43) break;
00082 if (i == last) {
00083 cout << endl << "Emergency dump of the intermediate event: " << endl;
00084 e.list();
00085 fatalEmissionVeto(string("Error: couldn't find ISR emission"));
00086 }
00087
00088
00089 if (e[i].pT() > pTveto) {
00090 nISRveto++;
00091 if(Verbosity) cout << "ISR vetoed" << endl;
00092 return true;
00093 }
00094
00095 if (pTshower < 0.) pTshower = e[i].pT();
00096
00097 return false;
00098 }
00099
00100 bool EmissionVetoHook::doVetoFSREmission(int, const Pythia8::Event &e, int iSys, bool) {
00101
00102 if (iSys != 0) return false;
00103
00104
00105 int i;
00106 for (i = e.size() - 1; i > last; i--)
00107 if (e[i].isFinal() && e[i].status() == 51 &&
00108 e[i].idAbs() != 6) break;
00109 if (i == last) {
00110 cout << endl << "Emergency dump of the intermediate event: " << endl;
00111 e.list();
00112 fatalEmissionVeto(string("Error: couldn't find FSR emission"));
00113 }
00114
00115
00116 if (e[i].pT() > pTveto) {
00117 nFSRveto++;
00118 if(Verbosity) cout << "FSR vetoed" << endl;
00119 return true;
00120 }
00121
00122 if (pTshower < 0.) pTshower = e[i].pT();
00123
00124 return false;
00125 }