53 {
54
57
58
59
61
62
64
67 evtnum = evtInfo->eventNumber();
68 }
69
70
72 return StatusCode::SUCCESS;
73 }
77 return StatusCode::SUCCESS;
78 }
79
80
82
83
87 }
88
92
93 std::cout <<
"GenEvent: #" <<
evt->event_number()
95 << " SignalProcessGenVertex Barcode: "
97 std::cout <<
" Entries this event: " <<
evt->vertices_size() <<
" vertices, "
98 <<
evt->particles_size() <<
" particles.\n";
99#ifdef HEPMC3
100 if (
evt->heavy_ion()) {
101 std::cout << " HeavyIon: jatt=" << evt->heavy_ion()->Ncoll_hard
102 << " np=" << evt->heavy_ion()->Npart_proj
103 << " nt=" << evt->heavy_ion()->Npart_targ
104 << " ncoll=" << evt->heavy_ion()->Ncoll
105 << " specn=" << evt->heavy_ion()->spectator_neutrons
106 << " specp=" << evt->heavy_ion()->spectator_protons
107 << " n01=" << evt->heavy_ion()->N_Nwounded_collisions
108 << " n10=" << evt->heavy_ion()->Nwounded_N_collisions
109 << " n11=" << evt->heavy_ion()->Nwounded_Nwounded_collisions
110 << " impact=" << evt->heavy_ion()->impact_parameter
111 << " evplane=" << evt->heavy_ion()->event_plane_angle
112 << " ecc=" << evt->heavy_ion()->eccentricity
113 << " sigmaNNinel=" << evt->heavy_ion()->sigma_inel_NN
114 << std::endl;
115 }
116 else {
117 std::cout << "HeavyIon: EMPTY"
118 << std::endl;
119 }
120
121
122
123 std::cout <<
" Weights(" <<
evt->weights().size() <<
")=";
124 for (
auto wgt =
evt->weights().begin();
125 wgt !=
evt->weights().end(); wgt++ ) { std::cout << *wgt <<
" "; }
126 std::cout << "\n";
127 std::cout <<
" EventScale " << (
evt->attribute<HepMC3::DoubleAttribute>(
"event_scale")?
evt->attribute<HepMC3::DoubleAttribute>(
"event_scale")->value():0.0)
128 <<
" [energy] \t alphaQCD=" << (
evt->attribute<HepMC3::DoubleAttribute>(
"alphaQCD")?
evt->attribute<HepMC3::DoubleAttribute>(
"alphaQCD")->value():0.0)
129 <<
"\t alphaQED=" << (
evt->attribute<HepMC3::DoubleAttribute>(
"alphaQED")?
evt->attribute<HepMC3::DoubleAttribute>(
"alphaQED")->value():0.0) << std::endl;
130
131 if (
evt->pdf_info()) {
132 std::cout << "PdfInfo: id1=" << evt->pdf_info()->parton_id[0]
133 << " id2=" << evt->pdf_info()->parton_id[1]
134 << " x1=" << evt->pdf_info()->x[0]
135 << " x2=" << evt->pdf_info()->x[1]
136 << " q=" << evt->pdf_info()->scale
137 << " xpdf1=" << evt->pdf_info()->pdf_id[0]
138 << " xpdf2=" << evt->pdf_info()->pdf_id[1]
139 << std::endl;
140 }
141 else {
142 std::cout << "PdfInfo: EMPTY"
143 << std::endl;
144 }
145#else
146 if (
evt->heavy_ion()) {
147 std::cout << " HeavyIon: jatt=" << evt->heavy_ion()->Ncoll_hard()
148 << " np=" << evt->heavy_ion()->Npart_proj()
149 << " nt=" << evt->heavy_ion()->Npart_targ()
150 << " ncoll=" << evt->heavy_ion()->Ncoll()
151 << " specn=" << evt->heavy_ion()->spectator_neutrons()
152 << " specp=" << evt->heavy_ion()->spectator_protons()
153 << " n01=" << evt->heavy_ion()->N_Nwounded_collisions()
154 << " n10=" << evt->heavy_ion()->Nwounded_N_collisions()
155 << " n11=" << evt->heavy_ion()->Nwounded_Nwounded_collisions()
156 << " impact=" << evt->heavy_ion()->impact_parameter()
157 << " evplane=" << evt->heavy_ion()->event_plane_angle()
158 << " ecc=" << evt->heavy_ion()->eccentricity()
159 << " sigmaNNinel=" << evt->heavy_ion()->sigma_inel_NN()
160 << std::endl;
161 }
162 else {
163 std::cout << "HeavyIon: EMPTY"
164 << std::endl;
165 }
166
167
168
169 std::cout <<
" Weights(" <<
evt->weights().size() <<
")=";
170 for (
double w :
evt->weights()) {
171 std::cout << w << " ";
172 }
173 std::cout << "\n";
174 std::cout <<
" EventScale " <<
evt->event_scale()
175 <<
" [energy] \t alphaQCD=" <<
evt->alphaQCD()
176 <<
"\t alphaQED=" <<
evt->alphaQED() << std::endl;
177
178 if (
evt->pdf_info()) {
179 std::cout << "PdfInfo: id1=" << evt->pdf_info()->id1()
180 << " id2=" << evt->pdf_info()->id2()
181 << " x1=" << evt->pdf_info()->x1()
182 << " x2=" << evt->pdf_info()->x2()
183 << " q=" << evt->pdf_info()->scalePDF()
184 << " xpdf1=" << evt->pdf_info()->pdf1()
185 << " xpdf2=" << evt->pdf_info()->pdf2()
186 << std::endl;
187 }
188 else {
189 std::cout << "PdfInfo: EMPTY"
190 << std::endl;
191 }
192#endif
193
194
195 char particle_legend[120];
196 sprintf( particle_legend," %9s %8s %-15s %4s %8s %8s (%9s,%9s,%9s,%9s,%9s)",
197 "Barcode","PDG ID","Name","Stat","ProdVtx","DecayVtx","Px","Py","Pz","E ","m");
198 std::cout << std::endl;
199 std::cout << " GenParticle Legend\n" << particle_legend << "\n";
201 sprintf( particle_legend," %60s (%9s,%9s,%9s,%9s)"," ","Vx","Vy","Vz","Vct ");
202 std::cout << particle_legend << std::endl;
203 }
205
206
207 for (auto p: *evt) {
209 int p_pdg_id =
p->pdg_id();
210 HepMC::FourVector
mom=
p->momentum();
211 int p_stat =
p->status();
212 int p_prodvtx =
p->production_vertex()?
HepMC::barcode(
p->production_vertex()):0;
214 HepMC::FourVector prodvtx=
p->production_vertex()?
p->production_vertex()->position():HepMC::FourVector(0.0,0.0,0.0,0.0);
215
216 std::string sname;
217 double p_mass =
p->generated_mass();
218 const HepPDT::ParticleData*
ap =
particleData(std::abs(p_pdg_id));
219 if (!ap) {
220 ATH_MSG_DEBUG(
"PID " << std::abs(p_pdg_id) <<
" is not in particle data table");
221 } else {
222 const double p_charge =
ap->charge() * (p_pdg_id < 0 ? -1 : 1);
223
225 if (p_charge < 0) {
226 const size_t plusidx = sname.rfind("+");
227 if (plusidx != std::string::npos) {
228 sname.replace(plusidx, 1, "-");
229 }
230 }
231 }
232
233
234 if (p_pdg_id == 21) sname="g";
235 else if (p_pdg_id == 1) sname="d";
236 else if (p_pdg_id == -1) sname="d~";
237 else if (p_pdg_id == 2) sname="u";
238 else if (p_pdg_id == -2) sname="u~";
239 else if (p_pdg_id == 3) sname="s";
240 else if (p_pdg_id == -3) sname="s~";
241 else if (p_pdg_id == 4) sname="c";
242 else if (p_pdg_id == -4) sname="c~";
243 else if (p_pdg_id == 5) sname="b";
244 else if (p_pdg_id == -5) sname="b~";
245 else if (p_pdg_id == 6) sname="t";
246 else if (p_pdg_id == -6) sname="t~";
247
248 else if (p_pdg_id == 91) sname="cluster";
249 else if (p_pdg_id == 92) sname="string";
250 else if (p_pdg_id == 9922212) sname="remn";
251 else if (p_pdg_id == 2101) sname="ud";
252 else if (p_pdg_id == 2203) sname="uu";
253
254
256 if (p_mass == 0 && (p_stat == 2 || (p_stat != 1 && p_pdg_id != 22))) {
258 }
259
260 const char* p_name = sname.c_str() ;
261 char particle_entries[120];
262 sprintf(particle_entries, " %9i %8i %-15s %4i %8i %8i (%+9.3g,%+9.3g,%+9.3g,%+9.3g,%9.3g)",
263 p_bcode, p_pdg_id, p_name, p_stat, p_prodvtx, p_endvtx,
mom.px(),
mom.py(),
mom.pz(),
mom.e(), p_mass);
264 std::cout << particle_entries << "\n";
266 sprintf(particle_entries," %60s (%+9.3g,%+9.3g,%+9.3g,%+9.3g)"," ",prodvtx.x(), prodvtx.y(),prodvtx.z(), prodvtx.t());
267 std::cout << particle_entries << "\n";
268 }
269 }
270
271 }
272
273 }
274
275 return StatusCode::SUCCESS;
276}
void drawLine(std::ostream &os)
const HepPDT::ParticleData * particleData(int pid) const
Access an element in the particle data table.
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey
void line(std::ostream &os, const GenEvent &e)
int signal_process_id(const GenEvent &e)
GenVertex * signal_process_vertex(const GenEvent *e)