16int 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>();
 
   32    runinfo->add_attribute(
"HEPRUP", hepr);
 
   36    runinfo->add_attribute(
"NPRUP",
 
   37                           std::make_shared<FloatAttribute>(hepr->heprup.NPRUP));
 
   42    std::vector<std::string> weightnames;
 
   43    weightnames.emplace_back(
"0"); 
 
   45    for ( 
int i = 0, N = hepr->heprup.weightinfo.size(); i < N; ++i ){
 
   46        weightnames.push_back(hepr->heprup.weightNameHepMC(i));}
 
   47    runinfo->set_weight_names(weightnames);
 
   51    for ( 
int i = 0, N = hepr->heprup.generators.size(); i < N; ++i ) {
 
   53        tool.
name =  hepr->heprup.generators[i].name;
 
   54        tool.
version =  hepr->heprup.generators[i].version;
 
   55        tool.
description =  hepr->heprup.generators[i].contents;
 
   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() ){
 
   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",
 
   82                        std:: make_shared<DoubleAttribute>(hepe->hepeup.AQCDUP));
 
   83        ev.add_attribute(
"AlphaEM",
 
   84                         std::make_shared<DoubleAttribute>(hepe->hepeup.AQEDUP));
 
   85        ev.add_attribute(
"NUP",
 
   86                         std::make_shared<IntAttribute>(hepe->hepeup.NUP));
 
   87        ev.add_attribute(
"IDPRUP",
 
   88                         std::make_shared<LongAttribute>(hepe->hepeup.IDPRUP));
 
   91        std::vector<GenParticlePtr> particles;
 
   92        std::map< std::pair<int,int>, GenVertexPtr> vertices;
 
   93        for ( 
int i = 0; i < hepe->hepeup.NUP; ++i )
 
   95            particles.push_back(std::make_shared<GenParticle>(hepe->momentum(i),hepe->hepeup.IDUP[i],hepe->hepeup.ISTUP[i]));
 
   97            std::pair<int,int> vertex_index(hepe->hepeup.MOTHUP[i].first,hepe->hepeup.MOTHUP[i].second);
 
   98            if (vertices.find(vertex_index)==vertices.end()) {vertices[vertex_index]=std::make_shared<GenVertex>();}
 
   99            vertices[vertex_index]->add_particle_out(particles.back());
 
  101        for ( 
auto v: vertices )
 
  103            std::pair<int,int> vertex_index=v.first;
 
  104            GenVertexPtr          vertex=v.second;
 
  105            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]);}
 
  107        for ( 
auto v: vertices ) {ev.add_vertex(v.second);}
 
  110        std::vector<double> wts;
 
  111        for ( 
int i = 0, N = hepe->hepeup.weights.size(); i < N; ++i ){
 
  112            wts.push_back(hepe->hepeup.weights[i].first);
 
  117        ev.add_attribute(
"OtherIncoming",
 
  118                         std::make_shared<AssociatedParticle>(particles[1]), particles[0]->
id());
 
  122        output.write_event(ev);
 
  133    hepr = std::shared_ptr<HEPRUPAttribute>();
 
  140        if ( !input.read_event(ev) || ev.event_number() == 0 ) 
break;
 
  143        std::shared_ptr<AssociatedParticle> assoc =
 
  145        if ( !assoc || !assoc->associated() ||
 
  146             assoc->associated() != ev.particles()[1] ) 
return 3;
 
  149        if ( input.run_info()->weight_names() != weightnames ) 
return 2;
 
  158            for ( 
int i = 0, N = hepr->tags.size(); i < N; ++i ){
 
  159                if ( hepr->tags[i]->name != 
"init" ){
 
  160                    hepr->tags[i]->print(writer.headerBlock());
 
  169            writer.heprup = hepr->heprup;
 
  170            if ( writer.heprup.eventfiles.size() >= 2 ) {
 
  171              writer.heprup.eventfiles[0].filename = 
"LHEF_example_1_out.plhe";
 
  172              writer.heprup.eventfiles[1].filename = 
"LHEF_example_2_out.plhe";
 
  179        std::shared_ptr<HEPEUPAttribute> hepe = ev.attribute<
HEPEUPAttribute>(
"HEPEUP");
 
  183        for ( 
int i = 0, N = hepe->tags.size(); i < N; ++i ){
 
  184            if ( hepe->tags[i]->name != 
"event" &&
 
  185                 hepe->tags[i]->name != 
"eventgroup" ){
 
  186                hepe->tags[i]->print(writer.eventComments());
 
  191        hepe->hepeup.AQCDUP =
 
  193        hepe->hepeup.AQEDUP =
 
  197        hepe->hepeup.IDPRUP =
 
  201        writer.hepeup = hepe->hepeup;
 
  202        writer.hepeup.heprup =  &writer.heprup;
 
Definition of class AssociatedParticle,.
Definition of class GenEvent.
Definition of class GenParticle.
Definition of class GenVertex.
Definition of class HEPRUPAttribute and class HEPEUAttribute.
Definition of class ReaderAscii.
Definition of class WriterAscii.
Attribute class allowing eg. a GenParticle to refer to another GenParticle.
Attribute that holds a real number as a double.
Attribute that holds a real number as a float.
float value() const
get the value associated to this Attribute.
Stores event-related information.
Class for storing data for LHEF run information.
Class for storing data for LHEF run information.
Attribute that holds an Integer implemented as an int.
Attribute that holds an Integer implemented as a long int.
GenEvent I/O parsing for structured text files.
GenEvent I/O serialization for structured text files.
static std::vector< XMLTag * > findXMLTags(std::string str, std::string *leftover=0)