From a1e3560f2cb79bf1ede43454a75222ba104ab175 Mon Sep 17 00:00:00 2001
From: Johannes Josef Junggeburth <johannes.josef.junggeburth@CERN.CH>
Date: Sat, 5 Sep 2020 20:02:42 +0200
Subject: [PATCH] Add d0 vs z0 validation histogram. Fix z0 sin theta bug

---
 .../share/InDetPVMPlotDefCommon.xml           | 68 +++++++++++--------
 .../src/InDetPerfPlot_TrackParameters.cxx     | 24 +++++--
 .../src/InDetPerfPlot_TrackParameters.h       |  3 +
 3 files changed, 59 insertions(+), 36 deletions(-)

diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml
index 72aa64a3a8fd..301f6400d608 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml
@@ -376,7 +376,7 @@
   <y title="Entries"/>
 </h>
 <h id="residualx_pixel_barrel" type="TH1F" title="Residual: Pixel Barrel X">
-  <x title="x residual(#mum)" n="100" lo="-100.0" hi="100.0"/> 
+  <x title="x residual(#mum)" n="100" lo="-100.0" hi="100.0"/>
   <y title="Entries"/>
 </h>
 <h id="residualx_pixel_barrel_1hit" type="TH1F" title="Residual: Pixel Barrel X 1 hit">
@@ -388,7 +388,7 @@
   <y title="Entries"/>
 </h>
 <h id="residualx_sct_barrel" type="TH1F" title="Residual: SCT Barrel X">
-  <x title="x residual(#mum)" n="1200" lo="-600" hi="600"/> 
+  <x title="x residual(#mum)" n="1200" lo="-600" hi="600"/>
   <y title="Entries"/>
 </h>
 <h id="residualx_sct_barrel_1hit" type="TH1F" title="Residual: SCT Barrel X 1 hit">
@@ -401,7 +401,7 @@
 </h>
 <!-- endcaps -->
 <h id="residualx_pixel_endcap" type="TH1F" title="Residual: Pixel Endcap X">
-  <x title="x residual(#mum)" n="100" lo="-100.0" hi="100.0"/> 
+  <x title="x residual(#mum)" n="100" lo="-100.0" hi="100.0"/>
   <y title="Entries"/>
 </h>
 <h id="residualx_pixel_endcap_1hit" type="TH1F" title="Residual: Pixel Endcap X 1 hit">
@@ -413,7 +413,7 @@
   <y title="Entries"/>
 </h>
 <h id="residualx_sct_endcap" type="TH1F" title="Residual: SCT Endcap X">
-  <x title="x residual(#mum)" n="1200" lo="-600" hi="600"/> 
+  <x title="x residual(#mum)" n="1200" lo="-600" hi="600"/>
   <y title="Entries"/>
 </h>
 <h id="residualx_sct_endcap_1hit" type="TH1F" title="Residual: SCT Endcap X 1 hit">
@@ -439,7 +439,7 @@
   <y title="Entries"/>
 </h>
 <h id="residualy_pixel_barrel" type="TH1F" title="Residual: Pixel Barrel Y">
-  <x title="y residual(#mum)" n="100" lo="-1000.0" hi="1000.0"/> 
+  <x title="y residual(#mum)" n="100" lo="-1000.0" hi="1000.0"/>
   <y title="Entries"/>
 </h>
 <h id="residualy_pixel_barrel_1hit" type="TH1F" title="Residual: Pixel Barrel Y 1 hit">
@@ -464,7 +464,7 @@
 </h>
 <!-- endcaps -->
 <h id="residualy_pixel_endcap" type="TH1F" title="Residual: Pixel Endcap Y">
-  <x title="y residual(#mum)" n="100" lo="-1000.0" hi="1000.0"/> 
+  <x title="y residual(#mum)" n="100" lo="-1000.0" hi="1000.0"/>
   <y title="Entries"/>
 </h>
 <h id="residualy_pixel_endcap_1hit" type="TH1F" title="Residual: Pixel Endcap Y 1 hit">
@@ -625,7 +625,7 @@
 <h id="efficiency_vs_eta" type="TEfficiency" title="Fraction of reco-matched truth track">
   <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
   <y title="Efficiency" lo="0.0" hi="2.0"/>
-</h> 
+</h>
 <h id="efficiency_vs_pt" type="TEfficiency" title="Fraction of reco-matched truth track">
   <x title="p_{T} [GeV]" n="25" lo="0" hi="50"/>
   <y title="Efficiency" lo="0.0" hi="2.0"/>
@@ -674,7 +674,7 @@
 <h id="fakerate_vs_eta" type="TEfficiency" title="Fractions of reco-tracks with matching probability &lt; 50%">
   <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
   <y title="Fake Rate" lo="0.0" hi="2.0"/>
-</h> 
+</h>
 <h id="fakerate_vs_pt" type="TEfficiency" title="Fractions of reco-tracks with matching probability &lt; 50%">
   <x title="p_{T} [GeV]" n="100" lo="0" hi="50.0"/>
   <y title="Fake Rate" lo="0.0" hi="2.0"/>
@@ -945,7 +945,7 @@
   <x title="reco_{z_{0} #times sin} - truth_{z_{0} #times sin}" n="100" lo="-&Z0SINRES;" hi="&Z0SINRES;"/>
   <y title="Number of Entries"/>
 </h>
-     
+
 <h id="sigma_d0" type="TH1F" title="#sigma(d_{0})">
   <x title="#sigma(d_{0}) [mm]" n="100" lo="0" hi="&D0RES;"/>
   <y title="Number of Entries"/>
@@ -1059,7 +1059,7 @@
   <x title="p_{T} [GeV]" n="100" lo="0." hi="100"/>
   <y title="reco_{z_{0} #times sin} - truth_{z_{0} #times sin} [mm]" n="1000" lo="-&Z0SINRES;" hi="&Z0SINRES;"/>
 </h>
-    
+
 
 <h id="pullHelper_eta_d0" type="TH2F" title="pull vs #eta for d_{0}">
   <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/>
@@ -1471,82 +1471,82 @@
 <h id="sigma_vs_eta_d0" type="TProfile" title="#sigma(d_{0}) vs #eta">
   <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/>
   <y title="#sigma(d_{0}) [mm}" lo="-1.5" hi="1.5"/>
-</h> 
+</h>
 
 <h id="sigma_vs_eta_z0" type="TProfile" title="#sigma(z_{0}) vs #eta">
   <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/>
   <y title="#sigma(z_{0}) [mm]" lo="-10.0" hi="10.0"/>
-</h>  
+</h>
 
 <h id="sigma_vs_eta_qoverp" type="TProfile" title="#sigma_{qoverp} vs #eta">
   <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/>
   <y title="#sigma_{qoverp}" lo="-2.5e-5" hi="2.5e-5"/>
-</h>  
+</h>
 
 <h id="sigma_vs_eta_ptqopt" type="TProfile" title="p_{T} #times #sigma(q/p_{T}) vs #eta">
   <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/>
   <y title="p_{T} #times #sigma(q/p_{T})" lo="-15.0" hi="15.0"/>
-</h>  
+</h>
 
 <h id="sigma_vs_eta_pt" type="TProfile" title="#sigma_{pt} vs #eta">
   <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/>
   <y title="#sigma_{pt}" lo="0.0" hi="100"/>
-</h>  
+</h>
 
 <h id="sigma_vs_eta_theta" type="TProfile" title="#sigma(#theta) vs #eta">
   <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/>
   <y title="#sigma(#theta)" lo="-0.01" hi="0.01"/>
-</h>  
+</h>
 
 <h id="sigma_vs_eta_phi" type="TProfile" title="#sigma(#phi) vs #eta">
   <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/>
   <y title="#sigma(#phi) [rads]" lo="-0.01" hi="0.01"/>
-</h>  
+</h>
 
 <h id="sigma_vs_eta_z0sin" type="TProfile" title="#sigma(z_{0} #times sin) vs #eta">
   <x title="#eta" n="&NETA;" lo="-&ETA;" hi="&ETA;"/>
   <y title="#sigma(z_{0} #times sin)" lo="-0.2" hi="0.2"/>
-</h>  
+</h>
 
 <h id="sigma_vs_pt_d0" type="TProfile" title="#sigma(d_{0}) vs p_{T}">
   <x title="p_{T} [GeV]" n="&NETA;" lo="0.0" hi="100"/>
   <y title="#sigma(d_{0}) [mm]" lo="-1.5" hi="1.5"/>
-</h> 
+</h>
 
 <h id="sigma_vs_pt_z0" type="TProfile" title="#sigma(z_{0}) vs p_{T}">
   <x title="p_{T} [GeV]" n="&NETA;" lo="0.0" hi="100"/>
   <y title="#sigma(z_{0}) [mm]" lo="-10.0" hi="10.0"/>
-</h>  
+</h>
 
 <h id="sigma_vs_pt_qoverp" type="TProfile" title="#sigma_{qoverp} vs pT">
   <x title="p_{T} [GeV]"  n="&NETA;" lo="0.0" hi="100"/>
   <y title="#sigma_{qoverp}" lo="-2.5e-5" hi="2.5e-5"/>
-</h>  
+</h>
 
 <h id="sigma_vs_pt_ptqopt" type="TProfile" title="p_{T} #times #sigma(q/p_{T}} vs p_{T}">
   <x title="p_{T} [GeV]" n="&NETA;" lo="0.0" hi="100"/>
   <y title="p_{T} #times #sigma(q/p_{T})" lo="-15.0" hi="15.0"/>
-</h>  
+</h>
 
 <h id="sigma_vs_pt_pt" type="TProfile" title="#sigma_{pt} vs pT">
   <x title="p_{T} [GeV]" n="&NETA;" lo="0.0" hi="100"/>
   <y title="#sigma_{pt}" lo="-100.0" hi="100.0"/>
-</h>  
+</h>
 
 <h id="sigma_vs_pt_theta" type="TProfile" title="#sigma(#theta) vs p_{T}">
   <x title="p_{T} [GeV]" n="&NETA;" lo="0.0" hi="100"/>
   <y title="#sigma(#theta) [rads]" lo="-0.01" hi="0.01" />
-</h>  
+</h>
 
 <h id="sigma_vs_pt_phi" type="TProfile" title="#sigma(phi) vs p_{T}">
   <x title="p_{T} [GeV]" n="&NETA;" lo="0.0" hi="100"/>
   <y title="#sigma(#phi) [rads]" lo="-0.01" hi="0.01"/>
-</h>  
+</h>
 
 <h id="sigma_vs_pt_z0sin" type="TProfile" title="#sigma(z_{0} #times sin) vs p_{T}">
   <x title="p_{T} [GeV]" n="&NETA;" lo="0.0" hi="100"/>
   <y title="#sigma(z_{0} #times sin)" lo="-0.2" hi="0.2"/>
-</h>  
+</h>
 
 
 <!-- End of standard resolution plots-->
@@ -1606,7 +1606,7 @@
   <x title="reco_{#chi^2/ndof}" n="100" lo="0.0" hi="5.0"/>
   <y title="Number of Entries"/>
 </h>
-  
+
 <h id="reco_author" type="TH1F" title="reco_{author}">
   <x title="reco_{author}" n="52" lo="0" hi="52"/>
   <y title="Number of Entries"/>
@@ -1621,6 +1621,16 @@
   <y title="reco_{#eta}" n="100" lo="-&ETA;" hi="&ETA;"/>
 </h>
 
+<h id="reco_d0_vs_z0" type="TH2F" title="reco d_{T} vs z_{0}">
+  <x title="reco_{d_0}" n="100" lo="-20" hi="20"/>
+  <y title="reco_{z_{0}}" n="100" lo="-250" hi="250"/>
+</h>
+
+<h id="reco_d0_vs_z0sin" type="TH2F" title="reco d_{T} vs z_{0} sin #theta">
+  <x title="reco_{d_0}" n="100" lo="-20" hi="20"/>
+  <y title="reco_{z_{0} sin #theta}" n="100" lo="-10" hi="10"/>
+</h>
+
 <h id="truth_d0" type="TH1F" title="truth_{d_{0}}">
   <x title="truth_{d0} [mm]" n="100" lo="-&D0PARA;" hi="&D0PARA;"/>
   <y title="Number of Entries"/>
@@ -1870,7 +1880,7 @@
 <h id="efficiency_vs_dR" type="TEfficiency" title="Fraction of reco-matched truth track versus #DeltaR">
   <x title="#DeltaR" n="40" lo="0.0" hi="&DRMAX;"/>
   <y title="Efficiency" lo="0.0" hi="2.0"/>
-</h> 
+</h>
 
 <h id="efficiency_vs_smalldR" type="TEfficiency" title="Fraction of reco-matched truth track versus #DeltaR">
   <x title="#DeltaR" n="40" lo="0.0" hi="&SMALLDRMAX;"/>
@@ -1886,7 +1896,7 @@
 <h id="fakerate_vs_dR" type="TEfficiency" title="Fake rate versus #DeltaR">
   <x title="#DeltaR" n="40" lo="0.0" hi="&DRMAX;"/>
   <y title="Fake Rate" lo="0.0" hi="2.0"/>
-</h> 
+</h>
 
 <h id="fakerate_vs_smalldR" type="TEfficiency" title="Fake rate versus #DeltaR">
   <x title="#DeltaR" n="40" lo="0.0" hi="&SMALLDRMAX;"/>
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_TrackParameters.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_TrackParameters.cxx
index 3220f56896f6..104e72335cfd 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_TrackParameters.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_TrackParameters.cxx
@@ -45,6 +45,10 @@ InDetPerfPlot_TrackParameters::InDetPerfPlot_TrackParameters(InDetPlotBase* pPar
   m_reco_pt_vs_eta{},
   m_reco_phi_vs_eta{},
 
+  m_reco_d0_z0{},
+  m_reco_d0_z0sin{},
+
+
   m_truth_pt_vs_eta{},
   m_truth_phi_vs_eta{} {
 }
@@ -76,11 +80,14 @@ InDetPerfPlot_TrackParameters::initializePlots() {
   book(m_truth_pt,     "truth_pt");
   book(m_truth_lowpt,     "truth_lowpt");
   book(m_truth_prodR,  "truth_prodR");
-  book(m_truth_prodZ,  "truth_prodZ"); 
+  book(m_truth_prodZ,  "truth_prodZ");
 
   book(m_reco_pt_vs_eta, "reco_pt_vs_eta");
   book(m_reco_phi_vs_eta, "reco_phi_vs_eta");
 
+  book(m_reco_d0_z0, "reco_d0_vs_z0");
+  book(m_reco_d0_z0sin, "reco_d0_vs_z0sin");
+
   book(m_truth_pt_vs_eta, "truth_pt_vs_eta");
   book(m_truth_phi_vs_eta, "truth_phi_vs_eta");
 
@@ -92,7 +99,7 @@ InDetPerfPlot_TrackParameters::fill(const xAOD::TruthParticle& particle) {
   // quantities with xAOD::TruthParticle accessors:
   float eta = particle.eta();
   float pt = particle.pt() / Gaudi::Units::GeV;
-  
+
   float d0 = (particle.isAvailable<float>("d0")) ? particle.auxdata<float>("d0") : -9999.;
   float z0 = (particle.isAvailable<float>("z0")) ? particle.auxdata<float>("z0") : -9999.;
   float theta = (particle.isAvailable<float>("theta")) ? particle.auxdata<float>("theta") : -9999.;
@@ -110,7 +117,7 @@ InDetPerfPlot_TrackParameters::fill(const xAOD::TruthParticle& particle) {
   if(qOverP > -9000.) fillHisto(m_truth_qoverp, qOverP);
   if(prodR > -9000.) fillHisto(m_truth_prodR, prodR);
   if(prodZ > -9000.) fillHisto(m_truth_prodZ, prodZ);
-  
+
   fillHisto(m_truth_eta, eta);
   fillHisto(m_truth_pt, pt);
   fillHisto(m_truth_lowpt, pt);
@@ -126,15 +133,15 @@ InDetPerfPlot_TrackParameters::fill(const xAOD::TrackParticle& particle) {
   float pt = particle.pt() / Gaudi::Units::GeV;
   float eta = particle.eta();
   float phi = particle.phi0();
-  
+
   float chi2 = particle.chiSquared();
   float ndof = particle.numberDoF();
   float chi2Overndof = ndof > 0 ? chi2 / ndof : 0;
-  
+
 
   fillHisto(m_reco_d0, particle.d0());
   fillHisto(m_reco_z0, particle.z0());
-  fillHisto(m_reco_z0sin, particle.z0()* particle.theta());
+  fillHisto(m_reco_z0sin, particle.z0()* std::sin(particle.theta()));
 
   fillHisto(m_reco_phi, phi);
   fillHisto(m_reco_theta, particle.theta());
@@ -146,13 +153,16 @@ InDetPerfPlot_TrackParameters::fill(const xAOD::TrackParticle& particle) {
   fillHisto(m_reco_pt_vs_eta, pt, eta);
   fillHisto(m_reco_phi_vs_eta, phi, eta);
 
+  fillHisto(m_reco_d0_z0,    particle.d0(), particle.z0());
+  fillHisto(m_reco_d0_z0sin, particle.d0(), particle.z0()*std::sin(particle.theta()));
+
   fillHisto(m_reco_chi2, chi2);
   fillHisto(m_reco_ndof, ndof);
   fillHisto(m_reco_chi2Overndof, chi2Overndof);
 
   std::bitset<xAOD::TrackPatternRecoInfo::NumberOfTrackRecoInfo>  patternInfo = particle.patternRecoInfo();
   for(unsigned int i = 0; i < xAOD::TrackPatternRecoInfo::NumberOfTrackRecoInfo; i++){
-    if(patternInfo.test(i)) fillHisto(m_reco_author, i);  
+    if(patternInfo.test(i)) fillHisto(m_reco_author, i);
   }
 
 }
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_TrackParameters.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_TrackParameters.h
index ce9a73c04308..126192b1ebc7 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_TrackParameters.h
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_TrackParameters.h
@@ -56,6 +56,9 @@ private:
   TH2* m_reco_pt_vs_eta;
   TH2* m_reco_phi_vs_eta;
 
+  TH2* m_reco_d0_z0;
+  TH2* m_reco_d0_z0sin;
+
   TH2* m_truth_pt_vs_eta;
   TH2* m_truth_phi_vs_eta;
 
-- 
GitLab