16 m_reader = std::make_shared<LHEF::Reader>(filename);
21 m_reader = std::make_shared<LHEF::Reader>(stream);
28 for (
int nn=n; nn>0; --nn)
42 m_hepr = std::make_shared<HEPRUPAttribute>();
49 for (
auto t1:
m_hepr->tags) {
50 if(t1->name!=
"header")
continue;
51 for (
auto t2: t1->tags) {
52 if(t2->name!=
"initrwgt")
continue;
53 for (
auto t3: t2->tags) {
54 if(t3->name!=
"weightgroup")
continue;
55 for (
auto t4: t3->tags)
if (t4->name==
"weight") nweights++;
71 std::make_shared<FloatAttribute>(
m_hepr->heprup.NPRUP));
77 std::vector<std::string> weightnames;
78 for (
int i = 0, N =
m_hepr->heprup.weightinfo.size(); i < N; ++i ) weightnames.push_back(
m_hepr->heprup.weightNameHepMC(i));
79 if (nweights==0) nweights=1;
80 for (
size_t i = weightnames.size(); i < nweights; ++i ) weightnames.push_back(std::to_string(i));
81 run_info()->set_weight_names(weightnames);
85 for (
int i = 0, N =
m_hepr->heprup.generators.size(); i < N; ++i )
111 std::shared_ptr<HEPEUPAttribute> hepe = std::make_shared<HEPEUPAttribute>();
112 if (
m_reader->outsideBlock.length() )
116 std::vector<LHEF::HEPEUP*> input;
117 if (
m_reader->hepeup.subevents.size()>0) input.insert(input.end(),hepe->hepeup.subevents.begin(),hepe->hepeup.subevents.end());
118 else (input.push_back(&
m_reader->hepeup));
119 int first_group_event=
m_neve;
121 for (
auto ahepeup: input)
125 evt.
add_attribute(
"AlphaQCD", std::make_shared<DoubleAttribute>(ahepeup->AQCDUP));
126 evt.
add_attribute(
"AlphaEM", std::make_shared<DoubleAttribute>(ahepeup->AQEDUP));
127 evt.
add_attribute(
"NUP", std::make_shared<IntAttribute>(ahepeup->NUP));
128 evt.
add_attribute(
"IDPRUP",std::make_shared<LongAttribute>(ahepeup->IDPRUP));
130 std::vector<GenParticlePtr> particles;
131 std::map< std::pair<int,int>, GenVertexPtr> vertices;
132 for (
int i = 0; i < ahepeup->NUP; ++i )
134 FourVector mom((ahepeup->PUP)[i][0],(ahepeup->PUP)[i][1],(ahepeup->PUP)[i][2],(ahepeup->PUP)[i][3]);
135 particles.push_back(std::make_shared<GenParticle>(mom,ahepeup->IDUP[i],ahepeup->ISTUP[i]));
137 std::pair<int,int> vertex_index(ahepeup->MOTHUP[i].first,ahepeup->MOTHUP[i].second);
138 if (vertices.find(vertex_index)==vertices.end())vertices[vertex_index]=std::make_shared<GenVertex>();
139 vertices[vertex_index]->add_particle_out(particles.back());
141 for (
auto v: vertices )
143 std::pair<int,int> vertex_index=v.first;
144 GenVertexPtr vertex=v.second;
145 for (
int i=vertex_index.first-1; i<vertex_index.second; ++i)
146 if (i>=0 && i<(
int)particles.size())
147 vertex->add_particle_in(particles[i]);
149 std::pair<int,int> vertex_index(0,0);
150 if (vertices.find(vertex_index)==vertices.end())vertices[vertex_index]=std::make_shared<GenVertex>();
151 for (
size_t i=0; i<particles.size(); ++i)
152 if (!particles[i]->end_vertex() && !particles[i]->production_vertex())
154 if (i<2) vertices[vertex_index]->add_particle_in(particles[i]);
155 else vertices[vertex_index]->add_particle_out(particles[i]);
157 for (
auto v: vertices ) evt.
add_vertex(v.second);
158 if (particles.size()>1)
160 particles[0]->set_status(4);
161 particles[1]->set_status(4);
167 std::vector<double> wts;
168 for (
int i = 0, N = ahepeup->weights.size(); i < N; ++i )
170 wts.push_back(ahepeup->weights[i].first);