19 m_n_vert(0), m_n_part(0),
20 m_n_vert_prim(0), m_n_vert_sec(0),
21 m_n_part_prim(0), m_n_part_sec(0),
22 m_x_vert(0), m_y_vert(0), m_z_vert(0),
24 m_vtx_r(0), m_vtx_z(0),
25 m_vtx_zr_indet(0), m_vtx_xy_indet(0),
26 m_meanx_vert(0), m_meany_vert(0), m_meanz_vert(0),
27 m_px_truth(0), m_py_truth(0), m_pz_truth(0), m_pt_truth(0), m_log_pt_truth(0),
28 m_theta_truth(0), m_eta_truth(0), m_phi_truth(0),
30 m_particle_status(0),m_particle_type(0),
31 m_p_gen(0), m_log_p_gen(0), m_eta_gen(0), m_phi_gen(0),m_pion_mass(0)
42 std::string histdirname(
"Truth");
43 if (
m_key!=
"TruthEvent") {
120 _SET_TITLE(
m_particle_status,
"Particle Status (1==undecayed, 2==decayed, 4==beam particle)",
"GenParticle Status",
"N GenParticles");
122 _SET_TITLE(
m_particle_type,
"Type (Type 0 = PDG 22, 1=11, 2=13,15, 3=111,211, 4=130,310,311,321, 5=2122, 6=2212, 7=else)",
"Particle Type (negative for anti-particles)",
"N Particles");
131 _SET_TITLE(
m_p_gen,
"momentum distribution of generator particles",
"p",
"dN/dp [1/MeV]");
133 _SET_TITLE(
m_log_p_gen,
"momentum distribution of generator particles",
"log(p)",
"dN/dlog(p) [1/log(MeV)]");
139 return StatusCode::SUCCESS;
154 if (currentGenEventIter!=mcCollection->
end() ) {
158 if (!vtx && (*currentGenEventIter)->vertices().size()>0) vtx=((*currentGenEventIter)->vertices()).front();
160 if (!vtx && (*currentGenEventIter)->vertices_size()>0) vtx=*((*currentGenEventIter)->vertices_begin());
164 m_x_vert->Fill( vtx->position().x() );
165 m_y_vert->Fill( vtx->position().y() );
166 m_z_vert->Fill( vtx->position().z() );
174 for (
const auto& vtx: (*currentGenEventIter)->vertices()) {
176 for (HepMC::GenEvent::vertex_const_iterator vtxit=(*currentGenEventIter)->vertices_begin();
177 vtxit!=(*currentGenEventIter)->vertices_end();++vtxit) {
181 double x = vtx->position().x();
182 double y = vtx->position().y();
183 double z = vtx->position().z();
184 double r = std::sqrt(
x*
x+
y*
y);
212 for (;currentGenEventIter!=mcCollection->
end(); ++currentGenEventIter) {
215 sprintf(
fname,
"%s.event%d.txt",
m_key.c_str(),evtnum);
221 int npart_prim=0, npart_sec=0;
222 for (
const auto& currentGenParticle: *(*currentGenEventIter)) {
224 const HepMC::FourVector
mom = currentGenParticle->momentum();
235 if(std::abs(currentGenParticle->pdg_id())==211) {
242 int pdg = currentGenParticle->pdg_id();
244 switch ( abs(pdg) ) {
278 if ( !is_simulation ) {
293 m_n_part->Fill(npart_prim+npart_sec);
297 return StatusCode::SUCCESS;