22 #include "/sphenix/user/gregtom3/SBU/research/macros/macros/sPHENIXStyle/sPhenixStyle.C"
24 #define NELEMS(arr) (sizeof(arr)/sizeof(arr[0]))
31 TTree *
load_tree(
const char *
const file_name,
const char *
const tree_name);
33 const int energy_level_gev,
const detector d);
34 void fill_histogram(TH1F *
const h, TTree *
const t,
const Float_t min_value);
36 const int particle_energy_gev,
const detector d);
47 "/sphenix/user/gregtom3/data/Summer2018/ECAL_energy_studies";
61 const static Color_t
plot_colors[] = { kBlue, kRed, kGreen, kOrange, kViolet };
74 gROOT->SetBatch(kTRUE);
79 TH1F *
const h_base =
new TH1F(
"h_base",
"", 100, 0.0, 25);
81 std::vector < TCanvas * >particle_canvases;
87 gStyle->GetCanvasDefH());
89 particle_canvases.push_back(c);
97 particle_canvases[
p]->cd(d + 1);
98 TH1F *
const h = (TH1F *) h_base->Clone();
107 particle_canvases[
p]->cd(d + 1);
111 new TLegend(0.60, .90, .9, 0.625,
116 l->SetTextSize(0.05);
128 new TLegend(0.60, .90, .9, 0.85,
133 l->SetTextSize(0.05);
142 TImage *
const img = TImage::Create();
143 img->FromPad(particle_canvases[
p]);
145 img->WriteImage(path);
151 const int energy_level_gev,
const detector d)
159 h->Scale(1 / h->GetEntries());
160 h->GetYaxis()->SetRangeUser(0.0001, 10);
161 h->SetXTitle(
"E_{cluster} (GeV)");
162 h->SetYTitle(
"entries / #scale[0.5]{#sum} entries ");
167 TTree *
load_tree(
const char *
const file_name,
const char *
const tree_name)
169 return (TTree *) (
new TFile(file_name,
"READ"))->
Get(tree_name);
183 Float_t measured_energy;
185 t->SetBranchAddress(
"e", &measured_energy);
186 t->SetBranchAddress(
"ge", &true_energy);
187 Int_t nentries = Int_t(t->GetEntries());
189 for (Int_t
i = 0;
i < nentries; ++
i) {
190 if (t->LoadTree(
i) < 0)
194 if (measured_energy > min_value && true_energy > 0.1)
195 h->Fill(measured_energy);
201 char *
const t =
new char[strlen(s) + 1];
206 const int particle_energy_gev,
const detector d)
208 std::stringstream
name;
219 name <<
"_" << particle_energy_gev <<
"GeV";
229 return strdup(name.str().c_str());
233 const int particle_energy_gev,
const detector d)
235 std::stringstream
path;
240 path <<
"/Electrons/Electrons";
243 path <<
"/Pions/Pions";
247 path << particle_energy_gev;
262 return strdup(path.str().c_str());
267 std::stringstream
name;
278 name <<
"-Measured_Energy";
294 return strdup(name.str().c_str());
299 std::stringstream canvas_name;
303 canvas_name <<
"Pion";
306 canvas_name <<
"Electron";
310 return strdup(canvas_name.str().c_str());
315 std::stringstream canvas_title;
319 canvas_title <<
"Pion";
322 canvas_title <<
"Electron";
326 return strdup(canvas_title.str().c_str());
331 std::stringstream legend_header;
335 legend_header <<
"CEMC ";
338 legend_header <<
"EEMC ";
341 legend_header <<
"FEMC ";
347 legend_header <<
"Pions ";
350 legend_header <<
"Electrons ";
354 return strdup(legend_header.str().c_str());
359 std::stringstream legend_entry;
360 legend_entry << particle_energy_gev <<
" GeV";
362 return strdup(legend_entry.str().c_str());