235 MsgStream log(msgSvc(), name());
262 ion->Ncoll_hard=
static_cast<int>(jatt);
263 ion->Npart_proj=
static_cast<int>(np);
264 ion->Npart_targ=
static_cast<int>(nt);
265 ion->Ncoll=
static_cast<int>(n0+n10+n01+n11);
266 ion->N_Nwounded_collisions=
static_cast<int>(n01);
267 ion->Nwounded_N_collisions=
static_cast<int>(n10);
268 ion->Nwounded_Nwounded_collisions=
static_cast<int>(n11);
269 ion->spectator_neutrons=-1;
270 ion->spectator_protons=-1;
271 ion->impact_parameter= b;
272 ion->event_plane_angle=bphi;
273 ion->event_plane_angle=-1;
274 ion->sigma_inel_NN=sigmainel;
275 evt->set_heavy_ion(std::move(ion));
279 bool keptHistory = (
m_hiparnt.ihpr2(21) == 1);
287 std::vector<int> partOriginVertex_vec(numHijingPart, 0);
288 std::vector<int> partDecayVertex_vec(numHijingPart, -1);
289 std::vector<HepMC::GenParticlePtr> particleHepPartPtr_vec(numHijingPart,
nullptr);
293 std::vector<HepMC::GenVertexPtr> vertexPtrVec;
297 CLHEP::HepLorentzVector newVertex;
298 newVertex = CLHEP::HepLorentzVector(0.,0.,0.,0.);
301 else if(
m_sel) newVertex = CLHEP::HepLorentzVector(
m_x,
m_y,
m_z, 0.);
306 vertexPtrVec.push_back(v1);
308 double eproj = (double)
m_efrm;
309 if (
m_frame ==
"CMS " ) eproj = eproj / 2.;
312 if (
m_proj ==
"PBAR " ) {
314 }
else if (
m_proj ==
"N " ) {
316 }
else if (
m_proj ==
"NBAR " ) {
318 }
else if (
m_proj ==
"PI+ " ) {
320 }
else if (
m_proj ==
"PI- " ) {
322 }
else if (
m_proj ==
"A " ) {
323 proj_id = 3000000 +
m_iap;
326 v1->add_particle_in( part_p );
332 if (
m_targ ==
"PBAR " ) {
334 }
else if (
m_targ ==
"N " ) {
336 }
else if (
m_targ ==
"NBAR " ) {
338 }
else if (
m_targ ==
"PI+ " ) {
340 }
else if (
m_targ ==
"PI- " ) {
342 }
else if (
m_targ ==
"A " ) {
343 targ_id = 3000000 +
m_iat;
346 v1->add_particle_in( part_t );
348 evt->set_beam_particles(std::move(part_p),std::move(part_t));
359 bool inconsistency =
false;
363 for (
int i = 1; i <=
m_himain1.natt(); ++i)
371 int parentIndex =
m_himain2.katt(i, 3) - 1;
372 int parentOriginIndex = 0;
373 int parentDecayIndex = -1;
377 if (parentIndex >= 0)
379 parentOriginIndex = partOriginVertex_vec[parentIndex];
380 parentDecayIndex = partDecayVertex_vec[parentIndex];
395 << std::setw(5) << i <<
","
396 << std::setw(7) <<
m_himain2.patt(i, 1) <<
", "
397 << std::setw(7) <<
m_himain2.patt(i, 2) <<
", "
398 << std::setw(7) <<
m_himain2.patt(i, 3) <<
", "
399 << std::setw(7) <<
m_himain2.katt(i, 1) <<
", "
400 << std::setw(7) <<
m_himain2.katt(i, 2) <<
", "
401 << std::setw(7) <<
m_himain2.katt(i, 3) <<
", "
402 << std::setw(7) <<
m_himain2.katt(i, 4) <<
", "
403 << std::setw(7) <<
m_himain2.vatt(i, 1) <<
", "
404 << std::setw(7) <<
m_himain2.vatt(i, 2) <<
", "
405 << std::setw(7) <<
m_himain2.vatt(i, 3) );
412 int particleVertexIndex = 0;
421 if (parentDecayIndex != -1)
425 HepGeom::Point3D<double> vertex_pos(vertexPtrVec[parentDecayIndex]->position().
x(),
426 vertexPtrVec[parentDecayIndex]->position().
y(),
427 vertexPtrVec[parentDecayIndex]->position().
z());
428 double distance = vertex_pos.distance(particleStart.vect());
435 ATH_MSG_WARNING(
" Inconsistency in Hijing particle vertexing, particle # " << i
436 <<
" starting point (x,y,z) = ("
437 << particleStart.x() <<
", "
438 << particleStart.y() <<
", "
439 << particleStart.z() <<
") "
440 <<
" a distance " << distance <<
" away from parent decay point " );
445 log << MSG::WARNING <<
" Parent decay vertex: (x,y,z) = " << vertexPtrVec[parentDecayIndex]->position().x()
446 <<
", " << vertexPtrVec[parentDecayIndex]->position().y()
447 <<
", " << vertexPtrVec[parentDecayIndex]->position().z()
448 <<
", associated daughter IDs = ";
450 auto vertexPtrVec_particles_out_const_begin=vertexPtrVec[parentDecayIndex]->particles_out().begin();
451 auto vertexPtrVec_particles_out_const_end=vertexPtrVec[parentDecayIndex]->particles_out().end();
452 for (
auto iter = vertexPtrVec_particles_out_const_begin;
453 iter != vertexPtrVec_particles_out_const_end;
456 log << (*iter) <<
", ";
460 inconsistency =
true;
465 particleVertexIndex = parentDecayIndex;
472 HepGeom::Point3D<double> vertex_pos(vertexPtrVec[parentOriginIndex]->position().
x(),
473 vertexPtrVec[parentOriginIndex]->position().
y(),
474 vertexPtrVec[parentOriginIndex]->position().
z());
475 double distance = vertex_pos.distance(particleStart.vect());
483 ATH_MSG_WARNING(
"HIJING BUG:: Particle found with displaced vertex but no parent " );
484 ATH_MSG_WARNING(
" Particle parameters: " << std::fixed << std::setprecision(2)
485 << std::setw(5) << i <<
","
486 << std::setw(7) <<
m_himain2.patt(i, 1) <<
", "
487 << std::setw(7) <<
m_himain2.patt(i, 2) <<
", "
488 << std::setw(7) <<
m_himain2.patt(i, 3) <<
", "
489 << std::setw(7) <<
m_himain2.katt(i, 1) <<
", "
490 << std::setw(7) <<
m_himain2.katt(i, 2) <<
", "
491 << std::setw(7) <<
m_himain2.katt(i, 3) <<
", "
492 << std::setw(7) <<
m_himain2.katt(i, 4) <<
", "
493 << std::setw(7) <<
m_himain2.vatt(i, 1) <<
", "
494 << std::setw(7) <<
m_himain2.vatt(i, 2) <<
", "
495 << std::setw(7) <<
m_himain2.vatt(i, 3) );
499 particleVertexIndex = parentOriginIndex;
507 evt->add_vertex(newVertex_p);
508 vertexPtrVec.push_back(newVertex_p);
509 particleVertexIndex = vertexPtrVec.size() - 1;
513 partDecayVertex_vec[parentIndex] = particleVertexIndex;
518 newVertex_p->add_particle_in(particleHepPartPtr_vec[parentIndex]);
523 particleVertexIndex = parentOriginIndex;
532 for (
unsigned int ivert = 0; ivert < vertexPtrVec.size(); ivert++)
535 HepGeom::Point3D<double> vertex_pos(vertexPtrVec[ivert]->position().
x(),
536 vertexPtrVec[ivert]->position().
y(),
537 vertexPtrVec[ivert]->position().
z());
538 double distance = vertex_pos.distance(particleStart.vect());
552 evt->add_vertex(newVertex_p);
553 vertexPtrVec.push_back(std::move(newVertex_p));
554 particleVertexIndex = vertexPtrVec.size() - 1;
558 particleVertexIndex = foundVert;
566 int particleStatus = 1;
567 if (
m_himain2.katt(i, 4) == 11) particleStatus = 2;
583 particleHepPartPtr_vec[i-1] = newParticle_p;
587 vertexPtrVec[particleVertexIndex]->add_particle_out(std::move(newParticle_p));
588 partOriginVertex_vec[i-1] = particleVertexIndex;
594 for (
int i = 1; i <=
m_himain1.natt(); ++i)
600 ATH_MSG_WARNING(
" Hijing.cxx inconsistency: " << std::fixed << std::setprecision(2)
602 << std::setw(5) << i <<
","
603 << std::setw(7) <<
m_himain2.patt(i, 1) <<
", "
604 << std::setw(7) <<
m_himain2.patt(i, 2) <<
", "
605 << std::setw(7) <<
m_himain2.patt(i, 3) <<
", "
606 << std::setw(7) <<
m_himain2.katt(i, 1) <<
", "
607 << std::setw(7) <<
m_himain2.katt(i, 2) <<
", "
608 << std::setw(7) <<
m_himain2.katt(i, 3) <<
", "
609 << std::setw(7) <<
m_himain2.katt(i, 4) <<
", "
610 << std::setw(7) <<
m_himain2.vatt(i, 1) <<
", "
611 << std::setw(7) <<
m_himain2.vatt(i, 2) <<
", "
612 << std::setw(7) <<
m_himain2.vatt(i, 3) );
618 for (
int isg = 1; isg <=
m_hijjet2.nsg(); isg++)
620 for (
int jparton = 1; jparton <=
m_hijjet2.njsg(isg); jparton++)
622 double px =
m_hijjet2.pxsg(isg, jparton);
623 double py =
m_hijjet2.pysg(isg, jparton);
624 double pz =
m_hijjet2.pzsg(isg, jparton);
625 double mass =
m_hijjet2.pmsg(isg, jparton);
627 double ptsq = px*px + py*py;
628 double e = std::sqrt(ptsq + pz*pz + mass*mass);
629 double mt = std::sqrt(ptsq + mass*mass);
630 double pt = std::sqrt(ptsq);
632 double pseud = 0.5*std::log((e + pz)/(e - pz));
634 int partonId =
m_hijjet2.k2sg(isg, jparton);
641 <<
", eta = " << pseud );
655 for (
int iproj = 1; iproj <= iap; iproj++)
657 for (
int jparton = 1; jparton <=
m_hijjet1.npj(iproj); jparton++)
659 double px =
m_hijjet1.pjpx(iproj, jparton);
660 double py =
m_hijjet1.pjpy(iproj, jparton);
661 double pz =
m_hijjet1.pjpz(iproj, jparton);
662 double mass =
m_hijjet1.pjpm(iproj, jparton);
664 double ptsq = px*px + py*py;
665 double e = std::sqrt(ptsq + pz*pz + mass*mass);
666 double mt = std::sqrt(ptsq + mass*mass);
667 double pt = std::sqrt(ptsq);
669 double pseud = 0.5*std::log((e + pz)/(e - pz));
671 int partonId =
m_hijjet1.kfpj(iproj, jparton);
678 <<
", eta = " << pseud );
689 for (
int itarg = 1; itarg <= iat; itarg++)
691 for (
int jparton = 1; jparton <=
m_hijjet1.ntj(itarg); jparton++)
693 double px =
m_hijjet1.pjtx(itarg, jparton);
694 double py =
m_hijjet1.pjty(itarg, jparton);
695 double pz =
m_hijjet1.pjtz(itarg, jparton);
696 double mass =
m_hijjet1.pjtm(itarg, jparton);
698 double ptsq = px*px + py*py;
699 double e = std::sqrt(ptsq + pz*pz + mass*mass);
700 double mt = std::sqrt(ptsq + mass*mass);
701 double pt = std::sqrt(ptsq);
703 double pseud = 0.5*std::log((e + pz)/(e - pz));
705 int partonId =
m_hijjet1.kftj(itarg, jparton);
712 <<
", eta = " << pseud );
722 evt->set_units(HepMC3::Units::MEV, HepMC3::Units::MM);
727 double ranz = CLHEP::RandFlat::shoot(p_Engine);
731 for(
auto pitr: *evt){
732 tmpmom= pitr->momentum();
733 tmpmom.setX(-tmpmom.x());
734 tmpmom.setY(-tmpmom.y());
735 tmpmom.setZ(-tmpmom.z());
736 tmpmom.setT(tmpmom.t());
737 pitr->set_momentum(tmpmom);
743 return StatusCode::SUCCESS;