6 #include "GaudiKernel/PhysicalConstants.h"
7 #include <CLHEP/Vector/LorentzVector.h>
8 using namespace Gaudi::Units;
24 if (m_mcEventKey == m_keyout && m_DeepCopy) {
25 ATH_MSG_FATAL(
"Input and output MC event keys cannot be the same (" << m_mcEventKey <<
")");
26 return StatusCode::FAILURE;
28 return StatusCode::SUCCESS;
36 for(
const HepMC::GenEvent*
evt : *events_const()) {
37 mcCollptra->push_back(
new HepMC::GenEvent(*
evt));
42 std::vector<HepMC::GenVertexPtr> lambda_vertices_to_remove;
44 const int abspid = std::abs(
part->pdg_id());
45 if (abspid != 310 && abspid != 3122 && abspid != 3222 && abspid != 3112 && abspid != 3322 && abspid != 3312 && abspid != 3334 )
continue;
46 if (!
part->end_vertex())
continue;
47 lambda_vertices_to_remove.push_back(
part->end_vertex());
50 for (
auto v: lambda_vertices_to_remove) (*evt)->remove_vertex(
v);
53 std::set<int> Lambdas;
54 std::set<int> vtx_to_delete;
55 for (HepMC::GenEvent::vertex_const_iterator vtx = (*evt)->vertices_begin(); vtx != (*evt)->vertices_end(); ++vtx) {
57 if ( vtx_to_delete.find((*vtx)->barcode()) == vtx_to_delete.end() &&
58 (*vtx)->particles_in_const_begin() != (*vtx)->particles_in_const_end() ) {
59 HepMC::GenVertex::particles_in_const_iterator
part = (*vtx)->particles_in_const_begin();
60 bool lambda_not_found =
true;
61 const int abspid = std::abs((*part)->pdg_id());
63 if (abspid == 310 || abspid == 3122 || abspid == 3222 || abspid == 3112 ||
64 abspid == 3322 || abspid == 3312 || abspid == 3334 ) {
65 lambda_not_found =
false;
66 Lambdas.insert((*part)->barcode());
67 vtx_to_delete.insert((*vtx)->barcode());
70 for (HepMC::GenVertex::vertex_iterator
desc = (*vtx)->vertices_begin(HepMC::descendants);
71 desc != (*vtx)->vertices_end(HepMC::descendants); ++
desc) {
72 vtx_to_delete.insert((*desc)->barcode());
76 }
while (
part != (*vtx)->particles_in_const_end() && lambda_not_found);
87 HepMC::GenVertex* vdel = (*evt)->barcode_to_vertex(*
v);
88 (*evt)->remove_vertex(vdel);
94 if (evtStore()->record(mcCollptra, m_keyout).isFailure()){
96 return StatusCode::FAILURE;
101 for(
const HepMC::GenEvent*
evt : *events_const()) {
102 auto pdfinfo =
evt->pdf_info();
103 auto ion =
evt->heavy_ion();
106 std::cout <<
"PdfInfo: "
107 << pdfinfo->parton_id[0] <<
", "
108 << pdfinfo->parton_id[1] <<
", "
109 << pdfinfo->x[0] <<
", "
110 << pdfinfo->x[1] <<
", "
111 << pdfinfo->scale <<
", "
112 << pdfinfo->xf[0] <<
", "
113 << pdfinfo->xf[1] <<
", "
114 << pdfinfo->pdf_id[0] <<
", "
115 << pdfinfo->pdf_id[1]
120 std::cout << std::endl;
121 std::cout <<
"Heavy Ion: "
122 << ion->Ncoll_hard <<
", "
123 << ion->Npart_proj <<
" , "
124 << ion->Npart_targ<<
", "
126 << ion->spectator_neutrons <<
", "
127 << ion->spectator_protons <<
", "
128 << ion->N_Nwounded_collisions <<
", "
129 << ion->Nwounded_N_collisions <<
", "
130 << ion->Nwounded_Nwounded_collisions <<
", "
131 << ion->impact_parameter <<
", "
132 << ion->event_plane_angle <<
", "
133 << ion->eccentricity <<
", "
134 << ion->sigma_inel_NN
139 std::cout <<
"PdfInfo: "
140 << pdfinfo->id1() <<
", "
141 << pdfinfo->id2() <<
", "
142 << pdfinfo->x1() <<
", "
143 << pdfinfo->x2() <<
", "
144 << pdfinfo->scalePDF() <<
", "
145 << pdfinfo->pdf1() <<
", "
146 << pdfinfo->pdf2() <<
", "
147 << pdfinfo->pdf_id1() <<
", "
148 << pdfinfo->pdf_id2()
153 std::cout << std::endl;
154 std::cout <<
"Heavy Ion: "
155 << ion->Ncoll_hard() <<
", "
156 << ion->Npart_proj() <<
" , "
157 << ion->Npart_targ()<<
", "
158 << ion->Ncoll()<<
", "
159 << ion->spectator_neutrons() <<
", "
160 << ion->spectator_protons() <<
", "
161 << ion->N_Nwounded_collisions() <<
", "
162 << ion->Nwounded_N_collisions() <<
", "
163 << ion->Nwounded_Nwounded_collisions() <<
", "
164 << ion->impact_parameter() <<
", "
165 << ion->event_plane_angle() <<
", "
166 << ion->eccentricity() <<
", "
167 << ion->sigma_inel_NN()
171 if (m_VerboseOutput) {
177 double rapid =
part->momentum().pseudoRapidity();
178 double phi =
part->momentum().phi();
179 double et=
part->momentum().perp();
180 int p_stat=
part->status();
181 int p_id =
part->pdg_id();
182 std::cout <<
" eta = " << rapid<<
" Phi = " <<
phi <<
" Et = " <<
et/
GeV <<
" Status= " << p_stat <<
" PDG ID= "<< p_id << std::endl;
185 if(m_PrintQuasiStableParticles) {
186 for (
const auto& pitr: *
evt) {
187 int p_stat=pitr->status();
188 if(p_stat==2 && pitr->production_vertex() && pitr->end_vertex()) {
189 const auto& prodVtx = pitr->production_vertex()->position();
190 const auto& endVtx = pitr->end_vertex()->position();
191 const CLHEP::HepLorentzVector lv0( prodVtx.x(), prodVtx.y(), prodVtx.z(), prodVtx.t() );
192 const CLHEP::HepLorentzVector lv1( endVtx.x(), endVtx.y(), endVtx.z(), endVtx.t() );
194 CLHEP::HepLorentzVector dist4D(lv1);
196 CLHEP::Hep3Vector dist3D=dist4D.vect();
198 const auto& GenMom = pitr->momentum();
199 const CLHEP::HepLorentzVector
mom( GenMom.x(), GenMom.y(), GenMom.z(), GenMom.t() );
203 ATH_MSG_INFO(
" gamma(Momentum)="<<
mom.gamma()<<
" gamma(Vertices)="<<dist4D.gamma());
210 return StatusCode::SUCCESS;