69 for (
auto& curVtx: ge.vertices()) {
70 if (curVtx->particles_in().size()!=1 || curVtx->particles_out().size()!=1) {
continue; }
71 const int pdgIn=curVtx->particles_in().front()->pdg_id();
72 const int pdgOut=curVtx->particles_out().front()->pdg_id();
74 std::find(pdgCodesBegin, pdgCodesEnd, std::abs(pdgIn))== pdgCodesEnd) {
78 if(!nextVtx) {
continue; }
79 ATH_MSG_DEBUG(
"Found a vertex to correct with incoming PDG code = " << pdgIn);
87 const HepMC::FourVector &nextVec = (nextVtx->has_set_position()) ? nextVtx->position() : HepMC::FourVector::ZERO_VECTOR();
88 const CLHEP::HepLorentzVector nextPos( nextVec.x(), nextVec.y(), nextVec.z(), nextVec.t() );
102 const HepMC::FourVector &prevVec = (prevVtx->has_set_position()) ? prevVtx->position() : HepMC::FourVector::ZERO_VECTOR();
103 const CLHEP::HepLorentzVector prevPos( prevVec.x(), prevVec.y(), prevVec.z(), prevVec.t() );
104 CLHEP::HepLorentzVector newPos = 0.5*(prevPos+nextPos);
105 curVtx->set_position(HepMC::FourVector(newPos.x(),newPos.y(),newPos.z(),newPos.t()));
112 CLHEP::HepLorentzVector newPos = nextPos;
113 curVtx->set_position(HepMC::FourVector(newPos.x(),newPos.y(),newPos.z(),newPos.t()));
121 HepMC::GenEvent::vertex_iterator vtxIt = ge.vertices_begin();
122 const HepMC::GenEvent::vertex_iterator vtxItEnd = ge.vertices_end();
125 for (; vtxIt != vtxItEnd; ++vtxIt) {
127 auto curVtx = (*vtxIt);
128 if (curVtx->particles_in_size()!=1 || curVtx->particles_out_size()!=1) {
continue; }
129 const int pdgIn=(*(curVtx->particles_in_const_begin()))->pdg_id();
130 const int pdgOut=(*(curVtx->particles_out_const_begin()))->pdg_id();
131 if (pdgIn!=-pdgOut ||
132 std::find(pdgCodesBegin, pdgCodesEnd, std::abs(pdgIn))== pdgCodesEnd) {
135 auto nextVtx = (*(curVtx->particles_out_const_begin()))->end_vertex();
136 if(!nextVtx) {
continue; }
137 ATH_MSG_DEBUG(
"Found a vertex to correct with incoming PDG code = " << pdgIn);
142 const HepMC::FourVector &nextVec = nextVtx->position();
143 const CLHEP::HepLorentzVector nextPos( nextVec.x(), nextVec.y(), nextVec.z(), nextVec.t() );
149 auto prevVtx = (*(curVtx->particles_in_const_begin()))->production_vertex();
154 const HepMC::FourVector &prevVec = prevVtx->position();
155 const CLHEP::HepLorentzVector prevPos( prevVec.x(), prevVec.y(), prevVec.z(), prevVec.t() );
156 CLHEP::HepLorentzVector newPos = 0.5*(prevPos+nextPos);
157 curVtx->set_position(newPos);
164 const CLHEP::HepLorentzVector& newPos = nextPos;
165 curVtx->set_position(newPos);
174 return StatusCode::SUCCESS;