Skip to content

Commit

Permalink
Merge pull request cms-sw#153 from kmcdermo/mean_diff_cmssw
Browse files Browse the repository at this point in the history
Validation feature additions: clone of PR cms-sw#143
  • Loading branch information
osschar committed Jul 24, 2018
2 parents 3df4b17 + f9697e9 commit 96832ce
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 20 deletions.
4 changes: 2 additions & 2 deletions plotting/PlotValidation.cpp
Expand Up @@ -346,7 +346,7 @@ void PlotValidation::PlotFRTree()
// plot names and key
const TString histkey = Form("%i_%i_d_%i_%i",j,k,p,o);
const TString histname = "h_"+dvars[p]+"_"+coll[o]+"_"+trks[j]+"_pt"+sptcuts[k];
const TString histtitle = "#Delta"+sdvars[p]+"("+scoll[o]+" "+strks[j]+",CMSSW) [p_{T} > "+sptcuts[k]+" GeV/c];"+dvars[p]+"^{"+scoll[o]+" "+strks[j]+"}-"+dvars[p]+"^{CMSSW};nTracks";
const TString histtitle = "#Delta"+sdvars[p]+"("+scoll[o]+" "+strks[j]+",CMSSW) [p_{T} > "+sptcuts[k]+" GeV/c];"+sdvars[p]+"^{"+scoll[o]+" "+strks[j]+"}-"+sdvars[p]+"^{CMSSW};nTracks";

// Numerator only type plots only!
hists[histkey] = new TH1F(histname.Data(),histtitle.Data(),dvarbins[p].size()-1,bins);
Expand Down Expand Up @@ -853,7 +853,7 @@ void PlotValidation::SetupStyle()
void PlotValidation::SetupBins()
{
// pt bins
PlotValidation::SetupVariableBins("0 0.25 0.5 0.75 1 1.25 1.5 1.75 2 2.5 3 3.5 4 4.5 5 5 6 7 8 9 10 15 20 25 30 40 50",fPtBins);
PlotValidation::SetupVariableBins("0 0.25 0.5 0.75 1 1.25 1.5 1.75 2 2.5 3 3.5 4 4.5 5 5 6 7 8 9 10 15 20 25 30 40 50 100",fPtBins);

// eta bins
PlotValidation::SetupFixedBins(60,-3,3,fEtaBins);
Expand Down
59 changes: 49 additions & 10 deletions plotting/StackValidation.cpp
Expand Up @@ -53,22 +53,36 @@ void StackValidation::MakeRatioStacks(const TString & trk)
canv->cd();

TLegend * leg = new TLegend(0.85,0.80,1.0,1.0);

// tmp axis titles, not sure why ROOT is deleting them
TString xtitle = "";
TString ytitle = "";

std::vector<TGraphAsymmErrors*> graphs(builds.size());
for (UInt_t b = 0; b < builds.size(); b++)
{
graphs[b] = ((TEfficiency*)files[b]->Get(rates[l].dir+"/"+rates[l].rate+"_"+rates[l].sORr+"_"+vars[i]+"_"+trk+"_pt"+Form("%3.1f",ptcuts[k])))->CreateGraph();
graphs[b]->SetLineColor(builds[b].color);
graphs[b]->SetMarkerColor(builds[b].color);
auto & graph = graphs[b];

graph = ((TEfficiency*)files[b]->Get(rates[l].dir+"/"+rates[l].rate+"_"+rates[l].sORr+"_"+vars[i]+"_"+trk+"_pt"+Form("%3.1f",ptcuts[k])))->CreateGraph();
graph->SetLineColor(builds[b].color);
graph->SetMarkerColor(builds[b].color);

graphs[b]->Draw(b>0?"PZ SAME":"APZ");
// store tmp titles
if (b == 0)
{
xtitle = graph->GetXaxis()->GetTitle();
ytitle = graph->GetYaxis()->GetTitle();
}

graph->Draw(b>0?"PZ SAME":"APZ");

if (!rates[l].rate.Contains("ineff",TString::kExact)) graphs[b]->GetYaxis()->SetRangeUser(0.0,1.05);
else graphs[b]->GetYaxis()->SetRangeUser(0.0,0.25);
if (!rates[l].rate.Contains("ineff",TString::kExact)) graph->GetYaxis()->SetRangeUser(0.0,1.05);
else graph->GetYaxis()->SetRangeUser(0.0,0.25);

leg->AddEntry(graphs[b],builds[b].label.Data(),"LEP");
leg->AddEntry(graph,builds[b].label.Data(),"LEP");
}


// print standard plot for every rate/variable
leg->Draw("SAME");
canv->SaveAs(label+"_"+rates[l].rate+"_"+vars[i]+"_"+trk+"_pt"+Form("%3.1f",ptcuts[k])+extra+".png");

Expand All @@ -89,6 +103,30 @@ void StackValidation::MakeRatioStacks(const TString & trk)
for (auto & zoomgraph : zoomgraphs) delete zoomgraph;
}

// make logx plots for pt: causes LOTS of weird effects... workarounds for now
if (i == 0)
{
canv->SetLogx(1);

// apparently logx removes titles and ranges???
for (UInt_t b = 0; b < builds.size(); b++)
{
auto & graph = graphs[b];
graph->GetXaxis()->SetRangeUser(0.01,graph->GetXaxis()->GetBinUpEdge(graph->GetXaxis()->GetNbins()));

if (!rates[l].rate.Contains("ineff",TString::kExact)) graph->GetYaxis()->SetRangeUser(0.0,1.05);
else graph->GetYaxis()->SetRangeUser(0.0,0.25);

graph->GetXaxis()->SetTitle(xtitle);
graph->GetYaxis()->SetTitle(ytitle);

graph->Draw(b>0?"PZ SAME":"APZ");
}

leg->Draw("SAME");
canv->SaveAs(label+"_"+rates[l].rate+"_"+vars[i]+"_logx_"+trk+"_pt"+Form("%3.1f",ptcuts[k])+extra+".png");
}

delete leg;
for (auto & graph : graphs) delete graph;
delete canv;
Expand Down Expand Up @@ -139,9 +177,10 @@ void StackValidation::MakeCMSSWKinematicDiffStacks(const TString & trk)
for (UInt_t b = 0; b < builds.size(); b++)
{
SetMinMaxHist(hists[b],min,max,isLogy);

hists[b]->Draw(b>0?"EP SAME":"EP");
leg->AddEntry(hists[b],builds[b].label.Data(),"LEP");

const TString mean = Form("%4.1f",hists[b]->GetMean());
leg->AddEntry(hists[b],builds[b].label+" "+" [#mu = "+mean+"]","LEP");
}

leg->Draw("SAME");
Expand Down
32 changes: 24 additions & 8 deletions web/collectBenchmarks.sh
Expand Up @@ -59,6 +59,7 @@ done
# Move ROOT validation
rootdir="SIMVAL"
mkdir -p ${dir}/${rootdir}
mkdir -p ${dir}/${rootdir}/logx

for build in BH STD CE FV CMSSW
do
Expand All @@ -68,18 +69,26 @@ done

for rate in eff ineff_brl ineff_trans ineff_ec dr fr
do
for var in pt pt_zoom phi eta
do
for pt in 0.0 0.9 2.0
do
for pt in 0.0 0.9 2.0
do
for var in phi eta
do
mv ${val_arch}_${sample}_${rate}_${var}_"build"_pt${pt}_"SIMVAL".png ${dir}/${rootdir}
done
done

for var in pt pt_zoom
do
mv ${val_arch}_${sample}_${rate}_${var}_"build"_pt"0.0"_"SIMVAL".png ${dir}/${rootdir}
done

mv ${val_arch}_${sample}_${rate}_"pt_logx"_"build"_pt"0.0"_"SIMVAL".png ${dir}/${rootdir}/logx
done

# Move CMSSW validation
cmsswdir="CMSSWVAL"
mkdir -p ${dir}/${cmsswdir}
mkdir -p ${dir}/${cmsswdir}

for build in BH STD CE FV
do
Expand All @@ -89,21 +98,28 @@ done

for trk in build fit
do
mkdir -p ${dir}/${cmsswdir}/${trk}
mkdir -p ${dir}/${cmsswdir}/${trk}/logx
mkdir -p ${dir}/${cmsswdir}/${trk}/diffs
done

for rate in eff ineff_brl ineff_trans ineff_ec dr fr
do
for var in pt pt_zoom phi eta
for trk in build fit
do
for trk in build fit
for pt in 0.0 0.9 2.0
do
for pt in 0.0 0.9 2.0
for var in phi eta
do
mv ${val_arch}_${sample}_${rate}_${var}_${trk}_pt${pt}_"CMSSWVAL".png ${dir}/${cmsswdir}/${trk}
done
done

for var in pt pt_zoom
do
mv ${val_arch}_${sample}_${rate}_${var}_${trk}_pt"0.0"_"CMSSWVAL".png ${dir}/${cmsswdir}/${trk}
done

mv ${val_arch}_${sample}_${rate}_"pt_logx"_${trk}_pt"0.0"_"CMSSWVAL".png ${dir}/${cmsswdir}/${trk}/logx
done
done

Expand Down

0 comments on commit 96832ce

Please sign in to comment.