|
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;
143 IsoHelperMap::const_iterator Itr = m_isohelpers.find(
type);
145 ATH_MSG_WARNING(
"Failed to properly access the vanilla isolation variable "
169 if (!
isLRT.isAvailable(*prim) || !
isLRT(*prim) ) {
171 cache.
tracks.insert(tracks.begin(), tracks.end());
188 if (!readHandle.isValid())
return;
189 std::set<const xAOD::IParticle*> tombola{};
196 for (
size_t ch = 0;
ch <
flow->nChargedObjects(); ++
ch) {
198 if (tombola.count(
obj)) {
199 const std::vector<float>&
weights =
flow->chargedObjectWeights();
203 for (
size_t ne = 0; ne <
flow->nOtherObjects(); ++ne) {
205 if (tombola.count(
obj)) {
206 const std::vector<float>&
weights =
flow->otherObjectWeights();
208 ATH_MSG_VERBOSE(
"getAssocFlowElements: neflow " << ne <<
", " <<
obj->type() <<
", " <<
obj->pt() <<
", " <<
obj->eta() <<
", " <<
obj->phi() <<
", " <<
flow->pt() <<
", " <<
flow->eta() <<
", " <<
flow->phi());
214 #ifndef XAOD_ANALYSIS
220 std::unique_ptr<Trk::CaloExtension> caloExtension;
228 if(!intersections.empty()){
230 for (
unsigned int i = 0;
i < intersections.size(); ++
i){
234 avePoint = (1./intersections.size())*avePoint;
235 eta = avePoint.eta();
236 phi = avePoint.phi();
248 const EventContext& ctx,
253 ATH_MSG_ERROR(
"The IsolationCloseByCorrectionTool was not initialised!!!");
321 float iso_variable{0.f};
338 ATH_MSG_DEBUG(
"subtractCloseByContribution: Set pt, eta, phi " <<
par->pt() <<
", " <<
par->eta() <<
", " <<
par->phi() <<
" for " <<
toString(iso_type) <<
" to " << iso_variable);
357 float iso_variable{0.f};
362 ATH_MSG_DEBUG(
"copyIsoValuesForPartsNotSelected: Set pt, eta " <<
part->pt() <<
", " <<
part->eta() <<
", " <<
part->phi() <<
" for " <<
toString(iso_type) <<
" to " << iso_variable);
373 const std::vector<IsolationType>& types,
376 ATH_MSG_ERROR(
"The IsolationCloseByCorrectionTool was not initialised!!!");
381 std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
383 IsoHelperMap::const_iterator Itr = m_isohelpers.find(
t);
384 if (Itr != m_isohelpers.end()) {
continue; }
388 corrections.assign(types.size(), 0);
391 const EventContext& ctx = Gaudi::Hive::currentContext();
395 IsoHelperMap::const_iterator Itr = m_isohelpers.find(iso_type);
431 if (
mu->muonType() != xAOD::Muon::SiliconAssociatedForwardMuon)
432 to_return.emplace(
mu->trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle));
435 to_return.emplace(trk);
441 << trk->pt() *
MeVtoGeV <<
" GeV, eta: " << trk->eta() <<
", phi: " << trk->phi());
442 to_return.emplace(trk);
450 for (
const TrackPtr trk : assoc_tracks) {
469 static const CharDecorator acc_isAssociatedToEG{
"isAssociatedToEG"};
473 for (
size_t calo = 0; calo < egamm->
nCaloClusters(); ++calo) {
475 if (!clust)
continue;
478 if (cluster && std::abs(cluster->eta()) < 7. && cluster->e() >
MinClusterEnergy) {
480 acc_isAssociatedToEG(*cluster) =
true;
481 ATH_MSG_VERBOSE(
"getAssociatedClusters: " <<
P->type() <<
" has topo cluster with pt: " << cluster->pt() *
MeVtoGeV <<
" GeV, eta: "
482 << cluster->eta() <<
", phi: " << cluster->phi()
483 <<
", isAssociatedToEG: " << (
int)acc_isAssociatedToEG(*cluster));
491 if (!topoClusters.isValid())
return clusters;
496 bool foundMuonTopo =
false;
499 <<
cl->eta() <<
", phi: " <<
cl->phi());
502 if (cluster && std::abs(cluster->eta()) < 7. && cluster->e() >
MinClusterEnergy) {
504 if (!acc_isAssociatedToEG.isAvailable(*cluster) || !acc_isAssociatedToEG(*cluster)) {
506 foundMuonTopo =
true;
507 ATH_MSG_VERBOSE(
"getAssociatedClusters: muon has topo cluster with pt: " << cluster->pt() *
MeVtoGeV <<
" GeV, eta: "
508 << cluster->eta() <<
", phi: " << cluster->phi());
511 ATH_MSG_VERBOSE(
"getAssociatedClusters: muon topo cluster already associated with an EG objet - cluster with pt: "
512 << cluster->pt() *
MeVtoGeV <<
" GeV, eta: " << cluster->eta() <<
", phi: " << cluster->phi());
517 if (!foundMuonTopo) {
518 #ifndef XAOD_ANALYSIS
522 ATH_MSG_VERBOSE(
"getAssociatedClusters: found mu tp " <<
" with pt: " <<
tp->pt() *
MeVtoGeV <<
" GeV, eta: " <<
tp->eta() <<
", phi: " <<
tp->phi());
526 ATH_MSG_VERBOSE(
"getAssociatedClusters: tp extrapolated - tpEtaAtCalo " << tpEtaAtCalo <<
", tpPhiAtCalo " << tpPhiAtCalo);
528 if (cluster && std::abs(cluster->eta()) < 7. && cluster->e() >
MinClusterEnergy &&
531 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);
543 if (!
P)
return false;
554 IsoHelperMap::const_iterator Itr = m_isohelpers.find(
type);
558 }
else if (cache.
tracks.empty())
566 <<
", phi: " <<
par->phi() <<
" before correction: " << isoValue *
MeVtoGeV <<
" GeV. "
567 << ToExclude.size() <<
" tracks will be excluded.");
575 if (
overlap(Ref, poluting_trk, MaxDR) && !ToExclude.count(poluting_trk)) {
577 << poluting_trk->pt() *
MeVtoGeV <<
" GeV, eta: " << poluting_trk->eta() <<
", phi: " << poluting_trk->phi()
578 <<
" with dR: " << std::sqrt(
deltaR2(Ref, poluting_trk)) <<
" from the isolation cone " <<
toString(
type)
579 <<
" " << (isoValue *
MeVtoGeV) <<
" GeV.");
580 isoValue -= poluting_trk->pt();
585 <<
", phi: " <<
par->phi() <<
" after correction: " << isoValue *
MeVtoGeV <<
" GeV");
590 float& isoValue)
const {
596 ATH_MSG_ERROR(
"getCloseByCorrectionPflowIso() -- Could not retrieve the isolation variable.");
600 if (isoValue <= 0.) {
601 ATH_MSG_DEBUG(
"Pflow varible is already sufficiently isolated ");
605 float ref_eta{0.f}, ref_phi{0.f};
607 if (
m_caloModel == TopoConeCorrectionModel::SubtractObjectsDirectly) {
611 <<
", phi: " <<
primary->phi() <<
" before correction: " << isoValue *
MeVtoGeV <<
" GeV. ");
621 if (assoc_coll.count(
flow)) {
622 ATH_MSG_VERBOSE(
"Flow element is directly associated with the object");
627 <<
" phi: " <<
flow->phi() <<
" dR: " << dR);
628 isoValue -=
flow->pt() *
flow.weight;
633 <<
", phi: " <<
primary->phi() <<
" after correction: " << isoValue *
MeVtoGeV <<
" GeV. ");
634 }
else if (
m_caloModel == TopoConeCorrectionModel::UseAveragedDecorators) {
640 if (others ==
primary)
continue;
641 if (!acc_isDecor.isAvailable(*others) || !acc_isDecor(*others)) {
642 ATH_MSG_ERROR(
"The variable energy averaged pflow decorations are not available for "<<
particleName(others)<<
". Please check");
645 const float other_eta = acc_eta(*others);
646 const float other_phi = acc_phi(*others);
648 if (dR > coneDR)
continue;
650 isoValue -= acc_ene(*others);
662 float& isoValue)
const {
673 if (isoValue <= 0.) {
674 ATH_MSG_DEBUG(
"Topo et cone variable is already sufficiently isolated");
677 float ref_eta{0.f}, ref_phi{0.f};
682 if (
m_caloModel == TopoConeCorrectionModel::SubtractObjectsDirectly) {
685 <<
", phi: " <<
primary->phi() <<
" before correction: " << isoValue *
MeVtoGeV <<
" GeV. ");
689 ATH_MSG_VERBOSE(
"getCloseByCorrectionTopoIso: Loop over cluster: " << calo->pt() *
MeVtoGeV <<
" GeV, eta: " << calo->eta() <<
" phi: " << calo->phi() <<
" dR: " << dR);
690 if (dR > MaxDR)
continue;
692 if (assoc.count(calo)) {
693 ATH_MSG_VERBOSE(
"getCloseByCorrectionTopoIso: skip due to assoc " << assoc.count(calo));
702 <<
" phi: " << calo->phi() <<
" dR: " << dR);
707 <<
", phi: " <<
primary->phi() <<
" after correction: " << isoValue *
MeVtoGeV <<
" GeV. ");
708 }
else if (
m_caloModel == TopoConeCorrectionModel::UseAveragedDecorators) {
714 if (others ==
primary)
continue;
715 if (!acc_isDecor.isAvailable(*others) || !acc_isDecor(*others)) {
719 const float other_eta = acc_eta(*others);
720 const float other_phi = acc_phi(*others);
722 if (dR > MaxDR)
continue;
724 isoValue -= acc_ene(*others);
744 }
else if (acc_isDecor.isAvailable(*
par) && acc_isDecor(*
par)) {
745 eta = acc_assocEta(*
par);
748 float assoc_ene{0.f};
753 dec_assocEta(*
par) = eta;
755 dec_isDecor(*
par) =
true;
759 float& phi,
float&
energy)
const {
762 if (flowCollection.empty()) {
768 const float flow_energy = ele->e() * ele.weight;
770 phi += ele->phi() * flow_energy;
771 eta += ele->eta() * flow_energy;
789 if (!cluster)
return;
793 float etaT{0.f}, phiT{0.f}, dphiT{0.f};
807 if (!nSample)
return;
808 ATH_MSG_DEBUG(
"Eta, phi before sampling: " << eta <<
", " <<
phi <<
" and after sampling: " << etaT / nSample <<
", "
811 eta = etaT / nSample;
813 <<
mu->eta() <<
", phi: " <<
mu->phi() <<
" energy, eta, phi " <<
energy <<
", " << eta <<
", " <<
phi
827 if (!cluster)
continue;
831 eta += cluster->eta() * clus_e;
832 phi += cluster->phi() * clus_e;
835 << cluster->eta() <<
", phi: " << cluster->phi());
842 << egamm->
eta() <<
", phi: " << egamm->
phi() <<
" energy, eta, phi " <<
energy <<
", " << eta <<
", " <<
phi );
844 ATH_MSG_DEBUG(
"Average energy from the clusters is too low " <<
energy <<
" copy particle properties");
855 if (iso_types.empty()) {
858 ATH_MSG_WARNING(
"Could not cast particle for acceptCorrected. Will return false.");
861 info.addCut(
"castCut",
"whether we managed to cast to a known type");
872 strPar.
eta =
x.eta();
873 strPar.
type =
x.type();
874 std::vector<float> corrections;
876 ATH_MSG_WARNING(
"Could not calculate the corrections. acceptCorrected(x) is done without the corrections.");
880 for (
unsigned int i = 0;
i < iso_types.size(); ++
i) {
883 float old = (*acc)(
x);
892 if (!Verticies.isValid() || !Verticies->size()) {
908 if (MiniIso < ConeDR)
return MiniIso;
933 const xAOD::TrackParticle* idTrk =
muon->trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle);
934 return idTrk ? idTrk :
muon->primaryTrackParticle();
949 if (AvgCalo || (
P->type() != P1->
type() &&
951 float phi1{0.f},
eta1{0.f},
eta2{0.f}, phi2{0.f};
964 IsoHelperMap::const_iterator itr = m_isohelpers.find(isoVariable);
967 ATH_MSG_ERROR(
"Failed to retrive the original isolation cone ");
979 Et = cluster->
p4(xAOD::CaloCluster::State::UNCALIBRATED).Et();
981 std::cosh(cluster->
p4(xAOD::CaloCluster::State::UNCALIBRATED).Eta());
982 }
catch (...) { Et = cluster->
p4().Et(); }
1007 return ttvaFlavours.count(flavour);
1015 return ttvaFlavours.count(flavour);
1029 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.
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
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.
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.
float etaSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
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.
float phiSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
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.
virtual FourMom_t p4() const
The full 4-momentum of the particle.
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.
float eSample(const CaloSample sampling) const
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 hasSampling(const CaloSample s) const
Checks if certain smapling contributes to cluster.
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
virtual double e() const
The total energy of the particle.
@ 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