ATLAS Offline Software
Loading...
Searching...
No Matches
TrackPlots.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include <utility>
6
7#include "TrackPlots.h"
9
10namespace Egamma{
11
12TrackPlots::TrackPlots(PlotBase* pParent, const std::string& sDir, std::string sParticleType):PlotBase(pParent, sDir),
13 m_sParticleType(std::move(sParticleType)),
14 deta(nullptr),
15 dphi(nullptr),
16 d0(nullptr),
17 z0(nullptr),
18 d0significance(nullptr),
19 blayer(nullptr),
20 pixel(nullptr),
21 sct(nullptr),
22 si(nullptr),
23 trt(nullptr),
24 trt_xe(nullptr),
25 trt_total(nullptr),
26 trt_ht(nullptr),
27 trt_ht_total(nullptr),
28 dphirescaled(nullptr),
29 eProbHT(nullptr),
30 deltaPoverP(nullptr),
31 EoverP(nullptr),
32 trtratio(nullptr),
33 trtvseta(nullptr),
34 trthtvseta(nullptr)
35
36{}
37
39 deta = Book1D("deta", "#Delta#eta_{1} of "+m_sParticleType+";#Delta#eta_{1};Electrons", 100,-0.01, 0.01);
40 dphi = Book1D("dphi", "#Delta#varphi_{2} of "+m_sParticleType+";#Delta#varphi_{2};Electrons", 100,-0.01, 0.01);
41 dphirescaled = Book1D("dphirescaled", "#Delta#varphiRescaled_{2} of "+m_sParticleType+";#Delta#varphiRescaled_{2};Electrons",100,-0.01,0.01);
42 d0 = Book1D("d0", "d0 of "+m_sParticleType+"; d0;Electrons", m_d0_nBins, m_d0Range[0], m_d0Range[1]);
43 z0 = Book1D("z0", "z0 of "+m_sParticleType+"; z0;Electrons", m_z0_nBins, m_z0Range[0], m_z0Range[1]);
44 d0significance = Book1D("d0significance", "d0significance of "+m_sParticleType+"; d0significance;Electrons", m_d0sig_nBins, m_d0sigRange[0], m_d0sigRange[1]);
45 blayer = Book1D("blayer", "#blayer hits of "+m_sParticleType+";# blayer hits;Electrons", 5,0, 5);
46 pixel = Book1D("pixel", "#pixel hits of "+m_sParticleType+";# pixel hits;Electrons", 10, 0, 10);
47 sct = Book1D("sct", "#sct hits of "+m_sParticleType+";# sct hits;Electrons", 25, 0, 25);
48 si = Book1D("si", "#pixel+sct hits of "+m_sParticleType+";# pixel+sct hits;Electrons", 25, 0, 25);
49 trt = Book1D("trt", "#trt hits of "+m_sParticleType+";# trt hits;Electrons", 50, 0, 50);
50 trt_xe = Book1D("trt_xe", "#trt xe hits of "+m_sParticleType+";# trt xe hits;Electrons", 50, 0, 50);
51 trt_total = Book1D("trt_total", "#total trt hits of "+m_sParticleType+";# total trt hits;Electrons", 50, 0, 50);
52 trt_ht = Book1D("trt_ht", "#HT trt hits of "+m_sParticleType+";# HT trt hits;Electrons", 50, 0, 50);
53 trt_ht_total = Book1D("trt_ht_total", "#HT total trt hits of "+m_sParticleType+";# total HT trt hits;Electrons", 50, 0, 50);
54 eProbHT = Book1D("eProbabilityHT", "#eProbablity HT of "+m_sParticleType+";#eProbablity HT;Electrons", 204, -0.01, 1.01);
55 deltaPoverP = Book1D("deltaPoverP", "#DeltaP/P of "+m_sParticleType+";#DeltaP/P;Electrons", 100,-1.1, 1.1);
56 EoverP = Book1D("EoverP", "E/P of "+m_sParticleType+";E/P;Electrons", 100, 0, 10);
57 trtratio = Book2D("trtratio", "TRT ratio vs eta of"+m_sParticleType+";#eta; TRT ratio", 50, -2.5, 2.5,100,0.,1.);
58 trtvseta = Book2D("trtvseta", "#trt hits vs eta of"+m_sParticleType+";#eta; #trt hits", 50, -2.5, 2.5,50,0.,50.);
59 trthtvseta = Book2D("trthtvseta", "#HT trt hits vs eta of"+m_sParticleType+";#eta; #HT trt hits", 50, -2.5, 2.5,50,0.,50.);
60}
61
62 void TrackPlots::Set_d0_nBins(unsigned d0_nBins)
63 {
64 m_d0_nBins = d0_nBins;
65 }
66 void TrackPlots::Set_d0sig_nBins(unsigned d0sig_nBins)
67 {
68 m_d0sig_nBins = d0sig_nBins;
69 }
70
71 void TrackPlots::Set_z0_nBins(unsigned z0_nBins)
72 {
73 m_z0_nBins = z0_nBins;
74 }
75
76 void TrackPlots::Set_d0_Bins(const std::vector<double> &d0Range)
77 {
78 m_d0Range = d0Range;
79 }
80 void TrackPlots::Set_d0sig_Bins(const std::vector<double> &d0sigRange)
81 {
82 m_d0sigRange = d0sigRange;
83 }
84
85 void TrackPlots::Set_z0_Bins(const std::vector<double> &z0Range)
86 {
87 m_z0Range = z0Range;
88 }
89
90
91
92
93 void TrackPlots::fill(const xAOD::Electron& electron, const xAOD::EventInfo& eventInfo) {
94
95 float deta1(0);
96 float dphi2 (0);
97 float dphirescaled2(0);
98 float eprobht(0);
99 float trackqoverp(0);
100 float eoverp(0);
101 double dpOverp(0);
102
103 float weight = 1.;
104 weight = eventInfo.beamSpotWeight();
105
106 if(electron.trackCaloMatchValue(deta1, xAOD::EgammaParameters::deltaEta1 )){
107 deta->Fill(deta1, weight);
108 }
109 if(electron.trackCaloMatchValue(dphi2, xAOD::EgammaParameters::deltaPhi2 )){
110 dphi->Fill(dphi2*electron.trackParticle()->charge(), weight);
111 }
112 if(electron.trackCaloMatchValue(dphirescaled2, xAOD::EgammaParameters::deltaPhiRescaled2 )){
113 dphirescaled->Fill(dphirescaled2, weight);
114 }
115 if(!electron.trackParticle()) return;
116 trackqoverp = electron.trackParticle()->qOverP();
117
118 if(electron.caloCluster()){
119 const double energy = electron.caloCluster()->e();
120 eoverp=std::abs(trackqoverp)*energy;
121 EoverP->Fill(eoverp, weight);
122 }
123 unsigned int index;
124 if( electron.trackParticle()->indexOfParameterAtPosition(index, xAOD::LastMeasurement) ) {
125
126 double refittedTrack_LMqoverp =
127 electron.trackParticle()->charge() / std::sqrt(std::pow(electron.trackParticle()->parameterPX(index), 2) +
128 std::pow(electron.trackParticle()->parameterPY(index), 2) +
129 std::pow(electron.trackParticle()->parameterPZ(index), 2));
130
131 dpOverp = 1 - trackqoverp/(refittedTrack_LMqoverp);
132 deltaPoverP->Fill(dpOverp, weight);
133 }
134
136 pixel->Fill(RetrieveHitInfo(electron, xAOD::numberOfPixelHits), weight);
137 sct->Fill(RetrieveHitInfo(electron, xAOD::numberOfSCTHits), weight);
139
140 if(electron.trackParticleSummaryValue(eprobht,xAOD::eProbabilityHT)){
141 eProbHT->Fill(eprobht, weight);
142 }
143
144 uint8_t numTotalTRTHits = RetrieveHitInfo(electron, xAOD::numberOfTRTHits) + RetrieveHitInfo(electron, xAOD::numberOfTRTOutliers);
145 uint8_t numTotalTRTHighThresholdHits = RetrieveHitInfo(electron, xAOD::numberOfTRTHighThresholdHits) + RetrieveHitInfo(electron, xAOD::numberOfTRTHighThresholdOutliers);
146 float totalTRTratio= (numTotalTRTHits != 0) ? float(numTotalTRTHighThresholdHits)/float(numTotalTRTHits) : 0;
147 trt->Fill(RetrieveHitInfo(electron, xAOD::numberOfTRTHits), weight);
148 trt_xe->Fill(RetrieveHitInfo(electron, xAOD::numberOfTRTXenonHits), weight);
150 trt_total->Fill(numTotalTRTHits, weight);
151 trt_ht_total->Fill(numTotalTRTHighThresholdHits, weight);
152 trtratio->Fill(electron.trackParticle()->eta(),totalTRTratio, weight);
153 trtvseta->Fill(electron.trackParticle()->eta(),RetrieveHitInfo(electron, xAOD::numberOfTRTHits), weight);
154 trthtvseta->Fill(electron.trackParticle()->eta(),RetrieveHitInfo(electron, xAOD::numberOfTRTHighThresholdHits), weight);
155
156 d0->Fill(electron.trackParticle()->d0(), weight);
157 z0->Fill(electron.trackParticle()->z0(), weight);
158
159 double d0sig = xAOD::TrackingHelpers::d0significance( electron.trackParticle() , eventInfo.beamPosSigmaX(), eventInfo.beamPosSigmaY(), eventInfo.beamPosSigmaXY() );
160 d0significance->Fill(d0sig, weight);
161}
162
163}
std::vector< double > m_d0sigRange
Definition TrackPlots.h:49
unsigned m_d0sig_nBins
Definition TrackPlots.h:46
void Set_d0sig_nBins(unsigned d0sig_nBins)
std::string m_sParticleType
Definition TrackPlots.h:21
void Set_d0sig_Bins(const std::vector< double > &d0sigRange)
std::vector< double > m_d0Range
Definition TrackPlots.h:48
unsigned m_d0_nBins
Definition TrackPlots.h:45
unsigned m_z0_nBins
Definition TrackPlots.h:47
std::vector< double > m_z0Range
Definition TrackPlots.h:50
TrackPlots(PlotBase *pParent, const std::string &sDir, std::string sParticleType)
void Set_z0_Bins(const std::vector< double > &z0Range)
void Set_d0_Bins(const std::vector< double > &d0Range)
void Set_d0_nBins(unsigned d0_nBins)
void fill(const xAOD::Electron &electron, const xAOD::EventInfo &eventInfo)
virtual void initializePlots()
void Set_z0_nBins(unsigned z0_nBins)
TH1D * Book1D(const std::string &name, const std::string &labels, int nBins, float start, float end, bool prependDir=true)
Book a TH1D histogram.
Definition PlotBase.cxx:94
PlotBase(PlotBase *parent, const std::string &sDir)
Definition PlotBase.cxx:29
TH2F * Book2D(const std::string &name, const std::string &labels, int nBinsX, float startX, float endX, int nBinsY, float startY, float endY, bool prependDir=true)
Book a TH2F histogram.
Definition PlotBase.cxx:123
float beamPosSigmaY() const
The width of the beam spot in the Y direction.
float beamPosSigmaXY() const
The beam spot shape's X-Y correlation.
float beamSpotWeight() const
Weight for beam spot size reweighting.
float beamPosSigmaX() const
The width of the beam spot in the X direction.
uint8_t RetrieveHitInfo(const xAOD::Electron &el, xAOD::SummaryType info, uint8_t defaultval)
Definition index.py:1
STL namespace.
@ deltaPhiRescaled2
difference between the cluster phi (second sampling) and the phi of the track extrapolated to the sec...
@ deltaPhi2
difference between the cluster phi (second sampling) and the phi of the track extrapolated to the sec...
@ deltaEta1
difference between the cluster eta (first sampling) and the eta of the track extrapolated to the firs...
double d0significance(const xAOD::TrackParticle *tp, double d0_uncert_beam_spot_2)
EventInfo_v1 EventInfo
Definition of the latest event info version.
@ numberOfTRTHighThresholdOutliers
number of TRT high threshold outliers (only xenon counted) [unit8_t].
@ numberOfTRTXenonHits
number of TRT hits on track in straws with xenon [unit8_t].
@ numberOfTRTHits
number of TRT hits [unit8_t].
@ eProbabilityHT
Electron probability from High Threshold (HT) information [float].
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfInnermostPixelLayerHits
these are the hits in the 0th pixel barrel layer
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
@ numberOfTRTHighThresholdHits
number of TRT hits which pass the high threshold (only xenon counted) [unit8_t].
@ numberOfTRTOutliers
number of TRT outliers [unit8_t].
Electron_v1 Electron
Definition of the current "egamma version".
@ LastMeasurement
Parameter defined at the position of the last measurement.