ATLAS Offline Software
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 
10 namespace Egamma{
11 
12 TrackPlots::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 
139 
140  if(electron.trackParticleSummaryValue(eprobht,xAOD::eProbabilityHT)){
141  eProbHT->Fill(eprobht, weight);
142  }
143 
146  float totalTRTratio= (numTotalTRTHits != 0) ? float(numTotalTRTHighThresholdHits)/float(numTotalTRTHits) : 0;
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);
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 }
Egamma::TrackPlots::si
TH1 * si
Definition: TrackPlots.h:31
TrackPlots.h
Egamma::TrackPlots::Set_d0sig_nBins
void Set_d0sig_nBins(unsigned d0sig_nBins)
Definition: TrackPlots.cxx:66
Egamma::RetrieveHitInfo
uint8_t RetrieveHitInfo(const xAOD::Electron &el, xAOD::SummaryType info, uint8_t defaultval)
Definition: EgammaPhysValHistUtilities.cxx:9
PlotBase
Definition: PlotBase.h:34
Egamma::TrackPlots::z0
TH1 * z0
Definition: TrackPlots.h:26
xAOD::uint8_t
uint8_t
Definition: Muon_v1.cxx:557
Egamma::TrackPlots::trt_xe
TH1 * trt_xe
Definition: TrackPlots.h:33
Egamma::TrackPlots::d0significance
TH1 * d0significance
Definition: TrackPlots.h:27
index
Definition: index.py:1
Egamma::TrackPlots::fill
void fill(const xAOD::Electron &electron, const xAOD::EventInfo &eventInfo)
Definition: TrackPlots.cxx:93
Egamma
Definition: ClusMomentumPlots.cxx:11
python.copyTCTOutput.sDir
sDir
Definition: copyTCTOutput.py:60
Egamma::TrackPlots::TrackPlots
TrackPlots(PlotBase *pParent, const std::string &sDir, std::string sParticleType)
Definition: TrackPlots.cxx:12
Egamma::TrackPlots::m_sParticleType
std::string m_sParticleType
Definition: TrackPlots.h:21
Egamma::TrackPlots::trtratio
TH2 * trtratio
Definition: TrackPlots.h:41
xAOD::numberOfTRTXenonHits
@ numberOfTRTXenonHits
number of TRT hits on track in straws with xenon [unit8_t].
Definition: TrackingPrimitives.h:284
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
xAOD::TrackingHelpers::d0significance
double d0significance(const xAOD::TrackParticle *tp, double d0_uncert_beam_spot_2)
Definition: TrackParticlexAODHelpers.cxx:42
Egamma::TrackPlots::dphirescaled
TH1 * dphirescaled
Definition: TrackPlots.h:37
Egamma::TrackPlots::sct
TH1 * sct
Definition: TrackPlots.h:30
Egamma::TrackPlots::trthtvseta
TH2 * trthtvseta
Definition: TrackPlots.h:43
PlotBase::Book2D
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
ElectronxAODHelpers.h
xAOD::EventInfo_v1::beamPosSigmaX
float beamPosSigmaX() const
The width of the beam spot in the X direction.
xAOD::numberOfPixelHits
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
Definition: TrackingPrimitives.h:259
xAOD::numberOfTRTHits
@ numberOfTRTHits
number of TRT hits [unit8_t].
Definition: TrackingPrimitives.h:275
xAOD::LastMeasurement
@ LastMeasurement
Parameter defined at the position of the last measurement.
Definition: TrackingPrimitives.h:215
Egamma::TrackPlots::Set_d0_Bins
void Set_d0_Bins(const std::vector< double > &d0Range)
Definition: TrackPlots.cxx:76
Egamma::TrackPlots::d0
TH1 * d0
Definition: TrackPlots.h:25
Egamma::TrackPlots::m_d0Range
std::vector< double > m_d0Range
Definition: TrackPlots.h:48
Egamma::TrackPlots::Set_z0_nBins
void Set_z0_nBins(unsigned z0_nBins)
Definition: TrackPlots.cxx:71
xAOD::numberOfTRTHighThresholdHits
@ numberOfTRTHighThresholdHits
number of TRT hits which pass the high threshold (only xenon counted) [unit8_t].
Definition: TrackingPrimitives.h:278
Egamma::TrackPlots::m_z0Range
std::vector< double > m_z0Range
Definition: TrackPlots.h:50
Egamma::TrackPlots::trt_ht
TH1 * trt_ht
Definition: TrackPlots.h:35
Egamma::TrackPlots::dphi
TH1 * dphi
Definition: TrackPlots.h:24
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
PlotBase::Book1D
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
Egamma::TrackPlots::trt_total
TH1 * trt_total
Definition: TrackPlots.h:34
xAOD::numberOfTRTHighThresholdOutliers
@ numberOfTRTHighThresholdOutliers
number of TRT high threshold outliers (only xenon counted) [unit8_t].
Definition: TrackingPrimitives.h:281
Egamma::TrackPlots::blayer
TH1 * blayer
Definition: TrackPlots.h:28
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
Egamma::TrackPlots::eProbHT
TH1 * eProbHT
Definition: TrackPlots.h:38
Egamma::TrackPlots::EoverP
TH1 * EoverP
Definition: TrackPlots.h:40
Egamma::TrackPlots::trtvseta
TH2 * trtvseta
Definition: TrackPlots.h:42
AllowedVariables::d0significance
@ d0significance
Definition: AsgElectronSelectorTool.cxx:50
TRT::Track::d0
@ d0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:62
xAOD::EgammaParameters::deltaPhiRescaled2
@ deltaPhiRescaled2
difference between the cluster phi (second sampling) and the phi of the track extrapolated to the sec...
Definition: EgammaEnums.h:225
Egamma::TrackPlots::deta
TH1 * deta
Definition: TrackPlots.h:23
TRT::Track::z0
@ z0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:63
Egamma::TrackPlots::Set_d0sig_Bins
void Set_d0sig_Bins(const std::vector< double > &d0sigRange)
Definition: TrackPlots.cxx:80
Egamma::TrackPlots::m_d0_nBins
unsigned m_d0_nBins
Definition: TrackPlots.h:45
xAOD::EventInfo_v1::beamPosSigmaY
float beamPosSigmaY() const
The width of the beam spot in the Y direction.
Egamma::TrackPlots::m_d0sigRange
std::vector< double > m_d0sigRange
Definition: TrackPlots.h:49
Egamma::TrackPlots::trt_ht_total
TH1 * trt_ht_total
Definition: TrackPlots.h:36
Egamma::TrackPlots::Set_z0_Bins
void Set_z0_Bins(const std::vector< double > &z0Range)
Definition: TrackPlots.cxx:85
xAOD::EgammaParameters::deltaPhi2
@ deltaPhi2
difference between the cluster phi (second sampling) and the phi of the track extrapolated to the sec...
Definition: EgammaEnums.h:204
xAOD::Electron_v1
Definition: Electron_v1.h:34
Egamma::TrackPlots::pixel
TH1 * pixel
Definition: TrackPlots.h:29
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
xAOD::numberOfTRTOutliers
@ numberOfTRTOutliers
number of TRT outliers [unit8_t].
Definition: TrackingPrimitives.h:276
Egamma::TrackPlots::deltaPoverP
TH1 * deltaPoverP
Definition: TrackPlots.h:39
DeMoScan.index
string index
Definition: DeMoScan.py:364
xAOD::EventInfo_v1::beamPosSigmaXY
float beamPosSigmaXY() const
The beam spot shape's X-Y correlation.
xAOD::EgammaParameters::electron
@ electron
Definition: EgammaEnums.h:18
xAOD::eProbabilityHT
@ eProbabilityHT
Electron probability from High Threshold (HT) information [float].
Definition: TrackingPrimitives.h:301
xAOD::numberOfSCTHits
@ numberOfSCTHits
number of hits in SCT [unit8_t].
Definition: TrackingPrimitives.h:268
Egamma::TrackPlots::trt
TH1 * trt
Definition: TrackPlots.h:32
Egamma::TrackPlots::m_d0sig_nBins
unsigned m_d0sig_nBins
Definition: TrackPlots.h:46
Egamma::TrackPlots::initializePlots
virtual void initializePlots()
Definition: TrackPlots.cxx:38
AllowedVariables::EoverP
@ EoverP
Definition: AsgElectronSelectorTool.cxx:56
xAOD::EgammaParameters::deltaEta1
@ deltaEta1
difference between the cluster eta (first sampling) and the eta of the track extrapolated to the firs...
Definition: EgammaEnums.h:184
Egamma::TrackPlots::Set_d0_nBins
void Set_d0_nBins(unsigned d0_nBins)
Definition: TrackPlots.cxx:62
xAOD::EventInfo_v1::beamSpotWeight
float beamSpotWeight() const
Weight for beam spot size reweighting.
Definition: EventInfo_v1.cxx:970
readCCLHist.float
float
Definition: readCCLHist.py:83
Egamma::TrackPlots::m_z0_nBins
unsigned m_z0_nBins
Definition: TrackPlots.h:47
SiliconTech::pixel
@ pixel
xAOD::numberOfInnermostPixelLayerHits
@ numberOfInnermostPixelLayerHits
these are the hits in the 0th pixel barrel layer
Definition: TrackingPrimitives.h:237