12 return ( i.cachedElement()->bdtPi0Score() > j.
cachedElement()->bdtPi0Score() );
43 return StatusCode::SUCCESS;
52 bool isBadSeed = (noAnyConstituents || noSelConstituents || noValidInputTau);
59 ATH_MSG_DEBUG(
"This seed is not useable for detail arranging (other than validity flag)");
62 return StatusCode::SUCCESS;
101 return StatusCode::SUCCESS;
106 const std::string& featName,
112 std::string fullFeatName =
"CellBased_" + featName;
114 double theValue = features->
value(fullFeatName,
isValid);
119 bool isBadSeed = (noAnyConstituents || noSelConstituents || noValidInputTau);
122 ATH_MSG_DEBUG(
"WARNING --- Problems getting value for feature " << fullFeatName <<
" from map! This should not happen for this seed!");
123 ATH_MSG_DEBUG(
"WARNING --- Did the ModeDiscriminator set features used in BDTs that were not found to their default values?");
124 ATH_MSG_DEBUG(
"NOTE --- This can also happen for seeds with (for example) 0 neutrals when trying to get Neutral_SumM - check seed");
130 int valueToAddInt = -1;
131 float valueToAddFloat = -1.1;
135 valueToAddInt =
static_cast<int>(theValue);
139 valueToAddFloat =
static_cast<float>(theValue);
143 ATH_MSG_WARNING(
"Unknown PanTauDetailType! Please use enum PanTauDetailsType from PanTauAlgs/Tool_DetailsArranger.h.");
155 std::vector< ElementLink< xAOD::PFOContainer > > neutralPFOLinks = tauJet->
protoNeutralPFOLinks();
164 std::vector< ElementLink< xAOD::PFOContainer > > preLinkPi0PFOLinks = tauJet->
pi0PFOLinks();
188 return StatusCode::SUCCESS;
192 if(decayModeProto == decayModeFinal) {
197 preLinkPi0PFOLinks.push_back( pi0PFOLinks.at(0) );
205 preLinkPi0PFOLinks=pi0PFOLinks;
216 if(!preSelected_neutralPFOLinks.empty()) preLinkPi0PFOLinks.push_back( preSelected_neutralPFOLinks.at(0) );
217 else ATH_MSG_WARNING(
"No neutral PFO Links although there should be!!");
235 preLinkPi0PFOLinks=pi0PFOLinks;
241 preLinkPi0PFOLinks=pi0PFOLinks;
242 if(!preSelected_neutralPFOLinks.empty()) preLinkPi0PFOLinks.push_back( preSelected_neutralPFOLinks.at(0) );
243 else ATH_MSG_WARNING(
"No neutral PFO Links although there should be!!");
252 preLinkPi0PFOLinks.push_back( pi0PFOLinks.at(0) );
253 preLinkPi0PFOLinks.push_back( pi0PFOLinks.at(1) );
261 if(!preSelected_neutralPFOLinks.empty()) preLinkPi0PFOLinks.push_back( preSelected_neutralPFOLinks.at(0) );
262 else ATH_MSG_WARNING(
"No neutral PFO Links although there should be!!");
277 std::vector< ElementLink< xAOD::PFOContainer > > finalChrgPFOLinks = tauJet->
chargedPFOLinks();
278 std::vector< ElementLink< xAOD::PFOContainer > > finalPi0PFOLinks = tauJet->
pi0PFOLinks();
279 std::vector< ElementLink< xAOD::PFOContainer > > finalNeutralPFOLinks = tauJet->
neutralPFOLinks();
282 std::vector< TLorentzVector > vec_pi04vec;
283 std::vector< std::vector< ElementLink<xAOD::PFOContainer> > > vec_pi0pfos;
286 for(
unsigned int itlv=0; itlv!=vec_pi04vec.size(); ++itlv) {
289 p->setPxPyPzE(vec_pi04vec.at(itlv).Px(), vec_pi04vec.at(itlv).Py(), vec_pi04vec.at(itlv).Pz(), vec_pi04vec.at(itlv).E());
290 std::vector< ElementLink< xAOD::PFOContainer > > pfo_link_vector;
291 for(
uint ipfo = 0; ipfo != vec_pi0pfos.at(itlv).size(); ++ipfo) {
292 pfo_link_vector.push_back(vec_pi0pfos.at(itlv).at(ipfo));
296 accPi0PFOLinks(*p) = pfo_link_vector;
304 return StatusCode::SUCCESS;
311 std::vector< ElementLink< xAOD::PFOContainer > > finalChrgPFOLinks = tauJet->
chargedPFOLinks();
312 std::vector< ElementLink< xAOD::PFOContainer > > finalPi0PFOLinks = tauJet->
pi0PFOLinks();
314 unsigned int NCharged = finalChrgPFOLinks.size();
315 unsigned int NPi0Neut = finalPi0PFOLinks.size();
317 TLorentzVector tlv_PanTau_Final;
318 for(
unsigned int iPFO=0; iPFO<NCharged; iPFO++) {
319 const xAOD::PFO* pfo = finalChrgPFOLinks.at(iPFO).cachedElement();
320 tlv_PanTau_Final += pfo->
p4();
322 for(
unsigned int iPFO=0; iPFO<NPi0Neut; iPFO++) {
323 const xAOD::PFO* pfo = finalPi0PFOLinks.at(iPFO).cachedElement();
324 tlv_PanTau_Final += pfo->
p4();
330 featureMap->
addFeature(
"CellBased_" + varTypeName_Basic +
"_FinalMomentumCore_pt", tlv_PanTau_Final.Pt() );
331 featureMap->
addFeature(
"CellBased_" + varTypeName_Basic +
"_FinalMomentumCore_eta", tlv_PanTau_Final.Eta() );
332 featureMap->
addFeature(
"CellBased_" + varTypeName_Basic +
"_FinalMomentumCore_phi", tlv_PanTau_Final.Phi() );
333 featureMap->
addFeature(
"CellBased_" + varTypeName_Basic +
"_FinalMomentumCore_m", tlv_PanTau_Final.M() );
341 int nPi0sPerCluster = 1;
352 return (nPi0sPerCluster > 1);
358 TLorentzVector momentum;
360 neutral_pfo->
setP4(momentum.Pt(), neutral_pfo->
eta(), neutral_pfo->
phi(), mass);
366 for (
const auto& link : neutralPFOLinks) {
367 size_t index = link.index();
382 std::vector< ElementLink< xAOD::PFOContainer > > new_links;
384 unsigned int nConstsOfType=0;
389 ATH_MSG_WARNING(
"CollectConstituentsAsPFOLinks: Function was called with type = " <<
type <<
" , however it was only designed for types t_Pi0Neut and t_Neutral! Returning...");
393 for(
unsigned int iConst=0; iConst<tauConstituents.size(); iConst++) {
394 bool isOfType = tauConstituents[iConst]->isOfType(
type);
395 if(!isOfType)
continue;
403 for(
unsigned int iPFO=0; iPFO<cellbased_neutralPFOLinks.size(); iPFO++) {
404 const xAOD::PFO* pfo = cellbased_neutralPFOLinks.at(iPFO).cachedElement();
406 if( tauConstituents[iConst]->getPFO() != pfo )
continue;
408 new_links.push_back( cellbased_neutralPFOLinks.at(iPFO) );
412 if( nConstsOfType != new_links.size() ){
413 ATH_MSG_WARNING(
"CollectConstituentsAsPFOLinks: Couldn't find PFOLinks " << new_links.size() <<
" for all tau constituents (" << tauConstituents.size() <<
")!");
431 size_t iNumPi0PFO = tauJet->
nPi0PFOs();
444 vPi0s.push_back(xPfo1->
p4() + xPfo2->
p4());
447 double dNewMomentum = std::sqrt(vPi0s[0].E() * vPi0s[0].E() - fMassPi0Squared);
448 vPi0s[0].SetPxPyPzE(vPi0s[0].Vect().Unit().Px() * dNewMomentum,
449 vPi0s[0].Vect().Unit().Py() * dNewMomentum,
450 vPi0s[0].Vect().Unit().Pz() * dNewMomentum,
453 std::vector< ElementLink<xAOD::PFOContainer> > pfovec;
456 vec_pi0pfos.push_back( pfovec );
463 vPi0s.push_back(xPfo->
p4());
466 double dNewMomentum = std::sqrt( (vPi0s[0].E()/2.)*(vPi0s[0].E()/2.) -
MASS_PI0*
MASS_PI0 );
467 vPi0s[0].SetVectM(vPi0s[0].Vect().Unit() * dNewMomentum,
MASS_PI0 );
470 vPi0s.push_back(vPi0s[0]);
472 std::vector< ElementLink<xAOD::PFOContainer> > pfovec;
474 vec_pi0pfos.push_back( pfovec );
475 vec_pi0pfos.push_back( pfovec );
479 for (
size_t iPFO = 0; iPFO < iNumPi0PFO; iPFO++){
480 vPi0s.push_back(tauJet->
pi0PFO(iPFO)->
p4());
481 std::vector< ElementLink<xAOD::PFOContainer> > pfovec;
483 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".