15 if (tau.jet() ==
nullptr) {
17 return StatusCode::FAILURE;
23 std::vector<TLorentzVector> jet_const_vec;
25 TLorentzVector baryCenter;
30 baryCenter += const_p4;
31 jet_const_vec.push_back(const_p4);
34 ATH_MSG_DEBUG(
"barycenter (eta, phi): " << baryCenter.Eta() <<
" " << baryCenter.Phi());
37 TLorentzVector tauDetectorAxis;
39 for (
const auto& constituentP4 : jet_const_vec) {
40 if (baryCenter.DeltaR(constituentP4) >
m_clusterCone)
continue;
41 tauDetectorAxis += constituentP4;
45 ATH_MSG_DEBUG(
"this tau candidate does not have any constituent clusters!");
46 return StatusCode::FAILURE;
49 ATH_MSG_DEBUG(
"detector axis:" << tauDetectorAxis.Pt()<<
" " << tauDetectorAxis.Eta() <<
" " << tauDetectorAxis.Phi() <<
" " << tauDetectorAxis.E());
50 tau.setP4(tauDetectorAxis.Pt(), tauDetectorAxis.Eta(), tauDetectorAxis.Phi(), tau.m());
56 TLorentzVector tauInterAxis;
61 if (jetVertex != tau.vertex()) {
64 if (tau.vertex() ==
nullptr) {
65 ATH_MSG_WARNING(
"The seed jet has a vertex, while the tau candidate does not. It should not happen.");
66 return StatusCode::FAILURE;
73 if (jetVertex !=
nullptr) {
78 std::vector<TLorentzVector> jet_const_vec_vtxcorr;
80 TLorentzVector baryCenterTauVertex;
86 baryCenterTauVertex += const_vtxcorr_p4;
87 jet_const_vec_vtxcorr.push_back(const_vtxcorr_p4);
89 ATH_MSG_DEBUG(
"barycenter (eta, phi) at tau vertex: " << baryCenterTauVertex.Eta() <<
" " << baryCenterTauVertex.Phi());
93 for (
const auto& constituent_vtxcorr_P4 : jet_const_vec_vtxcorr) {
94 if (baryCenterTauVertex.DeltaR(constituent_vtxcorr_P4) >
m_clusterCone)
continue;
95 tauInterAxis += constituent_vtxcorr_P4;
99 tauInterAxis = tauDetectorAxis;
102 if (tauInterAxis.Pt() == 0.) {
103 ATH_MSG_DEBUG(
"this tau candidate does not have any constituent clusters!");
104 return StatusCode::FAILURE;
107 ATH_MSG_DEBUG(
"tau axis:" << tauInterAxis.Pt()<<
" " << tauInterAxis.Eta() <<
" " << tauInterAxis.Phi() <<
" " << tauInterAxis.E() );
108 tau.setP4(tauInterAxis.Pt(), tauInterAxis.Eta(), tauInterAxis.Phi(), tau.m());
112 return StatusCode::SUCCESS;
140 TLorentzVector vertexCorrectedP4;
143 TVector3 pos(position.x(), position.y(), position.z());
147 vertexCorrectedP4 = fe.
p4();
151 " eta: " << fe.
eta() <<
" phi: " << fe.
phi() <<
" e: " << fe.
e());
152 ATH_MSG_DEBUG(
"Vertex corrected four momentum, pt: " << vertexCorrectedP4.Pt() <<
153 " eta: " << vertexCorrectedP4.Eta() <<
" phi: " << vertexCorrectedP4.Phi() <<
" e: " << vertexCorrectedP4.E());
155 return vertexCorrectedP4;