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;
Definition of class HEPRUPAttribute and class HEPEUAttribute.
std::string weightNameHepMC(int i) const
void set_weight_names(const std::vector< std::string > &names)
Set the names of the weights in this run.
GenEvent I/O parsing for structured text files.
Definition of class GenParticle.
std::vector< EventFile > eventfiles
Class for storing data for LHEF run information.
Definition of class GenVertex.
Definition of class WriterAscii.
Class for storing data for LHEF run information.
const std::vector< ToolInfo > & tools() const
The vector of tools used to produce this run.
Les Houches event file classes.
LHEF::HEPRUP heprup
The actual HEPRUP object.
std::vector< LHEF::XMLTag * > tags
The parsed XML-tags.
Stores event-related information.
Attribute that holds a real number as a double.
FourVector momentum(int i) const
Get momentum.
Definition of class ReaderAscii.
std::vector< std::pair< double, const WeightInfo * > > weights
LHEF::HEPEUP hepeup
The actual HEPEUP object.
std::vector< Generator > generators
ConstGenParticlePtr associated() const
get a pointer to the associated particle.
int main(int argc, char **argv)
void add_attribute(const string &name, const shared_ptr< Attribute > &att)
add an attribute This will overwrite existing attribute if an attribute with the same name is present
std::vector< LHEF::XMLTag * > tags
The parsed XML-tags.
Attribute that holds an Integer implemented as an int.
Definition of class GenEvent.
Definition of class AssociatedParticle,.
Attribute class allowing eg. a GenParticle to refer to another GenParticle.
std::vector< WeightInfo > weightinfo
Attribute that holds an Integer implemented as an int.
GenEvent I/O serialization for structured text files.