ATLAS Offline Software
TracksInCone.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // ======================================================================
6 // TracksInCone
7 // James.Catmore@cern.ch
8 // Given an xAOD::IParticle and an IDTrackParticle container, checks
9 // which tracks are in a cone of a given size around the IParticle. Sets
10 // a mask accordingly. Intended for thinning use.
11 // ======================================================================
12 #pragma once
13 
14 #include "xAODBase/IParticle.h"
17 
18 namespace DerivationFramework {
19  struct TracksInCone{
20 
21  void select(const xAOD::IParticle* particle, float coneSize, const xAOD::TrackParticleContainer* tracks, std::vector<bool> &mask) {
22  float particleEta = particle->eta();
23  float particlePhi = particle->phi();
24  unsigned int i(0);
25  for (xAOD::TrackParticleContainer::const_iterator trIt = tracks->begin(); trIt!=tracks->end(); ++trIt, ++i) {
26  float deltaEta = (*trIt)->eta() - particleEta;
27  float deltaPhi = fabs((*trIt)->phi() - particlePhi);
28  if (deltaPhi > TMath::Pi()) deltaPhi = 2.0*TMath::Pi() - deltaPhi;
29  float deltaR = sqrt(deltaEta*deltaEta + deltaPhi*deltaPhi);
30  if (deltaR < coneSize) mask[i] = true;
31  }
32  return;
33  }
34 
35  // Extend the functionality to tau tracks for consistency (TauTrackParticleThinning),
36  // although it's not recommended to select tau tracks based on dR;
37  // the selection should only rely on the tau track classification
38  void select(const xAOD::IParticle* particle, float coneSize, const xAOD::TauTrackContainer* tracks, std::vector<bool> &mask) {
39  float particleEta = particle->eta();
40  float particlePhi = particle->phi();
41  unsigned int i(0);
42  for (xAOD::TauTrackContainer::const_iterator trIt = tracks->begin(); trIt!=tracks->end(); ++trIt, ++i) {
43  float deltaEta = (*trIt)->eta() - particleEta;
44  float deltaPhi = fabs((*trIt)->phi() - particlePhi);
45  if (deltaPhi > TMath::Pi()) deltaPhi = 2.0*TMath::Pi() - deltaPhi;
46  float deltaR = sqrt(deltaEta*deltaEta + deltaPhi*deltaPhi);
47  if (deltaR < coneSize) mask[i] = true;
48  }
49  return;
50  }
51  };
52 }
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
IParticle.h
xAOD::deltaPhi
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
Definition: L2StandAloneMuon_v1.cxx:160
TauTrackContainer.h
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
DerivationFramework::TracksInCone::select
void select(const xAOD::IParticle *particle, float coneSize, const xAOD::TauTrackContainer *tracks, std::vector< bool > &mask)
Definition: TracksInCone.h:38
P4Helpers::deltaEta
double deltaEta(const I4Momentum &p1, const I4Momentum &p2)
Computes efficiently .
Definition: P4Helpers.h:66
lumiFormat.i
int i
Definition: lumiFormat.py:85
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DerivationFramework::TracksInCone
Definition: TracksInCone.h:19
DerivationFramework::TracksInCone::select
void select(const xAOD::IParticle *particle, float coneSize, const xAOD::TrackParticleContainer *tracks, std::vector< bool > &mask)
Definition: TracksInCone.h:21
xAOD::Iso::coneSize
float coneSize(IsolationConeSize type)
convert Isolation Size into cone size
Definition: IsolationHelpers.h:27
makeComparison.deltaR
float deltaR
Definition: makeComparison.py:36
TrackParticleContainer.h
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.