205 MsgStream log(msgSvc(), name());
232 HepMC::GenHeavyIonPtr ion= std::make_shared<HepMC::GenHeavyIon>();
233 ion->Ncoll_hard=
static_cast<int>(jatt);
234 ion->Npart_proj=
static_cast<int>(np);
235 ion->Npart_targ=
static_cast<int>(nt);
236 ion->Ncoll=
static_cast<int>(n0+n10+n01+n11);
237 ion->N_Nwounded_collisions=
static_cast<int>(n01);
238 ion->Nwounded_N_collisions=
static_cast<int>(n10);
239 ion->Nwounded_Nwounded_collisions=
static_cast<int>(n11);
240 ion->spectator_neutrons=-1;
241 ion->spectator_protons=-1;
242 ion->impact_parameter= b;
243 ion->event_plane_angle=bphi;
244 ion->event_plane_angle=-1;
245 ion->sigma_inel_NN=sigmainel;
246 evt->set_heavy_ion(std::move(ion));
250 static_cast<int>(jatt),
251 static_cast<int>(np),
252 static_cast<int>(nt),
253 static_cast<int>(n0+n10+n01+n11),
254 static_cast<int>(-1),
255 static_cast<int>(-1),
256 static_cast<int>(n01),
257 static_cast<int>(n10),
258 static_cast<int>(n11),
264 evt->set_heavy_ion(std::move(ion));
265 std::cout <<
" heavy ion " << evt->heavy_ion() << std::endl;
270 bool keptHistory = (
m_hiparnt.ihpr2(21) == 1);
278 std::vector<int> partOriginVertex_vec(numHijingPart, 0);
279 std::vector<int> partDecayVertex_vec(numHijingPart, -1);
280 std::vector<HepMC::GenParticlePtr> particleHepPartPtr_vec(numHijingPart,
nullptr);
284 std::vector<HepMC::GenVertexPtr> vertexPtrVec;
288 CLHEP::HepLorentzVector newVertex;
289 newVertex = CLHEP::HepLorentzVector(0.,0.,0.,0.);
292 else if(
m_sel) newVertex = CLHEP::HepLorentzVector(
m_x,
m_y,
m_z, 0.);
297 vertexPtrVec.push_back(v1);
299 double eproj = (double)
m_efrm;
300 if (
m_frame ==
"CMS " ) eproj = eproj / 2.;
303 if (
m_proj ==
"PBAR " ) {
305 }
else if (
m_proj ==
"N " ) {
307 }
else if (
m_proj ==
"NBAR " ) {
309 }
else if (
m_proj ==
"PI+ " ) {
311 }
else if (
m_proj ==
"PI- " ) {
313 }
else if (
m_proj ==
"A " ) {
314 proj_id = 3000000 +
m_iap;
317 v1->add_particle_in( part_p );
323 if (
m_targ ==
"PBAR " ) {
325 }
else if (
m_targ ==
"N " ) {
327 }
else if (
m_targ ==
"NBAR " ) {
329 }
else if (
m_targ ==
"PI+ " ) {
331 }
else if (
m_targ ==
"PI- " ) {
333 }
else if (
m_targ ==
"A " ) {
334 targ_id = 3000000 +
m_iat;
337 v1->add_particle_in( part_t );
339 evt->set_beam_particles(std::move(part_p),std::move(part_t));
350 bool inconsistency =
false;
354 for (
int i = 1; i <=
m_himain1.natt(); ++i)
362 int parentIndex =
m_himain2.katt(i, 3) - 1;
363 int parentOriginIndex = 0;
364 int parentDecayIndex = -1;
368 if (parentIndex >= 0)
370 parentOriginIndex = partOriginVertex_vec[parentIndex];
371 parentDecayIndex = partDecayVertex_vec[parentIndex];
386 << std::setw(5) << i <<
","
387 << std::setw(7) <<
m_himain2.patt(i, 1) <<
", "
388 << std::setw(7) <<
m_himain2.patt(i, 2) <<
", "
389 << std::setw(7) <<
m_himain2.patt(i, 3) <<
", "
390 << std::setw(7) <<
m_himain2.katt(i, 1) <<
", "
391 << std::setw(7) <<
m_himain2.katt(i, 2) <<
", "
392 << std::setw(7) <<
m_himain2.katt(i, 3) <<
", "
393 << std::setw(7) <<
m_himain2.katt(i, 4) <<
", "
394 << std::setw(7) <<
m_himain2.vatt(i, 1) <<
", "
395 << std::setw(7) <<
m_himain2.vatt(i, 2) <<
", "
396 << std::setw(7) <<
m_himain2.vatt(i, 3) );
403 int particleVertexIndex = 0;
412 if (parentDecayIndex != -1)
416 HepGeom::Point3D<double> vertex_pos(vertexPtrVec[parentDecayIndex]->position().
x(),
417 vertexPtrVec[parentDecayIndex]->position().
y(),
418 vertexPtrVec[parentDecayIndex]->position().
z());
419 double distance = vertex_pos.distance(particleStart.vect());
426 ATH_MSG_WARNING(
" Inconsistency in Hijing particle vertexing, particle # " << i
427 <<
" starting point (x,y,z) = ("
428 << particleStart.x() <<
", "
429 << particleStart.y() <<
", "
430 << particleStart.z() <<
") "
431 <<
" a distance " << distance <<
" away from parent decay point " );
436 log << MSG::WARNING <<
" Parent decay vertex: (x,y,z) = " << vertexPtrVec[parentDecayIndex]->position().x()
437 <<
", " << vertexPtrVec[parentDecayIndex]->position().y()
438 <<
", " << vertexPtrVec[parentDecayIndex]->position().z()
439 <<
", associated daughter IDs = ";
442 auto vertexPtrVec_particles_out_const_begin=vertexPtrVec[parentDecayIndex]->particles_out().begin();
443 auto vertexPtrVec_particles_out_const_end=vertexPtrVec[parentDecayIndex]->particles_out().end();
445 auto vertexPtrVec_particles_out_const_begin=vertexPtrVec[parentDecayIndex]->particles_out_const_begin();
446 auto vertexPtrVec_particles_out_const_end=vertexPtrVec[parentDecayIndex]->particles_out_const_end();
448 for (
auto iter = vertexPtrVec_particles_out_const_begin;
449 iter != vertexPtrVec_particles_out_const_end;
452 log << (*iter) <<
", ";
456 inconsistency =
true;
461 particleVertexIndex = parentDecayIndex;
468 HepGeom::Point3D<double> vertex_pos(vertexPtrVec[parentOriginIndex]->position().
x(),
469 vertexPtrVec[parentOriginIndex]->position().
y(),
470 vertexPtrVec[parentOriginIndex]->position().
z());
471 double distance = vertex_pos.distance(particleStart.vect());
479 ATH_MSG_WARNING(
"HIJING BUG:: Particle found with displaced vertex but no parent " );
480 ATH_MSG_WARNING(
" Particle parameters: " << std::fixed << std::setprecision(2)
481 << std::setw(5) << i <<
","
482 << std::setw(7) <<
m_himain2.patt(i, 1) <<
", "
483 << std::setw(7) <<
m_himain2.patt(i, 2) <<
", "
484 << std::setw(7) <<
m_himain2.patt(i, 3) <<
", "
485 << std::setw(7) <<
m_himain2.katt(i, 1) <<
", "
486 << std::setw(7) <<
m_himain2.katt(i, 2) <<
", "
487 << std::setw(7) <<
m_himain2.katt(i, 3) <<
", "
488 << std::setw(7) <<
m_himain2.katt(i, 4) <<
", "
489 << std::setw(7) <<
m_himain2.vatt(i, 1) <<
", "
490 << std::setw(7) <<
m_himain2.vatt(i, 2) <<
", "
491 << std::setw(7) <<
m_himain2.vatt(i, 3) );
495 particleVertexIndex = parentOriginIndex;
503 evt->add_vertex(newVertex_p);
504 vertexPtrVec.push_back(newVertex_p);
505 particleVertexIndex = vertexPtrVec.size() - 1;
509 partDecayVertex_vec[parentIndex] = particleVertexIndex;
514 newVertex_p->add_particle_in(particleHepPartPtr_vec[parentIndex]);
519 particleVertexIndex = parentOriginIndex;
528 for (
unsigned int ivert = 0; ivert < vertexPtrVec.size(); ivert++)
531 HepGeom::Point3D<double> vertex_pos(vertexPtrVec[ivert]->position().
x(),
532 vertexPtrVec[ivert]->position().
y(),
533 vertexPtrVec[ivert]->position().
z());
534 double distance = vertex_pos.distance(particleStart.vect());
548 evt->add_vertex(newVertex_p);
549 vertexPtrVec.push_back(std::move(newVertex_p));
550 particleVertexIndex = vertexPtrVec.size() - 1;
554 particleVertexIndex = foundVert;
562 int particleStatus = 1;
563 if (
m_himain2.katt(i, 4) == 11) particleStatus = 2;
567 HepMC::FourVector particleP4(
m_himain2.patt(i, 1),
579 particleHepPartPtr_vec[i-1] = newParticle_p;
583 vertexPtrVec[particleVertexIndex]->add_particle_out(std::move(newParticle_p));
584 partOriginVertex_vec[i-1] = particleVertexIndex;
590 for (
int i = 1; i <=
m_himain1.natt(); ++i)
596 ATH_MSG_WARNING(
" Hijing.cxx inconsistency: " << std::fixed << std::setprecision(2)
598 << std::setw(5) << i <<
","
599 << std::setw(7) <<
m_himain2.patt(i, 1) <<
", "
600 << std::setw(7) <<
m_himain2.patt(i, 2) <<
", "
601 << std::setw(7) <<
m_himain2.patt(i, 3) <<
", "
602 << std::setw(7) <<
m_himain2.katt(i, 1) <<
", "
603 << std::setw(7) <<
m_himain2.katt(i, 2) <<
", "
604 << std::setw(7) <<
m_himain2.katt(i, 3) <<
", "
605 << std::setw(7) <<
m_himain2.katt(i, 4) <<
", "
606 << std::setw(7) <<
m_himain2.vatt(i, 1) <<
", "
607 << std::setw(7) <<
m_himain2.vatt(i, 2) <<
", "
608 << std::setw(7) <<
m_himain2.vatt(i, 3) );
614 for (
int isg = 1; isg <=
m_hijjet2.nsg(); isg++)
616 for (
int jparton = 1; jparton <=
m_hijjet2.njsg(isg); jparton++)
618 double px =
m_hijjet2.pxsg(isg, jparton);
619 double py =
m_hijjet2.pysg(isg, jparton);
620 double pz =
m_hijjet2.pzsg(isg, jparton);
621 double mass =
m_hijjet2.pmsg(isg, jparton);
623 double ptsq = px*px + py*py;
624 double e = std::sqrt(ptsq + pz*pz + mass*mass);
625 double mt = std::sqrt(ptsq + mass*mass);
626 double pt = std::sqrt(ptsq);
628 double pseud = 0.5*std::log((e + pz)/(e - pz));
630 int partonId =
m_hijjet2.k2sg(isg, jparton);
637 <<
", eta = " << pseud );
651 for (
int iproj = 1; iproj <= iap; iproj++)
653 for (
int jparton = 1; jparton <=
m_hijjet1.npj(iproj); jparton++)
655 double px =
m_hijjet1.pjpx(iproj, jparton);
656 double py =
m_hijjet1.pjpy(iproj, jparton);
657 double pz =
m_hijjet1.pjpz(iproj, jparton);
658 double mass =
m_hijjet1.pjpm(iproj, jparton);
660 double ptsq = px*px + py*py;
661 double e = std::sqrt(ptsq + pz*pz + mass*mass);
662 double mt = std::sqrt(ptsq + mass*mass);
663 double pt = std::sqrt(ptsq);
665 double pseud = 0.5*std::log((e + pz)/(e - pz));
667 int partonId =
m_hijjet1.kfpj(iproj, jparton);
674 <<
", eta = " << pseud );
685 for (
int itarg = 1; itarg <= iat; itarg++)
687 for (
int jparton = 1; jparton <=
m_hijjet1.ntj(itarg); jparton++)
689 double px =
m_hijjet1.pjtx(itarg, jparton);
690 double py =
m_hijjet1.pjty(itarg, jparton);
691 double pz =
m_hijjet1.pjtz(itarg, jparton);
692 double mass =
m_hijjet1.pjtm(itarg, jparton);
694 double ptsq = px*px + py*py;
695 double e = std::sqrt(ptsq + pz*pz + mass*mass);
696 double mt = std::sqrt(ptsq + mass*mass);
697 double pt = std::sqrt(ptsq);
699 double pseud = 0.5*std::log((e + pz)/(e - pz));
701 int partonId =
m_hijjet1.kftj(itarg, jparton);
708 <<
", eta = " << pseud );
719 evt->set_units(HepMC3::Units::MEV, HepMC3::Units::MM);
724 HepMC::FourVector tmpmom(0.,0.,0.,0.);
725 double ranz = CLHEP::RandFlat::shoot(p_Engine);
729 for(
auto pitr: *evt){
730 tmpmom= pitr->momentum();
731 tmpmom.setX(-tmpmom.x());
732 tmpmom.setY(-tmpmom.y());
733 tmpmom.setZ(-tmpmom.z());
734 tmpmom.setT(tmpmom.t());
735 pitr->set_momentum(tmpmom);
741 return StatusCode::SUCCESS;