ATLAS Offline Software
IsolationCloseByCorrectionTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3  */
4 
12 #include <xAODBase/ObjectType.h>
17 
18 #include "xAODEgamma/Egamma.h"
20 
21 namespace CP {
22  using namespace xAOD::Iso;
25  return {"IsoCloseByCorr_assocClustEta", "IsoCloseByCorr_assocClustPhi", "IsoCloseByCorr_assocClustEnergy",
26  "IsoCloseByCorr_assocClustDecor"};
27  }
29  return {"IsoCloseByCorr_assocPflowEta", "IsoCloseByCorr_assocPflowPhi", "IsoCloseByCorr_assocPflowEnergy",
30  "IsoCloseByCorr_assocPflowDecor"};
31  }
32  constexpr float MinClusterEnergy = 100.;
33  constexpr float MeVtoGeV = 1.e-3;
34 
35  IsolationCloseByCorrectionTool::IsolationCloseByCorrectionTool(const std::string& toolName) : asg::AsgTool(toolName) {}
36 
39  ATH_CHECK(m_selectorTool.retrieve());
43 
47  if (!m_isoDecSuffix.empty()) ATH_MSG_INFO("IsoDecSuffix set to " << m_isoDecSuffix);
48  if (!m_quality_name.empty()) ATH_MSG_INFO("SelectionDecorator set to " << m_quality_name);
49 
50 
51 #ifndef XAOD_ANALYSIS
56  ATH_CHECK(m_isoVarKeys.initialize());
57  ATH_CHECK(m_isoWriteDecVarKeys.initialize());
58  if (!m_caloExtTool.empty()) ATH_CHECK(m_caloExtTool.retrieve());
59  else {
60  ATH_MSG_WARNING("The ParticleCaloExtensionTool was not configured. Pleease include it!!!");
61  }
62 #endif
63 
64  ATH_CHECK(m_VtxKey.initialize());
65  ATH_CHECK(m_CaloClusterKey.initialize(m_caloModel == TopoConeCorrectionModel::SubtractObjectsDirectly));
66  ATH_CHECK(m_PflowKey.initialize(m_caloModel == TopoConeCorrectionModel::SubtractObjectsDirectly));
67 
68  // set default properties of track selection tool, if the user hasn't configured it
69  if (m_trkselTool.empty()) {
70  asg::AsgToolConfig config{"InDet::InDetTrackSelectionTool/TrackParticleSelectionTool"};
71  ATH_MSG_INFO("No TrackSelectionTool provided, so I will create and configure my own, called: " << config.name());
72  // The z0 cut is checked in any case either by the
73  // track to vertex association tool or by the tracking tool
74  ATH_CHECK(config.setProperty("maxZ0SinTheta", 3.));
75  // The minimum Pt requirement is lowered to 500 MeV because
76  // the Loose ttva cone variables accept very low-pt tracks
77  // https://gitlab.cern.ch/atlas/athena/blob/21.2/Reconstruction/RecoAlgs/IsolationAlgs/python/IsoUpdatedTrackCones.py#L21
78  ATH_CHECK(config.setProperty("minPt", 500.));
79  ATH_CHECK(config.setProperty("CutLevel", "Loose"));
80  ATH_CHECK(config.makePrivateTool(m_trkselTool));
81  }
83  if (m_ttvaTool.empty()) {
84  asg::AsgToolConfig config{"CP::TrackVertexAssociationTool/ttva_selection_tool"};
85  ATH_CHECK(config.setProperty("WorkingPoint", "Nonprompt_All_MaxWeight"));
86  ATH_CHECK(config.makePrivateTool(m_ttvaTool));
87  }
88  ATH_CHECK(m_trkselTool.retrieve());
89  ATH_CHECK(m_ttvaTool.retrieve());
90 
91  if (!m_quality_name.empty()) m_acc_quality = std::make_unique<CharAccessor>(m_quality_name);
92  if (!m_passOR_name.empty()) m_acc_passOR = std::make_unique<CharAccessor>(m_passOR_name);
93  if (!m_isoSelection_name.empty()) m_dec_isoselection = std::make_unique<CharDecorator>(m_isoSelection_name);
94  m_isInitialised = true;
95  return StatusCode::SUCCESS;
96  }
97  void IsolationCloseByCorrectionTool::isoTypesFromWP(const std::vector<std::unique_ptr<IsolationWP>>& WPs, IsoVector& types) {
98  types.clear();
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()) {
105  m_isohelpers.insert(std::make_pair(iso_type, std::make_unique<IsoVariableHelper>(iso_type, m_backup_prefix, m_isoDecSuffix)));
106  }
107  }
108  }
109  }
110  m_has_nonTTVA |= std::find_if(types.begin(), types.end(),
111  [](const IsolationType& t) { return isTrackIso(t) && !isTrackIsoTTVA(t); }) != types.end();
112  m_hasPflowIso |= std::find_if(types.begin(), types.end(),
113  [](const IsolationType& t) { return isPFlowIso(t); }) != types.end();
114  m_hasEtConeIso |= std::find_if(types.begin(), types.end(),
115  [](const IsolationType& t) { return isTopoEtIso(t); }) != types.end();
116  }
117 #ifndef XAOD_ANALYSIS
118  void IsolationCloseByCorrectionTool::declareDependency(const std::vector<std::string>& containers, const IsoVector& types) {
119  for (const std::string& cont : containers) {
120  for (const IsoType iso : types) {
121  // define read accessor iso variable keys
122  m_isoVarKeys.emplace_back(cont + "." + std::string(toString(iso)));
123  // define write decorator iso variable keys - needed for MT, but we do not use handles for writing the decorators in isoHelpers
124  m_isoWriteDecVarKeys.emplace_back(cont + "." + std::string(toString(iso) + (m_isoDecSuffix.empty() ? "" : "_") + m_isoDecSuffix));
125  }
126  if (!m_declareCaloDecors && m_caloModel == TopoConeCorrectionModel::SubtractObjectsDirectly) continue;
128  for (const std::string& decor : pflowDecors()) m_isoVarKeys.emplace_back(cont + "." + decor);
129  }
131  for (const std::string& decor : caloDecors()) m_isoVarKeys.emplace_back(cont + "." + decor);
132  }
133  }
134  }
135 #endif
137  if (!container) return;
138  for (const xAOD::IParticle* particle : *container) {
139  if (m_dec_isoselection) (*m_dec_isoselection)(*particle) = true && m_selectorTool->accept(*particle);
140  const IsoVector& iso_types = getIsolationTypes(particle);
141  if (iso_types.empty()) { ATH_MSG_DEBUG("No isolation types have been defined for particle type " << particleName(particle)); }
142  for (const IsoType type : iso_types) {
143  IsoHelperMap::const_iterator Itr = m_isohelpers.find(type);
144  if (Itr == m_isohelpers.end() || Itr->second->backupIsolation(particle) == CorrectionCode::Error) {
145  ATH_MSG_WARNING("Failed to properly access the vanilla isolation variable "
146  << toString(type) << "for particle " << particleName(particle) << " with pT: "
147  << particle->pt() * MeVtoGeV << " GeV, eta: " << particle->eta() << ", phi: " << particle->phi());
148  }
149  }
150  // Save all particles to be sure to output the new iso decorated values
151  // They either pass or not the selection.
152  // The selected ones participate in the CloseBy and may have their isolation corrected.
154  cache.not_sel_parts.insert(particle);
155  }
156  else {
157  cache.prim_parts.insert(particle);
158  }
159  }
160  }
161  void IsolationCloseByCorrectionTool::loadAssociatedObjects(const EventContext& ctx, ObjectCache& cache) const {
162 
163  // Use isLRT decoration for LLP particles to avoid looking for tracks from the primary vertex
164  const CharAccessor isLRT("isLRT");
165 
167  for (const xAOD::IParticle* prim : cache.prim_parts) {
168  // skip LRT leptons
169  if (!isLRT.isAvailable(*prim) || !isLRT(*prim) ) {
170  const TrackSet tracks = getAssociatedTracks(prim, cache.prim_vtx);
171  cache.tracks.insert(tracks.begin(), tracks.end());
172  }
173  const ClusterSet clusters = getAssociatedClusters(ctx, prim);
174  cache.clusters.insert(clusters.begin(), clusters.end());
175  }
176  getAssocFlowElements(ctx, cache);
177  }
179  ObjectCache cache{};
180  cache.prim_parts = {particle};
181  loadAssociatedObjects(ctx, cache);
182  return cache.flows;
183  }
184 
185  void IsolationCloseByCorrectionTool::getAssocFlowElements(const EventContext& ctx, ObjectCache& cache) const {
186  if (m_PflowKey.empty()) return;
188  if (!readHandle.isValid()) return;
189  std::set<const xAOD::IParticle*> tombola{};
190  for (const xAOD::IParticle* p : cache.prim_parts) tombola.insert(p);
191  for (const TrackPtr& p : cache.tracks) tombola.insert(p);
192  for (const CaloClusterPtr& p : cache.clusters) tombola.insert(p);
193 
194  for (const xAOD::FlowElement* flow : *readHandle) {
195  if (!flow) continue;
196  for (size_t ch = 0; ch < flow->nChargedObjects(); ++ch) {
197  const xAOD::IParticle* obj = flow->chargedObject(ch);
198  if (tombola.count(obj)) {
199  const std::vector<float>& weights = flow->chargedObjectWeights();
200  cache.flows.emplace(flow, ch < weights.size() ? weights[ch] : 1.f);
201  }
202  }
203  for (size_t ne = 0; ne < flow->nOtherObjects(); ++ne) {
204  const xAOD::IParticle* obj = flow->otherObject(ne);
205  if (tombola.count(obj)) {
206  const std::vector<float>& weights = flow->otherObjectWeights();
207  cache.flows.emplace(flow, ne < weights.size() ? weights[ne] : 1.f);
208  ATH_MSG_VERBOSE("getAssocFlowElements: neflow " << ne << ", " << obj->type() << ", " << obj->pt() << ", " << obj->eta() << ", " << obj->phi() << ", " << flow->pt() << ", " << flow->eta() << ", " << flow->phi());
209  }
210  }
211  }
212  }
213 
214  #ifndef XAOD_ANALYSIS
215  bool IsolationCloseByCorrectionTool::getExtrapEtaPhi(const EventContext& ctx, const xAOD::TrackParticle* tp, float& eta, float& phi) const {
217  ATH_MSG_DEBUG("Geting calo extension caloExtension tool.");
218  // If we have an extension cache then it owns the extension, otherwise we own it
219  // Therefore we have to prepare both an owning and a non-owning pointer
220  std::unique_ptr<Trk::CaloExtension> caloExtension;
221  caloExtension = m_caloExtTool->caloExtension(ctx, *tp);
222  if(!caloExtension){
223  ATH_MSG_WARNING("Can not get caloExtension.");
224  return false;
225  };
226 
227  const std::vector<Trk::CurvilinearParameters>& intersections = caloExtension->caloLayerIntersections();
228  if(!intersections.empty()){
229  Amg::Vector3D avePoint(0,0,0);
230  for (unsigned int i = 0; i < intersections.size(); ++i){
231  const Amg::Vector3D& point = intersections[i].position();
232  avePoint += point;
233  }
234  avePoint = (1./intersections.size())*avePoint;
235  eta = avePoint.eta();
236  phi = avePoint.phi();
237  return true;
238  } else {
239  ATH_MSG_WARNING("Muon Calo extension got no intersection!!!");
240  }
242  ATH_MSG_WARNING("Calo extension can not be obtained!!!");
243  return false;
244  }
245  #endif // xAOD
246 
248  const EventContext& ctx,
250  const xAOD::MuonContainer* muons,
251  const xAOD::PhotonContainer* photons) const {
252  if (!m_isInitialised) {
253  ATH_MSG_ERROR("The IsolationCloseByCorrectionTool was not initialised!!!");
254  return CorrectionCode::Error;
255  }
256  ObjectCache cache{};
259  loadPrimaryParticles(muons, cache);
260  loadPrimaryParticles(photons, cache);
261 
262  loadAssociatedObjects(ctx, cache);
263  return performCloseByCorrection(ctx, cache);
264  }
266  if (cache.prim_vtx) {
267  // require a primary vertex for isolation correction - expect that if there is not primary vertex, then we only need to assure that the cache.not_sel_parts are treated correctly below
268  for (const xAOD::IParticle* particle : cache.prim_parts) {
269  ATH_MSG_DEBUG("Correct the isolation of particle "<<particleName(particle)<< " with pt: " << particle->pt() * MeVtoGeV << " GeV"
270  << " eta: " << particle->eta()
271  << " phi: " << particle->phi());
272 
274  ATH_MSG_ERROR("Failed to correct the isolation of particle with pt: " << particle->pt() * MeVtoGeV << " GeV"
275  << " eta: " << particle->eta()
276  << " phi: " << particle->phi());
277  return CorrectionCode::Error;
278  }
279  if (m_dec_isoselection) (*m_dec_isoselection)(*particle) = bool(m_selectorTool->accept(*particle));
280  ATH_MSG_DEBUG("Corrected the isolation of particle with pt: " << particle->pt() * MeVtoGeV << " GeV"
281  << " eta: " << particle->eta()
282  << " phi: " << particle->phi());
283 
284  }
285  }
286  // Only need to copy the uncorrected iso values
287  for (const xAOD::IParticle* particle : cache.not_sel_parts) {
288  ATH_MSG_DEBUG("Copy isolation values of particle with pt: " << particle->pt() * MeVtoGeV << " GeV"
289  << " eta: " << particle->eta()
290  << " phi: " << particle->phi());
292  ATH_MSG_ERROR("Failed to copy the isolation of particle with pt: " << particle->pt() * MeVtoGeV << " GeV"
293  << " eta: " << particle->eta()
294  << " phi: " << particle->phi());
295  return CorrectionCode::Error;
296  }
297  }
298  return CorrectionCode::Ok;
299  }
301  static const IsoVector dummy{};
302  if (!particle) return dummy;
304  return m_electron_isoTypes;
305  else if (particle->type() == xAOD::Type::ObjectType::Muon)
306  return m_muon_isoTypes;
307  else if (particle->type() == xAOD::Type::ObjectType::Photon)
308  return m_photon_isoTypes;
309  return dummy;
310  }
311 
313  const xAOD::IParticle* par,
314  const ObjectCache& cache) const {
315  const IsoVector& types = getIsolationTypes(par);
316  if (types.empty()) {
317  ATH_MSG_WARNING("No isolation types are defiend for " << particleName(par));
319  }
320  for (const IsolationType iso_type : types) {
321  float iso_variable{0.f};
322  if (isTrackIso(iso_type)) {
323  if (getCloseByCorrectionTrackIso(par, iso_type, cache, iso_variable) == CorrectionCode::Error) {
324  ATH_MSG_ERROR("Failed to apply track correction");
325  return CorrectionCode::Error;
326  }
327  } else if (isTopoEtIso(iso_type)) {
328  if (getCloseByCorrectionTopoIso(ctx, par, iso_type, cache, iso_variable) == CorrectionCode::Error) {
329  ATH_MSG_ERROR("Failed to apply topo cluster correction");
330  return CorrectionCode::Error;
331  }
332  } else if (isPFlowIso(iso_type)) {
333  if (getCloseByCorrectionPflowIso(ctx, par, iso_type, cache, iso_variable) == CorrectionCode::Error) {
334  ATH_MSG_ERROR("Failed to apply pflow correction");
335  return CorrectionCode::Error;
336  }
337  }
338  ATH_MSG_DEBUG("subtractCloseByContribution: Set pt, eta, phi " << par->pt() << ", " << par->eta() << ", " << par->phi() << " for " << toString(iso_type) << " to " << iso_variable);
339  if (m_isohelpers.at(iso_type)->setIsolation(par, iso_variable) == CorrectionCode::Error) {
340  ATH_MSG_ERROR("Cannot set " << toString(iso_type) << " to " << iso_variable);
341  return CorrectionCode::Error;
342  }
343  }
344  return CorrectionCode::Ok;
345  }
346 
348  const IsoVector& types = getIsolationTypes(part);
349 
350  ATH_MSG_DEBUG("copyIsoValuesForPartsNotSelected " << part->type() << " " << part->pt() * MeVtoGeV << " GeV" << " eta: " << part->eta() << " phi: " << part->phi());
351 
352  if (types.empty()) {
353  ATH_MSG_WARNING("No isolation types are defiend for " << particleName(part));
355  }
356  for (const IsolationType iso_type : types) {
357  float iso_variable{0.f};
358  if (m_isohelpers.at(iso_type)->getIsolation(part, iso_variable) == CorrectionCode::Error) {
359  ATH_MSG_ERROR("Cannot get value for " << toString(iso_type));
360  return CorrectionCode::Error;
361  }
362  ATH_MSG_DEBUG("copyIsoValuesForPartsNotSelected: Set pt, eta " << part->pt() << ", " << part->eta() << ", " << part->phi() << " for " << toString(iso_type) << " to " << iso_variable);
363  if (m_isohelpers.at(iso_type)->setIsolation(part, iso_variable) == CorrectionCode::Error) {
364  ATH_MSG_ERROR("Cannot set " << toString(iso_type) << " to " << iso_variable);
365  return CorrectionCode::Error;
366  }
367  }
368  return CorrectionCode::Ok;
369  }
370 
371 
373  const std::vector<IsolationType>& types,
374  const xAOD::IParticleContainer& closePar) const {
375  if (!m_isInitialised) {
376  ATH_MSG_ERROR("The IsolationCloseByCorrectionTool was not initialised!!!");
377  return CorrectionCode::Error;
378  }
380  {
381  std::lock_guard<std::mutex> guard{m_isoHelpersMutex};
382  for (const IsolationType& t : types) {
383  IsoHelperMap::const_iterator Itr = m_isohelpers.find(t);
384  if (Itr != m_isohelpers.end()) { continue; }
385  Itr = m_isohelpers.insert(std::make_pair(t, std::make_unique<IsoVariableHelper>(t, m_backup_prefix, m_isoDecSuffix))).first;
386  }
387  }
388  corrections.assign(types.size(), 0);
389  ObjectCache cache{};
390  loadPrimaryParticles(&closePar, cache);
391  const EventContext& ctx = Gaudi::Hive::currentContext();
392  loadAssociatedObjects(ctx, cache);
393  std::vector<float>::iterator Cone = corrections.begin();
394  for (const IsolationType& iso_type : types) {
395  IsoHelperMap::const_iterator Itr = m_isohelpers.find(iso_type);
396  if (Itr->second->backupIsolation(&par) == CP::CorrectionCode::Error) {
397  ATH_MSG_ERROR("Failed to backup isolation");
398  return CorrectionCode::Error;
399  }
400  if (isTrackIso(iso_type)) {
401  if (getCloseByCorrectionTrackIso(&par, iso_type, cache, (*Cone)) == CorrectionCode::Error) {
402  ATH_MSG_ERROR("Failed to apply track correction");
403  return CorrectionCode::Error;
404 
405  }
406  }
407  else if (isTopoEtIso(iso_type)) {
408  if (getCloseByCorrectionTopoIso(ctx, &par, iso_type, cache, (*Cone)) == CorrectionCode::Error) {
409  ATH_MSG_ERROR("Failed to apply topo cluster correction");
410  return CorrectionCode::Error;
411  }
412  }
413  else if (isPFlowIso(iso_type)) {
414  if (getCloseByCorrectionPflowIso(ctx, &par, iso_type, cache, (*Cone)) == CorrectionCode::Error) {
415  ATH_MSG_ERROR("Failed to apply pflow correction");
416  return CorrectionCode::Error;
417  }
418  }
419  ++Cone;
420  }
421  return CorrectionCode::Ok;
422  }
423  // check for non-zero primary vtx - single particle samples don't have one
425  return trk && vtx && m_trkselTool->accept(*trk, vtx) && (!m_has_nonTTVA || m_ttvaTool->isCompatible(*trk, *vtx));
426  }
428  TrackSet to_return{};
429  if (P->type() == xAOD::Type::Muon) {
430  const xAOD::Muon* mu = static_cast<const xAOD::Muon*>(P);
431  if (mu->muonType() != xAOD::Muon::SiliconAssociatedForwardMuon)
432  to_return.emplace(mu->trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle));
433  } else if (P->type() == xAOD::Type::TrackParticle) {
434  const xAOD::TrackParticle* trk = static_cast<const xAOD::TrackParticle*>(P);
435  to_return.emplace(trk);
436  } else if (isEgamma(P)) {
437  const xAOD::Egamma* EG = static_cast<const xAOD::Egamma*>(P);
438  std::set<const xAOD::TrackParticle*> trk_vec = xAOD::EgammaHelpers::getTrackParticles(EG, true, true);
439  for (const xAOD::TrackParticle* trk : trk_vec) {
440  ATH_MSG_VERBOSE("Adding egamma track with "
441  << trk->pt() * MeVtoGeV << " GeV, eta: " << trk->eta() << ", phi: " << trk->phi());
442  to_return.emplace(trk);
443  }
444  }
445  return to_return;
446  }
448  const TrackSet assoc_tracks = getAssociatedTracks(P);
449  TrackSet to_ret{};
450  for (const TrackPtr trk : assoc_tracks) {
451  if (passFirstStage(trk, vtx)) to_ret.insert(trk);
452  }
453  return to_ret;
454  }
457  }
459  return P && (P->type() == xAOD::Type::ObjectType::Electron || P->type() == xAOD::Type::ObjectType::Photon);
460  }
461 
462  // Collect topoclusters for electron, photon and muons
463  // - for electrons and photons, collect the associated clusters
464  // - for muons, use associated cluster, if it exists, to get topocluster, otherwise, extrapolate the InDet trackParticle to calo
465  // and look for topoclusters matching in dR the core muon cone
467  // Use accessor to mark topoclusters which are associated to an egamma object, electron or photon
468  // This will be used to avoid associating the same object to a muon during getCloseByCorrectionPflowIso or getCloseByCorrectionTopoIso
469  static const CharDecorator acc_isAssociatedToEG{"isAssociatedToEG"};
471  if (isEgamma(P)) {
472  const xAOD::Egamma* egamm = static_cast<const xAOD::Egamma*>(P);
473  for (size_t calo = 0; calo < egamm->nCaloClusters(); ++calo) {
474  const xAOD::CaloCluster* clust = egamm->caloCluster(calo);
475  if (!clust) continue;
476  std::vector<const xAOD::CaloCluster*> constituents = xAOD::EgammaHelpers::getAssociatedTopoClusters(clust);
477  for (const xAOD::CaloCluster* cluster : constituents) {
478  if (cluster && std::abs(cluster->eta()) < 7. && cluster->e() > MinClusterEnergy) {
479  clusters.emplace(cluster);
480  acc_isAssociatedToEG(*cluster) = true; // set flag that this cluster is associate to an electron or photon
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));
484  }
485  }
486  }
487  if (clusters.size()) return clusters;
488  }
489  if (m_CaloClusterKey.empty()) return clusters;
491  if (!topoClusters.isValid()) return clusters;
492 
493  if (P->type() == xAOD::Type::ObjectType::Muon) {
494  const xAOD::Muon* mu = static_cast<const xAOD::Muon*>(P);
495  const xAOD::CaloCluster* cl = mu->cluster();
496  bool foundMuonTopo = false;
497  if (cl) {
498  ATH_MSG_VERBOSE("getAssociatedClusters: muon has cluster with pt: " << cl->pt() * MeVtoGeV << " GeV, eta: "
499  << cl->eta() << ", phi: " << cl->phi());
500  std::vector<const xAOD::CaloCluster*> constituents = xAOD::EgammaHelpers::getAssociatedTopoClusters(cl);
501  for (const xAOD::CaloCluster* cluster : constituents) {
502  if (cluster && std::abs(cluster->eta()) < 7. && cluster->e() > MinClusterEnergy) {
503  // skip association if this cluster is already associated with an electron or photon - priority is given to egamma reco
504  if (!acc_isAssociatedToEG.isAvailable(*cluster) || !acc_isAssociatedToEG(*cluster)) {
505  clusters.emplace(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());
509  }
510  else {
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());
513  }
514  }
515  }
516  }
517  if (!foundMuonTopo) {
518 #ifndef XAOD_ANALYSIS
519  // extraploate muon to calo and look for matching topo cluster
520  const xAOD::TrackParticle* tp = mu->trackParticle(xAOD::Muon::InnerDetectorTrackParticle);
521  if (tp) {
522  ATH_MSG_VERBOSE("getAssociatedClusters: found mu tp " << " with pt: " << tp->pt() * MeVtoGeV << " GeV, eta: " << tp->eta() << ", phi: " << tp->phi());
523  float tpEtaAtCalo;
524  float tpPhiAtCalo;
525  if (getExtrapEtaPhi(ctx, tp, tpEtaAtCalo, tpPhiAtCalo)) {
526  ATH_MSG_VERBOSE("getAssociatedClusters: tp extrapolated - tpEtaAtCalo " << tpEtaAtCalo << ", tpPhiAtCalo " << tpPhiAtCalo);
527  for (const xAOD::CaloCluster* cluster : *topoClusters) {
528  if (cluster && std::abs(cluster->eta()) < 7. && cluster->e() > MinClusterEnergy &&
529  xAOD::P4Helpers::deltaR(tpEtaAtCalo, tpPhiAtCalo, cluster->eta(), cluster->phi()) < m_coreConeMu) {
530  clusters.emplace(cluster);
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);
532  }
533  }
534  }
535  }
536 #endif
537  }
538  }
539 
540  return clusters;
541  }
543  if (!P) return false;
544  if (m_acc_quality && (!m_acc_quality->isAvailable(*P) || !(*m_acc_quality)(*P))) return false;
545  if (m_acc_passOR && (!m_acc_passOR->isAvailable(*P) || !(*m_acc_passOR)(*P))) return false;
546  return true;
547  }
549  const ObjectCache& cache, float& isoValue) const {
550  if (!isTrackIso(type)) {
551  ATH_MSG_ERROR("Invalid isolation type " << toString(type));
552  return CorrectionCode::Error;
553  }
554  IsoHelperMap::const_iterator Itr = m_isohelpers.find(type);
555  if (Itr == m_isohelpers.end() || Itr->second->getOriginalIsolation(par, isoValue) == CorrectionCode::Error) {
556  ATH_MSG_WARNING(__func__<<"() -- "<<__LINE__<<" Could not retrieve the isolation variable " << toString(type));
557  return CorrectionCode::Error;
558  } else if (cache.tracks.empty())
559  return CorrectionCode::Ok;
560 
561  float MaxDR = coneSize(par, type);
562  const TrackSet ToExclude = getAssociatedTracks(par);
563 
564  const xAOD::IParticle* Ref = isoRefParticle(par);
565  ATH_MSG_VERBOSE(toString(type) << " of " << particleName(par) << " with pt: " << par->pt() * MeVtoGeV << " GeV, eta: " << par->eta()
566  << ", phi: " << par->phi() << " before correction: " << isoValue * MeVtoGeV << " GeV. "
567  << ToExclude.size() << " tracks will be excluded.");
568 
569  for (const TrackPtr& poluting_trk : cache.tracks) {
570  // Checks for the Pile-up robust isolation WP's
571  if (poluting_trk->pt() < trackPtCut(type)) continue;
573  if (isTrackIsoTTVA(type) && m_has_nonTTVA && !m_ttvaTool->isCompatible(*poluting_trk, *cache.prim_vtx)) continue;
574 
575  if (overlap(Ref, poluting_trk, MaxDR) && !ToExclude.count(poluting_trk)) {
576  ATH_MSG_VERBOSE("Subtract track with "
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();
581  }
582  }
583  isoValue = std::max(0.f, isoValue);
584  ATH_MSG_VERBOSE(toString(type) << " of " << particleName(par) << " with pt: " << par->pt() * MeVtoGeV << " GeV, eta: " << par->eta()
585  << ", phi: " << par->phi() << " after correction: " << isoValue * MeVtoGeV << " GeV");
586  return CorrectionCode::Ok;
587  }
589  const IsoType type, const ObjectCache& cache,
590  float& isoValue) const {
591  if (!isPFlowIso(type)) {
592  ATH_MSG_ERROR("getCloseByCorrectionPflowIso() -- The isolation type is not a Pflow variable " << toString(type));
593  return CorrectionCode::Error;
594  }
595  if (m_isohelpers.at(type)->getOriginalIsolation(primary, isoValue) == CorrectionCode::Error) {
596  ATH_MSG_ERROR("getCloseByCorrectionPflowIso() -- Could not retrieve the isolation variable.");
597  return CorrectionCode::Error;
598  }
600  if (isoValue <= 0.) {
601  ATH_MSG_DEBUG("Pflow varible is already sufficiently isolated ");
602  return CorrectionCode::Ok;
603  }
604  const float coneDR = coneSize(primary, type);
605  float ref_eta{0.f}, ref_phi{0.f};
606  getExtrapEtaPhi(primary, ref_eta, ref_phi);
607  if (m_caloModel == TopoConeCorrectionModel::SubtractObjectsDirectly) {
609  ATH_MSG_VERBOSE("getCloseByCorrectionPflowIso: " << toString(type) << " of " << particleName(primary) << " with pt: "
610  << primary->pt() * MeVtoGeV << " GeV, eta: " << primary->eta()
611  << ", phi: " << primary->phi() << " before correction: " << isoValue * MeVtoGeV << " GeV. ");
612  PflowSet assoc_coll = getAssocFlowElements(ctx, primary);
613  for (const FlowElementPtr& flow : cache.flows) {
614  ATH_MSG_VERBOSE("Loop over pflow element: " << flow->pt() << " GeV, eta: " << flow->eta() << " phi: " << flow->phi());
615 
616  const float dR = xAOD::P4Helpers::deltaR(ref_eta,ref_phi, flow->eta(),flow->phi());
618  ATH_MSG_VERBOSE("Flow element is in core cone");
619  continue;
620  }
621  if (assoc_coll.count(flow)) {
622  ATH_MSG_VERBOSE("Flow element is directly associated with the object");
623  continue;
624  }
625  if (dR < coneDR) {
626  ATH_MSG_VERBOSE("Found overlapping pflow element: " << flow->pt() << " GeV, eta: " << flow->eta()
627  << " phi: " << flow->phi() << " dR: " << dR);
628  isoValue -= flow->pt() * flow.weight;
629  }
630  }
631  ATH_MSG_VERBOSE("getCloseByCorrectionPflowIso: " << toString(type) << " of " << particleName(primary) << " with pt: "
632  << primary->pt() * MeVtoGeV << " GeV, eta: " << primary->eta()
633  << ", phi: " << primary->phi() << " after correction: " << isoValue * MeVtoGeV << " GeV. ");
634  } else if (m_caloModel == TopoConeCorrectionModel::UseAveragedDecorators) {
635  static const FloatAccessor acc_eta{pflowDecors()[0]};
636  static const FloatAccessor acc_phi{pflowDecors()[1]};
637  static const FloatAccessor acc_ene{pflowDecors()[2]};
638  static const CharAccessor acc_isDecor{pflowDecors()[3]};
639  for (const xAOD::IParticle* others : cache.prim_parts) {
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");
643  return CorrectionCode::Error;
644  }
645  const float other_eta = acc_eta(*others);
646  const float other_phi = acc_phi(*others);
647  const float dR = xAOD::P4Helpers::deltaR(ref_eta,ref_phi,other_eta,other_phi);
648  if (dR > coneDR) continue;
649  if (dR< (primary->type() == xAOD::Type::ObjectType::Muon ? m_coreConeMu : m_coreConeEl)) continue;
650  isoValue -= acc_ene(*others);
651  }
652  } else {
653  ATH_MSG_ERROR("Unknown calo correction model "<<m_caloModel);
654  return CorrectionCode::Error;
655  }
656  isoValue = std::max(0.f, isoValue);
657  return CorrectionCode::Ok;
658  }
659 
661  const IsoType type, const ObjectCache& cache,
662  float& isoValue) const {
663  // check if the isolation can be loaded
664  if (!isTopoEtIso(type)) {
665  ATH_MSG_ERROR("getCloseByCorrectionTopoIso() -- The isolation type is not an et cone variable " << toString(type));
666  return CorrectionCode::Error;
667  }
668  if (m_isohelpers.at(type)->getOriginalIsolation(primary, isoValue) == CorrectionCode::Error) {
669  ATH_MSG_WARNING("Could not retrieve the isolation variable.");
670  return CorrectionCode::Error;
671  }
673  if (isoValue <= 0.) {
674  ATH_MSG_DEBUG("Topo et cone variable is already sufficiently isolated");
675  return CorrectionCode::Ok;
676  }
677  float ref_eta{0.f}, ref_phi{0.f};
678  getExtrapEtaPhi(primary, ref_eta, ref_phi);
679  ATH_MSG_VERBOSE("getCloseByCorrectionTopoIso: " << toString(type) << " of " << particleName(primary) << " with ref eta: " << ref_eta << ", ref phi " << ref_phi);
680 
681  float MaxDR = coneSize(primary, type) * (primary->type() != xAOD::Type::ObjectType::Muon ? 1. : m_ConeSizeVariation.value());
682  if (m_caloModel == TopoConeCorrectionModel::SubtractObjectsDirectly) {
683  ATH_MSG_VERBOSE("getCloseByCorrectionTopoIso: " << toString(type) << " of " << particleName(primary) << " with pt: "
684  << primary->pt() * MeVtoGeV << " GeV, eta: " << primary->eta()
685  << ", phi: " << primary->phi() << " before correction: " << isoValue * MeVtoGeV << " GeV. ");
687  for (const CaloClusterPtr& calo : cache.clusters) {
688  const float dR = xAOD::P4Helpers::deltaR(ref_eta, ref_phi, calo->eta(), calo->phi());
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;
691  // REMOVED CORE CUT SINCE TOPOCLUSTERS SHOULD BE ASSOCIATED TO THE ELECTRONS AND MUONS AND WILL BE CUT BY ASSOC CUT BELOW
692  if (assoc.count(calo)) {
693  ATH_MSG_VERBOSE("getCloseByCorrectionTopoIso: skip due to assoc " << assoc.count(calo));
694  continue;
695  }
696  float Polution = clusterEtMinusTile(calo) / (isoValue != 0 ? isoValue : 1.);
697  if (Polution < 0. || Polution > m_maxTopoPolution) {
698  ATH_MSG_VERBOSE("getCloseByCorrectionTopoIso: skip due to polution " << Polution << ", clus noTile " << clusterEtMinusTile(calo) * MeVtoGeV << " GeV");
699  continue;
700  }
701  ATH_MSG_VERBOSE("getCloseByCorrectionTopoIso: Found overlapping topocluster: " << calo->pt() * MeVtoGeV << " GeV, lessTile " << clusterEtMinusTile(calo) * MeVtoGeV << " GeV, eta: " << calo->eta()
702  << " phi: " << calo->phi() << " dR: " << dR);
703  isoValue -= clusterEtMinusTile(calo);
704  }
705  ATH_MSG_VERBOSE("getCloseByCorrectionTopoIso: " << toString(type) << " of " << particleName(primary) << " with pt: "
706  << primary->pt() * MeVtoGeV << " GeV, eta: " << primary->eta()
707  << ", phi: " << primary->phi() << " after correction: " << isoValue * MeVtoGeV << " GeV. ");
708  } else if (m_caloModel == TopoConeCorrectionModel::UseAveragedDecorators) {
709  static const FloatAccessor acc_eta{caloDecors()[0]};
710  static const FloatAccessor acc_phi{caloDecors()[1]};
711  static const FloatAccessor acc_ene{caloDecors()[2]};
712  static const CharAccessor acc_isDecor{caloDecors()[3]};
713  for (const xAOD::IParticle* others : cache.prim_parts) {
714  if (others == primary) continue;
715  if (!acc_isDecor.isAvailable(*others) || !acc_isDecor(*others)) {
716  ATH_MSG_ERROR("The averaged calo cluster decorations are not available for "<<particleName(others)<<". Please check");
717  return CorrectionCode::Error;
718  }
719  const float other_eta = acc_eta(*others);
720  const float other_phi = acc_phi(*others);
721  const float dR = xAOD::P4Helpers::deltaR(ref_eta,ref_phi,other_eta,other_phi);
722  if (dR > MaxDR) continue;
723  if (dR< (primary->type() == xAOD::Type::ObjectType::Muon ? m_coreConeMu : m_coreConeEl)) continue;
724  isoValue -= acc_ene(*others);
725  }
726  }
727  isoValue = std::max(0.f, isoValue);
728  return CorrectionCode::Ok;
729  }
730  void IsolationCloseByCorrectionTool::getExtrapEtaPhi(const xAOD::IParticle* par, float& eta, float& phi) const {
731  static const FloatAccessor acc_assocEta{IsolationCloseByCorrectionTool::caloDecors()[0]};
732  static const FloatAccessor acc_assocPhi{IsolationCloseByCorrectionTool::caloDecors()[1]};
733  static const CharAccessor acc_isDecor{caloDecors()[3]};
734  if (par->type() != xAOD::Type::ObjectType::Muon) {
735  const xAOD::Egamma* egam = dynamic_cast<const xAOD::Egamma*>(par);
736  if( egam ) {
737  eta = egam->caloCluster()->eta();
738  phi = egam->caloCluster()->phi();
739  }
740  else {
741  eta = par->eta();
742  phi = par->phi();
743  }
744  } else if (acc_isDecor.isAvailable(*par) && acc_isDecor(*par)) {
745  eta = acc_assocEta(*par);
746  phi = acc_assocPhi(*par);
747  } else {
748  float assoc_ene{0.f};
749  static const FloatDecorator dec_assocEta{IsolationCloseByCorrectionTool::caloDecors()[0]};
750  static const FloatDecorator dec_assocPhi{IsolationCloseByCorrectionTool::caloDecors()[1]};
751  static const CharDecorator dec_isDecor{caloDecors()[3]};
752  associateCluster(par,eta, phi, assoc_ene);
753  dec_assocEta(*par) = eta;
754  dec_assocPhi(*par) = phi;
755  dec_isDecor(*par) = true;
756  }
757  }
758  void IsolationCloseByCorrectionTool::associateFlowElement(const EventContext& ctx, const xAOD::IParticle* particle, float& eta,
759  float& phi, float& energy) const {
760  phi = eta = energy = 0.;
761  PflowSet flowCollection = getAssocFlowElements(ctx, particle);
762  if (flowCollection.empty()) {
763  phi = particle->phi();
764  eta = particle->eta();
765  return;
766  }
767  for (const FlowElementPtr& ele : flowCollection) {
768  const float flow_energy = ele->e() * ele.weight;
769  if (flow_energy < MinClusterEnergy) continue;
770  phi += ele->phi() * flow_energy;
771  eta += ele->eta() * flow_energy;
772  energy += flow_energy;
773  }
774  if (energy < MinClusterEnergy) {
775  phi = particle->phi();
776  eta = particle->eta();
777  return;
778  }
780  eta /= energy;
781  }
782  void IsolationCloseByCorrectionTool::associateCluster(const xAOD::IParticle* particle, float& eta, float& phi, float& energy) const {
783  phi = particle->phi();
784  eta = particle->eta();
785  energy = -1.;
786  if (particle->type() == xAOD::Type::ObjectType::Muon) {
787  const xAOD::Muon* mu = static_cast<const xAOD::Muon*>(particle);
788  const xAOD::CaloCluster* cluster = mu->cluster();
789  if (!cluster) return;
790  energy = cluster->e();
791  // At the moment no cluster associated with muons is in the derivations
792  int nSample{0};
793  float etaT{0.f}, phiT{0.f}, dphiT{0.f};
794 
795  for (unsigned int i = 0; i < CaloSampling::Unknown; ++i) {
797  if (cluster->hasSampling(s)) {
798  ATH_MSG_VERBOSE("Sampling: " << i << "eta-phi (" << cluster->etaSample(s) << ", " << cluster->phiSample(s) << ")");
799  etaT += cluster->etaSample(s);
800  if (!nSample)
801  phiT = cluster->phiSample(s);
802  else
803  dphiT += xAOD::P4Helpers::deltaPhi(cluster->phiSample(s), phiT);
804  ++nSample;
805  }
806  }
807  if (!nSample) return;
808  ATH_MSG_DEBUG("Eta, phi before sampling: " << eta << ", " << phi << " and after sampling: " << etaT / nSample << ", "
809  << phiT / nSample);
810  phi = xAOD::P4Helpers::deltaPhi(phiT + dphiT / nSample, 0);
811  eta = etaT / nSample;
812  ATH_MSG_VERBOSE("associateCluster: mu with pt: " << mu->pt() * MeVtoGeV << " GeV, eta: "
813  << mu->eta() << ", phi: " << mu->phi() << " energy, eta, phi " << energy << ", " << eta << ", " << phi
814  << ", et " << energy * mu->pt() / mu->e());
815  }
816  if (!isEgamma(particle)) return;
817  const xAOD::Egamma* egamm = static_cast<const xAOD::Egamma*>(particle);
818  eta = phi = energy = 0.;
819  for (unsigned int cl = 0; cl < egamm->nCaloClusters(); ++cl) {
820  const xAOD::CaloCluster* prim_cluster = egamm->caloCluster(cl);
821  if (!prim_cluster) {
822  ATH_MSG_DEBUG("Cluster " << cl << " is not defined " << egamm);
823  continue;
824  }
825  std::vector<const xAOD::CaloCluster*> constituents = xAOD::EgammaHelpers::getAssociatedTopoClusters(prim_cluster);
826  for (const xAOD::CaloCluster* cluster : constituents) {
827  if (!cluster) continue;
828  const float clus_e = clusterEtMinusTile(cluster);
830  if (clus_e < MinClusterEnergy) continue;
831  eta += cluster->eta() * clus_e;
832  phi += cluster->phi() * clus_e;
833  energy += clus_e;
834  ATH_MSG_VERBOSE("associateCluster: eg add in clus with e: " << clus_e * MeVtoGeV << " clus et " << cluster->pt() * MeVtoGeV << " GeV, eta: "
835  << cluster->eta() << ", phi: " << cluster->phi());
836  }
837  }
838  if (energy >= MinClusterEnergy) {
840  eta /= energy;
841  ATH_MSG_VERBOSE("associateCluster: eg with pt: " << egamm->pt() * MeVtoGeV << " GeV, eta: "
842  << egamm->eta() << ", phi: " << egamm->phi() << " energy, eta, phi " << energy << ", " << eta << ", " << phi );
843  } else {
844  ATH_MSG_DEBUG("Average energy from the clusters is too low " << energy << " copy particle properties");
845  eta = egamm->eta();
846  phi = egamm->phi();
847  energy = egamm->e();
848  }
849  }
851  const xAOD::IParticleContainer& closePar) const {
852  if (!m_isInitialised) { ATH_MSG_WARNING("The IsolationCloseByCorrectionTool was not initialised!!!"); }
853  assert(!m_selectorTool.empty());
854  const IsoVector& iso_types = getIsolationTypes(&x);
855  if (iso_types.empty()) {
856  // TODO: figure out if this is actually a valid situation
857  // or if we should just fail at this point.
858  ATH_MSG_WARNING("Could not cast particle for acceptCorrected. Will return false.");
859  static const asg::AcceptInfo dummyAcceptInfo = []() {
861  info.addCut("castCut", "whether we managed to cast to a known type");
862  return info;
863  }();
864  if (m_dec_isoselection) (*m_dec_isoselection)(x) = false;
865  return asg::AcceptData(&dummyAcceptInfo);
866  }
867 
868  if (closePar.empty()) return m_selectorTool->accept(x);
869  strObj strPar;
870  strPar.isolationValues.resize(numIsolationTypes);
871  strPar.pt = x.pt();
872  strPar.eta = x.eta();
873  strPar.type = x.type();
874  std::vector<float> corrections;
875  if (getCloseByCorrection(corrections, x, iso_types, closePar) == CorrectionCode::Error) {
876  ATH_MSG_WARNING("Could not calculate the corrections. acceptCorrected(x) is done without the corrections.");
877  if (m_dec_isoselection) (*m_dec_isoselection)(x) = bool(m_selectorTool->accept(x));
878  return m_selectorTool->accept(x);
879  }
880  for (unsigned int i = 0; i < iso_types.size(); ++i) {
881  strPar.isolationValues[iso_types[i]] = corrections[i];
883  float old = (*acc)(x);
884  ATH_MSG_DEBUG("Correcting " << toString(iso_types.at(i)) << " from " << old << " to " << corrections[i]);
885  }
886  auto accept = m_selectorTool->accept(strPar);
887  if (m_dec_isoselection) (*m_dec_isoselection)(x) = bool(accept);
888  return accept;
889  }
892  if (!Verticies.isValid() || !Verticies->size()) {
893  ATH_MSG_WARNING("Failed to load vertex collection " << m_VtxKey.key());
894  return nullptr;
895  }
896  for (const xAOD::Vertex* V : *Verticies) {
897  if (V->vertexType() == xAOD::VxType::VertexType::PriVtx) return V;
898  }
899  return nullptr;
900  }
901 
903  using xAOD::Iso::coneSize;
904  float ConeDR = coneSize(Cone);
906  const xAOD::IParticle* Reference = isoRefParticle(P);
907  float MiniIso = m_ptvarconeRadius / unCalibPt(Reference);
908  if (MiniIso < ConeDR) return MiniIso;
909  }
910  return ConeDR;
911  }
913  if (!P) {
914  ATH_MSG_WARNING("No partcile given. Return stupidly big number. ");
915  return 1.e25;
916  }
918  if (!OR) {
919  ATH_MSG_VERBOSE("No reference from the shallow copy container of " << particleName(P) << " could be found");
920  return P->pt();
921  }
922  return OR->pt();
923  }
924 
926  if (!P) {
927  ATH_MSG_ERROR("Nullptr given");
928  return nullptr;
929  }
930  // Use for muons the associated ID track. Else the particle itself
931  if (P->type() == xAOD::Type::ObjectType::Muon) {
932  const xAOD::Muon* muon = static_cast<const xAOD::Muon*>(P);
933  const xAOD::TrackParticle* idTrk = muon->trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle);
934  return idTrk ? idTrk : muon->primaryTrackParticle();
935  }
936  return P;
937  }
939  if (!P || !P1) {
940  ATH_MSG_WARNING("Nullptr were given");
941  return true;
942  }
943  return (P == P1);
944  }
945 
946  float IsolationCloseByCorrectionTool::deltaR2(const xAOD::IParticle* P, const xAOD::IParticle* P1, bool AvgCalo) const {
947  if (isSame(P, P1)) return 0.;
948  // Check if one of the objects is a CaloCluster or the Averaging over the clusters is requested.
949  if (AvgCalo || (P->type() != P1->type() &&
951  float phi1{0.f}, eta1{0.f}, eta2{0.f}, phi2{0.f};
952  getExtrapEtaPhi(P, eta1, phi1);
953  getExtrapEtaPhi(P1, eta2, phi2);
954  return xAOD::P4Helpers::deltaR2(eta1, phi1, eta2, phi2);
955  }
956  float dPhi = xAOD::P4Helpers::deltaPhi(P, P1);
957  float dEta = P->eta() - P1->eta();
958  return dEta * dEta + dPhi * dPhi;
959  }
961  return (!isSame(P, P1) && deltaR2(P, P1) < (dR * dR));
962  }
964  IsoHelperMap::const_iterator itr = m_isohelpers.find(isoVariable);
965  float isovalue = 0;
966  if (itr == m_isohelpers.end() || itr->second->getOriginalIsolation(particle, isovalue) == CorrectionCode::Error) {
967  ATH_MSG_ERROR("Failed to retrive the original isolation cone ");
968  isovalue = FLT_MAX;
969  }
970  return isovalue;
971  }
974  }
976  float Et{0.f};
977  if (cluster) {
978  try {
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(); }
983  }
984  return std::max(Et, 0.f);
985  }
986  std::string IsolationCloseByCorrectionTool::particleName(const xAOD::IParticle* C) { return particleName(C->type()); }
988  if (T == xAOD::Type::ObjectType::Electron) return "Electron";
989  if (T == xAOD::Type::ObjectType::Photon) return "Photon";
990  if (T == xAOD::Type::ObjectType::Muon) return "Muon";
991  if (T == xAOD::Type::ObjectType::TrackParticle) return "Track";
992  if (T == xAOD::Type::ObjectType::CaloCluster) return "Cluster";
993  return "Unknown";
994  }
999  }
1003  static const std::set<IsolationFlavour> ttvaFlavours{IsolationFlavour::ptcone_Nonprompt_All_MaxWeightTTVA_pt500,
1007  return ttvaFlavours.count(flavour);
1008  }
1011  static const std::set<IsolationFlavour> ttvaFlavours{IsolationFlavour::ptvarcone_Nonprompt_All_MaxWeightTTVA_pt500,
1015  return ttvaFlavours.count(flavour);
1016  }
1019  ATH_MSG_INFO("The following isolation cones are considered for " << particleName(T));
1020  for (const IsoType& cone : types) { ATH_MSG_INFO(" --- " << toString(cone)); }
1021  }
1023  if (!isTrackIso(type)) return -1;
1025  static const std::set<IsolationFlavour> Pt1000_Flavours{IsolationFlavour::ptcone_Nonprompt_All_MaxWeightTTVA_pt1000,
1029  if (Pt1000_Flavours.count(flavour)) return 1000;
1030  return 500;
1031  }
1033 } // namespace CP
grepfile.info
info
Definition: grepfile.py:38
CP::IsolationCloseByCorrectionTool::copyIsoValuesForPartsNotSelected
CorrectionCode copyIsoValuesForPartsNotSelected(const xAOD::IParticle *part) const
Definition: IsolationCloseByCorrectionTool.cxx:347
CP::IsolationCloseByCorrectionTool::m_hasEtConeIso
bool m_hasEtConeIso
Switch whether a topoetcone isolation working point is defined.
Definition: IsolationCloseByCorrectionTool.h:289
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
xAOD::CaloCluster_v1::phi
virtual double phi() const
The azimuthal angle ( ) of the particle.
Definition: CaloCluster_v1.cxx:256
CP::IsolationCloseByCorrectionTool::m_backup_prefix
Gaudi::Property< std::string > m_backup_prefix
Definition: IsolationCloseByCorrectionTool.h:214
CP::caloDecorNames
IsolationCloseByCorrectionTool::caloDecorNames caloDecorNames
Definition: IsolationCloseByCorrectionTool.cxx:23
xAOD::Iso::topoetcone
@ topoetcone
Topo-cluster ET-sum.
Definition: IsolationFlavour.h:25
GetLCDefs::Unknown
@ Unknown
Definition: GetLCDefs.h:21
CP::IsolationCloseByCorrectionTool::m_maxTopoPolution
Gaudi::Property< float > m_maxTopoPolution
Definition: IsolationCloseByCorrectionTool.h:240
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:195
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
xAOD::Electron
Electron_v1 Electron
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Electron.h:17
CP::IsolationCloseByCorrectionTool::m_ttvaTool
ToolHandle< CP::ITrackVertexAssociationTool > m_ttvaTool
Definition: IsolationCloseByCorrectionTool.h:200
CP::IsolationCloseByCorrectionTool::ObjectCache::not_sel_parts
PrimaryCollection not_sel_parts
Definition: IsolationCloseByCorrectionTool.h:89
xAOD::EgammaHelpers::getAssociatedTopoClusters
std::vector< const xAOD::CaloCluster * > getAssociatedTopoClusters(const xAOD::CaloCluster *cluster)
Return a vector of all the topo clusters associated with the egamma cluster.
Definition: EgammaxAODHelpers.cxx:65
CP::IsolationCloseByCorrectionTool::m_isoWriteDecVarKeys
SG::WriteDecorHandleKeyArray< xAOD::IParticleContainer > m_isoWriteDecVarKeys
Definition: IsolationCloseByCorrectionTool.h:262
CP::IsolationCloseByCorrectionTool::isTrackIsoTTVA
static bool isTrackIsoTTVA(xAOD::Iso::IsolationType type)
Definition: IsolationCloseByCorrectionTool.cxx:1017
ParticleGun_SamplingFraction.eta2
eta2
Definition: ParticleGun_SamplingFraction.py:96
CP::IsolationCloseByCorrectionTool::isVarTrackIsoTTVA
static bool isVarTrackIsoTTVA(xAOD::Iso::IsolationType Iso)
Definition: IsolationCloseByCorrectionTool.cxx:1009
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
CP::IsolationCloseByCorrectionTool::isFixedTrackIso
static bool isFixedTrackIso(xAOD::Iso::IsolationType type)
Definition: IsolationCloseByCorrectionTool.cxx:995
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
CP::IsolationCloseByCorrectionTool::m_acc_quality
SelectionAccessor m_acc_quality
Definition: IsolationCloseByCorrectionTool.h:294
ObjectType
ObjectType
Definition: BaseObject.h:11
SG::Accessor
Helper class to provide type-safe access to aux data.
Definition: Control/AthContainers/AthContainers/Accessor.h:68
CP::IsolationCloseByCorrectionTool::m_declareCaloDecors
Gaudi::Property< bool > m_declareCaloDecors
Definition: IsolationCloseByCorrectionTool.h:249
CP::IsolationCloseByCorrectionTool::m_passOR_name
Gaudi::Property< std::string > m_passOR_name
Definition: IsolationCloseByCorrectionTool.h:210
CurrentContext.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
xAODP4Helpers.h
JetTiledMap::W
@ W
Definition: TiledEtaPhiMap.h:44
xAOD::Iso::IsolationFlavour
IsolationFlavour
Enumeration for different ways of calculating isolation in xAOD files.
Definition: IsolationFlavour.h:17
CP::IsolationCloseByCorrectionTool::m_PflowKey
SG::ReadHandleKey< xAOD::FlowElementContainer > m_PflowKey
Definition: IsolationCloseByCorrectionTool.h:276
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
xAOD::Egamma_v1::e
virtual double e() const override final
The total energy of the particle.
Definition: Egamma_v1.cxx:90
DMTest::P
P_v1 P
Definition: P.h:23
CutsMETMaker::accept
StatusCode accept(const xAOD::Muon *mu)
Definition: CutsMETMaker.cxx:18
CP::PflowSet
std::set< FlowElementPtr > PflowSet
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:74
CP::IsolationCloseByCorrectionTool::passSelectionQuality
bool passSelectionQuality(const xAOD::IParticle *particle) const
Definition: IsolationCloseByCorrectionTool.cxx:542
CP::IsolationCloseByCorrectionTool::IsolationCloseByCorrectionTool
IsolationCloseByCorrectionTool(const std::string &name)
Definition: IsolationCloseByCorrectionTool.cxx:35
CP::IsolationCloseByCorrectionTool::ObjectCache::clusters
ClusterSet clusters
Definition: IsolationCloseByCorrectionTool.h:91
asg
Definition: DataHandleTestTool.h:28
CP::IsolationCloseByCorrectionTool::m_muonKeys
Gaudi::Property< std::vector< std::string > > m_muonKeys
Definition: IsolationCloseByCorrectionTool.h:256
CP::MeVtoGeV
constexpr float MeVtoGeV
Definition: IsolationCloseByCorrectionTool.cxx:33
CP::IsolationCloseByCorrectionTool::isTopoEtIso
static bool isTopoEtIso(xAOD::Iso::IsolationType type)
Definition: IsolationCloseByCorrectionTool.cxx:1000
CP::IsolationCloseByCorrectionTool::clusterEtMinusTile
static float clusterEtMinusTile(const xAOD::CaloCluster *C)
Definition: IsolationCloseByCorrectionTool.cxx:975
CP::IsolationCloseByCorrectionTool::m_electron_isoTypes
IsoVector m_electron_isoTypes
Isolation variables used by the electron working point.
Definition: IsolationCloseByCorrectionTool.h:281
CP::TrackSet
std::set< TrackPtr > TrackSet
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:72
ParticleTest.tp
tp
Definition: ParticleTest.py:25
xAOD::IParticle::type
virtual Type::ObjectType type() const =0
The type of the object as a simple enumeration.
CP::IsolationCloseByCorrectionTool::m_elecKeys
Gaudi::Property< std::vector< std::string > > m_elecKeys
Declare the data dependencies of the Input containers.
Definition: IsolationCloseByCorrectionTool.h:254
CP::IsolationCloseByCorrectionTool::pflowDecors
static caloDecorNames pflowDecors()
Definition: IsolationCloseByCorrectionTool.cxx:28
CP::strObj::isolationValues
std::vector< float > isolationValues
Definition: IsolationCondition.h:26
xAOD::P4Helpers::deltaPhi
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
Definition: xAODP4Helpers.h:69
xAOD::eta1
setEt setPhi setE277 setWeta2 eta1
Definition: TrigEMCluster_v1.cxx:41
CP::IsolationCloseByCorrectionTool::associateCluster
void associateCluster(const xAOD::IParticle *particle, float &eta, float &phi, float &energy) const override
Retrieve the associated clusters from the Particle and calculate the average eta/phi/energy.
Definition: IsolationCloseByCorrectionTool.cxx:782
CP::IsolationCloseByCorrectionTool::ObjectCache::prim_vtx
const xAOD::Vertex * prim_vtx
Definition: IsolationCloseByCorrectionTool.h:87
xAOD::EgammaHelpers::getTrackParticles
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.
Definition: EgammaxAODHelpers.cxx:120
CP::SortedObjPtr
Small helper struct to have sets of particle pointers sorted by pt.
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:40
xAOD::Egamma_v1
Definition: Egamma_v1.h:56
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
CP::IsolationCloseByCorrectionTool::loadAssociatedObjects
void loadAssociatedObjects(const EventContext &ctx, ObjectCache &cache) const
Load all associated tracks / clusters / flow elements into the cache.
Definition: IsolationCloseByCorrectionTool.cxx:161
xAOD::Iso::neflowisol
@ neflowisol
neutral eflow
Definition: IsolationFlavour.h:31
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
xAOD::P4Helpers::deltaR2
double deltaR2(double rapidity1, double phi1, double rapidity2, double phi2)
from bare rapidity,phi
Definition: xAODP4Helpers.h:111
CP::IsolationCloseByCorrectionTool::m_caloModel
Gaudi::Property< int > m_caloModel
EXPERT PROPERTIES.
Definition: IsolationCloseByCorrectionTool.h:221
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
CP::IsolationCloseByCorrectionTool::isSame
bool isSame(const xAOD::IParticle *particle, const xAOD::IParticle *particle1) const
Definition: IsolationCloseByCorrectionTool.cxx:938
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
x
#define x
CP::IsolationCloseByCorrectionTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: IsolationCloseByCorrectionTool.cxx:37
CP
Select isolated Photons, Electrons and Muons.
Definition: Control/xAODRootAccess/xAODRootAccess/TEvent.h:48
CP::IsolationCloseByCorrectionTool::performCloseByCorrection
CorrectionCode performCloseByCorrection(const EventContext &ctx, ObjectCache &cache) const
Definition: IsolationCloseByCorrectionTool.cxx:265
xAOD::Egamma_v1::nCaloClusters
size_t nCaloClusters() const
Return the number of xAOD::CaloClusters that define the electron candidate.
Definition: Egamma_v1.cxx:377
CaloCell_ID_FCS::TileGap3
@ TileGap3
Definition: FastCaloSim_CaloCell_ID.h:36
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition: Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
CP::IsolationCloseByCorrectionTool::m_coreConeMu
Gaudi::Property< float > m_coreConeMu
Definition: IsolationCloseByCorrectionTool.h:229
CP::strObj
Definition: IsolationCondition.h:23
CP::IsolationCloseByCorrectionTool::m_isoSelection_name
Gaudi::Property< std::string > m_isoSelection_name
Definition: IsolationCloseByCorrectionTool.h:212
getIsolationCorrectionAccessor.h
CP::IsolationCloseByCorrectionTool::m_photon_isoTypes
IsoVector m_photon_isoTypes
Isolation variables used by the photon working point.
Definition: IsolationCloseByCorrectionTool.h:283
xAOD::CaloCluster_v1::etaSample
float etaSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
Definition: CaloCluster_v1.cxx:532
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition: Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
xAOD::Iso
Namespace holding the IsolationType enumeration.
Definition: IsolationConeSize.h:13
xAOD::phi
setEt phi
Definition: TrigEMCluster_v1.cxx:29
CP::IsolationCloseByCorrectionTool::m_has_nonTTVA
bool m_has_nonTTVA
Switch whether a pile-up non robust TTVA working point is defined.
Definition: IsolationCloseByCorrectionTool.h:285
CP::IsolationCloseByCorrectionTool::retrieveIDBestPrimaryVertex
const xAOD::Vertex * retrieveIDBestPrimaryVertex(const EventContext &ctx) const
Definition: IsolationCloseByCorrectionTool.cxx:890
xAOD::Cone
@ Cone
Definition: TrackingPrimitives.h:552
Egamma.h
CP::IsolationCloseByCorrectionTool::m_ConeSizeVariation
Gaudi::Property< float > m_ConeSizeVariation
Definition: IsolationCloseByCorrectionTool.h:244
CP::IsolationCloseByCorrectionTool::getAssocFlowElements
void getAssocFlowElements(const EventContext &ctx, ObjectCache &cache) const
Retrieve all Flow elements associated with the particles in the cache.
Definition: IsolationCloseByCorrectionTool.cxx:185
CP::IsolationCloseByCorrectionTool::m_muon_isoTypes
IsoVector m_muon_isoTypes
Isolation variables used by the muon working point.
Definition: IsolationCloseByCorrectionTool.h:279
CP::CorrectionCode::OutOfValidityRange
@ OutOfValidityRange
Input object is out of validity range.
Definition: CorrectionCode.h:37
CP::IsolationCloseByCorrectionTool::m_CaloClusterKey
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_CaloClusterKey
Definition: IsolationCloseByCorrectionTool.h:274
CP::CorrectionCode::Error
@ Error
Some error happened during the object correction.
Definition: CorrectionCode.h:36
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
xAOD::Iso::ptvarcone
@ ptvarcone
mini isolation
Definition: IsolationFlavour.h:28
CP::IsolationCloseByCorrectionTool::isEgamma
static bool isEgamma(const xAOD::IParticle *particle)
Definition: IsolationCloseByCorrectionTool.cxx:458
EgammaxAODHelpers.h
CP::IsolationCloseByCorrectionTool::loadPrimaryParticles
void loadPrimaryParticles(const xAOD::IParticleContainer *container, ObjectCache &cache) const
Filter all electrons/muons/photons from the collection which pass the selection decoration.
Definition: IsolationCloseByCorrectionTool.cxx:136
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ObjectType.h
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
StateLessPT_NewConfig.primary
primary
Definition: StateLessPT_NewConfig.py:228
xAOD::Iso::ptvarcone_Nonprompt_All_MaxWeightTTVALooseCone_pt1000
@ ptvarcone_Nonprompt_All_MaxWeightTTVALooseCone_pt1000
Definition: IsolationFlavour.h:42
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
CP::IsolationCloseByCorrectionTool::deltaR2
float deltaR2(const xAOD::IParticle *particle, const xAOD::IParticle *particle1, bool AvgCalo=false) const
Definition: IsolationCloseByCorrectionTool.cxx:946
asg::AsgToolConfig
an object that can create a AsgTool
Definition: AsgToolConfig.h:22
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
asg::AcceptInfo
Definition: AcceptInfo.h:28
IsolationSelectionTool.h
SG::Decorator
Helper class to provide type-safe access to aux data.
Definition: Decorator.h:59
CP::IsolationCloseByCorrectionTool::m_coreConeEl
Gaudi::Property< float > m_coreConeEl
Definition: IsolationCloseByCorrectionTool.h:224
CP::IsolationCloseByCorrectionTool::coneSize
float coneSize(const xAOD::IParticle *particle, IsoType Cone) const
Definition: IsolationCloseByCorrectionTool.cxx:902
HepMC::flow
int flow(const T &a, int i)
Definition: Flow.h:51
IsoCloseByCorrectionTest.containers
containers
Associate the close-by pflow objects and the calorimeter clusters.
Definition: IsoCloseByCorrectionTest.py:82
xAOD::CaloCluster_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition: CaloCluster_v1.cxx:251
lumiFormat.i
int i
Definition: lumiFormat.py:85
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
xAOD::P4Helpers::deltaR
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi
Definition: xAODP4Helpers.h:150
CP::IsolationCloseByCorrectionTool::particleName
static std::string particleName(const xAOD::IParticle *C)
Definition: IsolationCloseByCorrectionTool.cxx:986
CP::IsolationCloseByCorrectionTool::ObjectCache::flows
PflowSet flows
Definition: IsolationCloseByCorrectionTool.h:92
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CP::IsolationCloseByCorrectionTool::getCloseByCorrectionPflowIso
CorrectionCode getCloseByCorrectionPflowIso(const EventContext &ctx, const xAOD::IParticle *primary, const IsoType type, const ObjectCache &cache, float &isoValue) const
Definition: IsolationCloseByCorrectionTool.cxx:588
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
CP::IsolationCloseByCorrectionTool::passFirstStage
bool passFirstStage(const xAOD::TrackParticle *trk, const xAOD::Vertex *vtx) const
The Track particle has to pass the Track selection tool and the TTVA selection.
Definition: IsolationCloseByCorrectionTool.cxx:424
xAOD::Iso::IsolationType
IsolationType
Overall enumeration for isolation types in xAOD files.
Definition: IsolationType.h:26
CP::IsolationCloseByCorrectionTool::printIsolationCones
void printIsolationCones(const IsoVector &types, xAOD::Type::ObjectType T) const
Definition: IsolationCloseByCorrectionTool.cxx:1018
TauGNNUtils::Variables::Track::dPhi
bool dPhi(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:538
xAOD::Iso::ptcone_Nonprompt_All_MaxWeightTTVALooseCone_pt500
@ ptcone_Nonprompt_All_MaxWeightTTVALooseCone_pt500
ptcone for high mu
Definition: IsolationFlavour.h:45
AsgToolConfig.h
CP::IsolationCloseByCorrectionTool::isFixedTrackIsoTTVA
static bool isFixedTrackIsoTTVA(xAOD::Iso::IsolationType type)
Definition: IsolationCloseByCorrectionTool.cxx:1001
xAOD::Egamma_v1::caloCluster
const xAOD::CaloCluster * caloCluster(size_t index=0) const
Pointer to the xAOD::CaloCluster/s that define the electron candidate.
Definition: Egamma_v1.cxx:388
xAOD::Iso::ptcone_Nonprompt_All_MaxWeightTTVA_pt500
@ ptcone_Nonprompt_All_MaxWeightTTVA_pt500
ptcone for high mu
Definition: IsolationFlavour.h:38
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition: TrackingPrimitives.h:571
CP::IsolationCloseByCorrectionTool::isPFlowIso
static bool isPFlowIso(xAOD::Iso::IsolationType type)
Definition: IsolationCloseByCorrectionTool.cxx:1032
AthenaPoolTestRead.acc
acc
Definition: AthenaPoolTestRead.py:16
CP::IsolationCloseByCorrectionTool::m_photKeys
Gaudi::Property< std::vector< std::string > > m_photKeys
Definition: IsolationCloseByCorrectionTool.h:258
python.xAODType.dummy
dummy
Definition: xAODType.py:4
CP::IsolationCloseByCorrectionTool::m_caloExtTool
ToolHandle< Trk::IParticleCaloExtensionTool > m_caloExtTool
calo extension tool for muon track particle extrapolation to calo
Definition: IsolationCloseByCorrectionTool.h:266
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
hist_file_dump.f
f
Definition: hist_file_dump.py:135
xAOD::Iso::ptvarcone_Nonprompt_All_MaxWeightTTVALooseCone_pt500
@ ptvarcone_Nonprompt_All_MaxWeightTTVALooseCone_pt500
Definition: IsolationFlavour.h:41
xAOD::Iso::ptcone
@ ptcone
Track isolation.
Definition: IsolationFlavour.h:22
xAOD::Egamma_v1::phi
virtual double phi() const override final
The azimuthal angle ( ) of the particle.
Definition: Egamma_v1.cxx:75
xAOD::CaloCluster_v1::phiSample
float phiSample(const CaloSample sampling) const
Retrieve barycenter in a given sample.
Definition: CaloCluster_v1.cxx:547
CP::IsolationCloseByCorrectionTool::unCalibPt
float unCalibPt(const xAOD::IParticle *particle) const
Definition: IsolationCloseByCorrectionTool.cxx:912
CP::IsolationCloseByCorrectionTool::getTrackCandidates
TrackSet getTrackCandidates(const EventContext &ctx, const xAOD::IParticle *particle) const override
Load all TrackParticles associated with the particles in the Container. The particles have to pass th...
Definition: IsolationCloseByCorrectionTool.cxx:455
CP::IsolationCloseByCorrectionTool::getAssociatedTracks
TrackSet getAssociatedTracks(const xAOD::IParticle *P) const
Retrieve all Inner detector tracks associated with the primary particle.
Definition: IsolationCloseByCorrectionTool.cxx:427
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
xAOD::getIsolationAccessor
const SG::AuxElement::Accessor< float > * getIsolationAccessor(Iso::IsolationType type)
Get the Accessor object for a given isolation type.
Definition: getIsolationAccessor.cxx:24
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
CP::IsolationCloseByCorrectionTool::m_hasPflowIso
bool m_hasPflowIso
Switch whether a pflow isolation working point is defined.
Definition: IsolationCloseByCorrectionTool.h:287
CP::IsolationCloseByCorrectionTool::m_selectorTool
ToolHandle< CP::IIsolationSelectionTool > m_selectorTool
Definition: IsolationCloseByCorrectionTool.h:202
CP::IsolationCloseByCorrectionTool::ObjectCache::prim_parts
PrimaryCollection prim_parts
Definition: IsolationCloseByCorrectionTool.h:88
CP::IsolationCloseByCorrectionTool::m_isInitialised
bool m_isInitialised
Definition: IsolationCloseByCorrectionTool.h:292
xAOD::CaloCluster_v1::p4
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition: CaloCluster_v1.cxx:465
xAOD::Iso::isolationFlavour
IsolationFlavour isolationFlavour(IsolationType type)
convert Isolation Type into Isolation Flavour
Definition: IsolationHelpers.h:47
CP::IsolationCloseByCorrectionTool::m_acc_passOR
SelectionAccessor m_acc_passOR
Definition: IsolationCloseByCorrectionTool.h:295
CP::IsolationCloseByCorrectionTool::getExtrapEtaPhi
bool getExtrapEtaPhi(const EventContext &ctx, const xAOD::TrackParticle *tp, float &eta, float &phi) const
helper to get eta,phi of muon extrap
Definition: IsolationCloseByCorrectionTool.cxx:215
CP::IsolationCloseByCorrectionTool::getIsolationTypes
const IsoVector & getIsolationTypes(const xAOD::IParticle *particle) const
Definition: IsolationCloseByCorrectionTool.cxx:300
xAOD::Iso::ptvarcone_Nonprompt_All_MaxWeightTTVA_pt1000
@ ptvarcone_Nonprompt_All_MaxWeightTTVA_pt1000
Definition: IsolationFlavour.h:35
CP::IsolationCloseByCorrectionTool::getCloseByCorrectionTopoIso
CorrectionCode getCloseByCorrectionTopoIso(const EventContext &ctx, const xAOD::IParticle *primary, const IsoType type, const ObjectCache &cache, float &isoValue) const
Definition: IsolationCloseByCorrectionTool.cxx:660
CP::IsolationCloseByCorrectionTool::m_isoDecSuffix
Gaudi::Property< std::string > m_isoDecSuffix
Definition: IsolationCloseByCorrectionTool.h:217
CP::IsolationCloseByCorrectionTool::m_trkselTool
ToolHandle< InDet::IInDetTrackSelectionTool > m_trkselTool
Definition: IsolationCloseByCorrectionTool.h:198
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:29
ReadHandle.h
Handle class for reading from StoreGate.
CP::IsolationCloseByCorrectionTool::caloDecors
static caloDecorNames caloDecors()
Returns an array with the calo cluster decoration ames [0]-> eta, [1]->phi, [2]->energy....
Definition: IsolationCloseByCorrectionTool.cxx:24
weights
Definition: herwig7_interface.h:38
CP::FlowElementPtr
For the flow elements we need a special derivate which also contains the weights.
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:59
CP::IsolationCloseByCorrectionTool::getCloseByIsoCorrection
virtual CorrectionCode getCloseByIsoCorrection(const EventContext &ctx, const xAOD::ElectronContainer *Electrons, const xAOD::MuonContainer *Muons, const xAOD::PhotonContainer *Photons) const override
Definition: IsolationCloseByCorrectionTool.cxx:247
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
CP::IsolationCloseByCorrectionTool::getCloseByCorrectionTrackIso
CorrectionCode getCloseByCorrectionTrackIso(const xAOD::IParticle *primary, const IsoType type, const ObjectCache &cache, float &isoValue) const
Definition: IsolationCloseByCorrectionTool.cxx:548
CP::IsolationCloseByCorrectionTool::ObjectCache
Definition: IsolationCloseByCorrectionTool.h:85
xAOD::Iso::ptcone_Nonprompt_All_MaxWeightTTVALooseCone_pt1000
@ ptcone_Nonprompt_All_MaxWeightTTVALooseCone_pt1000
Definition: IsolationFlavour.h:46
CP::IsolationCloseByCorrectionTool::associateFlowElement
void associateFlowElement(const EventContext &ctx, const xAOD::IParticle *particle, float &eta, float &phi, float &energy) const override
Definition: IsolationCloseByCorrectionTool.cxx:758
CP::IsolationCloseByCorrectionTool::m_ptvarconeRadius
Gaudi::Property< float > m_ptvarconeRadius
Definition: IsolationCloseByCorrectionTool.h:233
xAOD::Photon
Photon_v1 Photon
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Photon.h:17
CP::ClusterSet
std::set< CaloClusterPtr > ClusterSet
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:73
Muon
struct TBPatternUnitContext Muon
CP::IsolationCloseByCorrectionTool::ObjectCache::tracks
TrackSet tracks
Definition: IsolationCloseByCorrectionTool.h:90
IsolationCloseByCorrectionTool.h
CP::CorrectionCode::Ok
@ Ok
The correction was done successfully.
Definition: CorrectionCode.h:38
getIsolationAccessor.h
xAOD::CaloCluster_v1::eSample
float eSample(const CaloSample sampling) const
Definition: CaloCluster_v1.cxx:521
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
python.HLT.Muon.MuonRecoSequences.isLRT
def isLRT(name)
Definition: MuonRecoSequences.py:65
CSV_InDetExporter.old
old
Definition: CSV_InDetExporter.py:145
CP::IsolationCloseByCorrectionTool::m_VtxKey
SG::ReadHandleKey< xAOD::VertexContainer > m_VtxKey
Definition: IsolationCloseByCorrectionTool.h:272
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
xAOD::IParticle::eta
virtual double eta() const =0
The pseudorapidity ( ) of the particle.
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
CP::IsolationCloseByCorrectionTool::subtractCloseByContribution
CorrectionCode subtractCloseByContribution(const EventContext &ctx, const xAOD::IParticle *P, const ObjectCache &cache) const
Definition: IsolationCloseByCorrectionTool.cxx:312
IsolationHelpers.h
CP::IsolationCloseByCorrectionTool::getOriginalIsolation
virtual float getOriginalIsolation(const xAOD::IParticle &P, IsoType type) const override
Definition: IsolationCloseByCorrectionTool.cxx:972
CP::CorrectionCode
Return value from object correction CP tools.
Definition: CorrectionCode.h:31
RunTileMonitoring.clusters
clusters
Definition: RunTileMonitoring.py:133
Root::OR
@ OR
Definition: TGRLCollection.h:32
CP::IsolationCloseByCorrectionTool::m_quality_name
Gaudi::Property< std::string > m_quality_name
Definition: IsolationCloseByCorrectionTool.h:207
CP::IsolationCloseByCorrectionTool::isTrackIso
static bool isTrackIso(xAOD::Iso::IsolationType type)
Definition: IsolationCloseByCorrectionTool.cxx:997
xAOD::Egamma_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: Egamma_v1.cxx:65
CP::IsolationCloseByCorrectionTool::caloDecorNames
std::array< std::string, 4 > caloDecorNames
Definition: IsolationCloseByCorrectionTool.h:45
xAOD::Iso::numIsolationTypes
@ numIsolationTypes
Definition: IsolationType.h:118
CP::IsolationCloseByCorrectionTool::acceptCorrected
virtual asg::AcceptData acceptCorrected(const xAOD::IParticle &x, const xAOD::IParticleContainer &closePar) const override
Definition: IsolationCloseByCorrectionTool.cxx:850
CP::IsolationCloseByCorrectionTool::getAssociatedClusters
ClusterSet getAssociatedClusters(const EventContext &ctx, const xAOD::IParticle *particle) const
Loads the topo clusters associated with the primary IParticle.
Definition: IsolationCloseByCorrectionTool.cxx:466
CorrectionCode.h
xAOD::Egamma_v1::eta
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
Definition: Egamma_v1.cxx:70
CP::IsolationCloseByCorrectionTool::overlap
bool overlap(const xAOD::IParticle *particle, const xAOD::IParticle *particle1, float dR) const
Definition: IsolationCloseByCorrectionTool.cxx:960
CP::MinClusterEnergy
constexpr float MinClusterEnergy
Definition: IsolationCloseByCorrectionTool.cxx:32
IParticleHelpers.h
CP::IsolationCloseByCorrectionTool::m_dec_isoselection
SelectionDecorator m_dec_isoselection
Definition: IsolationCloseByCorrectionTool.h:296
CP::strObj::pt
float pt
Definition: IsolationCondition.h:24
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
xAOD::getOriginalObject
const IParticle * getOriginalObject(const IParticle &copy)
This function can be used to conveniently get a pointer back to the original object from which a copy...
Definition: IParticleHelpers.cxx:140
Trk::CaloExtension::caloLayerIntersections
const std::vector< CurvilinearParameters > & caloLayerIntersections() const
access to the intersections with the calorimeter layers.
Definition: CaloExtension.h:76
xAOD::CaloCluster_v1::hasSampling
bool hasSampling(const CaloSample s) const
Checks if certain smapling contributes to cluster.
Definition: CaloCluster_v1.h:890
CheckAppliedSFs.WPs
WPs
Definition: CheckAppliedSFs.py:206
asg::AcceptData
Definition: AcceptData.h:30
TauGNNUtils::Variables::Track::dEta
bool dEta(const xAOD::TauJet &tau, const xAOD::TauTrack &track, double &out)
Definition: TauGNNUtils.cxx:527
python.PyAthena.obj
obj
Definition: PyAthena.py:132
CP::IsolationCloseByCorrectionTool::isoRefParticle
const xAOD::IParticle * isoRefParticle(const xAOD::IParticle *particle) const override
Retrieve the reference particle to define the cone axis in which the track particles contributing to ...
Definition: IsolationCloseByCorrectionTool.cxx:925
CP::IsolationCloseByCorrectionTool::getCloseByCorrection
virtual CorrectionCode getCloseByCorrection(std::vector< float > &corrections, const xAOD::IParticle &par, const std::vector< xAOD::Iso::IsolationType > &types, const xAOD::IParticleContainer &closePar) const override
Definition: IsolationCloseByCorrectionTool.cxx:372
CaloNoise_fillDB.mu
mu
Definition: CaloNoise_fillDB.py:53
xAOD::bool
setBGCode setTAP setLVL2ErrorBits bool
Definition: TrigDecision_v1.cxx:60
xAOD::Iso::coneSize
float coneSize(IsolationConeSize type)
convert Isolation Size into cone size
Definition: IsolationHelpers.h:27
CP::IsolationCloseByCorrectionTool::isVarTrackIso
static bool isVarTrackIso(xAOD::Iso::IsolationType type)
Definition: IsolationCloseByCorrectionTool.cxx:996
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
CP::IsolationCloseByCorrectionTool::declareDependency
void declareDependency(const std::vector< std::string > &containers, const IsoVector &types)
Helper function to declare the data dependencies.
Definition: IsolationCloseByCorrectionTool.cxx:118
xAOD::Iso::ptcone_Nonprompt_All_MaxWeightTTVA_pt1000
@ ptcone_Nonprompt_All_MaxWeightTTVA_pt1000
Definition: IsolationFlavour.h:39
CP::IsolationCloseByCorrectionTool::isoTypesFromWP
void isoTypesFromWP(const std::vector< std::unique_ptr< IsolationWP >> &WP, IsoVector &types)
Helper function to load all Isolation types from the iso working points.
Definition: IsolationCloseByCorrectionTool.cxx:97
CP::IsolationCloseByCorrectionTool::trackPtCut
static float trackPtCut(xAOD::Iso::IsolationType type)
Definition: IsolationCloseByCorrectionTool.cxx:1022
xAOD::CaloCluster_v1::e
virtual double e() const
The total energy of the particle.
Definition: CaloCluster_v1.cxx:265
xAOD::Iso::ptvarcone_Nonprompt_All_MaxWeightTTVA_pt500
@ ptvarcone_Nonprompt_All_MaxWeightTTVA_pt500
ptvarcone for high mu
Definition: IsolationFlavour.h:34
CP::IsoVector
std::vector< IsoType > IsoVector
Definition: PhysicsAnalysis/AnalysisCommon/IsolationSelection/IsolationSelection/Defs.h:37
CP::IsolationCloseByCorrectionTool::m_isoVarKeys
SG::ReadDecorHandleKeyArray< xAOD::IParticleContainer > m_isoVarKeys
Definition: IsolationCloseByCorrectionTool.h:260
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
InDetDD::electrons
@ electrons
Definition: InDetDD_Defs.h:17
CP::strObj::eta
float eta
Definition: IsolationCondition.h:25
xAOD::FlowElement_v1
A detector object made of other lower level object(s)
Definition: FlowElement_v1.h:25
CP::strObj::type
xAOD::Type::ObjectType type
Definition: IsolationCondition.h:27