ATLAS Offline Software
InsituTrackTools.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 #include <cmath>
8 
9 namespace Muon {
10  InsituTrackTools::InsituTrackTools(const std::string& t, const std::string& n, const IInterface* p ):
11  AthAlgTool(t,n,p)
12  {
13  declareInterface<IInsituTrackTools>(this);
14 
15  declareProperty("InnerTrackContainerName", m_InnerTrackContainerName = "TrackParticleCandidate");
16  declareProperty("ConeJetContainerName", m_ConeJetContainerName = "Cone4H1TowerJets");
17  declareProperty("m_MaximalMassDifferenceToZBoson", m_MaximalMassDifferenceToZBoson = 20000.); // MeV
18  declareProperty("m_MaximalPTofTracksInCone", m_MaximalPTofTracksInCone = 15000.); // MeV
19  declareProperty("m_MaximalNumberofTracksInCone", m_MaximalNumberofTracksInCone = 5);
20  declareProperty("m_MaximalJetEnergyInCone", m_MaximalJetEnergyInCone = 25000.); // MeV
21 
22  }
23 
25  {
27  if (isCloseTrack(track1, track2)==true) return false;
28 
30  if (std::abs(getInvariantMass(track1, track2)-91187.6)>m_MaximalMassDifferenceToZBoson) return false;
31 
32  if ((isIsolatedTrack(track1)==true) && (isIsolatedTrack(track2)==true)) return true;
33  return false;
34  }
35 
37  {
38  float TrackPTIsolation1 = 0.0;
39  int NIsolation1 = 0;
40  getTrackIsolation(track1, TrackPTIsolation1, NIsolation1);
41 
42  if ((TrackPTIsolation1<m_MaximalPTofTracksInCone) && (NIsolation1<m_MaximalNumberofTracksInCone)) return true;
43  return false;
44  }
45 
47  {
48  float JetIsolation1 = getJetIsolation(track1);
49  float TrackPTIsolation1 = 0.0;
50  int NIsolation1 = 0;
51  getTrackIsolation(track1, TrackPTIsolation1, NIsolation1);
52 
53  if ((JetIsolation1<m_MaximalJetEnergyInCone) && (TrackPTIsolation1<m_MaximalPTofTracksInCone) && (NIsolation1<m_MaximalNumberofTracksInCone)) return true;
54  return false;
55  }
56 
58  {
59  TLorentzVector tvec1;
60  TLorentzVector tvec2;
61  tvec1.SetPtEtaPhiM(track1->pt(), track1->eta(), track1->phi(), 105.65);
62  tvec2.SetPtEtaPhiM(track2->pt(), track2->eta(), track2->phi(), 105.65);
63  return (tvec1+tvec2).M();
64  }
65 
67  {
68  return true;
69  }
70 
72  {
73  return true;
74  }
75 
77  {
78  return false;
79  }
80 
82  {
83  if (getDistance(track1, track2)<0.4) return true;
84  return false;
85  }
86 
88  {
89  double dphi = std::abs(track1->phi()-track2->phi());
90  if (dphi>M_PI) dphi = std::abs(dphi-2.0*M_PI);
91  return std::sqrt(std::pow(track1->eta()-track2->eta(),2)+std::pow(dphi,2));
92  }
93 
94  bool InsituTrackTools::getTrackIsolation(const INavigable4Momentum *trackParticle, float &PtIsolation, int &NIsolation)
95  {
96  const Rec::TrackParticleContainer* trackTES=nullptr;
97  StatusCode sc = evtStore()->retrieve(trackTES, m_InnerTrackContainerName);
98  if (sc.isFailure() || !trackTES) return false;
99 
100  NIsolation = 0;
101  PtIsolation = 0.0;
102 
103  double track_eta = trackParticle->eta();
104  double track_phi = trackParticle->phi();
105 
106  double id_eta = 0.0;
107  double id_phi = 0.0;
108  double dr = 0.0;
110  Rec::TrackParticleContainer::const_iterator trackItr = trackTES->begin();
111  Rec::TrackParticleContainer::const_iterator trackItrE = trackTES->end();
112  for (; trackItr != trackItrE; ++trackItr)
113  {
114 
115  id_eta = (*trackItr)->eta();
116  id_phi = (*trackItr)->phi();
117 
118  dr = std::sqrt(std::pow(id_eta-track_eta,2)+std::pow(id_phi-track_phi,2));
119  if ((0.01<dr) && (dr<0.4))
120  {
121  NIsolation++;
122  PtIsolation+=(*trackItr)->pt();
123  }
124  }
125 
126  return true;
127  }
128 
130  {
131  float PtIsolation;
132  int NIsolation;
133  if (getTrackIsolation(trackParticle, PtIsolation, NIsolation)==true) return PtIsolation;
134  return -1.0;
135  }
136 
138  {
139  float PtIsolation;
140  int NIsolation;
141  if (getTrackIsolation(trackParticle, PtIsolation, NIsolation)==true) return NIsolation;
142  return -1;
143  }
144 
145 
147  {
148  const JetCollection* jetTES = nullptr; //ESD Key
149  StatusCode sc = evtStore()->retrieve(jetTES, m_ConeJetContainerName);
150  if (sc.isFailure() || !jetTES) return -1.;
151 
152  double track_eta = trackParticle->eta();
153  double track_phi = trackParticle->phi();
154 
155  double jet_energy = 0.0;
156  double jet_eta = 0.0;
157  double jet_phi = 0.0;
158  double dr = 0.0;
159 
161  JetCollection::const_iterator jetItr = jetTES->begin();
162  JetCollection::const_iterator jetItrE = jetTES->end();
163 
164  for(; jetItr != jetItrE; ++jetItr)
165  {
166  jet_eta = (*jetItr)->eta();
167  jet_phi = (*jetItr)->phi();
168 
169  dr = std::sqrt(std::pow(jet_eta-track_eta,2)+std::pow(jet_phi-track_phi,2));
170  if ((0.01<dr) && (dr<0.4)) jet_energy+=(*jetItr)->pt();
171  }
172 
173  return jet_energy;
174  }
175 }//namespace
Muon::InsituTrackTools::isTriggeredMuon
virtual bool isTriggeredMuon(const INavigable4Momentum *track1) override
Definition: InsituTrackTools.cxx:66
Muon::InsituTrackTools::getTrackPtIsolation
virtual float getTrackPtIsolation(const INavigable4Momentum *trackParticle) override
Definition: InsituTrackTools.cxx:129
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
Muon::InsituTrackTools::isTriggeredElectron
virtual bool isTriggeredElectron(const INavigable4Momentum *track1) override
Definition: InsituTrackTools.cxx:71
Muon::InsituTrackTools::getInvariantMass
virtual double getInvariantMass(const INavigable4Momentum *track1, const INavigable4Momentum *track2) override
Definition: InsituTrackTools.cxx:57
INavigable4Momentum.h
Muon::InsituTrackTools::m_ConeJetContainerName
std::string m_ConeJetContainerName
Definition: InsituTrackTools.h:85
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
M_PI
#define M_PI
Definition: ActiveFraction.h:11
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition: TrackSystemController.h:45
Muon::InsituTrackTools::getDistance
virtual double getDistance(const INavigable4Momentum *track1, const INavigable4Momentum *track2) override
Definition: InsituTrackTools.cxx:87
I4Momentum::pt
virtual double pt() const =0
transverse momentum
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
Muon::InsituTrackTools::m_InnerTrackContainerName
std::string m_InnerTrackContainerName
member variables for algorithm properties:
Definition: InsituTrackTools.h:84
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
I4Momentum::eta
virtual double eta() const =0
pseudo rapidity
Muon::InsituTrackTools::m_MaximalMassDifferenceToZBoson
double m_MaximalMassDifferenceToZBoson
Cut variables.
Definition: InsituTrackTools.h:88
InsituTrackTools.h
Muon::InsituTrackTools::getTrackIsolation
virtual bool getTrackIsolation(const INavigable4Momentum *trackParticle, float &PtIsolation, int &NIsolation) override
Definition: InsituTrackTools.cxx:94
I4Momentum::phi
virtual double phi() const =0
phi in [-pi,pi[
Muon::InsituTrackTools::isCloseTrack
virtual bool isCloseTrack(const INavigable4Momentum *track1, const INavigable4Momentum *track2) override
Definition: InsituTrackTools.cxx:81
Muon::InsituTrackTools::m_MaximalJetEnergyInCone
double m_MaximalJetEnergyInCone
Definition: InsituTrackTools.h:91
Rec::TrackParticleContainer
Definition: Reconstruction/Particle/Particle/TrackParticleContainer.h:33
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
Muon::InsituTrackTools::InsituTrackTools
InsituTrackTools(const std::string &, const std::string &, const IInterface *)
Definition: InsituTrackTools.cxx:10
Muon::InsituTrackTools::isZBosonCandidate
virtual bool isZBosonCandidate(const INavigable4Momentum *track1, const INavigable4Momentum *track2) override
Definition: InsituTrackTools.cxx:24
JetCollection
Container for Jets
Definition: JetCollection.h:30
INavigable4Momentum
Definition: INavigable4Momentum.h:21
Muon::InsituTrackTools::isIsolatedTrack
virtual bool isIsolatedTrack(const INavigable4Momentum *track1) override
Definition: InsituTrackTools.cxx:36
Muon::InsituTrackTools::m_MaximalNumberofTracksInCone
double m_MaximalNumberofTracksInCone
Definition: InsituTrackTools.h:90
Trk::jet_phi
@ jet_phi
Definition: JetVtxParamDefs.h:28
Muon::InsituTrackTools::getJetIsolation
virtual float getJetIsolation(const INavigable4Momentum *trackParticle) override
Definition: InsituTrackTools.cxx:146
AthAlgTool
Definition: AthAlgTool.h:26
Muon::InsituTrackTools::isIsolatedMuon
virtual bool isIsolatedMuon(const INavigable4Momentum *track1) override
Definition: InsituTrackTools.cxx:46
Muon::InsituTrackTools::m_MaximalPTofTracksInCone
double m_MaximalPTofTracksInCone
Definition: InsituTrackTools.h:89
pow
constexpr int pow(int base, int exp) noexcept
Definition: ap_fixedTest.cxx:15
Muon::InsituTrackTools::getNTrackIsolation
virtual int getNTrackIsolation(const INavigable4Momentum *trackParticle) override
Definition: InsituTrackTools.cxx:137
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Muon::InsituTrackTools::isElectronCandidate
virtual bool isElectronCandidate(const INavigable4Momentum *track1) override
Definition: InsituTrackTools.cxx:76