15 if (tau.
jet() ==
nullptr) {
17 return StatusCode::FAILURE;
23 TLorentzVector baryCenter;
30 ATH_MSG_DEBUG(
"barycenter (eta, phi): " << baryCenter.Eta() <<
" " << baryCenter.Phi());
33 TLorentzVector tauDetectorAxis;
38 if (baryCenter.DeltaR(constituentP4) >
m_clusterCone)
continue;
40 tauDetectorAxis += constituentP4;
44 ATH_MSG_DEBUG(
"this tau candidate does not have any constituent clusters!");
45 return StatusCode::FAILURE;
48 ATH_MSG_DEBUG(
"detector axis:" << tauDetectorAxis.Pt()<<
" " << tauDetectorAxis.Eta() <<
" " << tauDetectorAxis.Phi() <<
" " << tauDetectorAxis.E());
49 tau.
setP4(tauDetectorAxis.Pt(), tauDetectorAxis.Eta(), tauDetectorAxis.Phi(), tau.
m());
55 TLorentzVector tauInterAxis;
60 if (jetVertex != tau.
vertex()) {
63 if (tau.
vertex() ==
nullptr) {
64 ATH_MSG_WARNING(
"The seed jet has a vertex, while the tau candidate does not. It should not happen.");
65 return StatusCode::FAILURE;
72 if (jetVertex !=
nullptr) {
77 TLorentzVector baryCenterTauVertex;
84 ATH_MSG_DEBUG(
"barycenter (eta, phi) at tau vertex: " << baryCenterTauVertex.Eta() <<
" " << baryCenterTauVertex.Phi());
90 if (baryCenterTauVertex.DeltaR(constituentP4) >
m_clusterCone)
continue;
92 tauInterAxis += constituentP4;
96 tauInterAxis = tauDetectorAxis;
99 if (tauInterAxis.Pt() == 0.) {
100 ATH_MSG_DEBUG(
"this tau candidate does not have any constituent clusters!");
101 return StatusCode::FAILURE;
104 ATH_MSG_DEBUG(
"tau axis:" << tauInterAxis.Pt()<<
" " << tauInterAxis.Eta() <<
" " << tauInterAxis.Phi() <<
" " << tauInterAxis.E() );
105 tau.
setP4(tauInterAxis.Pt(), tauInterAxis.Eta(), tauInterAxis.Phi(), tau.
m());
109 return StatusCode::SUCCESS;
116 TLorentzVector vertexCorrectedP4;
127 ATH_MSG_WARNING(
"Seed jet constituent type not supported, will not do vertex correction !");
131 return vertexCorrectedP4;
137 TLorentzVector vertexCorrectedP4;
140 TVector3 pos(position.x(), position.y(), position.z());
144 vertexCorrectedP4 = fe.
p4();
148 " eta: " << fe.
eta() <<
" phi: " << fe.
phi() <<
" e: " << fe.
e());
149 ATH_MSG_DEBUG(
"Vertex corrected four momentum, pt: " << vertexCorrectedP4.Pt() <<
150 " eta: " << vertexCorrectedP4.Eta() <<
" phi: " << vertexCorrectedP4.Phi() <<
" e: " << vertexCorrectedP4.E());
152 return vertexCorrectedP4;
#define ATH_MSG_WARNING(x)
TLorentzVector getVertexCorrectedP4(const xAOD::JetConstituent &constituent, const Amg::Vector3D &position) const
Get the vertex corrected four momentum.
Gaudi::Property< bool > m_doVertexCorrection
virtual StatusCode execute(xAOD::TauJet &tau) const override
Execution of this tool.
TauAxisSetter(const std::string &name)
Constructor.
Gaudi::Property< double > m_clusterCone
virtual FourMom_t p4() const final
The full 4-momentum of the particle.
Evaluate cluster kinematics with a different vertex / signal state.
virtual double pt() const override
virtual double phi() const override
The azimuthal angle ( ) of the particle.
virtual double eta() const override
The pseudorapidity ( ) of the particle.
virtual double e() const override
The total energy of the particle.
virtual FourMom_t p4() const override
The full 4-momentum of the particle.
A vector of jet constituents at the scale used during jet finding.
4-vector of jet constituent at the scale used during jet finding.
Type::ObjectType type() const
The full 4-momentum of the particle.
const IParticle * rawConstituent() const
Access the real underlying IParticle.
JetConstituentVector getConstituents() const
Return a vector of consituents. The object behaves like vector<const IParticle*>. See JetConstituentV...
const Vertex * vertex() const
void setP4(double pt, double eta, double phi, double m)
Set methods for IParticle values.
virtual double m() const
The invariant mass of the particle.
const Amg::Vector3D & position() const
Returns the 3-pos.
Eigen::Matrix< double, 3, 1 > Vector3D
TLorentzVector getVertexCorrectedFourVec(const xAOD::FlowElement &fe, const xAOD::Vertex &vertexToCorrectTo)
@ FlowElement
The object is a track-calo-cluster.
@ CaloCluster
The object is a calorimeter cluster.
Jet_v1 Jet
Definition of the current "jet version".
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
TauJet_v3 TauJet
Definition of the current "tau version".