27 return StatusCode::SUCCESS;
30 ATH_MSG_DEBUG(
"Process a new tau candidate, addreess " << &tau
31 <<
", e: " << tau.
pt()
32 <<
", eta: " << tau.
eta()
33 <<
", pt: " << tau.
pt());
47 for (
xAOD::PFO* pfo : neutralPFOContainer) {
49 <<
", e: " << pfo->pt()
50 <<
", eta: " << pfo->eta()
51 <<
", pt: " << pfo->pt());
54 return StatusCode::SUCCESS;
60 std::vector<ElementLink<xAOD::IParticleContainer>> emptyLinks;
63 pfo->setAssociatedParticleLinks(
type, emptyLinks);
71 if (not tauTrackLink.isValid()) {
79 chargedPFOContainer.
push_back(chargedPFO);
83 chargedPFO->
setP4(tauTrack->
p4());
102 float position = -10.0;
105 std::vector<const xAOD::IParticle*> tauTrackParticles;
108 if (tauTrackParticles.empty()) {
120 ATH_MSG_WARNING(
"Failed to retrieve extrapolated chargedPFO position, will set -10.0 to " <<
detail);
130 std::map< xAOD::PFO*,std::vector< ElementLink< xAOD::IParticleContainer > > > linkMap;
135 if (not hadPFOLink.isValid()) {
139 ATH_MSG_DEBUG(
"hadPFO " << hadPFOLink.index() <<
", eta: " << (*hadPFOLink)->eta() <<
", phi: " << (*hadPFOLink)->phi() );
154 chargedPFOMatch = chargedPFO;
158 if( not chargedPFOMatch ){
170 if( not linkMap.count(chargedPFOMatch) ) {
171 linkMap[chargedPFOMatch] = std::vector< ElementLink< xAOD::IParticleContainer > >();
174 linkMap[chargedPFOMatch].push_back(newHadLink);
178 for (
auto [k,v] : linkMap) {
187 std::map< xAOD::PFO*,std::vector< ElementLink< xAOD::IParticleContainer > > > linkMap;
189 if (not chargedPFOLink.isValid()) {
193 const xAOD::PFO* chargedPFO = (*chargedPFOLink);
209 neutralPFOMatch = neutralPFO;
213 if (not neutralPFOMatch){
220 if (not newChargedLink.
isValid()){
225 if( not linkMap.count(neutralPFOMatch) ) {
226 linkMap[neutralPFOMatch] = std::vector< ElementLink< xAOD::IParticleContainer > >();
229 linkMap[neutralPFOMatch].push_back(newChargedLink);
233 for (
auto [k,v] : linkMap) {
248 std::vector<const xAOD::IParticle*> chargedPFOs;
250 if (chargedPFOs.empty()) {
254 ATH_MSG_DEBUG(
"Associated charged PFOs: " << chargedPFOs.size() );
257 float neutralEnergy = neutralPFO->
e();
260 if( not chargedPFO ){
261 ATH_MSG_WARNING(
"Failed to downcast IParticle ptr: " << chargedParticle <<
", to ChargedPFO! " );
264 float chargedEMEnergy = chargedPFO->
e();
266 std::vector<const xAOD::IParticle*> hadPFOs;
268 for (
const auto *hadPFO : hadPFOs) {
269 chargedEMEnergy -= hadPFO->e();
272 if( chargedEMEnergy < 0.0 ) chargedEMEnergy = 0.0;
273 neutralEnergy -= chargedEMEnergy;
274 ATH_MSG_DEBUG(
"Subtracting charged energy: " << chargedEMEnergy );
276 float neutralPt = neutralEnergy / std::cosh(neutralPFO->
eta());
277 if (neutralPt <= 100.) neutralPt = 100.0;
279 ATH_MSG_DEBUG(
"Neutral PFO pt, original: " << neutralPFO->
pt() <<
" subtracted: " << neutralPt);
280 neutralPFO->
setP4(neutralPt , neutralPFO->
eta(), neutralPFO->
phi(), neutralPFO->
m());
#define ATH_MSG_WARNING(x)
const T * at(size_type n) const
Access an element, as an rvalue.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
ElementLink implementation for ROOT usage.
bool isValid() const
Test to see if the link can be dereferenced.
size_t index() const
Return the index of this element within its container.
virtual StatusCode executePi0ClusterScaler(xAOD::TauJet &pTau, xAOD::PFOContainer &pNeutralPFOContainer, xAOD::PFOContainer &pChargedPFOContainer) const override
void createChargedPFOs(xAOD::TauJet &pTau, xAOD::PFOContainer &pChargedPFOContainer) const
create charged PFOs
void clearAssociatedParticleLinks(xAOD::PFOContainer &pfoContainer, xAOD::PFODetails::PFOParticleType type) const
Clear accosicated partcle links for the pfo container.
float getExtrapolatedPosition(const xAOD::PFO &chargedPFO, xAOD::TauJetParameters::TrackDetail detail) const
Get extrapolated position to the CAL.
void associateChargedToNeutralPFOs(const xAOD::TauJet &pTau, xAOD::PFOContainer &pNeutralPFOContainer) const
associate charged PFOs to neutral PFOs
TauPi0ClusterScaler(const std::string &name)
void associateHadronicToChargedPFOs(const xAOD::TauJet &pTau, xAOD::PFOContainer &pChargedPFOContainer) const
associate hadronic PFOs to charged PFOs
Gaudi::Property< double > m_maxDeltaRNeutralCharged
void subtractChargedEnergyFromNeutralPFOs(const xAOD::TauJet &tau, xAOD::PFOContainer &pNeutralPFOContainer) const
associate charged PFOs to neutral PFOs
Class providing the definition of the 4-vector interface.
bool setTrackLink(const ElementLink< xAOD::TrackParticleContainer > &theTrack)
Set a track constituent - does NOT append to existing container.
bool associatedParticles(PFODetails::PFOParticleType ParticleType, std::vector< const IParticle * > &theParticles) const
get a vector of PFO constituent particle types via enum
void setP4(const FourMom_t &vec)
set the 4-vec
virtual double eta() const
The pseudorapidity ( ) of the particle.
bool setAssociatedParticleLink(PFODetails::PFOParticleType ParticleType, const ElementLink< IParticleContainer > &theParticle)
Set an IParticle constituent via enum - does NOT append to existing container.
virtual double m() const
The invariant mass of the particle.
void setCharge(float charge)
set charge of PFO
virtual double e() const
The total energy of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
virtual double pt() const
The transverse momentum ( ) of the particle.
const CaloCluster * cluster(unsigned int index) const
Retrieve a const pointer to a CaloCluster.
const PFOLinks_t & hadronicPFOLinks() const
const PFO * protoChargedPFO(size_t i) const
Get the pointer to a given cellbased_charged PFO associated with this tau.
virtual double pt() const
The transverse momentum ( ) of the particle.
size_t nProtoChargedPFOs() const
Get the number of cellbased_charged PFO particles associated with this tau.
const PFOLinks_t & protoChargedPFOLinks() const
cellbased pfos
void addProtoChargedPFOLink(const ElementLink< PFOContainer > &pfo)
add a cellbased_charged PFO to the tau
void clearProtoChargedPFOLinks()
Remove all cellbased_charged PFOs from the tau.
const TauTrackLinks_t tauTrackLinks(TauJetParameters::TauTrackFlag=TauJetParameters::TauTrackFlag::classifiedCharged) const
const PFO * protoNeutralPFO(size_t i) const
Get the pointer to a given cellbased_neutral PFO associated with this tau.
size_t nProtoNeutralPFOs() const
Get the number of cellbased_neutral PFO particles associated with this tau.
virtual double eta() const
The pseudorapidity ( ) of the particle.
size_t nTracks(TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged) const
bool detail(TauJetParameters::TrackDetail detail, float &value) const
virtual FourMom_t p4() const
The full 4-momentum of the particle.
const TrackParticleLinks_t & trackLinks() const
const TrackParticle * track() const
float charge() const
Returns the charge.
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi
PFOParticleType
This enum is used to label the associated particles to the PFO object.
PFO_v1 PFO
Definition of the current "pfo version".
PFOContainer_v1 PFOContainer
Definition of the current "pfo container version".
TauTrack_v1 TauTrack
Definition of the current version.
TauJet_v3 TauJet
Definition of the current "tau version".