183 std::vector<PanTau::TauConstituent*> list_TypeConstituents = inSeed->
getConstituentsOfType(iType, isOK);
184 unsigned int n_Constituents_Type = list_TypeConstituents.size();
185 TLorentzVector tlv_TypeConstituents = inSeed->
getSubsystemHLV(iType, isOK);
187 std::string name =
"CellBased_" + curTypeName +
"_" + prefixVARType;
189 std::vector<PanTau::TauConstituent*> list_TypeConstituents_SortBDT = inSeed->
getConstituentsOfType(iType, isOK);
192 if(!list_TypeConstituents.empty()) {
193 tauFeatureMap->
addFeature(name +
"_SumPt", tlv_TypeConstituents.Perp());
194 tauFeatureMap->
addFeature(name +
"_SumEta", tlv_TypeConstituents.Eta());
195 tauFeatureMap->
addFeature(name +
"_SumPhi", tlv_TypeConstituents.Phi());
196 tauFeatureMap->
addFeature(name +
"_SumM", tlv_TypeConstituents.M());
200 std::vector<double> curConstsBDT_pt = std::vector<double>(0);
201 std::vector<double> curConstsBDT_eta = std::vector<double>(0);
202 std::vector<double> curConstsBDT_phi = std::vector<double>(0);
203 std::vector<double> curConstsBDT_m = std::vector<double>(0);
204 for(
unsigned int iConst=0; iConst<n_Constituents_Type; iConst++) {
205 TLorentzVector tlv_curConstBDT = list_TypeConstituents_SortBDT[iConst]->p4();
206 curConstsBDT_pt.push_back(tlv_curConstBDT.Perp());
207 curConstsBDT_eta.push_back(tlv_curConstBDT.Eta());
208 curConstsBDT_phi.push_back(tlv_curConstBDT.Phi());
209 curConstsBDT_m.push_back(tlv_curConstBDT.M());
211 tauFeatureMap->
addVecFeature(name +
"_BDTSort_Constituents_pt", curConstsBDT_pt);
212 tauFeatureMap->
addVecFeature(name +
"_BDTSort_Constituents_eta", curConstsBDT_eta);
213 tauFeatureMap->
addVecFeature(name +
"_BDTSort_Constituents_phi", curConstsBDT_phi);
214 tauFeatureMap->
addVecFeature(name +
"_BDTSort_Constituents_m", curConstsBDT_m);
218 return StatusCode::SUCCESS;
223 int tauConstituentType,
224 const std::map<std::string, double>& variants_SeedEt)
const {
233 bool foundIt =
false;
234 std::vector<PanTau::TauConstituent*> list_TypeConstituents;
237 if (!foundIt)
return StatusCode::SUCCESS;
239 unsigned int n_Constituents_Type = list_TypeConstituents.size();
246 std::vector<PanTau::TauConstituent*> list_TypeConstituents_SortBDT = list_TypeConstituents;
249 TLorentzVector tlv_1st_BDT;
251 if(!list_TypeConstituents_SortBDT.empty()) tlv_1st_BDT = list_TypeConstituents_SortBDT[0]->p4();
258 TLorentzVector tlv_TypeConstituents;
263 double sum_EtxDR = 0;
265 unsigned int num_EFOs = 0;
270 for(
unsigned int iTypeConst=0; iTypeConst<list_TypeConstituents.size(); iTypeConst++) {
273 TLorentzVector tlv_curConst = list_TypeConstituents.at(iTypeConst)->p4();
276 if (std::isnan(tlv_curConst.Pt()) || std::isinf(tlv_curConst.Pt()))
continue;
281 tlv_TypeConstituents += tlv_curConst;
284 double hlp_Et = tlv_curConst.Et();
285 double hlp_Et2 = hlp_Et * hlp_Et;
286 double hlp_DeltaR = tlv_Reference.DeltaR(tlv_curConst);
292 sum_EtxDR += hlp_Et * hlp_DeltaR;
304 std::string prefixVARType =
"";
308 if( num_EFOs == 0 ) {
309 return StatusCode::SUCCESS;
316 for(
unsigned int iTypeConst=0; iTypeConst<n_Constituents_Type; iTypeConst++) {
318 double value_BDT = list_TypeConstituents_SortBDT[iTypeConst]->getBDTValue();
319 if( std::isnan(value_BDT) || std::isinf(value_BDT) )
continue;
323 double mvaCorrection = 0.0;
324 double etaCurConst = list_TypeConstituents_SortBDT[iTypeConst]->p4().Eta();
330 value_BDT = value_BDT - mvaCorrection;
333 std::string iConst =
m_HelperFunctions.convertNumberToString(
static_cast<double>(iTypeConst+1));
334 tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_BDTValues_BDTSort_" + iConst, value_BDT);
343 TLorentzVector totalTLV_SumShots = TLorentzVector(0., 0., 0., 0.);
344 unsigned int totalPhotonsInSeed = 0;
346 std::vector<TLorentzVector> allShotTLVs = std::vector<TLorentzVector>(0);
348 for(
unsigned int iConst=0; iConst<list_TypeConstituents_SortBDT.size(); iConst++) {
351 TLorentzVector tlv_CurConst = curConst->
p4();
352 std::vector<PanTau::TauConstituent*> shotConstituents = curConst->
getShots();
353 unsigned int nShots = shotConstituents.size();
355 unsigned int totalPhotonsInNeutral = 0;
356 TLorentzVector tlv_SumShots = TLorentzVector(0., 0., 0., 0.);
358 for(
unsigned int iShot=0; iShot<nShots; iShot++) {
361 tlv_SumShots += curShot->
p4();
362 allShotTLVs.push_back(curShot->
p4());
364 totalTLV_SumShots += tlv_SumShots;
365 totalPhotonsInSeed += totalPhotonsInNeutral;
367 std::string iConstStr =
m_HelperFunctions.convertNumberToString(
static_cast<double>(iConst+1));
369 tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_nPhotons_BDTSort_" + iConstStr, totalPhotonsInNeutral);
371 if(tlv_CurConst.Et() > 0.) tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_EtSumShotsOverConstEt_BDTSort_" + iConstStr, tlv_SumShots.Et() / tlv_CurConst.Et());
376 tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_NPhotonsInSeed", totalPhotonsInSeed);
384 if(curTypeName != curTypeName_All)
addFeatureWrtSeedEnergy(tauFeatureMap,
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_EtOver", sum_Et, variants_SeedEt);
386 if(tlv_1st_BDT.Pt() != 0)
addFeatureWrtSeedEnergy(tauFeatureMap,
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_1stBDTEtOver", tlv_1st_BDT.Et(), variants_SeedEt);
388 if(tlv_1st_BDT.Pt() != 0 && sum_Et > 0.) tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_1stBDTEtOverTypeEt", tlv_1st_BDT.Et() / sum_Et);
395 if(stddev_Et > 0.)
addFeatureWrtSeedEnergy(tauFeatureMap,
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_Et_Wrt", stddev_Et, variants_SeedEt);
405 tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_EtDR", sum_EtxDR / sum_Et);
406 tauFeatureMap->
addFeature(
"CellBased_" + curTypeName +
"_" + prefixVARType +
"_EtDRxTotalEt", (sum_EtxDR / sum_Et) * variants_SeedEt.at(
"EtAllConsts"));
409 return StatusCode::SUCCESS;
414 const std::map<std::string, double>& variants_SeedEt)
const {
425 std::vector<PanTau::TauConstituent*> list_NeutralConstituents = inSeed->
getConstituentsOfType(et_Neutral, foundIt);
442 name_EFOType[iType] =
"";
443 num_EFOs[iType] = 0.;
444 tlv_System[iType] = TLorentzVector();
445 tlv_1stEFO[iType] = TLorentzVector();
446 tlv_2ndEFO[iType] = TLorentzVector();
447 tlv_Sys_OK[iType] =
false;
448 tlv_1st_OK[iType] =
false;
455 if (!tlv_Sys_OK[iType])
continue;
457 std::vector<TauConstituent*> typeConstituents = inSeed->
getConstituentsOfType(iType, tlv_Sys_OK[iType]);
458 if (typeConstituents.empty()) tlv_Sys_OK[iType] =
false;
459 if (!tlv_Sys_OK[iType])
continue;
461 num_EFOs[iType] = typeConstituents.size();
463 if (!typeConstituents.empty()) {
464 tlv_1stEFO[iType] = typeConstituents.at(0)->p4();
465 tlv_1st_OK[iType] =
true;
467 tlv_1st_OK[iType] =
false;
470 if (typeConstituents.size() > 1) {
471 tlv_2ndEFO[iType] = typeConstituents.at(1)->p4();
486 int type_Denom = iType;
491 int type_Nom = jType;
493 if(jType == iType)
continue;
498 double sum_Et_Nom = 0.0;
499 double sum_Et_Denom = 0.0;
500 if(tlv_Sys_OK[type_Nom] && tlv_Sys_OK[type_Denom]) {
501 sum_Et_Nom = tlv_System[type_Nom].Et();
502 sum_Et_Denom = tlv_System[type_Denom].Et();
507 if(tlv_1st_OK[type_Nom]) {
508 if(tlv_1stEFO[type_Nom].Et() > 0. && sum_Et_Denom > 0.) {
509 tauFeatures->
addFeature(
"CellBased_" + prefixVARType +
"_Log1st" + typeName_Nom +
"EtOver" + typeName_Denom +
"Et", std::log10(tlv_1stEFO[type_Nom].Et() / sum_Et_Denom) );
514 if(jType <= iType)
continue;
517 if(sum_Et_Denom > 0. && sum_Et_Nom > 0.) {
518 tauFeatures->
addFeature(
"CellBased_" + prefixVARType +
"_Log" + typeName_Nom +
"EtOver" + typeName_Denom +
"Et", std::log10(sum_Et_Nom / sum_Et_Denom) );
522 if(tlv_Sys_OK[type_Nom] && tlv_Sys_OK[type_Denom]) {
523 tauFeatures->
addFeature(
"CellBased_" + prefixVARType +
"_Angle" + typeName_Nom +
"To" + typeName_Denom, tlv_System[type_Nom].Angle( tlv_System[type_Denom].Vect()) );
526 if(tlv_1st_OK[type_Nom] && tlv_1st_OK[type_Denom]) {
528 tauFeatures->
addFeature(
"CellBased_" + prefixVARType +
"_DeltaR1st" + typeName_Nom +
"To1st" + typeName_Denom, tlv_1stEFO[type_Nom].DeltaR( tlv_1stEFO[type_Denom] ) );
531 tauFeatures->
addFeature(
"CellBased_" + prefixVARType +
"_Angle1st" + typeName_Nom +
"To1st" + typeName_Denom, tlv_1stEFO[type_Nom].Angle( tlv_1stEFO[type_Denom].Vect() ) );
541 const int cTypes = 1;
542 const int nTypes = 2;
543 int index_charged[cTypes] = {et_Charged};
544 int index_neutral[nTypes] = {et_Pi0Neut, et_Neutral};
546 for(
int cType=0; cType<cTypes; cType++) {
547 for(
int nType=0; nType<nTypes; nType++) {
549 int et_c = index_charged[cType];
550 int et_n = index_neutral[nType];
555 if(!tlv_Sys_OK[et_c] || !tlv_Sys_OK[et_n])
continue;
558 if(num_EFOs[et_c] + num_EFOs[et_n] > 0.) {
559 double mean_cTypenTypeEt = ( tlv_System[et_c].Et() + tlv_System[et_n].Et() ) / (num_EFOs[et_c] + num_EFOs[et_n]);
560 addFeatureWrtSeedEnergy(tauFeatures,
"CellBased_" + prefixVARType +
"_Mean" + name_cType + name_nType +
"Et_Wrt", mean_cTypenTypeEt, variants_SeedEt);
564 tauFeatures->
addFeature(
"CellBased_" + prefixVARType +
"_InvMass" + name_cType + name_nType, ( tlv_System[et_c] + tlv_System[et_n] ).M() );
569 return StatusCode::SUCCESS;