diff --git a/checker/perfscans/PerfScan_CompassUT.sh b/checker/perfscans/PerfScan_CompassUT.sh new file mode 100644 index 0000000000000000000000000000000000000000..55b10827a7d8deb99fc9ecb3d89086dcd2d20a2a --- /dev/null +++ b/checker/perfscans/PerfScan_CompassUT.sh @@ -0,0 +1,79 @@ +outloc=../output/perfscans +cd ../.. +cp cuda/UT/common/include/CompassUTDefinitions.cuh bkpfile.bkp + +for par in 'max_considered_before_found' +do + for val in '1' '3' '6' '9' '12' '15' + do + echo 'Scanning CompassUT parameters' $par $val + sed -i s/$par\ =\ \[^\;\]\*\;/$par\ =\ $val\;/g cuda/UT/common/include/CompassUTDefinitions.cuh + cd build + make -j 8 >& /tmp/WTF + ./Allen -f /data/gligorov/BsPhiPhi -c 1 -t 1 -r 1 -m 3000 >& $outloc\/CompassUT-$par-$val-scan.stdout + cp ../output/PrCheckerPlots.root $outloc\/PrChk-CompassUT-$par-$val-scan.root + cp ../output/KalmanIPCheckerOutput.root $outloc\/KFChk-CompassUT-$par-$val-scan.root + ./Allen -f /data/gligorov/minbias -c 0 -n 10000 -t 3 -r 1 -m 4000 >& $outloc\/CompassUT-$par-$val-tptscan.stdout + cd .. + cp bkpfile.bkp cuda/UT/common/include/CompassUTDefinitions.cuh + done +done + +cp bkpfile.bkp cuda/UT/common/include/CompassUTDefinitions.cuh +rm bkpfile.bkp + +cp cuda/UT/common/include/UTDefinitions.cuh bkpfile.bkp + +for par in 'minPT' 'minPTFinal' +do + for val in '0.1' '0.2' '0.3' '0.4' '0.5' '0.6' + do + echo 'Scanning CompassUT parameters' $par $val + sed -i s/$par\ =\ \[^f\]\*f/$par\ =\ $val\f/g cuda/UT/common/include/UTDefinitions.cuh + cd build + make -j 8 >& /tmp/WTF + ./Allen -f /data/gligorov/BsPhiPhi -c 1 -t 1 -r 1 -m 3000 >& $outloc\/CompassUT-$par-$val-scan.stdout + cp ../output/PrCheckerPlots.root $outloc\/PrChk-CompassUT-$par-$val-scan.root + cp ../output/KalmanIPCheckerOutput.root $outloc\/KFChk-CompassUT-$par-$val-scan.root + ./Allen -f /data/gligorov/minbias -c 0 -n 10000 -t 3 -r 1 -m 4000 >& $outloc\/CompassUT-$par-$val-tptscan.stdout + cd .. + cp bkpfile.bkp cuda/UT/common/include/UTDefinitions.cuh + done +done + +for par in 'minMomentum' 'minMomentumFinal' +do + for val in '0.5' '1.5' '2.5' '3.5' '4.5' '6.0' + do + echo 'Scanning CompassUT parameters' $par $val + sed -i s/$par\ =\ \[^f\]\*f/$par\ =\ $val\f/g cuda/UT/common/include/UTDefinitions.cuh + cd build + make -j 8 >& /tmp/WTF + ./Allen -f /data/gligorov/BsPhiPhi -c 1 -t 1 -r 1 -m 3000 >& $outloc\/CompassUT-$par-$val-scan.stdout + cp ../output/PrCheckerPlots.root $outloc\/PrChk-CompassUT-$par-$val-scan.root + cp ../output/KalmanIPCheckerOutput.root $outloc\/KFChk-CompassUT-$par-$val-scan.root + ./Allen -f /data/gligorov/minbias -c 0 -n 10000 -t 3 -r 1 -m 4000 >& $outloc\/CompassUT-$par-$val-tptscan.stdout + cd .. + cp bkpfile.bkp cuda/UT/common/include/UTDefinitions.cuh + done +done + +for par in 'yTol' +do + for val in '0.2' '0.35' '0.5' '0.65' '0.8' + do + echo 'Scanning CompassUT parameters' $par $val + sed -i s/$par\ =\ \[^f\]\*f/$par\ =\ $val\f/g cuda/UT/common/include/UTDefinitions.cuh + cd build + make -j 8 >& /tmp/WTF + ./Allen -f /data/gligorov/BsPhiPhi -c 1 -t 1 -r 1 -m 3000 >& $outloc\/CompassUT-$par-$val-scan.stdout + cp ../output/PrCheckerPlots.root $outloc\/PrChk-CompassUT-$par-$val-scan.root + cp ../output/KalmanIPCheckerOutput.root $outloc\/KFChk-CompassUT-$par-$val-scan.root + ./Allen -f /data/gligorov/minbias -c 0 -n 10000 -t 3 -r 1 -m 4000 >& $outloc\/CompassUT-$par-$val-tptscan.stdout + cd .. + cp bkpfile.bkp cuda/UT/common/include/UTDefinitions.cuh + done +done + +cp bkpfile.bkp cuda/UT/common/include/UTDefinitions.cuh +rm bkpfile.bkp diff --git a/checker/perfscans/PerfScan_PV.sh b/checker/perfscans/PerfScan_PV.sh new file mode 100644 index 0000000000000000000000000000000000000000..e04d6debe3eaaad1ab5ef923d968367b7d474971 --- /dev/null +++ b/checker/perfscans/PerfScan_PV.sh @@ -0,0 +1,70 @@ +outloc=../output/perfscans +cd ../.. +cp cuda/PV/beamlinePV/include/BeamlinePVConstants.cuh bkpfile.bkp + +for par in 'zmin' +do + for val in '-300' '-275' '-250' '-225' '-200' + do + echo 'Scanning PV parameters' $par $val + sed -i s/$par\ =\ \[^\;\]\*\;/$par\ =\ $val\f\;/g cuda/PV/beamlinePV/include/BeamlinePVConstants.cuh + cd build + make -j 8 >& /tmp/WTF + ./Allen -f ~/Data/BsPhiPhi/ -c 1 -m 3000 >& $outloc\/PV-$par-$val-scan.stdout + cp ../output/GPU_PVChecker.root $outloc\/PVChk-PV-$par-$val-scan.root + ./Allen -f /data/gligorov/minbias -c 0 -n 10000 -t 3 -r 1 -m 4000 >& $outloc\/PV-$par-$val-tptscan.stdout + cd .. + cp bkpfile.bkp cuda/PV/beamlinePV/include/BeamlinePVConstants.cuh + done +done + +for par in 'zmax' +do + for val in '200' '225' '250' '275' '300' + do + echo 'Scanning PV parameters' $par $val + sed -i s/$par\ =\ \[^\;\]\*\;/$par\ =\ $val\f\;/g cuda/PV/beamlinePV/include/BeamlinePVConstants.cuh + cd build + make -j 8 >& /tmp/WTF + ./Allen -f ~/Data/BsPhiPhi/ -c 1 -m 3000 >& $outloc\/PV-$par-$val-scan.stdout + cp ../output/GPU_PVChecker.root $outloc\/PVChk-PV-$par-$val-scan.root + ./Allen -f /data/gligorov/minbias -c 0 -n 10000 -t 3 -r 1 -m 4000 >& $outloc\/PV-$par-$val-tptscan.stdout + cd .. + cp bkpfile.bkp cuda/PV/beamlinePV/include/BeamlinePVConstants.cuh + done +done + +for par in 'maxChi2' +do + for val in '7' '8' '9' '10' '11' + do + echo 'Scanning PV parameters' $par $val + sed -i s/$par\ =\ \[^\;\]\*\;/$par\ =\ $val\f\;/g cuda/PV/beamlinePV/include/BeamlinePVConstants.cuh + cd build + make -j 8 >& /tmp/WTF + ./Allen -f ~/Data/BsPhiPhi/ -c 1 -m 3000 >& $outloc\/PV-$par-$val-scan.stdout + cp ../output/GPU_PVChecker.root $outloc\/PVChk-PV-$par-$val-scan.root + ./Allen -f /data/gligorov/minbias -c 0 -n 10000 -t 3 -r 1 -m 4000 >& $outloc\/PV-$par-$val-tptscan.stdout + cd .. + cp bkpfile.bkp cuda/PV/beamlinePV/include/BeamlinePVConstants.cuh + done +done + +for par in 'minTracksInSeed' +do + for val in '1.5' '2.0' '2.5' '3.0' '3.5' + do + echo 'Scanning PV parameters' $par $val + sed -i s/$par\ =\ \[^\;\]\*\;/$par\ =\ $val\f\;/g cuda/PV/beamlinePV/include/BeamlinePVConstants.cuh + cd build + make -j 8 >& /tmp/WTF + ./Allen -f ~/Data/BsPhiPhi/ -c 1 -m 3000 >& $outloc\/PV-$par-$val-scan.stdout + cp ../output/GPU_PVChecker.root $outloc\/PVChk-PV-$par-$val-scan.root + ./Allen -f /data/gligorov/minbias -c 0 -n 10000 -t 3 -r 1 -m 4000 >& $outloc\/PV-$par-$val-tptscan.stdout + cd .. + cp bkpfile.bkp cuda/PV/beamlinePV/include/BeamlinePVConstants.cuh + done +done + +cp bkpfile.bkp cuda/PV/beamlinePV/include/BeamlinePVConstants.cuh +rm bkpfile.bkp diff --git a/checker/perfscans/PerfScan_SciFi.sh b/checker/perfscans/PerfScan_SciFi.sh new file mode 100644 index 0000000000000000000000000000000000000000..ab6b56ba964b872e83277f4aeec2d84241e6753c --- /dev/null +++ b/checker/perfscans/PerfScan_SciFi.sh @@ -0,0 +1,96 @@ +outloc=../output/perfscans +cd ../.. +cp cuda/SciFi/PrForward/include/PrForwardConstants.cuh bkpfile.bkp + +for par in 'minPt' +do + for val in '200' '300' '400' '500' '600' + do + echo 'Scanning SciFi parameters' $par $val + sed -i s/$par\ =\ \[^\;\]\*\;/$par\ =\ $val\;/g cuda/SciFi/PrForward/include/PrForwardConstants.cuh + cd build + make -j 8 >& /tmp/WTF + ./Allen -f /data/gligorov/BsPhiPhi -c 1 -t 1 -r 1 -m 3000 >& $outloc\/SciFi-$par-$val-scan.stdout + cp ../output/PrCheckerPlots.root $outloc\/PrChk-SciFi-$par-$val-scan.root + cp ../output/KalmanIPCheckerOutput.root $outloc\/KFChk-SciFi-$par-$val-scan.root + ./Allen -f /data/gligorov/minbias -c 0 -n 10000 -t 3 -r 1 -m 4000 >& $outloc\/SciFi-$par-$val-tptscan.stdout + cd .. + cp bkpfile.bkp cuda/SciFi/PrForward/include/PrForwardConstants.cuh + done +done + +for par in 'tolYCollectX' +do + for val in '1.5' '2.5' '3.5' '4.5' '5.5' + do + echo 'Scanning SciFi parameters' $par $val + sed -i s/$par\ =\ \[^\;\]\*\;/$par\ =\ $val\;/g cuda/SciFi/PrForward/include/PrForwardConstants.cuh + cd build + make -j 8 >& /tmp/WTF + ./Allen -f /data/gligorov/BsPhiPhi -c 1 -t 1 -r 1 -m 3000 >& $outloc\/SciFi-$par-$val-scan.stdout + cp ../output/PrCheckerPlots.root $outloc\/PrChk-SciFi-$par-$val-scan.root + cp ../output/KalmanIPCheckerOutput.root $outloc\/KFChk-SciFi-$par-$val-scan.root + ./Allen -f /data/gligorov/minbias -c 0 -n 10000 -t 3 -r 1 -m 4000 >& $outloc\/SciFi-$par-$val-tptscan.stdout + cd .. + cp bkpfile.bkp cuda/SciFi/PrForward/include/PrForwardConstants.cuh + done +done + +cp bkpfile.bkp cuda/SciFi/PrForward/include/PrForwardConstants.cuh +rm bkpfile.bkp + +cp cuda/SciFi/looking_forward/common/include/LookingForwardConstants.cuh bkpfile.bkp + +for par in 'maximum_number_of_candidates_per_ut_track' +do + for val in '32' '48' '64' '80' '96' '112' '128' + do + echo 'Scanning SciFi parameters' $par $val + sed -i s/$par\ =\ \[^\;\]\*\;/$par\ =\ $val\;/g cuda/SciFi/looking_forward/common/include/LookingForwardConstants.cuh + cd build + make -j 8 >& /tmp/WTF + ./Allen -f /data/gligorov/BsPhiPhi -c 1 -t 1 -r 1 -m 3000 >& $outloc\/SciFi-$par-$val-scan.stdout + cp ../output/PrCheckerPlots.root $outloc\/PrChk-SciFi-$par-$val-scan.root + cp ../output/KalmanIPCheckerOutput.root $outloc\/KFChk-SciFi-$par-$val-scan.root + ./Allen -f /data/gligorov/minbias -c 0 -n 10000 -t 3 -r 1 -m 4000 >& $outloc\/SciFi-$par-$val-tptscan.stdout + cd .. + cp bkpfile.bkp cuda/SciFi/looking_forward/common/include/LookingForwardConstants.cuh + done +done + +for par in 'maximum_number_of_candidates_per_ut_track_after_x_filter' +do + for val in '2' '3' '4' + do + echo 'Scanning SciFi parameters' $par $val + sed -i s/$par\ =\ \[^\;\]\*\;/$par\ =\ $val\;/g cuda/SciFi/looking_forward/common/include/LookingForwardConstants.cuh + cd build + make -j 8 >& /tmp/WTF + ./Allen -f /data/gligorov/BsPhiPhi -c 1 -t 1 -r 1 -m 3000 >& $outloc\/SciFi-$par-$val-scan.stdout + cp ../output/PrCheckerPlots.root $outloc\/PrChk-SciFi-$par-$val-scan.root + cp ../output/KalmanIPCheckerOutput.root $outloc\/KFChk-SciFi-$par-$val-scan.root + ./Allen -f /data/gligorov/minbias -c 0 -n 10000 -t 3 -r 1 -m 4000 >& $outloc\/SciFi-$par-$val-tptscan.stdout + cd .. + cp bkpfile.bkp cuda/SciFi/looking_forward/common/include/LookingForwardConstants.cuh + done +done + +for par in 'track_min_quality' +do + for val in '0.05' '0.075' '0.10' '0.125' '0.15' + do + echo 'Scanning SciFi parameters' $par $val + sed -i s/$par\ =\ \[^\;\]\*\;/$par\ =\ $val\f\;/g cuda/SciFi/looking_forward/common/include/LookingForwardConstants.cuh + cd build + make -j 8 >& /tmp/WTF + ./Allen -f /data/gligorov/BsPhiPhi -c 1 -t 1 -r 1 -m 3000 >& $outloc\/SciFi-$par-$val-scan.stdout + cp ../output/PrCheckerPlots.root $outloc\/PrChk-SciFi-$par-$val-scan.root + cp ../output/KalmanIPCheckerOutput.root $outloc\/KFChk-SciFi-$par-$val-scan.root + ./Allen -f /data/gligorov/minbias -c 0 -n 10000 -t 3 -r 1 -m 4000 >& $outloc\/SciFi-$par-$val-tptscan.stdout + cd .. + cp bkpfile.bkp cuda/SciFi/looking_forward/common/include/LookingForwardConstants.cuh + done +done + +cp bkpfile.bkp cuda/SciFi/looking_forward/common/include/LookingForwardConstants.cuh +rm bkpfile.bkp diff --git a/checker/perfscans/PerfScan_VELO.sh b/checker/perfscans/PerfScan_VELO.sh new file mode 100644 index 0000000000000000000000000000000000000000..338759e58f509e7d0386ea44aeab1d3159d61831 --- /dev/null +++ b/checker/perfscans/PerfScan_VELO.sh @@ -0,0 +1,60 @@ +outloc=../output/perfscans +cd ../.. +cp cuda/velo/common/include/VeloDefinitions.cuh bkpfile.bkp + +for par in 'max_scatter_seeding' 'max_scatter_forwarding' +do + for val in '0.05' '0.10' '0.20' '0.40' '0.60' '0.80' '0.90' '1.0' + do + echo 'Scanning VELO parameters' $par $val + sed -i s/$par\ =\ \[^\;\]\*\;/$par\ =\ $val\f\;/g cuda/velo/common/include/VeloDefinitions.cuh + cd build + make -j 8 >& /tmp/WTF + ./Allen -f /data/gligorov/BsPhiPhi -c 1 -t 1 -r 1 -m 3000 >& $outloc\/VELO-$par-$val-scan.stdout + cp ../output/PrCheckerPlots.root $outloc\/PrChk-VELO-$par-$val-scan.root + cp ../output/KalmanIPCheckerOutput.root $outloc\/KFChk-VELO-$par-$val-scan.root + cp ../output/GPU_PVChecker.root $outloc\/PVChk-VELO-$par-$val-scan.root + ./Allen -f /data/gligorov/minbias -c 0 -n 10000 -t 3 -r 1 -m 4000 >& $outloc\/VELO-$par-$val-tptscan.stdout + cd .. + cp bkpfile.bkp cuda/velo/common/include/VeloDefinitions.cuh + done +done + +for par in 'phi_extrapolation_base' +do + for val in '0.02' '0.025' '0.030' '0.035' '0.040' + do + echo 'Scanning VELO parameters' $par $val + sed -i s/$par\ =\ \[^\;\]\*\;/$par\ =\ $val\f\;/g cuda/velo/common/include/VeloDefinitions.cuh + cd build + make -j 8 >& /tmp/WTF + ./Allen -f /data/gligorov/BsPhiPhi -c 1 -t 1 -r 1 -m 3000 >& $outloc\/VELO-$par-$val-scan.stdout + cp ../output/PrCheckerPlots.root $outloc\/PrChk-VELO-$par-$val-scan.root + cp ../output/KalmanIPCheckerOutput.root $outloc\/KFChk-VELO-$par-$val-scan.root + cp ../output/GPU_PVChecker.root $outloc\/PVChk-VELO-$par-$val-scan.root + ./Allen -f /data/gligorov/minbias -c 0 -n 10000 -t 3 -r 1 -m 4000 >& $outloc\/VELO-$par-$val-tptscan.stdout + cd .. + cp bkpfile.bkp cuda/velo/common/include/VeloDefinitions.cuh + done +done + +for par in 'phi_extrapolation_coef' +do + for val in '0.0001' '0.00015' '0.0002' '0.00025' '0.0003' + do + echo 'Scanning VELO parameters' $par $val + sed -i s/$par\ =\ \[^\;\]\*\;/$par\ =\ $val\f\;/g cuda/velo/common/include/VeloDefinitions.cuh + cd build + make -j 8 >& /tmp/WTF + ./Allen -f /data/gligorov/BsPhiPhi -c 1 -t 1 -r 1 -m 3000 >& $outloc\/VELO-$par-$val-scan.stdout + cp ../output/PrCheckerPlots.root $outloc\/PrChk-VELO-$par-$val-scan.root + cp ../output/KalmanIPCheckerOutput.root $outloc\/KFChk-VELO-$par-$val-scan.root + cp ../output/GPU_PVChecker.root $outloc\/PVChk-VELO-$par-$val-scan.root + ./Allen -f /data/gligorov/minbias -c 0 -n 10000 -t 3 -r 1 -m 4000 >& $outloc\/VELO-$par-$val-tptscan.stdout + cd .. + cp bkpfile.bkp cuda/velo/common/include/VeloDefinitions.cuh + done +done + +cp bkpfile.bkp cuda/velo/common/include/VeloDefinitions.cuh +rm bkpfile.bkp diff --git a/checker/perfscans/makePlots.py b/checker/perfscans/makePlots.py new file mode 100644 index 0000000000000000000000000000000000000000..11ad5ccfc72744fcedbefd2b29825e0d4989e1c6 --- /dev/null +++ b/checker/perfscans/makePlots.py @@ -0,0 +1,202 @@ +import os,sys,fnmatch +import ROOT +from ROOT import * + +scans = { "VELO" : { + "max_scatter_seeding" : [], + "max_scatter_forwarding" : [], + "phi_extrapolation_base" : [], + "phi_extrapolation_coef" : [] + }, + "PV" : { + "zmin" : [], + "zmax" : [], + "maxChi2" : [], + "minTracksInSeed" : [] + }, + "CompassUT" : { + "max_considered_before_found" : [], + "minPT" : [], + "minPTFinal" : [], + "minMomentum" : [], + "minMomentumFinal" : [], + "yTol" : [] + }, + "SciFi" : { + "maximum_number_of_candidates_per_ut_track" : [], + "maximum_number_of_candidates_per_ut_track_after_x_filter" : [], + "track_min_quality" : [] + } + } + +physperfsuffix = "scan.stdout" +throughputsuffix = "tptscan.stdout" + +resultsdir = "../../output/perfscans/" + +# Get what parameter values we scaned over without having to hardcode it +files = os.listdir(resultsdir) +for thisscan in scans : + for var in scans[thisscan] : + pattern = thisscan+'-'+var+'-*-'+physperfsuffix + for entry in files: + if fnmatch.fnmatch(entry, pattern): + scans[thisscan][var].append(entry.lstrip(thisscan).lstrip('-').lstrip(var)[1:].rstrip('-'+physperfsuffix)) + scans[thisscan][var].sort() + +# What are we actually going to plot? +scanstoplot = ["VELO","PV","CompassUT","SciFi"] + +tpthistos = {} +# Throughput plots are one number so do them first +canvtoploton = TCanvas("tptcanv","tptcanv",1000,800) +for thisscan in scanstoplot : + tpthistos[thisscan] = {} + for var in scans[thisscan] : + tpthistos[thisscan][var] = TH1F(thisscan+var+"tphist", + thisscan+var+"tphist", + 100, + float(scans[thisscan][var][0])/1.1, + float(scans[thisscan][var][-1])*1.1) + tpthistos[thisscan][var].SetMarkerStyle(20) + tpthistos[thisscan][var].SetMarkerSize(1.6) + tpthistos[thisscan][var].GetYaxis().SetTitle("Throughput on V100 (kHz)") + tpthistos[thisscan][var].GetYaxis().SetTitleOffset(0.9) + tpthistos[thisscan][var].GetXaxis().SetTitle(var) + tpthistos[thisscan][var].GetXaxis().SetTitleSize(0.05) + tpthistos[thisscan][var].GetXaxis().SetTitleOffset(1.1) + for scanpoint in scans[thisscan][var] : + thistpfile = open(resultsdir+thisscan+'-'+var+'-'+scanpoint+'-'+throughputsuffix) + for line in thistpfile : + if line.find('events/s') > -1 : + tpthistos[thisscan][var].Fill(float(scanpoint),float(line.split()[0])) + + for thisbin in range(100): + tpthistos[thisscan][var].SetBinError(thisbin,0) + canvtoploton.cd() + tpthistos[thisscan][var].Draw("P") + tpthistos[thisscan][var].GetYaxis().SetRangeUser(0,100000) + canvtoploton.SaveAs(resultsdir+thisscan+'-'+var+'-tptscan.pdf') + +physperfhistos = {} +# The physics performance histos are a bit more complex to define +physperftoplot = { + "VELO" : { "end" : "Checking GPU beamline PVs", + "cats" : ["ghosts", + "Not electron long eta25 p<5GeV", + "Not electron long eta25 p>5GeV", + "Not electron long strange eta25 p<5GeV", + "Not electron long strange eta25 p>5GeV", + "Electrons long eta25 p<5GeV", + "Electrons long eta25 p>5GeV", + "Electrons long strange eta25 p<5GeV", + "Electrons long strange eta25 p>5GeV"] + }, + "PV" : { "end" : "Checking Velo+UT tracks", + "cats" : ["All","Isolated","Close","False"] + }, + "CompassUT" : { "end" : "Checking SciFi tracks", + "cats" : ["ghosts", + "Velo+UT, not long, p > 5 GeV", + "Long, p > 5 GeV", + "Long from B, p > 5 GeV", + "Long from B electrons, p > 5 GeV", + "Long from B, p > 3 GeV, pt > 0.5 GeV"] + }, + "SciFi" : { "end" : "Producing Kalman plots", + "cats" : ["ghosts", + "Long, p > 5 GeV", + "Long strange, p > 5 GeV", + "Long from B, p > 5 GeV", + "Long electrons from B, p > 5 GeV", + "Long from B, p > 3 GeV, pt > 0.5 GeV"] + + } + } +ordertoread = ["VELO","PV","CompassUT","SciFi"] +# First a loop to set up all the histos +for thisscan in scanstoplot : + physperfhistos[thisscan] = {} + for var in scans[thisscan] : + physperfhistos[thisscan][var] = {} + for ppgroup in ordertoread : + for ppcat in physperftoplot[ppgroup]["cats"] : + physperfhistos[thisscan][var][ppgroup+ppcat] = TH1F(thisscan+var+ppgroup+ppcat+"pphist", + thisscan+var+ppgroup+ppcat+"pphist", + 100, + float(scans[thisscan][var][0])/1.05, + float(scans[thisscan][var][-1])*1.05) + physperfhistos[thisscan][var][ppgroup+ppcat].SetMarkerStyle(24) + physperfhistos[thisscan][var][ppgroup+ppcat].SetMarkerSize(1.6) + physperfhistos[thisscan][var][ppgroup+ppcat].GetYaxis().SetTitle("Efficiency (%)") + physperfhistos[thisscan][var][ppgroup+ppcat].GetYaxis().SetTitleOffset(0.9) + physperfhistos[thisscan][var][ppgroup+ppcat].GetXaxis().SetTitle(var) + physperfhistos[thisscan][var][ppgroup+ppcat].GetXaxis().SetTitleSize(0.05) + physperfhistos[thisscan][var][ppgroup+ppcat].GetXaxis().SetTitleOffset(1.1) + +#Now a loop to fill them +for thisscan in scanstoplot : + for var in scans[thisscan] : + for scanpoint in scans[thisscan][var] : + thisppfile = open(resultsdir+thisscan+'-'+var+'-'+scanpoint+'-'+physperfsuffix) + for ppgroup in ordertoread : + for line in thisppfile : + if line.find(physperftoplot[ppgroup]['end']) > -1 : + break + for ppcat in physperftoplot[ppgroup]["cats"] : + effval = 0. + if line.find(ppcat) > -1 : + if ppcat == "ghosts" : + if line.find('TrackChecker output') == -1 : + continue + if ppgroup == "PV" : + effval = 100.*float(line.split(":")[1].split('(')[0]) + else : + if ppcat == "ghosts" : + effval = float(line.split(':')[1].split()[2].rstrip('%')) + else : + effval = float(line.split(':')[1].split('(')[0].split()[2].rstrip('%')) + physperfhistos[thisscan][var][ppgroup+ppcat].Fill(float(scanpoint),effval) + +# Set errors to 0 +for thisscan in scanstoplot : + for var in scans[thisscan] : + for ppgroup in ordertoread : + for ppcat in physperftoplot[ppgroup]["cats"] : + for thisbin in range(100): + physperfhistos[thisscan][var][ppgroup+ppcat].SetBinError(thisbin,0) + +# Now plot them +canvtoploton = TCanvas("ppcanv","ppcanv",1000,800) +legcanv = TCanvas("legcanv","legcanv",1000,800) +legend = TLegend(0.1,0.1,0.9,0.9) +legend.SetMargin(0.1) +legendpv = TLegend(0.35,0.25,0.65,0.75) +legendpv.SetMargin(0.2) +for thisscan in scanstoplot : + for var in scans[thisscan] : + for ppgroup in ordertoread : + legend.Clear() + firstcat = True + canvtoploton.cd() + for col,ppcat in enumerate(physperftoplot[ppgroup]["cats"]) : + physperfhistos[thisscan][var][ppgroup+ppcat].SetLineColor(col+1) + physperfhistos[thisscan][var][ppgroup+ppcat].SetMarkerColor(col+1) + physperfhistos[thisscan][var][ppgroup+ppcat].SetMarkerStyle(26-col) + if firstcat : + physperfhistos[thisscan][var][ppgroup+ppcat].Draw("P") + physperfhistos[thisscan][var][ppgroup+ppcat].GetYaxis().SetRangeUser(0,100) + firstcat = False + else : + physperfhistos[thisscan][var][ppgroup+ppcat].Draw("PSAME") + if ppgroup == "PV" : + legendpv.AddEntry(physperfhistos[thisscan][var][ppgroup+ppcat],ppcat,"p") + else : + legend.AddEntry(physperfhistos[thisscan][var][ppgroup+ppcat],ppcat,"p") + canvtoploton.SaveAs(resultsdir+thisscan+'-'+var+'-'+ppgroup+'-ppscan.pdf') + legcanv.cd() + if ppgroup == "PV" : + legendpv.Draw() + else : + legend.Draw() + legcanv.SaveAs(resultsdir+thisscan+'-'+var+'-'+ppgroup+'-legend.pdf')