55 {
56
59
60
61
63
64
66
68 SG::ReadHandle<xAOD::EventInfo> evtInfo(
m_evtInfoKey, ctx);
69 evtnum = evtInfo->eventNumber();
70 }
71
72
74 return StatusCode::SUCCESS;
75 }
79 return StatusCode::SUCCESS;
80 }
81
82
84
85
88 HepMC::Print::line(std::cout, *evt);
89 }
90
94
95 std::cout <<
"GenEvent: #" <<
evt->event_number()
97 << " SignalProcessGenVertex Barcode: "
99 std::cout <<
" Entries this event: " <<
evt->vertices_size() <<
" vertices, "
100 <<
evt->particles_size() <<
" particles.\n";
101 if (
evt->heavy_ion()) {
102 std::cout << " HeavyIon: jatt=" << evt->heavy_ion()->Ncoll_hard
103 << " np=" << evt->heavy_ion()->Npart_proj
104 << " nt=" << evt->heavy_ion()->Npart_targ
105 << " ncoll=" << evt->heavy_ion()->Ncoll
106 << " specn=" << evt->heavy_ion()->spectator_neutrons
107 << " specp=" << evt->heavy_ion()->spectator_protons
108 << " n01=" << evt->heavy_ion()->N_Nwounded_collisions
109 << " n10=" << evt->heavy_ion()->Nwounded_N_collisions
110 << " n11=" << evt->heavy_ion()->Nwounded_Nwounded_collisions
111 << " impact=" << evt->heavy_ion()->impact_parameter
112 << " evplane=" << evt->heavy_ion()->event_plane_angle
113 << " ecc=" << evt->heavy_ion()->eccentricity
114 << " sigmaNNinel=" << evt->heavy_ion()->sigma_inel_NN
115 << std::endl;
116 }
117 else {
118 std::cout << "HeavyIon: EMPTY"
119 << std::endl;
120 }
121
122
123
124 std::cout <<
" Weights(" <<
evt->weights().size() <<
")=";
125 for (
auto wgt =
evt->weights().begin();
126 wgt !=
evt->weights().end(); wgt++ ) { std::cout << *wgt <<
" "; }
127 std::cout << "\n";
128 std::cout <<
" EventScale " << (
evt->attribute<HepMC3::DoubleAttribute>(HepMCStr::event_scale)?
evt->attribute<HepMC3::DoubleAttribute>(HepMCStr::event_scale)->value():0.0)
129 <<
" [energy] \t alphaQCD=" << (
evt->attribute<HepMC3::DoubleAttribute>(HepMCStr::alphaQCD)?
evt->attribute<HepMC3::DoubleAttribute>(HepMCStr::alphaQCD)->value():0.0)
130 <<
"\t alphaQED=" << (
evt->attribute<HepMC3::DoubleAttribute>(HepMCStr::alphaQED)?
evt->attribute<HepMC3::DoubleAttribute>(HepMCStr::alphaQED)->value():0.0) << std::endl;
131
132 if (
evt->pdf_info()) {
133 std::cout << "PdfInfo: id1=" << evt->pdf_info()->parton_id[0]
134 << " id2=" << evt->pdf_info()->parton_id[1]
135 << " x1=" << evt->pdf_info()->x[0]
136 << " x2=" << evt->pdf_info()->x[1]
137 << " q=" << evt->pdf_info()->scale
138 << " xpdf1=" << evt->pdf_info()->pdf_id[0]
139 << " xpdf2=" << evt->pdf_info()->pdf_id[1]
140 << std::endl;
141 }
142 else {
143 std::cout << "PdfInfo: EMPTY"
144 << std::endl;
145 }
146
147
148 char particle_legend[120];
149 sprintf( particle_legend," %9s %8s %-15s %4s %8s %8s (%9s,%9s,%9s,%9s,%9s)",
150 "Barcode","PDG ID","Name","Stat","ProdVtx","DecayVtx","Px","Py","Pz","E ","m");
151 std::cout << std::endl;
152 std::cout << " GenParticle Legend\n" << particle_legend << "\n";
154 sprintf( particle_legend," %60s (%9s,%9s,%9s,%9s)"," ","Vx","Vy","Vz","Vct ");
155 std::cout << particle_legend << std::endl;
156 }
158
159
160 for (auto p: *evt) {
162 int p_pdg_id =
p->pdg_id();
164 int p_stat =
p->status();
165 int p_prodvtx =
p->production_vertex()?
HepMC::barcode(
p->production_vertex()):0;
168
169 std::string sname;
170 double p_mass =
p->generated_mass();
171 auto ap =
m_gendata->particleMass(std::abs(p_pdg_id));
172 if (!ap) {
173 ATH_MSG_DEBUG(
"PID " << std::abs(p_pdg_id) <<
" is not in particle data table");
174 } else {
176
177 sname =
m_gendata->particleName(std::abs(p_pdg_id)).value();
178 if (p_charge < 0) {
179 const size_t plusidx = sname.rfind("+");
180 if (plusidx != std::string::npos) {
181 sname.replace(plusidx, 1, "-");
182 }
183 }
184 }
185
186
187 if (p_pdg_id == 21) sname="g";
188 else if (p_pdg_id == 1) sname="d";
189 else if (p_pdg_id == -1) sname="d~";
190 else if (p_pdg_id == 2) sname="u";
191 else if (p_pdg_id == -2) sname="u~";
192 else if (p_pdg_id == 3) sname="s";
193 else if (p_pdg_id == -3) sname="s~";
194 else if (p_pdg_id == 4) sname="c";
195 else if (p_pdg_id == -4) sname="c~";
196 else if (p_pdg_id == 5) sname="b";
197 else if (p_pdg_id == -5) sname="b~";
198 else if (p_pdg_id == 6) sname="t";
199 else if (p_pdg_id == -6) sname="t~";
200
201 else if (p_pdg_id == 91) sname="cluster";
202 else if (p_pdg_id == 92) sname="string";
203 else if (p_pdg_id == 9922212) sname="remn";
204 else if (p_pdg_id == 2101) sname="ud";
205 else if (p_pdg_id == 2203) sname="uu";
206
207
209 if (p_mass == 0 && (p_stat == 2 || (p_stat != 1 && p_pdg_id != 22))) {
211 }
212
213 const char* p_name = sname.c_str() ;
214 char particle_entries[120];
215 sprintf(particle_entries, " %9i %8i %-15s %4i %8i %8i (%+9.3g,%+9.3g,%+9.3g,%+9.3g,%9.3g)",
216 p_bcode, p_pdg_id, p_name, p_stat, p_prodvtx, p_endvtx,
mom.px(),
mom.py(),
mom.pz(),
mom.e(), p_mass);
217 std::cout << particle_entries << "\n";
219 sprintf(particle_entries," %60s (%+9.3g,%+9.3g,%+9.3g,%+9.3g)"," ",prodvtx.x(), prodvtx.y(),prodvtx.z(), prodvtx.t());
220 std::cout << particle_entries << "\n";
221 }
222 }
223
224 }
225
226 }
227
228 return StatusCode::SUCCESS;
229}
void drawLine(std::ostream &os)
std::shared_ptr< GenData > m_gendata
SG::ReadHandleKey< xAOD::EventInfo > m_evtInfoKey
for(size_t i=0;i< m_blockFillers.size();i++)
Fill one block.
int signal_process_id(const GenEvent &evt)
HepMC3::FourVector FourVector
ConstGenVertexPtr signal_process_vertex(const GenEvent *e)
HepMC3::GenEvent GenEvent
double charge(const T &p)