From 9e3fb8c1589c695014239c9d29adbd20ecab8a3b Mon Sep 17 00:00:00 2001 From: Pierfrancesco Butti <pierfrancesco.butti@cern.ch> Date: Fri, 26 Aug 2016 09:25:10 +0200 Subject: [PATCH] Fixes to the hit Efficiencies vs LB (InDetAlignmentMonitoring-00-04-30) * Added src/PVBiases.cxx and src/PVBiases.h * src/components/InDetAlignmentMonitoring_entries.cxx has been updated accordingly 2016-07-12 Pierfrancesco Butti * Added Protection for NULL RawDriftCircles in the TRT maps that cause crash on DESD. 2016-07-08 Pierfrancesco Butti * Updated to Trunk version * Tagged as InDetAlignmentMonitoring-00-04-29 --- .../share/MakeMajorAlignMonPlots.py | 5 + .../share/MakeResidualOverlapPlots.py | 244 +++++++++ .../share/MakeResidualPlots.py | 14 + .../share/userConfig.py | 17 +- .../share/utilities.py | 22 +- .../src/IDAlignMonEfficiencies.cxx | 184 +++++-- .../src/IDAlignMonEfficiencies.h | 31 +- .../src/IDAlignMonPVBiases.cxx | 475 ++++++++++++++++++ .../src/IDAlignMonPVBiases.h | 98 ++++ .../src/IDAlignMonResiduals.cxx | 39 +- .../InDetAlignmentMonitoring_entries.cxx | 3 +- .../utils/MagnitudeEvolution.h | 21 +- .../utils/include/drawutils.py | 28 +- .../utils/include/fileutils.py | 6 +- .../utils/include/moduleutils.py | 4 +- 15 files changed, 1091 insertions(+), 100 deletions(-) create mode 100644 InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualOverlapPlots.py create mode 100755 InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.cxx create mode 100755 InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.h diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeMajorAlignMonPlots.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeMajorAlignMonPlots.py index 5e04c06c68a..80d322fefe6 100755 --- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeMajorAlignMonPlots.py +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeMajorAlignMonPlots.py @@ -59,6 +59,7 @@ def optParsing(): parser.add_option("--Pulls", dest="inputPulls", help="Do pulls plots for all systems and then layer by layer", action="store_true",default=False) parser.add_option("--ResidualMaps", dest="inputResidualMaps", help="Do residuals plots for all systems layer by layer", action="store_true",default=False) parser.add_option("--Residuals", dest="inputResiduals", help="Do residuals plots for all systems and then layer by layer", action="store_true",default=False) + parser.add_option("--Overlaps", dest="inputOverlaps", help="Do Overlap residuals plots for all systems and then layer by layer", action="store_true",default=False) parser.add_option("--Script", dest="inputScript", help="The user may provie its own script", default="") parser.add_option("--SetBatch", dest="inputSetBatch", help="When SetBatch is used histogram displays are not open", action="store_true", default=True) parser.add_option("--ShowPlots", dest="inputSetBatch", help="When ShowPlots is used the histogram display is open", action="store_false", default=True) @@ -82,6 +83,7 @@ userIBL = config.inputIBL userPulls = config.inputPulls userResidualMaps = config.inputResidualMaps userResiduals = config.inputResiduals +userOverlaps = config.inputOverlaps userTrackParams = config.inputTrackParams userTrackSegments = config.inputTrackSegments userExtended = config.inputExtended @@ -113,6 +115,7 @@ if (config.inputALL): userPulls = True userResidualMaps = False userResiduals = True + userOverlaps = True userTrackParams = True userExtended = True userResByModule = False # as this plots to many histograms, this can be only activated on purpose @@ -132,6 +135,7 @@ if (userPDF): outputFileExtension="pdf" # doResiduals = False or userResiduals +doOverlaps = False or userOverlaps doResidualProfiles = False doPulls = False or userPulls doTrackParams = False or userTrackParams @@ -197,6 +201,7 @@ print " -- MakeMajorAlignMonPlots -- Using in total ",nFiles, " input files " # Basic Barrel Residual distributions if (doResiduals): execfile("MakeResidualPlots.py") +if (doOverlaps): execfile("MakeResidualOverlapPlots.py") if (doResidualProfiles): execfile("MakeResidualProfilesPlots.py") if (doIBL): execfile("MakeResidualsIBL.py") if (doPulls): execfile("MakePullPlots.py") diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualOverlapPlots.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualOverlapPlots.py new file mode 100644 index 00000000000..18181783dcf --- /dev/null +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualOverlapPlots.py @@ -0,0 +1,244 @@ +#Script to plot Overlap Plots. (PF) + +#Pixel +#round is not the best function to use for this scope. For the moment I use this. Think about pass to Decimal. + +mmToum=1000. + +if (userExtended): + PIX_OXRX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_xoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + thiscan = DrawPlots(PIX_OXRX0, outputDir+"/"+userPrefix+"PIXIBL_OXRX."+oFext, "IBL", "Hits on tracks / "+str(round(PIX_OXRX0[1].GetBinWidth(1)*mmToum,1))+" #mum", + "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + PIX_OXRX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_xoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + thiscan = DrawPlots(PIX_OXRX1, outputDir+"/"+userPrefix+"PIX0_OXRX."+oFext, "B Layer", "Hits on tracks / "+str(round(PIX_OXRX1[1].GetBinWidth(1)*mmToum,1))+" #mum", + "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + PIX_OXRX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_xoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + thiscan = DrawPlots(PIX_OXRX2, outputDir+"/"+userPrefix+"PIX1_OXRX."+oFext, "PIX Layer 1", "Hits on tracks / "+str(round(PIX_OXRX2[1].GetBinWidth(1)*mmToum,1))+" #mum", + "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + PIX_OXRX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_xoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + thiscan = DrawPlots(PIX_OXRX3, outputDir+"/"+userPrefix+"PIX3_OXRX."+oFext, "PIX Layer 3", "Hits on tracks / "+str(round(PIX_OXRX3[1].GetBinWidth(1)*mmToum,1))+" #mum", + "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + + PIX_OXRY0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_xoverlapresidualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + thiscan = DrawPlots(PIX_OXRY0, outputDir+"/"+userPrefix+"PIXIBL_OXRY."+oFext, "IBL", "Hits on tracks / "+str(round(PIX_OXRY0[1].GetBinWidth(1)*mmToum,1))+" #mum", + "X Overlap Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + PIX_OXRY1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_xoverlapresidualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + thiscan = DrawPlots(PIX_OXRY1, outputDir+"/"+userPrefix+"PIX0_OXRY."+oFext, "B Layer", "Hits on tracks / "+str(round(PIX_OXRY1[1].GetBinWidth(1)*mmToum,1))+" #mum", + "X Overlap Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + PIX_OXRY2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_xoverlapresidualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + thiscan = DrawPlots(PIX_OXRY2, outputDir+"/"+userPrefix+"PIX1_OXRY."+oFext, "PIX Layer 1", "Hits on tracks / "+str(round(PIX_OXRY2[1].GetBinWidth(1)*mmToum,1))+" #mum", + "X Overlap Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + PIX_OXRY3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_xoverlapresidualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + thiscan = DrawPlots(PIX_OXRY3, outputDir+"/"+userPrefix+"PIX3_OXRY."+oFext, "PIX Layer 3", "Hits on tracks / "+str(round(PIX_OXRY3[1].GetBinWidth(1)*mmToum,1))+" #mum", + "X Overlap Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + + + +#This histogram should be empty but there are entries + PIX_OYRX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_yoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + thiscan = DrawPlots(PIX_OYRX0, outputDir+"/"+userPrefix+"PIXIBL_OYRX."+oFext, "IBL", "Hits on tracks / "+str(round(PIX_OYRX0[1].GetBinWidth(1)*mmToum,1))+" #mum", + "Y Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + PIX_OYRX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_yoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + thiscan = DrawPlots(PIX_OYRX1, outputDir+"/"+userPrefix+"PIX0_OYRX."+oFext, "B Layer", "Hits on tracks / "+str(round(PIX_OYRX1[1].GetBinWidth(1)*mmToum,1))+" #mum", + "Y Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + PIX_OYRX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_yoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + thiscan = DrawPlots(PIX_OYRX2, outputDir+"/"+userPrefix+"PIX1_OYRX."+oFext, "PIX Layer 1", "Hits on tracks / "+str(round(PIX_OYRX2[1].GetBinWidth(1)*mmToum,1))+" #mum", + "Y Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + PIX_OYRX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_yoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + thiscan = DrawPlots(PIX_OYRX3, outputDir+"/"+userPrefix+"PIX3_OYRX."+oFext, "PIX Layer 3", "Hits on tracks / "+str(round(PIX_OYRX3[1].GetBinWidth(1)*mmToum,1))+" #mum", + "Y Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + +#This histogram shouldn't be filled +#PIX_OYRY0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b0_yoverlapresidualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) +#thiscan = DrawPlots(PIX_OYRY0, outputDir+"/"+userPrefix+"PIXIBL_OYRY."+oFext, "IBL", "Hits on tracks / "+str(round(PIX_OYRY0[1].GetBinWidth(1)*mmToum,1))+" #mum", +# "Y Overlap Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + PIX_OYRY1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_yoverlapresidualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + thiscan = DrawPlots(PIX_OYRY1, outputDir+"/"+userPrefix+"PIX0_OYRY."+oFext, "B Layer", "Hits on tracks / "+str(round(PIX_OYRY1[1].GetBinWidth(1)*mmToum,1))+" #mum", + "Y Overlap Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + PIX_OYRY2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b2_yoverlapresidualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + thiscan = DrawPlots(PIX_OYRY2, outputDir+"/"+userPrefix+"PIX1_OYRY."+oFext, "PIX Layer 1", "Hits on tracks / "+str(round(PIX_OYRY2[1].GetBinWidth(1)*mmToum,1))+" #mum", + "Y Overlap Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + PIX_OYRY3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b3_yoverlapresidualy","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + thiscan = DrawPlots(PIX_OYRY3, outputDir+"/"+userPrefix+"PIX3_OYRY."+oFext, "PIX Layer 3", "Hits on tracks / "+str(round(PIX_OYRY3[1].GetBinWidth(1)*mmToum,1))+" #mum", + "Y Overlap Local y residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + +# +# Overlap Residual mean as a function of eta / phi modified modules +# + +PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_b_Oxresxvsmodeta","noFit",rootFiles,nFiles,False) +DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOXRXvsModEta."+oFext, "Pixel Barrel", "X Overlap local x residual mean [#mum]", + "Module Eta", 0.18, 0.88, "#mum", + canvasText,makeOutput,0.59, 0.87,False) #False + +#PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_b_Oyresxvsmodeta","noFit",rootFiles,nFiles,False) +#DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOYRXvsModEta."+oFext, "Pixel Barrel", "Y Overlap local x residual mean [mm]", +# "Module Eta", 0.18, 0.88, "#mum", +# canvasText,makeOutput,0.59, 0.87,False) #False + + +#PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_b_Oxresyvsmodeta","noFit",rootFiles,nFiles,False) +#DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOXRYvsModEta."+oFext, "Pixel Barrel", "X Overlap local y residual mean [mm]", +# "Module Eta", 0.18, 0.88, "#mum", +# canvasText,makeOutput,0.59, 0.87,False) #False + +PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_b_Oyresyvsmodeta","noFit",rootFiles,nFiles,False) +DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOYRYvsModEta."+oFext, "Pixel Barrel", "Y Overlap local y residual mean [#mum]", + "Module Eta", 0.18, 0.88, "#mum", + canvasText,makeOutput,0.59, 0.87,False) #False + +PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_b_Oxresxvsmodphi","noFit",rootFiles,nFiles,False) +DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOXRXvsModPhi."+oFext, "Pixel Barrel", "X Overlap local x residual mean [#mum]", + "Module Phi", 0.18, 0.88, "#mum", + canvasText,makeOutput,0.59, 0.87,False) #False + +#PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_b_Oyresxvsmodphi","noFit",rootFiles,nFiles,False) +#DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOYRXvsModPhi."+oFext, "Pixel Barrel", "Y Overlap local x residual mean [mm]", +# "Module Phi", 0.18, 0.88, "#mum", +# canvasText,makeOutput,0.59, 0.87,False) #False + +#PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_b_Oxresyvsmodphi","noFit",rootFiles,nFiles,False) +#DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOXRYvsModPhi."+oFext, "Pixel Barrel", "X Overlap local y residual mean [mm]", +# "Module Phi", 0.18, 0.88, "#mum", +# canvasText,makeOutput,0.59, 0.87,False) #False + +PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_b_Oyresyvsmodphi","noFit",rootFiles,nFiles,False) +DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOYRYvsModPhi."+oFext, "Pixel Barrel", "Y Overlap local y residual mean [#mum]", + "Module Phi", 0.18, 0.88, "#mum", + canvasText,makeOutput,0.59, 0.87,False) #False + + +PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_eca_Oxresxvsmodphi","noFit",rootFiles,nFiles,False) +DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOXRXvsModPhiECA."+oFext, "Pixel Endcap A", "X Overlap local x residual mean [#mum]", + "Module Phi", 0.18, 0.88, "#mum", + canvasText,makeOutput,0.59, 0.87,False) #False + +#This plot is empty +#PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_eca_Oyresyvsmodphi","noFit",rootFiles,nFiles,False) +#DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOYRYvsModPhiECA."+oFext, "Pixel Endcap A", "Y Overlap local y residual mean [#mum]", +# "Module Phi", 0.18, 0.88, "#mum", +# canvasText,makeOutput,0.59, 0.87,False) #False + + + +PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_ecc_Oxresxvsmodphi","noFit",rootFiles,nFiles,False) +DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOXRXvsModPhiECC."+oFext, "Pixel Endcap C", "X Overlap local x residual mean [#mum]", + "Module Phi", 0.18, 0.88, "#mum", + canvasText,makeOutput,0.59, 0.87,False) #False + + +#This plot is empty. +#PixelRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"pix_ecc_Oyresyvsmodphi","noFit",rootFiles,nFiles,False) +#DrawPlots(PixelRes, outputDir+"/"+userPrefix+"PixelOYRYvsModPhiECC."+oFext, "Pixel Endcap C", "Y Overlap local y residual mean [#mum]", +# "Module Phi", 0.18, 0.88, "#mum", +# canvasText,makeOutput,0.59, 0.87,False) #False + + + + +#Barrel Endcap Overlap residuals and mean for Pixel + + +#General SCT Overlap Residuals +if (userExtended): + SCT_OXRX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b0_xoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + DrawPlots(SCT_OXRX0, outputDir+"/"+userPrefix+"SCT0_OXRX."+oFext, "SCT Layer 0", "Hits on tracks / "+str(round(SCT_OXRX0[1].GetBinWidth(1)*mmToum,1))+" #mum", + "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + + SCT_OXRX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b1_xoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + DrawPlots(SCT_OXRX1, outputDir+"/"+userPrefix+"SCT1_OXRX."+oFext, "SCT Layer 1", "Hits on tracks / "+str(round(SCT_OXRX1[1].GetBinWidth(1)*mmToum,1))+" #mum", + "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + + SCT_OXRX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b2_xoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + DrawPlots(SCT_OXRX2, outputDir+"/"+userPrefix+"SCT2_OXRX."+oFext, "SCT Layer 2", "Hits on tracks / "+str(round(SCT_OXRX2[1].GetBinWidth(1)*mmToum,1))+" #mum", + "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + + SCT_OXRX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b3_xoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + DrawPlots(SCT_OXRX3, outputDir+"/"+userPrefix+"SCT3_OXRX."+oFext, "SCT Layer 3", "Hits on tracks / "+str(round(SCT_OXRX3[1].GetBinWidth(1)*mmToum,1))+" #mum", + "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + + + SCT_OYRX0 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b0_yoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + DrawPlots(SCT_OXRX0, outputDir+"/"+userPrefix+"SCT0_OYRX."+oFext, "SCT Layer 0", "Hits on tracks / "+str(round(SCT_OYRX0[1].GetBinWidth(1)*mmToum,1))+" #mum", + "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + + SCT_OYRX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b1_yoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + DrawPlots(SCT_OXRX1, outputDir+"/"+userPrefix+"SCT1_OYRX."+oFext, "SCT Layer 1", "Hits on tracks / "+str(round(SCT_OYRX1[1].GetBinWidth(1)*mmToum,1))+" #mum", + "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + + SCT_OYRX2 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b2_yoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + DrawPlots(SCT_OXRX2, outputDir+"/"+userPrefix+"SCT2_OYRX."+oFext, "SCT Layer 2", "Hits on tracks / "+str(round(SCT_OYRX2[1].GetBinWidth(1)*mmToum,1))+" #mum", + "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + + SCT_OYRX3 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"sct_b3_yoverlapresidualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) + DrawPlots(SCT_OXRX3, outputDir+"/"+userPrefix+"SCT3_OYRX."+oFext, "SCT Layer 3", "Hits on tracks / "+str(round(SCT_OYRX3[1].GetBinWidth(1)*mmToum,1))+" #mum", + "X Overlap Local x residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) + + + +# SCT Overlap residuals mean vs eta and phi + + +SCTRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"sct_b_Oxresxvsmodeta","noFit",rootFiles,nFiles,False) +DrawPlots(SCTRes, outputDir+"/"+userPrefix+"SCTOXRXvsModEta."+oFext, "SCT Barrel", "X Overlap local x residual mean [#mum]", + "Module Eta", 0.18, 0.88, "#mum", + canvasText,makeOutput,0.59, 0.87,False) #False + + +SCTRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"sct_b_Oyresxvsmodeta","noFit",rootFiles,nFiles,False) +DrawPlots(SCTRes, outputDir+"/"+userPrefix+"SCTOYRXvsModEta."+oFext, "SCT Barrel", "Y Overlap local x residual mean [#mum]", + "Module Eta", 0.18, 0.88, "#mum", + canvasText,makeOutput,0.59, 0.87,False) #False + + + +SCTRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"sct_b_Oxresxvsmodphi","noFit",rootFiles,nFiles,False) +DrawPlots(SCTRes, outputDir+"/"+userPrefix+"SCTOXRXvsModPhi."+oFext, "SCT Barrel", "X Overlap local x residual mean [#mum]", + "Module Phi", 0.18, 0.88, "#mum", + canvasText,makeOutput,0.59, 0.87,False) #False + + +SCTRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"sct_b_Oyresxvsmodphi","noFit",rootFiles,nFiles,False) +DrawPlots(SCTRes, outputDir+"/"+userPrefix+"SCTOYRXvsModPhi."+oFext, "SCT Barrel", "Y Overlap local x residual mean [#mum]", + "Module Phi", 0.18, 0.88, "#mum", + canvasText,makeOutput,0.59, 0.87,False) #False + + +SCTRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"sct_eca_Oxresxvsmodphi","noFit",rootFiles,nFiles,False) +DrawPlots(SCTRes, outputDir+"/"+userPrefix+"SCTOXRXvsModPhiECA."+oFext, "SCT Endcap A", "X Overlap local x residual mean [#mum]", + "Module Phi", 0.18, 0.88, "#mum", + canvasText,makeOutput,0.59, 0.87,False) #False + +SCTRes = MakePlots(residualsDir, legendTitles, markerColors,markerStyles,"sct_ecc_Oxresxvsmodphi","noFit",rootFiles,nFiles,False) +DrawPlots(SCTRes, outputDir+"/"+userPrefix+"SCTOXRXvsModPhiECC."+oFext, "SCT Endcap C", "X Overlap local x residual mean [#mum]", + "Module Phi", 0.18, 0.88, "#mum", + canvasText,makeOutput,0.59, 0.87,False) #False + + + + + + + diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualPlots.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualPlots.py index f199e85d1c9..8d4ea4664c6 100644 --- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualPlots.py +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/MakeResidualPlots.py @@ -57,6 +57,12 @@ TRTR = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_r thiscan = DrawPlots(TRTR, outputDir+"/"+userPrefix+"TRTR."+oFext, "TRT barrel", "Hits on tracks / 22 #mum", "residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) if (userCollectOutput): Canvases.append(thiscan) + +#TRT no Tube +TRTR = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_b_residualR_notube","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea) +thiscan = DrawPlots(TRTR, outputDir+"/"+userPrefix+"TRTR_notube."+oFext, "TRT barrel", "Hits on tracks / 22 #mum", + "residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput,0.59, 0.87) +if (userCollectOutput): Canvases.append(thiscan) ## Individual Barrel Layer Residual Distributions PIXX1 = MakePlots(residualsDir,legendTitles,markerColors,markerStyles,"pix_b1_residualx","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) @@ -180,10 +186,18 @@ TRTECA = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_e DrawPlots(TRTECA, outputDir+"/"+userPrefix+"TRTECA."+oFext, "TRT Endcap A", "Hits on tracks / 22 #mum", "residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput) +TRTECA = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR_notubeEndcap_A","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) +DrawPlots(TRTECA, outputDir+"/"+userPrefix+"TRTECA_notube."+oFext, "TRT Endcap A", "Hits on tracks / 22 #mum", + "residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput) + TRTECC = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR_Endcap_C","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) DrawPlots(TRTECC, outputDir+"/"+userPrefix+"TRTECC."+oFext, "TRT Endcap C", "Hits on tracks / 22 #mum", "residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput) +TRTECC = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR_notubeEndcap_C","noFitWithStats",rootFiles,nFiles,normaliseHistos,unitArea) +DrawPlots(TRTECC, outputDir+"/"+userPrefix+"TRTECC_notube."+oFext, "TRT Endcap C", "Hits on tracks / 22 #mum", + "residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput) + TRTEC = MakePlots(trtResidualsDir,legendTitles,markerColors,markerStyles,"trt_ec_residualR","noFitWithStats",rootFiles,nFiles,normaliseHistos)#,unitArea) DrawPlots(TRTEC, outputDir+"/"+userPrefix+"TRTEC."+oFext, "TRT end-caps", "Hits on tracks / 22 #mum", "residual [mm]", 0.18, 0.88, "#mum",canvasText,makeOutput) diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/userConfig.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/userConfig.py index 76bccb2cec4..657b7021492 100644 --- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/userConfig.py +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/userConfig.py @@ -9,7 +9,7 @@ print " <userConfig> -- START -- " print " userPDF:", userPDF print " userOuputFolder:", userOuputFolder -outputDir = "../plots_2016_initial" # this sets the output directory where plot gifs will be saved +outputDir = "../ZmumuTracks" # this sets the output directory where plot gifs will be saved if (userOuputFolder): outputDir = userOuputFolder if (doDebug): print " <userConfig> output folder set to: ", outputDir @@ -19,7 +19,8 @@ oFext="png" # output file extention without the dot if (userPDF): oFext="pdf" #### -canvasText = ["IDCosmics", " ", "",""] #specifies additional canvas text +#canvasText = ["Zmumu Selection", "Muon Tracks", "p_{T}>25 GeV",""] #specifies additional canvas text +canvasText = ["Data 2016 exp", "AlignTracks", "p_{T}>5 GeV (?)",""] #specifies additional canvas text if (len(userCanvasText)>=1): canvasText = SetCanvasText(userCanvasText) @@ -31,9 +32,15 @@ unitArea = False # set to true if you want to draw residual histos to unit area # specify the ROOT histogram files containing the monitoring plots here #SetNextInputFile("/Users/martis/scratch/Run301973_IDCosmics_Monitoring_PostTS1_2.root", "Reco with Post_TS1_June2016", kOpenSquare, kRed-7,"AlignTracks_all","run_301973") -SetNextInputFile("/Users/martis/scratch/Run301973_IDCosmics_Monitoring.root", "301973", kOpenSquare, kGray+3,"AlignTracks_all","run_301973") -SetNextInputFile("/Users/martis/scratch/Run302393_IDCosmics_Monitoring.root", "302393", kOpenSquare, kRed+1,"AlignTracks_all","run_302393") -#SetNextInputFile("/Users/martis/scratch/Run301973_IDCosmics_Monitoring.root", "Upper segment", kOpenSquare, kBlue-4,"AlignTracks_Upper_all","run_301973") + + +#SetNextInputFile("/afs/cern.ch/user/p/pbutti/spacework/public/Maps_v2/GRL_TotalMonitoring.root", "Data GRL",kOpenSquare, kRed+1,"SelectedMuonsRefit1_AlignTracks","") +#SetNextInputFile("/afs/cern.ch/user/p/pbutti/spacework/public/Maps_v2/MC_TotalMonitoring_pp.root", "MC", kOpenSquare, kBlue-4,"SelectedMuonsRefit1_Tracks","") + +SetNextInputFile("/afs/cern.ch/user/m/mdanning/hias/public/13TeV/2016/20.7.6.2/fixd0Bias/L3/Iter2_L3/collisions/TotalMonitoring.root", "2016_fixd0Bias", kOpenSquare, kRed+1,"AlignTracks_all","run_multiple") + + +#SetNextInputFile("/afs/cern.ch/user/p/pbutti/spacework/public/Maps_v2/NoGRL_TotalMonitoring.root", "Data noGRL",kOpenSquare, kGreen+4,"SelectedMuonsRefit1_AlignTracks","") #SetNextInputFile("/Users/martis/scratch/Run301973_IDCosmics_Monitoring.root", "Lower segment", kOpenSquare, kRed-4,"AlignTracks_Lower_all","run_301973") #SetNextInputFile("/afs/cern.ch/user/h/hoide/workdir/alignment/2016InitialAlign/20.7.5.7/run297041/Iter0pass1/collisions/TotalMonitoring.root", "297041 Iter0", kOpenSquare, kOrange+3,"AlignTracks_all","run_297041") diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/utilities.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/utilities.py index 054898b6988..80149d66321 100644 --- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/utilities.py +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/share/utilities.py @@ -2521,14 +2521,32 @@ def GetHistogram(rootFile,histogramDir,histogramName,markerColor,markerStyle, fi # histoGram.SetAxisRange(-0.5,0.5) # if "asym" in histogramName: # histoGram.GetYaxis().SetRangeUser(-0.3,0.3) - # priscilla + # priscilla + -# print " priscilla roofile ", rootFile.GetName() if histogramName=="delta_z0": histoGram.SetAxisRange(-1.,1.) + #Overlaps mean + if histogramName=="pix_b_Oyresyvsmodeta": + histoGram.Scale(1000.) + histoGram.GetYaxis().SetRangeUser(-300,200) + + if histogramName=="pix_b_Oyresyvsmodphi": + histoGram.Scale(1000.) + histoGram.GetYaxis().SetRangeUser(-300,300) + + if histogramName=="pix_b_Oxresxvsmodeta" or histogramName=="pix_b_Oxresxvsmodphi" or histogramName=="pix_eca_Oxresxvsmodphi" or histogramName=="pix_ecc_Oxresxvsmodphi" or histogramName=="pix_eca_Oyresyvsmodphi" or histogramName=="pix_ecc_Oyresyvsmodphi": + histoGram.Scale(1000.) + + + if histogramName=="sct_b_Oxresxvsmodeta" or histogramName=="sct_b_Oyresxvsmodeta" or histogramName=="sct_b_Oyresxvsmodphi" or histogramName=="sct_b_Oxresxvsmodphi" or histogramName=="sct_b_yresxvsmodphi" or histogramName=="sct_eca_Oxresxvsmodphi" or histogramName=="sct_ecc_Oxresxvsmodphi": + histoGram.Scale(1000.) + + + if histogramName=="si_barrel_resX_mean" or histogramName=="si_eca_resX_mean" or histogramName=="si_ecc_resX_mean": #Patch for the mean histoGram.Scale(1000) diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.cxx index 4da5b08dc2d..2d31f0e9b4e 100755 --- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.cxx +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.cxx @@ -208,8 +208,8 @@ IDAlignMonEfficiencies::IDAlignMonEfficiencies( const std::string & type, const m_doHitQuality(false) { m_minLB=-0.5; - m_maxLB=1023.5; - m_nLB = 1024; + m_maxLB=3023.5; + m_nLB = 3024; m_trackSelection = ToolHandle<InDetAlignMon::TrackSelectionTool>("InDetAlignMon::TrackSelectionTool"); m_hitQualityTool = ToolHandle<IInDetAlignHitQualSelTool>(""); m_holeSearchTool = ToolHandle<Trk::ITrackHoleSearchTool>("InDetHoleSearchTool"); @@ -221,6 +221,7 @@ IDAlignMonEfficiencies::IDAlignMonEfficiencies( const std::string & type, const m_triggerChainName = "NoTriggerSelection"; m_doHoleSearch = true; m_extendedPlots= false; + m_mapSplit=1; InitializeHistograms(); @@ -237,6 +238,7 @@ IDAlignMonEfficiencies::IDAlignMonEfficiencies( const std::string & type, const declareProperty("SCT_Manager" , m_SCT_Manager); declareProperty("TRT_Manager" , m_TRT_Manager); declareProperty("trackSumTool" , m_trackSumTool); + declareProperty("NSplitMap" , m_mapSplit); declareProperty("useExtendedPlots" , m_extendedPlots); } @@ -1014,13 +1016,13 @@ StatusCode IDAlignMonEfficiencies::fillHistograms() else if (barrelEC==2){ m_hits_vs_layer_eca -> Fill(layerDisk); m_hits_vs_Phi_pix_eca[layerDisk] -> Fill(modPhi); - m_hits_vs_LB_pix_eca -> Fill(float(LumiBlock)); + m_hits_vs_LB_pix_eca[layerDisk] -> Fill(float(LumiBlock)); m_hits_vs_Eta_Phi_pix_eca -> Fill(layerDisk,modPhi); } else if (barrelEC == -2){ m_hits_vs_layer_ecc -> Fill(layerDisk); m_hits_vs_Phi_pix_ecc[layerDisk] -> Fill(modPhi); - m_hits_vs_LB_pix_ecc -> Fill(float(LumiBlock)); + m_hits_vs_LB_pix_ecc[layerDisk] -> Fill(float(LumiBlock)); m_hits_vs_Eta_Phi_pix_ecc -> Fill(layerDisk, modPhi); } } // end of pix @@ -1119,7 +1121,7 @@ StatusCode IDAlignMonEfficiencies::fillHistograms() m_measurements_vs_layer_eca -> Fill(layerDisk); m_noholes_vs_layer_eca -> Fill(layerDisk); m_measurements_vs_Phi_pix_eca[layerDisk] -> Fill(modPhi); - m_measurements_vs_LB_pix_eca -> Fill(float(LumiBlock)); + m_measurements_vs_LB_pix_eca[layerDisk] -> Fill(float(LumiBlock)); if (m_extendedPlots) { if(foundXOverlap){ m_overlapX_vs_layer_eca-> Fill(layerDisk); @@ -1140,7 +1142,7 @@ StatusCode IDAlignMonEfficiencies::fillHistograms() m_measurements_vs_layer_ecc -> Fill(layerDisk); m_noholes_vs_layer_ecc -> Fill(layerDisk); m_measurements_vs_Phi_pix_ecc[layerDisk] -> Fill(modPhi); - m_measurements_vs_LB_pix_ecc -> Fill(float(LumiBlock)); + m_measurements_vs_LB_pix_ecc[layerDisk] -> Fill(float(LumiBlock)); if (m_extendedPlots){ if(foundXOverlap){ m_overlapX_vs_Phi_pix_ecc[layerDisk] -> Fill(modPhi); @@ -1256,18 +1258,21 @@ StatusCode IDAlignMonEfficiencies::fillHistograms() m_outliers_vs_Eta_Phi_pix_b[layerDisk] -> Fill(modEta, modPhi); m_outliers_vs_Eta_pix_b[layerDisk] -> Fill(modEta); m_outliers_vs_Phi_pix_b[layerDisk] -> Fill(modPhi); + m_outliers_vs_LB_pix_b[layerDisk] -> Fill(float(LumiBlock)); m_outliers_vs_pT_pix_b[layerDisk] -> Fill(abs_trkpt); }//barrel else if (barrelEC == 2){ m_outliers_vs_layer_eca -> Fill(layerDisk); m_noholes_vs_layer_eca -> Fill(layerDisk); + m_outliers_vs_LB_pix_eca[layerDisk] -> Fill(float(LumiBlock)); m_outliers_vs_Eta_Phi_pix_eca -> Fill(layerDisk, modPhi); }//ECA // ECC else if (barrelEC == -2){ m_outliers_vs_layer_ecc -> Fill(layerDisk); + m_outliers_vs_LB_pix_ecc[layerDisk] -> Fill(float(LumiBlock)); m_noholes_vs_layer_ecc -> Fill(layerDisk); m_outliers_vs_Eta_Phi_pix_ecc -> Fill(layerDisk, modPhi); }//ecc @@ -1373,9 +1378,7 @@ StatusCode IDAlignMonEfficiencies::fillHistograms() if (barrelEC == 0){ // msg(MSG::WARNING) << " ** HOLE FOUND ** Pixel barrel ** layer_disk=" << m_pixelID->layer_disk(surfaceID) << ", eta=" << m_pixelID->eta_module(surfaceID) << ", phi=" << m_pixelID->phi_module(surfaceID) << endreq; - m_hits_vs_layer_barrel -> Fill(layerDisk); - - m_hits_vs_Eta_Phi_pix_b[layerDisk] -> Fill(modEta,modPhi); + bool knownType = false; if ((*HTSOSItr)->type(Trk::TrackStateOnSurface::Measurement)) { knownType = true; @@ -1389,9 +1392,11 @@ StatusCode IDAlignMonEfficiencies::fillHistograms() knownType = true; //std::cout << " Type: Hole "; } - if (!knownType) std::cout << "IDAlignment Monitoring HitEfficiencies Type: -- UNKNOWN -- "; - std::cout << std::endl; + if (!knownType) std::cout << "IDAlignment Monitoring HitEfficiencies Type: -- UNKNOWN -- "<<std::endl; + + m_hits_vs_layer_barrel -> Fill(layerDisk); + m_hits_vs_Eta_Phi_pix_b[layerDisk] -> Fill(modEta,modPhi); m_hits_vs_Eta_pix_b[layerDisk] -> Fill(modEta); m_hits_vs_LB_pix_b[layerDisk] -> Fill(float(LumiBlock)); m_hits_vs_Phi_pix_b[layerDisk] -> Fill(modPhi); @@ -1403,13 +1408,13 @@ StatusCode IDAlignMonEfficiencies::fillHistograms() m_hits_vs_layer_eca -> Fill(layerDisk); m_hits_vs_Phi_pix_eca[layerDisk] -> Fill(modPhi); m_hits_vs_Eta_Phi_pix_eca -> Fill(layerDisk, modPhi); - m_hits_vs_LB_pix_eca -> Fill(float(LumiBlock)); + m_hits_vs_LB_pix_eca[layerDisk] -> Fill(float(LumiBlock)); } // eca // ----------- ecc else if (barrelEC == -2){ m_hits_vs_layer_ecc -> Fill(layerDisk); m_hits_vs_Phi_pix_ecc[layerDisk] -> Fill(modPhi); - m_hits_vs_LB_pix_ecc -> Fill(float(LumiBlock)); + m_hits_vs_LB_pix_ecc[layerDisk] -> Fill(float(LumiBlock)); m_hits_vs_Eta_Phi_pix_ecc -> Fill(layerDisk, modPhi); } // ecc } // pixels @@ -1456,16 +1461,19 @@ StatusCode IDAlignMonEfficiencies::fillHistograms() m_holes_vs_Eta_Phi_pix_b[layerDisk] -> Fill(modEta,modPhi); m_holes_vs_Eta_pix_b[layerDisk] -> Fill(modEta); m_holes_vs_Phi_pix_b[layerDisk] -> Fill(modPhi); + m_holes_vs_LB_pix_b[layerDisk] -> Fill(float(LumiBlock)); m_holes_vs_pT_pix_b[layerDisk] -> Fill(abs_trkpt); } // ----------- eca else if (barrelEC == 2){ m_holes_vs_layer_eca -> Fill(layerDisk); + m_holes_vs_LB_pix_eca[layerDisk] -> Fill(float(LumiBlock)); m_holes_vs_Eta_Phi_pix_eca -> Fill(layerDisk, modPhi); } // ----------- ecc else if (barrelEC == -2){ m_holes_vs_layer_ecc -> Fill(layerDisk); + m_holes_vs_LB_pix_ecc[layerDisk] -> Fill(float(LumiBlock)); m_holes_vs_Eta_Phi_pix_ecc -> Fill(layerDisk, modPhi); } } // pix @@ -1494,6 +1502,9 @@ StatusCode IDAlignMonEfficiencies::fillHistograms() // filling histograms for holes being outliers if ( (*HTSOSItr)->type(Trk::TrackStateOnSurface::Outlier) ){ + + //This section has to be removed. There is no hole flagged as outlier. I've checked it (PF) + // holes per layer and per hit // --- pixel if (detType==0){ @@ -1501,17 +1512,20 @@ StatusCode IDAlignMonEfficiencies::fillHistograms() m_holes_vs_layer_barrel -> Fill(layerDisk); m_holes_vs_Eta_Phi_pix_b[layerDisk] -> Fill(modEta,modPhi); m_holes_vs_Eta_pix_b[layerDisk] -> Fill(modEta); + m_holes_vs_LB_pix_b[layerDisk] -> Fill(float(LumiBlock)); m_holes_vs_Phi_pix_b[layerDisk] -> Fill(modPhi); m_holes_vs_pT_pix_b[layerDisk] -> Fill(abs_trkpt); } // ----------- eca else if (barrelEC == 2){ m_holes_vs_layer_eca -> Fill(layerDisk); + m_holes_vs_LB_pix_eca[layerDisk] -> Fill(float(LumiBlock)); m_holes_vs_Eta_Phi_pix_eca -> Fill(layerDisk, modPhi); } // ----------- ecc else if (barrelEC == -2){ m_holes_vs_layer_ecc -> Fill(layerDisk); + m_holes_vs_LB_pix_ecc[layerDisk] -> Fill(float(LumiBlock)); m_holes_vs_Eta_Phi_pix_ecc -> Fill(layerDisk, modPhi); } } // pix @@ -1541,6 +1555,9 @@ StatusCode IDAlignMonEfficiencies::fillHistograms() // filling histograms for holes being measurements if ( (*HTSOSItr)->type(Trk::TrackStateOnSurface::Measurement) ){ + + //This has to be removed. There are no holes flagged as measurements. Checked it. PF + // holes per layer and per hit // --- pixel if (detType==0){ @@ -1549,16 +1566,19 @@ StatusCode IDAlignMonEfficiencies::fillHistograms() m_holes_vs_Eta_Phi_pix_b[layerDisk] -> Fill(modEta,modPhi); m_holes_vs_Eta_pix_b[layerDisk] -> Fill(modEta); m_holes_vs_Phi_pix_b[layerDisk] -> Fill(modPhi); + m_holes_vs_LB_pix_b[layerDisk] -> Fill(float(LumiBlock)); m_holes_vs_pT_pix_b[layerDisk] -> Fill(abs_trkpt); } // ----------- eca else if (barrelEC == 2){ m_holes_vs_layer_eca -> Fill(layerDisk); + m_holes_vs_LB_pix_eca[layerDisk] -> Fill(float(LumiBlock)); m_holes_vs_Eta_Phi_pix_eca -> Fill(layerDisk, modPhi); } // ----------- ecc else if (barrelEC == -2){ m_holes_vs_layer_ecc -> Fill(layerDisk); + m_holes_vs_LB_pix_ecc[layerDisk] -> Fill(float(LumiBlock)); m_holes_vs_Eta_Phi_pix_ecc -> Fill(layerDisk, modPhi); } } // pix @@ -1815,8 +1835,11 @@ StatusCode IDAlignMonEfficiencies::procHistograms() - //LB plots + //LB plots - Barrel makeEffHisto(m_measurements_vs_LB_pix_b[iLayer],m_hits_vs_LB_pix_b[iLayer],m_measurements_eff_vs_LB_pix_b[iLayer]); + makeEffHisto(m_outliers_vs_LB_pix_b[iLayer],m_hits_vs_LB_pix_b[iLayer],m_outliers_eff_vs_LB_pix_b[iLayer]); + makeEffHisto(m_holes_vs_LB_pix_b[iLayer],m_hits_vs_LB_pix_b[iLayer],m_holes_eff_vs_LB_pix_b[iLayer]); + @@ -1824,29 +1847,40 @@ StatusCode IDAlignMonEfficiencies::procHistograms() for (int iECIndex = 0; iECIndex < m_PIX_Mgr->numerology().numEndcaps(); ++iECIndex) { int iSide = m_PIX_Mgr->numerology().endcapId(iECIndex); - for (int iWheel=0; iWheel < m_PIX_Mgr->numerology().numDisks();++iWheel) + for (int iDisk=0; iDisk < m_PIX_Mgr->numerology().numDisks();++iDisk) { - if (!m_SCT_Mgr->numerology().useDisk(iWheel)){//To check if the Wheel is in use. - msg(MSG::WARNING) << "Wheel "<<iWheel<<" Not in Use"<<endreq; + if (!m_PIX_Mgr->numerology().useDisk(iDisk)){//To check if the Disk is in use. + msg(MSG::WARNING) << "Disk "<<iDisk<<" Not in Use"<<endreq; continue;} if (iSide>0) { - makeEffHisto(m_measurements_vs_Phi_pix_eca[iWheel],m_hits_vs_Phi_pix_eca[iWheel],m_measurements_eff_vs_Phi_pix_eca[iWheel]); + makeEffHisto(m_measurements_vs_Phi_pix_eca[iDisk],m_hits_vs_Phi_pix_eca[iDisk],m_measurements_eff_vs_Phi_pix_eca[iDisk]); + makeEffHisto(m_measurements_vs_LB_pix_eca[iDisk],m_hits_vs_LB_pix_eca[iDisk],m_measurements_eff_vs_LB_pix_eca[iDisk]); + makeEffHisto(m_holes_vs_LB_pix_eca[iDisk],m_hits_vs_LB_pix_eca[iDisk],m_holes_eff_vs_LB_pix_eca[iDisk]); + makeEffHisto(m_outliers_vs_LB_pix_eca[iDisk],m_hits_vs_LB_pix_eca[iDisk],m_outliers_eff_vs_LB_pix_eca[iDisk]); } if (iSide<0) { - makeEffHisto(m_measurements_vs_Phi_pix_ecc[iWheel],m_hits_vs_Phi_pix_ecc[iWheel],m_measurements_eff_vs_Phi_pix_ecc[iWheel]); + makeEffHisto(m_measurements_vs_Phi_pix_ecc[iDisk],m_hits_vs_Phi_pix_ecc[iDisk],m_measurements_eff_vs_Phi_pix_ecc[iDisk]); + makeEffHisto(m_measurements_vs_LB_pix_ecc[iDisk],m_hits_vs_LB_pix_ecc[iDisk],m_measurements_eff_vs_LB_pix_ecc[iDisk]); + makeEffHisto(m_holes_vs_LB_pix_ecc[iDisk],m_hits_vs_LB_pix_ecc[iDisk],m_holes_eff_vs_LB_pix_ecc[iDisk]); + makeEffHisto(m_outliers_vs_LB_pix_ecc[iDisk],m_hits_vs_LB_pix_ecc[iDisk],m_outliers_eff_vs_LB_pix_ecc[iDisk]); - } - }//Wheel loop + } + + + + + + + + }//Disk loop }//Endcap loop - makeEffHisto(m_measurements_vs_LB_pix_eca,m_hits_vs_LB_pix_eca,m_measurements_eff_vs_LB_pix_eca); - makeEffHisto(m_measurements_vs_LB_pix_ecc,m_hits_vs_LB_pix_ecc,m_measurements_eff_vs_LB_pix_ecc); - + for (int iLayer=0; iLayer < m_SCT_Mgr->numerology().numLayers();++iLayer) { if (!m_SCT_Mgr->numerology().useLayer(iLayer)){ @@ -2458,9 +2492,24 @@ void IDAlignMonEfficiencies::makePIXBarrelHistograms(MonGroup& al_mon){ m_measurements_vs_LB_pix_b.push_back(new TH1F(("measurements_vs_LB_pix_b"+intToString(iLayer)).c_str(),("measurements per possible hits vs. LB-ID in PIX barrel layer "+intToString(iLayer)).c_str(),m_nLB,m_minLB,m_maxLB)); RegisterHisto(al_mon,m_measurements_vs_LB_pix_b[iLayer]); - m_measurements_eff_vs_LB_pix_b.push_back(new TProfile(("measurements_eff_vs_LB_pix_b"+intToString(iLayer)).c_str(),("measurements per possible hits vs. LB-ID in PIX barrel layer "+intToString(iLayer)).c_str(),m_nLB,m_minLB,m_maxLB, 0.5,1.)); - RegisterHisto(al_mon,m_measurements_eff_vs_LB_pix_b[iLayer]); + m_measurements_eff_vs_LB_pix_b.push_back(new TProfile(("measurements_eff_vs_LB_pix_b"+intToString(iLayer)).c_str(),("measurements eff per possible hits vs. LB-ID in PIX barrel layer "+intToString(iLayer)).c_str(),m_nLB,m_minLB,m_maxLB, 0.,1.)); + RegisterHisto(al_mon,m_measurements_eff_vs_LB_pix_b[iLayer]); + + //holes vs LB by layer + m_holes_vs_LB_pix_b.push_back(new TH1F(("holes_vs_LB_pix_b"+intToString(iLayer)).c_str(),("holes per possible hits vs. LB-ID in PIX barrel layer "+intToString(iLayer)).c_str(),m_nLB,m_minLB,m_maxLB)); + RegisterHisto(al_mon,m_holes_vs_LB_pix_b[iLayer]); + + m_holes_eff_vs_LB_pix_b.push_back(new TProfile(("holes_eff_vs_LB_pix_b"+intToString(iLayer)).c_str(),("holes eff per possible hits vs. LB-ID in PIX barrel layer "+intToString(iLayer)).c_str(),m_nLB,m_minLB,m_maxLB, 0.,1.)); + RegisterHisto(al_mon,m_holes_eff_vs_LB_pix_b[iLayer]); + //outliers vs LB by layer + + m_outliers_vs_LB_pix_b.push_back(new TH1F(("outliers_vs_LB_pix_b"+intToString(iLayer)).c_str(),("outliers per possible hits vs. LB-ID in PIX barrel layer "+intToString(iLayer)).c_str(),m_nLB,m_minLB,m_maxLB)); + RegisterHisto(al_mon,m_outliers_vs_LB_pix_b[iLayer]); + + m_outliers_eff_vs_LB_pix_b.push_back(new TProfile(("outliers_eff_vs_LB_pix_b"+intToString(iLayer)).c_str(),("outliers eff per possible hits vs. LB-ID in PIX barrel layer "+intToString(iLayer)).c_str(),m_nLB,m_minLB,m_maxLB, 0.,1.)); + RegisterHisto(al_mon,m_outliers_eff_vs_LB_pix_b[iLayer]); + //overlap efficiency by layer if (m_extendedPlots) @@ -2562,9 +2611,39 @@ void IDAlignMonEfficiencies::makePIXEndCapsHistograms(MonGroup& al_mon){ } if (iSide>0) { - //hits for endcaps - m_hits_vs_Phi_pix_eca.push_back( new TH1F(("hits_vs_Phi_pix_eca"+intToString(iWheel)).c_str(),("possible hits vs. Phi-ID in Pixel eca layer "+intToString(iWheel)).c_str(),maxPhiModulesPerRing,-0.5,maxPhiModulesPerRing-0.5)); + + m_hits_vs_Phi_pix_eca.push_back( new TH1F(("hits_vs_Phi_pix_eca"+intToString(iWheel)).c_str(),("possible hits vs. Phi-ID in Pixel eca Disk "+intToString(iWheel)).c_str(),maxPhiModulesPerRing,-0.5,maxPhiModulesPerRing-0.5)); RegisterHisto(al_mon,m_hits_vs_Phi_pix_eca[iWheel]) ; + + //vs LB + + m_hits_vs_LB_pix_eca.push_back ( new TH1F(("hits_vs_LB_pix_eca"+intToString(iWheel)).c_str(),("possible hits vs. LB-ID in Pixel ECA Disk " +intToString(iWheel)).c_str(),m_nLB,m_minLB,m_maxLB)); + RegisterHisto(al_mon,m_hits_vs_LB_pix_eca[iWheel]); + + m_measurements_vs_LB_pix_eca.push_back( new TH1F(("measurements_vs_LB_pix_eca"+intToString(iWheel)).c_str(),("possible measurements vs. LB-ID in Pixel ECA Disk " +intToString(iWheel)).c_str(),m_nLB,m_minLB,m_maxLB)); + RegisterHisto(al_mon,m_measurements_vs_LB_pix_eca[iWheel]); + + m_measurements_eff_vs_LB_pix_eca.push_back(new TProfile(("measurements_eff_vs_LB_pix_eca"+intToString(iWheel)).c_str(),("measurements eff per possible hits vs. LB-ID in PIX Eca Disk "+intToString(iWheel)).c_str(),m_nLB,m_minLB,m_maxLB, 0.,1.)); + RegisterHisto(al_mon,m_measurements_eff_vs_LB_pix_eca[iWheel]); + + //outliers + + m_outliers_vs_LB_pix_eca.push_back( new TH1F(("outliers_vs_LB_pix_eca"+intToString(iWheel)).c_str(),("outliers vs. LB-ID in Pixel ECA Disk " +intToString(iWheel)).c_str(),m_nLB,m_minLB,m_maxLB)); + RegisterHisto(al_mon,m_outliers_vs_LB_pix_eca[iWheel]); + + m_outliers_eff_vs_LB_pix_eca.push_back(new TProfile(("outliers_eff_vs_LB_pix_eca"+intToString(iWheel)).c_str(),("outliers eff per possible hits vs. LB-ID in PIX Eca Disk "+intToString(iWheel)).c_str(),m_nLB,m_minLB,m_maxLB, 0.,1.)); + RegisterHisto(al_mon,m_outliers_eff_vs_LB_pix_eca[iWheel]); + + //holes + + m_holes_vs_LB_pix_eca.push_back( new TH1F(("holes_vs_LB_pix_eca"+intToString(iWheel)).c_str(),("holes vs. LB-ID in Pixel ECA Disk " +intToString(iWheel)).c_str(),m_nLB,m_minLB,m_maxLB)); + RegisterHisto(al_mon,m_holes_vs_LB_pix_eca[iWheel]); + + m_holes_eff_vs_LB_pix_eca.push_back(new TProfile(("holes_eff_vs_LB_pix_eca"+intToString(iWheel)).c_str(),("holes eff per possible hits vs. LB-ID in PIX Eca Disk "+intToString(iWheel)).c_str(),m_nLB,m_minLB,m_maxLB, 0.,1.)); + RegisterHisto(al_mon,m_holes_eff_vs_LB_pix_eca[iWheel]); + + + if (m_extendedPlots) { //overlaps by layer @@ -2595,6 +2674,35 @@ void IDAlignMonEfficiencies::makePIXEndCapsHistograms(MonGroup& al_mon){ //hits for endcaps m_hits_vs_Phi_pix_ecc.push_back( new TH1F(("hits_vs_Phi_pix_ecc"+intToString(iWheel)).c_str(),("possible hits vs. Phi-ID in Pixel ecc layer "+intToString(iWheel)).c_str(),maxPhiModulesPerRing,-0.5,maxPhiModulesPerRing-0.5)); RegisterHisto(al_mon,m_hits_vs_Phi_pix_ecc[iWheel]) ; + + //vs LB + + m_hits_vs_LB_pix_ecc.push_back( new TH1F(("hits_vs_LB_pix_ecc"+intToString(iWheel)).c_str(),("possible hits vs. LB-ID in Pixel ECC Disk " +intToString(iWheel)).c_str(),m_nLB,m_minLB,m_maxLB)); + RegisterHisto(al_mon,m_hits_vs_LB_pix_ecc[iWheel]); + + m_measurements_vs_LB_pix_ecc.push_back( new TH1F(("measurements_vs_LB_pix_ecc"+intToString(iWheel)).c_str(),("possible measurements vs. LB-ID in Pixel ECC Disk " +intToString(iWheel)).c_str(),m_nLB,m_minLB,m_maxLB)); + RegisterHisto(al_mon,m_measurements_vs_LB_pix_ecc[iWheel]); + + m_measurements_eff_vs_LB_pix_ecc.push_back(new TProfile(("measurements_eff_vs_LB_pix_ecc"+intToString(iWheel)).c_str(),("measurements eff per possible hits vs. LB-ID in PIX Ecc Disk "+intToString(iWheel)).c_str(),m_nLB,m_minLB,m_maxLB, 0.,1.)); + RegisterHisto(al_mon,m_measurements_eff_vs_LB_pix_ecc[iWheel]); + + //outliers + + m_outliers_vs_LB_pix_ecc.push_back( new TH1F(("outliers_vs_LB_pix_ecc"+intToString(iWheel)).c_str(),("outliers vs. LB-ID in Pixel ECC Disk " +intToString(iWheel)).c_str(),m_nLB,m_minLB,m_maxLB)); + RegisterHisto(al_mon,m_outliers_vs_LB_pix_ecc[iWheel]); + + m_outliers_eff_vs_LB_pix_ecc.push_back(new TProfile(("outliers_eff_vs_LB_pix_ecc"+intToString(iWheel)).c_str(),("outliers eff per possible hits vs. LB-ID in PIX Ecc Disk "+intToString(iWheel)).c_str(),m_nLB,m_minLB,m_maxLB, 0.,1.)); + RegisterHisto(al_mon,m_outliers_eff_vs_LB_pix_ecc[iWheel]); + + //holes + + m_holes_vs_LB_pix_ecc.push_back( new TH1F(("holes_vs_LB_pix_ecc"+intToString(iWheel)).c_str(),("holes vs. LB-ID in Pixel ECC Disk " +intToString(iWheel)).c_str(),m_nLB,m_minLB,m_maxLB)); + RegisterHisto(al_mon,m_holes_vs_LB_pix_ecc[iWheel]); + + m_holes_eff_vs_LB_pix_ecc.push_back(new TProfile(("holes_eff_vs_LB_pix_ecc"+intToString(iWheel)).c_str(),("holes eff per possible hits vs. LB-ID in PIX Ecc Disk "+intToString(iWheel)).c_str(),m_nLB,m_minLB,m_maxLB, 0.,1.)); + RegisterHisto(al_mon,m_holes_eff_vs_LB_pix_ecc[iWheel]); + + if (m_extendedPlots) { //overlaps by layer @@ -2620,25 +2728,7 @@ void IDAlignMonEfficiencies::makePIXEndCapsHistograms(MonGroup& al_mon){ } } } - //vs LB - - m_hits_vs_LB_pix_eca = new TH1F("hits_vs_LB_pix_eca","possible hits vs. LB-ID in Pixel ECA",m_nLB,m_minLB,m_maxLB); - RegisterHisto(al_mon,m_hits_vs_LB_pix_eca); - m_measurements_vs_LB_pix_eca = new TH1F("measurements_vs_LB_pix_eca","measurements per possible hits vs. LB-ID in Pixel ECA",m_nLB,m_minLB,m_maxLB); - RegisterHisto(al_mon,m_measurements_vs_LB_pix_eca); - m_measurements_eff_vs_LB_pix_eca = new TProfile("measurements_eff_vs_LB_pix_eca","measurements per possible hits vs. LB-ID in Pixel ECA",m_nLB,m_minLB,m_maxLB, 0.5,1.); - RegisterHisto(al_mon,m_measurements_eff_vs_LB_pix_eca); - - //vs LB - - m_hits_vs_LB_pix_ecc = new TH1F("hits_vs_LB_pix_ecc","possible hits vs. LB-ID in Pixel ECC",m_nLB,m_minLB,m_maxLB); - RegisterHisto(al_mon,m_hits_vs_LB_pix_ecc); - m_measurements_vs_LB_pix_ecc = new TH1F("measurements_vs_LB_pix_ecc","measurements per possible hits vs. LB-ID in Pixel ECC",m_nLB,m_minLB,m_maxLB); - RegisterHisto(al_mon,m_measurements_vs_LB_pix_ecc); - m_measurements_eff_vs_LB_pix_ecc = new TProfile("measurements_eff_vs_LB_pix_ecc","measurements per possible hits vs. LB-ID in Pixel ECC",m_nLB,m_minLB,m_maxLB, 0.5,1.); - RegisterHisto(al_mon,m_measurements_eff_vs_LB_pix_ecc); - - + } void IDAlignMonEfficiencies::makeSCTBarrelHistograms(MonGroup &al_mon){ diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.h index a8a98125536..922cfe7e1c2 100755 --- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.h +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.h @@ -323,22 +323,40 @@ class IDAlignMonEfficiencies : public ManagedMonitorToolBase std::vector<TProfile*> m_measurements_eff_vs_Phi_sct_b; std::vector<TProfile*> m_measurements_eff_vs_LB_pix_b; + std::vector<TProfile*> m_holes_eff_vs_LB_pix_b; + std::vector<TProfile*> m_outliers_eff_vs_LB_pix_b; std::vector<TH1F*> m_measurements_vs_LB_pix_b; + std::vector<TH1F*> m_holes_vs_LB_pix_b; + std::vector<TH1F*> m_outliers_vs_LB_pix_b; std::vector<TH1F*> m_hits_vs_LB_pix_b; std::vector<TProfile*> m_measurements_eff_vs_LB_sct_b; std::vector<TH1F*> m_measurements_vs_LB_sct_b; std::vector<TH1F*> m_hits_vs_LB_sct_b; - TProfile* m_measurements_eff_vs_LB_pix_eca; - TH1F* m_hits_vs_LB_pix_eca; - TH1F* m_measurements_vs_LB_pix_eca; + std::vector<TProfile*> m_measurements_eff_vs_LB_pix_eca; + std::vector<TProfile*> m_measurements_eff_vs_LB_pix_ecc; + std::vector<TProfile*> m_holes_eff_vs_LB_pix_eca; + std::vector<TProfile*> m_holes_eff_vs_LB_pix_ecc; + std::vector<TProfile*> m_outliers_eff_vs_LB_pix_eca; + std::vector<TProfile*> m_outliers_eff_vs_LB_pix_ecc; + + std::vector<TH1F*> m_hits_vs_LB_pix_eca; + std::vector<TH1F*> m_outliers_vs_LB_pix_eca; + std::vector<TH1F*> m_holes_vs_LB_pix_eca; + std::vector<TH1F*> m_measurements_vs_LB_pix_eca; + std::vector<TH1F*> m_hits_vs_LB_pix_ecc; + std::vector<TH1F*> m_outliers_vs_LB_pix_ecc; + std::vector<TH1F*> m_holes_vs_LB_pix_ecc; + std::vector<TH1F*> m_measurements_vs_LB_pix_ecc; + + TProfile* m_measurements_eff_vs_LB_sct_eca; TH1F* m_hits_vs_LB_sct_eca; TH1F* m_measurements_vs_LB_sct_eca; - TProfile* m_measurements_eff_vs_LB_pix_ecc; - TH1F* m_hits_vs_LB_pix_ecc; - TH1F* m_measurements_vs_LB_pix_ecc; + + + TProfile* m_measurements_eff_vs_LB_sct_ecc; TH1F* m_hits_vs_LB_sct_ecc; TH1F* m_measurements_vs_LB_sct_ecc; @@ -429,6 +447,7 @@ class IDAlignMonEfficiencies : public ManagedMonitorToolBase int m_checkrate; int m_NPixLayers; int m_events; + int m_mapSplit; int m_histosBooked; bool m_doHitQuality; float m_minLB; diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.cxx new file mode 100755 index 00000000000..34a7dff245d --- /dev/null +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.cxx @@ -0,0 +1,475 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ********************************************************************** +// IDAlignMonPVBiases.cxx +// AUTHORS: Ambrosius Vermeulen, Pierfrancesco Butti +// ********************************************************************** + +#include <sstream> +#include <math.h> +#include "TH1.h" +#include "TH2.h" +#include "TProfile.h" +#include "TMath.h" + +#include "GaudiKernel/IJobOptionsSvc.h" +#include "GaudiKernel/MsgStream.h" + +#include "AtlasDetDescr/AtlasDetectorID.h" +#include "InDetIdentifier/PixelID.h" +#include "InDetIdentifier/SCT_ID.h" +#include "InDetIdentifier/TRT_ID.h" + +#include "TrkTrack/TrackCollection.h" +#include "InDetRIO_OnTrack/SiClusterOnTrack.h" +#include "InDetPrepRawData/SiCluster.h" + + +//#include "Particle/TrackParticleContainer.h" +#include "Particle/TrackParticle.h" +#include "TrkParticleBase/LinkToTrackParticleBase.h" + +#include "TrkEventPrimitives/FitQuality.h" +#include "TrkEventPrimitives/LocalParameters.h" + +#include "InDetBeamSpotService/IBeamCondSvc.h" +#include "xAODEventInfo/EventInfo.h" +//#include "EventInfo/EventInfo.h" + +//#include "AthenaMonitoring/AthenaMonManager.h" +#include "IDAlignMonPVBiases.h" +#include "CLHEP/GenericFunctions/CumulativeChiSquare.hh" + +#include "InDetAlignGenTools/IInDetAlignHitQualSelTool.h" +#include "TrackSelectionTool.h" +#include "TrkVertexFitterInterfaces/ITrackToVertexIPEstimator.h" + + +// ********************************************************************* +// Public Methods +// ********************************************************************* + +IDAlignMonPVBiases::IDAlignMonPVBiases( const std::string & type, const std::string & name, const IInterface* parent ) + :ManagedMonitorToolBase( type, name, parent ), + m_events(0), + m_tracksName("ExtendedTracks"), + m_triggerChainName("NoTriggerSelection"), + m_trackToVertexIPEstimator("Trk::TrackToVertexIPEstimator"), + m_vertices(0), + m_TreeFolder("/PVbiases/PVbiases"), + m_Tree(0), + m_TreeName("PVbiases") +{ + m_trackSelection = ToolHandle< InDetAlignMon::TrackSelectionTool >("InDetAlignMon::TrackSelectionTool"); + + declareProperty("tracksName" , m_tracksName); + declareProperty("CheckRate" , m_checkrate=1000); + declareProperty("triggerChainName" , m_triggerChainName); + declareProperty("trackSelection" , m_trackSelection); + declareProperty("VxPrimContainerName" , m_VxPrimContainerName); + +} + + +IDAlignMonPVBiases::~IDAlignMonPVBiases() { } + + +StatusCode IDAlignMonPVBiases::initialize() +{ + StatusCode sc; + m_events=0; + + sc = ManagedMonitorToolBase::initialize(); + if(!sc.isSuccess()) + return StatusCode::SUCCESS; + + if ( m_trackSelection.retrieve().isFailure() ) { + if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Failed to retrieve tool " << m_trackSelection << endreq; + return StatusCode::SUCCESS; + } else { + if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "BROOS Retrieved tool " << m_trackSelection << endreq; + } + + //create tree and branches + if(m_Tree == 0) { + + m_Tree = new TTree(m_TreeName.c_str(), "Tree"); + + m_Tree->Branch("run_number" , &m_runNumber, "runNumber/I"); + m_Tree->Branch("event_number" , &m_evtNumber, "eventNumber/I"); + m_Tree->Branch("lumi_block" , &m_lumi_block, "lumi_block/I"); + + m_Tree->Branch("charge", &m_charge, "Charge/D"); + m_Tree->Branch("pt", &m_pt, "pt/D"); + m_Tree->Branch("eta", &m_eta, "eta/D"); + m_Tree->Branch("phi", &m_phi, "phi/D"); + m_Tree->Branch("z0", &m_z0, "z0/D"); + m_Tree->Branch("d0", &m_d0, "d0/D"); + m_Tree->Branch("z0_err", &m_z0_err, "z0_err/D"); + m_Tree->Branch("d0_err", &m_d0_err, "d0_err/D"); + m_Tree->Branch("vertex_x", &m_vertex_x, "vertex_x/D"); + m_Tree->Branch("vertex_y", &m_vertex_y, "vertex_y/D"); + m_Tree->Branch("vertex_z", &m_vertex_z, "vertex_z/D"); + } + + //register the tree + ITHistSvc* tHistSvc = 0; + if (service("THistSvc",tHistSvc).isFailure()){ + ATH_MSG_ERROR("initialize() Could not find Hist Service -> Switching ValidationMode Off !"); + //m_validationMode = false; + } + + if ((tHistSvc->regTree(m_TreeFolder, m_Tree)).isFailure() ) { + ATH_MSG_ERROR("initialize() Could not register the validation Tree -> Switching ValidationMode Off !"); + delete m_Tree; m_Tree = 0; + //m_validationMode = false; + } + + return StatusCode::SUCCESS; +} + +StatusCode IDAlignMonPVBiases::bookHistograms() +{ + +return StatusCode::SUCCESS; +} + +StatusCode IDAlignMonPVBiases::procHistograms() +{ + + return StatusCode::SUCCESS; +} + +StatusCode IDAlignMonPVBiases::fillHistograms() +{ + m_events++; + + /****************************************************************** + ** Event Information + *******************************************************************/ + bool isMC = false; + //get eventinfo + ATH_MSG_DEBUG("Retrieving event info."); + const xAOD::EventInfo * eventInfo; + if (evtStore()->retrieve(eventInfo).isFailure()) + ATH_MSG_ERROR("Could not retrieve event info."); + else + { + m_runNumber = eventInfo->runNumber(); + m_evtNumber = eventInfo->eventNumber(); + m_lumi_block = eventInfo->lumiBlock(); + ATH_MSG_DEBUG(" Execute() starting on --> Run: " << m_runNumber << " event: " << m_evtNumber); + } + + + /// Beam spot error + bsXerror = eventInfo->beamPosSigmaX(); + bsYerror = eventInfo->beamPosSigmaY(); + bsXYerror = eventInfo->beamPosSigmaXY(); + bsZerror = eventInfo->beamPosSigmaZ(); + //Info("execute()", "bsXerror: %f, bsYerror: %f, bserror: %f, correlation:%f", bsXerror, bsYerror, bserror, eventInfo->beamPosSigmaXY() ); + + //COMMENTED OUT BY BROOS + //h2beamSpotXY->Fill( eventInfo->beamPosX(), eventInfo->beamPosY()); + //h2beamSpotErrorXY->Fill( bsXerror, bsYerror); + //h1beamSpotZ->Fill( eventInfo->beamPosZ() ); + + /// check if the event is data or MC + //if(eventInfo->eventType( xAOD::EventInfo::IS_SIMULATION ) ){ + // isMC = true; + // } + + /// Scale Factor +/* if(isMC){ + /// K_PV from Sarah Boutle, 18/5/2015 + kPV_d0 = 0.95; // +- 0.03 + kPV_z0 = 0.98; // +- 0.02 + kPV_z0st = 0.98; // +- 0.02 TEMPORARY!!! + }else{ + kPV_d0 = 1.06; // +- 0.03 + kPV_z0 = 1.01; // +- 0.02 + kPV_z0st = 1.01; // +- 0.02 TEMPORARY!!! + } +*/ + /// Event weight + /// Overall weight is sigma*efficiency/Nevent, where sigma and filter + /// efficiency are gotten from AMI +// wt = 1.; + //if(isMC){ + // const std::vector< float > weights = eventInfo->mcEventWeights(); + // if( weights.size() > 0 ) wt = weights[0]; + //} + + //COMMENTED OUT BY BROOS + /* + /// if data check if event passes GRL & remove detector imperfection + if(!isMC){ // it's data! + //if(m_debug) std::cout << " GRL " << std::endl; + if(!m_grl->passRunLB(*eventInfo)){ + return EL::StatusCode::SUCCESS; // go to next event + } + //if(m_debug) std::cout << " Detector imperfection " << std::endl; + if( (eventInfo->errorState(xAOD::EventInfo::LAr)==xAOD::EventInfo::Error ) + || (eventInfo->errorState(xAOD::EventInfo::Tile)==xAOD::EventInfo::Error ) + || (eventInfo->isEventFlagBitSet(xAOD::EventInfo::Core, 18) ) ) + { + return EL::StatusCode::SUCCESS; // go to the next event + } // end if event flags check + } // end if not MC + + + /// examine the HLT_xe80* chains, see if they passed/failed and their total prescale + if(m_doTrigger){ + if(m_debug) std::cout << " Trigger " << std::endl; + bool triggerIsPassed = false; + auto chainGroup = m_trigDecisionTool->getChainGroup( m_triggermenu.c_str() ); + std::map<std::string,int> triggerCounts; + for(auto &trig : chainGroup->getListOfTriggers()) { + auto cg = m_trigDecisionTool->getChainGroup(trig); + std::string thisTrig = trig; + triggerIsPassed = cg->isPassed(); + //Info( "execute()", "%30s chain passed(1)/failed(0): %d total chain prescale (L1*HLT): %.1f", thisTrig.c_str(), cg->isPassed(), cg->getPrescale() ); + } // end for loop (c++11 style) over chain group matching "HLT_xe80*" + if(!triggerIsPassed){ + return EL::StatusCode::SUCCESS; // go to the next event + } + if(m_debug) std::cout << " Finish Trigger " << std::endl; + } + + + //// Fill the pile up + h1ActPileUp->Fill(eventInfo->actualInteractionsPerCrossing(), wt); + h1AvePileUp->Fill(eventInfo->averageInteractionsPerCrossing(), wt); + h1DiffPileUp->Fill(eventInfo->actualInteractionsPerCrossing() - + eventInfo->averageInteractionsPerCrossing(), wt); + */ + + + /****************************************************************** + * Vertex Loop + ******************************************************************/ + /* + if(m_debug) std::cout << "Vertex loop" << std::endl; + const xAOD::VertexContainer* vertices = 0; + if( ! m_event->retrieve( vertices, "PrimaryVertices").isSuccess() ){ + Error("execute()", "Failed to retrieve event info collection. Exiting." ); + return EL::StatusCode::FAILURE; + } + xAOD::VertexContainer::const_iterator vertex_itr = vertices->begin(); + xAOD::VertexContainer::const_iterator vertex_itrE = vertices->end(); + unsigned int *nvertices = new unsigned int(0); + bool *hasMT10traks = new bool(false); + for (; vertex_itr!=vertex_itrE; ++vertex_itr) { + if((*vertex_itr)->vertexType() != 1) continue; // require primary vertex + int nTracksPerVtx = (*vertex_itr)->nTrackParticles(); + if(nTracksPerVtx >= 10) (*hasMT10traks)=true; + if(nTracksPerVtx > 4) (*nvertices)++; + h1PrimVtxX->Fill( (*vertex_itr)->x() ); + } + /// additional cut for primary vertex to reduce the effect of multile interactions + //if( hasMT10traks && (*nvertices) > 1 ){ + // return EL::StatusCode::SUCCESS; + //} + m_eventCounterAfterVtxCut++; + + delete nvertices; + delete hasMT10traks; + */ + + + /****************************************************************** + * Track Loop + ******************************************************************/ + //const xAOD::TrackParticleContainer* tracks = 0; + //if( ! evtStore()->retrieve( tracks, "InDetTrackParticles").isSuccess() ){ + //msg(MSG::WARNING) << "Failed to retrieve event info collection. Exiting." << endreq; + //return StatusCode::FAILURE; + //} + const xAOD::TrackParticleContainer* tracks = evtStore()->retrieve< const xAOD::TrackParticleContainer >("InDetTrackParticles"); + + xAOD::TrackParticleContainer::const_iterator track_itr = tracks->begin(); + xAOD::TrackParticleContainer::const_iterator track_itrE = tracks->end(); + + /// Track Loop + for (; track_itr!=track_itrE; ++track_itr) { + +/* uint8_t nhitsOfPixel = 0; + uint8_t ndeadOfPixel = 0; + uint8_t nhitsOfSCT = 0; + uint8_t ndeadOfSCT = 0; + uint8_t nSharedHitsOfPixel = 0; + uint8_t nSharedHitsOfSCT = 0; + uint8_t nholesOfPixel = 0; + uint8_t nholesOfSCT = 0; + + if( !(*track_itr)->summaryValue(nhitsOfPixel, xAOD::numberOfPixelHits)) continue; + if( !(*track_itr)->summaryValue(ndeadOfPixel, xAOD::numberOfPixelDeadSensors)) continue; + if( !(*track_itr)->summaryValue(nhitsOfSCT, xAOD::numberOfSCTHits)) continue; + if( !(*track_itr)->summaryValue(ndeadOfSCT, xAOD::numberOfSCTDeadSensors)) continue; + if( !(*track_itr)->summaryValue(nSharedHitsOfPixel, xAOD::numberOfPixelSharedHits)) continue; + if( !(*track_itr)->summaryValue(nSharedHitsOfSCT, xAOD::numberOfSCTSharedHits)) continue; + if( !(*track_itr)->summaryValue(nholesOfPixel, xAOD::numberOfPixelHoles)) continue; + if( !(*track_itr)->summaryValue(nholesOfSCT, xAOD::numberOfSCTHoles)) continue; + + // To avoid crash for 20.7 + if( (*track_itr)->pt() < 300. || isinf((*track_itr)->pt()) || isnan((*track_itr)->pt()) || (*track_itr)->pt() > 1000000. ) continue; + + + if( !(fabs( (*track_itr)->eta() ) < 2.5) && + !((nhitsOfPixel + ndeadOfPixel + nhitsOfSCT + ndeadOfSCT) >= 7) && + !((nSharedHitsOfPixel + (0.5*nSharedHitsOfSCT)) <= 1) && + !((nholesOfPixel + nholesOfSCT) <= 2) && + !(nholesOfPixel <= 1)) { + continue; + } + //bool trkSelection[nCuts] = {false}; + int dummy = nholesOfPixel; + msg(MSG::INFO) << "Number of pixel hits:" << dummy << endreq; +*/ + + //ElementLink< xAOD::VertexContainer> vtxLink = trktovxtool->getUniqueMatchVertexLink( (**track_itr), (*vertices) ); + //if(!vtxLink.isValid() ) continue; + //priVtx = (*vtxLink); + + //if(priVtx->vertexType() != 1) continue; + + + + + /// retrieve truth particle and vertex + /*const xAOD::TruthParticle * truthTrk = 0; + if(isMC){ + typedef ElementLink< xAOD::TruthParticleContainer > Link_t; + static const char* NAME = "truthParticleLink"; + if(! (*track_itr)->isAvailable< Link_t > ( NAME ) ){ + // Info("execute()", "truthParticleLink is not available" ); + } + const Link_t& link = (*track_itr)->auxdata< Link_t > (NAME); + if(!link.isValid() ) continue; + truthTrk = (*link); + /// Cut of truthMatchProbability + h1TruthMatchProb->Fill( (*track_itr)->auxdata<float>("truthMatchProbability") ); + if( (*track_itr)->auxdata<float>("truthMatchProbability") < 0.8 ) continue; + }*/ + + /// retrieve track information + ///if( !(*track_itr)->summaryValue(nhitsOfPixel, xAOD::numberOfBLayerHits)) continue; + //if( !(*track_itr)->summaryValue(nhitsOfPixel, xAOD::numberOfInnermostPixelLayerHits)) continue; + //if( !(*track_itr)->summaryValue(nhitsOfPixel, xAOD::numberOfPixelHits)) continue; + //if( !(*track_itr)->summaryValue(nhitsOfSCT, xAOD::numberOfSCTHits)) continue; + + + /// Definition of parameters + //if(m_debug) std::cout << "[TrackParticle loop] retrieve the parameters" << std::endl; + //retrieveTrackPars( (*track_itr) /*, priVtx */ ); + //if(isMC){ + //retrieveTruthPars( truthTrk /*, priVtx*/ ); + // } + // m_d0 = (*track_itr)->d0(); + // m_z0 = (*track_itr)->z0(); + //m_z0SinTheta = z0 * TMath::Sin( theta ); + //bserror = xAODAnalysis::d0UncertaintyBeamSpot2(phi, bsXerror, bsYerror, bsXYerror); + //bserror = TMath::Hypot(bsXerror*TMath::Sin(phi), bsYerror*TMath::Cos(phi)); + + //std::cout << (*track_itr)->pt() << std::endl; + + + ////// additional cut + ///if( ntracks < 10 ) continue; + ///if( (*track_itr)->auxdata<float>("truthMatchProbability") < 0.8 ) continue; + ///if( truthDr > 0.1) continue; + ///if( fabs(truthPt - pt) > 5. ) continue; + ///if( fabs(truthD0) > 1.0 ) continue; + /* if(!doTruthOnly){ + if( fabs(d0Unbias) > 100.0 || + fabs(z0Unbias) > 100.0 || + fabs(z0stUnbias) > 100.0 ) continue; + }*/ + + ////// Track Selection + ///if(m_debug) std::cout << "[TrackParticle loop] Track Selection" << std::endl; + //////TrackQualityCut( trkSelection ); + + ////// Track Selection Loop + //for(int isel=0; isel<nCuts; isel++){ + + //if(trkSelection[isel] == false) continue; + //if( isel > 0 && !selTool[isel-1]->accept((*track_itr)) ) continue; + //m_trackCounter[isel]++; + + /// Track Weight for MC sample + //float trkwt = 1.; + /*if(isMC && m_doReweight){ + trkwt = readZVTXweight( isel ); + trkwt = trkwt * readPTETAweight( isel ); + //Info("execute()", "zwt = %f, ptetawt = %f, total = %f", readZVTXweight( isel ), readPTETAweight( isel ), trkwt); + }else{ + trkwt = 1.; + }*/ + + /* if(!doTruthOnly){ + unfoldD0Unbias = d0Unbias * UnfoldFactor(kPV_d0, 1.0, pvd0sigmaUnbias, d0sigmaUnbias); + unfoldZ0Unbias = z0Unbias * UnfoldFactor(kPV_z0, 1.0, pvz0sigmaUnbias, z0sigmaUnbias); + unfoldZ0stUnbias = z0stUnbias * UnfoldFactor(kPV_z0st, 1.0, pvz0stsigmaUnbias, z0stsigmaUnbias); + unfoldD0UnbiasError = TMath::Hypot(d0sigmaUnbias, pvd0sigmaUnbias) * UnfoldFactor(kPV_d0, 1.0, pvd0sigmaUnbias, d0sigmaUnbias); + unfoldZ0UnbiasError = TMath::Hypot(z0sigmaUnbias, pvz0sigmaUnbias) * UnfoldFactor(kPV_z0, 1.0, pvz0sigmaUnbias, z0sigmaUnbias); + } + + /// Fill histograms + if(m_debug) std::cout << "[TrackParticle loop] Filling parameters" << std::endl; + fillTrackPars( isel, trkwt ); + if(isMC){ + fillTruthPars( isel, trkwt ); + } + + /// Categorization by pT and theta + if(m_debug) std::cout << "[TrackParticle loop] Filling parameters by categorization" << std::endl; + fillCategorizedMatrices( isel, trkwt ); + */ + + + // lumi block check REMOVE THIS + //if(m_lumi_block != 345) continue; + + // require having vertex + if(!(*track_itr)->vertex()) continue; + // require associated with primary vertex + if((*track_itr)->vertex()->vertexType() != 1) continue; + // require at least 10 tracks associated + if((*track_itr)->vertex()->nTrackParticles() < 10) continue; + + const Trk::ImpactParametersAndSigma* myIPandSigma(NULL); + myIPandSigma = m_trackToVertexIPEstimator->estimate(*track_itr, (*track_itr)->vertex(),true); + + // require d0_pv to be smaller than 4 + if(myIPandSigma->IPd0 > 4.0) continue; + if(myIPandSigma->IPd0 < -4.0) continue; + + // store in ntuple + m_d0=myIPandSigma->IPd0; + m_z0=myIPandSigma->IPz0; + m_z0_err = myIPandSigma->sigmaz0; + m_d0_err= myIPandSigma->sigmad0; + + m_charge = (*track_itr)->charge(); + m_pt = (*track_itr)->pt(); + m_eta = (*track_itr)->eta(); + m_phi = (*track_itr)->phi(); + m_vertex_x = (*track_itr)->vertex()->x(); + m_vertex_y = (*track_itr)->vertex()->y(); + m_vertex_z = (*track_itr)->vertex()->z(); + + m_Tree->Fill(); + + + } // End of track selection loop + + return StatusCode::SUCCESS; +} + +StatusCode IDAlignMonPVBiases::finalize() +{ + return StatusCode::SUCCESS; +} diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.h new file mode 100755 index 00000000000..a1a415291d0 --- /dev/null +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonPVBiases.h @@ -0,0 +1,98 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef IDAlignMonPVBiases_H +#define IDAlignMonPVBiases_H + +// ********************************************************************** +// IDAlignMonPVBIases.cxx +// AUTHORS: Ambrosius Vermeulen, Pierfrancesco Butti +// ********************************************************************** + +#include <vector> + +#include "GaudiKernel/StatusCode.h" +#include "AthenaMonitoring/AthenaMonManager.h" +#include "AthenaMonitoring/ManagedMonitorToolBase.h" +#include "EventPrimitives/EventPrimitives.h" +#include "EventPrimitives/EventPrimitivesHelpers.h" +#include "GaudiKernel/AlgTool.h" +#include "GaudiKernel/ToolHandle.h" +#include "TH3F.h" +#include "TH2F.h" +#include "TFile.h" +#include "xAODTracking/TrackParticle.h" +#include "xAODTracking/TrackParticleContainer.h" +#include "xAODTracking/Vertex.h" +#include "xAODTracking/VertexContainer.h" +#include <map> + +namespace Trk { + class ITrackToVertexIPEstimator; + class VxCandidate; + class Track; + class VxTrackAtVertex; +} + +namespace InDetAlignMon{ + class TrackSelectionTool; +} + +class IDAlignMonPVBiases : public ManagedMonitorToolBase +{ + +public: + + IDAlignMonPVBiases( const std::string & type, const std::string & name, const IInterface* parent ); + + virtual ~IDAlignMonPVBiases(); + virtual StatusCode initialize(); + virtual StatusCode fillHistograms(); + virtual StatusCode finalize(); + virtual StatusCode bookHistograms(); + virtual StatusCode procHistograms(); + +private: + bool fillVertexInformation() const; + const xAOD::Vertex* findAssociatedVertexTP(const xAOD::TrackParticle *) const; + + mutable std::map<const xAOD::TrackParticle*, const xAOD::Vertex* > m_trackVertexMapTP; + + int m_checkrate; + int m_events; + std::string m_tracksName; + std::string m_triggerChainName; + std::string m_VxPrimContainerName; + ToolHandle< Trk::ITrackToVertexIPEstimator > m_trackToVertexIPEstimator; + const xAOD::VertexContainer* m_vertices; + std::string m_TreeFolder; + TTree* m_Tree; + std::string m_TreeName; + + mutable unsigned int m_runNumber; + mutable unsigned int m_evtNumber; + mutable unsigned int m_lumi_block; + + double m_charge; + double m_pt; + double m_eta; + double m_phi; + double m_z0; + double m_d0; + double m_z0_err; + double m_d0_err; + double m_vertex_x; + double m_vertex_y; + double m_vertex_z; + + //Daiki stuf + double bsXerror; + double bsYerror; + double bsXYerror; + double bsZerror; + + ToolHandle< InDetAlignMon::TrackSelectionTool > m_trackSelection; +}; + +#endif diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx index dddf217f028..b48e7bab7f8 100755 --- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx @@ -1430,8 +1430,8 @@ StatusCode IDAlignMonResiduals::fillHistograms() const InDet::TRT_DriftCircleOnTrack *trtCircle = dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>((*iter_tsos)->measurementOnTrack()); - if (trtCircle == NULL) - ATH_MSG_DEBUG("trtCircle is NULL pointer"); + + const InDet::TRT_DriftCircle *RawDriftCircle(NULL); @@ -1440,14 +1440,19 @@ StatusCode IDAlignMonResiduals::fillHistograms() ATH_MSG_DEBUG("Getting RawDriftCircle"); RawDriftCircle = dynamic_cast<const InDet::TRT_DriftCircle*>(trtCircle->prepRawData()); } + else + ATH_MSG_DEBUG("trtCircle is a NULL pointer"); + if ( trtCircle != NULL){ bool isValid; float leadingEdge = -999; if (RawDriftCircle != NULL) { - ATH_MSG_DEBUG("RawDriftCircles have NULL pointer"); leadingEdge=RawDriftCircle->driftTime(isValid); } + else + ATH_MSG_DEBUG("RawDriftCircles are NULL pointer"); + Identifier DCoTId = trtCircle->identify(); float t0 = m_trtcaldbSvc->getT0(DCoTId, TRTCond::ExpandedIdentifier::STRAW); @@ -1459,19 +1464,22 @@ StatusCode IDAlignMonResiduals::fillHistograms() /* Estimates the global Z position of a TRT barrel hit by using the x,y position of the straw and the track theta */ float hitZ = -999.; - Amg::Vector3D center = RawDriftCircle->detectorElement()->surface( id ).center(); - if( fabs(m_barrel_ec) == 1 ){ + Amg::Vector3D center(-9999.,-9999.,-9999);; + if (RawDriftCircle!=NULL) + center = RawDriftCircle->detectorElement()->surface( id ).center() ; + + if( fabs(m_barrel_ec) == 1 && RawDriftCircle!=NULL){ hitZ = sqrt(center.x()*center.x()+center.y()*center.y())*tan(M_PI/2. - theta) + trkz0; //std::cout << "z: " << hitZ << std::endl; } /* Estimates the global R position of a TRT EC hit using the global z position of the straw and the track theta */ float hitGlobalR = -9999.; // -999. is a possible value :) - if( fabs(m_barrel_ec) == 2 ){ + if( fabs(m_barrel_ec) == 2 && RawDriftCircle!=NULL){ hitGlobalR = (center.z() - trkz0) / tan(M_PI/2. - theta); //std::cout << "R: " << hitGlobalR << std::endl; } - + /** filling TRT histograms */ fillTRTHistograms(m_barrel_ec ,m_layer_or_wheel @@ -5117,7 +5125,7 @@ void IDAlignMonResiduals::fillTRTBarrelHistograms(int m_barrel_ec, int m_layer_o for(int lay=0; lay<3; ++lay){ if(lay == m_layer_or_wheel){ m_trt_b_hist->lrOverPhiVsStrawLayer[side] -> Fill(numStrawLayers[lay]+m_straw_layer, LRcorrect, hweight); - if(m_extendedPlots){ + if(m_extendedPlots && hitZ!=-999){ m_trt_b_hist->resVsPhiZ[side][lay]->Fill(hitZ,m_phi_module,residualR,hweight); m_trt_b_hist->resVsPhiEta[side][lay]->Fill(trketa,m_phi_module,residualR,hweight); } @@ -5220,12 +5228,15 @@ void IDAlignMonResiduals::fillTRTEndcapHistograms(int m_barrel_ec, int m_layer_o // fill TH3F of ave residual vs wheel & radius vs charge & LOW PT ONLY if(fabs(trkpt) < m_maxPtEC){ int charge = (trkpt > 0 ? 1 : -1); - if(charge > 0){ - m_trt_ec_hist->resVsRadiusWheelPos[endcap]->Fill(getRing(m_layer_or_wheel,m_straw_layer),hitGlobalR,residualR,hweight); - } - else{ - m_trt_ec_hist->resVsRadiusWheelNeg[endcap]->Fill(getRing(m_layer_or_wheel,m_straw_layer),hitGlobalR,residualR,hweight); - } + if (hitGlobalR != -9999) + { + if(charge > 0){ + m_trt_ec_hist->resVsRadiusWheelPos[endcap]->Fill(getRing(m_layer_or_wheel,m_straw_layer),hitGlobalR,residualR,hweight); + } + else{ + m_trt_ec_hist->resVsRadiusWheelNeg[endcap]->Fill(getRing(m_layer_or_wheel,m_straw_layer),hitGlobalR,residualR,hweight); + } + } } } diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/components/InDetAlignmentMonitoring_entries.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/components/InDetAlignmentMonitoring_entries.cxx index dd98c007f21..fa24b072749 100755 --- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/components/InDetAlignmentMonitoring_entries.cxx +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/components/InDetAlignmentMonitoring_entries.cxx @@ -8,9 +8,10 @@ #include "src/IDAlignMonSivsTRT.h" #include "src/TrackSelectionTool.h" #include "src/TrackSelectionAlg.h" +#include "src/IDAlignMonPVBiases.h" #include "GaudiKernel/DeclareFactoryEntries.h" - +DECLARE_TOOL_FACTORY(IDAlignMonPVBiases) DECLARE_TOOL_FACTORY(IDAlignMonEfficiencies) DECLARE_TOOL_FACTORY(IDAlignMonGenericTracks) DECLARE_TOOL_FACTORY(InDetAlignMonBeamSpot) diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/MagnitudeEvolution.h b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/MagnitudeEvolution.h index b79022c71fc..383c899793c 100644 --- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/MagnitudeEvolution.h +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/MagnitudeEvolution.h @@ -15,11 +15,6 @@ #include <vector> #include <string> -//// ATLAS includes //// -#include "include/AtlasLabels.C" -#include "include/AtlasStyle.C" -#include "include/AtlasUtils.C" - //// ROOT includes //// #include "TArrow.h" #include "TCanvas.h" @@ -39,6 +34,11 @@ #include "TText.h" #include "TSystem.h" +//// ATLAS includes //// +#include "include/AtlasLabels.C" +#include "include/AtlasStyle.C" +#include "include/AtlasUtils.C" + //// parameters //// #define NIBLSTAVES 0 #define MINENTRIES 36 @@ -50,9 +50,9 @@ const bool FULLOUTPUT= false; const bool USEPLANARONLY = true; -bool LUMIBLOCKANALYSIS = false; -bool ITER3ANALYSIS = true; -const int REBINFACTOR = 5; // 100; // LumiBlock rebinning factor for the residuals vs LumiBlock histograms +const bool LUMIBLOCKANALYSIS = false; +const bool ITER3ANALYSIS = false; +const int REBINFACTOR = 2; // 100; // LumiBlock rebinning factor for the residuals vs LumiBlock histograms const bool WRITETEXTOUTPUT = true; const bool REGENERATEAFTERALIGMENTMONITORINGFILE = false; @@ -62,12 +62,13 @@ const bool REGENERATEAFTERALIGMENTMONITORINGFILE = false; const TString me_trackCollection("ExtendedTracks_all"); TString me_outputFolder; TString me_afterAlignmentHistosFolder; +TString me_HOSTNAME; const double z_fix = 366.5; // Stave fixing screw position [mm] float xmax = 0.3; float xmin = -xmax; -const double me_bowingRangeInPlots = 30.; //12.; //in microns +const double me_bowingRangeInPlots = 12.; //12.; 30. //in microns const float me_systUncertaintyBowing = 0.255; // systematic uncertainty on the bowing measurements (in microns) @@ -118,7 +119,7 @@ void ME_clear (); void ME_computeDeltaBx (int); void ME_conditioningStaveSummaryHisto (); void ME_drawEvolInTimeFormat(); -int ME_extractRunNumber (int); +//int ME_extractRunNumber (int); void ME_finalize (); bool ME_fitBowingMagnitude (TH1F*, int, int, int lumiblockid = -1, TString theSuffix=""); bool ME_fitResidualsDistribution (TH1F*, int); diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/drawutils.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/drawutils.py index 16363cf0f5a..4d680b00746 100644 --- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/drawutils.py +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/drawutils.py @@ -84,7 +84,7 @@ def AutoColors(NFiles): Color_i = int(51+i*ColorStep) if Color_i>100: Color_i = 100 - #print " File ", i, " --> color ",Color_i + #print " - color - File ", i, " --> color ",Color_i Colors[i] = Color_i Colors[1] = 1 @@ -455,13 +455,13 @@ def drawCorrEvolution(detector, labelList, drawErrors=False, drawLine=True, whic # Rz keep it independent - yrange[0] = 0.004 - yrange[1] = 0.008 + #yrange[0] = 0.004 + yrange[1] = 0.0065 #yrange[2] = 0.040 #yrange[3] = 0.04 #yrange[4] = 0.04 #yrange[5] = 0.06 - #yrange[6] = 0.0027 + yrange[6] = 0.0025 # # prepare the legend @@ -504,12 +504,13 @@ def drawCorrEvolution(detector, labelList, drawErrors=False, drawLine=True, whic # prepare the histogram that will store the corrections hname = 'Dof_%s_corrections_Evol' % (name) htitle = 'Evolution of %s corrections' % (name) + htitle = 'Evolution of d%s/dLB corrections' % (name) if (doDebug): print " -- drawCorrEvolution -- dof= %d hname= %s" %(dof, hname) print " htitle= ", htitle # build the histogram that is the main frame to plot the corrections for this dof (evolution of dof for each sample) - hCorrectionsEvol[dof] = TH1F(hname, htitle, numberOfSamples, -0.5, numberOfSamples*1.-0.5) + hCorrectionsEvol[dof] = TH1F(hname, htitle, numberOfSamples-1, -0.5, numberOfSamples*1.-1.5) # the last sample is the accumulation # set the x axis labels hCorrectionsEvol[dof].GetXaxis().SetLabelSize(0.05) @@ -531,6 +532,7 @@ def drawCorrEvolution(detector, labelList, drawErrors=False, drawLine=True, whic # label of the Y axis if name is 'Tx' or name is 'Ty' or name is 'Tz' or name is 'Bx': hCorrectionsEvol[dof].SetYTitle("mm") + hCorrectionsEvol[dof].SetYTitle("dTy/dLB [mm/25LB]") else: hCorrectionsEvol[dof].SetYTitle("mrad") @@ -569,15 +571,20 @@ def drawCorrEvolution(detector, labelList, drawErrors=False, drawLine=True, whic hCorrectionsEvolStruct[dof]={} hname = 'Dof_%s_corrections_Evol_struct_%d' % (name, struct) htitle = 'Corrections evolution for structure %s (struct %d)' % (name, struct) - hCorrectionsEvolStruct[dof][struct] = TH1F(hname, htitle, numberOfSamples, -0.5, numberOfSamples*1.-0.5) + hCorrectionsEvolStruct[dof][struct] = TH1F(hname, htitle, numberOfSamples-1, -0.5, numberOfSamples*1.-1.5) # last point is for the accumulation --> do not show #print " -- drawCorrEvolution -- hCorrectionsEvolStruct has ",hCorrectionsEvolStruct[dof][struct].GetNbinsX(), ' bins in X' hCorrectionsEvolStruct[dof][struct].SetLineColor(EvolColor[struct]) hCorrectionsEvolStruct[dof][struct].SetStats(False) # once the histogram is created, fill it with the corrections of each iteration currentLabel = "000000" # dummy value - for iterval in range(numberOfSamples): + for iterval in range(numberOfSamples): value = detector[iterval].GetModule(struct).GetDoF(dof)[1] + + # derivatives + if (iterval == 0): value = 0 + if (iterval>0): value = (detector[iterval].GetModule(struct).GetDoF(dof)[1] - detector[iterval-1].GetModule(struct).GetDoF(dof)[1]) + print " iterval ", iterval, " dx=", value, " +-",detector[iterval].GetModule(struct).GetDoFError(dof)[1] hCorrectionsEvolStruct[dof][struct].SetBinContent(iterval+1, value) if (drawErrors): hCorrectionsEvolStruct[dof][struct].SetBinError(iterval+1, detector[iterval].GetModule(struct).GetDoFError(dof)[1]) # check the label in case it needs to be marked @@ -625,13 +632,14 @@ def drawCorrEvolution(detector, labelList, drawErrors=False, drawLine=True, whic finalName[dof] = "%f_evolution_%s" %(t, name) gPad.Update() if (outputFormat == ONEBYONE or outputFormat == SPLITBYSTRUCT): - print " -- drawCorrEvol -- saving plots from ONEBYONE " + #print " -- drawCorrEvol -- saving plots from ONEBYONE " Alldetector[dof].SaveAs(pathfiles + finalName[dof] + ".png", "png") Alldetector[dof].SaveAs(pathfiles + finalName[dof] + ".pdf", "pdf") - Alldetector[dof].SaveAs(pathfiles + finalName[dof] + ".root", "root") + #Alldetector[dof].SaveAs(pathfiles + finalName[dof] + ".root", "root") + #Alldetector[dof].SaveAs(pathfiles + finalName[dof] + ".C", "C") if (outputFormat == ALLINONE): - print " -- drawCorrEvol -- saving plots from ALLINONE " + #print " -- drawCorrEvol -- saving plots from ALLINONE " t = time.time() myFinalName = "%f_evolution_dofs" %(t) ThisCanvas.SaveAs(pathfiles+myFinalName + ".png","png") diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/fileutils.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/fileutils.py index 310d37e4a03..f3c7268aaca 100644 --- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/fileutils.py +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/fileutils.py @@ -26,7 +26,7 @@ def writeCorr(outputfile, detector): def readConstants(file, useBarrels=True, useEndCaps=True): import imp - print " <fileutils.readconstants> runWebMonitor=",runWebMonitor, " runLocalTest = ", runLocalTest + #print " <fileutils.readconstants> runWebMonitor=",runWebMonitor, " runLocalTest = ", runLocalTest #from module import Module #from module import Detector if (runWebMonitor): @@ -82,7 +82,7 @@ def readConstants(file, useBarrels=True, useEndCaps=True): #print " In Ntracks --> counter:", counter, " Ntracks: ",line detector.GetModule(counter).setTracks(int(line)) elif "total time spent in solve" in line: - print " ** readConstants ** ** WARNING ** ** DISCARDING REST OF THE FILE ** after counter ", counter + #print " ** readConstants ** ** WARNING ** ** DISCARDING REST OF THE FILE ** after counter ", counter break else: if "Number of hits too small" in line: @@ -127,7 +127,7 @@ def readConstants(file, useBarrels=True, useEndCaps=True): detector.GetModule(counter).setEBx(EBx) print " -----> ",Bx - print " ** reading input file. Counter = ", counter + #print " ** reading input file. Counter = ", counter if OutputLevel > 0: detector.PrintValues() return detector diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/moduleutils.py b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/moduleutils.py index bcda75144a2..62d844c4116 100644 --- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/moduleutils.py +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/utils/include/moduleutils.py @@ -89,10 +89,10 @@ class Module: def PrintValues(self): # info = "%6s %6s %6s %6s %6s %6s %6s %12s %12s %12s %12s %12s %12s %12s\n" % (str(self.index), - info = "%s %s %s %s %s %s %s %s\n" % (str(self.index), + info = "%s %s %s %s %s %s %s %s %s\n" % (str(self.index), str(self.Tx)[:12],str(self.Ty)[:12],str(self.Tz)[:12], str(self.Rx)[:12],str(self.Ry)[:12],str(self.Rz)[:12], - str(self.Hits)) + str(self.Bx)[:12],str(self.Hits)) return info -- GitLab