EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StrangeTagPlots.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file StrangeTagPlots.C
1 #include "TROOT.h"
2 #include "TChain.h"
3 #include "TEfficiency.h"
4 #include "TH1.h"
5 #include "TGraphErrors.h"
6 #include "TCut.h"
7 #include "TCanvas.h"
8 #include "TStyle.h"
9 #include "TLegend.h"
10 #include "TMath.h"
11 #include "TLine.h"
12 #include "TLatex.h"
13 #include "TRatioPlot.h"
14 
15 #include <glob.h>
16 #include <iostream>
17 #include <iomanip>
18 #include <vector>
19 
20 #include "PlotFunctions.h"
21 
22 void StrangeTagPlots(TString dir, TString input, TString xvar, TString filePattern = "*/out.root")
23 {
24  // Global options
25  gStyle->SetOptStat(0);
26 
27  // Create the TCanvas
28  TCanvas* pad = new TCanvas("pad","",800,600);
29  TLegend * legend = nullptr;
30  TH1F* htemplate = nullptr;
31 
32  auto default_data = new TChain("tree");
33  default_data->SetTitle(input.Data());
34  auto files = fileVector(Form("%s/%s/%s", dir.Data(), input.Data(), filePattern.Data()));
35 
36  for (auto file : files)
37  {
38  default_data->Add(file.c_str());
39  }
40 
41 
42  // Setup plot configurations
43  TString common_title = "NC-DIS, 10GeVx275GeV, Q^{2}>100 GeV^{2}";
44 
45  plot_config strangejets;
46  strangejets.markerstyle = kFourSquaresX;
47  strangejets.markercolor = kGreen+3;
48  strangejets.linestyle = kSolid;
49  strangejets.linecolor = kGreen+3;
50 
51  plot_config lightjets;
52  lightjets.markerstyle = kFullCircle;
53  lightjets.markercolor = kRed+1;
54  lightjets.linestyle = kSolid;
55  lightjets.linecolor = kRed+1;
56 
57  // Compare the z shapes for light and light jets
58  strangejets.htemplate = new TH1F("ks_zhadron_template","",100,0,1.5);
59  strangejets.xtitle = "K_{s}^{0} z_{hadron}";
60  strangejets.ytitle = "K_{s}^{0} Candidates in Jets";
61 
62  lightjets.htemplate = strangejets.htemplate;
63  lightjets.xtitle = strangejets.xtitle;
64  lightjets.ytitle = strangejets.ytitle;
65 
66  auto strange_Ks_zhadron = GeneratePlot(strangejets, default_data, "jet_Ks_zhadron_strange", "jet_Ks_zhadron", TCut("jet_flavor==3"));
67  auto light_Ks_zhadron = GeneratePlot(lightjets, default_data, "jet_Ks_zhadron_light", "jet_Ks_zhadron", TCut("(jet_flavor<3 || jet_flavor==21)"));
68 
69  pad->cd();
70 
71  light_Ks_zhadron->DrawNormalized("HIST");
72  strange_Ks_zhadron->DrawNormalized("E1 SAME");
73 
74  legend = smart_legend();
75  legend->AddEntry(light_Ks_zhadron, "Light Jets", "lp");
76  legend->AddEntry(strange_Ks_zhadron, "Strange Jets", "lp");
77  legend->Draw();
78 
79  make_title(common_title);
80 
81  pad->SaveAs("Ks_zhadron.pdf");
82 
83 
84  // Charged Kaons
85  strangejets.htemplate = new TH1F("k_zhadron_template","",100,0,1.5);
86  strangejets.xtitle = "K^{#pm} z_{hadron}";
87  strangejets.ytitle = "K^{#pm} Candidates in Jets";
88 
89  lightjets.htemplate = strangejets.htemplate;
90  lightjets.xtitle = strangejets.xtitle;
91  lightjets.ytitle = strangejets.ytitle;
92 
93  auto strange_K_zhadron = GeneratePlot(strangejets, default_data, "jet_K_zhadron_strange", "jet_K_zhadron", TCut("jet_flavor==3"));
94  auto light_K_zhadron = GeneratePlot(lightjets, default_data, "jet_K_zhadron_light", "jet_K_zhadron", TCut("(jet_flavor<3 || jet_flavor==21)"));
95 
96  pad->cd();
97 
98  light_K_zhadron->DrawNormalized("HIST");
99  strange_K_zhadron->DrawNormalized("E1 SAME");
100 
101  legend = smart_legend();
102  legend->AddEntry(light_K_zhadron, "Light Jets", "lp");
103  legend->AddEntry(strange_K_zhadron, "Strange Jets", "lp");
104  legend->Draw();
105 
106  make_title(common_title);
107 
108  pad->SaveAs("K_zhadron.pdf");
109 
110 
111  // Jet Charge
112  strangejets.htemplate = new TH1F("jetcharge_template","",100,-1.5,1.5);
113  strangejets.xtitle = "Jet Charge (#kappa = 0.5)";
114  strangejets.ytitle = "Jet Candidates";
115 
116  lightjets.htemplate = strangejets.htemplate;
117  lightjets.xtitle = strangejets.xtitle;
118  lightjets.ytitle = strangejets.ytitle;
119 
120  auto ujets = lightjets;
121  ujets.linestyle = kDashed;
122 
123  auto djets = lightjets;
124  djets.linestyle = kSolid;
125 
126  auto gjets = lightjets;
127  gjets.linestyle = kSolid;
128  gjets.linecolor = kGray;
129 
130 
131 
132 
133  auto strange_jetcharge = GeneratePlot(strangejets, default_data, "jet_charge_strange", "jet_charge", TCut("jet_flavor==3"));
134  auto u_jetcharge = GeneratePlot(ujets, default_data, "jet_charge_u", "jet_charge", TCut("(jet_flavor==2)"));
135  auto d_jetcharge = GeneratePlot(djets, default_data, "jet_charge_d", "jet_charge", TCut("(jet_flavor==1)"));
136  auto g_jetcharge = GeneratePlot(gjets, default_data, "jet_charge_g", "jet_charge", TCut("(jet_flavor==21)"));
137 
138  pad->cd();
139 
140  auto hist = g_jetcharge->DrawNormalized("HIST");
141  u_jetcharge->DrawNormalized("HIST SAME");
142  d_jetcharge->DrawNormalized("HIST SAME");
143  strange_jetcharge->DrawNormalized("E1 SAME");
144 
145  hist->SetAxisRange(0.0, 0.035, "Y");
146 
147  legend = smart_legend();
148  legend->AddEntry(g_jetcharge, "Gluon Jets", "lf");
149  legend->AddEntry(u_jetcharge, "Up Jets", "lf");
150  legend->AddEntry(d_jetcharge, "Down Jets", "lf");
151  legend->AddEntry(strange_jetcharge, "Strange Jets", "lp");
152  legend->Draw();
153 
154  make_title(common_title);
155 
156 
157  pad->Update();
158  pad->SaveAs("jet_charge.pdf");
159 
160 
161 
162 }