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;
51 return StatusCode::SUCCESS;
60 ATH_MSG_ERROR(
"CorrectPFOTool received FlowElements that aren't PFOs");
61 return StatusCode::FAILURE;
72 if (!handle.isValid()){
85 for (
const auto *theVertex : *pvtxs) {
92 ATH_MSG_DEBUG(
"Could not find a primary vertex in this event " );
93 for (
const auto *theVertex : *pvtxs) {
110 ATH_MSG_ERROR(
"Primary vertex container was empty or no valid vertex found!");
111 return StatusCode::FAILURE;
113 ATH_MSG_VERBOSE(
"No genuine primary vertex found. Will not apply origin correction");
119 if ( std::abs(ppfo->charge())<FLT_MIN) {
130 return StatusCode::SUCCESS;
139 ATH_MSG_ERROR(
"Primary vertex container was empty or no valid vertex found!");
140 return StatusCode::FAILURE;
142 ATH_MSG_VERBOSE(
"No genuine primary vertex found. Will not apply origin correction");
148 if ( !ppfo->isCharged()) {
159 return StatusCode::SUCCESS;
166 if (!handle.isValid()){
168 return StatusCode::FAILURE;
173 ATH_MSG_WARNING(
" Failed to retrieve valid primary vertex container" );
174 return StatusCode::FAILURE;
179 if ( std::abs(ppfo->charge())<FLT_MIN) {
185 ATH_MSG_WARNING(
"Encountered a neutral per-vertex PFO object without the corresponding vertex index attribute");
189 const unsigned iVtx = copyIndex(*ppfo);
190 if (iVtx >= pvtxs->
size())
192 ATH_MSG_WARNING(
"Encountered a neutral per-vertex PFO object with an index beyond the size of the vertex container");
200 if (ppfo->e() < FLT_MIN) {
201 ppfo->setP4(0, 0, 0, 0);
204 ppfo->setP4(ppfo->GetVertexCorrectedFourVec(*vtx));
206 ppfo->setP4(ppfo->GetVertexCorrectedEMFourVec(*vtx));
217 return StatusCode::SUCCESS;
225 if (!handle.isValid()){
227 return StatusCode::FAILURE;
232 ATH_MSG_WARNING(
" Failed to retrieve valid primary vertex container" );
233 return StatusCode::FAILURE;
238 if ( !ppfo->isCharged()) {
244 ATH_MSG_WARNING(
"Encountered a neutral per-vertex PFO object without the corresponding vertex index attribute");
248 const unsigned iVtx = copyIndex(*ppfo);
249 if (iVtx >= pvtxs->
size())
251 ATH_MSG_WARNING(
"Encountered a neutral per-vertex PFO object with an index beyond the size of the vertex container");
259 if (ppfo->e() < FLT_MIN) {
260 ppfo->setP4(0, 0, 0, 0);
272 return StatusCode::SUCCESS;
277 if (pfo.
e() < FLT_MIN) {
292 return StatusCode::SUCCESS;
296 if (pfo.
e() < FLT_MIN) {
303 return StatusCode::SUCCESS;
310 ATH_MSG_VERBOSE(
"Fill pseudojet for CPFO with weighted pt: " << pfo.
pt()*weight);
313 return StatusCode::SUCCESS;
320 ATH_MSG_VERBOSE(
"Fill pseudojet for CPFO with weighted pt: " << pfo.
pt()*weight);
323 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.