13 return u->getBDTValue() >
v->getBDTValue();
18 return u->p4().Et() >
v->p4().Et();
33 ATH_CHECK( m_Tool_InformationStore.retrieve() );
35 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Ratio", m_varTypeName_Ratio) );
36 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Mean", m_varTypeName_Mean) );
37 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_StdDev", m_varTypeName_StdDev) );
38 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_HLV", m_varTypeName_HLV) );
39 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Angle", m_varTypeName_Angle) );
40 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_DeltaR", m_varTypeName_DeltaR) );
41 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_JetMoment", m_varTypeName_JetMoment) );
42 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Combined", m_varTypeName_Combined) );
43 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Basic", m_varTypeName_Basic) );
44 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_PID", m_varTypeName_PID) );
46 ATH_CHECK( m_Tool_InformationStore->getInfo_Int(
"FeatureExtractor_UseEmptySeeds", m_Config_UseEmptySeeds) );
48 ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble(
"CellBased_BinEdges_Eta", m_Config_CellBased_BinEdges_Eta) );
49 ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble(
"CellBased_EtaBinned_Pi0MVACut_1prong", m_Config_CellBased_EtaBinned_Pi0MVACut_1prong) );
50 ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble(
"CellBased_EtaBinned_Pi0MVACut_3prong", m_Config_CellBased_EtaBinned_Pi0MVACut_3prong) );
52 return StatusCode::SUCCESS;
57 std::map<std::string, double>& variants_SeedEt) {
60 variants_SeedEt[
"EtAllConsts"] = 0.0;
63 for (
unsigned int iConst = 0; iConst < tauConstituents.size(); iConst++) {
67 double curEt = curConstituent->
p4().Et();
72 variants_SeedEt[
"EtAllConsts"] += curEt;
79 const std::string& featName,
81 const std::map<std::string, double>& denominatorMap) {
82 std::map<std::string, double>::const_iterator
it = denominatorMap.begin();
83 for(;
it!=denominatorMap.end(); ++
it) {
85 float value =
static_cast<float>(
it->second);
97 bool isBadSeed = (noAnyConstituents || noSelConstituents || noValidInputTau);
98 if(
static_cast<bool>(m_Config_UseEmptySeeds)) isBadSeed = noValidInputTau;
101 ATH_MSG_DEBUG(
"Seed is not valid for feature extraction (no constituents or no valid input tau) - just fill isPanTauCandidate feature");
103 return StatusCode::SUCCESS;
108 ATH_CHECK( calculateBasicFeatures(inSeed) );
110 ATH_CHECK( addConstituentMomenta(inSeed) );
113 std::map<std::string, double> variants_SeedEt;
125 ATH_CHECK( addCombinedFeatures(inSeed, variants_SeedEt) );
127 return StatusCode::SUCCESS;
135 std::string featurePrefix = m_varTypeName_Basic;
136 std::string
name =
"CellBased_" + featurePrefix;
138 double SumCharge = 0;
139 double AbsCharge = 0;
146 bool foundIt =
false;
148 if(!foundIt)
continue;
152 unsigned int nConstituents = curList.size();
157 for(
unsigned int iConst=0; iConst<nConstituents; iConst++) {
159 SumCharge += curConstituent->
getCharge();
160 AbsCharge += std::abs(
static_cast<double>(curConstituent->
getCharge()));
172 featureMap->
addFeature(
name +
"_ProtoMomentumCore_pt", tlv_ProtoMomentumCore.Perp());
173 featureMap->
addFeature(
name +
"_ProtoMomentumCore_eta", tlv_ProtoMomentumCore.Eta());
174 featureMap->
addFeature(
name +
"_ProtoMomentumCore_phi", tlv_ProtoMomentumCore.Phi());
175 featureMap->
addFeature(
name +
"_ProtoMomentumCore_m", tlv_ProtoMomentumCore.M());
177 return StatusCode::SUCCESS;
183 std::string prefixVARType = m_varTypeName_HLV;
186 std::vector<PanTau::TauConstituent*> list_TypeConstituents = inSeed->
getConstituentsOfType(iType, isOK);
187 unsigned int n_Constituents_Type = list_TypeConstituents.size();
188 TLorentzVector tlv_TypeConstituents = inSeed->
getSubsystemHLV(iType, isOK);
190 std::string
name =
"CellBased_" + curTypeName +
"_" + prefixVARType;
192 std::vector<PanTau::TauConstituent*> list_TypeConstituents_SortBDT = inSeed->
getConstituentsOfType(iType, isOK);
193 std::sort(list_TypeConstituents_SortBDT.begin(), list_TypeConstituents_SortBDT.end(),
sortTauConstituentMVA);
195 if(!list_TypeConstituents.empty()) {
196 tauFeatureMap->
addFeature(
name +
"_SumPt", tlv_TypeConstituents.Perp());
197 tauFeatureMap->
addFeature(
name +
"_SumEta", tlv_TypeConstituents.Eta());
198 tauFeatureMap->
addFeature(
name +
"_SumPhi", tlv_TypeConstituents.Phi());
199 tauFeatureMap->
addFeature(
name +
"_SumM", tlv_TypeConstituents.M());
203 std::vector<double> curConstsBDT_pt = std::vector<double>(0);
204 std::vector<double> curConstsBDT_eta = std::vector<double>(0);
205 std::vector<double> curConstsBDT_phi = std::vector<double>(0);
206 std::vector<double> curConstsBDT_m = std::vector<double>(0);
207 for(
unsigned int iConst=0; iConst<n_Constituents_Type; iConst++) {
208 TLorentzVector tlv_curConstBDT = list_TypeConstituents_SortBDT[iConst]->p4();
209 curConstsBDT_pt.push_back(tlv_curConstBDT.Perp());
210 curConstsBDT_eta.push_back(tlv_curConstBDT.Eta());
211 curConstsBDT_phi.push_back(tlv_curConstBDT.Phi());
212 curConstsBDT_m.push_back(tlv_curConstBDT.M());
214 tauFeatureMap->
addVecFeature(
name +
"_BDTSort_Constituents_pt", curConstsBDT_pt);
215 tauFeatureMap->
addVecFeature(
name +
"_BDTSort_Constituents_eta", curConstsBDT_eta);
216 tauFeatureMap->
addVecFeature(
name +
"_BDTSort_Constituents_phi", curConstsBDT_phi);
221 return StatusCode::SUCCESS;
226 int tauConstituentType,
227 const std::map<std::string, double>& variants_SeedEt)
const {
236 bool foundIt =
false;
237 std::vector<PanTau::TauConstituent*> list_TypeConstituents;
240 if (!foundIt)
return StatusCode::SUCCESS;
242 unsigned int n_Constituents_Type = list_TypeConstituents.size();
249 std::vector<PanTau::TauConstituent*> list_TypeConstituents_SortBDT = list_TypeConstituents;
250 std::sort(list_TypeConstituents_SortBDT.begin(), list_TypeConstituents_SortBDT.end(),
sortTauConstituentMVA);
252 TLorentzVector tlv_1st_BDT;
254 if(!list_TypeConstituents_SortBDT.empty()) tlv_1st_BDT = list_TypeConstituents_SortBDT[0]->p4();
261 TLorentzVector tlv_TypeConstituents;
266 double sum_EtxDR = 0;
268 unsigned int num_EFOs = 0;
273 for(
unsigned int iTypeConst=0; iTypeConst<list_TypeConstituents.size(); iTypeConst++) {
276 TLorentzVector tlv_curConst = list_TypeConstituents.at(iTypeConst)->p4();
279 if (std::isnan(tlv_curConst.Pt()) || std::isinf(tlv_curConst.Pt()))
continue;
284 tlv_TypeConstituents += tlv_curConst;
287 double hlp_Et = tlv_curConst.Et();
288 double hlp_Et2 = hlp_Et * hlp_Et;
289 double hlp_DeltaR = tlv_Reference.DeltaR(tlv_curConst);
295 sum_EtxDR += hlp_Et * hlp_DeltaR;
307 std::string prefixVARType =
"";
311 if( num_EFOs == 0 ) {
312 return StatusCode::SUCCESS;
316 prefixVARType = m_varTypeName_PID;
319 for(
unsigned int iTypeConst=0; iTypeConst<n_Constituents_Type; iTypeConst++) {
321 double value_BDT = list_TypeConstituents_SortBDT[iTypeConst]->getBDTValue();
322 if( std::isnan(value_BDT) || std::isinf(value_BDT) )
continue;
326 double mvaCorrection = 0.0;
327 double etaCurConst = list_TypeConstituents_SortBDT[iTypeConst]->p4().Eta();
328 int etaBinIndex = m_HelperFunctions.getBinIndex(m_Config_CellBased_BinEdges_Eta, std::abs(etaCurConst));
330 if(numTrack == 1) { mvaCorrection = m_Config_CellBased_EtaBinned_Pi0MVACut_1prong.at(etaBinIndex); }
331 else { mvaCorrection = m_Config_CellBased_EtaBinned_Pi0MVACut_3prong.at(etaBinIndex); }
333 value_BDT = value_BDT - mvaCorrection;
336 std::string iConst = m_HelperFunctions.convertNumberToString(
static_cast<double>(iTypeConst+1));
337 tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_BDTValues_BDTSort_" + iConst, value_BDT);
346 TLorentzVector totalTLV_SumShots = TLorentzVector(0., 0., 0., 0.);
347 unsigned int totalPhotonsInSeed = 0;
349 std::vector<TLorentzVector> allShotTLVs = std::vector<TLorentzVector>(0);
351 for(
unsigned int iConst=0; iConst<list_TypeConstituents_SortBDT.size(); iConst++) {
354 TLorentzVector tlv_CurConst = curConst->
p4();
355 std::vector<PanTau::TauConstituent*> shotConstituents = curConst->
getShots();
356 unsigned int nShots = shotConstituents.size();
358 unsigned int totalPhotonsInNeutral = 0;
359 TLorentzVector tlv_SumShots = TLorentzVector(0., 0., 0., 0.);
361 for(
unsigned int iShot=0; iShot<nShots; iShot++) {
364 tlv_SumShots += curShot->
p4();
365 allShotTLVs.push_back(curShot->
p4());
367 totalTLV_SumShots += tlv_SumShots;
368 totalPhotonsInSeed += totalPhotonsInNeutral;
370 std::string iConstStr = m_HelperFunctions.convertNumberToString(
static_cast<double>(iConst+1));
372 tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_nPhotons_BDTSort_" + iConstStr, totalPhotonsInNeutral);
374 if(tlv_CurConst.Et() > 0.) tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_EtSumShotsOverConstEt_BDTSort_" + iConstStr, tlv_SumShots.Et() / tlv_CurConst.Et());
379 tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_NPhotonsInSeed", totalPhotonsInSeed);
385 prefixVARType = m_varTypeName_Ratio;
387 if(curTypeName != curTypeName_All) addFeatureWrtSeedEnergy(tauFeatureMap,
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_EtOver", sum_Et, variants_SeedEt);
389 if(tlv_1st_BDT.Pt() != 0) addFeatureWrtSeedEnergy(tauFeatureMap,
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_1stBDTEtOver", tlv_1st_BDT.Et(), variants_SeedEt);
391 if(tlv_1st_BDT.Pt() != 0 && sum_Et > 0.) tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_1stBDTEtOverTypeEt", tlv_1st_BDT.Et() / sum_Et);
394 prefixVARType = m_varTypeName_StdDev;
396 double stddev_Et = m_HelperFunctions.stddev(sum_Et2, sum_Et, num_EFOs);
398 if(stddev_Et > 0.) addFeatureWrtSeedEnergy(tauFeatureMap,
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_Et_Wrt", stddev_Et, variants_SeedEt);
404 prefixVARType = m_varTypeName_JetMoment;
408 tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_EtDR", sum_EtxDR / sum_Et);
409 tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_EtDRxTotalEt", (sum_EtxDR / sum_Et) * variants_SeedEt.at(
"EtAllConsts"));
412 return StatusCode::SUCCESS;
417 const std::map<std::string, double>& variants_SeedEt)
const {
428 std::vector<PanTau::TauConstituent*> list_NeutralConstituents = inSeed->
getConstituentsOfType(et_Neutral, foundIt);
445 name_EFOType[iType] =
"";
446 num_EFOs[iType] = 0.;
447 tlv_System[iType] = TLorentzVector();
448 tlv_1stEFO[iType] = TLorentzVector();
449 tlv_2ndEFO[iType] = TLorentzVector();
450 tlv_Sys_OK[iType] =
false;
451 tlv_1st_OK[iType] =
false;
458 if (!tlv_Sys_OK[iType])
continue;
460 std::vector<TauConstituent*> typeConstituents = inSeed->
getConstituentsOfType(iType, tlv_Sys_OK[iType]);
461 if (typeConstituents.empty()) tlv_Sys_OK[iType] =
false;
462 if (!tlv_Sys_OK[iType])
continue;
464 num_EFOs[iType] = typeConstituents.size();
466 if (!typeConstituents.empty()) {
467 tlv_1stEFO[iType] = typeConstituents.at(0)->p4();
468 tlv_1st_OK[iType] =
true;
470 tlv_1st_OK[iType] =
false;
473 if (typeConstituents.size() > 1) {
474 tlv_2ndEFO[iType] = typeConstituents.at(1)->p4();
479 std::string prefixVARType = m_varTypeName_Combined;
489 int type_Denom = iType;
494 int type_Nom = jType;
496 if(jType == iType)
continue;
501 double sum_Et_Nom = 0.0;
502 double sum_Et_Denom = 0.0;
503 if(tlv_Sys_OK[type_Nom] && tlv_Sys_OK[type_Denom]) {
504 sum_Et_Nom = tlv_System[type_Nom].Et();
505 sum_Et_Denom = tlv_System[type_Denom].Et();
510 if(tlv_1st_OK[type_Nom]) {
511 if(tlv_1stEFO[type_Nom].Et() > 0. && sum_Et_Denom > 0.) {
512 tauFeatures->
addFeature(
"CellBased_" + prefixVARType +
"_Log1st" + typeName_Nom +
"EtOver" + typeName_Denom +
"Et", std::log10(tlv_1stEFO[type_Nom].Et() / sum_Et_Denom) );
517 if(jType <= iType)
continue;
520 if(sum_Et_Denom > 0. && sum_Et_Nom > 0.) {
521 tauFeatures->
addFeature(
"CellBased_" + prefixVARType +
"_Log" + typeName_Nom +
"EtOver" + typeName_Denom +
"Et", std::log10(sum_Et_Nom / sum_Et_Denom) );
525 if(tlv_Sys_OK[type_Nom] && tlv_Sys_OK[type_Denom]) {
526 tauFeatures->
addFeature(
"CellBased_" + prefixVARType +
"_Angle" + typeName_Nom +
"To" + typeName_Denom, tlv_System[type_Nom].
Angle( tlv_System[type_Denom].Vect()) );
529 if(tlv_1st_OK[type_Nom] && tlv_1st_OK[type_Denom]) {
531 tauFeatures->
addFeature(
"CellBased_" + prefixVARType +
"_DeltaR1st" + typeName_Nom +
"To1st" + typeName_Denom, tlv_1stEFO[type_Nom].
DeltaR( tlv_1stEFO[type_Denom] ) );
534 tauFeatures->
addFeature(
"CellBased_" + prefixVARType +
"_Angle1st" + typeName_Nom +
"To1st" + typeName_Denom, tlv_1stEFO[type_Nom].
Angle( tlv_1stEFO[type_Denom].Vect() ) );
544 const int cTypes = 1;
545 const int nTypes = 2;
546 int index_charged[cTypes] = {et_Charged};
547 int index_neutral[nTypes] = {et_Pi0Neut, et_Neutral};
549 for(
int cType=0; cType<cTypes; cType++) {
550 for(
int nType=0; nType<nTypes; nType++) {
552 int et_c = index_charged[cType];
553 int et_n = index_neutral[nType];
558 if(!tlv_Sys_OK[et_c] || !tlv_Sys_OK[et_n])
continue;
561 if(num_EFOs[et_c] + num_EFOs[et_n] > 0.) {
562 double mean_cTypenTypeEt = ( tlv_System[et_c].Et() + tlv_System[et_n].Et() ) / (num_EFOs[et_c] + num_EFOs[et_n]);
563 addFeatureWrtSeedEnergy(tauFeatures,
"CellBased_" + prefixVARType +
"_Mean" + name_cType + name_nType +
"Et_Wrt", mean_cTypenTypeEt, variants_SeedEt);
567 tauFeatures->
addFeature(
"CellBased_" + prefixVARType +
"_InvMass" + name_cType + name_nType, ( tlv_System[et_c] + tlv_System[et_n] ).M() );
572 return StatusCode::SUCCESS;