Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
25 return {
"IsoCloseByCorr_assocClustEta",
"IsoCloseByCorr_assocClustPhi",
"IsoCloseByCorr_assocClustEnergy",
26 "IsoCloseByCorr_assocClustDecor"};
29 return {
"IsoCloseByCorr_assocPflowEta",
"IsoCloseByCorr_assocPflowPhi",
"IsoCloseByCorr_assocPflowEnergy",
30 "IsoCloseByCorr_assocPflowDecor"};
60 ATH_MSG_WARNING(
"The ParticleCaloExtensionTool was not configured. Pleease include it!!!");
71 ATH_MSG_INFO(
"No TrackSelectionTool provided, so I will create and configure my own, called: " <<
config.name());
85 ATH_CHECK(
config.setProperty(
"WorkingPoint",
"Nonprompt_All_MaxWeight"));
95 return StatusCode::SUCCESS;
99 for (
const std::unique_ptr<IsolationWP>&
W :
WPs) {
100 for (
const std::unique_ptr<IsolationCondition>& C :
W->conditions()) {
101 for (
unsigned int t = 0;
t < C->num_types(); ++
t) {
102 const IsoType iso_type = C->type(
t);
103 if (
std::find(types.begin(), types.end(), iso_type) == types.end()) types.emplace_back(iso_type);
104 if (m_isohelpers.find(iso_type) == m_isohelpers.end()) {
111 [](
const IsolationType&
t) { return isTrackIso(t) && !isTrackIsoTTVA(t); }) != types.end();
113 [](
const IsolationType&
t) { return isPFlowIso(t); }) != types.end();
115 [](
const IsolationType&
t) { return isTopoEtIso(t); }) != types.end();
117 #ifndef XAOD_ANALYSIS
120 for (
const IsoType iso : types) {
137 if (!container)
return;
141 if (iso_types.empty()) {
ATH_MSG_DEBUG(
"No isolation types have been defined for particle type " <<
particleName(particle)); }
143 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
144 IsoHelperMap::const_iterator Itr = m_isohelpers.find(
type);
146 ATH_MSG_WARNING(
"Failed to properly access the vanilla isolation variable "
148 << particle->pt() *
MeVtoGeV <<
" GeV, eta: " << particle->eta() <<
", phi: " << particle->phi());
170 if (!
isLRT.isAvailable(*prim) || !
isLRT(*prim) ) {
172 cache.
tracks.insert(tracks.begin(), tracks.end());
189 if (!readHandle.isValid())
return;
190 std::set<const xAOD::IParticle*> tombola{};
197 for (
size_t ch = 0;
ch <
flow->nChargedObjects(); ++
ch) {
199 if (tombola.count(
obj)) {
200 const std::vector<float>&
weights =
flow->chargedObjectWeights();
204 for (
size_t ne = 0; ne <
flow->nOtherObjects(); ++ne) {
206 if (tombola.count(
obj)) {
207 const std::vector<float>&
weights =
flow->otherObjectWeights();
209 ATH_MSG_VERBOSE(
"getAssocFlowElements: neflow " << ne <<
", " <<
obj->type() <<
", " <<
obj->pt() <<
", " <<
obj->eta() <<
", " <<
obj->phi() <<
", " <<
flow->pt() <<
", " <<
flow->eta() <<
", " <<
flow->phi());
215 #ifndef XAOD_ANALYSIS
221 std::unique_ptr<Trk::CaloExtension> caloExtension;
229 if(!intersections.empty()){
231 for (
unsigned int i = 0;
i < intersections.size(); ++
i){
235 avePoint = (1./intersections.size())*avePoint;
236 eta = avePoint.eta();
237 phi = avePoint.phi();
249 const EventContext& ctx,
254 ATH_MSG_ERROR(
"The IsolationCloseByCorrectionTool was not initialised!!!");
275 <<
" eta: " << particle->eta()
276 <<
" phi: " << particle->phi());
279 ATH_MSG_ERROR(
"Failed to correct the isolation of particle with pt: " << particle->pt() *
MeVtoGeV <<
" GeV"
280 <<
" eta: " << particle->eta()
281 <<
" phi: " << particle->phi());
286 <<
" eta: " << particle->eta()
287 <<
" phi: " << particle->phi());
295 <<
" eta: " << particle->eta()
296 <<
" phi: " << particle->phi());
298 ATH_MSG_ERROR(
"Failed to copy the isolation of particle with pt: " << particle->pt() *
MeVtoGeV <<
" GeV"
299 <<
" eta: " << particle->eta()
300 <<
" phi: " << particle->phi());
308 <<
" eta: " << particle->eta()
309 <<
" phi: " << particle->phi());
311 ATH_MSG_ERROR(
"Failed to copy the isolation of particle with pt: " << particle->pt() *
MeVtoGeV <<
" GeV"
312 <<
" eta: " << particle->eta()
313 <<
" phi: " << particle->phi());
321 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
322 for (
const auto&
p : m_isohelpers) {
325 p.second->lockDecorations(*
part->container());
329 p.second->lockDecorations(*
parts);
335 if (!particle)
return dummy;
354 float iso_variable{0.f};
371 ATH_MSG_DEBUG(
"subtractCloseByContribution: Set pt, eta, phi " <<
par->pt() <<
", " <<
par->eta() <<
", " <<
par->phi() <<
" for " <<
toString(iso_type) <<
" to " << iso_variable);
372 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
391 float iso_variable{0.f};
392 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
397 ATH_MSG_DEBUG(
"copyIsoValuesForPartsNotSelected: Set pt, eta " <<
part->pt() <<
", " <<
part->eta() <<
", " <<
part->phi() <<
" for " <<
toString(iso_type) <<
" to " << iso_variable);
408 const std::vector<IsolationType>& types,
412 ATH_MSG_ERROR(
"The IsolationCloseByCorrectionTool was not initialised!!!");
417 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
419 IsoHelperMap::const_iterator Itr = m_isohelpers.find(
t);
420 if (Itr != m_isohelpers.end()) {
continue; }
424 corrections.assign(types.size(), 0);
427 const EventContext& ctx = Gaudi::Hive::currentContext();
431 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
432 IsoHelperMap::const_iterator Itr = m_isohelpers.find(iso_type);
468 if (
mu->muonType() != xAOD::Muon::SiliconAssociatedForwardMuon)
469 to_return.emplace(
mu->trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle));
472 to_return.emplace(trk);
478 << trk->pt() *
MeVtoGeV <<
" GeV, eta: " << trk->eta() <<
", phi: " << trk->phi());
479 to_return.emplace(trk);
487 for (
const TrackPtr trk : assoc_tracks) {
510 for (
size_t calo = 0; calo < egamm->
nCaloClusters(); ++calo) {
512 if (!clust)
continue;
515 if (cluster && std::abs(cluster->eta()) < 7. && cluster->e() >
MinClusterEnergy) {
518 ATH_MSG_VERBOSE(
"getAssociatedClusters: " <<
P->type() <<
" has topo cluster with pt: " << cluster->pt() *
MeVtoGeV <<
" GeV, eta: "
519 << cluster->eta() <<
", phi: " << cluster->phi());
527 if (!topoClusters.isValid())
return clusters;
532 bool foundMuonTopo =
false;
535 <<
cl->eta() <<
", phi: " <<
cl->phi());
538 if (cluster && std::abs(cluster->eta()) < 7. && cluster->e() >
MinClusterEnergy) {
542 foundMuonTopo =
true;
543 ATH_MSG_VERBOSE(
"getAssociatedClusters: muon has topo cluster with pt: " << cluster->pt() *
MeVtoGeV <<
" GeV, eta: "
544 << cluster->eta() <<
", phi: " << cluster->phi());
547 ATH_MSG_VERBOSE(
"getAssociatedClusters: muon topo cluster already associated with an EG objet - cluster with pt: "
548 << cluster->pt() *
MeVtoGeV <<
" GeV, eta: " << cluster->eta() <<
", phi: " << cluster->phi());
553 if (!foundMuonTopo) {
554 #ifndef XAOD_ANALYSIS
558 ATH_MSG_VERBOSE(
"getAssociatedClusters: found mu tp " <<
" with pt: " <<
tp->pt() *
MeVtoGeV <<
" GeV, eta: " <<
tp->eta() <<
", phi: " <<
tp->phi());
562 ATH_MSG_VERBOSE(
"getAssociatedClusters: tp extrapolated - tpEtaAtCalo " << tpEtaAtCalo <<
", tpPhiAtCalo " << tpPhiAtCalo);
564 if (cluster && std::abs(cluster->eta()) < 7. && cluster->e() >
MinClusterEnergy &&
567 ATH_MSG_VERBOSE(
"getAssociatedClusters: for mu trkPart save clus " <<
" with pt: " << cluster->pt() *
MeVtoGeV <<
" GeV, eta: " << cluster->eta() <<
", phi: " << cluster->phi() <<
", tpEtaAtCalo " << tpEtaAtCalo <<
", tpPhiAtCalo " << tpPhiAtCalo);
579 if (!
P)
return false;
590 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
591 IsoHelperMap::const_iterator Itr = m_isohelpers.find(
type);
595 }
else if (cache.
tracks.empty())
603 <<
", phi: " <<
par->phi() <<
" before correction: " << isoValue *
MeVtoGeV <<
" GeV. "
604 << ToExclude.size() <<
" tracks will be excluded.");
612 if (
overlap(Ref, poluting_trk, MaxDR) && !ToExclude.count(poluting_trk)) {
614 << poluting_trk->pt() *
MeVtoGeV <<
" GeV, eta: " << poluting_trk->eta() <<
", phi: " << poluting_trk->phi()
615 <<
" with dR: " << std::sqrt(
deltaR2(Ref, poluting_trk)) <<
" from the isolation cone " <<
toString(
type)
616 <<
" " << (isoValue *
MeVtoGeV) <<
" GeV.");
617 isoValue -= poluting_trk->pt();
622 <<
", phi: " <<
par->phi() <<
" after correction: " << isoValue *
MeVtoGeV <<
" GeV");
627 float& isoValue)
const {
633 ATH_MSG_ERROR(
"getCloseByCorrectionPflowIso() -- Could not retrieve the isolation variable.");
637 if (isoValue <= 0.) {
638 ATH_MSG_DEBUG(
"Pflow varible is already sufficiently isolated ");
642 float ref_eta{0.f}, ref_phi{0.f};
644 if (
m_caloModel == TopoConeCorrectionModel::SubtractObjectsDirectly) {
648 <<
", phi: " <<
primary->phi() <<
" before correction: " << isoValue *
MeVtoGeV <<
" GeV. ");
658 if (assoc_coll.count(
flow)) {
659 ATH_MSG_VERBOSE(
"Flow element is directly associated with the object");
664 <<
" phi: " <<
flow->phi() <<
" dR: " << dR);
665 isoValue -=
flow->pt() *
flow.weight;
670 <<
", phi: " <<
primary->phi() <<
" after correction: " << isoValue *
MeVtoGeV <<
" GeV. ");
671 }
else if (
m_caloModel == TopoConeCorrectionModel::UseAveragedDecorators) {
677 if (others ==
primary)
continue;
678 if (!acc_isDecor.isAvailable(*others) || !acc_isDecor(*others)) {
679 ATH_MSG_ERROR(
"The variable energy averaged pflow decorations are not available for "<<
particleName(others)<<
". Please check");
682 const float other_eta = acc_eta(*others);
683 const float other_phi = acc_phi(*others);
685 if (dR > coneDR)
continue;
687 isoValue -= acc_ene(*others);
699 float& isoValue)
const {
705 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
711 if (isoValue <= 0.) {
712 ATH_MSG_DEBUG(
"Topo et cone variable is already sufficiently isolated");
715 float ref_eta{0.f}, ref_phi{0.f};
720 if (
m_caloModel == TopoConeCorrectionModel::SubtractObjectsDirectly) {
723 <<
", phi: " <<
primary->phi() <<
" before correction: " << isoValue *
MeVtoGeV <<
" GeV. ");
727 ATH_MSG_VERBOSE(
"getCloseByCorrectionTopoIso: Loop over cluster: " << calo->pt() *
MeVtoGeV <<
" GeV, eta: " << calo->eta() <<
" phi: " << calo->phi() <<
" dR: " << dR);
728 if (dR > MaxDR)
continue;
730 if (assoc.count(calo)) {
731 ATH_MSG_VERBOSE(
"getCloseByCorrectionTopoIso: skip due to assoc " << assoc.count(calo));
740 <<
" phi: " << calo->phi() <<
" dR: " << dR);
745 <<
", phi: " <<
primary->phi() <<
" after correction: " << isoValue *
MeVtoGeV <<
" GeV. ");
746 }
else if (
m_caloModel == TopoConeCorrectionModel::UseAveragedDecorators) {
752 if (others ==
primary)
continue;
753 if (!acc_isDecor.isAvailable(*others) || !acc_isDecor(*others)) {
757 const float other_eta = acc_eta(*others);
758 const float other_phi = acc_phi(*others);
760 if (dR > MaxDR)
continue;
762 isoValue -= acc_ene(*others);
782 }
else if (acc_isDecor.isAvailable(*
par) && acc_isDecor(*
par)) {
783 eta = acc_assocEta(*
par);
786 float assoc_ene{0.f};
791 dec_assocEta(*
par) = eta;
793 dec_isDecor(*
par) =
true;
797 float& phi,
float&
energy)
const {
800 if (flowCollection.empty()) {
801 phi = particle->phi();
802 eta = particle->eta();
806 const float flow_energy = ele->e() * ele.weight;
808 phi += ele->phi() * flow_energy;
809 eta += ele->eta() * flow_energy;
813 phi = particle->phi();
814 eta = particle->eta();
821 phi = particle->phi();
822 eta = particle->eta();
827 if (!cluster)
return;
831 float etaT{0.f}, phiT{0.f}, dphiT{0.f};
835 if (cluster->hasSampling(
s)) {
836 ATH_MSG_VERBOSE(
"Sampling: " <<
i <<
"eta-phi (" << cluster->etaSample(
s) <<
", " << cluster->phiSample(
s) <<
")");
837 etaT += cluster->etaSample(
s);
839 phiT = cluster->phiSample(
s);
845 if (!nSample)
return;
846 ATH_MSG_DEBUG(
"Eta, phi before sampling: " << eta <<
", " <<
phi <<
" and after sampling: " << etaT / nSample <<
", "
849 eta = etaT / nSample;
851 <<
mu->eta() <<
", phi: " <<
mu->phi() <<
" energy, eta, phi " <<
energy <<
", " << eta <<
", " <<
phi
865 if (!cluster)
continue;
869 eta += cluster->eta() * clus_e;
870 phi += cluster->phi() * clus_e;
873 << cluster->eta() <<
", phi: " << cluster->phi());
880 << egamm->
eta() <<
", phi: " << egamm->
phi() <<
" energy, eta, phi " <<
energy <<
", " << eta <<
", " <<
phi );
882 ATH_MSG_DEBUG(
"Average energy from the clusters is too low " <<
energy <<
" copy particle properties");
893 if (iso_types.empty()) {
896 ATH_MSG_WARNING(
"Could not cast particle for acceptCorrected. Will return false.");
899 info.addCut(
"castCut",
"whether we managed to cast to a known type");
910 strPar.
eta =
x.eta();
911 strPar.
type =
x.type();
912 std::vector<float> corrections;
914 ATH_MSG_WARNING(
"Could not calculate the corrections. acceptCorrected(x) is done without the corrections.");
918 for (
unsigned int i = 0;
i < iso_types.size(); ++
i) {
921 float old = (*acc)(
x);
930 if (!Verticies.isValid() || !Verticies->size()) {
950 if (MiniIso < ConeDR)
return MiniIso;
975 const xAOD::TrackParticle* idTrk =
muon->trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle);
976 return idTrk ? idTrk :
muon->primaryTrackParticle();
991 if (AvgCalo || (
P->type() != P1->
type() &&
993 float phi1{0.f},
eta1{0.f},
eta2{0.f}, phi2{0.f};
1006 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
1007 IsoHelperMap::const_iterator itr = m_isohelpers.find(isoVariable);
1009 if (itr == m_isohelpers.end() || itr->second->getOriginalIsolation(particle, isovalue) ==
CorrectionCode::Error) {
1010 ATH_MSG_ERROR(
"Failed to retrive the original isolation cone ");
1022 Et = cluster->p4(xAOD::CaloCluster::State::UNCALIBRATED).Et();
1024 std::cosh(cluster->p4(xAOD::CaloCluster::State::UNCALIBRATED).Eta());
1025 }
catch (...) { Et = cluster->p4().Et(); }
1050 return ttvaFlavours.count(flavour);
1058 return ttvaFlavours.count(flavour);
1072 if (Pt1000_Flavours.count(flavour))
return 1000;
JetConstituentVector::iterator iterator
virtual double phi() const
The azimuthal angle ( ) of the particle.
IsolationCloseByCorrectionTool::caloDecorNames caloDecorNames
@ topoetcone
Topo-cluster ET-sum.
Electron_v1 Electron
Definition of the current "egamma version".
std::vector< const xAOD::CaloCluster * > getAssociatedTopoClusters(const xAOD::CaloCluster *cluster)
Return a vector of all the topo clusters associated with the egamma cluster.
std::string find(const std::string &s)
return a remapped string
Helper class to provide type-safe access to aux data.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
IsolationFlavour
Enumeration for different ways of calculating isolation in xAOD files.
virtual double e() const override final
The total energy of the particle.
StatusCode accept(const xAOD::Muon *mu)
std::set< FlowElementPtr > PflowSet
std::set< TrackPtr > TrackSet
virtual Type::ObjectType type() const =0
The type of the object as a simple enumeration.
std::vector< float > isolationValues
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
setEt setPhi setE277 setWeta2 eta1
std::set< const xAOD::TrackParticle * > getTrackParticles(const xAOD::Egamma *eg, bool useBremAssoc=true, bool allParticles=true)
Return a list of all or only the best TrackParticle associated to the object.
Small helper struct to have sets of particle pointers sorted by pt.
Helper class to provide constant type-safe access to aux data.
@ neflowisol
neutral eflow
#define ATH_MSG_VERBOSE(x)
double deltaR2(double rapidity1, double phi1, double rapidity2, double phi2)
from bare rapidity,phi
bool empty() const
Test if the key is blank.
Class providing the definition of the 4-vector interface.
Select isolated Photons, Electrons and Muons.
size_t nCaloClusters() const
Return the number of xAOD::CaloClusters that define the electron candidate.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Namespace holding the IsolationType enumeration.
@ OutOfValidityRange
Input object is out of validity range.
@ Error
Some error happened during the object correction.
Description of a calorimeter cluster.
@ ptvarcone
mini isolation
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
@ ptvarcone_Nonprompt_All_MaxWeightTTVALooseCone_pt1000
Helper class to provide type-safe access to aux data.
int flow(const T &a, int i)
containers
Associate the close-by pflow objects and the calorimeter clusters.
virtual double eta() const
The pseudorapidity ( ) of the particle.
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi
::StatusCode StatusCode
StatusCode definition for legacy code.
IsolationType
Overall enumeration for isolation types in xAOD files.
bool dPhi(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
@ ptcone_Nonprompt_All_MaxWeightTTVALooseCone_pt500
ptcone for high mu
const xAOD::CaloCluster * caloCluster(size_t index=0) const
Pointer to the xAOD::CaloCluster/s that define the electron candidate.
@ ptcone_Nonprompt_All_MaxWeightTTVA_pt500
ptcone for high mu
@ ptvarcone_Nonprompt_All_MaxWeightTTVALooseCone_pt500
virtual double phi() const override final
The azimuthal angle ( ) of the particle.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
const SG::AuxElement::Accessor< float > * getIsolationAccessor(Iso::IsolationType type)
Get the Accessor object for a given isolation type.
IsolationFlavour isolationFlavour(IsolationType type)
convert Isolation Type into Isolation Flavour
@ ptvarcone_Nonprompt_All_MaxWeightTTVA_pt1000
For the flow elements we need a special derivate which also contains the weights.
Eigen::Matrix< double, 3, 1 > Vector3D
@ ptcone_Nonprompt_All_MaxWeightTTVALooseCone_pt1000
Photon_v1 Photon
Definition of the current "egamma version".
std::set< CaloClusterPtr > ClusterSet
struct TBPatternUnitContext Muon
@ Ok
The correction was done successfully.
Class describing a Vertex.
#define ATH_MSG_WARNING(x)
virtual double eta() const =0
The pseudorapidity ( ) of the particle.
Return value from object correction CP tools.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
constexpr float MinClusterEnergy
Class describing a TrackParticle.
const IParticle * getOriginalObject(const IParticle ©)
This function can be used to conveniently get a pointer back to the original object from which a copy...
const std::vector< CurvilinearParameters > & caloLayerIntersections() const
access to the intersections with the calorimeter layers.
bool dEta(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
setBGCode setTAP setLVL2ErrorBits bool
float coneSize(IsolationConeSize type)
convert Isolation Size into cone size
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
@ ptcone_Nonprompt_All_MaxWeightTTVA_pt1000
@ ptvarcone_Nonprompt_All_MaxWeightTTVA_pt500
ptvarcone for high mu
std::vector< IsoType > IsoVector
bool empty() const noexcept
Returns true if the collection is empty.
A detector object made of other lower level object(s)
xAOD::Type::ObjectType type