Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions FirstAnalysis/kinematic2D_run5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env python
from ROOT import TCanvas, TFile, gPad, gStyle

gStyle.SetOptStat(0)
gStyle.SetErrorX(0)
gStyle.SetFrameLineWidth(1)
gStyle.SetTitleSize(0.045, "x")
gStyle.SetTitleSize(0.045, "y")
gStyle.SetMarkerSize(1)
gStyle.SetLabelOffset(0.015, "x")
gStyle.SetLabelOffset(0.02, "y")
gStyle.SetTickLength(-0.02, "x")
gStyle.SetTickLength(-0.02, "y")
gStyle.SetTitleOffset(1.1, "x")
gStyle.SetTitleOffset(1.0, "y")


def saveCanvas(canvas, title):
format_list = ["png", ".pdf", ".root"]
for fileFormat in format_list:
canvas.SaveAs(title + fileFormat)


def kinematic_plots(var1):
fileo2 = TFile("../codeHF/AnalysisResults_O2.root")
cres = TCanvas("cres", "resolution distribution")
cres.SetCanvasSize(1600, 1200)
cres.Divide(1, 3)
sig = fileo2.Get("hf-task-jpsi-mc/h%sSig" % var1)
bkg = fileo2.Get("hf-task-jpsi-mc/h%sBg" % var1)
gen = fileo2.Get("hf-task-jpsi-mc/h%sGen" % var1)
cres.cd(1)
gPad.SetLogz()
sig.Draw("coltz")
sig.SetTitle("%s Signal distribution(Rec. Level)" % var1)
cres.cd(2)
gPad.SetLogz()
bkg.Draw("coltz")
bkg.SetTitle("%s Background distribution(Rec. Level)" % var1)
cres.cd(3)
gPad.SetLogz()
gen.Draw("coltz")
gen.SetTitle("%s Gen distribution(Gen. Level)" % var1)
saveCanvas(cres, "%s" % var1)
ceff = TCanvas("ceff", "2D efficiencies")
ceff.SetCanvasSize(1600, 1200)
ceff.cd()
eff = sig.Clone("eff")
den = gen.Clone("den")
eff.Divide(den)
eff.Draw("COLZ")
eff.SetTitle("%s Jpsi reco and sel. efficiency (Reco pt / Gen pt)" % var1)
saveCanvas(ceff, "efficiencyYpt")


var_list = ["Y"]

for var in var_list:
kinematic_plots(var)
136 changes: 136 additions & 0 deletions FirstAnalysis/plotsinglevar.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
#!/usr/bin/env python
import os

from ROOT import TF1, TH2F, TCanvas, TFile, TLatex, gROOT, gStyle


def makeSavePaths(title, *fileFormats, outputdir="outputPlots"):
"""
Saves the canvas as the desired output format in an output directory (default = outputPlots)
"""
if not os.path.exists(outputdir):
os.makedirs(outputdir)
return [outputdir + "/" + title + fileFormat for fileFormat in fileFormats]


def plotsinglevar(
mode="MM",
filename="../codeHF/AnalysisResults_O2.root",
dirname="hf-task-xicc-mc",
latex="Xi_{cc}",
iptBin=2,
histonmasssig="hPtRecGenDiff", # hPtRecGenDiff hXSecVtxPosDiff
xmin=-2.0,
xmax=2.0,
ymin=0.1,
ymax=1.0e6,
rebin=4,
logx=1,
logy=1,
xminfit=-2.0,
xmaxfit=2.0,
title="",
xaxis="Xi_{cc} X vertex reco - gen (cm)",
dofit=0,
):
gStyle.SetOptStat(0)
gROOT.SetBatch(1)

fileSig = TFile(filename)
histo2d = fileSig.Get("%s/%s" % (dirname, histonmasssig))
hvar = histo2d.ProjectionX("hvar", iptBin + 1, iptBin + 1)
hvar.GetXaxis().SetRangeUser(xmin, xmax)
hvar.Draw()
ptMin = histo2d.GetYaxis().GetBinLowEdge(iptBin + 1)
ptMax = ptMin + histo2d.GetYaxis().GetBinWidth(iptBin + 1)
# ymax = hvar.GetMaximum() * 10
# ymin = hvar.GetMinimum()
hempty = TH2F("hempty", ";%s; Entries" % xaxis, 100, xmin, xmax, 100, ymin, ymax)
hempty.GetXaxis().SetLabelFont(42)
hempty.GetXaxis().SetTitleOffset(1)
hempty.GetXaxis().SetLabelSize(0.03)
hempty.GetXaxis().SetTitleFont(42)
hempty.GetYaxis().SetLabelFont(42)
hempty.GetYaxis().SetTitleOffset(1.35)
hempty.GetYaxis().SetTitleFont(42)
hempty.GetZaxis().SetLabelFont(42)
hempty.GetZaxis().SetTitleOffset(1)
hempty.GetZaxis().SetTitleFont(42)

canvas = TCanvas("canvas", "A Simple Graph Example", 881, 176, 668, 616)
gStyle.SetOptStat(0)
canvas.SetHighLightColor(2)
canvas.Range(-1.25, -4.625, 11.25, 11.625)
canvas.SetFillColor(0)
canvas.SetBorderMode(0)
canvas.SetBorderSize(2)
canvas.SetFrameBorderMode(0)
canvas.SetFrameBorderMode(0)
if logx == 1:
canvas.SetLogx()
if logy == 1:
canvas.SetLogy()
canvas.cd()
hempty.Draw("")
hvar.Draw("PEsame")
latexa = TLatex()
latexa.SetTextSize(0.04)
latexa.SetTextFont(42)
latexa.SetTextAlign(3)
xave = xmin + (xmax - xmin) / 4.0
latexa.DrawLatex(
xave, ymax * 0.2, "%.1f < p_{T} (%s) < %.1f GeV" % (ptMin, latex, ptMax)
)
if dofit:
f = TF1("f", "gaus")
hvar.Fit("f", "R", "", xminfit, xmaxfit)
latexb = TLatex()
latexb.SetTextSize(0.04)
latexb.SetTextFont(42)
latexb.SetTextAlign(3)
mean = f.GetParameter(1)
sigma = f.GetParameter(2)
latexb.DrawLatex(xave, ymax * 0.35, "#mu = %.5f, #sigma = %.5f" % (mean, sigma))
canvas.SaveAs("%s%s.pdf" % (histonmasssig, mode))


plotsinglevar(
"MuMu",
"../codeHF/AnalysisResults_O2.root",
"hf-task-x",
"J/#psi",
5,
"hMass",
2.7,
4.2,
0.1,
5e3,
4,
0,
1,
2.0,
4.0,
"",
"Xi_{cc} reco - gen p_{T}",
0,
)
plotsinglevar(
"EE",
"../codeHF/AnalysisResults_O2_EE.root",
"hf-task-jpsi-mc",
"J/#psi",
2,
"hmassBg",
2.7,
3.4,
0.1,
5e3,
4,
0,
1,
2.0,
4.0,
"",
"Xi_{cc} reco - gen p_{T}",
0,
)
4 changes: 2 additions & 2 deletions codeHF/PlotEfficiency.C
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ Int_t PlotEfficiency(TString pathFile = "AnalysisResults.root", TString particle
// efficiency
auto padR = canEff->cd();
TH1F* hEff = (TH1F*)hPtRec->Clone("hEff");
hEff->Divide(hPtGen);
hEff->Divide(hEff, hPtGen, 1., 1., "B");
hEff->SetTitle(Form("Entries ratio: %g;#it{p}_{T} (GeV/#it{c});efficiency", (double)nRec / (double)nGen));
yMin = hEff->GetMinimum(0);
yMax = hEff->GetMaximum();
SetHistogram(hEff, yMin, yMax, marginRLow, marginRHigh, logScaleR);
SetPad(padR, logScaleR);
hEff->Draw();
hEff->Draw("PE");

canPt->SaveAs(Form("MC_%s_pT.pdf", particle.Data()));
canEff->SaveAs(Form("MC_%s_eff.pdf", particle.Data()));
Expand Down
4 changes: 2 additions & 2 deletions codeHF/config_tasks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ DOO2_TASK_LC=0 # hf-task-lc
DOO2_TASK_XIC=0 # hf-task-xic
DOO2_TASK_JPSI=1 # hf-task-jpsi
DOO2_TASK_BPLUS=0 # hf-task-bplus
DOO2_TASK_X=1 # hf-task-x
DOO2_TASK_X=0 # hf-task-x
# Tree creators
DOO2_TREE_D0=0 # hf-tree-creator-d0-tokpi
DOO2_TREE_LC=0 # hf-tree-creator-lc-topkpi
Expand All @@ -66,7 +66,7 @@ APPLYCUTS_DPLUS=0 # Apply D+ selection cuts.
APPLYCUTS_LC=0 # Apply Λc selection cuts.
APPLYCUTS_XIC=0 # Apply Ξc selection cuts.
APPLYCUTS_JPSI=1 # Apply J/ψ selection cuts.
APPLYCUTS_X=1 # Apply X selection cuts.
APPLYCUTS_X=0 # Apply X selection cuts.

SAVETREES=0 # Save O2 tables to trees.
USEO2VERTEXER=0 # Use the O2 vertexer in AliPhysics.
Expand Down
13 changes: 11 additions & 2 deletions codeHF/dpl-config_run5_oniaX.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@
"mInvMassJpsiToEEMax": "4.1",
"mCPAJpsiToEEMin": "-2.",
"mImpParProductJpsiToEEMax": "1000.00",
"mPtJpsiToMuMuMin": "0",
"mInvMassJpsiToMuMuMin": "2.5",
"mInvMassJpsiToMuMuMax": "4.0",
"mCPAJpsiToMuMuMin": "-2",
"mImpParProductJpsiToMuMuMax": "1000",
"mPtDPlusToPiKPiMin": "2.",
"mInvMassDPlusToPiKPiMin": "1.67",
"mInvMassDPlusToPiKPiMax": "2.07",
Expand Down Expand Up @@ -256,11 +261,13 @@
"d_pidTPCMaxpT": "2000.",
"d_pidTOFMinpT": "0.15",
"d_pidTOFMaxpT": "1.",
"d_nSigmaTOFCombined": "0.",
"d_pidRICHMinpT": "0.5",
"d_pidRICHMaxpT": "15.",
"d_nSigmaRICHCombinedTOF": "0.",
"d_TPCNClsFindablePIDCut": "-9999",
"d_nSigmaTPC": "1000.",
"d_nSigmaTOF": "2.",
"d_nSigmaTOF": "3.",
"d_nSigmaRICH": "3.",
"pTBins": {
"values": [
Expand Down Expand Up @@ -410,6 +417,7 @@
"hf-task-jpsi": {
"cutYCandMax": "1.44",
"d_selectionFlagJpsi": "0",
"d_modeJpsiToMuMu": false,
"pTBins": {
"values": [
"0",
Expand All @@ -427,7 +435,8 @@
},
"hf-task-jpsi-mc": {
"cutYCandMax": "1.44",
"d_selectionFlagJpsi": "0"
"d_selectionFlagJpsi": "0",
"d_modeJpsiToMuMu": false
},
"hf-candidate-creator-x": {
"cutYCandMax": "1.44",
Expand Down