5 #include "HepMC/HEPEVT_Wrapper.h"
20 using namespace Pythia8;
24 : UserHooks(), fRunBlock(0), fEventBlock(0), fEventNumber(0), fInfoPtr(info), fJetMatching(0)
29 std::string scheme = ps.
getParameter<std::string>(
"scheme");
31 if ( scheme ==
"Madgraph" )
35 else if ( scheme ==
"MLM" || scheme ==
"Alpgen" )
38 <<
"Port of " << scheme <<
"scheme \"" <<
"\""
39 " for parton-shower matching is still in progress."
44 <<
"Unknown scheme \"" << scheme <<
"\""
45 " specified for parton-shower matching."
62 <<
"Invalid RunInfo" << std::endl;
130 HepMC::HEPEVT_Wrapper::zero_everything();
134 std::vector<int> Py8PartonIdx;
135 Py8PartonIdx.clear();
136 std::vector<int> HEPEVTPartonIdx;
137 HEPEVTPartonIdx.clear();
143 int Py8PartonCounter = 0;
144 int HEPEVTPartonCounter = 0;
148 for (
int iprt=1; iprt<
event.size(); iprt++ )
150 const Particle&
part =
event[iprt];
151 if (
abs(part.status()) < 22 )
continue;
154 Py8PartonCounter = iprt;
160 for (
int iprt=2; iprt<hepeup.
NUP; iprt++ )
163 HepMC::HEPEVT_Wrapper::set_id( index, hepeup.
IDUP[iprt] );
164 HepMC::HEPEVT_Wrapper::set_status( index, 2 );
165 HepMC::HEPEVT_Wrapper::set_momentum( index, hepeup.
PUP[iprt][0], hepeup.
PUP[iprt][1], hepeup.
PUP[iprt][2], hepeup.
PUP[iprt][4] );
166 HepMC::HEPEVT_Wrapper::set_mass( index, hepeup.
PUP[iprt][4] );
168 HepMC::HEPEVT_Wrapper::set_parents( index, 0, 0 );
169 HepMC::HEPEVT_Wrapper::set_children( index, 0, 0 );
170 if ( hepeup.
MOTHUP[iprt].first > 2 && hepeup.
MOTHUP[iprt].second > 2 )
172 HEPEVTPartonCounter++;
175 Py8PartonIdx.push_back( Py8PartonCounter );
177 HEPEVTPartonIdx.push_back( HEPEVTPartonCounter);
178 HEPEVTPartonCounter++;
181 HepMC::HEPEVT_Wrapper::set_number_entries( index );
186 for (
int iprt=1; iprt<workEvent.size(); iprt++ )
189 const Particle&
part = workEvent[iprt];
192 if ( part.status() != 62 )
continue;
195 HepMC::HEPEVT_Wrapper::set_id( index, part.id() );
198 HepMC::HEPEVT_Wrapper::set_status( index, 1 );
199 HepMC::HEPEVT_Wrapper::set_momentum( index, part.px(), part.py(), part.pz(), part.e() );
200 HepMC::HEPEVT_Wrapper::set_mass( index, part.m() );
201 HepMC::HEPEVT_Wrapper::set_position( index, part.xProd(), part.yProd(), part.zProd(), part.tProd() );
202 HepMC::HEPEVT_Wrapper::set_parents( index, 0, 0 );
204 HepMC::HEPEVT_Wrapper::set_children( index, 0, 0 );
210 if ( parentId <= 0 )
continue;
212 for (
int idx=0; idx<(int)Py8PartonIdx.size(); idx++ )
214 if ( parentId == Py8PartonIdx[idx] )
216 int idx1 = HEPEVTPartonIdx[idx];
217 HepMC::HEPEVT_Wrapper::set_parents( index, idx1+1, idx1+1 );
224 HepMC::HEPEVT_Wrapper::set_number_entries( index );
226 HepMC::HEPEVT_Wrapper::set_event_number(
fEventNumber );
237 int parentId = fullEvent[
pos].mother1();
238 int parentPrevId = 0;
241 while ( parentId > 0 )
243 if ( parentId == fullEvent[counter].mother2() )
245 parentPrevId = parentId;
247 parentId = fullEvent[parentPrevId].mother1();
255 if ( (parentId < parentPrevId) || parentId < fullEvent[counter].mother2() )
259 if (
abs(fullEvent[counter].
status()) == 22 ||
abs(fullEvent[counter].
status()) == 23 )
268 parentPrevId = parentId;
269 parentId = fullEvent[parentPrevId].mother1();
272 else if ( parentId > parentPrevId || parentId > pos )
280 if (
abs(fullEvent[parentId].
status()) == 22 ||
abs(fullEvent[parentId].
status())== 23 )
284 if (
abs(fullEvent[parentId].
status()) < 22 )
T getParameter(std::string const &) const
lhef::LHEEvent * fEventBlock
virtual ~JetMatchingHook()
void setLHEEvent(lhef::LHEEvent *lhee)
virtual void beforeHadronisation(const lhef::LHEEvent *event)
const HEPEUP * getHEPEUP() const
void beforeHadronization(lhef::LHEEvent *lhee)
std::vector< std::pair< int, int > > MOTHUP
JetMatchingHook(const edm::ParameterSet &, Pythia8::Info *)
std::vector< FiveVector > PUP
virtual bool doVetoPartonLevel(const Pythia8::Event &event)
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
void setLHERunInfo(lhef::LHERunInfo *lheri)
void init(lhef::LHERunInfo *runInfo)
virtual void beforeHadronisationExec()
void setHEPEVT(const Pythia8::Event &)
gen::JetMatching * fJetMatching
virtual int match(const HepMC::GenEvent *partonLevel, const HepMC::GenEvent *finalState, bool showeredFinalState=false)=0
int getAncestor(int, const Pythia8::Event &)
virtual void init(const lhef::LHERunInfo *runInfo)
lhef::LHERunInfo * fRunBlock