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));
93 std::vector<std::string> weightnames;
94 size_t N =
m_hepr->heprup.weightinfo.size();
95 weightnames.reserve(N);
96 for (
size_t i = 0; i < N; ++i ) weightnames.emplace_back(
m_hepr->heprup.weightNameHepMC(i));
101 if (weightnames.empty()) {
103 for (
size_t i = weightnames.size(); i < nweights; ++i ) weightnames.emplace_back(std::to_string(i));
105 run_info()->set_weight_names(weightnames);
109 for (
int i = 0, NN =
m_hepr->heprup.generators.size(); i < NN; ++i )
112 tool.
name =
m_hepr->heprup.generators[i].name;
115 run_info()->tools().emplace_back(tool);
129 bool read_result =
m_reader->readEvent();
137 std::shared_ptr<HEPEUPAttribute> hepe = std::make_shared<HEPEUPAttribute>();
138 if (
m_reader->outsideBlock.length() ) {
142 std::vector<LHEF::HEPEUP*> input;
143 if (!
m_reader->hepeup.subevents.empty()) { input.insert(input.end(), hepe->hepeup.subevents.begin(), hepe->hepeup.subevents.end()); }
144 else { input.emplace_back(&
m_reader->hepeup);}
145 int first_group_event =
m_neve;
147 for (
auto* ahepeup: input)
151 evt.
add_attribute(
"AlphaQCD", std::make_shared<DoubleAttribute>(ahepeup->AQCDUP));
152 evt.
add_attribute(
"AlphaEM", std::make_shared<DoubleAttribute>(ahepeup->AQEDUP));
153 evt.
add_attribute(
"NUP", std::make_shared<IntAttribute>(ahepeup->NUP));
154 evt.
add_attribute(
"IDPRUP", std::make_shared<LongAttribute>(ahepeup->IDPRUP));
156 std::vector<GenParticlePtr> particles;
157 if (ahepeup->NUP>0) particles.reserve(ahepeup->NUP);
158 std::map< std::pair<int, int>, GenVertexPtr> vertices;
159 for (
int i = 0; i < ahepeup->NUP; ++i )
161 FourVector mom((ahepeup->PUP)[i][0], (ahepeup->PUP)[i][1], (ahepeup->PUP)[i][2], (ahepeup->PUP)[i][3]);
162 particles.emplace_back(std::make_shared<GenParticle>(mom, ahepeup->IDUP[i], ahepeup->ISTUP[i]));
163 if ( i < 2 )
continue;
164 std::pair<int, int> vertex_index(ahepeup->MOTHUP[i].first, ahepeup->MOTHUP[i].second);
165 if (vertices.count(vertex_index) == 0) vertices[vertex_index] = std::make_shared<GenVertex>();
166 vertices[vertex_index]->add_particle_out(particles.back());
168 for (
auto& v: vertices )
170 std::pair<int, int> vertex_index = v.first;
171 GenVertexPtr vertex = v.second;
172 for (
int i = vertex_index.first-1; i < vertex_index.second; ++i) {
173 if ( i >= 0 && i <
static_cast<int>(particles.size())) {
174 vertex->add_particle_in(particles[i]);
178 std::pair<int, int> vertex_index(0, 0);
179 if (vertices.count(vertex_index) == 0) vertices[vertex_index] = std::make_shared<GenVertex>();
180 for (
size_t i = 0; i < particles.size(); ++i) {
181 if (!particles[i]->end_vertex() && !particles[i]->production_vertex())
183 if ( i < 2 ) { vertices[vertex_index]->add_particle_in(particles[i]); }
184 else { vertices[vertex_index]->add_particle_out(particles[i]);}
187 for (
auto& v: vertices ) {
188 if (!v.second->particles_out().empty() && !v.second->particles_in().empty()) {
192 if (particles.size() > 1)
194 particles[0]->set_status(4);
195 particles[1]->set_status(4);
201 std::vector<double> wts;
202 size_t N = ahepeup->weights.size();
204 for (
size_t i = 0; i < N; ++i )
206 wts.emplace_back(ahepeup->weights[i].first);
210 std::shared_ptr<GenCrossSection> xs = std::make_shared<GenCrossSection>();
213 xs->set_cross_section(
m_hepr->heprup.XSECUP,
m_hepr->heprup.XERRUP);
215 std::shared_ptr<GenPdfInfo> pi = std::make_shared<GenPdfInfo>();
216 pi->parton_id[0] = particles[0]->pdg_id();
217 pi->parton_id[1] = particles[1]->pdg_id();
218 pi->x[0] = std::abs(particles[0]->momentum().pz()/
m_hepr->heprup.EBMUP.first);
219 pi->x[1] = std::abs(particles[1]->momentum().pz()/
m_hepr->heprup.EBMUP.second);
220 pi->scale = ahepeup->pdfinfo.scale;
232 pi->pdf_id[0] =
m_hepr->heprup.PDFSUP.first;
233 pi->pdf_id[1] =
m_hepr->heprup.PDFSUP.second;