Skip to content

Commit

Permalink
updating plots
Browse files Browse the repository at this point in the history
  • Loading branch information
cippy committed Feb 21, 2020
1 parent 62923d2 commit 30d4857
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 30 deletions.
12 changes: 9 additions & 3 deletions submit/AfterCalibTools/PlotMaker/compareDistributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ def createPlotDirAndCopyPhp(outdir):
# if bc < miny: miny = bc
maxy = max(maxy,histos[n].GetBinContent(histos[n].GetMaximumBin()))

leg = ROOT.TLegend(0.6,0.6,0.9,0.9)
leg = ROOT.TLegend(0.7,0.66,0.9,0.9)
leg.SetFillColor(0)
#leg.SetFillStyle(0)
#leg.SetBorderSize(0)
leg.SetHeader(legTitles[jdet])
#leg.SetHeader(legTitles[jdet])
for i,y in enumerate(years):
n = dirs[y]
if i == 0:
Expand All @@ -138,12 +138,18 @@ def createPlotDirAndCopyPhp(outdir):

canvas.RedrawAxis("sameaxis")

latDet = ROOT.TLatex()
latDet.SetNDC();
latDet.SetTextFont(42)
latDet.SetTextSize(0.05)
latDet.DrawLatex(0.2,0.85, legTitles[jdet])

latCMS = ROOT.TLatex()
latCMS.SetNDC();
latCMS.SetTextFont(42)
latCMS.SetTextSize(0.04)
latCMS.DrawLatex(leftmargin, 0.95, '#bf{CMS} #it{Preliminary}')
latCMS.DrawLatex(0.82, 0.95, '(%s TeV)' % str(options.energy))
latCMS.DrawLatex(0.83, 0.95, '(%s TeV)' % str(options.energy))

cname = hname + "_comparisonRun2_region" + detId + ("_pi0" if isPi0 else "_eta0")
for ext in [".png", ".pdf"]:
Expand Down
38 changes: 30 additions & 8 deletions submit/AfterCalibTools/PlotMaker/comparePlotsVsEta.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def createPlotDirAndCopyPhp(outdir):
quit()

for detId in detIds:

print ""
print "-"*30
print detId
Expand All @@ -75,14 +74,26 @@ def createPlotDirAndCopyPhp(outdir):
tf = ROOT.TFile.Open(files[i])
h = tf.Get(hname)
h.SetDirectory(0)
histos[n] = h.Clone(n)
# for EB, remove 2 empty bin in the middle at eta = 0, was an artifact of ieta = 0, which does not exist
# so there are two bins from -0.017 to 0 and to +0.017
if detId == "EB":
histos[n] = ROOT.TH1D(n,"",h.GetNbinsX()-2,
h.GetXaxis().GetBinLowEdge(1),
h.GetXaxis().GetBinLowEdge(h.GetNbinsX()+1))
for ib in range(1,histos[n].GetNbinsX()+1):
hbin = ib + (2 if ib > histos[n].GetNbinsX()/2 else 0)
histos[n].SetBinContent(ib,h.GetBinContent(hbin))
histos[n].SetBinContent(ib,h.GetBinContent(hbin))
else:
histos[n] = h.Clone(n)
histos[n].SetDirectory(0)
histos[n].SetStats(0)
tf.Close()
print ">>> File: %s" % files[i]

leftmargin = 0.16
rightmargin = 0.06
topmargin = 0.06
topmargin = 0.07
canvas = ROOT.TCanvas("canvas","",1000,800)
canvas.SetTickx(1)
canvas.SetTicky(1)
Expand Down Expand Up @@ -122,26 +133,37 @@ def createPlotDirAndCopyPhp(outdir):
histos[n].Draw("HE")
histos[n].GetYaxis().SetRangeUser(0.9*miny,1.2*maxy)
histos[n].GetYaxis().SetTitle(yaxisTitle)
histos[n].GetYaxis().SetTitleOffset(1.3)
histos[n].GetYaxis().SetTitleSize(0.06)
histos[n].GetYaxis().SetLabelSize(0.05)
histos[n].GetYaxis().SetTitleOffset(1.35)
histos[n].GetXaxis().SetTitleSize(0.06)
histos[n].GetXaxis().SetLabelSize(0.05)
histos[n].GetXaxis().SetTitleOffset(0.95)
if detId == "EB":
histos[n].GetXaxis().SetTitle("#eta")
else:
histos[n].GetXaxis().SetTitle("#eta-ring number")
histos[n].GetXaxis().SetRangeUser(0,25)
else:
histos[n].Draw("HESAME")
leg.AddEntry(histos[n],y,"LF")
leg.Draw("same")


latDet = ROOT.TLatex()
latDet.SetNDC();
latDet.SetTextFont(42)
latDet.SetTextSize(0.05)
latDet.DrawLatex(0.2,0.85,"ECAL " + detector[detId] )

latCMS = ROOT.TLatex()
latCMS.SetNDC();
latCMS.SetTextFont(42)
latCMS.SetTextSize(0.04)
latCMS.SetTextSize(0.05)
latCMS.DrawLatex(leftmargin, 0.95, '#bf{CMS} #it{Preliminary}')
latCMS.DrawLatex(0.82, 0.95, '(%s TeV)' % str(options.energy))
latCMS.DrawLatex(0.8, 0.95, '(%s TeV)' % str(options.energy))

cname = hname + "_comparisonRun2_" + detId + ("_pi0" if isPi0 else "_eta0")
for ext in [".png", ".pdf"]:
for ext in [".png", ".pdf", ".C", ".root"]:
canvas.SaveAs(outname + cname + ext)

print "-"*30
Expand Down
41 changes: 29 additions & 12 deletions submit/AfterCalibTools/streamStudy/comparePeak.C
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,16 @@ void realComparePeak(const string& outdir = "/afs/cern.ch/user/m/mciprian/www/pi

string subdet = isEB ? "Barrel" : "Endcap";
string detector = Form("ECAL %s", subdet.c_str());
Double_t eta = isEB ? -0.03 : 1.83;
Double_t eta = isEB ? 0.10 : 1.83;
Double_t sigmaOverM_2016 = 0.0;
Double_t sigmaOverM_2017 = 0.0;
Double_t sigmaOverM_2018 = 0.0;

string id1 = isEB ? "30003" : "8155";
string id2 = isEB ? "30003" : "8155";
string id3 = isEB ? "30003" : "8155";

// EB: 30003, eta = -0.03
// EB: 32429, eta = 0.10
string id1 = isEB ? "32429" : "8155";
string id2 = isEB ? "32429" : "8155";
string id3 = isEB ? "32429" : "8155";

string input1 = "";
string input2 = "";
Expand All @@ -125,19 +127,29 @@ void realComparePeak(const string& outdir = "/afs/cern.ch/user/m/mciprian/www/pi
input2 = Form("/afs/cern.ch/user/m/mciprian/www/pi0calib/plot_approve_full2017data_Pi0_legacyReRecoCalib/AlCaP0_AllRun2017_condor_fixEBm16/iter_0/fitResPlots/%s/pi0Mass_singleXtal_index_%s_Rooplot.root",subdet.c_str(), id2.c_str());
input3 = Form("/afs/cern.ch/user/m/mciprian/www/pi0calib/plot_approve_UL2018data/AlCaP0_2018_ULrereco_1every2/iter_0/fitResPlots/%s/pi0Mass_singleXtal_index_%s_Rooplot.root",subdet.c_str(), id2.c_str());

// 30003
sigmaOverM_2016 = isEB ? 8.74 : 8.64;
sigmaOverM_2017 = isEB ? 10.5 : 9.25;
sigmaOverM_2018 = isEB ? 10.97 : 8.91;
// 32429
sigmaOverM_2016 = isEB ? 7.72 : 8.64;
sigmaOverM_2017 = isEB ? 9.20 : 9.25;
sigmaOverM_2018 = isEB ? 9.85 : 8.91;

} else {

input1 = Form("/afs/cern.ch/user/m/mciprian/www/pi0calib/plot_approve_UL2016data_Eta/AlCaEta_2016_ULrereco/iter_0/fitResPlots/%s/etaMass_singleXtal_index_%s_Rooplot.root",subdet.c_str(), id1.c_str());
input2 = Form("/afs/cern.ch/user/m/mciprian/www/pi0calib/plot_approve_UL2017data_Eta/AlCaEta_2017_ULrereco_all2017data/iter_0/fitResPlots/%s/etaMass_singleXtal_index_%s_Rooplot.root",subdet.c_str(), id2.c_str());
input3 = Form("/afs/cern.ch/user/m/mciprian/www/pi0calib/plot_approve_UL2018data_Eta/AlCaEta_2018_ULrereco_all2018data/iter_0/fitResPlots/%s/etaMass_singleXtal_index_%s_Rooplot.root",subdet.c_str(), id2.c_str());

// 30003
sigmaOverM_2016 = isEB ? 4.15 : 6.34;
sigmaOverM_2017 = isEB ? 4.44 : 6.16;
sigmaOverM_2018 = isEB ? 4.70 : 5.79;
//32429
sigmaOverM_2016 = isEB ? 3.78 : 6.34;
sigmaOverM_2017 = isEB ? 4.07 : 6.16;
sigmaOverM_2018 = isEB ? 4.55 : 5.79;

}

Expand Down Expand Up @@ -365,16 +377,21 @@ void realComparePeak(const string& outdir = "/afs/cern.ch/user/m/mciprian/www/pi
}


void comparePeak(const string& outdir = "/afs/cern.ch/user/m/mciprian/www/pi0calib/massComparison_Run2/")
void comparePeak(const string& outdir = "/afs/cern.ch/user/m/mciprian/www/pi0calib/massComparison_Run2/",
const int do_all0_pi0Only1_etaOnly2 = 1)
{

// pi0
string outdirPi0 = outdir + "pi0/";
realComparePeak(outdirPi0, true);
realComparePeak(outdirPi0, false);
if (do_all0_pi0Only1_etaOnly2 != 2) {
string outdirPi0 = outdir + "pi0/";
realComparePeak(outdirPi0, true);
realComparePeak(outdirPi0, false);
}
// eta
string outdirEta = outdir + "eta/";
realComparePeak(outdirEta, true, false);
realComparePeak(outdirEta, false, false);
if (do_all0_pi0Only1_etaOnly2 != 1) {
string outdirEta = outdir + "eta/";
realComparePeak(outdirEta, true, false);
realComparePeak(outdirEta, false, false);
}

}
14 changes: 7 additions & 7 deletions submit/AfterCalibTools/streamStudy/manageRooPlotFromFile.C
Original file line number Diff line number Diff line change
Expand Up @@ -423,16 +423,16 @@ void printSignificanceInFile(const string& calibMapFile = "",
//===============================================


void manageRooPlotFromFile(const string& dirName = "AlCaEta_2018_ULrereco_all2018data",
const string& outDirName = "plot_approve_UL2018data_Eta",
const bool usePi0 = false,
void manageRooPlotFromFile(const string& dirName = "AlCaP0_2018_ULrereco_1every2",
const string& outDirName = "plot_approve_UL2018data",
const bool usePi0 = true,
//const string& dirName = "AlCaP0_AllRun2017_condor_fixEBm16",
//const string& outDirName = "plot_approve_full2017data_Pi0_legacyReRecoCalib",
//const bool usePi0 = true,
// const string& dirName = "AlCaP0_Run2018D_goldenJson_13_09_2018",
// const string& outDirName = "plot_approve_2018D_pi0",
// const bool usePi0 = true,
const Int_t skip_EB1_EE2 = 0,
const Int_t skip_EB1_EE2 = 2,
const double lumi = 0.0,
const int whichIteration = 0,
const string& subdirTag = "",
Expand All @@ -450,9 +450,9 @@ void manageRooPlotFromFile(const string& dirName = "AlCaEta_2018_ULrereco_all201
if (dirName.find("AlCaP0") != string::npos) isPi0 = true;
if (dirName.find("AlCaEta") != string::npos) isPi0 = false;

int EBxtalIndex = 30003;
string EBfitFileIndex = "15"; // need to find a way to derive it from EBxtalIndex
double etaEB = -0.03; // would be negative but ok
int EBxtalIndex = 32429; //30003;
string EBfitFileIndex = "16";//"15"; // need to find a way to derive it from EBxtalIndex
double etaEB = 0.10;//-0.03; // would be negative but ok
//int EExtalIndex = 12001; //12001;
//string EEfitFileIndex = "6"; //"6"; // need to find a way to derive it from EExtalIndex
//double etaEE = 2.5;
Expand Down

0 comments on commit 30d4857

Please sign in to comment.