49    m_hepr = std::make_shared<HEPRUPAttribute>();
 
   56    for (
auto* t1: 
m_hepr->tags) {
 
   57        if (t1->name != 
"header") 
continue;
 
   58        for (
auto* t2: t1->tags) {
 
   59            if (t2->name != 
"initrwgt") 
continue;
 
   60            for (
auto* t3: t2->tags) {
 
   61                if (t3->name != 
"weightgroup") 
continue;
 
   62                for (
auto* t4: t3->tags) 
if (t4->name == 
"weight") nweights++;
 
   76    run_info()->add_attribute(
"NPRUP",std::make_shared<IntAttribute>(
m_hepr->heprup.NPRUP));
 
   77    run_info()->add_attribute(
"XSECUP",std::make_shared<VectorDoubleAttribute>(
m_hepr->heprup.XSECUP));
 
   78    run_info()->add_attribute(
"XERRUP",std::make_shared<VectorDoubleAttribute>(
m_hepr->heprup.XERRUP));
 
   79    run_info()->add_attribute(
"LPRUP",std::make_shared<VectorIntAttribute>(
m_hepr->heprup.LPRUP));
 
   80    run_info()->add_attribute(
"PDFGUP1",std::make_shared<IntAttribute>(
m_hepr->heprup.PDFGUP.first));
 
   81    run_info()->add_attribute(
"PDFGUP2",std::make_shared<IntAttribute>(
m_hepr->heprup.PDFGUP.second));
 
   82    run_info()->add_attribute(
"PDFSUP1",std::make_shared<IntAttribute>(
m_hepr->heprup.PDFSUP.first));
 
   83    run_info()->add_attribute(
"PDFSUP2",std::make_shared<IntAttribute>(
m_hepr->heprup.PDFSUP.second));
 
   84    run_info()->add_attribute(
"IDBMUP1",std::make_shared<IntAttribute>(
m_hepr->heprup.IDBMUP.first));
 
   85    run_info()->add_attribute(
"IDBMUP2",std::make_shared<IntAttribute>(
m_hepr->heprup.IDBMUP.second));
 
   86    run_info()->add_attribute(
"EBMUP1",std::make_shared<DoubleAttribute>(
m_hepr->heprup.EBMUP.first));
 
   87    run_info()->add_attribute(
"EBMUP2",std::make_shared<DoubleAttribute>(
m_hepr->heprup.EBMUP.second));
 
   98    std::vector<std::string> weightnames;
 
   99    size_t N = 
m_hepr->heprup.weightinfo.size();
 
  100    weightnames.reserve(N);
 
  101    for ( 
size_t i = 0; i < N; ++i ) weightnames.emplace_back(
m_hepr->heprup.weightNameHepMC(i));
 
  106    if (weightnames.empty()) {
 
  107        HEPMC3_WARNING(
"ReaderLHEF::init: empty weightinfo in the LHEF file.")
 
  108        for ( 
size_t i = weightnames.size(); i < nweights; ++i ) weightnames.emplace_back(std::to_string(i));
 
  110    run_info()->set_weight_names(weightnames);
 
  114    for ( 
int i = 0, N = 
m_hepr->heprup.generators.size(); i < N; ++i )
 
  117        tool.
name =  
m_hepr->heprup.generators[i].name;
 
  120        run_info()->tools().emplace_back(tool);
 
 
  134    bool read_result = 
m_reader->readEvent();
 
  142    std::shared_ptr<HEPEUPAttribute> hepe = std::make_shared<HEPEUPAttribute>();
 
  143    if ( 
m_reader->outsideBlock.length() ) {
 
  147    std::vector<LHEF::HEPEUP*> input;
 
  148    if (!
m_reader->hepeup.subevents.empty()) { input.insert(input.end(), hepe->hepeup.subevents.begin(), hepe->hepeup.subevents.end()); }
 
  149    else { input.emplace_back(&
m_reader->hepeup);}
 
  150    int first_group_event = 
m_neve;
 
  152    for (
auto* ahepeup: input)
 
  156        evt.
add_attribute(
"AlphaQCD", std::make_shared<DoubleAttribute>(ahepeup->AQCDUP));
 
  157        evt.
add_attribute(
"AlphaEM", std::make_shared<DoubleAttribute>(ahepeup->AQEDUP));
 
  158        evt.
add_attribute(
"NUP",  std::make_shared<IntAttribute>(ahepeup->NUP));
 
  159        evt.
add_attribute(
"IDPRUP", std::make_shared<LongAttribute>(ahepeup->IDPRUP));
 
  161        std::vector<GenParticlePtr> particles;
 
  162        if (ahepeup->NUP>0) particles.reserve(ahepeup->NUP);
 
  163        std::map< std::pair<int, int>, GenVertexPtr> vertices;
 
  164        for ( 
int i = 0; i < ahepeup->NUP; ++i )
 
  166            FourVector mom((ahepeup->PUP)[i][0], (ahepeup->PUP)[i][1], (ahepeup->PUP)[i][2], (ahepeup->PUP)[i][3]);
 
  167            particles.emplace_back(std::make_shared<GenParticle>(mom, ahepeup->IDUP[i], ahepeup->ISTUP[i]));
 
  168            if ( i < 2 ) 
continue;
 
  169            std::pair<int, int> vertex_index(ahepeup->MOTHUP[i].first, ahepeup->MOTHUP[i].second);
 
  170            if (vertices.count(vertex_index) == 0) vertices[vertex_index] = std::make_shared<GenVertex>();
 
  171            vertices[vertex_index]->add_particle_out(particles.back());
 
  173        for ( 
auto& v: vertices )
 
  175            std::pair<int, int> vertex_index = v.first;
 
  176            GenVertexPtr          vertex = v.second;
 
  177            for (
int i = vertex_index.first-1; i < vertex_index.second; ++i) {
 
  178                if ( i >= 0 && i < (
int)particles.size()) {
 
  179                    vertex->add_particle_in(particles[i]);
 
  183        std::pair<int, int> vertex_index(0, 0);
 
  184        if (vertices.count(vertex_index) == 0) vertices[vertex_index] = std::make_shared<GenVertex>();
 
  185        for (
size_t i = 0; i < particles.size(); ++i) {
 
  186            if (!particles[i]->end_vertex() && !particles[i]->production_vertex())
 
  188                if ( i < 2 ) { vertices[vertex_index]->add_particle_in(particles[i]); }
 
  189                else { vertices[vertex_index]->add_particle_out(particles[i]);}
 
  192        for ( 
auto v: vertices ) {
 
  193            if (!v.second->particles_out().empty() && !v.second->particles_in().empty()) {
 
  197        if (particles.size() > 1)
 
  199            particles[0]->set_status(4);
 
  200            particles[1]->set_status(4);
 
  206        std::vector<double> wts;
 
  207        size_t N = ahepeup->weights.size();
 
  209        for ( 
size_t i = 0; i < N; ++i )
 
  211            wts.emplace_back(ahepeup->weights[i].first);
 
  215        std::shared_ptr<GenCrossSection>  xs     = std::make_shared<GenCrossSection>();
 
  218        xs->set_cross_section(
m_hepr->heprup.XSECUP, 
m_hepr->heprup.XERRUP);
 
  220        std::shared_ptr<GenPdfInfo> pi  = std::make_shared<GenPdfInfo>();
 
  221        pi->parton_id[0] = particles[0]->pdg_id();
 
  222        pi->parton_id[1] = particles[1]->pdg_id();
 
  223        pi->x[0] = std::abs(particles[0]->momentum().pz()/
m_hepr->heprup.EBMUP.first);
 
  224        pi->x[1] = std::abs(particles[1]->momentum().pz()/
m_hepr->heprup.EBMUP.second);
 
  225        pi->scale = ahepeup->pdfinfo.scale;
 
  237        pi->pdf_id[0] = 
m_hepr->heprup.PDFSUP.first;
 
  238        pi->pdf_id[1] = 
m_hepr->heprup.PDFSUP.second;