Loading [MathJax]/extensions/tex2jax.js
 |
ATLAS Offline Software
|
Go to the documentation of this file.
27 {
"IsoCloseByCorr_assocClustEta",
"IsoCloseByCorr_assocClustPhi",
"IsoCloseByCorr_assocClustEnergy",
28 "IsoCloseByCorr_assocClustDecor"};
33 {
"IsoCloseByCorr_assocPflowEta",
"IsoCloseByCorr_assocPflowPhi",
"IsoCloseByCorr_assocPflowEnergy",
34 "IsoCloseByCorr_assocPflowDecor"};
65 ATH_MSG_WARNING(
"The ParticleCaloExtensionTool was not configured. Pleease include it!!!");
76 ATH_MSG_INFO(
"No TrackSelectionTool provided, so I will create and configure my own, called: " <<
config.name());
90 ATH_CHECK(
config.setProperty(
"WorkingPoint",
"Nonprompt_All_MaxWeight"));
100 return StatusCode::SUCCESS;
104 for (
const std::unique_ptr<IsolationWP>&
W :
WPs) {
105 for (
const std::unique_ptr<IsolationCondition>& C :
W->conditions()) {
106 for (
unsigned int t = 0;
t < C->num_types(); ++
t) {
107 const IsoType iso_type = C->type(
t);
108 if (
std::find(types.begin(), types.end(), iso_type) == types.end()) types.emplace_back(iso_type);
109 if (m_isohelpers.find(iso_type) == m_isohelpers.end()) {
116 [](
const IsolationType&
t) { return isTrackIso(t) && !isTrackIsoTTVA(t); }) != types.end();
118 [](
const IsolationType&
t) { return isPFlowIso(t); }) != types.end();
120 [](
const IsolationType&
t) { return isTopoEtIso(t); }) != types.end();
122 #ifndef XAOD_ANALYSIS
125 for (
const IsoType iso : types) {
142 if (!container)
return;
146 if (iso_types.empty()) {
ATH_MSG_DEBUG(
"No isolation types have been defined for particle type " <<
particleName(particle)); }
148 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
149 IsoHelperMap::const_iterator Itr = m_isohelpers.find(
type);
151 ATH_MSG_WARNING(
"Failed to properly access the vanilla isolation variable "
153 << particle->pt() *
MeVtoGeV <<
" GeV, eta: " << particle->eta() <<
", phi: " << particle->phi());
175 if (!
isLRT.isAvailable(*prim) || !
isLRT(*prim) ) {
177 cache.
tracks.insert(tracks.begin(), tracks.end());
194 if (!readHandle.isValid())
return;
195 std::set<const xAOD::IParticle*> tombola{};
202 for (
size_t ch = 0;
ch <
flow->nChargedObjects(); ++
ch) {
204 if (tombola.count(
obj)) {
205 const std::vector<float>&
weights =
flow->chargedObjectWeights();
209 for (
size_t ne = 0; ne <
flow->nOtherObjects(); ++ne) {
211 if (tombola.count(
obj)) {
212 const std::vector<float>&
weights =
flow->otherObjectWeights();
214 ATH_MSG_VERBOSE(
"getAssocFlowElements: neflow " << ne <<
", " <<
obj->type() <<
", " <<
obj->pt() <<
", " <<
obj->eta() <<
", " <<
obj->phi() <<
", " <<
flow->pt() <<
", " <<
flow->eta() <<
", " <<
flow->phi());
220 #ifndef XAOD_ANALYSIS
226 std::unique_ptr<Trk::CaloExtension> caloExtension;
234 if(!intersections.empty()){
236 for (
unsigned int i = 0;
i < intersections.size(); ++
i){
240 avePoint = (1./intersections.size())*avePoint;
241 eta = avePoint.eta();
242 phi = avePoint.phi();
254 const EventContext& ctx,
259 ATH_MSG_ERROR(
"The IsolationCloseByCorrectionTool was not initialised!!!");
280 <<
" eta: " << particle->eta()
281 <<
" phi: " << particle->phi());
284 ATH_MSG_ERROR(
"Failed to correct the isolation of particle with pt: " << particle->pt() *
MeVtoGeV <<
" GeV"
285 <<
" eta: " << particle->eta()
286 <<
" phi: " << particle->phi());
291 <<
" eta: " << particle->eta()
292 <<
" phi: " << particle->phi());
300 <<
" eta: " << particle->eta()
301 <<
" phi: " << particle->phi());
303 ATH_MSG_ERROR(
"Failed to copy the isolation of particle with pt: " << particle->pt() *
MeVtoGeV <<
" GeV"
304 <<
" eta: " << particle->eta()
305 <<
" phi: " << particle->phi());
313 <<
" eta: " << particle->eta()
314 <<
" phi: " << particle->phi());
316 ATH_MSG_ERROR(
"Failed to copy the isolation of particle with pt: " << particle->pt() *
MeVtoGeV <<
" GeV"
317 <<
" eta: " << particle->eta()
318 <<
" phi: " << particle->phi());
331 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
337 if (conts.insert(
c).second) {
338 for (
const auto&
p : m_isohelpers) {
339 p.second->lockDecorations(*
part->container());
344 c_nc->lockDecoration (dec_assocPhi.auxid());
345 c_nc->lockDecoration (dec_isDecor.auxid());
351 for (
const auto&
p : m_isohelpers) {
352 p.second->lockDecorations(*
parts);
356 c_nc->lockDecoration (dec_assocEta.auxid());
357 c_nc->lockDecoration (dec_assocPhi.auxid());
358 c_nc->lockDecoration (dec_isDecor.auxid());
363 if (!particle)
return dummy;
382 float iso_variable{0.f};
399 ATH_MSG_DEBUG(
"subtractCloseByContribution: Set pt, eta, phi " <<
par->pt() <<
", " <<
par->eta() <<
", " <<
par->phi() <<
" for " <<
toString(iso_type) <<
" to " << iso_variable);
400 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
419 float iso_variable{0.f};
420 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
425 ATH_MSG_DEBUG(
"copyIsoValuesForPartsNotSelected: Set pt, eta " <<
part->pt() <<
", " <<
part->eta() <<
", " <<
part->phi() <<
" for " <<
toString(iso_type) <<
" to " << iso_variable);
436 const std::vector<IsolationType>& types,
440 ATH_MSG_ERROR(
"The IsolationCloseByCorrectionTool was not initialised!!!");
445 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
447 IsoHelperMap::const_iterator Itr = m_isohelpers.find(
t);
448 if (Itr != m_isohelpers.end()) {
continue; }
452 corrections.assign(types.size(), 0);
455 const EventContext& ctx = Gaudi::Hive::currentContext();
460 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
461 IsoHelperMap::const_iterator Itr = m_isohelpers.find(iso_type);
498 if (
mu->muonType() != xAOD::Muon::SiliconAssociatedForwardMuon)
499 to_return.emplace(
mu->trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle));
502 to_return.emplace(trk);
508 << trk->pt() *
MeVtoGeV <<
" GeV, eta: " << trk->eta() <<
", phi: " << trk->phi());
509 to_return.emplace(trk);
517 for (
const TrackPtr trk : assoc_tracks) {
540 for (
size_t calo = 0; calo < egamm->
nCaloClusters(); ++calo) {
542 if (!clust)
continue;
545 if (cluster && std::abs(cluster->eta()) < 7. && cluster->e() >
MinClusterEnergy) {
548 ATH_MSG_VERBOSE(
"getAssociatedClusters: " <<
P->type() <<
" has topo cluster with pt: " << cluster->pt() *
MeVtoGeV <<
" GeV, eta: "
549 << cluster->eta() <<
", phi: " << cluster->phi());
557 if (!topoClusters.isValid())
return clusters;
562 bool foundMuonTopo =
false;
565 <<
cl->eta() <<
", phi: " <<
cl->phi());
568 if (cluster && std::abs(cluster->eta()) < 7. && cluster->e() >
MinClusterEnergy) {
572 foundMuonTopo =
true;
573 ATH_MSG_VERBOSE(
"getAssociatedClusters: muon has topo cluster with pt: " << cluster->pt() *
MeVtoGeV <<
" GeV, eta: "
574 << cluster->eta() <<
", phi: " << cluster->phi());
577 ATH_MSG_VERBOSE(
"getAssociatedClusters: muon topo cluster already associated with an EG objet - cluster with pt: "
578 << cluster->pt() *
MeVtoGeV <<
" GeV, eta: " << cluster->eta() <<
", phi: " << cluster->phi());
583 if (!foundMuonTopo) {
584 #ifndef XAOD_ANALYSIS
588 ATH_MSG_VERBOSE(
"getAssociatedClusters: found mu tp " <<
" with pt: " <<
tp->pt() *
MeVtoGeV <<
" GeV, eta: " <<
tp->eta() <<
", phi: " <<
tp->phi());
592 ATH_MSG_VERBOSE(
"getAssociatedClusters: tp extrapolated - tpEtaAtCalo " << tpEtaAtCalo <<
", tpPhiAtCalo " << tpPhiAtCalo);
594 if (cluster && std::abs(cluster->eta()) < 7. && cluster->e() >
MinClusterEnergy &&
597 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);
609 if (!
P)
return false;
621 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
622 IsoHelperMap::const_iterator Itr = m_isohelpers.find(
type);
626 }
else if (cache.
tracks.empty())
635 <<
", phi: " <<
par->phi() <<
" before correction: " << isoValue *
MeVtoGeV <<
" GeV. "
636 << ToExclude.size() <<
" tracks will be excluded.");
644 if (
overlap(Ref, poluting_trk, MaxDR) && !ToExclude.count(poluting_trk)) {
646 << poluting_trk->pt() *
MeVtoGeV <<
" GeV, eta: " << poluting_trk->eta() <<
", phi: " << poluting_trk->phi()
647 <<
" with dR: " << std::sqrt(
deltaR2(Ref, poluting_trk)) <<
" from the isolation cone " <<
toString(
type)
648 <<
" " << (isoValue *
MeVtoGeV) <<
" GeV.");
649 isoValue -= poluting_trk->pt();
654 <<
", phi: " <<
par->phi() <<
" after correction: " << isoValue *
MeVtoGeV <<
" GeV");
659 float& isoValue)
const {
665 ATH_MSG_ERROR(
"getCloseByCorrectionPflowIso() -- Could not retrieve the isolation variable.");
669 if (isoValue <= 0.) {
670 ATH_MSG_DEBUG(
"Pflow varible is already sufficiently isolated ");
674 float ref_eta{0.f}, ref_phi{0.f};
676 if (
m_caloModel == TopoConeCorrectionModel::SubtractObjectsDirectly) {
680 <<
", phi: " <<
primary->phi() <<
" before correction: " << isoValue *
MeVtoGeV <<
" GeV. ");
690 if (assoc_coll.count(
flow)) {
691 ATH_MSG_VERBOSE(
"Flow element is directly associated with the object");
696 <<
" phi: " <<
flow->phi() <<
" dR: " << dR);
697 isoValue -=
flow->pt() *
flow.weight;
702 <<
", phi: " <<
primary->phi() <<
" after correction: " << isoValue *
MeVtoGeV <<
" GeV. ");
703 }
else if (
m_caloModel == TopoConeCorrectionModel::UseAveragedDecorators) {
709 if (others ==
primary)
continue;
710 if (!acc_isDecor.isAvailable(*others) || !acc_isDecor(*others)) {
711 ATH_MSG_ERROR(
"The variable energy averaged pflow decorations are not available for "<<
particleName(others)<<
". Please check");
714 const float other_eta = acc_eta(*others);
715 const float other_phi = acc_phi(*others);
717 if (dR > coneDR)
continue;
719 isoValue -= acc_ene(*others);
731 float& isoValue)
const {
738 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
745 if (isoValue <= 0.) {
746 ATH_MSG_DEBUG(
"Topo et cone variable is already sufficiently isolated");
749 float ref_eta{0.f}, ref_phi{0.f};
754 if (
m_caloModel == TopoConeCorrectionModel::SubtractObjectsDirectly) {
757 <<
", phi: " <<
primary->phi() <<
" before correction: " << isoValue *
MeVtoGeV <<
" GeV. ");
761 ATH_MSG_VERBOSE(
"getCloseByCorrectionTopoIso: Loop over cluster: " << calo->pt() *
MeVtoGeV <<
" GeV, eta: " << calo->eta() <<
" phi: " << calo->phi() <<
" dR: " << dR);
762 if (dR > MaxDR)
continue;
764 if (assoc.count(calo)) {
765 ATH_MSG_VERBOSE(
"getCloseByCorrectionTopoIso: skip due to assoc " << assoc.count(calo));
774 <<
" phi: " << calo->phi() <<
" dR: " << dR);
779 <<
", phi: " <<
primary->phi() <<
" after correction: " << isoValue *
MeVtoGeV <<
" GeV. ");
780 }
else if (
m_caloModel == TopoConeCorrectionModel::UseAveragedDecorators) {
786 if (others ==
primary)
continue;
787 if (!acc_isDecor.isAvailable(*others) || !acc_isDecor(*others)) {
791 const float other_eta = acc_eta(*others);
792 const float other_phi = acc_phi(*others);
794 if (dR > MaxDR)
continue;
796 isoValue -= acc_ene(*others);
816 }
else if (acc_isDecor.isAvailable(*
par) && acc_isDecor(*
par)) {
817 eta = acc_assocEta(*
par);
820 float assoc_ene{0.f};
825 dec_assocEta(*
par) = eta;
827 dec_isDecor(*
par) =
true;
831 float& phi,
float&
energy)
const {
834 if (flowCollection.empty()) {
835 phi = particle->phi();
836 eta = particle->eta();
840 const float flow_energy = ele->e() * ele.weight;
842 phi += ele->phi() * flow_energy;
843 eta += ele->eta() * flow_energy;
847 phi = particle->phi();
848 eta = particle->eta();
855 phi = particle->phi();
856 eta = particle->eta();
861 if (!cluster)
return;
865 float etaT{0.f}, phiT{0.f}, dphiT{0.f};
869 if (cluster->hasSampling(
s)) {
870 ATH_MSG_VERBOSE(
"Sampling: " <<
i <<
"eta-phi (" << cluster->etaSample(
s) <<
", " << cluster->phiSample(
s) <<
")");
871 etaT += cluster->etaSample(
s);
873 phiT = cluster->phiSample(
s);
879 if (!nSample)
return;
880 ATH_MSG_DEBUG(
"Eta, phi before sampling: " << eta <<
", " <<
phi <<
" and after sampling: " << etaT / nSample <<
", "
883 eta = etaT / nSample;
885 <<
mu->eta() <<
", phi: " <<
mu->phi() <<
" energy, eta, phi " <<
energy <<
", " << eta <<
", " <<
phi
899 if (!cluster)
continue;
903 eta += cluster->eta() * clus_e;
904 phi += cluster->phi() * clus_e;
907 << cluster->eta() <<
", phi: " << cluster->phi());
914 << egamm->
eta() <<
", phi: " << egamm->
phi() <<
" energy, eta, phi " <<
energy <<
", " << eta <<
", " <<
phi );
916 ATH_MSG_DEBUG(
"Average energy from the clusters is too low " <<
energy <<
" copy particle properties");
927 if (iso_types.empty()) {
930 ATH_MSG_WARNING(
"Could not cast particle for acceptCorrected. Will return false.");
933 info.addCut(
"castCut",
"whether we managed to cast to a known type");
944 strPar.
eta =
x.eta();
945 strPar.
type =
x.type();
946 std::vector<float> corrections;
948 ATH_MSG_WARNING(
"Could not calculate the corrections. acceptCorrected(x) is done without the corrections.");
952 for (
unsigned int i = 0;
i < iso_types.size(); ++
i) {
955 float old = (*acc)(
x);
964 if (!Verticies.isValid() || !Verticies->size()) {
984 if (MiniIso < ConeDR)
return MiniIso;
1009 const xAOD::TrackParticle* idTrk =
muon->trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle);
1010 return idTrk ? idTrk :
muon->primaryTrackParticle();
1025 if (AvgCalo || (
P->type() != P1->
type() &&
1027 float phi1{0.f},
eta1{0.f},
eta2{0.f}, phi2{0.f};
1040 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
1041 IsoHelperMap::const_iterator itr = m_isohelpers.find(isoVariable);
1043 if (itr == m_isohelpers.end() || itr->second->getOriginalIsolation(particle, isovalue) ==
CorrectionCode::Error) {
1044 ATH_MSG_ERROR(
"Failed to retrive the original isolation cone ");
1056 Et = cluster->p4(xAOD::CaloCluster::State::UNCALIBRATED).Et();
1058 std::cosh(cluster->p4(xAOD::CaloCluster::State::UNCALIBRATED).Eta());
1059 }
catch (...) { Et = cluster->p4().Et(); }
1084 return ttvaFlavours.count(flavour);
1092 return ttvaFlavours.count(flavour);
1106 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.
void lockDecoration(SG::auxid_t auxid)
Explicitly lock a decoration.
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.
std::unordered_set< const SG::AuxVectorData * > UnorderedContainerSet
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
Manage lookup of vectors of auxiliary data.
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)
Define macros for attributes used to control the static checker.
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