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_Sum", m_varTypeName_Sum) );
36 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Ratio", m_varTypeName_Ratio) );
37 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Isolation", m_varTypeName_Isolation) );
38 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Num", m_varTypeName_Num) );
39 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Mean", m_varTypeName_Mean) );
40 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_StdDev", m_varTypeName_StdDev) );
41 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_HLV", m_varTypeName_HLV) );
42 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Angle", m_varTypeName_Angle) );
43 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_DeltaR", m_varTypeName_DeltaR) );
44 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_JetMoment", m_varTypeName_JetMoment) );
45 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Combined", m_varTypeName_Combined) );
46 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_Basic", m_varTypeName_Basic) );
47 ATH_CHECK( m_Tool_InformationStore->getInfo_String(
"FeatureExtractor_VarTypeName_varTypeName_PID", m_varTypeName_PID) );
49 ATH_CHECK( m_Tool_InformationStore->getInfo_Int(
"FeatureExtractor_UseEmptySeeds", m_Config_UseEmptySeeds) );
51 ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble(
"CellBased_BinEdges_Eta", m_Config_CellBased_BinEdges_Eta) );
52 ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble(
"CellBased_EtaBinned_Pi0MVACut_1prong", m_Config_CellBased_EtaBinned_Pi0MVACut_1prong) );
53 ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble(
"CellBased_EtaBinned_Pi0MVACut_3prong", m_Config_CellBased_EtaBinned_Pi0MVACut_3prong) );
55 return StatusCode::SUCCESS;
60 std::map<std::string, double>& variants_SeedEt) {
63 variants_SeedEt[
"EtAllConsts"] = 0.0;
66 for (
unsigned int iConst = 0; iConst < tauConstituents.size(); iConst++) {
70 double curEt = curConstituent->
p4().Et();
75 variants_SeedEt[
"EtAllConsts"] += curEt;
82 const std::string& featName,
84 const std::map<std::string, double>& denominatorMap) {
85 std::map<std::string, double>::const_iterator
it = denominatorMap.begin();
86 for(;
it!=denominatorMap.end(); ++
it) {
88 float value =
static_cast<float>(
it->second);
100 bool isBadSeed = (noAnyConstituents || noSelConstituents || noValidInputTau);
101 if(
static_cast<bool>(m_Config_UseEmptySeeds)) isBadSeed = noValidInputTau;
104 ATH_MSG_DEBUG(
"Seed is not valid for feature extraction (no constituents or no valid input tau) - just fill isPanTauCandidate feature");
106 return StatusCode::SUCCESS;
111 ATH_CHECK( calculateBasicFeatures(inSeed) );
113 ATH_CHECK( addConstituentMomenta(inSeed) );
116 std::map<std::string, double> variants_SeedEt;
128 ATH_CHECK( addCombinedFeatures(inSeed, variants_SeedEt) );
130 return StatusCode::SUCCESS;
138 std::string featurePrefix = m_varTypeName_Basic;
139 std::string
name =
"CellBased_" + featurePrefix;
141 double SumCharge = 0;
142 double AbsCharge = 0;
149 bool foundIt =
false;
151 if(!foundIt)
continue;
155 unsigned int nConstituents = curList.size();
160 for(
unsigned int iConst=0; iConst<nConstituents; iConst++) {
162 SumCharge += curConstituent->
getCharge();
163 AbsCharge += std::abs(
static_cast<double>(curConstituent->
getCharge()));
175 featureMap->
addFeature(
name +
"_ProtoMomentumCore_pt", tlv_ProtoMomentumCore.Perp());
176 featureMap->
addFeature(
name +
"_ProtoMomentumCore_eta", tlv_ProtoMomentumCore.Eta());
177 featureMap->
addFeature(
name +
"_ProtoMomentumCore_phi", tlv_ProtoMomentumCore.Phi());
178 featureMap->
addFeature(
name +
"_ProtoMomentumCore_m", tlv_ProtoMomentumCore.M());
180 return StatusCode::SUCCESS;
186 std::string prefixVARType = m_varTypeName_HLV;
189 std::vector<PanTau::TauConstituent*> list_TypeConstituents = inSeed->
getConstituentsOfType(iType, isOK);
190 unsigned int n_Constituents_Type = list_TypeConstituents.size();
191 TLorentzVector tlv_TypeConstituents = inSeed->
getSubsystemHLV(iType, isOK);
193 std::string
name =
"CellBased_" + curTypeName +
"_" + prefixVARType;
195 std::vector<PanTau::TauConstituent*> list_TypeConstituents_SortBDT = inSeed->
getConstituentsOfType(iType, isOK);
196 std::sort(list_TypeConstituents_SortBDT.begin(), list_TypeConstituents_SortBDT.end(),
sortTauConstituentMVA);
198 if(!list_TypeConstituents.empty()) {
199 tauFeatureMap->
addFeature(
name +
"_SumPt", tlv_TypeConstituents.Perp());
200 tauFeatureMap->
addFeature(
name +
"_SumEta", tlv_TypeConstituents.Eta());
201 tauFeatureMap->
addFeature(
name +
"_SumPhi", tlv_TypeConstituents.Phi());
202 tauFeatureMap->
addFeature(
name +
"_SumM", tlv_TypeConstituents.M());
206 std::vector<double> curConstsBDT_pt = std::vector<double>(0);
207 std::vector<double> curConstsBDT_eta = std::vector<double>(0);
208 std::vector<double> curConstsBDT_phi = std::vector<double>(0);
209 std::vector<double> curConstsBDT_m = std::vector<double>(0);
210 for(
unsigned int iConst=0; iConst<n_Constituents_Type; iConst++) {
211 TLorentzVector tlv_curConstBDT = list_TypeConstituents_SortBDT[iConst]->p4();
212 curConstsBDT_pt.push_back(tlv_curConstBDT.Perp());
213 curConstsBDT_eta.push_back(tlv_curConstBDT.Eta());
214 curConstsBDT_phi.push_back(tlv_curConstBDT.Phi());
215 curConstsBDT_m.push_back(tlv_curConstBDT.M());
217 tauFeatureMap->
addVecFeature(
name +
"_BDTSort_Constituents_pt", curConstsBDT_pt);
218 tauFeatureMap->
addVecFeature(
name +
"_BDTSort_Constituents_eta", curConstsBDT_eta);
219 tauFeatureMap->
addVecFeature(
name +
"_BDTSort_Constituents_phi", curConstsBDT_phi);
224 return StatusCode::SUCCESS;
229 int tauConstituentType,
230 const std::map<std::string, double>& variants_SeedEt)
const {
239 bool foundIt =
false;
240 std::vector<PanTau::TauConstituent*> list_TypeConstituents;
243 if (!foundIt)
return StatusCode::SUCCESS;
245 unsigned int n_Constituents_Type = list_TypeConstituents.size();
252 std::vector<PanTau::TauConstituent*> list_TypeConstituents_SortBDT = list_TypeConstituents;
253 std::sort(list_TypeConstituents_SortBDT.begin(), list_TypeConstituents_SortBDT.end(),
sortTauConstituentMVA);
255 TLorentzVector tlv_1st_BDT;
257 if(!list_TypeConstituents_SortBDT.empty()) tlv_1st_BDT = list_TypeConstituents_SortBDT[0]->p4();
264 TLorentzVector tlv_TypeConstituents;
269 double sum_EtxDR = 0;
271 unsigned int num_EFOs = 0;
276 for(
unsigned int iTypeConst=0; iTypeConst<list_TypeConstituents.size(); iTypeConst++) {
279 TLorentzVector tlv_curConst = list_TypeConstituents.at(iTypeConst)->p4();
282 if (std::isnan(tlv_curConst.Pt()) || std::isinf(tlv_curConst.Pt()))
continue;
287 tlv_TypeConstituents += tlv_curConst;
290 double hlp_Et = tlv_curConst.Et();
291 double hlp_Et2 = hlp_Et * hlp_Et;
292 double hlp_DeltaR = tlv_Reference.DeltaR(tlv_curConst);
298 sum_EtxDR += hlp_Et * hlp_DeltaR;
310 std::string prefixVARType =
"";
314 if( num_EFOs == 0 ) {
315 return StatusCode::SUCCESS;
319 prefixVARType = m_varTypeName_PID;
322 for(
unsigned int iTypeConst=0; iTypeConst<n_Constituents_Type; iTypeConst++) {
324 double value_BDT = list_TypeConstituents_SortBDT[iTypeConst]->getBDTValue();
325 if( std::isnan(value_BDT) || std::isinf(value_BDT) )
continue;
329 double mvaCorrection = 0.0;
330 double etaCurConst = list_TypeConstituents_SortBDT[iTypeConst]->p4().Eta();
331 int etaBinIndex = m_HelperFunctions.getBinIndex(m_Config_CellBased_BinEdges_Eta, std::abs(etaCurConst));
333 if(numTrack == 1) { mvaCorrection = m_Config_CellBased_EtaBinned_Pi0MVACut_1prong.at(etaBinIndex); }
334 else { mvaCorrection = m_Config_CellBased_EtaBinned_Pi0MVACut_3prong.at(etaBinIndex); }
336 value_BDT = value_BDT - mvaCorrection;
339 std::string iConst = m_HelperFunctions.convertNumberToString(
static_cast<double>(iTypeConst+1));
340 tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_BDTValues_BDTSort_" + iConst, value_BDT);
349 TLorentzVector totalTLV_SumShots = TLorentzVector(0., 0., 0., 0.);
350 unsigned int totalPhotonsInSeed = 0;
352 std::vector<TLorentzVector> allShotTLVs = std::vector<TLorentzVector>(0);
354 for(
unsigned int iConst=0; iConst<list_TypeConstituents_SortBDT.size(); iConst++) {
357 TLorentzVector tlv_CurConst = curConst->
p4();
358 std::vector<PanTau::TauConstituent*> shotConstituents = curConst->
getShots();
359 unsigned int nShots = shotConstituents.size();
361 unsigned int totalPhotonsInNeutral = 0;
362 TLorentzVector tlv_SumShots = TLorentzVector(0., 0., 0., 0.);
364 for(
unsigned int iShot=0; iShot<nShots; iShot++) {
367 tlv_SumShots += curShot->
p4();
368 allShotTLVs.push_back(curShot->
p4());
370 totalTLV_SumShots += tlv_SumShots;
371 totalPhotonsInSeed += totalPhotonsInNeutral;
373 std::string iConstStr = m_HelperFunctions.convertNumberToString(
static_cast<double>(iConst+1));
375 tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_nPhotons_BDTSort_" + iConstStr, totalPhotonsInNeutral);
377 if(tlv_CurConst.Et() > 0.) tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_EtSumShotsOverConstEt_BDTSort_" + iConstStr, tlv_SumShots.Et() / tlv_CurConst.Et());
382 tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_NPhotonsInSeed", totalPhotonsInSeed);
388 prefixVARType = m_varTypeName_Ratio;
390 if(curTypeName != curTypeName_All) addFeatureWrtSeedEnergy(tauFeatureMap,
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_EtOver", sum_Et, variants_SeedEt);
392 if(tlv_1st_BDT.Pt() != 0) addFeatureWrtSeedEnergy(tauFeatureMap,
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_1stBDTEtOver", tlv_1st_BDT.Et(), variants_SeedEt);
394 if(tlv_1st_BDT.Pt() != 0 && sum_Et > 0.) tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_1stBDTEtOverTypeEt", tlv_1st_BDT.Et() / sum_Et);
397 prefixVARType = m_varTypeName_StdDev;
399 double stddev_Et = m_HelperFunctions.stddev(sum_Et2, sum_Et, num_EFOs);
401 if(stddev_Et > 0.) addFeatureWrtSeedEnergy(tauFeatureMap,
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_Et_Wrt", stddev_Et, variants_SeedEt);
407 prefixVARType = m_varTypeName_JetMoment;
411 tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_EtDR", sum_EtxDR / sum_Et);
412 tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_EtDRxTotalEt", (sum_EtxDR / sum_Et) * variants_SeedEt.at(
"EtAllConsts"));
415 return StatusCode::SUCCESS;
420 const std::map<std::string, double>& variants_SeedEt)
const {
431 std::vector<PanTau::TauConstituent*> list_NeutralConstituents = inSeed->
getConstituentsOfType(et_Neutral, foundIt);
448 name_EFOType[iType] =
"";
449 num_EFOs[iType] = 0.;
450 tlv_System[iType] = TLorentzVector();
451 tlv_1stEFO[iType] = TLorentzVector();
452 tlv_2ndEFO[iType] = TLorentzVector();
453 tlv_Sys_OK[iType] =
false;
454 tlv_1st_OK[iType] =
false;
461 if (!tlv_Sys_OK[iType])
continue;
463 std::vector<TauConstituent*> typeConstituents = inSeed->
getConstituentsOfType(iType, tlv_Sys_OK[iType]);
464 if (typeConstituents.empty()) tlv_Sys_OK[iType] =
false;
465 if (!tlv_Sys_OK[iType])
continue;
467 num_EFOs[iType] = typeConstituents.size();
469 if (!typeConstituents.empty()) {
470 tlv_1stEFO[iType] = typeConstituents.at(0)->p4();
471 tlv_1st_OK[iType] =
true;
473 tlv_1st_OK[iType] =
false;
476 if (typeConstituents.size() > 1) {
477 tlv_2ndEFO[iType] = typeConstituents.at(1)->p4();
482 std::string prefixVARType = m_varTypeName_Combined;
492 int type_Denom = iType;
497 int type_Nom = jType;
499 if(jType == iType)
continue;
504 double sum_Et_Nom = 0.0;
505 double sum_Et_Denom = 0.0;
506 if(tlv_Sys_OK[type_Nom] && tlv_Sys_OK[type_Denom]) {
507 sum_Et_Nom = tlv_System[type_Nom].Et();
508 sum_Et_Denom = tlv_System[type_Denom].Et();
513 if(tlv_1st_OK[type_Nom]) {
514 if(tlv_1stEFO[type_Nom].Et() > 0. && sum_Et_Denom > 0.) {
515 tauFeatures->
addFeature(
"CellBased_" + prefixVARType +
"_Log1st" + typeName_Nom +
"EtOver" + typeName_Denom +
"Et", std::log10(tlv_1stEFO[type_Nom].Et() / sum_Et_Denom) );
520 if(jType <= iType)
continue;
523 if(sum_Et_Denom > 0. && sum_Et_Nom > 0.) {
524 tauFeatures->
addFeature(
"CellBased_" + prefixVARType +
"_Log" + typeName_Nom +
"EtOver" + typeName_Denom +
"Et", std::log10(sum_Et_Nom / sum_Et_Denom) );
528 if(tlv_Sys_OK[type_Nom] && tlv_Sys_OK[type_Denom]) {
529 tauFeatures->
addFeature(
"CellBased_" + prefixVARType +
"_Angle" + typeName_Nom +
"To" + typeName_Denom, tlv_System[type_Nom].
Angle( tlv_System[type_Denom].Vect()) );
532 if(tlv_1st_OK[type_Nom] && tlv_1st_OK[type_Denom]) {
534 tauFeatures->
addFeature(
"CellBased_" + prefixVARType +
"_DeltaR1st" + typeName_Nom +
"To1st" + typeName_Denom, tlv_1stEFO[type_Nom].
DeltaR( tlv_1stEFO[type_Denom] ) );
537 tauFeatures->
addFeature(
"CellBased_" + prefixVARType +
"_Angle1st" + typeName_Nom +
"To1st" + typeName_Denom, tlv_1stEFO[type_Nom].
Angle( tlv_1stEFO[type_Denom].Vect() ) );
547 const int cTypes = 1;
548 const int nTypes = 2;
549 int index_charged[cTypes] = {et_Charged};
550 int index_neutral[nTypes] = {et_Pi0Neut, et_Neutral};
552 for(
int cType=0; cType<cTypes; cType++) {
553 for(
int nType=0; nType<nTypes; nType++) {
555 int et_c = index_charged[cType];
556 int et_n = index_neutral[nType];
561 if(!tlv_Sys_OK[et_c] || !tlv_Sys_OK[et_n])
continue;
564 if(num_EFOs[et_c] + num_EFOs[et_n] > 0.) {
565 double mean_cTypenTypeEt = ( tlv_System[et_c].Et() + tlv_System[et_n].Et() ) / (num_EFOs[et_c] + num_EFOs[et_n]);
566 addFeatureWrtSeedEnergy(tauFeatures,
"CellBased_" + prefixVARType +
"_Mean" + name_cType + name_nType +
"Et_Wrt", mean_cTypenTypeEt, variants_SeedEt);
570 tauFeatures->
addFeature(
"CellBased_" + prefixVARType +
"_InvMass" + name_cType + name_nType, ( tlv_System[et_c] + tlv_System[et_n] ).M() );
575 return StatusCode::SUCCESS;