13#include "CaloGeoHelpers/CaloSampling.h"
23#include "GaudiKernel/ThreadLocalContext.h"
45#if defined(SIMULATIONBASE) || defined(XAOD_ANALYSIS)
59 declareInterface<ICaloCellIsolationTool>(
this);
60 declareInterface<ICaloTopoClusterIsolationTool>(
this);
61 declareInterface<INeutralEFlowIsolationTool>(
this);
89 return StatusCode::FAILURE;
95 return StatusCode::FAILURE;
103 return StatusCode::FAILURE;
124 if (filename.empty()){
126 return StatusCode::FAILURE ;
128 ATH_MSG_INFO(
"Path found for pileup correction = "<< filename);
129 std::unique_ptr<TFile> f(TFile::Open(filename.c_str(),
"READ"));
137 if (filename.empty()){
139 return StatusCode::FAILURE ;
141 ATH_MSG_INFO(
"Path found for mc additional correction of pileup correction = "<< filename);
142 std::unique_ptr<TFile> g(TFile::Open(filename.c_str(),
"READ"));
151 return StatusCode::SUCCESS;
156 return StatusCode::SUCCESS;
162 const std::vector<Iso::IsolationType>& cones,
180 derefMap[ip] = &particle;
183 if (particle.type() == Type::Muon)
187 const Muon*
muon =
dynamic_cast<const Muon*
>(&particle);
194 ATH_MSG_WARNING(
"CaloCellIsolation only supported for Muons and Egamma");
202 const std::vector<Iso::IsolationType>& cones,
206 if ( cones.empty() ) {
212 if (particle.type() == Type::Muon)
222 derefMap[ip] = &particle;
232 ATH_MSG_WARNING(
"CaloTopoClusterIsolation only supported for TrackParticles and Egamma");
240 const std::vector<Iso::IsolationType>& cones,
245 if (particle.type() == Type::Muon)
255 derefMap[ip] = &particle;
265 ATH_MSG_WARNING(
"FlowElementIsolation only supported for Egamma and TrackParticle");
276 const std::vector<Iso::IsolationType>& isoTypes,
const CaloCorrection& corrlist
278 ,
double coneCoreSize
282 if( isoTypes.empty() ) {
287 unsigned int typesize = isoTypes.size();
300 ATH_MSG_WARNING(
"Unsupported isolation flavour passed, cannot calculate isolation " <<
301 static_cast<int>(theFlavour));
308 const std::vector<Iso::IsolationType>& isoTypes,
314 if( isoTypes.empty() ) {
319 unsigned int typesize = isoTypes.size();
322 std::vector<float> coneSizes;
323 coneSizes.resize(isoTypes.size());
324 for (
unsigned int is = 0; is < isoTypes.size(); is++)
337 ATH_MSG_WARNING(
"Unsupported isolation flavour passed, cannot calculate isolation " <<
static_cast<int>(theFlavour));
345 ATH_MSG_WARNING(
"Could not compute core cell energy for egamma in etcone");
360 const std::vector<Iso::IsolationType>& isoTypes,
363 double coneCoreSize)
const
366 if( isoTypes.empty() ) {
371 unsigned int typesize = isoTypes.size();
374 std::vector<float> coneSizes;
375 coneSizes.reserve(isoTypes.size());
377 for(
auto isoType : isoTypes ){
381 float phi = eg.caloCluster()->phi();
382 float eta = eg.caloCluster()->eta();
395 ATH_MSG_WARNING(
"Could not compute core cell energy for egamma in topoetcone");
402 ATH_MSG_WARNING(
"Could not apply pt correction to topoetcone isolation");
417 const std::vector<Iso::IsolationType>& isoTypes,
419 double coneCoreSize)
const
422 if( isoTypes.empty() ) {
427 ATH_MSG_WARNING(
"Only EM scale is supported by neutralEflowIsolation");
431 unsigned int typesize = isoTypes.size();
434 std::vector<float> coneSizes;
435 coneSizes.reserve(isoTypes.size());
437 for(
auto isoType : isoTypes ){
444 float phi = eg.phi();
445 float eta = eg.eta();
448 <<
" cluster eta, phi = " << eg.caloCluster()->eta() <<
" " << eg.caloCluster()->phi());
458 ATH_MSG_WARNING(
"Could not compute core cell energy for egamma in neflowisol");
469 std::string
type =
"PFlow";
482 const std::vector<Iso::IsolationType>& isoTypes,
488 if( isoTypes.empty() ) {
493 unsigned int typesize = isoTypes.size();
496 std::vector<float> coneSizes;
497 coneSizes.reserve(isoTypes.size());
499 for(
auto isoType : isoTypes ){
503 float phi = tp.phi();
504 float eta = tp.eta();
506 ATH_MSG_WARNING(
"TrackParticle eta = " << tp.eta() <<
", phi = " << tp.phi() <<
" not updated from extraplation!");
508 ATH_MSG_DEBUG(
"TrackParticle eta = " << tp.eta() <<
", phi = " << tp.phi() <<
", extrap eta = " <<
eta <<
", phi = " <<
phi);
519 ATH_MSG_WARNING(
"Could not compute muon core energy (cells) from neflowisol");
524 std::string
type =
"PFlow";
526 ATH_MSG_WARNING(
"Could not apply ED correction to eflow isolation for muon");
546 const Muon* mu =
dynamic_cast<const Muon*
>(derefMap[tp]);
548 const auto *cluster = mu->cluster();
550 float etaT = 0, phiT = 0, dphiT = 0.;
552 for(
unsigned int i=0; i<CaloSampling::Unknown; i++)
555 if(!cluster->hasSampling(s))
continue;
556 ATH_MSG_DEBUG(
"Sampling: " << i <<
"eta-phi (" << cluster->etaSample(s) <<
", " << cluster->phiSample(s) <<
")");
557 etaT += cluster->etaSample(s);
559 phiT = cluster->phiSample(s);
568 phi = phiT + dphiT/nSample;
583 std::unique_ptr<Trk::CaloExtension> caloExtensionUPtr;
588 m_caloExtTool->caloExtension(Gaudi::Hive::currentContext(), *tp);
589 caloExtension = caloExtensionUPtr.get();
594 if (!cache.isValid())
607 if(!intersections.empty()){
609 for (
unsigned int i = 0; i < intersections.size(); ++i){
612 <<
" eta-phi (" << point.eta() <<
", " << point.phi() <<
")");
615 avePoint = (1./intersections.size())*avePoint;
616 eta = avePoint.eta();
617 phi = avePoint.phi();
624 ATH_MSG_WARNING("Calo extension can not be obtained!!!");
631 const std::vector<Iso::IsolationType>& isoTypes,
636 if( isoTypes.empty() ) {
641 unsigned int typesize = isoTypes.size();
643 std::vector<float> coneSizes;
644 coneSizes.reserve(isoTypes.size());
646for(
auto isoType : isoTypes ){
650 float phi = tp.phi();
651 float eta = tp.eta();
653 ATH_MSG_DEBUG(
"TrackParticle eta = " << tp.eta() <<
", phi = " << tp.phi() <<
", extrap eta = " <<
eta <<
", phi = " <<
phi);
664 ATH_MSG_WARNING(
"Could not compute muon core energy (cells) from topoetcone");
678 const std::vector<Iso::IsolationType>& isoTypes,
690 std::vector<double> conesf;
691 double maxConeSize = -1;
692 for(
auto isoType : isoTypes ){
694 ATH_MSG_WARNING(
"Unsupported isolation type passed, cannot calculate isolation " <<
static_cast<int>(isoType));
698 conesf.push_back(cone);
699 if(cone>maxConeSize) maxConeSize = cone;
703 const double coreConeDR = coneCoreSize;
705 if(doCoreCone && maxConeSize<coreConeDR) maxConeSize = coreConeDR;
708 ATH_MSG_DEBUG(
"calculating etcone for # " << conesf.size() <<
" cones");
709 std::unique_ptr<const Rec::ParticleCellAssociation> association=
m_assoTool->particleCellAssociation(tp,maxConeSize,
container);
711 ATH_MSG_DEBUG(
"failed to obtain the ParticleCellAssociation");
716 selector.preSelectAction(association->caloExtension());
717 ATH_MSG_DEBUG(
"looping over cells " << association->data().size());
718 for(
unsigned int i=0; i<conesf.size(); i++){
720 selector.setConeSize(conesf[i]);
721 for (
const auto *aCell : association->data()){
722 if( !selector.select(*aCell) )
continue;
723 if (
m_ExcludeTG3 && CaloCell_ID::TileGap3 == aCell->caloDDE()->getSampling())
continue;
727 ATH_MSG_DEBUG(
"etcone raw: coneSize = " << conesf[i] <<
"; etcone = " <<
result.etcones[i]);
735 selector.setConeSize(coreConeDR);
736 for (
const auto *aCell : association->data()){
737 if( !selector.select(*aCell) )
continue;
738 if (
m_ExcludeTG3 && CaloCell_ID::TileGap3 == aCell->caloDDE()->getSampling())
continue;
741 std::map<Iso::IsolationCorrectionParameter,float> corecorr;
750 ATH_MSG_DEBUG(
"Applying coreCone correction for trackParticle etcone isolation.");
751 for(
unsigned int i=0;i<
result.etcones.size();++i ) {
752 result.etcones[i] -= ecore;
771 const std::vector<Iso::IsolationType>& isoTypes,
775 std::vector<double> conesf;
776 double maxConeSize = -1;
777 for(
auto isoType : isoTypes ){
779 ATH_MSG_WARNING(
"Unsupported isolation type passed, cannot calculate isolation " <<
static_cast<int>(isoType));
783 conesf.push_back(cone);
784 if(cone>maxConeSize) maxConeSize = cone;
787 const double coreConeDR = coneCoreSize;
789 if(doCoreCone && maxConeSize<coreConeDR) maxConeSize = coreConeDR;
791 if(!
muon.clusterLink().isValid()){
794 for(
unsigned int i=0; i<conesf.size(); i++)
result.etcones[i] = 0;
798 std::map<Iso::IsolationCorrectionParameter,float> corecorr;
806 ATH_MSG_DEBUG(
"Applying coreCone correction for trackParticle etcone isolation.");
807 for(
unsigned int i=0;i<
result.etcones.size();++i ) {
808 result.etcones[i] -= ecore;
817 ATH_MSG_DEBUG(
"calculating etcone for # " << conesf.size() <<
" cones");
819 selector.preSelectAction(*muonCluster);
821 for(
unsigned int i=0; i<conesf.size(); i++){
823 selector.setConeSize(conesf[i]);
825 for(; cell_itr!=muonCluster->
end(); ++cell_itr){
826 if( !selector.select(**cell_itr) )
continue;
827 if (
m_ExcludeTG3 && CaloCell_ID::TileGap3 == (*cell_itr)->caloDDE()->getSampling())
continue;
828 totE += (*cell_itr)->et();
831 ATH_MSG_DEBUG(
"etcone raw: coneSize = " << conesf[i] <<
"; etcone = " <<
result.etcones[i]);
838 selector.setConeSize(coreConeDR);
840 for(; cell_itr!=muonCluster->
end(); ++cell_itr){
841 if( !selector.select(**cell_itr) )
continue;
842 if (
m_ExcludeTG3 && CaloCell_ID::TileGap3 == (*cell_itr)->caloDDE()->getSampling())
continue;
843 totE += (*cell_itr)->et();
845 std::map<Iso::IsolationCorrectionParameter,float> corecorr;
854 ATH_MSG_DEBUG(
"Applying coreCone correction for trackParticle etcone isolation.");
855 for(
unsigned int i=0;i<
result.etcones.size();++i ) {
856 result.etcones[i] -= ecore;
866 if(
muon.primaryTrackParticleLink().isValid() &&
muon.author()!=2) tp = *
muon.primaryTrackParticleLink();
867 if( !tp) tp = *
muon.inDetTrackParticleLink();
878 const std::vector<Iso::IsolationType>& isoTypes,
880 if( isoTypes.empty() ) {
888 std::vector<float> coneSizes; coneSizes.resize(3);
889 std::vector<float> coneSizesSquared; coneSizesSquared.resize(3);
890 for (
unsigned int i = 0; i < isoTypes.size(); i++) {
893 coneSizesSquared[i] = dR*dR;
896 float phi = eg.caloCluster()->phi();
897 float eta = eg.caloCluster()->eta();
900 std::vector<CaloCell_ID::SUBCALO> Vec_EMCaloEnums;
906 std::vector<CaloCell_ID::SUBCALO> Vec_HadCaloEnums;
915 for (
unsigned int n=0; n< coneSizes.size(); n++)
916 if (coneSizes[n] > Rmax) Rmax = coneSizes[n];
921 for (
const auto *it: EMccl) {
922 double etacel=it->eta();
923 double phicel=it->phi();
925 double deleta =
eta-etacel;
927 double drcel2 = (deleta*deleta) + (delphi*delphi);
929 for (
unsigned int i = 0; i < coneSizes.size(); i++) {
930 if (drcel2 < coneSizesSquared[i])
931 result.etcones[i] += it->et();
939 for (
const auto *it: HADccl) {
941 if (
m_ExcludeTG3 && CaloCell_ID::TileGap3 == it->caloDDE()->getSampling()) {
947 double etacel = it->eta();
948 double phicel = it->phi();
950 double deleta =
eta-etacel;
952 double drcel2 = (deleta*deleta) + (delphi*delphi);
954 for (
unsigned int i = 0; i < coneSizes.size(); i++) {
955 if (drcel2 < coneSizesSquared[i])
956 result.etcones[i] += it->et();
965 std::vector<float>& coneSizes,
970 double coneCoreSize)
const
974 auto max_cone_iter=std::max_element(coneSizes.begin(), coneSizes.end());
975 float max_cone= (*max_cone_iter);
976 std::vector<const CaloCluster*> clusts;
985 if(!particlesInCone(
eta,
phi,max_cone,clusts))
991 for(; clItr != clItrE; ++clItr){
992 clusts.push_back (*clItr);
1015 std::vector<float>& coneSizes,
1018 double coneCoreSize,
1019 const Egamma *egObj)
const
1023 auto max_cone_iter=std::max_element(coneSizes.begin(), coneSizes.end());
1024 float max_cone = (*max_cone_iter);
1025 std::vector<const FlowElement*> clusts;
1027#ifndef XAOD_ANALYSIS
1039 for(; clItr != clItrE; ++clItr){
1040 clusts.push_back (*clItr);
1064 std::vector<float>& coneSizes,
1065 const std::vector<const CaloCluster*>& clusts)
const
1072 if(
et <= 0 || fabs(cl->eta()) > 7.0)
continue;
1075 float tilegap3_et = cl->eSample(CaloSampling::TileGap3)*st;
1079 float dEta = cl->eta()-
eta;
1080 float dr=sqrt(dPhi*dPhi+ dEta*dEta);
1082 for (
unsigned int i = 0; i < coneSizes.size(); i++) {
1083 if (dr < coneSizes[i]) {
1084 ATH_MSG_DEBUG(
"Adding topo " << cl <<
" dR = " << dr <<
" et of a topo clust et = " <<
et
1085 <<
" (calibrated " << cl->pt() <<
", tilegap et = " << tilegap3_et <<
")");
1098 std::vector<float>& coneSizes,
1099 const std::vector<const FlowElement*>& clusts)
const
1105 float et = cl->pt();
1106 if (
et <= 0 || fabs(cl->eta()) > 7.0)
continue;
1109 float dEta = cl->eta()-
eta;
1110 float dR = sqrt(dPhi*dPhi+ dEta*dEta);
1112 for (
unsigned int i = 0; i < coneSizes.size(); i++) {
1113 if (dR < coneSizes[i]) {
1124 const std::vector<Iso::IsolationType>& isoTypes,
1134 if ((gotIso && fabs(coreV) < 1
e-3) || !gotIso) {
1135#ifndef XAOD_ANALYSIS
1138 float eraw57=0.,
eta=0.;
1141 double seedEta = cleg->
eta0(), seedPhi = cleg->
phi0();
1147 egcCloneFor57.get()).isSuccess())
1151 if(egcCloneFor57->size()==0){
1156 eraw57 = egcCloneFor57->e();
1158 coreV = eraw57/cosh(
eta);
1159 ATH_MSG_DEBUG(
"Number of cells in 5x7 " << egcCloneFor57->size()
1160 <<
" seed eta,phi " << cleg->
eta0() <<
" " << cleg->
phi0()
1161 <<
" eraw = " << eraw57 <<
" etraw = " << coreV
1169 std::map<Iso::IsolationCorrectionParameter,float> corecorr;
1174 for (
unsigned int i = 0; i < isoTypes.size(); i++){
1175 result.etcones[i] -= coreV;
1184 float dEtaMax_core,
float dPhiMax_core,
float dR2Max_core,
1185 const std::vector<const CaloCluster*>& clusts,
bool onlyEM,
1187 const Egamma* egObj)
const
1189 ATH_MSG_DEBUG(
"In CaloIsolationTool::correctIsolationEnergy_TopoCore");
1194 float areacore = -999.;
1195 if (fwdClus ==
nullptr) {
1196 if (dEtaMax_core>0 && dPhiMax_core>0) areacore = 4*dEtaMax_core*dPhiMax_core;
1197 else if (dR2Max_core>0) areacore =
M_PI*dR2Max_core;
1201 double topoCore(0.);
1204 ATH_MSG_DEBUG(
"Including " << topoCore <<
" in the core transverse energy of the fwd electron");
1207 ATH_MSG_DEBUG(
"cl: eta " << cl->eta() <<
" phi " << cl->phi()
1210 <<
" cal E " << cl->e());
1213 if(dEtaMax_core>0 && fabs(dPhi) > dPhiMax_core)
continue;
1214 float dEta = cl->eta()-
eta;
1215 if(dPhiMax_core>0 && fabs(dEta) > dEtaMax_core)
continue;
1216 if(dR2Max_core>0 && dPhi*dPhi+dEta*dEta > dR2Max_core)
continue;
1217 ATH_MSG_DEBUG(
"dist: dPhi " << dPhi <<
" dEta " << dEta <<
" dR2 " << dPhi*dPhi+dEta*dEta);
1221 if(
et <= 0 || fabs(cl->eta()) > 7.0)
continue;
1226 if (fabs(ettg3) > 1)
1232 double eEM = cl->energyBE(0)+cl->energyBE(1)+cl->energyBE(2)+cl->energyBE(3);
1239 ATH_MSG_DEBUG(
"adding in core et: " <<
et <<
" (em frac = " << emfrac <<
" dR = " << sqrt(dPhi*dPhi+dEta*dEta) <<
") total " << topoCore);
1243 double topoCoreSC(0.);
1245 double topoCoreSCem = 0;
1248 for (
unsigned int ic = 0; ic < assocClus.size(); ic++) {
1252 ATH_MSG_DEBUG(
"Adding topo " << ic <<
" ptr = " << cl <<
" contrib, pt = " << cl->pt()
1254 <<
" eta,phi = " << cl->eta() <<
" " << cl->phi()
1257 <<
" nCells = " << cluster_size(cl)
1262 topoCoreSCem -= ettg3;
1267 double eEM = cl->energyBE(0)+cl->energyBE(1)+cl->energyBE(2)+cl->energyBE(3);
1276 ATH_MSG_DEBUG(
"Including " << topoCore <<
" only em, no tg3 " << topoCoreSCem <<
" calibrated " << test <<
" in the core transverse energy of the super cluster egamma object made of "
1277 << assocClus.size() <<
" clusters with corresponding pT = " << egObj->
pt()
1278 <<
" cluster pT = " << egObj->
caloCluster()->
pt() <<
" cluster un cal pT = "
1280 <<
" nCells = " << cluster_size(egObj->
caloCluster())
1286 std::map<Iso::IsolationCorrectionParameter,float> corecorrSC;
1293 ATH_MSG_DEBUG(
"core energy, std = " << topoCore <<
" topo-assoc (full) = " << topoCoreSC <<
" topo-assoc (only em, no tg3) = " << topoCoreSCem);
1295 std::map<Iso::IsolationCorrectionParameter,float> corecorr;
1310 toSub = topoCoreSCem;
1318 for (
unsigned int i = 0; i <
result.etcones.size(); i++){
1319 result.etcones[i] -= toSub;
1320 ATH_MSG_DEBUG(
"TopoCore correction i=" << i <<
" cone [before] " <<
result.etcones[i]+toSub <<
" cone [after] " <<
result.etcones[i]);
1329 float detaMax,
float dphiMax,
1331 const std::vector<const FlowElement*>& clusts,
1332 bool onlyEM,
const Egamma* egObj)
const
1335 float pflowCore(0.);
1337 ATH_MSG_DEBUG(
"pflo: eta " << cl->eta() <<
" phi " << cl->phi() <<
" pt " << cl->pt() <<
" charge " << cl->charge());
1339 if (detaMax > 0 && fabs(dphi) > dphiMax)
continue;
1340 float deta = cl->eta()-
eta;
1341 if (dphiMax > 0 && fabs(deta) > detaMax)
continue;
1342 if (dR2Max > 0 && dphi*dphi+deta*deta > dR2Max)
continue;
1345 float et = cl->pt();
1346 if (
et <= 0 || fabs(cl->eta()) > 7.0)
continue;
1353 emfrac = std::min(1.,eEM / cl->e());
1360 ATH_MSG_DEBUG(
"pflow to be added to core: et = " <<
et <<
" (em frac = " << emfrac <<
"), total = " << pflowCore);
1364 float pflowCoreSC(0.);
1368 ATH_MSG_DEBUG(
"Number of associated neutral FE = " << fes.size());
1370 if (fe ==
nullptr) {
1374 ATH_MSG_DEBUG(
"asso pflo: eta " << fe->eta() <<
" phi " << fe->phi() <<
" pt " << fe->pt() <<
" charge " << fe->charge() <<
" index = " << fe->index());
1377 if (fe->index() == cl->index()) {
1384 ATH_MSG_DEBUG(
"asso pflo after vertex correction : eta " << afe->
eta() <<
" phi " << afe->
phi() <<
" pt " << afe->
pt());
1386 float et = afe->
pt();
1387 if (
et <= 0 || fabs(afe->
eta()) > 7.0)
continue;
1394 et -= allEne.at(17)/cosh(afe->
eta());
1398 for (
int i = 0; i <= 7; i++) eEM += allEne.at(i);
1399 double eAll = fe->e();
1401 eAll -= allEne.at(17);
1402 emfrac = std::min(1.,eEM / eAll);
1408 ATH_MSG_DEBUG(
"asso pflow to be added to core " << fe <<
" et = " <<
et <<
" (em frac = " << emfrac <<
"), total = " << pflowCoreSC);
1410 std::map<Iso::IsolationCorrectionParameter,float> corecorrSC;
1417 float areacore = -999.;
1418 if (detaMax > 0 && dphiMax > 0) areacore = 4*detaMax*dphiMax;
1419 else if (dR2Max > 0) areacore =
M_PI*dR2Max;
1421 std::map<Iso::IsolationCorrectionParameter,float> corecorr;
1427 for (
unsigned int i = 0; i <
result.etcones.size(); i++) {
1428 ATH_MSG_DEBUG(
"pflow, cone type " << i <<
", in cone " <<
result.etcones[i] <<
", subtracted " <<
result.etcones[i]-pflowCore);
1429 result.etcones[i] -= pflowCore;
1442 ATH_MSG_DEBUG(
"in CaloIsolationTool::correctIsolationEnergy_MuonCore ");
1446 auto muI = derefMap.find(&tp);
1448 if(muI!=derefMap.end()){
1451 ATH_MSG_WARNING(
"ET_Core of muon not found! coreMuon isolation correction will not be applied!!!");
1455 std::map<Iso::IsolationCorrectionParameter,float> corecorr;
1461 for(
unsigned int i=0;i<
result.etcones.size();++i ) {
1462 result.etcones[i] -= ecore;
1463 ATH_MSG_DEBUG(
"MuonCore i=" << i <<
" cone [before] " <<
result.etcones[i]+ecore <<
" cone [after] " <<
result.etcones[i]);
1472 const std::vector<Iso::IsolationType>& isoTypes)
const
1478 std::vector<float> corrvec;
1479 corrvec.resize(isoTypes.size(),0.);
1480 for (
unsigned int i = 0; i < isoTypes.size(); i++) {
1488 result.etcones[i] -= corrvec[i];
1489 ATH_MSG_DEBUG(
"eta = " << eg.eta() <<
", phi = " << eg.phi() <<
", pt = " << eg.pt() <<
", isoType = " <<
Iso::toCString(isoTypes[i])
1490 <<
", ptcorr = " << corrvec[i] <<
", isol pt corrected = " <<
result.etcones[i] );
1501 const std::vector<Iso::IsolationType>& isoTypes,
1503 const std::string&
type,
1507 std::vector<float> corrvec;
1508 corrvec.resize(isoTypes.size(),0.);
1512 if (
type ==
"PFlow") {
1514 }
else if (fwdClus !=
nullptr) {
1515 ATH_MSG_DEBUG(
"No pileup correction for forward electron isolation yet");
1530 ATH_MSG_WARNING(
"Cannot retrieve density " << esKey->
key() <<
" for isolation correction. No ED correction");
1536 std::map<xAOD::Iso::IsolationCorrectionParameter,float> ecore;
1546 if (iter != ecore.end())
1549 for (
unsigned int i = 0; i < isoTypes.size(); i++) {
1551 float toSub = rho*(dR*dR*
M_PI - areacore);
1554 double areaCorr = 0;
1557 areaCorr = puZeta->second->Eval(std::abs(
eta));
1564 areaCorr -= puZetaMC->second->Eval(std::abs(
eta));
1566 ATH_MSG_WARNING(
"Requested refined eta dependent pileup correction for mc but no zeta correction provided " <<
Iso::toCString(isoTypes.at(i)));
1573 result.etcones[i] -= toSub;
1575 ATH_MSG_DEBUG(
"ED correction ("<<
type <<
")for size " << dR <<
" = " << toSub <<
" (areacore=" << areacore <<
")");
1584 unsigned int typesize) {
1586 result.corrlist = corrlist;
1587 result.coreCorrections.clear();
1588 result.noncoreCorrections.clear();
1589 result.etcones.resize(typesize,0.);
1596 const Muon*
muon =
dynamic_cast<const Muon*
>(&particle);
1601 if(
muon->primaryTrackParticleLink().isValid() &&
muon->author()!=2) tp = *
muon->primaryTrackParticleLink();
1602 if( !tp) tp = *
muon->inDetTrackParticleLink();
1614 bool CaloIsolationTool::particlesInCone(
float eta,
float phi,
float dr, std::vector<const CaloCluster*>& output )
const {
1617 std::string m_caloClusterLocation =
"CaloCalTopoClusters";
1618 if(
evtStore()->retrieve(caloClusters, m_caloClusterLocation).isFailure()) {
1619 ATH_MSG_FATAL(
"Unable to retrieve " << m_caloClusterLocation );
1623 const float m_minPt = 1
e-3;
1626 for(
auto trk: *caloClusters){
1627 if(trk->pt()<m_minPt)
continue;
1629 float dEta =
eta-trk->eta();
1631 if(dr2<(dEta*dEta+dPhi*dPhi))
continue;
1632 output.push_back(trk);
1637 bool CaloIsolationTool::particlesInCone(
float eta,
float phi,
float dr, std::vector<const FlowElement*>& output )
const{
1640 std::string m_ClusterLocation =
"JetETMissNeutralParticleFlowObjects";
1646 const float m_minPt = 1
e-3;
1649 for(
auto trk: *Clusters){
1650 if(trk->pt()<m_minPt)
continue;
1653 if(dr2<(dEta*dEta+dPhi*dPhi))
continue;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Helper class to provide constant type-safe access to aux data.
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
ServiceHandle< StoreGateSvc > & evtStore()
Container class for CaloCell.
void select(double eta, double phi, double deta, double dphi)
CaloCell_Base_ID::SUBCALO SUBCALO
const CaloCellContainer * getCellContainer() const
Method to access underlying cell container.
static std::unique_ptr< xAOD::CaloCluster > makeCluster(const CaloCellContainer *cellCont)
Creates a valid CaloCluster with a private Aux-Store and CellLink container.
This class provides the client interface for accessing the detector description information common to...
SG::ConstAccessor< T, ALLOC > ConstAccessor
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
const_reference_type withDefault(const ELT &e, const T &deflt) const
Fetch the variable for one element, as a const reference, with a default.
Property holding a SG store/key/clid from which a ReadHandle is made.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const std::string & key() const
Return the StoreGate ID for the referenced object.
Tracking class to hold the extrapolation through calorimeter Layers Both the caloEntryLayerIntersecti...
const std::vector< CurvilinearParameters > & caloLayerIntersections() const
access to the intersections with the calorimeter layers.
ClusterSize clusterSize() const
Get cluster size.
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
const_iterator end() const
virtual double pt() const
The transverse momentum ( ) of the particle (negative for negative-energy clusters)
const_iterator begin() const
virtual double eta() const
The pseudorapidity ( ) of the particle.
size_t size() const
size method (forwarded from CaloClusterCellLink obj)
CaloClusterCellLink::const_iterator const_cell_iterator
Iterator of the underlying CaloClusterCellLink (explicitly const version)
float energyBE(const unsigned layer) const
Get the energy in one layer of the EM Calo.
flt_t eta0() const
Returns raw of cluster seed.
virtual FourMom_t p4() const
The full 4-momentum of the particle.
flt_t phi0() const
Returns raw of cluster seed.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
const xAOD::CaloCluster * caloCluster(size_t index=0) const
Pointer to the xAOD::CaloCluster/s that define the electron candidate.
virtual double pt() const override
virtual double phi() const override
The azimuthal angle ( ) of the particle.
virtual double eta() const override
The pseudorapidity ( ) of the particle.
Class providing the definition of the 4-vector interface.
Eigen::Matrix< double, 3, 1 > Vector3D
std::vector< float > getEnergiesPerSampling(const xAOD::FlowElement &fe)
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
bool dPhi(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
bool dEta(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
retrieve(aClass, aKey=None)
std::vector< const xAOD::CaloCluster * > getAssociatedTopoClusters(const xAOD::CaloCluster *cluster)
Return a vector of all the topo clusters associated with the egamma cluster.
std::vector< const xAOD::FlowElement * > getAssociatedFlowElements(const xAOD::Egamma *eg, bool neutral=true, bool charged=false)
Return a vector of the flow elements associated with the egamma cluster (only neutral for default)
const uint16_t AuthorFwdElectron
Electron reconstructed by the Forward cluster-based algorithm.
IsolationFlavour isolationFlavour(IsolationType type)
convert Isolation Type into Isolation Flavour
@ topoetcone20
Topo-cluster ET-sum.
IsolationFlavour
Enumeration for different ways of calculating isolation in xAOD files.
@ topoetcone
Topo-cluster ET-sum.
@ etcone
Calorimeter isolation.
static const char * toCString(IsolationConeSize conesize)
@ coreArea
area used to calculate this correction
@ coreEnergy
energy stored for this correction
@ ptCorrection
egamma ptcorrection
@ pileupCorrection
fully corrected
@ coreConeSC
core energy (super cluster).
@ coreCone
core energy (in dR<0.1).
@ core57cells
core 5x7 cells
float coneSize(IsolationConeSize type)
convert Isolation Size into cone size
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
FlowElementContainer_v1 FlowElementContainer
Definition of the current "pfo container version".
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
FlowElement_v1 FlowElement
Definition of the current "pfo version".
TrackParticle_v1 TrackParticle
Reference the current persistent version:
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.