12 return ( i.cachedElement()->bdtPi0Score() > j.
cachedElement()->bdtPi0Score() );
29 return StatusCode::SUCCESS;
38 bool isBadSeed = (noAnyConstituents || noSelConstituents || noValidInputTau);
45 ATH_MSG_DEBUG(
"This seed is not useable for detail arranging (other than validity flag)");
48 return StatusCode::SUCCESS;
87 return StatusCode::SUCCESS;
92 const std::string& featName,
98 std::string fullFeatName =
"CellBased_" + featName;
100 double theValue = features->
value(fullFeatName,
isValid);
105 bool isBadSeed = (noAnyConstituents || noSelConstituents || noValidInputTau);
108 ATH_MSG_DEBUG(
"WARNING --- Problems getting value for feature " << fullFeatName <<
" from map! This should not happen for this seed!");
109 ATH_MSG_DEBUG(
"WARNING --- Did the ModeDiscriminator set features used in BDTs that were not found to their default values?");
110 ATH_MSG_DEBUG(
"NOTE --- This can also happen for seeds with (for example) 0 neutrals when trying to get Neutral_SumM - check seed");
116 int valueToAddInt = -1;
117 float valueToAddFloat = -1.1;
121 valueToAddInt =
static_cast<int>(theValue);
125 valueToAddFloat =
static_cast<float>(theValue);
129 ATH_MSG_WARNING(
"Unknown PanTauDetailType! Please use enum PanTauDetailsType from PanTauAlgs/Tool_DetailsArranger.h.");
141 std::vector< ElementLink< xAOD::PFOContainer > > neutralPFOLinks = tauJet->
protoNeutralPFOLinks();
150 std::vector< ElementLink< xAOD::PFOContainer > > preLinkPi0PFOLinks = tauJet->
pi0PFOLinks();
174 return StatusCode::SUCCESS;
178 if(decayModeProto == decayModeFinal) {
183 preLinkPi0PFOLinks.push_back( pi0PFOLinks.at(0) );
191 preLinkPi0PFOLinks=pi0PFOLinks;
202 if(!preSelected_neutralPFOLinks.empty()) preLinkPi0PFOLinks.push_back( preSelected_neutralPFOLinks.at(0) );
203 else ATH_MSG_WARNING(
"No neutral PFO Links although there should be!!");
221 preLinkPi0PFOLinks=pi0PFOLinks;
227 preLinkPi0PFOLinks=pi0PFOLinks;
228 if(!preSelected_neutralPFOLinks.empty()) preLinkPi0PFOLinks.push_back( preSelected_neutralPFOLinks.at(0) );
229 else ATH_MSG_WARNING(
"No neutral PFO Links although there should be!!");
238 preLinkPi0PFOLinks.push_back( pi0PFOLinks.at(0) );
239 preLinkPi0PFOLinks.push_back( pi0PFOLinks.at(1) );
247 if(!preSelected_neutralPFOLinks.empty()) preLinkPi0PFOLinks.push_back( preSelected_neutralPFOLinks.at(0) );
248 else ATH_MSG_WARNING(
"No neutral PFO Links although there should be!!");
263 std::vector< ElementLink< xAOD::PFOContainer > > finalChrgPFOLinks = tauJet->
chargedPFOLinks();
264 std::vector< ElementLink< xAOD::PFOContainer > > finalPi0PFOLinks = tauJet->
pi0PFOLinks();
265 std::vector< ElementLink< xAOD::PFOContainer > > finalNeutralPFOLinks = tauJet->
neutralPFOLinks();
268 std::vector< TLorentzVector > vec_pi04vec;
269 std::vector< std::vector< ElementLink<xAOD::PFOContainer> > > vec_pi0pfos;
272 for(
unsigned int itlv=0; itlv!=vec_pi04vec.size(); ++itlv) {
275 p->setPxPyPzE(vec_pi04vec.at(itlv).Px(), vec_pi04vec.at(itlv).Py(), vec_pi04vec.at(itlv).Pz(), vec_pi04vec.at(itlv).E());
276 std::vector< ElementLink< xAOD::PFOContainer > > pfo_link_vector;
277 for(
uint ipfo = 0; ipfo != vec_pi0pfos.at(itlv).size(); ++ipfo) {
278 pfo_link_vector.push_back(vec_pi0pfos.at(itlv).at(ipfo));
282 accPi0PFOLinks(*p) = pfo_link_vector;
290 return StatusCode::SUCCESS;
297 std::vector< ElementLink< xAOD::PFOContainer > > finalChrgPFOLinks = tauJet->
chargedPFOLinks();
298 std::vector< ElementLink< xAOD::PFOContainer > > finalPi0PFOLinks = tauJet->
pi0PFOLinks();
300 unsigned int NCharged = finalChrgPFOLinks.size();
301 unsigned int NPi0Neut = finalPi0PFOLinks.size();
303 TLorentzVector tlv_PanTau_Final;
304 for(
unsigned int iPFO=0; iPFO<NCharged; iPFO++) {
305 const xAOD::PFO* pfo = finalChrgPFOLinks.at(iPFO).cachedElement();
306 tlv_PanTau_Final += pfo->
p4();
308 for(
unsigned int iPFO=0; iPFO<NPi0Neut; iPFO++) {
309 const xAOD::PFO* pfo = finalPi0PFOLinks.at(iPFO).cachedElement();
310 tlv_PanTau_Final += pfo->
p4();
316 featureMap->
addFeature(
"CellBased_" + varTypeName_Basic +
"_FinalMomentumCore_pt", tlv_PanTau_Final.Pt() );
317 featureMap->
addFeature(
"CellBased_" + varTypeName_Basic +
"_FinalMomentumCore_eta", tlv_PanTau_Final.Eta() );
318 featureMap->
addFeature(
"CellBased_" + varTypeName_Basic +
"_FinalMomentumCore_phi", tlv_PanTau_Final.Phi() );
319 featureMap->
addFeature(
"CellBased_" + varTypeName_Basic +
"_FinalMomentumCore_m", tlv_PanTau_Final.M() );
327 int nPi0sPerCluster = 1;
338 return (nPi0sPerCluster > 1);
344 TLorentzVector momentum;
346 neutral_pfo->
setP4(momentum.Pt(), neutral_pfo->
eta(), neutral_pfo->
phi(), mass);
352 for (
const auto& link : neutralPFOLinks) {
353 size_t index = link.index();
368 std::vector< ElementLink< xAOD::PFOContainer > > new_links;
370 unsigned int nConstsOfType=0;
375 ATH_MSG_WARNING(
"CollectConstituentsAsPFOLinks: Function was called with type = " <<
type <<
" , however it was only designed for types t_Pi0Neut and t_Neutral! Returning...");
379 for(
unsigned int iConst=0; iConst<tauConstituents.size(); iConst++) {
380 bool isOfType = tauConstituents[iConst]->isOfType(
type);
381 if(!isOfType)
continue;
389 for(
unsigned int iPFO=0; iPFO<cellbased_neutralPFOLinks.size(); iPFO++) {
390 const xAOD::PFO* pfo = cellbased_neutralPFOLinks.at(iPFO).cachedElement();
392 if( tauConstituents[iConst]->getPFO() != pfo )
continue;
394 new_links.push_back( cellbased_neutralPFOLinks.at(iPFO) );
398 if( nConstsOfType != new_links.size() ){
399 ATH_MSG_WARNING(
"CollectConstituentsAsPFOLinks: Couldn't find PFOLinks " << new_links.size() <<
" for all tau constituents (" << tauConstituents.size() <<
")!");
417 size_t iNumPi0PFO = tauJet->
nPi0PFOs();
430 vPi0s.push_back(xPfo1->
p4() + xPfo2->
p4());
433 double dNewMomentum = std::sqrt(vPi0s[0].E() * vPi0s[0].E() - fMassPi0Squared);
434 vPi0s[0].SetPxPyPzE(vPi0s[0].Vect().Unit().Px() * dNewMomentum,
435 vPi0s[0].Vect().Unit().Py() * dNewMomentum,
436 vPi0s[0].Vect().Unit().Pz() * dNewMomentum,
439 std::vector< ElementLink<xAOD::PFOContainer> > pfovec;
442 vec_pi0pfos.push_back( pfovec );
449 vPi0s.push_back(xPfo->
p4());
452 double dNewMomentum = std::sqrt( (vPi0s[0].E()/2.)*(vPi0s[0].E()/2.) -
MASS_PI0*
MASS_PI0 );
453 vPi0s[0].SetVectM(vPi0s[0].Vect().Unit() * dNewMomentum,
MASS_PI0 );
456 vPi0s.push_back(vPi0s[0]);
458 std::vector< ElementLink<xAOD::PFOContainer> > pfovec;
460 vec_pi0pfos.push_back( pfovec );
461 vec_pi0pfos.push_back( pfovec );
465 for (
size_t iPFO = 0; iPFO < iNumPi0PFO; iPFO++){
466 vPi0s.push_back(tauJet->
pi0PFO(iPFO)->
p4());
467 std::vector< ElementLink<xAOD::PFOContainer> > pfovec;
469 vec_pi0pfos.push_back( pfovec );
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
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.
bool toContainedElement(BaseConstReference data, ElementType element, IProxyDict *sg=0)
Set from element pointer and a reference to the container (storable)
ElementType cachedElement() const
Return the cached element, if any.
static StatusCode bindToolHandle(ToolHandle< T > &, std::string)
int getDecayModeByPanTau() const
std::vector< PanTau::TauConstituent * > getConstituentsOfType(int tauConstituent_Type, bool &foundit)
@ t_NoSelectedConstituents
void setFinalMomentum(TLorentzVector finalMom)
bool isOfTechnicalQuality(int pantauSeed_TechnicalQuality) const
const xAOD::TauJet * getTauJet() const
int getDecayModeBySubAlg() const
TLorentzVector getFinalMomentum() const
const PanTau::TauFeature * getFeatures() const
Type
Type enumeration to specify type of this tau constituent.
Class containing features of a tau seed.
bool addFeature(const std::string &name, const double value)
adds a new feature
double value(const std::string &name, bool &isValid) const
returns the value of the feature given by its name
Helper class to provide type-safe access to aux data.
Class providing the definition of the 4-vector interface.
bool attribute(PFODetails::PFOAttributes AttributeType, T &anAttribute) const
get a PFO Variable via enum
virtual FourMom_t p4() const
The full 4-momentum of the particle.
void setP4(const FourMom_t &vec)
set the 4-vec
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double e() const
The total energy of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
void setPi0PFOLinks(const PFOLinks_t &pi0PFOs)
void setPanTauDetail(TauJetParameters::PanTauDetails panTauDetail, int value)
const PFO * pi0PFO(size_t i) const
Get the pointer to a given pi0 PFO associated with this tau.
void clearPi0PFOLinks()
Remove all pi0 PFOs from the tau.
const PFOLinks_t & pi0PFOLinks() const
const PFOLinks_t & protoChargedPFOLinks() const
cellbased pfos
size_t nPi0PFOs() const
Get the number of pi0 PFO particles associated with this tau.
void clearChargedPFOLinks()
Remove all charged PFOs from the tau.
void addPi0Link(const ElementLink< IParticleContainer > &tr)
add a pi0 link to the tau
void setDetail(TauJetParameters::Detail detail, int value)
void setP4(double pt, double eta, double phi, double m)
Set methods for IParticle values.
void clearNeutralPFOLinks()
Remove all neutral PFOs from the tau.
bool panTauDetail(TauJetParameters::PanTauDetails panTauDetail, int &value) const
Get and set values of pantau details variables via enum.
void setNeutralPFOLinks(const PFOLinks_t &neutralPFOs)
const PFOLinks_t & neutralPFOLinks() const
const PFOLinks_t & chargedPFOLinks() const
default pfos
void setChargedPFOLinks(const PFOLinks_t &chargedPFOs)
const PFOLinks_t & protoNeutralPFOLinks() const
static void SetP4EEtaPhiM(TLorentzVector &hlv, double e, double eta, double phi, double m)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
PanTauDetails
Enum for tau details (scalar) calculated by pantau.
@ PanTau_BDTVar_Neutral_HLV_SumM
@ PanTau_BDTVar_Neutral_PID_BDTValues_BDTSort_2
@ PanTau_BDTVar_Charged_JetMoment_EtDRxTotalEt
@ PanTau_BDTValue_1p1n_vs_1pXn
@ PanTau_BDTVar_Basic_NNeutralConsts
@ PanTau_BDTVar_Neutral_Ratio_1stBDTEtOverEtAllConsts
@ PanTau_BDTValue_3p0n_vs_3pXn
@ PanTau_isPanTauCandidate
@ PanTau_BDTVar_Neutral_PID_BDTValues_BDTSort_1
@ PanTau_BDTVar_Combined_DeltaR1stNeutralTo1stCharged
@ PanTau_BDTVar_Neutral_Ratio_EtOverEtAllConsts
@ PanTau_BDTVar_Charged_StdDev_Et_WrtEtAllConsts
@ PanTau_BDTValue_1p0n_vs_1p1n
@ PanTau_BDTVar_Charged_HLV_SumM
@ PanTau_BDTVar_Neutral_Shots_NPhotonsInSeed
PFO_v1 PFO
Definition of the current "pfo version".
PFOContainer_v1 PFOContainer
Definition of the current "pfo container version".
Particle_v1 Particle
Define the latest version of the particle class.
ParticleContainer_v1 ParticleContainer
Define the latest version of the particle class.
TauJet_v3 TauJet
Definition of the current "tau version".