17 int main(
int ,
char ** ) {
23 shared_ptr<HEPRUPAttribute> hepr = make_shared<HEPRUPAttribute>();
24 hepr->
heprup = reader.heprup;
28 hepr->
tags = XMLTag::findXMLTags(reader.headerBlock + reader.initComments);
32 shared_ptr<GenRunInfo> runinfo = make_shared<GenRunInfo>();
43 std::vector<std::string> weightnames;
44 weightnames.push_back(
"0");
57 runinfo->
tools().push_back(tool);
64 while ( reader.readEvent() ) {
71 shared_ptr<HEPEUPAttribute> hepe = make_shared<HEPEUPAttribute>();
72 if ( reader.outsideBlock.length() )
73 hepe->
tags = XMLTag::findXMLTags(reader.outsideBlock);
74 hepe->
hepeup = reader.hepeup;
75 GenEvent ev(runinfo, Units::GEV, Units::MM);
76 ev.set_event_number(neve);
80 ev.add_attribute(
"HEPEUP", hepe);
81 ev.add_attribute(
"AlphaQCD",
83 ev.add_attribute(
"AlphaEM",
85 ev.add_attribute(
"NUP",
86 make_shared<IntAttribute>(hepe->
hepeup.
NUP));
87 ev.add_attribute(
"IDPRUP",
91 GenParticlePtr p1 = make_shared<GenParticle>(hepe->
momentum(0),
94 GenParticlePtr p2 = make_shared<GenParticle>(hepe->
momentum(1),
97 GenVertexPtr vx = make_shared<GenVertex>();
98 vx->add_particle_in(p1);
99 vx->add_particle_in(p2);
101 for (
int i = 2; i < hepe->
hepeup.
NUP; ++i )
102 vx->add_particle_out(make_shared<GenParticle>
109 std::vector<double> wts;
110 for (
int i = 0, N = hepe->
hepeup.
weights.size(); i < N; ++i )
115 ev.add_attribute(
"OtherIncoming",
116 make_shared<AssociatedParticle>(p2), p1->id());
120 output.write_event(ev);
131 hepr = shared_ptr<HEPRUPAttribute>();
138 if ( !input.read_event(ev) || ev.event_number() == 0 )
break;
141 shared_ptr<AssociatedParticle> assoc =
144 assoc->
associated() != ev.particles()[1] )
return 3;
147 if ( input.run_info()->weight_names() != weightnames )
return 2;
156 for (
int i = 0, N = hepr->
tags.size(); i < N; ++i )
157 if ( hepr->
tags[i]->name !=
"init" )
158 hepr->
tags[i]->print(writer.headerBlock());
163 int(input.run_info()->
164 attribute<FloatAttribute>(
"NPRUP")->value());
167 writer.heprup = hepr->
heprup;
168 if ( writer.heprup.eventfiles.size() >= 2 ) {
169 writer.heprup.
eventfiles[0].filename =
"LHEF_example_1_out.plhe";
170 writer.heprup.eventfiles[1].filename =
"LHEF_example_2_out.plhe";
177 shared_ptr<HEPEUPAttribute> hepe =
182 for (
int i = 0, N = hepe->
tags.size(); i < N; ++i )
183 if ( hepe->
tags[i]->name !=
"event" &&
184 hepe->
tags[i]->name !=
"eventgroup" )
185 hepe->
tags[i]->print(writer.eventComments());
199 writer.hepeup = hepe->
hepeup;
200 writer.hepeup.
heprup = &writer.heprup;