17 return (
i.cachedElement()->bdtPi0Score() > j.
cachedElement()->bdtPi0Score() );
23 m_Tool_InformationStore(
"PanTau::Tool_InformationStore/Tool_InformationStore")
39 ATH_CHECK( m_Tool_InformationStore->getInfo_Double(
"TauConstituents_Types_DeltaRCore", m_CoreCone) );
40 ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble(
"TauConstituents_BinEdges_Eta", m_EtaBinEdges) );
41 ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble(
"TauConstituents_Selection_Neutral_EtaBinned_EtCut", m_EtaBinnedEtCuts) );
42 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Sum", m_varTypeName_Sum) );
43 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Ratio", m_varTypeName_Ratio) );
44 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_EtInRing", m_varTypeName_EtInRing) );
45 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Isolation", m_varTypeName_Isolation) );
46 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Num", m_varTypeName_Num) );
47 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Mean", m_varTypeName_Mean) );
48 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_StdDev", m_varTypeName_StdDev) );
49 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_HLV", m_varTypeName_HLV) );
50 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Angle", m_varTypeName_Angle) );
51 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_DeltaR", m_varTypeName_DeltaR) );
52 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_JetMoment", m_varTypeName_JetMoment) );
53 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Combined", m_varTypeName_Combined) );
54 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_JetShape", m_varTypeName_JetShape) );
55 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_ImpactParams", m_varTypeName_ImpactParams) );
56 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Basic", m_varTypeName_Basic) );
57 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_PID", m_varTypeName_PID) );
58 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Shots", m_varTypeName_Shots) );
60 return StatusCode::SUCCESS;
71 bool isBadSeed = (noAnyConstituents || noSelConstituents || noValidInputTau);
78 ATH_MSG_DEBUG(
"This seed is not useable for detail arranging (other than validity flag)");
81 return StatusCode::SUCCESS;
84 ATH_CHECK(arrangePFOLinks(inSeed, tauJet, pi0Container, neutralPFOContainer));
97 addPanTauDetailToTauJet(inSeed,
"Basic_NNeutralConsts",
99 addPanTauDetailToTauJet(inSeed,
"Charged_JetMoment_EtDRxTotalEt",
101 addPanTauDetailToTauJet(inSeed,
"Charged_StdDev_Et_WrtEtAllConsts",
103 addPanTauDetailToTauJet(inSeed,
"Neutral_HLV_SumM",
105 addPanTauDetailToTauJet(inSeed,
"Neutral_PID_BDTValues_BDTSort_1",
107 addPanTauDetailToTauJet(inSeed,
"Neutral_PID_BDTValues_BDTSort_2",
109 addPanTauDetailToTauJet(inSeed,
"Neutral_Ratio_1stBDTEtOverEtAllConsts",
111 addPanTauDetailToTauJet(inSeed,
"Neutral_Ratio_EtOverEtAllConsts",
113 addPanTauDetailToTauJet(inSeed,
"Neutral_Shots_NPhotonsInSeed",
115 addPanTauDetailToTauJet(inSeed,
"Combined_DeltaR1stNeutralTo1stCharged",
117 addPanTauDetailToTauJet(inSeed,
"Charged_HLV_SumM",
120 return StatusCode::SUCCESS;
125 const std::string& featName,
133 double theValue = features->
value(fullFeatName,
isValid);
138 bool isBadSeed = (noAnyConstituents || noSelConstituents || noValidInputTau);
141 ATH_MSG_DEBUG(
"WARNING --- Problems getting value for feature " << fullFeatName <<
" from map! This should not happen for this seed!");
142 ATH_MSG_DEBUG(
"WARNING --- Did the ModeDiscriminator set features used in BDTs that were not found to their default values?");
143 ATH_MSG_DEBUG(
"NOTE --- This can also happen for seeds with (for example) 0 neutrals when trying to get Neutral_SumM - check seed");
149 int valueToAddInt = -1;
150 float valueToAddFloat = -1.1;
154 valueToAddInt = (
int)theValue;
158 valueToAddFloat = (
float)theValue;
162 ATH_MSG_WARNING(
"Unknown PanTauDetailType! Please use enum PanTauDetailsType from PanTauAlgs/Tool_DetailsArranger.h.");
176 std::vector< ElementLink< xAOD::PFOContainer > > neutralPFOLinks = tauJet->
protoNeutralPFOLinks();
185 std::vector< ElementLink< xAOD::PFOContainer > > preLinkPi0PFOLinks = tauJet->
pi0PFOLinks();
188 std::sort (pi0PFOLinks.begin(), pi0PFOLinks.end(),
sortBDTscore);
189 std::sort (preSelected_neutralPFOLinks.begin(), preSelected_neutralPFOLinks.end(),
sortBDTscore);
190 std::sort (neutralPFOLinks.begin(), neutralPFOLinks.end(),
sortBDTscore);
193 SetNeutralConstituentVectorMasses(neutralPFOLinks, neutralPFOContainer, 0.);
207 SetHLVTau(inSeed, tauJet, inputAlg, m_varTypeName_Basic);
209 return StatusCode::SUCCESS;
213 if(decayModeProto == decayModeFinal) {
218 preLinkPi0PFOLinks.push_back( pi0PFOLinks.at(0) );
221 SetNeutralConstituentVectorMasses(preLinkPi0PFOLinks, neutralPFOContainer, MASS_PI0);
226 preLinkPi0PFOLinks=pi0PFOLinks;
229 SetNeutralConstituentVectorMasses(preLinkPi0PFOLinks, neutralPFOContainer, MASS_PI0);
237 if(!preSelected_neutralPFOLinks.empty()) preLinkPi0PFOLinks.push_back( preSelected_neutralPFOLinks.at(0) );
238 else ATH_MSG_WARNING(
"No neutral PFO Links although there should be!!");
241 SetNeutralConstituentVectorMasses(preLinkPi0PFOLinks, neutralPFOContainer, MASS_PI0);
250 if( pi0PFOLinks.size() == 1 && HasMultPi0sInOneCluster(pi0PFOLinks.at(0).cachedElement(), decayModeProto, inputAlg) ){
253 SetNeutralConstituentVectorMasses(pi0PFOLinks, neutralPFOContainer, 2*MASS_PI0);
256 preLinkPi0PFOLinks=pi0PFOLinks;
262 preLinkPi0PFOLinks=pi0PFOLinks;
263 if(!preSelected_neutralPFOLinks.empty()) preLinkPi0PFOLinks.push_back( preSelected_neutralPFOLinks.at(0) );
264 else ATH_MSG_WARNING(
"No neutral PFO Links although there should be!!");
267 SetNeutralConstituentVectorMasses(preLinkPi0PFOLinks, neutralPFOContainer, MASS_PI0);
273 preLinkPi0PFOLinks.push_back( pi0PFOLinks.at(0) );
274 preLinkPi0PFOLinks.push_back( pi0PFOLinks.at(1) );
277 SetNeutralConstituentVectorMasses(preLinkPi0PFOLinks, neutralPFOContainer, 0.);
282 if(!preSelected_neutralPFOLinks.empty()) preLinkPi0PFOLinks.push_back( preSelected_neutralPFOLinks.at(0) );
283 else ATH_MSG_WARNING(
"No neutral PFO Links although there should be!!");
286 SetNeutralConstituentVectorMasses(preLinkPi0PFOLinks, neutralPFOContainer, MASS_PI0);
296 SetHLVTau(inSeed, tauJet, inputAlg, m_varTypeName_Basic);
298 std::vector< ElementLink< xAOD::PFOContainer > > finalChrgPFOLinks = tauJet->
chargedPFOLinks();
299 std::vector< ElementLink< xAOD::PFOContainer > > finalPi0PFOLinks = tauJet->
pi0PFOLinks();
300 std::vector< ElementLink< xAOD::PFOContainer > > finalNeutralPFOLinks = tauJet->
neutralPFOLinks();
303 std::vector< TLorentzVector > vec_pi04vec;
304 std::vector< std::vector< ElementLink<xAOD::PFOContainer> > > vec_pi0pfos;
307 for(
unsigned int itlv=0; itlv!=vec_pi04vec.size(); ++itlv) {
310 p->setPxPyPzE(vec_pi04vec.at(itlv).Px(), vec_pi04vec.at(itlv).Py(), vec_pi04vec.at(itlv).Pz(), vec_pi04vec.at(itlv).E());
311 std::vector< ElementLink< xAOD::PFOContainer > > pfo_link_vector;
312 for(
uint ipfo = 0; ipfo != vec_pi0pfos.at(itlv).
size(); ++ipfo) {
313 pfo_link_vector.push_back(vec_pi0pfos.at(itlv).at(ipfo));
317 accPi0PFOLinks(*
p) = pfo_link_vector;
325 return StatusCode::SUCCESS;
332 std::vector< ElementLink< xAOD::PFOContainer > > finalChrgPFOLinks = tauJet->
chargedPFOLinks();
333 std::vector< ElementLink< xAOD::PFOContainer > > finalPi0PFOLinks = tauJet->
pi0PFOLinks();
335 unsigned int NCharged = finalChrgPFOLinks.size();
336 unsigned int NPi0Neut = finalPi0PFOLinks.size();
338 TLorentzVector tlv_PanTau_Final;
339 for(
unsigned int iPFO=0; iPFO<NCharged; iPFO++) {
340 const xAOD::PFO* pfo = finalChrgPFOLinks.at(iPFO).cachedElement();
341 tlv_PanTau_Final += pfo->
p4();
343 for(
unsigned int iPFO=0; iPFO<NPi0Neut; iPFO++) {
344 const xAOD::PFO* pfo = finalPi0PFOLinks.at(iPFO).cachedElement();
345 tlv_PanTau_Final += pfo->
p4();
351 featureMap->
addFeature(inputAlg +
"_" + varTypeName_Basic +
"_FinalMomentumCore_pt", tlv_PanTau_Final.Pt() );
352 featureMap->
addFeature(inputAlg +
"_" + varTypeName_Basic +
"_FinalMomentumCore_eta", tlv_PanTau_Final.Eta() );
353 featureMap->
addFeature(inputAlg +
"_" + varTypeName_Basic +
"_FinalMomentumCore_phi", tlv_PanTau_Final.Phi() );
354 featureMap->
addFeature(inputAlg +
"_" + varTypeName_Basic +
"_FinalMomentumCore_m", tlv_PanTau_Final.M() );
362 int nPi0sPerCluster = 1;
364 if (inputAlg !=
"CellBased" )
return (nPi0sPerCluster > 1);
375 return (nPi0sPerCluster > 1);
382 PanTau::SetP4EEtaPhiM(
momentum, neutral_pfo->
e(), neutral_pfo->
eta(), neutral_pfo->
phi(),
mass);
389 for (
const auto& link : neutralPFOLinks) {
390 size_t index = link.index();
392 SetNeutralConstituentMass(curNeutralPFO,
mass);
405 std::vector< ElementLink< xAOD::PFOContainer > > new_links;
407 unsigned int nConstsOfType=0;
412 ATH_MSG_WARNING(
"CollectConstituentsAsPFOLinks: Function was called with type = " <<
type <<
" , however it was only designed for types t_Pi0Neut and t_Neutral! Returning...");
416 for(
unsigned int iConst=0; iConst<tauConstituents.size(); iConst++) {
417 bool isOfType = tauConstituents[iConst]->isOfType(
type);
418 if(!isOfType)
continue;
426 for(
unsigned int iPFO=0; iPFO<cellbased_neutralPFOLinks.size(); iPFO++) {
427 const xAOD::PFO* pfo = cellbased_neutralPFOLinks.at(iPFO).cachedElement();
429 if( tauConstituents[iConst]->getPFO() != pfo )
continue;
431 new_links.push_back( cellbased_neutralPFOLinks.at(iPFO) );
435 if( nConstsOfType != new_links.size() ){
436 ATH_MSG_WARNING(
"CollectConstituentsAsPFOLinks: Couldn't find PFOLinks " << new_links.size() <<
" for all tau constituents (" << tauConstituents.size() <<
")!");
454 size_t iNumPi0PFO = tauJet->
nPi0PFOs();
463 float fMassPi0Squared = MASS_PI0*MASS_PI0;
468 vPi0s.push_back(xPfo1->
p4() + xPfo2->
p4());
471 double dNewMomentum = std::sqrt(vPi0s[0].
E() * vPi0s[0].
E() - fMassPi0Squared);
472 vPi0s[0].SetPxPyPzE(vPi0s[0].Vect().Unit().Px() * dNewMomentum,
473 vPi0s[0].Vect().Unit().Py() * dNewMomentum,
474 vPi0s[0].Vect().Unit().Pz() * dNewMomentum,
477 std::vector< ElementLink<xAOD::PFOContainer> > pfovec;
480 vec_pi0pfos.push_back( pfovec );
487 vPi0s.push_back(xPfo->
p4());
490 double dNewMomentum = std::sqrt( (vPi0s[0].
E()/2.)*(vPi0s[0].
E()/2.) - MASS_PI0*MASS_PI0 );
491 vPi0s[0].SetVectM(vPi0s[0].Vect().Unit() * dNewMomentum, MASS_PI0 );
494 vPi0s.push_back(vPi0s[0]);
496 std::vector< ElementLink<xAOD::PFOContainer> > pfovec;
498 vec_pi0pfos.push_back( pfovec );
499 vec_pi0pfos.push_back( pfovec );
503 for (
size_t iPFO = 0; iPFO < iNumPi0PFO; iPFO++){
504 vPi0s.push_back(tauJet->
pi0PFO(iPFO)->
p4());
505 std::vector< ElementLink<xAOD::PFOContainer> > pfovec;
507 vec_pi0pfos.push_back( pfovec );