diff --git a/Reconstruction/egamma/egammaValidation/CMakeLists.txt b/Reconstruction/egamma/egammaValidation/CMakeLists.txt index 24ca334877fc64993afa7f1a7fda07cff0ea0afb..46ed471f78bf7d394c746b44fd9160d17c9f0bf1 100644 --- a/Reconstruction/egamma/egammaValidation/CMakeLists.txt +++ b/Reconstruction/egamma/egammaValidation/CMakeLists.txt @@ -36,8 +36,7 @@ atlas_add_component (egammmaValidation xAODEgamma xAODTracking TrkValHistUtils AsgAnalysisInterfaces) # Install JO/python files from the package: -atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) # ART shell executable scripts : -atlas_install_scripts( test/*.sh) +atlas_install_scripts( test/*.sh scripts/*py ) diff --git a/Reconstruction/egamma/egammaValidation/scripts/plotsMaker.py b/Reconstruction/egamma/egammaValidation/scripts/plotsMaker.py new file mode 100755 index 0000000000000000000000000000000000000000..0b4e0928dd5eb285de691b892a8268338275d2a3 --- /dev/null +++ b/Reconstruction/egamma/egammaValidation/scripts/plotsMaker.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python +# +# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration. +# + +import sys +import os + +#Import the ROOT libraries +from ROOT import gDirectory, gROOT, gStyle, kTRUE, TCanvas, TFile, TFileIter, TH1, TH1D, TLegend, TPad + +def GetKeyNames(f0, dir = ""): + f0.cd(dir) + return [key.GetName() for key in gDirectory.GetListOfKeys()] + + +if __name__ == '__main__': + f1 = TFile(sys.argv[1]) + f2 = TFile(sys.argv[2]) + + particleType = sys.argv[3] + + fO = TFile("BN_ComparisonPlots_"+particleType+".hist.root", "RECREATE") + + gROOT.SetBatch(kTRUE) + + for folder in GetKeyNames(f1): + for histo in GetKeyNames(f1,folder): + + c1 = TCanvas() + + mainPad = TPad("mainPad", "top", 0.00, 0.254758, 1.00, 1.00) + mainPad.SetLeftMargin(0.12) + mainPad.SetRightMargin(0.04) + mainPad.SetTopMargin(0.02) + mainPad.SetBottomMargin(0.02) + mainPad.SetTicky(0) + mainPad.SetTickx(0) + mainPad.Draw() + + c1.Update() + + ratioPad = TPad("ratioPad","bottom", 0.00, 0.00, 1.00, 0.25) + ratioPad.SetLeftMargin(0.12) + ratioPad.SetRightMargin(0.04) + ratioPad.SetTopMargin(0.03) + ratioPad.SetTickx(0) + ratioPad.SetBottomMargin(0.36) + ratioPad.Draw() + + c1.Update() + + h_Base = f1.Get(folder+'/'+histo) + h_Base.SetMarkerStyle(3) + h_Base.SetMarkerSize(2) + h_Base.SetMarkerColor(2) + h_Base.GetXaxis().SetLabelOffset(1.20) + + h_Night = f2.Get(folder+'/'+histo) + h_Night.SetLineColor(4) + + mainPad.cd() + + h_Base.Draw("hist p") + h_Night.Draw("same") + + c1.Update() + + leg = TLegend(0.330986, 0.884087, 0.879499, 0.97053) + leg.SetHeader(folder+'_'+histo, "C") + leg.SetNColumns(2) + leg.SetFillStyle(0) + leg.SetBorderSize(0) + leg.AddEntry(h_Base , "Baseline", "p") + leg.AddEntry(h_Night, "Nightly" , "l") + leg.Draw() + + c1.Update() + + ratioPad.cd() + + h1clone = h_Night.Clone() + h1clone.Sumw2() + h1clone.SetStats(0) + h1clone.Divide(h_Base) + h1clone.SetMarkerColor(1) + h1clone.SetMarkerStyle(20) + h1clone.GetXaxis().SetLabelSize(0.10) + h1clone.GetXaxis().SetTitleSize(0.13) + h1clone.GetYaxis().SetLabelSize(0.09) + h1clone.GetYaxis().SetRangeUser(0.75, 1.25) + h1clone.GetYaxis().SetTitle("Ratio") + h1clone.GetYaxis().CenterTitle(1) + h1clone.GetYaxis().SetTitleSize(0.09) + h1clone.GetYaxis().SetTitleOffset(0.3) + h1clone.GetYaxis().SetNdivisions(505) + + h1clone.Draw("p") + c1.Update() + + c1.SaveAs(folder+'_'+histo+".pdf" ) + c1.SaveAs(folder+'_'+histo+".png" ) + + fO.cd() + c1.Write(folder+'_'+histo) + + fO.Write() + fO.Close() + diff --git a/Reconstruction/egamma/egammaValidation/test/test_electron.sh b/Reconstruction/egamma/egammaValidation/test/test_electron.sh index f799fc2d0bcc0100d366b37ce14bccf9dc7d530d..8a7582e2e05e2697c266d8f7a749865c47dd9de7 100755 --- a/Reconstruction/egamma/egammaValidation/test/test_electron.sh +++ b/Reconstruction/egamma/egammaValidation/test/test_electron.sh @@ -35,7 +35,6 @@ athena -c "particleType='electron'" egamma_art_checker_joboptions.py echo "art-result: $? athena_job" -get_files -jo plotsMaker.py -python plotsMaker.py /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/egammaValidation/Baseline_Files/rootFiles/Baseline-monitoring_electron.hist.root Nightly-monitoring_electron.hist.root electron +plotsMaker.py /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/egammaValidation/Baseline_Files/rootFiles/Baseline-monitoring_electron.hist.root Nightly-monitoring_electron.hist.root electron echo "art-result: $? final_comparison" diff --git a/Reconstruction/egamma/egammaValidation/test/test_gamma.sh b/Reconstruction/egamma/egammaValidation/test/test_gamma.sh index 83c8dc16b0d6202d599441869d43afe80073b552..0e8932b3e58339f6b1d94b9c3836752319e1bd00 100755 --- a/Reconstruction/egamma/egammaValidation/test/test_gamma.sh +++ b/Reconstruction/egamma/egammaValidation/test/test_gamma.sh @@ -35,7 +35,6 @@ athena -c "particleType='gamma'" egamma_art_checker_joboptions.py echo "art-result: $? athena_job" -get_files -jo plotsMaker.py -python plotsMaker.py /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/egammaValidation/Baseline_Files/rootFiles/Baseline-monitoring_gamma.hist.root Nightly-monitoring_gamma.hist.root gamma +plotsMaker.py /cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/egammaValidation/Baseline_Files/rootFiles/Baseline-monitoring_gamma.hist.root Nightly-monitoring_gamma.hist.root gamma echo "art-result: $? final_comparison"