13 #define NELEMS(arr) (sizeof(arr)/sizeof(arr[0]))
17 "/sphenix/user/gregtom3/data/Summer2018/ECAL_energy_studies";
26 TTree *
load_tree(
const char *
const file_name,
const char *
const tree_name);
27 void fill_histogram(TH1F *
const h, TTree *
const t,
const Float_t min_value,
28 const bool normalize);
30 const char *
const title,
const char *
const label);
46 (
"/sphenix/user/gregtom3/SBU/research/macros/macros/sPHENIXStyle/sPhenixStyle.C");
53 TH1F *h_base =
new TH1F(
"h_base",
"", 25, 0.0, 2.5);
54 TH1F *h_base_e = (TH1F *) h_base->Clone();
55 TH1F *h_base_p = (TH1F *) h_base->Clone();
56 h_base_e->SetLineColor(kRed);
57 h_base_p->SetLineColor(kBlue);
63 TH1F *
const h_pion_cemc = h_base_p->Clone();
64 TH1F *
const h_electron_cemc = h_base_e->Clone();
70 TTree *
const t_pion_cemc =
73 TTree *
const t_electron_cemc =
85 TH1F *
const h_pion_eemc = h_base_p->Clone();
86 TH1F *
const h_electron_eemc = h_base_e->Clone();
92 TTree *
const t_pion_eemc =
95 TTree *
const t_electron_eemc =
107 TH1F *
const h_pion_femc = h_base_p->Clone();
108 TH1F *
const h_electron_femc = h_base_e->Clone();
114 TTree *
const t_pion_femc =
117 TTree *
const t_electron_femc =
132 TTree *
load_tree(
const char *
const file_name,
const char *
const tree_name)
134 return (TTree *) (
new TFile(file_name,
"READ"))->
Get(tree_name);
147 const bool normalize)
149 Float_t measured_energy;
151 t->SetBranchAddress(
"e", &measured_energy);
152 t->SetBranchAddress(
"ge", &true_energy);
153 Int_t nentries = Int_t(t->GetEntries());
155 for (Int_t
i = 0;
i < nentries; ++
i) {
156 if (t->LoadTree(
i) < 0)
160 if (measured_energy > min_value && true_energy > 0.1)
161 h->Fill(measured_energy / true_energy);
164 h->Scale(1 / h->GetEntries());
166 h->SetXTitle(
"em_cluster_e / true_e");
167 h->SetYTitle(
"entries / #scale[0.5]{#sum} entries ");
171 const char *
const title,
const char *
const label)
173 TCanvas *cPNG =
new TCanvas(label, title, 600, 400);
175 h_pion->GetYaxis()->SetRangeUser(0.0001, 1);
176 h_electron->GetYaxis()->SetRangeUser(0.0001, 1);
179 h_electron->Draw(
"SAME");
182 auto legend =
new TLegend(0.70, 0.9, 0.95, 0.65, label);
183 legend->AddEntry(h_pion,
"Pions",
"l");
184 legend->AddEntry(h_electron,
"Electrons",
"l");
190 char *
const t =
new char[strlen(s) + 1];
197 std::stringstream
name;
208 name <<
"_" << particle_energy_gev <<
"GeV";
218 return strdup(name.str().c_str());
222 const int particle_energy_gev,
const detector d)
224 std::stringstream
path;
229 path <<
"/Electrons/Electrons";
232 path <<
"/Pions/Pions";
236 path << particle_energy_gev;
251 return strdup(path.str().c_str());
261 std::stringstream
label;
274 label << particle_energy_gev <<
"GeV";
276 return strdup(label.str().c_str());