247 MsgStream log(msgSvc(), name());
274 ion->Ncoll_hard=
static_cast<int>(jatt);
275 ion->Npart_proj=
static_cast<int>(np);
276 ion->Npart_targ=
static_cast<int>(nt);
277 ion->Ncoll=
static_cast<int>(n0+n10+n01+n11);
278 ion->N_Nwounded_collisions=
static_cast<int>(n01);
279 ion->Nwounded_N_collisions=
static_cast<int>(n10);
280 ion->Nwounded_Nwounded_collisions=
static_cast<int>(n11);
281 ion->spectator_neutrons=-1;
282 ion->spectator_protons=-1;
283 ion->impact_parameter= b;
284 ion->event_plane_angle=bphi;
285 ion->event_plane_angle=-1;
286 ion->sigma_inel_NN=sigmainel;
287 evt->set_heavy_ion(std::move(ion));
291 bool keptHistory = (
m_hiparnt.ihpr2(21) == 1);
299 std::vector<int> partOriginVertex_vec(numHijingPart, 0);
300 std::vector<int> partDecayVertex_vec(numHijingPart, -1);
301 std::vector<HepMC::GenParticlePtr> particleHepPartPtr_vec(numHijingPart,
nullptr);
305 std::vector<HepMC::GenVertexPtr> vertexPtrVec;
309 CLHEP::HepLorentzVector newVertex;
310 newVertex = CLHEP::HepLorentzVector(0.,0.,0.,0.);
313 else if(
m_sel) newVertex = CLHEP::HepLorentzVector(
m_x,
m_y,
m_z, 0.);
318 vertexPtrVec.push_back(v1);
320 double eproj = (double)
m_efrm;
321 if (
m_frame ==
"CMS " ) eproj = eproj / 2.;
324 if (
m_proj ==
"PBAR " ) {
326 }
else if (
m_proj ==
"N " ) {
328 }
else if (
m_proj ==
"NBAR " ) {
330 }
else if (
m_proj ==
"PI+ " ) {
332 }
else if (
m_proj ==
"PI- " ) {
334 }
else if (
m_proj ==
"A " ) {
335 proj_id = 3000000 +
m_iap;
338 v1->add_particle_in( part_p );
344 if (
m_targ ==
"PBAR " ) {
346 }
else if (
m_targ ==
"N " ) {
348 }
else if (
m_targ ==
"NBAR " ) {
350 }
else if (
m_targ ==
"PI+ " ) {
352 }
else if (
m_targ ==
"PI- " ) {
354 }
else if (
m_targ ==
"A " ) {
355 targ_id = 3000000 +
m_iat;
358 v1->add_particle_in( part_t );
360 evt->set_beam_particles(std::move(part_p),std::move(part_t));
371 bool inconsistency =
false;
375 for (
int i = 1; i <=
m_himain1.natt(); ++i)
383 int parentIndex =
m_himain2.katt(i, 3) - 1;
384 int parentOriginIndex = 0;
385 int parentDecayIndex = -1;
389 if (parentIndex >= 0)
391 parentOriginIndex = partOriginVertex_vec[parentIndex];
392 parentDecayIndex = partDecayVertex_vec[parentIndex];
407 << std::setw(5) << i <<
","
408 << std::setw(7) <<
m_himain2.patt(i, 1) <<
", "
409 << std::setw(7) <<
m_himain2.patt(i, 2) <<
", "
410 << std::setw(7) <<
m_himain2.patt(i, 3) <<
", "
411 << std::setw(7) <<
m_himain2.katt(i, 1) <<
", "
412 << std::setw(7) <<
m_himain2.katt(i, 2) <<
", "
413 << std::setw(7) <<
m_himain2.katt(i, 3) <<
", "
414 << std::setw(7) <<
m_himain2.katt(i, 4) <<
", "
415 << std::setw(7) <<
m_himain2.vatt(i, 1) <<
", "
416 << std::setw(7) <<
m_himain2.vatt(i, 2) <<
", "
417 << std::setw(7) <<
m_himain2.vatt(i, 3) );
424 int particleVertexIndex = 0;
433 if (parentDecayIndex != -1)
437 HepGeom::Point3D<double> vertex_pos(vertexPtrVec[parentDecayIndex]->position().
x(),
438 vertexPtrVec[parentDecayIndex]->position().
y(),
439 vertexPtrVec[parentDecayIndex]->position().
z());
440 double distance = vertex_pos.distance(particleStart.vect());
447 ATH_MSG_WARNING(
" Inconsistency in Hijing particle vertexing, particle # " << i
448 <<
" starting point (x,y,z) = ("
449 << particleStart.x() <<
", "
450 << particleStart.y() <<
", "
451 << particleStart.z() <<
") "
452 <<
" a distance " << distance <<
" away from parent decay point " );
457 log << MSG::WARNING <<
" Parent decay vertex: (x,y,z) = " << vertexPtrVec[parentDecayIndex]->position().x()
458 <<
", " << vertexPtrVec[parentDecayIndex]->position().y()
459 <<
", " << vertexPtrVec[parentDecayIndex]->position().z()
460 <<
", associated daughter IDs = ";
462 auto vertexPtrVec_particles_out_const_begin=vertexPtrVec[parentDecayIndex]->particles_out().begin();
463 auto vertexPtrVec_particles_out_const_end=vertexPtrVec[parentDecayIndex]->particles_out().end();
464 for (
auto iter = vertexPtrVec_particles_out_const_begin;
465 iter != vertexPtrVec_particles_out_const_end;
468 log << (*iter) <<
", ";
472 inconsistency =
true;
477 particleVertexIndex = parentDecayIndex;
484 HepGeom::Point3D<double> vertex_pos(vertexPtrVec[parentOriginIndex]->position().
x(),
485 vertexPtrVec[parentOriginIndex]->position().
y(),
486 vertexPtrVec[parentOriginIndex]->position().
z());
487 double distance = vertex_pos.distance(particleStart.vect());
495 ATH_MSG_WARNING(
"HIJING BUG:: Particle found with displaced vertex but no parent " );
496 ATH_MSG_WARNING(
" Particle parameters: " << std::fixed << std::setprecision(2)
497 << std::setw(5) << i <<
","
498 << std::setw(7) <<
m_himain2.patt(i, 1) <<
", "
499 << std::setw(7) <<
m_himain2.patt(i, 2) <<
", "
500 << std::setw(7) <<
m_himain2.patt(i, 3) <<
", "
501 << std::setw(7) <<
m_himain2.katt(i, 1) <<
", "
502 << std::setw(7) <<
m_himain2.katt(i, 2) <<
", "
503 << std::setw(7) <<
m_himain2.katt(i, 3) <<
", "
504 << std::setw(7) <<
m_himain2.katt(i, 4) <<
", "
505 << std::setw(7) <<
m_himain2.vatt(i, 1) <<
", "
506 << std::setw(7) <<
m_himain2.vatt(i, 2) <<
", "
507 << std::setw(7) <<
m_himain2.vatt(i, 3) );
511 particleVertexIndex = parentOriginIndex;
519 evt->add_vertex(newVertex_p);
520 vertexPtrVec.push_back(newVertex_p);
521 particleVertexIndex = vertexPtrVec.size() - 1;
525 partDecayVertex_vec[parentIndex] = particleVertexIndex;
530 newVertex_p->add_particle_in(particleHepPartPtr_vec[parentIndex]);
535 particleVertexIndex = parentOriginIndex;
544 for (
unsigned int ivert = 0; ivert < vertexPtrVec.size(); ivert++)
547 HepGeom::Point3D<double> vertex_pos(vertexPtrVec[ivert]->position().
x(),
548 vertexPtrVec[ivert]->position().
y(),
549 vertexPtrVec[ivert]->position().
z());
550 double distance = vertex_pos.distance(particleStart.vect());
564 evt->add_vertex(newVertex_p);
565 vertexPtrVec.push_back(std::move(newVertex_p));
566 particleVertexIndex = vertexPtrVec.size() - 1;
570 particleVertexIndex = foundVert;
578 int particleStatus = 1;
579 if (
m_himain2.katt(i, 4) == 11) particleStatus = 2;
595 particleHepPartPtr_vec[i-1] = newParticle_p;
599 vertexPtrVec[particleVertexIndex]->add_particle_out(std::move(newParticle_p));
600 partOriginVertex_vec[i-1] = particleVertexIndex;
606 for (
int i = 1; i <=
m_himain1.natt(); ++i)
612 ATH_MSG_WARNING(
" Hijing.cxx inconsistency: " << std::fixed << std::setprecision(2)
614 << std::setw(5) << i <<
","
615 << std::setw(7) <<
m_himain2.patt(i, 1) <<
", "
616 << std::setw(7) <<
m_himain2.patt(i, 2) <<
", "
617 << std::setw(7) <<
m_himain2.patt(i, 3) <<
", "
618 << std::setw(7) <<
m_himain2.katt(i, 1) <<
", "
619 << std::setw(7) <<
m_himain2.katt(i, 2) <<
", "
620 << std::setw(7) <<
m_himain2.katt(i, 3) <<
", "
621 << std::setw(7) <<
m_himain2.katt(i, 4) <<
", "
622 << std::setw(7) <<
m_himain2.vatt(i, 1) <<
", "
623 << std::setw(7) <<
m_himain2.vatt(i, 2) <<
", "
624 << std::setw(7) <<
m_himain2.vatt(i, 3) );
630 for (
int isg = 1; isg <=
m_hijjet2.nsg(); isg++)
632 for (
int jparton = 1; jparton <=
m_hijjet2.njsg(isg); jparton++)
634 double px =
m_hijjet2.pxsg(isg, jparton);
635 double py =
m_hijjet2.pysg(isg, jparton);
636 double pz =
m_hijjet2.pzsg(isg, jparton);
637 double mass =
m_hijjet2.pmsg(isg, jparton);
639 double ptsq = px*px + py*py;
640 double e = std::sqrt(ptsq + pz*pz + mass*mass);
641 double mt = std::sqrt(ptsq + mass*mass);
642 double pt = std::sqrt(ptsq);
644 double pseud = 0.5*std::log((e + pz)/(e - pz));
646 int partonId =
m_hijjet2.k2sg(isg, jparton);
653 <<
", eta = " << pseud );
667 for (
int iproj = 1; iproj <= iap; iproj++)
669 for (
int jparton = 1; jparton <=
m_hijjet1.npj(iproj); jparton++)
671 double px =
m_hijjet1.pjpx(iproj, jparton);
672 double py =
m_hijjet1.pjpy(iproj, jparton);
673 double pz =
m_hijjet1.pjpz(iproj, jparton);
674 double mass =
m_hijjet1.pjpm(iproj, jparton);
676 double ptsq = px*px + py*py;
677 double e = std::sqrt(ptsq + pz*pz + mass*mass);
678 double mt = std::sqrt(ptsq + mass*mass);
679 double pt = std::sqrt(ptsq);
681 double pseud = 0.5*std::log((e + pz)/(e - pz));
683 int partonId =
m_hijjet1.kfpj(iproj, jparton);
690 <<
", eta = " << pseud );
701 for (
int itarg = 1; itarg <= iat; itarg++)
703 for (
int jparton = 1; jparton <=
m_hijjet1.ntj(itarg); jparton++)
705 double px =
m_hijjet1.pjtx(itarg, jparton);
706 double py =
m_hijjet1.pjty(itarg, jparton);
707 double pz =
m_hijjet1.pjtz(itarg, jparton);
708 double mass =
m_hijjet1.pjtm(itarg, jparton);
710 double ptsq = px*px + py*py;
711 double e = std::sqrt(ptsq + pz*pz + mass*mass);
712 double mt = std::sqrt(ptsq + mass*mass);
713 double pt = std::sqrt(ptsq);
715 double pseud = 0.5*std::log((e + pz)/(e - pz));
717 int partonId =
m_hijjet1.kftj(itarg, jparton);
724 <<
", eta = " << pseud );
734 evt->set_units(HepMC3::Units::MEV, HepMC3::Units::MM);
739 double ranz = CLHEP::RandFlat::shoot(p_Engine);
743 for(
auto pitr: *evt){
744 tmpmom= pitr->momentum();
745 tmpmom.setX(-tmpmom.x());
746 tmpmom.setY(-tmpmom.y());
747 tmpmom.setZ(-tmpmom.z());
748 tmpmom.setT(tmpmom.t());
749 pitr->set_momentum(tmpmom);
755 return StatusCode::SUCCESS;