16 int main(
int ,
char ** ) {
22 std::shared_ptr<HEPRUPAttribute> hepr = std::make_shared<HEPRUPAttribute>();
23 hepr->
heprup = reader.heprup;
31 std::shared_ptr<GenRunInfo> runinfo = std::make_shared<GenRunInfo>();
37 std::make_shared<FloatAttribute>(hepr->
heprup.
NPRUP));
42 std::vector<std::string> weightnames;
43 weightnames.push_back(
"0");
56 runinfo->
tools().push_back(tool);
63 while ( reader.readEvent() ) {
70 std::shared_ptr<HEPEUPAttribute> hepe = std::make_shared<HEPEUPAttribute>();
71 if ( reader.outsideBlock.length() )
73 hepe->
hepeup = reader.hepeup;
74 GenEvent ev(runinfo, Units::GEV, Units::MM);
75 ev.set_event_number(neve);
79 ev.add_attribute(
"HEPEUP", hepe);
80 ev.add_attribute(
"AlphaQCD",
81 std:: make_shared<DoubleAttribute>(hepe->
hepeup.
AQCDUP));
82 ev.add_attribute(
"AlphaEM",
84 ev.add_attribute(
"NUP",
85 std::make_shared<IntAttribute>(hepe->
hepeup.
NUP));
86 ev.add_attribute(
"IDPRUP",
90 std::vector<GenParticlePtr> particles;
91 std::map< std::pair<int,int>, GenVertexPtr> vertices;
92 for (
int i = 0; i < hepe->
hepeup.
NUP; ++i )
97 if (vertices.find(vertex_index)==vertices.end())vertices[vertex_index]=std::make_shared<GenVertex>();
98 vertices[vertex_index]->add_particle_out(particles.back());
100 for (
auto v: vertices )
102 std::pair<int,int> vertex_index=v.first;
103 GenVertexPtr vertex=v.second;
104 for (
int i=vertex_index.first-1; i<vertex_index.second; i++)
if (i>=0&&i<(
int)particles.size()) vertex->add_particle_in(particles[i]);
106 for (
auto v: vertices ) ev.add_vertex(v.second);
109 std::vector<double> wts;
110 for (
int i = 0, N = hepe->
hepeup.
weights.size(); i < N; ++i )
115 ev.add_attribute(
"OtherIncoming",
116 std::make_shared<AssociatedParticle>(particles[1]), particles[0]->
id());
120 output.write_event(ev);
131 hepr = std::shared_ptr<HEPRUPAttribute>();
138 if ( !input.read_event(ev) || ev.event_number() == 0 )
break;
141 std::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 std::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;