29 "Datahandle key for the primary vertex container");
35 return StatusCode::FAILURE;
38 ATH_MSG_ERROR(
"CorrectPFOTool requires PFO inputs. It cannot operate on objects of type "
40 return StatusCode::FAILURE;
48 return StatusCode::SUCCESS;
57 ATH_MSG_ERROR(
"CorrectPFOTool received FlowElements that aren't PFOs");
58 return StatusCode::FAILURE;
69 if (!handle.isValid()){
82 for (
const auto *theVertex : *pvtxs) {
89 ATH_MSG_DEBUG(
"Could not find a primary vertex in this event " );
90 for (
const auto *theVertex : *pvtxs) {
107 ATH_MSG_ERROR(
"Primary vertex container was empty or no valid vertex found!");
108 return StatusCode::FAILURE;
110 ATH_MSG_VERBOSE(
"No genuine primary vertex found. Will not apply origin correction");
116 if ( std::abs(ppfo->charge())<FLT_MIN) {
127 return StatusCode::SUCCESS;
136 ATH_MSG_ERROR(
"Primary vertex container was empty or no valid vertex found!");
137 return StatusCode::FAILURE;
139 ATH_MSG_VERBOSE(
"No genuine primary vertex found. Will not apply origin correction");
145 if ( !ppfo->isCharged()) {
156 return StatusCode::SUCCESS;
163 if (!handle.isValid()){
165 return StatusCode::FAILURE;
170 ATH_MSG_WARNING(
" Failed to retrieve valid primary vertex container" );
171 return StatusCode::FAILURE;
176 if ( std::abs(ppfo->charge())<FLT_MIN) {
182 ATH_MSG_WARNING(
"Encountered a neutral per-vertex PFO object without the corresponding vertex index attribute");
186 const unsigned iVtx = copyIndex(*ppfo);
187 if (iVtx >= pvtxs->
size())
189 ATH_MSG_WARNING(
"Encountered a neutral per-vertex PFO object with an index beyond the size of the vertex container");
197 if (ppfo->e() < FLT_MIN) {
198 ppfo->setP4(0, 0, 0, 0);
201 ppfo->setP4(ppfo->GetVertexCorrectedFourVec(*vtx));
203 ppfo->setP4(ppfo->GetVertexCorrectedEMFourVec(*vtx));
214 return StatusCode::SUCCESS;
222 if (!handle.isValid()){
224 return StatusCode::FAILURE;
229 ATH_MSG_WARNING(
" Failed to retrieve valid primary vertex container" );
230 return StatusCode::FAILURE;
235 if ( !ppfo->isCharged()) {
241 ATH_MSG_WARNING(
"Encountered a neutral per-vertex PFO object without the corresponding vertex index attribute");
245 const unsigned iVtx = copyIndex(*ppfo);
246 if (iVtx >= pvtxs->
size())
248 ATH_MSG_WARNING(
"Encountered a neutral per-vertex PFO object with an index beyond the size of the vertex container");
256 if (ppfo->e() < FLT_MIN) {
257 ppfo->setP4(0, 0, 0, 0);
269 return StatusCode::SUCCESS;
274 if (pfo.
e() < FLT_MIN) {
289 return StatusCode::SUCCESS;
293 if (pfo.
e() < FLT_MIN) {
300 return StatusCode::SUCCESS;
307 ATH_MSG_VERBOSE(
"Fill pseudojet for CPFO with weighted pt: " << pfo.
pt()*weight);
310 return StatusCode::SUCCESS;
317 ATH_MSG_VERBOSE(
"Fill pseudojet for CPFO with weighted pt: " << pfo.
pt()*weight);
320 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const T * at(size_type n) const
Access an element, as an rvalue.
const T * front() const
Access the first element in the collection as an rvalue.
size_type size() const noexcept
Returns the number of elements in the collection.
bool empty() const noexcept
Returns true if the collection is empty.
JetConstituentModifierBase(const std::string &name)
SG::Accessor< T, ALLOC > Accessor
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
virtual double pt() const override
void setP4(float pt, float eta, float phi, float m)
signal_t signalType() const
virtual double e() const override
The total energy of the particle.
virtual FourMom_t p4() const override
The full 4-momentum of the particle.
TLorentzVector GetVertexCorrectedFourVec(const xAOD::Vertex &vertexToCorrectTo) const
Correct 4-vector to point at a vertex.
FourMom_t p4EM() const
get EM scale 4-vector
virtual FourMom_t p4() const
The full 4-momentum of the particle.
void setP4(const FourMom_t &vec)
set the 4-vec
TLorentzVector GetVertexCorrectedEMFourVec(const xAOD::Vertex &vertexToCorrectTo) const
Correct EM scale 4-vector to point at a vertex.
virtual double e() const
The total energy of the particle.
virtual double pt() const
The transverse momentum ( ) of the particle.
VxType::VertexType vertexType() const
The type of the vertex.
TLorentzVector getVertexCorrectedFourVec(const xAOD::FlowElement &fe, const xAOD::Vertex &vertexToCorrectTo)
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
@ ParticleFlow
The object is a particle-flow object.
@ FlowElement
The object is a track-calo-cluster.
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
FlowElementContainer_v1 FlowElementContainer
Definition of the current "pfo container version".
PFO_v1 PFO
Definition of the current "pfo version".
PFOContainer_v1 PFOContainer
Definition of the current "pfo container version".
FlowElement_v1 FlowElement
Definition of the current "pfo version".
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.