From 7ce82505944ef77aa797ab723ad37283e3a38da1 Mon Sep 17 00:00:00 2001
From: Salvador Marti <salvador.marti@ific.uv.es>
Date: Sat, 23 Nov 2019 07:56:24 +0100
Subject: [PATCH] TRT EC residuals vs pt and per weel

---
 .../src/IDAlignMonResiduals.cxx                  | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx
index d8fe1a8b41960..9f5f22bfbb19f 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx
@@ -210,6 +210,7 @@ struct IDAlignMonResiduals::TRTEndcapHistograms{
 	
 	/** Residuals and pulls vs pT in the TRT Endcap */
 	TH2F* residualR_pt[2];
+        TProfile* residualR_ptwheel[2][40];
 	TH2F* pullR_pt[2];
 	TH2F* pullR_notube_pt[2];
 
@@ -255,6 +256,7 @@ struct IDAlignMonResiduals::TRTEndcapHistograms{
 			lrVsPhiSec[side] = 0;
 			lrVsRing[side] = 0;
 			residualR_pt[side] = 0;
+			for (int iwheel=0; iwheel<40; iwheel++) residualR_ptwheel[side][iwheel] = 0;
 			pullR_pt[side] = 0;
 			pullR_notube_pt[side] = 0;
 			residualR_mu[side] = 0;
@@ -5050,6 +5052,16 @@ void IDAlignMonResiduals::MakeTRTEndcapHistograms(MonGroup& al_mon){
       m_trt_ec_hist->pullR_notube_pt[endcap] = MakeHist("trt_ec_pullRnotube_pt_"+endcapName[endcap],"UnBiased Pull vs pT for the TRT (no tube hits)"+endcapName[endcap],m_nBinsPtRange,-m_PtRange,m_PtRange,100,-m_RangeOfPullHistos,m_RangeOfPullHistos, "Track p_{T} [GeV]","Pull");
       RegisterHisto(al_mon,m_trt_ec_hist->pullR_notube_pt[endcap]);  
 
+      /** Residuals and pulls vs pt per wheel */
+      // SALVA
+      for (int iWheel=0; iWheel < 40; iWheel++) {
+	m_trt_ec_hist->residualR_ptwheel[endcap][iWheel] = MakeProfile("trt_"+endcapName[endcap]+"_resvspt_wheel_"+intToString(iWheel),
+								       "Unbiased residual vs p_{T} for TRT "+endcapName[endcap]+" "+intToString(iWheel),
+								       m_nBinsPtRange, -m_PtRange, m_PtRange,
+								       -1.0, 1.0, "Track p_{T} [GeV]","Residual [mm]");
+	RegisterHisto(al_mon,m_trt_ec_hist->residualR_ptwheel[endcap][iWheel]);
+      }
+
       /** Residuals and pulls vs mu*/
       m_trt_ec_hist->residualR_mu[endcap] = MakeHist("trt_ec_residualR_mu_"+endcapName[endcap],"UnBiased Residual vs mu for the TRT "+endcapName[endcap],m_nBinsPtRange,-m_PtRange,m_PtRange,200,-1.0,1.0, "#mu ","Residual [mm]");
       RegisterHisto(al_mon,m_trt_ec_hist->residualR_mu[endcap]);  
@@ -5336,9 +5348,9 @@ void IDAlignMonResiduals::fillTRTEndcapHistograms(int m_barrel_ec, int m_layer_o
     m_trt_ec_hist->aveResVsTrackEta[endcap] -> Fill(trketa,residualR, TrkWeight);
 		
     if(m_extendedPlots){
-      if (LE != -999)
-	m_trt_ec_hist->rt[endcap] -> Fill(LE - EP - t0,fabs(perdictR), TrkWeight);
+      if (LE != -999) m_trt_ec_hist->rt[endcap] -> Fill(LE - EP - t0,fabs(perdictR), TrkWeight);
       m_trt_ec_hist->residualR_pt[endcap]-> Fill(trkpt, residualR, TrkWeight);
+      m_trt_ec_hist->residualR_ptwheel[endcap][m_layer_or_wheel]-> Fill(trkpt, residualR, TrkWeight);
       m_trt_ec_hist->pullR_pt[endcap]    -> Fill(trkpt, pullR    , TrkWeight);
       if (!isTubeHit) m_trt_ec_hist->pullR_notube_pt[endcap] -> Fill(trkpt,pullR, TrkWeight);
       
-- 
GitLab