From 1f9968c4f7a88db1f837bd39238fca5a9abc8028 Mon Sep 17 00:00:00 2001
From: Ioannis Nomidis <Ioannis.Nomidis@cern.ch>
Date: Tue, 10 Feb 2015 04:54:24 +0100
Subject: [PATCH] fixed compilation warning and added functionalities for
 running on data (MuonPhysValMonitoring-00-00-32)

	* modifications for running of data
	* fix compilation warning
	* added muon multiplicity histograms
	* tagging MuonPhysValMonitoring-00-00-32

2014-02-03 <Ioannis.Nomidis@cern.ch>
	* using new classes for new plots
	* disabling muon decoration
	* tagging MuonPhysValMonitoring-00-00-31

2015-01-30 <Daniel Mori <dmori@cern.ch>
	* macros now find author directories automatically
	* added PullProfileMacro.py to make track pull profiles over pt
	* updated CreateMuonValidationSlides.README

2015-01-26 <Daniel Mori <dmori@cern.ch>
	* Minor fixes for macros CreateValidationSlides.py and PullFitMacro.py

2015-01-18 <Ioannis.Nomidis@cern.ch>
	* adding muon quality selections with MuonSelectionTool
...
(Long ChangeLog diff - truncated)
---
 .../MuonPhysValMonitoring/cmt/requirements    |  15 +-
 .../macros/CreateEffAndRecoFracPlots.py       | 161 ++++----
 .../macros/CreateMuonValidationSlides.README  |  50 ++-
 .../macros/CreateMuonValidationSlides.py      |  76 ++--
 .../macros/CreateResolutionPlots.py           |  22 +-
 .../macros/PullFitMacro.py                    |  49 +--
 .../MuonPhysValMonitoring/macros/config.py    | 124 +++---
 .../MuonPhysValMonitoring/macros/validator.py |   3 +-
 .../src/MuonPhysValMonitoringTool.cxx         | 365 ++++++++++++++----
 .../src/MuonPhysValMonitoringTool.h           |  30 +-
 .../src/MuonSegmentValidationPlots.cxx        |  35 +-
 .../src/MuonSegmentValidationPlots.h          |  13 +-
 .../src/MuonTrackValidationPlots.cxx          |  19 +-
 .../src/MuonTrackValidationPlots.h            |   7 +-
 .../src/MuonValidationPlots.cxx               | 200 ++++++----
 .../src/MuonValidationPlots.h                 |  38 +-
 .../src/RecoMuonPlots.cxx                     |   2 +
 .../MuonPhysValMonitoring/src/RecoMuonPlots.h |   2 +
 .../src/TruthRelatedMuonPlots.cxx             |  43 ++-
 .../src/TruthRelatedMuonPlots.h               |   6 +-
 20 files changed, 813 insertions(+), 447 deletions(-)

diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/cmt/requirements b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/cmt/requirements
index 1ecd4b124ec..8b5769ea10c 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/cmt/requirements
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/cmt/requirements
@@ -9,20 +9,25 @@ use AtlasPolicy 	AtlasPolicy-*
 use GaudiInterface 	GaudiInterface-* 	External
 
 ## put here your package dependencies...
-
-#use AsgTools            AsgTools-*              Control/AthToolSupport
+# public
+# use AsgTools            AsgTools-*              Control/AthToolSupport
 
 private
-use AthenaBaseComps     AthenaBaseComps-*       Control
+#use AthenaBaseComps     AthenaBaseComps-*       Control
 use AthenaMonitoring    AthenaMonitoring-*      Control
 use AtlasROOT           AtlasROOT-*             External
 #use StoreGate		StoreGate-*		Control
+use xAODCore            xAODCore-*              Event/xAOD
+use xAODBase            xAODBase-*              Event/xAOD
 use xAODEventInfo       xAODEventInfo-*         Event/xAOD
 use xAODTruth           xAODTruth-*             Event/xAOD
-use xAODMuon            xAODMuon-*              Event/xAOD 
-use xAODTracking        xAODTracking-*          Event/xAOD 
+use xAODMuon            xAODMuon-*              Event/xAOD
+use xAODTracking        xAODTracking-*          Event/xAOD
+use xAODTrigger         xAODTrigger-*           Event/xAOD
 use TrkValHistUtils     TrkValHistUtils-*       Tracking/TrkValidation
 use MuonHistUtils       MuonHistUtils-*         MuonSpectrometer/MuonValidation/MuonHistogramming
+use MuonSelectorTools   MuonSelectorTools-*	PhysicsAnalysis/MuonID
+
 end_private
 
 
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/CreateEffAndRecoFracPlots.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/CreateEffAndRecoFracPlots.py
index a2f56e15a86..309bf18746d 100755
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/CreateEffAndRecoFracPlots.py
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/CreateEffAndRecoFracPlots.py
@@ -1,5 +1,3 @@
-#!/usr/bin/env python
-
 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 
 #Written by Dan Mori
@@ -89,10 +87,9 @@ def CreateRatioPlot( numHist, denHist, var, eta1=None, eta2=None, xtitle = '', p
             PlotName = numNamePrefix+'_'+plottype+'_'+var.split('_')[1]+'_etaRange_{0}_{1}'.format(eta1,eta2).replace('-','m').replace('.','p')
             PlotTitle = PlotTitle + ' ({0}<eta<{1})'.format(eta1,eta2)
 
-    # --- not good for segment plots
-    # if not num.IsA().InheritsFrom(ROOT.TH2.Class()):
-    #     num = num.Rebin(2,"num")
-    #     den = den.Rebin(2,"den")
+    if not num.IsA().InheritsFrom(ROOT.TH2.Class()):
+        num = num.Rebin(2,"num")
+        den = den.Rebin(2,"den")
 
     ratio = num.Clone()
     ratio.Divide(num,den,1,1,"B")
@@ -145,9 +142,8 @@ def main( argv ):
         print( 'Cannot open file: {0}'.format( filename ) )
         exit(1)
 
-    muonTypesEff = [ 'All', 'Prompt', 'InFlight', 'NonIsolated' ]
+    muonTypesEff  = [ 'All', 'Prompt', 'InFlight', 'NonIsolated' ]
     muonTypesReco = [ 'Prompt', 'InFlight', 'NonIsolated' ]
-    Authors = [ 'MuidCombined', 'AllAuthors', 'MuTagIMO' , 'CaloTag', 'MuGirl', 'MuidStandalone' ]
     Variables = [ 'pt', 'eta', 'phi', 'eta_phi', 'eta_pt' ]
 
     Xtitles = {
@@ -157,97 +153,74 @@ def main( argv ):
       'eta_phi' : 'eta',
       'eta_pt' : 'eta' }
 
-
     #Efficiency plots
-    for muType, author, var in itertools.product( muonTypesEff, Authors, Variables ):
-        truthAll='all'
-        if author=='MuonSegments':
-            truthAll='MuonSegments'
-        truthDirName = 'Muons/{0}/truth/{1}'.format( muType, truthAll )
-        matchDirName = 'Muons/{0}/matched/{1}'.format( muType, author )
-        truthDir = infile.GetDirectory( truthDirName )
-        matchDir = infile.GetDirectory( matchDirName )
-        if not truthDir:
-            print( 'WARNING Directory not found: '+truthDirName )
-            continue
-        if not matchDir:
-            print( 'WARNING Directory not found: '+truthDirName )
-            continue
-        truthHistName = 'Muons_{0}_truth_{1}_{2}'.format( muType, truthAll, var )
-        truthHist = truthDir.Get( truthHistName )
-        matchHistName = 'Muons_{0}_matched_{1}_{2}'.format( muType, author, var )
-        matchHist = matchDir.Get( matchHistName )
-        if not truthHist:
-            print( 'WARNING histogram not found: '+truthHistName+' in '+truthDirName)
-            continue
-        if not matchHist:
-            print( 'WARNING histogram not found: '+matchHistName+' in '+matchDirName )
+    for muType in muonTypesEff:
+        if not infile.Get( 'Muons/' + muType ):
+            print( 'INFO TDirectory not found: Muons/' + muType )
             continue
-        CreateRatioPlot( matchHist, truthHist, var, xtitle = muType+' Muon '+Xtitles[var], plottype = 'Eff' )
-        if var == 'eta_phi' or var == 'eta_pt':
-            CreateRatioPlot( matchHist, truthHist, var, -0.1, 0.1, muType+' Muon '+Xtitles[var], 'Eff' )
-            CreateRatioPlot( matchHist, truthHist, var, 0.1, 1.05, muType+' Muon '+Xtitles[var], 'Eff' )
-            CreateRatioPlot( matchHist, truthHist, var, 1.05, 2.0, muType+' Muon '+Xtitles[var], 'Eff' )
-            CreateRatioPlot( matchHist, truthHist, var, 2.0, 2.5, muType+' Muon '+Xtitles[var], 'Eff' )
+        #get list of authors from matched dir
+        AuthDir = infile.Get( 'Muons/{0}/matched'.format( muType ) )
+        Authors = [ i.GetName() for i in AuthDir.GetListOfKeys() if AuthDir.Get( i.GetName() ).InheritsFrom( 'TDirectory' ) ]
+        for author in Authors:
+            truthDirName = 'Muons/{0}/truth/all'.format( muType )
+            matchDirName = 'Muons/{0}/matched/{1}'.format( muType, author )
+            truthDir = infile.GetDirectory( truthDirName )
+            matchDir = infile.GetDirectory( matchDirName )
+            if not truthDir:
+                print( 'WARNING Directory not found: '+truthDirName )
+                continue
+            if not matchDir:
+                print( 'WARNING Directory not found: '+matchDirName )
+                continue
+            for var in Variables:
+                truthHistName = 'Muons_{0}_truth_all_{1}'.format( muType, var )
+                truthHist = truthDir.Get( truthHistName )
+                matchHistName = 'Muons_{0}_matched_{1}_{2}'.format( muType, author, var )
+                matchHist = matchDir.Get( matchHistName )
+                if not truthHist:
+                    print( 'WARNING histogram not found: '+truthHistName )
+                    continue
+                if not matchHist:
+                    print( 'WARNING histogram not found: '+matchHistName )
+                    continue
+                CreateRatioPlot( matchHist, truthHist, var, xtitle = muType+' Muon '+Xtitles[var], plottype = 'Eff' )
+                if var == 'eta_phi' or var == 'eta_pt':
+                    CreateRatioPlot( matchHist, truthHist, var, -0.1, 0.1, muType+' Muon '+Xtitles[var], 'Eff' )
+                    CreateRatioPlot( matchHist, truthHist, var, 0.1, 1.05, muType+' Muon '+Xtitles[var], 'Eff' )
+                    CreateRatioPlot( matchHist, truthHist, var, 1.05, 2.0, muType+' Muon '+Xtitles[var], 'Eff' )
+                    CreateRatioPlot( matchHist, truthHist, var,  2.0, 2.5, muType+' Muon '+Xtitles[var], 'Eff' )
 
-    #Segment Efficiency plots
-    SegmentVariables = ['sector','sector_perStation','nPrecisionHits']
-    for muType, segmVar in itertools.product( muonTypesEff, SegmentVariables ):
-        if muType!='All':
-            continue; ## fix
-
-        truthDirName = 'Muons/{0}/truth/MuonSegments'.format( muType )
-        matchDirName = 'Muons/{0}/matched/MuonSegments'.format( muType )
-        truthDir = infile.GetDirectory( truthDirName )
-        matchDir = infile.GetDirectory( matchDirName )
-        if not truthDir:
-            print( 'WARNING Directory not found: '+truthDirName )
-            continue
-        if not matchDir:
-            print( 'WARNING Directory not found: '+truthDirName )
-            continue
-        truthHistName = 'Muons_{0}_truth_MuonSegments_{1}'.format( muType, segmVar )
-        matchHistName = 'Muons_{0}_matched_MuonSegments_{1}'.format( muType, segmVar )
-        truthHist = truthDir.Get( truthHistName )
-        matchHist = matchDir.Get( matchHistName )
-        if not truthHist:
-            print( 'WARNING histogram not found: '+truthHistName+' in '+truthDirName)
-            continue
-        if not matchHist:
-            print( 'WARNING histogram not found: '+matchHistName+' in '+matchDirName )
-            continue        
-        CreateRatioPlot( matchHist, truthHist, segmVar, xtitle = 'muon segment '+segmVar, plottype = 'Eff' )
-        #if segmVar == 'sector_perStation':
-            #CreateRatioPlot( matchHist, truthHist, var, 0, 1, 'muon segment '+segmVar , 'Eff' )
     #Reco Fraction plots
-    for muType, author, var in itertools.product( muonTypesReco, Authors, Variables ):
-        typedir = 'Muons/{0}/reco/{1}'.format( muType, author )
-        typeplot = 'Muons_{0}_reco_{1}_{2}'.format( muType, author, var )
-        alldir = 'Muons/All/reco/{0}'.format( author )
-        allplot = 'Muons_All_reco_{0}_{1}'.format( author, var )
-
-        typeRecoDir = infile.GetDirectory( typedir )
-        allRecoDir = infile.GetDirectory( alldir )
-
-        if not typeRecoDir:
-            print( 'ERROR TDirectory not found: '+typedir )
+    for muType in muonTypesReco:
+        if not infile.Get( 'Muons/' + muType ):
+            print( 'INFO TDirectory not found: Muons/' + muType )
             continue
-
-        if not allRecoDir:
-            print( 'ERROR TDirectory not found: '+alldir )
-            continue
-
-        typeRecoHist = typeRecoDir.Get( typeplot )
-        allRecoHist = allRecoDir.Get( allplot )
-
-        if not typeRecoHist:
-            print( 'WARNING plot not found: ' + typeplot )
-            continue
-        if not allRecoHist:
-            print( 'WARNING plot not found: ' + allplot )
-            continue
-
-        CreateRatioPlot( typeRecoHist, allRecoHist, var, xtitle = muType+' Muon '+Xtitles[var], plottype = 'RecoFrac' )
+        #get list of authors from matched dir
+        AuthDir = infile.Get( 'Muons/{0}/matched'.format( muType ) )
+        Authors = [ i.GetName() for i in AuthDir.GetListOfKeys() if AuthDir.Get( i.GetName() ).InheritsFrom( 'TDirectory' ) ]
+        for author in Authors:
+            typedir = 'Muons/{0}/reco/{1}'.format( muType, author )
+            alldir = 'Muons/All/reco/{0}'.format( author )
+            typeRecoDir = infile.Get( typedir )
+            allRecoDir = infile.Get( alldir )
+            if not typeRecoDir:
+                print( 'ERROR TDirectory not found: '+typedir )
+                continue
+            if not allRecoDir:
+                print( 'ERROR TDirectory not found: '+alldir )
+                continue
+            for var in Variables:
+                typeplot = 'Muons_{0}_reco_{1}_{2}'.format( muType, author, var )
+                allplot = 'Muons_All_reco_{0}_{1}'.format( author, var )
+                typeRecoHist = typeRecoDir.Get( typeplot )
+                allRecoHist = allRecoDir.Get( allplot )
+                if not typeRecoHist:
+                    print( 'WARNING plot not found: ' + typeplot )
+                    continue
+                if not allRecoHist:
+                    print( 'WARNING plot not found: ' + allplot )
+                    continue
+                CreateRatioPlot( typeRecoHist, allRecoHist, var, xtitle = muType+' Muon '+Xtitles[var], plottype = 'RecoFrac' )
 
     #unmatched muon reco fraction
     muType = 'UnmatchedRecoMuons'
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/CreateMuonValidationSlides.README b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/CreateMuonValidationSlides.README
index e3f39e8ba09..460f9faa141 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/CreateMuonValidationSlides.README
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/CreateMuonValidationSlides.README
@@ -1,41 +1,51 @@
-by Dan Mori <dmori at cern.ch>
+Dan Mori <dmori at cern.ch>
 
-This is how to use the software in the macros folder in MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring to create slides for muon validation.
-Software requires Python version 2.7 or greater
+This is how to use the macros in MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros to create Beamer LaTeX slides with muon validation histograms. This assumes that the validation will be done using a test sample and reference sample for comparison and that you already have the ROOT files containing the physval plots for each sample.
 
-This assumes that the validation will be done using a test sample and reference sample for comparison and that you already have the ROOT files containing the physval plots for each sample. The macros that both files have the same directory structure.
-
-eg. REFFILE=19.1.1.3.run1.root
+eg. REFFILE=19.0.3.3.run1.root
 eg. TESTFILE=19.1.1.1.run1.root
 
-1. Create Efficiency and Reco Fraction Plots
-	Run the following for each file to add efficiency and reco fraction plots:
+** NOTE ** Beamer is not supported on lxplus, so the .tex file will have to be compiled on a different system. Either copy the tex file and plots directory to another system or access the files through AFS.
+
+Since not all histograms can be created in the validation code, a few macros need to be run first to create them.
 
-python CreateEffAndRecoFracPlots.py $REFFILE
-python CreateEffAndRecoFracPlots.py $TESTFILE
+----------------------------------
+Efficiency and Reco Fraction Plots
+----------------------------------
+Run the following for each file to add efficiency and reco fraction plots:
 
-2. Create Resolution Plots
-	Run the following for each file to add resolution and pt scale plots:
+python CreateEffAndRecoFracPlots.py $PHYSVAL_FILE
 
-python CreateResolutionPlots.py $REFFILE
-python CreateResolutionPlots.py $TESTFILE
+--------------------------
+Resolution and Scale Plots
+--------------------------
+If DoBinnedResolutionPlots is enabled in PhysValMuon_jobOptions.py, run the following for each file to add resolution and pt scale plots:
 
-3. Create Muon Validation Slides
+python CreateResolutionPlots.py $PHYSVAL_FILE
+
+-----------------------------
+Create Muon Validation Slides
+-----------------------------
 CreateMuonValidation Slides uses Beamer (LaTeX) to create slides for a presentation using selected plots from the test and reference physval files. All plots will also contain a ratio plot of the test and reference histograms.
 
-3a. Configuration
-First, open up the slides_config.py file and edit the info as required. From here, you can edit the title page info, such as title, date, author, as well as input the sample datasets, Athena versions used, description of the samples, summary slide items, and which plots go on which page. Comments can be added to each slide as well.
+** This macro requires Python 2.7 or greater. **
+Athena version 19 or greater will setup Python 2.7 automatically.
+
+Configuration
+-------------
+First, open up the config.py file and edit the info as required. From here, you can edit the title page info, such as title, date, author, as well as input the sample datasets, Athena versions used, description of the samples, summary slide items, and which plots go on which page. Comments can be added to each slide as well.
 
 e.g.
 title = 'Muon Validation of 19.1.1.1 compared to 19.0.3.3'
 subtitle = 'No Pileup, Run 1 Configuration'
 date = r'\today'
 
-3b. Running the macro
+Running the macro
+-----------------
 python CreateMuonValidationSlides.py -r $REFFILE -t $TESTFILE -d OUTPUT_DIRECTORY -c
 
 -t FILE: test file
 -r FILE: reference file
 -d DIR: directory where the LaTeX files, plots and final pdf will be put. This is by default set to './beamer'
--c: compile LaTeX file automatically
--n: don't create a title page for the slides
+-c: compile LaTeX file automatically (does nothing on lxplus)
+-n: no title page for the slides
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/CreateMuonValidationSlides.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/CreateMuonValidationSlides.py
index 09c495d7cb8..4d8fad102b2 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/CreateMuonValidationSlides.py
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/CreateMuonValidationSlides.py
@@ -40,7 +40,7 @@ def MakeComparisonPlot( refHist, testHist, plotName, path, doNorm = False, doRat
     if not testHist:
         print('WARNING Test histogram not found: '+plotName)
         print('        Creating empty plot')
-        CreateEmptyPlot( path+'/'+plotName+'.pdf' )
+        CreateEmptyPlot( path+'/'+plotName+'.png' )
         return
 
     #if doNorm set, scale hists to area = 1
@@ -52,18 +52,14 @@ def MakeComparisonPlot( refHist, testHist, plotName, path, doNorm = False, doRat
 
     if doNorm:
         if refint != 0:
-            refHist.Scale( 1./refint )
-            for i in range( 1, refHist.GetNbinsX() + 1 ):
-                refHist.SetBinError( i, refHist.GetBinError( i )/refint )
+           refHist.Scale( 1./refint )
         elif refHist:
-            print( 'WARNING empty ref plot ' + plotName )
+           print( 'WARNING empty ref plot ' + plotName )
 
         if testint != 0:
-            testHist.Scale( 1./testint )
-            for i in range( 1, refHist.GetNbinsX() + 1 ):
-                testHist.SetBinError( i, testHist.GetBinError( i )/testint )
+           testHist.Scale( 1./testint )
         else:
-            print( 'WARNING empty test plot ' + plotName )
+           print( 'WARNING empty test plot ' + plotName )
 
     canvas = ROOT.TCanvas( "", "", 860, 900 )
     canvas.SetLeftMargin( 0 )
@@ -93,30 +89,31 @@ def MakeComparisonPlot( refHist, testHist, plotName, path, doNorm = False, doRat
     testHist.GetYaxis().SetTitleSize( labelsize*0.4 )
     testHist.SetLabelSize( labelsize*0.4, 'Y' )
 
-    testHist.Draw("P")
-    if refint>0:
+    testHist.Draw("PE")
+    if refint > 0:
         refHist.SetMarkerColor(ROOT.kBlack)
         refHist.SetLineColor(ROOT.kBlack)
         leg.AddEntry(refHist, "ref", 'P')
         if 'cone' not in plotName:
             refHist = SetBounds(refHist, testHist)
 
-        refHist.Draw("PSAME")
-        testHist.Draw("PSAME")
+        refHist.Draw("PESAME")
+        testHist.Draw("PESAME")
     leg.Draw()
 
-    #ks & chi^2 values
-#    if refint > 0 and testint > 0:
-#        ks = testHist.KolmogorovTest( refHist, 'WW' )
-#        kstext = ROOT.TLatex( 0.18, .955, 'KS = %0.3f'%(ks))
-#        kstext.SetNDC(ROOT.kTRUE)
-#        kstext.SetTextSize(0.055)
-#        kstext.Draw()
-#        chi = testHist.Chi2Test( refHist, 'WW' )
-#        chitext = ROOT.TLatex( 0.35, .955, '#chi^{2} = %0.3f'%(chi))
-#        chitext.SetNDC(ROOT.kTRUE)
-#        chitext.SetTextSize(0.055)
-#        chitext.Draw()
+    # #ks & chi^2 values
+    # if refint > 0 and testint > 0:
+    #     ks = testHist.KolmogorovTest( refHist, 'WW' )
+    #     kstext = ROOT.TLatex( 0.18, .955, 'KS = %0.3f'%(ks))
+    #     kstext.SetNDC(ROOT.kTRUE)
+    #     kstext.SetTextSize(0.055)
+    #     kstext.Draw()
+    #     chi = testHist.Chi2Test( refHist, 'WW' )
+    #     #print(chi)
+    #     chitext = ROOT.TLatex( 0.4, .955, 'p(#chi^{2}) = %0.3f'%(chi))
+    #     chitext.SetNDC(ROOT.kTRUE)
+    #     chitext.SetTextSize(0.055)
+    #     chitext.Draw()
 
     if refint == 0 or testint == 0:
         print( 'WARNING No ratio plot available: '+ plotName )
@@ -128,14 +125,6 @@ def MakeComparisonPlot( refHist, testHist, plotName, path, doNorm = False, doRat
         ratioHist.Divide( refHist )
         ratioHist.SetMarkerColor( ROOT.kBlack )
         ratioHist = SetBounds( ratioHist, ratioHist )
-        for i in range( ratioHist.GetNbinsX() ):
-            nref = refHist.GetBinContent(i)
-            ntest = testHist.GetBinContent(i)
-            if nref == 0 or ntest == 0:
-                ratioHist.SetBinError( i, 0 )
-            else:
-                error = nref/ntest*math.sqrt((refHist.GetBinError(i)/nref)**2 + (testHist.GetBinError(i)/ntest)**2)
-                ratioHist.SetBinError( i, error )
         ratioHist.SetLineColor( ROOT.kBlack )
         ratioHist.GetYaxis().SetTitle( "test / ref" )
         xtitle = ratioHist.GetXaxis().GetTitle()
@@ -147,7 +136,7 @@ def MakeComparisonPlot( refHist, testHist, plotName, path, doNorm = False, doRat
         ratioHist.SetLabelSize( labelsize, 'XY' )
         ratioHist.GetXaxis().SetTitleOffset( 1.0 )
         ratioHist.GetYaxis().SetTitleOffset( .4 )
-        ratioHist.Draw("E")
+        ratioHist.Draw("PE")
 
         lineRatio = ROOT.TLine( ratioHist.GetXaxis().GetXmin(), 1,
                                 ratioHist.GetXaxis().GetXmax(), 1 )
@@ -156,7 +145,7 @@ def MakeComparisonPlot( refHist, testHist, plotName, path, doNorm = False, doRat
         lineRatio.Draw("same")
 
     canvas.cd()
-    canvas.SaveAs( path + '/' + plotName + '.pdf' )
+    canvas.SaveAs( path + '/' + plotName + '.png' )
     canvas.Close()
 
 #############################################################################
@@ -185,22 +174,20 @@ def main():
     for PlotList in PlotPages.values():
         for PlotPath in PlotList:
             HistDir, HistName = os.path.split( PlotPath )
-            if reffile.GetDirectory( HistDir ):
-                refhist = reffile.GetDirectory( HistDir ).Get( HistName )
-            else:
-                refhist = False
-
             if testfile.GetDirectory( HistDir ):
                 testhist = testfile.GetDirectory( HistDir ).Get( HistName )
             else:
                 testhist = False
+            if reffile.GetDirectory( HistDir ):
+                refhist = reffile.GetDirectory( HistDir ).Get( HistName )
+            else:
+                refhist = False
 
             doNorm = not sum([ HistName.__contains__(i) for i in specialTypes ])
             #doRatio = not (plot.__contains__('PtRes') or plot.__contains__('PtScale'))
             MakeComparisonPlot( refhist, testhist, HistName, outdir, doNorm = doNorm, doRatio = True )
 
-
-##### create Beamer file #####
+    ##### create Beamer file #####
 
     endl = '\n'
     output  = r'\documentclass{beamer}' + endl
@@ -259,9 +246,6 @@ def main():
     output += 'Test:' + endl*2
     output += '{0}: {1}'.format(TestVersion, TestDescription) + endl*2
     output += TestDataset + endl*2
-    #output += r'\begin{itemize}' + endl
-    #output += r'\item '+ Intro + endl
-    #output += r'\end{itemize}' + endl
     output += r'\vspace{12pt}' + Intro + endl
     output += r'\end{frame}' + endl*2
 
@@ -272,7 +256,7 @@ def main():
         output += r'\hspace*{-4pt}\makebox[\linewidth][c]{' + endl
         output += r'\begin{tabular}{c%s}'%(r'@{\hspace{1pt}}c'*(len(plotlist)-1)) + endl
         for n, plotpath in enumerate(plotlist):
-            output += r'\includegraphics[width=%0.2f\textwidth]{%s/%s.pdf}'%( 0.35, outdir.replace( args.directory+'/', '' ), os.path.split(plotpath)[1] )
+            output += r'\includegraphics[width=%0.2f\textwidth]{%s/%s.png}'%( 0.35, outdir.replace( args.directory+'/', '' ), os.path.split(plotpath)[1] )
             if n+1 < len(plotlist):
                 output += ' &'
             output += endl
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/CreateResolutionPlots.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/CreateResolutionPlots.py
index 25c3172887f..f2f4ce94cb6 100755
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/CreateResolutionPlots.py
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/CreateResolutionPlots.py
@@ -19,6 +19,8 @@ from array import array
 ROOT.gROOT.SetBatch( True )
 ROOT.gROOT.Macro("rootlogon.C")
 
+DEBUG=False
+
 #--------------------------------------------------------------------------
 
 def createResolutionPlotsFromProfile( directory ):
@@ -27,10 +29,11 @@ def createResolutionPlotsFromProfile( directory ):
         obj=key.ReadObj()
         if not obj.IsA().InheritsFrom(ROOT.TProfile.Class()):
             continue
-        #print obj.GetName()
+        if DEBUG:
+            print '--- DEBUG obj name ', obj.GetName()
         namePrefix = directory.GetPath()[directory.GetPath().index(':')+2:].replace('/','_')
-        #print '   ',namePrefix
-
+        if DEBUG:
+            print '--- DEBUG namePrefix ', namePrefix
         binVar=''
         if '_vs_eta' in obj.GetName() :
             binVar='eta'
@@ -198,19 +201,26 @@ def main( argv ):
   ## ROOT.gROOT.Macro("~/rootlogon.C")
 
   #muonTypes = [ 'All', 'Prompt', 'InFlight', 'Rest' ]
-  #Authors = [ 'MuidCombined', 'MuTagIMO', 'MuidStandalone', 'MuGirl', 'CaloTag', 'CaloLikelihood', 'AllAuthors' ]
+  #Authors = [ 'MuidCo', 'MuTagIMO', 'MuidSA', 'MuGirl', 'CaloTag', 'CaloLikelihood', 'AllMuons' ]
   muonTypes = [ 'Prompt' ]
-  Authors = [ 'MuidCombined' ]
+  Authors = [ 'MuidCo' ]
   resolutionTypes = [ 'MS','ID','' ]
   resolutionTypesStr = [ 'MS','ID','CB' ]
   colors = [ ROOT.kRed, 8 , ROOT.kBlack ]
 
   momentumParameters = ['PtResol','PtScale']
-  binVariables = [ 'pT', 'eta', 'phi' ]
+  #binVariables = [ 'pT', 'eta', 'phi' ]
+  binVariables = [ 'pT' ]
 
   for muType, author, resolType in itertools.product( muonTypes, Authors, resolutionTypes):
       resolutionHistDirName = 'Muons/{0}/matched/{1}/resolution{2}'.format( muType,author,resolType )
       resolutionHistDir = infile.GetDirectory( resolutionHistDirName )
+      if DEBUG:
+          print '--- DEBUG opening directory ', resolutionHistDirName
+      if not resolutionHistDir:
+          if DEBUG:
+              print '--- DEBUG directory does not exist'
+          continue  
       createResolutionPlotsFromProfile( resolutionHistDir )
       for binVar in binVariables:
           outputDir = resolutionHistDir
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/PullFitMacro.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/PullFitMacro.py
index 665a78a9b24..c817f674195 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/PullFitMacro.py
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/PullFitMacro.py
@@ -9,29 +9,20 @@ import ROOT
 import sys
 import os
 import itertools
-from ROOT import TLatex
+
 #---------------------------------------------------------------------------
 
 def AddGaussian( infile, HistDir, HistName ):
     hist = infile.GetDirectory(HistDir).Get(HistName)
-    if hist.Integral() < 10:
-        print('INFO Skipping - Integral < 10: '+HistName)
+    if hist.GetEntries() < 10:
+        print('INFO Skipping Fit. NumEntries = {0}: '.format(hist.GetEntries()) + HistName)
         return
-    hist.Fit("gaus")
-    func = hist.GetFunction('gaus')
-    func.SetLineColor(ROOT.kRed)    
+    f = ROOT.TF1( "gaus", "gaus", -5, 5 )
+    hist.Fit(f,"RQ")
+    f1 = hist.GetFunction("gaus")
+    f1.SetLineColor(ROOT.kRed)
     print('INFO Overwriting histogram: ' + HistDir+'/'+HistName )
     hist.GetDirectory().WriteTObject( hist, HistName, "Overwrite" )
-    
-    can = ROOT.TCanvas()
-    hist.Draw()
-    t = TLatex()
-    t.SetNDC(); t.SetTextColor(1);
-    
-    resultMeanLab ='#mu = {0} #pm {1}'.format( format(func.GetParameter(1),'.2g'), format(func.GetParError(1),'.2g') )
-    resultSigmaLab ='#sigma = {0} #pm {1}'.format( format(func.GetParameter(2),'.2g'),format(func.GetParError(2),'.2g') )
-    t.DrawLatex(0.2,0.85,'#splitline{'+resultMeanLab+'}{'+resultSigmaLab+'}')
-    can.SaveAs( HistName + '.pdf' )
 
 #---------------------------------------------------------------------------
 
@@ -40,33 +31,33 @@ def main( args ):
         filename = args[1]
         if len( args ) > 2:
             PlotDir = os.path.dirname( args[2] )
-            print('INFO Plots will be saved to {0}'.format( PlotDir ))
+            print( 'INFO Plots will be saved to {0}'.format( PlotDir ) )
             if not os.path.exists(PlotDir):
                 os.makedirs(PlotDir)
         else:
             PlotDir = ''
 
     else:
-        print('Usage: python {0} filename [plot directory]'.format( args[0] ))
+        print( 'Usage: python {0} filename [plot directory]'.format( args[0] ) )
         return
 
     if not os.path.exists( filename ):
         print ( 'File not found: ' + filename )
         return
 
+    print( 'Opening file: ' + filename )
     infile = ROOT.TFile.Open( filename, 'update' )
 
-    #MuonTypes = [ 'All', 'Prompt', 'InFlight', 'NonIsolated' ]
-    MuonTypes = [ 'Prompt']
-    Authors = [ 'MuidCombined' ] #, 'AllAuthors', 'CaloTag', 'MuGirl', 'MuidStandalone' ]
-    PullTypes = [ 'Pulls' ] #, 'PullsID', 'PullsMS' ]
+    MuonTypes = [ 'All', 'Prompt', 'InFlight', 'NonIsolated' ]
+    PullTypes = [ 'Pulls', 'PullsID', 'PullsMS' ]
     Variables = [ 'phi0', 'theta', 'qOverP', 'P', 'd0', 'z0' ]
-    #Variables = [ 'qOverP' ]
 
     for MuonType in MuonTypes:
         if not infile.Get( 'Muons/' + MuonType ):
 #            print( 'INFO TDirectory not found: Muons/' + MuonType )
             continue
+        AuthDir = infile.Get( 'Muons/{0}/matched'.format( MuonType ) )
+        Authors = [ i.GetName() for i in AuthDir.GetListOfKeys() if AuthDir.Get( i.GetName() ).InheritsFrom( 'TDirectory' ) ]
         for Author in Authors:
             if not infile.Get( 'Muons/{0}/matched/{1}'.format( MuonType, Author ) ):
 #                print( 'INFO TDirectory not found: ' + 'Muons/{0}/matched/{1}'.format( MuonType, Author ) )
@@ -87,12 +78,12 @@ def main( args ):
 
     infile.Close()
 
-    # if PlotDir != '':
-    #     infile = ROOT.TFile.Open( filename )
-    #     can = ROOT.TCanvas()
-    #     infile.GetDirectory(HistDir).Get(HistName).Draw()
-    #     can.SaveAs( PlotDir + '/' + HistName + '.pdf' )
-    #     infile.Close()
+    if PlotDir != '':
+        infile = ROOT.TFile.Open( filename )
+        can = ROOT.TCanvas()
+        infile.GetDirectory(HistDir).Get(HistName).Draw()
+        can.SaveAs( PlotDir + '/' + HistName + '.pdf' )
+        infile.Close()
 
 #---------------------------------------------------------------------------
 
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/config.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/config.py
index 9ad931d16b5..7e6aac41058 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/config.py
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/config.py
@@ -1,7 +1,8 @@
 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 
-#Dan Mori
+#by Dan Mori
 #config file for CreateMuonValidationSlides.py
+#all strings here are for LaTeX
 
 from collections import OrderedDict
 
@@ -18,11 +19,11 @@ TestDescription = 'run 2, pileup, 14 TeV'
 #titlepage info
 Title = 'Muon Validation of {0}'.format( TestVersion, RefVersion )
 Subtitle = 'Pileup vs No Pileup, Run 2 Config (14 TeV)'
-Author = 'Dan Mori'
-ShortAuthor = 'Mori'
-Institute = 'Simon Fraser University'
-ShortInstitute = 'SFU'
-Date = '10 Sept 2014'
+Author = 'Me'
+ShortAuthor = 'Me'
+Institute = 'CERN'
+ShortInstitute = 'CERN'
+Date = r'\today'
 
 ShortTitle = r'\textcolor{red}{Test: %s} \textcolor{black}{Ref: %s}'%( TestVersion, RefVersion )  #this will be in the footline of each slide - shows versions of test/ref in red/black
 
@@ -37,122 +38,135 @@ Summary = []
 #    'item 3' ]
 
 #############################################################################
-#list of plots to go into each page. the key is the title for each page
+#list of plots to go into each page. the dict key is the title for each page
 #each plot should be entered as path/to/hist/histname
 #The pages will appear in the order given here
+#macro is setup to handle 2 or 3 plots per page only
 
 PlotPages = OrderedDict()
 PlotComments = {}
 
 #kinematics
 PlotPages[ 'Kinematics - pt, eta, phi' ] = [ 
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_pt',
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_eta',
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_phi' ]
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_pt',
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_eta',
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_phi' ]
 #PlotComments[ 'Kinematics - pt, eta, phi' ] = 'PUT COMMENTS HERE IF YOU WANT'
 
 PlotPages[ 'Kinematics - d0, z0' ] = [
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_d0',
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_z0' ]
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_d0',
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_z0' ]
 #PlotComments[ 'Kinematics - d0 (left), z0 (right)' ] = 'PUT COMMENTS HERE IF YOU WANT'
 
 #layers
 PlotPages[ 'Precision Layers' ] = [
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_nprecLayers',
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_nphiLayers' ]
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_nprecLayers',
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_nphiLayers' ]
 #PlotComments[ 'Precision Layers' ] = 'PUT COMMENTS HERE IF YOU WANT'
 
 #hits
 PlotPages[ 'Precision Hits - Inner' ] = [
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_innersmallhits',
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_innerlargehits' ]
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_innersmallhits',
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_innerlargehits' ]
 #PlotComments[ 'Precision Hits - Inner' ] = 'PUT COMMENTS HERE IF YOU WANT'
 
 PlotPages[ 'Precision Hits - Middle' ] = [
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_middlesmallhits',
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_middlelargehits' ]
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_middlesmallhits',
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_middlelargehits' ]
 #PlotComments[ 'Precision Hits - Middle' ] = 'PUT COMMENTS HERE IF YOU WANT'
 
 PlotPages[ 'Precision Hits - Outer' ] = [
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_outersmallhits',
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_outerlargehits' ]
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_outersmallhits',
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_outerlargehits' ]
 #PlotComments[ 'Precision Hits - Outer' ] = 'PUT COMMENTS HERE IF YOU WANT'
 
 #isolation
 PlotPages[ r'Isolation - $p_T$-cone / $p_T$' ] = [
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_ptcone20rel',
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_ptcone30rel',
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_ptcone40rel' ]
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_ptcone20rel',
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_ptcone30rel',
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_ptcone40rel' ]
 #PlotComments[ r'Isolation - $p_T$-cone / $p_T$' ] = 'PUT COMMENTS HERE IF YOU WANT'
 
 PlotPages[ r'Isolation - $E_T$-cone / $p_T$' ] = [
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_etcone20rel',
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_etcone30rel',
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_etcone40rel' ]
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_etcone20rel',
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_etcone30rel',
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_etcone40rel' ]
 #PlotComments[ r'Isolation - $E_T$-cone / $p_T$' ] = 'PUT COMMENTS HERE IF YOU WANT'
 
 #chi^2
 PlotPages[ 'Track Fit Quality' ] = [
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_tchi2',
-    'Muons/Prompt/reco/MuidCombined/Muons_Prompt_reco_MuidCombined_chi2ndof' ]
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_tchi2',
+    'Muons/All/reco/AllAuthors/Muons_All_reco_AllAuthors_chi2ndof' ]
 #PlotComments[ 'Track Fit Quality' ] = 'PUT COMMENTS HERE IF YOU WANT'
 
 #Resolution
 #PlotPages[ 'Resolution (MS+ID)' ] = [
-#    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_resolution_PtRes_vs_pt',
-#    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_resolution_PtRes_vs_eta',
-#    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_resolution_PtRes_vs_phi' ]
+#    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_resolution_PtRes_vs_pt',
+#    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_resolution_PtRes_vs_eta',
+#    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_resolution_PtRes_vs_phi' ]
 #PlotComments[ 'Resolution (MS+ID)' ] = 'PUT COMMENTS HERE IF YOU WANT'
 
 #PlotPages[ 'Resolution (ID)' ] = [
-#    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_resolutionID_PtRes_vs_pt',
-#    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_resolutionID_PtRes_vs_eta',
-#    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_resolutionID_PtRes_vs_phi' ]
+#    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_resolutionID_PtRes_vs_pt',
+#    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_resolutionID_PtRes_vs_eta',
+#    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_resolutionID_PtRes_vs_phi' ]
 #PlotComments[ 'Resolution (ID)' ] = 'PUT COMMENTS HERE IF YOU WANT'
 
 #PlotPages[ 'Resolution (MS)' ] = [
-#    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_resolutionMS_PtRes_vs_pt',
-#    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_resolutionMS_PtRes_vs_eta',
-#    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_resolutionMS_PtRes_vs_phi' ]
+#    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_resolutionMS_PtRes_vs_pt',
+#    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_resolutionMS_PtRes_vs_eta',
+#    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_resolutionMS_PtRes_vs_phi' ]
 #PlotComments[ 'Resolution (MS)' ] = 'PUT COMMENTS HERE IF YOU WANT'
 
 #Momentum scale
 #PlotPages[ r'$p_T$ Scale (MS+ID)' ] = [
-#    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_resolution_PtScale_vs_pt',
-#    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_resolution_PtScale_vs_eta',
-#    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_resolution_PtScale_vs_phi' ]
+#    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_resolution_PtScale_vs_pt',
+#    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_resolution_PtScale_vs_eta',
+#    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_resolution_PtScale_vs_phi' ]
 #PlotComments[ r'$p_T$ Scale (MS+ID)' ] = 'PUT COMMENTS HERE IF YOU WANT'
 
 #PlotPages[ r'$p_T$ Scale (ID)' ] = [
-#    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_resolutionID_PtScale_vs_pt',
-#    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_resolutionID_PtScale_vs_eta',
-#    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_resolutionID_PtScale_vs_phi' ]
+#    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_resolutionID_PtScale_vs_pt',
+#    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_resolutionID_PtScale_vs_eta',
+#    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_resolutionID_PtScale_vs_phi' ]
 #PlotComments[ r'$p_T$ Scale (ID)' ] = 'PUT COMMENTS HERE IF YOU WANT'
 
 #PlotPages[ r'$p_T$ Scale (MS)' ] = [
-#    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_resolutionMS_PtScale_vs_pt',
-#    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_resolutionMS_PtScale_vs_eta',
-#    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_resolutionMS_PtScale_vs_phi' ]
+#    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_resolutionMS_PtScale_vs_pt',
+#    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_resolutionMS_PtScale_vs_eta',
+#    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_resolutionMS_PtScale_vs_phi' ]
 #PlotComments[ r'$p_T$ Scale (MS)' ] = 'PUT COMMENTS HERE IF YOU WANT'
 
+#Pulls
+PlotPages[ 'Track Pull Plots - $q/P$, $\theta$, $\phi$' ] = [
+    'Muons/All/matched/AllAuthors/Pulls/Muons_All_matched_AllAuthors_Pulls_Pull_qOverP',
+    'Muons/All/matched/AllAuthors/Pulls/Muons_All_matched_AllAuthors_Pulls_Pull_theta',
+    'Muons/All/matched/AllAuthors/Pulls/Muons_All_matched_AllAuthors_Pulls_Pull_phi0' ]
+#PlotComments[ 'Track Pull Plots - $q/P$, $\theta$, $\phi$' ] = 'PUT COMMENTS HERE IF YOU WANT'
+
+PlotPages[ 'Track Pull Plots - $d_0$, $z_0$' ] = [
+    'Muons/All/matched/AllAuthors/Pulls/Muons_All_matched_AllAuthors_Pulls_Pull_dO',
+    'Muons/All/matched/AllAuthors/Pulls/Muons_All_matched_AllAuthors_Pulls_Pull_z0' ]
+#PlotComments[ 'Efficiency' ] = 'PUT COMMENTS HERE IF YOU WANT'
+
 #Efficiency
 PlotPages[ 'Efficiency' ] = [
-    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_Eff_pt',
-    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_Eff_eta',
-    'Muons/Prompt/matched/MuidCombined/Muons_Prompt_matched_MuidCombined_Eff_phi' ]
+    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_Eff_pt',
+    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_Eff_eta',
+    'Muons/All/matched/AllAuthors/Muons_All_matched_AllAuthors_Eff_phi' ]
 #PlotComments[ 'Efficiency' ] = 'PUT COMMENTS HERE IF YOU WANT'
 
 #Reco fraction
 #PlotPages[ 'Reco Fraction - Inflight Muons' ] = [
-#    'Muons/InFlight/reco/MuidCombined/Muons_InFlight_reco_MuidCombined_RecoFrac_pt',
-#    'Muons/InFlight/reco/MuidCombined/Muons_InFlight_reco_MuidCombined_RecoFrac_eta',
-#    'Muons/InFlight/reco/MuidCombined/Muons_InFlight_reco_MuidCombined_RecoFrac_phi' ]
+#    'Muons/InFlight/reco/AllAuthors/Muons_InFlight_reco_AllAuthors_RecoFrac_pt',
+#    'Muons/InFlight/reco/AllAuthors/Muons_InFlight_reco_AllAuthors_RecoFrac_eta',
+#    'Muons/InFlight/reco/AllAuthors/Muons_InFlight_reco_AllAuthors_RecoFrac_phi' ]
 #PlotComments[ 'Reco Fraction - Inflight Muons' ] = 'PUT COMMENTS HERE IF YOU WANT'
 
 #PlotPages[ 'Reco Fraction - Rest Muons' ] = [
-#    'Muons/Rest/reco/MuidCombined/Muons_Rest_reco_MuidCombined_RecoFrac_pt',
-#    'Muons/Rest/reco/MuidCombined/Muons_Rest_reco_MuidCombined_RecoFrac_eta',
-#    'Muons/Rest/reco/MuidCombined/Muons_Rest_reco_MuidCombined_RecoFrac_phi' ]
+#    'Muons/Rest/reco/AllAuthors/Muons_Rest_reco_AllAuthors_RecoFrac_pt',
+#    'Muons/Rest/reco/AllAuthors/Muons_Rest_reco_AllAuthors_RecoFrac_eta',
+#    'Muons/Rest/reco/AllAuthors/Muons_Rest_reco_AllAuthors_RecoFrac_phi' ]
 #PlotComments[ 'Reco Fraction - Rest Muons' ] = 'PUT COMMENTS HERE IF YOU WANT'
 
 #PlotPages[ 'Reco Fraction - Unmatched All Authors' ] = [
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/validator.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/validator.py
index 353873dc733..9b2d7860280 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/validator.py
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/macros/validator.py
@@ -85,7 +85,8 @@ class Validator(object):
       return
 
     if self.CompareFunc(refHist, testHist): print path + refHist.GetName() + " looks ok"
-    else: self.MakeComparisonPlot(refHist, testHist, path)
+    #else:
+    self.MakeComparisonPlot(refHist, testHist, path)
   
   def MakeComparisonPlot(self,refHist, testHist, path):
     def SetBounds(refHist, testHist, setMinToZero):
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.cxx
index 63087bc36f3..85397268622 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.cxx
@@ -15,13 +15,23 @@
 // FrameWork includes
 #include "GaudiKernel/IToolSvc.h"
 #include "xAODMuon/MuonContainer.h"
+#include "xAODMuon/MuonAuxContainer.h"
 #include "xAODMuon/Muon.h"
+#include "xAODTrigger/MuonRoI.h"
+#include "xAODTrigger/MuonRoIContainer.h"
 #include "xAODTruth/TruthParticle.h"
 #include "xAODTruth/TruthVertexContainer.h"
 #include "xAODTruth/TruthVertexAuxContainer.h"
 #include "xAODEventInfo/EventInfo.h"
-#include "AthenaBaseComps/AthCheckMacros.h"
+//#include "AthenaBaseComps/AthCheckMacros.h"
+#include "MuonHistUtils/MuonEnumDefs.h"
 
+#include "xAODCore/ShallowCopy.h"
+#include "xAODBase/IParticleHelpers.h"
+
+typedef ElementLink< xAOD::MuonContainer > MuonLink;
+typedef ElementLink< xAOD::MuonSegmentContainer > MuonSegmentLink;
+typedef ElementLink< xAOD::TruthParticleContainer > TruthLink;
 
 namespace MuonPhysValMonitoring {
 
@@ -36,12 +46,15 @@ MuonPhysValMonitoringTool::MuonPhysValMonitoringTool( const std::string& type,
 						      const std::string& name, 
 						      const IInterface* parent ):
   ManagedMonitorToolBase( type, name, parent ),
+  m_isData(false),
+  m_muonSelectionTool("CP::MuonSelectionTool/MuonSelectionTool"),
   m_oUnmatchedRecoMuonPlots(NULL),
   m_oUnmatchedTruthMuonPlots(NULL),
   m_oUnmatchedRecoMuonTrackPlots(NULL),
   m_oUnmatchedRecoMuonSegmentPlots(NULL),
   h_overview_reco_category(NULL)
-{  
+{
+  declareProperty( "IsData", m_isData = false );
   declareProperty( "MuonContainerName", m_muonsName = "Muons" );
   declareProperty( "MuonTruthParticleContainerName", m_muonsTruthName = "MuonTruthParticles" );
   declareProperty( "MuonTrackContainerName", m_muonTracksName = "MuonSpectrometerTrackParticles" );
@@ -52,21 +65,41 @@ MuonPhysValMonitoringTool::MuonPhysValMonitoringTool( const std::string& type,
   declareProperty( "DoMuonTrackValidation", m_doMuonTrackValidation = true);
   declareProperty( "DoMuonSegmentValidation", m_doMuonSegmentValidation = true);
   declareProperty( "DoBinnedResolutionPlots", m_doBinnedResolutionPlots = true);
+
+  declareProperty( "DoTrigMuonValidation", m_doTrigMuonValidation = false);
+  declareProperty( "DoTrigMuonL1Validation", m_doTrigMuonL1Validation = false);
+  declareProperty( "DoTrigMuonL2Validation", m_doTrigMuonL2Validation = false);
+  declareProperty( "DoTrigMuonEFValidation", m_doTrigMuonEFValidation = false);
+  declareProperty( "L1TrigMuonContainerName", m_muonL1TrigName = "LVL1MuonRoIs");
+  declareProperty( "EFCombTrigMuonContainerName", m_muonEFCombTrigName = "HLT_xAOD__MuonContainer_MuonEFInfo");
+
 }
 
 // Destructor
 ///////////////
 MuonPhysValMonitoringTool::~MuonPhysValMonitoringTool()
-{ 
-}
+{}
 
 // Athena algtool's Hooks
 ////////////////////////////
 StatusCode MuonPhysValMonitoringTool::initialize()
 {
-  ATH_MSG_INFO ("Initializing " << name() << "...");    
+  ATH_MSG_INFO ("Initializing " << name() << "...");
   ATH_CHECK(ManagedMonitorToolBase::initialize());
-  
+
+  // setup flags
+  if (m_doTrigMuonValidation==false) {
+    m_doTrigMuonL1Validation = false;
+    m_doTrigMuonL2Validation = false;
+    m_doTrigMuonEFValidation = false;
+  }
+  if (m_isData) {
+    m_selectMuonCategories.clear();
+    m_selectMuonCategories.push_back(ALL); //cannot identigy origin of muon in data
+  }
+
+  ATH_CHECK(m_muonSelectionTool.retrieve());
+
   return StatusCode::SUCCESS;
 }
 
@@ -130,12 +163,16 @@ StatusCode MuonPhysValMonitoringTool::bookHistograms()
 
   for (const auto category : m_selectMuonCategoriesStr) {
     std::string categoryPath = "Muons/"+category+"/";
-    m_muonValidationPlots.push_back(new MuonValidationPlots(0, categoryPath, m_selectMuonAuthors, m_doBinnedResolutionPlots));
+    m_muonValidationPlots.push_back( new MuonValidationPlots(0, categoryPath,
+              m_selectMuonAuthors, m_isData,
+	      (category==theMuonCategories[ALL]? false : m_doBinnedResolutionPlots),
+              m_doTrigMuonL1Validation,m_doTrigMuonL2Validation,m_doTrigMuonEFValidation ));
+    
     if (m_doMuonTrackValidation) 
-      m_muonTrackValidationPlots.push_back(new MuonTrackValidationPlots(0, categoryPath));
+      m_muonTrackValidationPlots.push_back(new MuonTrackValidationPlots(0, categoryPath, m_isData));
     if (m_doMuonSegmentValidation) {
       if (category!=theMuonCategories[ALL]) continue; //cannot identify the truth origin of segments...
-      m_muonSegmentValidationPlots.push_back(new MuonSegmentValidationPlots(0, categoryPath));
+      m_muonSegmentValidationPlots.push_back(new MuonSegmentValidationPlots(0, categoryPath, m_isData));
     }
   }
   
@@ -168,6 +205,16 @@ StatusCode MuonPhysValMonitoringTool::bookHistograms()
   bookValidationPlots(*m_oUnmatchedTruthMuonPlots).ignore();
 
   //book overview hists
+  h_overview_nObjects.clear();
+  h_overview_nObjects.push_back(new TH1F("Muons_Overview_N_perevent_truth_muons", "Number of truth Muons per event", 20, -0.5, 19.5));
+  h_overview_nObjects.push_back(new TH1F("Muons_Overview_N_perevent_muons", "Number of Muons per event", 20, -0.5, 19.5));
+  h_overview_nObjects.push_back(new TH1F("Muons_Overview_N_perevent_tracks", "Number of Tracks per event", 50, -0.5, 49.5));
+  h_overview_nObjects.push_back(new TH1F("Muons_Overview_N_perevent_truth_segments", "Number of truth Segments per event", 200, -0.5, 199.5));
+  h_overview_nObjects.push_back(new TH1F("Muons_Overview_N_perevent_segments", "Number of Segments per event", 200, -0.5, 199.5));
+  for (const auto hist : h_overview_nObjects) {
+    if (hist) ATH_CHECK(regHist(hist,"Muons/Overview",all));
+  }
+
   h_overview_reco_category = new TH1F("Muons_reco_category","",4,0,4); //prompt/in-flight/non-isolated/other
   for (int i=1; i<4; i++) { //skip 'All'
     h_overview_reco_category->GetXaxis()->SetBinLabel(i,theMuonCategories[i].c_str());
@@ -184,15 +231,26 @@ StatusCode MuonPhysValMonitoringTool::bookHistograms()
     if (hist) ATH_CHECK(regHist(hist,"Muons/Overview",all));
   }
 
-  return StatusCode::SUCCESS;      
+  return StatusCode::SUCCESS;
 }
 
 StatusCode MuonPhysValMonitoringTool::bookValidationPlots(PlotBase& valPlots)
 {
   valPlots.initialize();
   std::vector<HistData> hists = valPlots.retrieveBookedHistograms();
-  for (auto hist: hists){
-    ATH_MSG_DEBUG ("Initializing " << hist.first << " " << hist.first->GetName() << " " << hist.second << "...");
+
+  for (auto &hist: hists){
+    std::string sHistName = hist.first->GetName();
+    ATH_MSG_DEBUG ("Initializing " << hist.first << " " << sHistName << " " << hist.second << "...");
+
+    //check for histograms that are useless
+    if ( sHistName.find( Muon::EnumDefs::toString(xAOD::Muon::MuidSA) ) != std::string::npos &&
+	 ( sHistName.find( "ID" ) != std::string::npos || sHistName.find( "MS" ) != std::string::npos ) )
+      continue;
+    if ( sHistName.find( "_bin_" ) != std::string::npos && ( sHistName.find( "Res_eta" ) != std::string::npos || sHistName.find( "Res_phi" ) != std::string::npos) )
+      continue;
+    
+    modifyHistogram(hist.first);
     ATH_CHECK(regHist(hist.first,hist.second,all));
   }
   return StatusCode::SUCCESS;
@@ -204,32 +262,67 @@ StatusCode MuonPhysValMonitoringTool::fillHistograms()
   m_vMatchedMuons.clear();
   m_vMatchedMuonTracks.clear();
   m_vMatchedMuonSegments.clear();
-
+  m_vEFMuons.clear();
+  m_vEFMuonsSelected.clear();
+  
   // const xAOD::EventInfo* eventInfo = evtStore()->retrieve<const xAOD::EventInfo>("EventInfo");
   // if (!eventInfo){
-  //   ATH_MSG_WARNING("Could not retrieve EventInfo. Returning 1");
+  //   ATH_MSG_WARNING("Could not retrieve EventInfo, returning");
   //   return StatusCode::SUCCESS;
-  // } 
-  //  
-  // if (!eventInfo->eventType( xAOD::EventInfo::IS_SIMULATION )) return StatusCode::SUCCESS; // enable once it is available
+  // }
+  // isData = !eventInfo->eventType( xAOD::EventInfo::IS_SIMULATION );
+  
 
-  const xAOD::TruthParticleContainer* TruthMuons = evtStore()->tryConstRetrieve< xAOD::TruthParticleContainer >(m_muonsTruthName);
-  if (!TruthMuons) {
-    ATH_MSG_WARNING ("Couldn't retrieve TruthMuons container with key: " << m_muonsTruthName);
-    return StatusCode::SUCCESS;
+  const xAOD::TruthParticleContainer* TruthMuons(0);
+  if (!m_isData) {
+    TruthMuons = evtStore()->tryConstRetrieve< xAOD::TruthParticleContainer >(m_muonsTruthName);
+    if (!TruthMuons) {
+      ATH_MSG_WARNING ("Couldn't retrieve TruthMuons container with key: " << m_muonsTruthName);
+      return StatusCode::SUCCESS;
+    }
+    ATH_MSG_DEBUG("Retrieved truth muons " << TruthMuons->size());
+    h_overview_nObjects[0]->Fill(TruthMuons->size());
   }
-  ATH_MSG_DEBUG("Retrieved truth muons " << TruthMuons->size());
 
-  for (const auto truthMu: *TruthMuons) handleTruthMuon(truthMu);
-  
   const xAOD::MuonContainer* Muons = evtStore()->retrieve< const xAOD::MuonContainer >( m_muonsName );
   if (!Muons) {
     ATH_MSG_WARNING ("Couldn't retrieve Muons container with key: " << m_muonsName);
     return StatusCode::SUCCESS;
   } 
   ATH_MSG_DEBUG("Retrieved muons " << Muons->size());
- 
-  for(const auto mu : *Muons) handleMuon(mu);
+  h_overview_nObjects[1]->Fill(Muons->size());
+
+  // std::pair< xAOD::MuonContainer*, xAOD::ShallowAuxContainer* > NewMuons;
+  // NewMuons = xAOD::shallowCopyContainer( *Muons );
+  // if(!setOriginalObjectLink( *Muons, *NewMuons.first )) { 
+  //   ATH_MSG_ERROR("Failed to add original object links to shallow copy of Muons");
+  //   return StatusCode::FAILURE;
+  // }
+  // for(auto mu : *NewMuons.first) {
+  //   //decorateMuon(*mu); //@@@
+  //   xAOD::Muon::Quality q = mu->quality();
+  //   m_muonSelectionTool->setQuality(*mu);
+  //   if (mu->quality()>xAOD::Muon::VeryLoose || mu->quality()<xAOD::Muon::Tight) ATH_MSG_WARNING( "Muon quality is wrong");    
+  //   //m_muonSelectionTool->setPassesHighPtCuts(*mu);
+  //   //m_muonSelectionTool->setPassesIDCuts(*mu);
+  //   ATH_MSG_ERROR("@@@ before " << q << ", after " << mu->quality() << ", tool " << m_muonSelectionTool->getQuality(*mu)  );
+  //   //if (q!=mu->quality()) ATH_MSG_ERROR("@@@ ok, changed !!");
+  //   ///if (mu->quality()!=m_muonSelectionTool->getQuality(*mu)) ATH_MSG_ERROR("@@@  changed 2 !!");
+  // }
+
+  /////////////////////////////////////////////////////////////////////// @@@
+  // @@@ Temp hack to get the MuonSpectrometerTrackParticle (@MS Entry, not extrapolated), needed for eloss plots
+  // Remove when the link to MuonSpectrometerTrackParticle appears in the xAOD muon
+  MSTracks = evtStore()->retrieve< const xAOD::TrackParticleContainer >( "MuonSpectrometerTrackParticles" );
+  if (!MSTracks) {
+    ATH_MSG_WARNING ("Couldn't retrieve MS Tracks container");
+    return StatusCode::SUCCESS;
+  } 
+  else ATH_MSG_DEBUG("Retrieved muon tracks " << MSTracks->size());
+  /////////////////////////////////////////////////////////////////////// @@@
+  
+  if (!m_isData) for (const auto truthMu: *TruthMuons) handleTruthMuon(truthMu);
+  for (const auto mu: *Muons) handleMuon(mu); //for (auto mu: *NewMuons.first) handleMuon(mu);
 
   if (m_doMuonTrackValidation) {
     const xAOD::TrackParticleContainer* MuonTracks = evtStore()->retrieve< const xAOD::TrackParticleContainer >( m_muonTracksName );
@@ -238,31 +331,85 @@ StatusCode MuonPhysValMonitoringTool::fillHistograms()
       return StatusCode::SUCCESS;
     } 
     ATH_MSG_DEBUG("Retrieved muon tracks " << MuonTracks->size());
-    
+    h_overview_nObjects[2]->Fill(MuonTracks->size());
     for(const auto muTP : *MuonTracks) handleMuonTrack(muTP);
   }
 
   if (m_doMuonSegmentValidation) {
-    const xAOD::MuonSegmentContainer* TruthMuonSegments = evtStore()->tryConstRetrieve< xAOD::MuonSegmentContainer >(m_muonSegmentsTruthName);
-
-    if (!TruthMuonSegments) {
-      ATH_MSG_WARNING ("Couldn't retrieve Truth Muon Segments container with key: " << m_muonSegmentsTruthName);
-      return StatusCode::SUCCESS;
+    const xAOD::MuonSegmentContainer* TruthMuonSegments(0);
+    if (!m_isData) {
+      TruthMuonSegments = evtStore()->tryConstRetrieve< xAOD::MuonSegmentContainer >(m_muonSegmentsTruthName);
+      if (!TruthMuonSegments) {
+	ATH_MSG_WARNING ("Couldn't retrieve Truth Muon Segments container with key: " << m_muonSegmentsTruthName);
+	return StatusCode::SUCCESS;
+      }
+      ATH_MSG_DEBUG("Retrieved truth muon segments " << TruthMuonSegments->size());
+      h_overview_nObjects[3]->Fill(TruthMuonSegments->size());
+      for (const auto truthMuSeg: *TruthMuonSegments) handleTruthMuonSegment(truthMuSeg,TruthMuons);
     }
-
-    ATH_MSG_DEBUG("Retrieved truth muon segments " << TruthMuonSegments->size());
-  
-    for (const auto truthMuSeg: *TruthMuonSegments) handleTruthMuonSegment(truthMuSeg,TruthMuons);
-    
+      
     const xAOD::MuonSegmentContainer* MuonSegments = evtStore()->retrieve< const xAOD::MuonSegmentContainer >( m_muonSegmentsName );
     if (!MuonSegments) {
       ATH_MSG_WARNING ("Couldn't retrieve MuonSegments container with key: " << m_muonSegmentsName);
       return StatusCode::SUCCESS;
     } 
     ATH_MSG_DEBUG("Retrieved muon segments " << MuonSegments->size());
+    h_overview_nObjects[4]->Fill(MuonSegments->size());
     for(const auto muSeg : *MuonSegments) handleMuonSegment(muSeg);	
   }
 
+  if (m_doTrigMuonValidation) {
+    if(m_doTrigMuonL1Validation){
+       const xAOD::MuonRoIContainer* L1TrigMuons = evtStore()->retrieve< const xAOD::MuonRoIContainer >( m_muonL1TrigName );    
+       if (!L1TrigMuons) {
+         ATH_MSG_WARNING ("Couldn't retrieve L1 Muon Trigger container with key: " << m_muonL1TrigName);
+         return StatusCode::SUCCESS;
+       }      
+       ATH_MSG_DEBUG("Retrieved L1 triggered muons " << L1TrigMuons->size());
+       for(const auto TrigL1mu : *L1TrigMuons) handleMuonL1Trigger(TrigL1mu);
+    }
+    if(m_doTrigMuonL2Validation){
+      ATH_MSG_DEBUG("TrigMuonL2Validation not defined");
+    }
+    if(m_doTrigMuonEFValidation){
+       const xAOD::MuonContainer* EFCombTrigMuons = evtStore()->retrieve< const xAOD::MuonContainer >( m_muonEFCombTrigName );    
+       if (!EFCombTrigMuons) {
+         ATH_MSG_WARNING ("Couldn't retrieve EF Muon Trigger container with key: " << m_muonEFCombTrigName);
+         return StatusCode::SUCCESS;
+       }      
+       ATH_MSG_DEBUG("Retrieved EF triggered muons " << EFCombTrigMuons->size());
+       if (EFCombTrigMuons->size()!=0){
+          for(const auto Trigmu : *EFCombTrigMuons) {
+             ATH_MSG_DEBUG("Muon EF Trigger: pt " << Trigmu->pt() <<" phi " << Trigmu->phi() <<" eta " << Trigmu->eta() << "   author" << Trigmu->author());
+             m_vEFMuons.push_back(Trigmu);
+          }
+       
+          m_vEFMuonsSelected.push_back(m_vEFMuons.at(0));
+
+
+          for (unsigned int i=0; i<m_vEFMuons.size(); i++) {    
+		unsigned int cont=0;
+
+              for (unsigned int j=0; j< m_vEFMuonsSelected.size(); j++) {    
+		if(
+		   ( (fabs(m_vEFMuons.at(i)->eta()- m_vEFMuonsSelected.at(j)->eta())>0.05) ||
+		     (fabs(m_vEFMuons.at(i)->phi()- m_vEFMuonsSelected.at(j)->phi())>0.05)   ) ||
+		   ((m_vEFMuons.at(i)->author()-m_vEFMuonsSelected.at(j)->author())!=0)
+		   ) cont++;
+		
+		if (cont==m_vEFMuonsSelected.size()){  
+		     m_vEFMuonsSelected.push_back(m_vEFMuons.at(i));
+	             break;
+		}                         
+              }
+	  }
+       }
+       for (unsigned int j=0; j< m_vEFMuonsSelected.size(); j++) {   	 
+	 handleMuon(m_vEFMuonsSelected.at(j)); //handleMuonTrigger(m_vEFMuonsSelected.at(j));
+       } 
+    }
+  }
+
   return StatusCode::SUCCESS;
 }
 
@@ -301,41 +448,63 @@ void MuonPhysValMonitoringTool::handleMuonSegment(const xAOD::MuonSegment* muSeg
 
 void MuonPhysValMonitoringTool::handleMuon(const xAOD::Muon* mu)
 {
+  if (!mu) return;
   if (msgLvl(MSG::DEBUG)) printMuonDebug(mu);
+
+  //make deep copy of muon to decorate with quality
+  //xAOD::Muon* newmu(0);// = new xAOD::Muon;
+  //correctedMuon(*mu,newmu);
+  //newmu->makePrivateStore(*mu); 
+  // m_muonSelectionTool->setQuality(*newmu);
+  // m_muonSelectionTool->setPassesHighPtCuts(*newmu);
+  // m_muonSelectionTool->setPassesIDCuts(*newmu);
+
   if (std::find(std::begin(m_vMatchedMuons), std::end(m_vMatchedMuons), mu) != std::end(m_vMatchedMuons)) return;
+  
   //unmatched reco muons (not matched with any kind of truth particle, fakes)
   m_oUnmatchedRecoMuonPlots->fill(*mu);
   h_overview_reco_category->Fill("Other",1);
   h_overview_reco_authors[3]->Fill(mu->author());
+ 
   for (unsigned int i=0; i<m_selectMuonCategories.size(); i++) {
-    if (m_selectMuonCategories[i]==ALL) { 
+    if (m_selectMuonCategories[i]==ALL) {
       m_muonValidationPlots[i]->fill(*mu);
       break;
     }
   }
+  //if (newmu) delete newmu;
 }
 
 
 void MuonPhysValMonitoringTool::handleTruthMuon(const xAOD::TruthParticle* truthMu)
 {
   const xAOD::Muon* mu = findRecoMuon(truthMu);
+  
   if (msgLvl(MSG::DEBUG)) printTruthMuonDebug(truthMu, mu);
   if( truthMu->pt() < 5000. || fabs(truthMu->eta()) > 2.5 ) return;
   
+  // xAOD::Muon* newmu(0);
+  // if (mu) {
+  //   //make deep copy of muon to decorate with quality
+  //   newmu = new xAOD::Muon();
+  //   std::cout << "@@@>>" << std::endl;
+  //   correctedMuon(*mu,newmu);
+  //   std::cout << "<<@@@" << std::endl;
+  // }
   unsigned int thisMuonCategory = getMuonTruthCategory(truthMu);
 
-  if (mu) {
-    h_overview_reco_category->Fill(thisMuonCategory-1);
-    h_overview_reco_authors[thisMuonCategory-1]->Fill(mu->author());
-  }
-
   for (unsigned int i=0; i<m_selectMuonCategories.size(); i++) {
     if (m_selectMuonCategories[i]==ALL || m_selectMuonCategories[i]==thisMuonCategory) {
-      m_muonValidationPlots[i]->fill(truthMu, mu); //if no muon is found a protection inside MuonValidationPlots will ensure, its plots won't be filled
+      m_muonValidationPlots[i]->fill(truthMu, mu, MSTracks); //if no muon is found a protection inside MuonValidationPlots will ensure, its plots won't be filled
     }
   }
+  if (mu) {    
+    h_overview_reco_category->Fill(thisMuonCategory-1);
+    h_overview_reco_authors[thisMuonCategory-1]->Fill(mu->author());
+  }
+  else m_oUnmatchedTruthMuonPlots->fill(*truthMu);
 
-  if (!mu) m_oUnmatchedTruthMuonPlots->fill(*truthMu);
+  //if (newmu) delete newmu;
 }
 
 void MuonPhysValMonitoringTool::handleMuonTrack(const xAOD::TrackParticle* muTP)
@@ -345,32 +514,34 @@ void MuonPhysValMonitoringTool::handleMuonTrack(const xAOD::TrackParticle* muTP)
     return;
   }
   
-  ElementLink< xAOD::TruthParticleContainer > truthLink;
-  if( muTP->isAvailable<ElementLink< xAOD::TruthParticleContainer > >("truthParticleLink") ) {
-    truthLink = muTP->auxdata<ElementLink< xAOD::TruthParticleContainer > >("truthParticleLink");
+  if (m_isData) {
+    m_muonTrackValidationPlots.back()->fill(*muTP);
+    return;	
+  }
+
+  TruthLink truthLink;
+  if( muTP->isAvailable<TruthLink>("truthParticleLink") ) {
+    truthLink = muTP->auxdata<TruthLink>("truthParticleLink");
   }
   else {
     ATH_MSG_WARNING("No truth link available");
     return;
   }
-
-  if( truthLink ) {
-    if (!truthLink.isValid() || muTP->auxdata< int >("truthType")==0 ){
-      //unmatched - unknown
-      m_oUnmatchedRecoMuonTrackPlots->fill(*muTP);
-      for (unsigned int i=0; i<m_selectMuonCategories.size(); i++) {
-	if (m_selectMuonCategories[i]==ALL) {
-	  m_muonTrackValidationPlots[i]->fill(*muTP);
-	  break;
-	}
+  if (!truthLink.isValid() || muTP->auxdata< int >("truthType")==0 ){
+    //unmatched - unknown
+    m_oUnmatchedRecoMuonTrackPlots->fill(*muTP);
+    for (unsigned int i=0; i<m_selectMuonCategories.size(); i++) {
+      if (m_selectMuonCategories[i]==ALL) {
+	m_muonTrackValidationPlots[i]->fill(*muTP);
+	break;
       }
     }
-    else {
-      unsigned int thisMuonCategory = getMuonTruthCategory(muTP);
-      for (unsigned int i=0; i<m_selectMuonCategories.size(); i++) {
-	if (m_selectMuonCategories[i]==ALL || m_selectMuonCategories[i]==thisMuonCategory) {
-	  m_muonTrackValidationPlots[i]->fill(*truthLink, muTP); //if no muon is found a protection inside MuonValidationPlots will ensure, its plots won't be filled
-	}
+  }
+  else { //valid truth link and truthType
+    unsigned int thisMuonCategory = getMuonTruthCategory(muTP);
+    for (unsigned int i=0; i<m_selectMuonCategories.size(); i++) {
+      if (m_selectMuonCategories[i]==ALL || m_selectMuonCategories[i]==thisMuonCategory) {
+	m_muonTrackValidationPlots[i]->fill(*truthLink, muTP); //if no muon is found a protection inside MuonValidationPlots will ensure, its plots won't be filled
       }
     }
   }
@@ -378,20 +549,30 @@ void MuonPhysValMonitoringTool::handleMuonTrack(const xAOD::TrackParticle* muTP)
   return;
 }
 
+void MuonPhysValMonitoringTool::handleMuonL1Trigger(const xAOD::MuonRoI* TrigL1mu)
+{
+  if (msgLvl(MSG::DEBUG)) printMuonL1TriggerDebug(TrigL1mu);
+  for (unsigned int i=0; i<m_selectMuonCategories.size(); i++) {
+    if (m_selectMuonCategories[i]==ALL) { 
+      m_muonValidationPlots[i]->fill(*TrigL1mu);
+      break;
+    }
+  } 
+} 
+
 void MuonPhysValMonitoringTool::printMuonDebug(const xAOD::Muon* mu)
 {
   const xAOD::TrackParticle* tp  = mu->primaryTrackParticle();
-  ElementLink< xAOD::TruthParticleContainer > truthLink;
+  TruthLink truthLink;
   if( tp  ){
-    if( !tp->isAvailable<ElementLink< xAOD::TruthParticleContainer > >("truthParticleLink") ) ATH_MSG_DEBUG("No truth link found");
-    else truthLink = tp->auxdata<ElementLink< xAOD::TruthParticleContainer > >("truthParticleLink");
+    if( !tp->isAvailable<TruthLink>("truthParticleLink") ) ATH_MSG_DEBUG("No truth link found");
+    else truthLink = tp->auxdata<TruthLink>("truthParticleLink");
   }
   ATH_MSG_DEBUG("Muon: pt " << mu->pt() << " eta " << mu->eta() << " link " <<truthLink.isValid() );    
 }
 
 const xAOD::Muon* MuonPhysValMonitoringTool::findRecoMuon(const xAOD::TruthParticle* truthMu)
 {
-  typedef ElementLink< xAOD::MuonContainer > MuonLink;
   if(!truthMu->isAvailable< MuonLink >("recoMuonLink") ) return nullptr;
   MuonLink link = truthMu->auxdata< MuonLink >("recoMuonLink");
   if(!link.isValid() ) return nullptr;
@@ -408,6 +589,17 @@ void MuonPhysValMonitoringTool::printTruthMuonDebug(const xAOD::TruthParticle* t
   
 }
 
+// void MuonPhysValMonitoringTool::printMuonEFTriggerDebug(const xAOD::Muon* mu)
+// {
+//   ATH_MSG_DEBUG("   ==> Geometrical selection of EF Trigger muons: pt " << mu->pt() <<" phi " << mu->phi() <<" eta " << mu->eta() <<  " author " << mu->author());    
+// }
+
+void MuonPhysValMonitoringTool::printMuonL1TriggerDebug(const xAOD::MuonRoI* TrigL1mu)
+{
+  ATH_MSG_DEBUG("MuonRoI L1 Trigger: ptThr " << TrigL1mu->thrValue() <<" phi " << TrigL1mu->phi() <<" eta " << TrigL1mu->eta());    
+}
+
+
 
 StatusCode MuonPhysValMonitoringTool::procHistograms() 
 {
@@ -431,7 +623,6 @@ StatusCode MuonPhysValMonitoringTool::procHistograms()
 
 const xAOD::MuonSegment* MuonPhysValMonitoringTool::findRecoMuonSegment(const xAOD::MuonSegment* truthMuSeg)
 {
-  typedef ElementLink< xAOD::MuonSegmentContainer > MuonSegmentLink;
   if(!truthMuSeg->isAvailable< MuonSegmentLink >("recoSegmentLink") ) {
     ATH_MSG_DEBUG("recoSegmentLink not found");
     return nullptr;
@@ -461,9 +652,9 @@ TH1F* MuonPhysValMonitoringTool::findHistogram(std::vector<HistData> hists,std::
 
 MuonPhysValMonitoringTool::MUCATEGORY MuonPhysValMonitoringTool::getMuonSegmentTruthCategory(const xAOD::MuonSegment* truthMuSeg,const xAOD::TruthParticleContainer* muonTruthContainer)
 {
-  ElementLink< xAOD::TruthParticleContainer > truthLink;
-  if( truthMuSeg->isAvailable<ElementLink< xAOD::TruthParticleContainer > >("truthParticleLink") ) {
-    truthLink = truthMuSeg->auxdata<ElementLink< xAOD::TruthParticleContainer > >("truthParticleLink");
+  TruthLink truthLink;
+  if( truthMuSeg->isAvailable<TruthLink>("truthParticleLink") ) {
+    truthLink = truthMuSeg->auxdata<TruthLink>("truthParticleLink");
     if (truthLink.isValid()) {
       int theBarcode = (*truthLink)->barcode();
       if (abs( (*truthLink)->pdgId() ) != 13) return REST;
@@ -488,4 +679,34 @@ MuonPhysValMonitoringTool::MUCATEGORY MuonPhysValMonitoringTool::getMuonTruthCat
   return REST;
 }
 
+void MuonPhysValMonitoringTool::decorateMuon(xAOD::Muon*& mu)
+{
+  //if( outputMuon ) ATH_MSG_WARNING( "Non-null pointer received. " "There's a possible memory leak!" );
+  m_muonSelectionTool->setQuality(*mu);
+  if (mu->quality()>xAOD::Muon::VeryLoose || mu->quality()<xAOD::Muon::Tight) ATH_MSG_WARNING( "Muon quality is wrong");
+  
+  m_muonSelectionTool->setPassesHighPtCuts(*mu);
+  m_muonSelectionTool->setPassesIDCuts(*mu);
+}
+  
+void MuonPhysValMonitoringTool::modifyHistogram(TH1* hist)
+{
+  std::string histname = hist->GetName();
+
+  if (histname.find("trigger_L1_pt") != std::string::npos){ //if (histname=="Muons_All_trigger_L1_pt"){ 
+    hist->SetTitle("L1Trigger Muons pt treshold");
+    hist->GetXaxis()->SetTitle("L1Trigger Muons pt treshold [GeV]");
+    hist->GetXaxis()->Set(30,-0.5,29.5);
+  }
+  if (histname.find("trigger_L1_eta_pt") != std::string::npos){ // if (histname=="Muons_All_trigger_L1_eta_pt") {
+    hist->SetTitle("L1Trigger Muons pt treshold vs eta");
+    hist->GetYaxis()->Set(90,-0.5,29.5);
+    hist->GetYaxis()->SetTitle("L1Trigger Muons pt treshold [GeV]");
+  }
+
+  if (histname.find("MS_Res_phi") != std::string::npos){
+    hist->GetXaxis()->Set(50,-0.025,0.025);	
+  }
+}
+  
 } //close namespace
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.h
index 827e298f13b..63fb91b949f 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.h
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonPhysValMonitoringTool.h
@@ -21,6 +21,9 @@
 #include "xAODTruth/TruthParticleContainer.h"
 #include "xAODTruth/TruthParticleAuxContainer.h"
 
+// Tools
+#include "MuonSelectorTools/IMuonSelectionTool.h"
+
 // Local includes
 #include "AthenaMonitoring/ManagedMonitorToolBase.h"
 
@@ -82,15 +85,25 @@ class MuonPhysValMonitoringTool
   void handleMuonTrack(const xAOD::TrackParticle* muTP);
   void handleMuonSegment(const xAOD::MuonSegment* muSeg);
   void handleTruthMuonSegment(const xAOD::MuonSegment* truthMuSeg, const xAOD::TruthParticleContainer* muonTruthContainer);
-  
+  void handleMuonTrigger(const xAOD::Muon* Trigmu);
+  void handleMuonL1Trigger(const xAOD::MuonRoI* TrigL1mu);
+
   void printMuonDebug(const xAOD::Muon* mu);
+  void printMuonL1TriggerDebug(const xAOD::MuonRoI* TrigL1mu);
+
   void printTruthMuonDebug(const xAOD::TruthParticle* truthMu, const xAOD::Muon* mu);
   StatusCode bookValidationPlots(PlotBase& valPlots);
   const xAOD::Muon* findRecoMuon(const xAOD::TruthParticle* truthMu);
   const xAOD::MuonSegment* findRecoMuonSegment(const xAOD::MuonSegment* truthMuSeg);
 
+  void decorateMuon(xAOD::Muon*& mu);
+  const xAOD::TrackParticleContainer* MSTracks;
+  
   TH1F* findHistogram(std::vector<HistData> hists,std::string hnameTag,std::string hdirTag,std::string hNewName);
+  void modifyHistogram(TH1* hist);
 
+  bool m_isData;
+  
   // Containers
   std::string m_muonsName;
   std::string m_muonsTruthName;
@@ -105,7 +118,17 @@ class MuonPhysValMonitoringTool
   bool m_doMuonTrackValidation;
   bool m_doBinnedResolutionPlots;
 
-  //
+  bool m_doTrigMuonValidation;
+  bool m_doTrigMuonL1Validation;
+  bool m_doTrigMuonL2Validation;
+  bool m_doTrigMuonEFValidation;
+
+  std::string m_muonL1TrigName;
+  std::string m_muonEFCombTrigName;
+  
+  // Tools
+  ToolHandle<CP::IMuonSelectionTool> m_muonSelectionTool;
+ 
   enum MUCATEGORY{ALL=0, PROMPT, INFLIGHT, NONISO, REST};
   std::vector<std::string> m_selectMuonCategoriesStr;
   MuonPhysValMonitoringTool::MUCATEGORY getMuonSegmentTruthCategory(const xAOD::MuonSegment* truthMuSeg, const xAOD::TruthParticleContainer* muonTruthContainer);
@@ -121,12 +144,15 @@ class MuonPhysValMonitoringTool
   Muon::MuonSegmentPlots* m_oUnmatchedRecoMuonSegmentPlots;
 
   //overview hists
+  std::vector<TH1F*> h_overview_nObjects;
   TH1F* h_overview_reco_category;
   std::vector<TH1F*> h_overview_reco_authors;
 
   std::vector<const xAOD::Muon*> m_vMatchedMuons;
   std::vector<const xAOD::TrackParticle*> m_vMatchedMuonTracks;
   std::vector<const xAOD::MuonSegment*> m_vMatchedMuonSegments;
+  std::vector<const xAOD::Muon*> m_vEFMuons;
+  std::vector<const xAOD::Muon*> m_vEFMuonsSelected;
 }; 
 
 
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonSegmentValidationPlots.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonSegmentValidationPlots.cxx
index 861fe1b644a..e86a7f986be 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonSegmentValidationPlots.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonSegmentValidationPlots.cxx
@@ -4,28 +4,39 @@
 
 #include "MuonSegmentValidationPlots.h"
 
-MuonSegmentValidationPlots::MuonSegmentValidationPlots(PlotBase* pParent, std::string sDir):
-  PlotBase(pParent, sDir),
-  m_oRecoSegmPlots(this, "reco/MuonSegments/"),
-  m_oMatchedMuonSegmPlots(this, "matched/MuonSegments/"),
-  m_oMatchedMuonSegmDiffPlots(this, "matched/MuonSegments/"),
-  m_oTruthMuonSegmPlots(this, "truth/MuonSegments/")
-{}
+MuonSegmentValidationPlots::MuonSegmentValidationPlots(PlotBase* pParent, std::string sDir, bool isData):
+  PlotBase(pParent, sDir), m_oRecoSegmPlots(NULL), m_oMatchedMuonSegmPlots(NULL), m_oMatchedMuonSegmDiffPlots(NULL), m_oTruthMuonSegmPlots(NULL)
+{
+  m_oRecoSegmPlots = new Muon::MuonSegmentPlots(this, "reco/MuonSegments/");
+  if (!isData) {
+    m_oMatchedMuonSegmPlots = new Muon::MuonSegmentPlots(this, "matched/MuonSegments/");
+    m_oMatchedMuonSegmDiffPlots = new Muon::MuonSegmentTruthRelatedPlots(this, "matched/MuonSegments/");
+    m_oTruthMuonSegmPlots = new Muon::MuonSegmentPlots(this, "truth/MuonSegments/");
+  }
+}
+
+MuonSegmentValidationPlots::~MuonSegmentValidationPlots()
+{
+  delete m_oRecoSegmPlots;
+  if (m_oMatchedMuonSegmPlots) delete m_oMatchedMuonSegmPlots;
+  if (m_oMatchedMuonSegmDiffPlots) delete m_oMatchedMuonSegmDiffPlots;
+  if (m_oTruthMuonSegmPlots) delete m_oTruthMuonSegmPlots;  
+}
 
 void MuonSegmentValidationPlots::fill(const xAOD::MuonSegment* truthMuSeg, const xAOD::MuonSegment* muSeg)
 {
   if (truthMuSeg) 
-    m_oTruthMuonSegmPlots.fill( *truthMuSeg );
+    m_oTruthMuonSegmPlots->fill( *truthMuSeg );
   if (muSeg)
-    m_oRecoSegmPlots.fill(*muSeg);
+    m_oRecoSegmPlots->fill(*muSeg);
   
   if ( (truthMuSeg) && (muSeg) ) {    
-    m_oMatchedMuonSegmPlots.fill( *truthMuSeg );
-    m_oMatchedMuonSegmDiffPlots.fill( *truthMuSeg, *muSeg );
+    m_oMatchedMuonSegmPlots->fill( *truthMuSeg );
+    m_oMatchedMuonSegmDiffPlots->fill( *truthMuSeg, *muSeg );
   }
 }
 
 void MuonSegmentValidationPlots::fill(const xAOD::MuonSegment* muSeg)
 {
-  m_oRecoSegmPlots.fill(*muSeg);
+  m_oRecoSegmPlots->fill(*muSeg);
 }
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonSegmentValidationPlots.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonSegmentValidationPlots.h
index 31c872fd69a..b90f4f66b0f 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonSegmentValidationPlots.h
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonSegmentValidationPlots.h
@@ -10,14 +10,15 @@
 
 class MuonSegmentValidationPlots: public PlotBase {
   public:
-    MuonSegmentValidationPlots(PlotBase* pParent, std::string sDir);
-
+    MuonSegmentValidationPlots(PlotBase* pParent, std::string sDir, bool isData);
+    ~MuonSegmentValidationPlots();
+    
     // Reco only information
-    Muon::MuonSegmentPlots                 m_oRecoSegmPlots;
+    Muon::MuonSegmentPlots                 *m_oRecoSegmPlots;
     // Truth related plots
-    Muon::MuonSegmentPlots                 m_oMatchedMuonSegmPlots;
-    Muon::MuonSegmentTruthRelatedPlots     m_oMatchedMuonSegmDiffPlots;
-    Muon::MuonSegmentPlots                 m_oTruthMuonSegmPlots;
+    Muon::MuonSegmentPlots                 *m_oMatchedMuonSegmPlots;
+    Muon::MuonSegmentTruthRelatedPlots     *m_oMatchedMuonSegmDiffPlots;
+    Muon::MuonSegmentPlots                 *m_oTruthMuonSegmPlots;
 
     void fill(const xAOD::MuonSegment* truthMuSeg, const xAOD::MuonSegment* muSeg);
     void fill(const xAOD::MuonSegment* muSeg);
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonTrackValidationPlots.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonTrackValidationPlots.cxx
index ca1837c1a38..27cb958321e 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonTrackValidationPlots.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonTrackValidationPlots.cxx
@@ -4,20 +4,27 @@
 
 #include "MuonTrackValidationPlots.h"
 
-MuonTrackValidationPlots::MuonTrackValidationPlots(PlotBase* pParent, std::string sDir):PlotBase(pParent, sDir),
-m_oRecoMuonTrackPlots(this, "reco/MSTrackParticles/"),
-m_oMatchedMuonTrackPlots(this,"matched/MSTrackParticles/") {}
+MuonTrackValidationPlots::MuonTrackValidationPlots(PlotBase* pParent, std::string sDir, bool isData):PlotBase(pParent, sDir), m_oRecoMuonTrackPlots(NULL), m_oMatchedMuonTrackPlots(NULL)
+{
+  m_oRecoMuonTrackPlots = new RecoMuonTrackPlots(this, "reco/MSTrackParticles/");
+  if (!isData) m_oMatchedMuonTrackPlots = new TruthRelatedMuonTrackPlots(this,"matched/MSTrackParticles/");
+}
 
+MuonTrackValidationPlots::~MuonTrackValidationPlots()
+{
+  delete m_oRecoMuonTrackPlots;
+  if (m_oMatchedMuonTrackPlots) delete m_oMatchedMuonTrackPlots;
+}
 
 void MuonTrackValidationPlots::fill(const xAOD::TrackParticle& muTP) {
-  m_oRecoMuonTrackPlots.fill(muTP);
+  m_oRecoMuonTrackPlots->fill(muTP);
 }
 
 void MuonTrackValidationPlots::fill(const xAOD::TruthParticle* truthMu, const xAOD::TrackParticle* muTP){
   if (muTP) {
-    m_oRecoMuonTrackPlots.fill(*muTP);
+    m_oRecoMuonTrackPlots->fill(*muTP);
     if (truthMu) {
-      m_oMatchedMuonTrackPlots.fill(*truthMu,*muTP);
+      m_oMatchedMuonTrackPlots->fill(*truthMu,*muTP);
     }
   }
  
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonTrackValidationPlots.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonTrackValidationPlots.h
index ffe0dac4cd1..aa4d9ceb3e4 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonTrackValidationPlots.h
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonTrackValidationPlots.h
@@ -13,12 +13,13 @@
 
 class MuonTrackValidationPlots:public PlotBase {
   public:
-    MuonTrackValidationPlots(PlotBase* pParent, std::string sDir);
+    MuonTrackValidationPlots(PlotBase* pParent, std::string sDir, bool isData=false);
+    ~MuonTrackValidationPlots();
 
     // Reco only information
-    RecoMuonTrackPlots          m_oRecoMuonTrackPlots;
+    RecoMuonTrackPlots          *m_oRecoMuonTrackPlots;
     // Truth related plots
-    TruthRelatedMuonTrackPlots  m_oMatchedMuonTrackPlots;
+    TruthRelatedMuonTrackPlots  *m_oMatchedMuonTrackPlots;
 
     void fill(const xAOD::TrackParticle& muTP);
     void fill(const xAOD::TruthParticle* truthMu, const xAOD::TrackParticle* muTP);
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonValidationPlots.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonValidationPlots.cxx
index aeb7ec2966f..d1f1e9f6415 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonValidationPlots.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonValidationPlots.cxx
@@ -3,104 +3,117 @@
 */
 
 #include "MuonValidationPlots.h"
+#include "MuonHistUtils/MuonEnumDefs.h"
 
 typedef ElementLink< xAOD::TrackParticleContainer > TrackLink;
 typedef ElementLink< xAOD::MuonContainer > MuonLink;
 
-MuonValidationPlots::MuonValidationPlots(PlotBase* pParent, std::string sDir,std::vector<unsigned int> authors, bool doBinnedResolutionPlots):
-  PlotBase(pParent, sDir),
-  m_authorNames(xAOD::Muon::NumberOfMuonAuthors+1,""),
-  m_truthSelections(2,"")
+MuonValidationPlots::MuonValidationPlots(PlotBase* pParent, std::string sDir,std::vector<unsigned int> authors, bool isData, bool doBinnedResolutionPlots, bool doTrigMuonL1Validation, bool doTrigMuonL2Validation, bool doTrigMuonEFValidation):
+  PlotBase(pParent, sDir),  m_selectedAuthors(authors), m_truthSelections(2,""), m_isData(isData), m_doTrigMuonL1Validation(doTrigMuonL1Validation), m_doTrigMuonL2Validation(doTrigMuonL2Validation), m_doTrigMuonEFValidation(doTrigMuonEFValidation)
+
 {
-  m_truthSelections[0] = "all"; //no selection on truth muons (minimum selection is |eta|<2.5, pt>5 GeV, defined in MuonPhysValMonitoringTool::handleTruthMuon() 
-  m_truthSelections[1] = "MSAcceptance"; //truth muons in MS acceptance (at least 4 associated hits in the MS)
+  if (!m_isData) {
+    m_truthSelections[0] = "all"; //no selection on truth muons (minimum selection is |eta|<2.5, pt>5 GeV, defined in MuonPhysValMonitoringTool::handleTruthMuon() 
+    m_truthSelections[1] = "MSAcceptance"; //truth muons in MS acceptance (at least 4 associated hits in the MS)
 
-  for(const auto truthSelection : m_truthSelections) {
-    m_oTruthMuonPlots.push_back(new TruthMuonPlots(this,"truth/"+truthSelection));
+    //histogram classes for all muons
+    for(const auto truthSelection : m_truthSelections) {
+      m_oTruthMuonPlots.push_back(new TruthMuonPlots(this,"truth/"+truthSelection));
+    }
+    m_oTruthRelatedMuonPlots = new TruthRelatedMuonPlots(this, "matched/AllMuons", doBinnedResolutionPlots);
+  }
+  //histogram classes for all muons
+  m_oRecoMuonPlots = new RecoMuonPlots(this, "reco/AllMuons");
+  
+  //define a histogram class for each of the selected muon qualities
+  for(unsigned int i=0; i<Muon::EnumDefs::nMuonQualities(); i++) {
+    std::string sQuality = Muon::EnumDefs::toString( (xAOD::Muon::Quality) i);
+    m_oRecoMuonPlots_perQuality.push_back(new RecoMuonPlots(this, "reco/"+sQuality));
+    if (!m_isData) m_oTruthRelatedMuonPlots_perQuality.push_back(new TruthRelatedMuonPlots(this, "matched/"+sQuality, false)); //disable binned resolution plots for qualities 
+    //m_oTruthRelatedMuonPlots_perQuality.push_back(new TruthRelatedMuonPlots(this, "matched/"+sQuality, doBinnedResolutionPlots));    
   }
-
-  //list of author names taken from: Event/xAOD/xAODMuon/xAODMuon/versions/Muon_v1.h
-  //19.0.3
-  m_authorNames[xAOD::Muon::unknown]="unknown";      // 0
-  m_authorNames[xAOD::Muon::MuidCo]="MuidCombined";
-  m_authorNames[xAOD::Muon::STACO]="STACO";
-  m_authorNames[xAOD::Muon::MuTag]="MuTag";
-  m_authorNames[xAOD::Muon::MuTagIMO]="MuTagIMO";
-  m_authorNames[xAOD::Muon::MuidSA]="MuidStandalone";
-  m_authorNames[xAOD::Muon::MuGirl]="MuGirl";
-  m_authorNames[xAOD::Muon::MuGirlLowBeta]="MuGirlLowBeta";  // 15
-  m_authorNames[xAOD::Muon::CaloTag]="CaloTag";
-  m_authorNames[xAOD::Muon::CaloLikelihood]="CaloLikelihood";
-  m_authorNames[xAOD::Muon::ExtrapolateMuonToIP]="ExtrapolateMuonToIP"; // 20
-   
-  m_authorNames[xAOD::Muon::NumberOfMuonAuthors]="AllAuthors"; //inclusive
-
-
-  //19.0.2
-  // m_authorNames[0]="undefined";      // 0
-  // m_authorNames[1]="unknown";
-  // m_authorNames[2]="unknown";
-  // m_authorNames[3]="unknown";
-  // m_authorNames[4]="MuonboySP";
-  // m_authorNames[5]="Muonboy";        // 5
-  // m_authorNames[6]="STACO";
-  // m_authorNames[7]="MuTag";
-  // m_authorNames[8]="unknown";
-  // m_authorNames[9]="unknown";
-  // m_authorNames[10]="Moore";          // 10
-  // m_authorNames[11]="MuidStandalone";
-  // m_authorNames[12]="MuidCombined";
-  // m_authorNames[13]="MuGirl";
-  // m_authorNames[14]="CaloMuonID";
-  // m_authorNames[15]="MuGirlLowBeta";  // 15
-  // m_authorNames[16]="CaloTag";
-  // m_authorNames[17]="CaloLikelihood";
-  // m_authorNames[18]="MuTagIMO";
-  // m_authorNames[19]="MuonCombinedRefit";
-  // m_authorNames[20]="ExtrapolateMuonToIP"; // 20
-
-  // m_authorNames[21]="AllAuthors"; //inclusive
 
   //define a histogram class for each of the selected muon authors (+one inclusive for all authors
-  m_selectedAuthors = authors;
-  m_selectedAuthors.push_back(xAOD::Muon::NumberOfMuonAuthors);
-  for(const auto author : m_selectedAuthors) {   
-    m_oRecoMuonPlots.push_back(new RecoMuonPlots(this, "reco/"+m_authorNames[author]));
-    m_oTruthRelatedMuonPlots.push_back(new TruthRelatedMuonPlots(this, "matched/"+m_authorNames[author], doBinnedResolutionPlots));
+  for (unsigned int i=0; i<m_selectedAuthors.size(); i++) {
+    std::string sAuthor = Muon::EnumDefs::toString( (xAOD::Muon::Author) m_selectedAuthors[i] );
+    m_oRecoMuonPlots_perAuthor.push_back(new RecoMuonPlots(this, "reco/"+sAuthor));
+    if (!m_isData) m_oTruthRelatedMuonPlots_perAuthor.push_back(new TruthRelatedMuonPlots(this, "matched/"+sAuthor, doBinnedResolutionPlots));
+    if (m_doTrigMuonEFValidation) m_oEFTriggerMuonPlots.push_back(new EFTriggerMuonPlots(this,"trigger/EF/"+sAuthor));
   }
-
+  if (m_doTrigMuonL1Validation) m_oL1TriggerMuonPlots = new L1TriggerMuonPlots(this,"trigger/L1");
 }
 
 MuonValidationPlots::~MuonValidationPlots()
 {
-  for (unsigned int i=0; i<m_oRecoMuonPlots.size(); i++) {    
-    RecoMuonPlots *recoMuonPlots = m_oRecoMuonPlots[i];
-    TruthRelatedMuonPlots *truthRelatedMuonPlots = m_oTruthRelatedMuonPlots[i];
-    
-    delete recoMuonPlots;
-    delete truthRelatedMuonPlots;
+  delete m_oRecoMuonPlots;
+  m_oRecoMuonPlots=0;
+
+  if (!m_isData) {
+    delete m_oTruthRelatedMuonPlots;
+    m_oTruthRelatedMuonPlots=0;    
 
+    for (unsigned int i=0; i<m_oTruthMuonPlots.size(); i++) {    
+      TruthMuonPlots *truthMuonPlots = m_oTruthMuonPlots[i];
+      delete truthMuonPlots;
+      truthMuonPlots = 0;
+    }
+    for (unsigned int i=0; i<m_oTruthRelatedMuonPlots_perQuality.size(); i++) {    
+      TruthRelatedMuonPlots *truthRelatedMuonPlots = m_oTruthRelatedMuonPlots_perQuality[i];
+      delete truthRelatedMuonPlots;
+      truthRelatedMuonPlots = 0;
+    }
+    for (unsigned int i=0; i<m_oTruthRelatedMuonPlots_perAuthor.size(); i++) {    
+      TruthRelatedMuonPlots *truthRelatedMuonPlots = m_oTruthRelatedMuonPlots_perAuthor[i];
+      delete truthRelatedMuonPlots;
+      truthRelatedMuonPlots = 0;
+    }
+  }
+  
+  if (m_doTrigMuonL1Validation) {
+    delete m_oL1TriggerMuonPlots;
+    m_oL1TriggerMuonPlots=0;
+  }
+  
+  for (unsigned int i=0; i<m_oRecoMuonPlots_perQuality.size(); i++) {    
+    RecoMuonPlots *recoMuonPlots = m_oRecoMuonPlots_perQuality[i];    
+    delete recoMuonPlots;
     recoMuonPlots = 0;
-    truthRelatedMuonPlots = 0;
   }
+  for (unsigned int i=0; i<m_oRecoMuonPlots_perAuthor.size(); i++) {    
+    RecoMuonPlots *recoMuonPlots = m_oRecoMuonPlots_perAuthor[i];
+    delete recoMuonPlots;
+    recoMuonPlots = 0;
 
-  for (unsigned int i=0; i<m_oTruthMuonPlots.size(); i++) {    
-    TruthMuonPlots *truthMuonPlots = m_oTruthMuonPlots[i];
-    delete truthMuonPlots;
-    truthMuonPlots = 0;
-  }
+    if (m_doTrigMuonEFValidation) {
+      EFTriggerMuonPlots *trigMuonPlots = m_oEFTriggerMuonPlots[i];
+      delete trigMuonPlots;
+      trigMuonPlots=0;
+    }
+  }        
 }
 
-void MuonValidationPlots::fillRecoMuonPlots(const xAOD::Muon& mu) {
+void MuonValidationPlots::fillRecoMuonPlots(const xAOD::Muon& mu)
+{
+  //fill hists for all muons
+  m_oRecoMuonPlots->fill(mu);
+	
+  //fill separate hists for each muon quality
+  xAOD::Muon::Quality muqual = mu.quality();
+  for (unsigned int i=0; i<Muon::EnumDefs::nMuonQualities(); i++) {    
+    if ( muqual <= (xAOD::Muon::Quality)i ) {
+      m_oRecoMuonPlots_perQuality[i]->fill(mu);
+    }
+  }
   //fill separate hists for each author
   for (unsigned int i=0; i<m_selectedAuthors.size(); i++) {
-    if (mu.isAuthor( (xAOD::Muon::Author)m_selectedAuthors[i] ) || m_selectedAuthors[i]==xAOD::Muon::NumberOfMuonAuthors) {
-      m_oRecoMuonPlots[i]->fill(mu);
+    if (mu.isAuthor( (xAOD::Muon::Author)m_selectedAuthors[i] )) {
+      m_oRecoMuonPlots_perAuthor[i]->fill(mu);
     }
   }
 }
-void MuonValidationPlots::fillTruthMuonPlots(const xAOD::TruthParticle &truthMu) {
 
+void MuonValidationPlots::fillTruthMuonPlots(const xAOD::TruthParticle &truthMu)
+{
   m_oTruthMuonPlots[0]->fill(truthMu); //no selections
  
   if (isGoodTruthTrack(truthMu)) { //in MS acceptance (minimum precision hits)
@@ -109,6 +122,28 @@ void MuonValidationPlots::fillTruthMuonPlots(const xAOD::TruthParticle &truthMu)
 
 }
 
+void MuonValidationPlots::fillTriggerMuonPlots(const xAOD::MuonRoI &TrigL1mu) {
+  m_oL1TriggerMuonPlots->fill(TrigL1mu);  
+}
+
+void MuonValidationPlots::fillTriggerMuonPlots(const xAOD::Muon &mu,const xAOD::Muon &Trigmu) {
+  for (unsigned int i=0; i<m_selectedAuthors.size(); i++) {
+    if (mu.isAuthor( (xAOD::Muon::Author)m_selectedAuthors[i] )) {
+      //if (Trigmu.isAuthor( (xAOD::Muon::Author)m_selectedAuthors[i] ) || m_selectedAuthors[i]==xAOD::Muon::NumberOfMuonAuthors) {
+      m_oEFTriggerMuonPlots[i]->fill(Trigmu,Trigmu);
+    }
+  }
+}
+
+void MuonValidationPlots::fill(const xAOD::Muon& /* mu */,const xAOD::Muon& Trigmu) {
+  fillTriggerMuonPlots(Trigmu,Trigmu);
+}
+
+void MuonValidationPlots::fill(const xAOD::MuonRoI& TrigL1mu) {
+  fillTriggerMuonPlots(TrigL1mu);
+}
+
+
 void MuonValidationPlots::fill(const xAOD::Muon& mu) {
   fillRecoMuonPlots(mu);
 }
@@ -117,17 +152,28 @@ void MuonValidationPlots::fill(const xAOD::TruthParticle &truthMu){
   fillTruthMuonPlots(truthMu);
 }
 
-void MuonValidationPlots::fill(const xAOD::TruthParticle* truthMu, const xAOD::Muon* mu){
-
+void MuonValidationPlots::fill(const xAOD::TruthParticle* truthMu, const xAOD::Muon* mu, const xAOD::TrackParticleContainer* MSTracks)
+{
   if (truthMu) fillTruthMuonPlots(*truthMu);
   if (mu) fillRecoMuonPlots(*mu);
 
   if ( (mu) && (truthMu) ) {
-    for (unsigned int i=0; i<m_selectedAuthors.size(); i++) {
-      if (mu->isAuthor( (xAOD::Muon::Author)m_selectedAuthors[i] ) || m_selectedAuthors[i]==xAOD::Muon::NumberOfMuonAuthors) {
-	m_oTruthRelatedMuonPlots[i]->fill(*truthMu, *mu);
+    //plots for all
+    m_oTruthRelatedMuonPlots->fill(*truthMu, *mu, MSTracks);
+    
+    //plots per quality
+    xAOD::Muon::Quality muqual = mu->quality();
+    for (unsigned int i=0; i<Muon::EnumDefs::nMuonQualities(); i++) {    
+      if ( muqual <= (xAOD::Muon::Quality)i ) {
+	m_oTruthRelatedMuonPlots_perQuality[i]->fill(*truthMu, *mu, MSTracks);
       }
     }
+    //plots per author
+    for (unsigned int i=0; i<m_selectedAuthors.size(); i++) {
+      if (mu->isAuthor( (xAOD::Muon::Author)m_selectedAuthors[i] )) {
+	m_oTruthRelatedMuonPlots_perAuthor[i]->fill(*truthMu, *mu, MSTracks);
+      }
+    }    
   }
 
 }
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonValidationPlots.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonValidationPlots.h
index 57843023dd4..dd66b34cbcc 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonValidationPlots.h
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/MuonValidationPlots.h
@@ -9,30 +9,52 @@
 #include "TruthMuonPlots.h"
 #include "TruthRelatedMuonPlots.h"
 
+#include "MuonHistUtils/L1TriggerMuonPlots.h"
+#include "MuonHistUtils/EFTriggerMuonPlots.h"
+
 #include "xAODMuon/Muon.h"
 #include "xAODMuon/MuonContainer.h"
 #include "xAODTruth/TruthParticle.h"
+#include "xAODTrigger/MuonRoI.h"
 
 class MuonValidationPlots:public PlotBase {
   public:
-    MuonValidationPlots(PlotBase* pParent, std::string sDir, std::vector<unsigned int> authors,bool doBinnedResolutionPlots);
+  MuonValidationPlots(PlotBase* pParent, std::string sDir, std::vector<unsigned int> authors, bool isData, bool doBinnedResolutionPlots, bool doTrigMuonL1Validation, bool doTrigMuonL2Validation, bool doTrigMuonEFValidation );
+
     virtual ~MuonValidationPlots();
     void fill(const xAOD::Muon& mu);
-    void fill(const xAOD::TruthParticle& truthMu);
-    void fill(const xAOD::TruthParticle* truthMu, const xAOD::Muon* mu);
+    void fill(const xAOD::MuonRoI &TrigL1mu);
+    void fill(const xAOD::Muon& mu, const xAOD::Muon& Trigmu);
     bool isGoodTruthTrack(const xAOD::TruthParticle& truthMu);
 
+    void fill(const xAOD::TruthParticle& truthMu);
+    void fill(const xAOD::TruthParticle* truthMu, const xAOD::Muon* mu, const xAOD::TrackParticleContainer* MSTracks);
+
     std::vector<unsigned int> m_selectedAuthors;
-    std::vector<std::string> m_authorNames;
     std::vector<std::string> m_truthSelections;    
-
-    std::vector<RecoMuonPlots*> m_oRecoMuonPlots;
-    std::vector<TruthMuonPlots*> m_oTruthMuonPlots;
-    std::vector<TruthRelatedMuonPlots*> m_oTruthRelatedMuonPlots;
+    std::vector<std::string> m_TriggerLevels;
+ 
+    RecoMuonPlots *m_oRecoMuonPlots;
+    TruthRelatedMuonPlots *m_oTruthRelatedMuonPlots;
+    L1TriggerMuonPlots* m_oL1TriggerMuonPlots;    
+    std::vector<EFTriggerMuonPlots*> m_oEFTriggerMuonPlots;
+    std::vector<RecoMuonPlots*> m_oRecoMuonPlots_perQuality;
+    std::vector<RecoMuonPlots*> m_oRecoMuonPlots_perAuthor;
+    std::vector<TruthRelatedMuonPlots*> m_oTruthRelatedMuonPlots_perQuality;
+    std::vector<TruthRelatedMuonPlots*> m_oTruthRelatedMuonPlots_perAuthor;
+    std::vector<TruthMuonPlots*> m_oTruthMuonPlots;    
 
  private:
     void fillRecoMuonPlots(const xAOD::Muon& mu);
     void fillTruthMuonPlots(const xAOD::TruthParticle &truthMu);
+    void fillTriggerMuonPlots(const xAOD::Muon& mu,const xAOD::Muon& Trigmu);
+    void fillTriggerMuonPlots(const xAOD::MuonRoI& TrigL1mu);
+
+    bool m_isData;
+    bool m_doTrigMuonL1Validation;
+    bool m_doTrigMuonL2Validation;
+    bool m_doTrigMuonEFValidation;
+
 };
 
 #endif
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/RecoMuonPlots.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/RecoMuonPlots.cxx
index 132fae07448..8c077d52155 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/RecoMuonPlots.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/RecoMuonPlots.cxx
@@ -10,6 +10,7 @@ typedef ElementLink< xAOD::MuonContainer > MuonLink;
 RecoMuonPlots::RecoMuonPlots(PlotBase* pParent, std::string sDir):PlotBase(pParent, sDir),
 
 m_oAllPlots(this, "/", "Reco Muon"),
+m_oMuonParamPlots(this,"/"),
 m_oMuRecoInfoPlots(this, "/"),
 m_oImpactPlots(this, "/"),
 m_oMomentumPullPlots(this, "/"),
@@ -22,6 +23,7 @@ m_oMuonIsolationPlots(this,"/")
 void RecoMuonPlots::fill(const xAOD::Muon& mu) {
   //General Plots
   m_oAllPlots.fill(mu);
+  m_oMuonParamPlots.fill(mu);
   m_oMuRecoInfoPlots.fill(mu);
   m_oMomentumPullPlots.fill(mu);
   m_oMuonHitSummaryPlots.fill(mu);
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/RecoMuonPlots.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/RecoMuonPlots.h
index 3052cd9f1da..a282f588ddb 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/RecoMuonPlots.h
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/RecoMuonPlots.h
@@ -10,6 +10,7 @@
 #include "TrkValHistUtils/MSHitPlots.h"
 #include "TrkValHistUtils/ImpactPlots.h"
 #include "MuonHistUtils/RecoInfoPlots.h"
+#include "MuonHistUtils/MuonParamPlots.h"
 #include "MuonHistUtils/MomentumPullPlots.h"
 #include "MuonHistUtils/MuonIsolationPlots.h"
 #include "MuonHistUtils/MuonHitSummaryPlots.h"
@@ -24,6 +25,7 @@ class RecoMuonPlots:public PlotBase {
       
       // Reco only information
       Trk::ParamPlots                 m_oAllPlots;
+      Muon::MuonParamPlots            m_oMuonParamPlots;
       Muon::RecoInfoPlots             m_oMuRecoInfoPlots;
       Trk::ImpactPlots                m_oImpactPlots;
       Muon::MomentumPullPlots         m_oMomentumPullPlots;
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/TruthRelatedMuonPlots.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/TruthRelatedMuonPlots.cxx
index 2bed0f6bcf9..4087ce6fc60 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/TruthRelatedMuonPlots.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/TruthRelatedMuonPlots.cxx
@@ -3,6 +3,10 @@
 */
 
 #include "TruthRelatedMuonPlots.h"
+#include "xAODTruth/TruthParticleContainer.h"
+#include "xAODTruth/TruthParticleAuxContainer.h"
+#include "xAODTracking/TrackParticleContainer.h"
+#include "xAODTracking/TrackParticleAuxContainer.h"
 
 TruthRelatedMuonPlots::TruthRelatedMuonPlots(PlotBase* pParent, std::string sDir,bool doBinnedResolutionPlots):
     PlotBase(pParent, sDir),
@@ -16,11 +20,14 @@ TruthRelatedMuonPlots::TruthRelatedMuonPlots(PlotBase* pParent, std::string sDir
     m_oMuonIDResolutionPlots(this, "/resolutionID/",doBinnedResolutionPlots),
     m_oDefParamPullPlots(this, "/Pulls/"),
     m_oMSDefParamPullPlots(this, "/PullsMS/"),
-    m_oIDDefParamPullPlots(this, "/PullsID/"){}
+    m_oIDDefParamPullPlots(this, "/PullsID/"),
+
+    m_oMomentumDiffPlots(this,"/resolution/")
+{}
 
 TruthRelatedMuonPlots::~TruthRelatedMuonPlots() {}
 
-void TruthRelatedMuonPlots::fill(const xAOD::TruthParticle& truthMu, const xAOD::Muon& mu){
+void TruthRelatedMuonPlots::fill(const xAOD::TruthParticle& truthMu, const xAOD::Muon& mu, const xAOD::TrackParticleContainer* MSTracks){
     m_oMatchedPlots.fill( truthMu );
     m_oMuonHitDiffSummaryPlots.fill(mu, truthMu);
 
@@ -42,4 +49,34 @@ void TruthRelatedMuonPlots::fill(const xAOD::TruthParticle& truthMu, const xAOD:
         m_oMuonMSResolutionPlots.fill(*msTrk,truthMu);
         m_oMSDefParamPullPlots.fill(*msTrk, truthMu);
     }
-}
\ No newline at end of file
+
+
+    const xAOD::TrackParticle *msTrkIP(0);    
+    //if (mu) {
+    typedef ElementLink< xAOD::TruthParticleContainer > TruthLink;
+
+    ElementLink<xAOD::TrackParticleContainer> muTrk = mu.muonSpectrometerTrackParticleLink();
+    if (muTrk.isValid()) {
+      TruthLink truthLink_muTrk;
+      if( (*muTrk)->isAvailable<TruthLink>("truthParticleLink") ) {
+	truthLink_muTrk = (*muTrk)->auxdata<TruthLink>("truthParticleLink");
+      }
+      if (truthLink_muTrk.isValid()) {
+	for (const auto trk: *MSTracks) {
+	  TruthLink truthLink_msTrk;
+	  if( trk->isAvailable<TruthLink>("truthParticleLink") ) {
+	    truthLink_msTrk = trk->auxdata<TruthLink>("truthParticleLink");
+	    if (truthLink_msTrk.isValid()) {
+	      if (truthLink_msTrk == truthLink_muTrk) {
+		msTrkIP = trk;
+		break;
+	      }
+	    }
+	  }
+	}
+      }
+    }
+    // }  
+    m_oMomentumDiffPlots.fill(mu, msTrkIP, truthMu);
+    
+}
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/TruthRelatedMuonPlots.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/TruthRelatedMuonPlots.h
index 6ddb97404c3..71611f0664b 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/TruthRelatedMuonPlots.h
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonPhysValMonitoring/src/TruthRelatedMuonPlots.h
@@ -19,8 +19,8 @@ class TruthRelatedMuonPlots:public PlotBase {
  public:
   TruthRelatedMuonPlots(PlotBase* pParent, std::string sDir,bool doBinnedResolutionPlots);
   ~TruthRelatedMuonPlots();
-  void fill(const xAOD::TruthParticle& truthMu, const xAOD::Muon& mu);
-
+  void fill(const xAOD::TruthParticle& truthMu, const xAOD::Muon& mu, const xAOD::TrackParticleContainer* MSTrack);
+    
   // Truth related plots
   Trk::ParamPlots                 m_oMatchedPlots;
   Trk::MSHitDiffPlots             m_oMSHitDiffPlots;
@@ -31,6 +31,8 @@ class TruthRelatedMuonPlots:public PlotBase {
   Trk::DefParamPullPlots          m_oDefParamPullPlots;
   Trk::DefParamPullPlots          m_oMSDefParamPullPlots;
   Trk::DefParamPullPlots          m_oIDDefParamPullPlots;
+
+  Muon::MomentumDiffPlots         m_oMomentumDiffPlots;
 };
 
 #endif
-- 
GitLab