11 const TString DIR_PATH =
"/sphenix/user/gregtom3/data/Summer2018/ECAL_probability_studies/"
14 TFile *
f =
new TFile(DIR_PATH+FILE_NAME,
"READ");
15 TTree *
t = (TTree*)f->Get(TREE_NAME);
19 TH1F*
fillHist(TH1F *THE_HIST, TTree *THE_TREE)
21 std::vector<float> measured_energy;
22 std::vector<float> measured_ptotal;
23 std::vector<float> shower_probability;
24 std::vector<float>* measured_energy_pointer = &measured_energy;
25 std::vector<float>* measured_ptotal_pointer = &measured_ptotal;
26 std::vector<float>* shower_probability_pointer = &shower_probability;
27 THE_TREE->SetBranchAddress(
"em_cluster_e",&measured_energy_pointer);
28 THE_TREE->SetBranchAddress(
"em_track_ptotal",&measured_ptotal_pointer);
29 THE_TREE->SetBranchAddress(
"em_cluster_prob",&shower_probability_pointer);
31 Int_t nentries = Int_t(THE_TREE->GetEntries());
32 for(Int_t entryInChain=0; entryInChain<nentries; entryInChain++)
34 Int_t entryInTree = THE_TREE->LoadTree(entryInChain);
35 if (entryInTree < 0)
break;
36 THE_TREE->GetEntry(entryInChain);
37 for(
int i=0;
i<shower_probability.size();
i++)
39 if(measured_energy[
i]>0.5)
40 THE_HIST->Fill(shower_probability[
i]);
43 THE_HIST->SetXTitle(
"P_{EM}");
44 THE_HIST->SetYTitle(
"Counts");
51 TCanvas *cPNG =
new TCanvas(
"cPNG",title);
52 TImage *img = TImage::Create();
56 h_p->GetXaxis()->SetNdivisions(6,2,0,
false);
57 h_p->GetYaxis()->SetNdivisions(5,3,0,
false);
58 h_p->GetYaxis()->SetRangeUser(0,5000);
59 auto legend =
new TLegend(0.7,0.65,0.95,0.90,title);
60 legend->AddEntry(h_p,
"Pions",
"l");
61 legend->AddEntry(h_e,
"Electrons",
"l");
62 legend->SetTextSize(0.05);
66 img->WriteImage(saveFileName);
78 const TString DIR_PATH =
"/sphenix/user/gregtom3/data/Summer2018/ECAL_probability_studies/"
86 gROOT->LoadMacro(
"/sphenix/user/gregtom3/SBU/research/macros/macros/sPHENIXStyle/sPhenixStyle.C");
88 gROOT->SetBatch(kTRUE);
94 TH1F *h_base =
new TH1F(
"h_base",
"",25,0,1.2);
95 TH1F *h_base_e = (TH1F*)h_base->Clone();
96 TH1F *h_base_p = (TH1F*)h_base->Clone();
98 h_base_e->SetLineColor(kRed);
99 h_base_p->SetLineColor(kBlue);
109 TH1F *h_P_1GeV_CEMC = (TH1F*)h_base_p->Clone();
110 TH1F *h_P_2GeV_CEMC = (TH1F*)h_base_p->Clone();
111 TH1F *h_P_5GeV_CEMC = (TH1F*)h_base_p->Clone();
112 TH1F *h_P_10GeV_CEMC = (TH1F*)h_base_p->Clone();
113 TH1F *h_P_20GeV_CEMC = (TH1F*)h_base_p->Clone();
115 TH1F *h_E_1GeV_CEMC = (TH1F*)h_base_e->Clone();
116 TH1F *h_E_2GeV_CEMC = (TH1F*)h_base_e->Clone();
117 TH1F *h_E_5GeV_CEMC = (TH1F*)h_base_e->Clone();
118 TH1F *h_E_10GeV_CEMC = (TH1F*)h_base_e->Clone();
119 TH1F *h_E_20GeV_CEMC = (TH1F*)h_base_e->Clone();
121 h_P_1GeV_CEMC->SetName(
"h_P_1GeV_CEMC");
122 h_P_2GeV_CEMC->SetName(
"h_P_2GeV_CEMC");
123 h_P_5GeV_CEMC->SetName(
"h_P_5GeV_CEMC");
124 h_P_10GeV_CEMC->SetName(
"h_P_10GeV_CEMC");
125 h_P_20GeV_CEMC->SetName(
"h_P_20GeV_CEMC");
127 h_E_1GeV_CEMC->SetName(
"h_E_1GeV_CEMC");
128 h_E_2GeV_CEMC->SetName(
"h_E_2GeV_CEMC");
129 h_E_5GeV_CEMC->SetName(
"h_E_5GeV_CEMC");
130 h_E_10GeV_CEMC->SetName(
"h_E_10GeV_CEMC");
131 h_E_20GeV_CEMC->SetName(
"h_E_20GeV_CEMC");
133 TTree *t_P_1GeV_CEMC =
loadTree(
"Pions/Pions1C.root",
"event_cluster");
134 TTree *t_P_2GeV_CEMC =
loadTree(
"Pions/Pions2C.root",
"event_cluster");
135 TTree *t_P_5GeV_CEMC =
loadTree(
"Pions/Pions5C.root",
"event_cluster");
136 TTree *t_P_10GeV_CEMC =
loadTree(
"Pions/Pions10C.root",
"event_cluster");
137 TTree *t_P_20GeV_CEMC =
loadTree(
"Pions/Pions20C.root",
"event_cluster");
139 TTree *t_E_1GeV_CEMC =
loadTree(
"Electrons/Electrons1C.root",
"event_cluster");
140 TTree *t_E_2GeV_CEMC =
loadTree(
"Electrons/Electrons2C.root",
"event_cluster");
141 TTree *t_E_5GeV_CEMC =
loadTree(
"Electrons/Electrons5C.root",
"event_cluster");
142 TTree *t_E_10GeV_CEMC =
loadTree(
"Electrons/Electrons10C.root",
"event_cluster");
143 TTree *t_E_20GeV_CEMC =
loadTree(
"Electrons/Electrons20C.root",
"event_cluster");
146 TH1F *h_P_1GeV_EEMC = (TH1F*)h_base_p->Clone();
147 TH1F *h_P_2GeV_EEMC = (TH1F*)h_base_p->Clone();
148 TH1F *h_P_5GeV_EEMC = (TH1F*)h_base_p->Clone();
149 TH1F *h_P_10GeV_EEMC = (TH1F*)h_base_p->Clone();
150 TH1F *h_P_20GeV_EEMC = (TH1F*)h_base_p->Clone();
152 TH1F *h_E_1GeV_EEMC = (TH1F*)h_base_e->Clone();
153 TH1F *h_E_2GeV_EEMC = (TH1F*)h_base_e->Clone();
154 TH1F *h_E_5GeV_EEMC = (TH1F*)h_base_e->Clone();
155 TH1F *h_E_10GeV_EEMC = (TH1F*)h_base_e->Clone();
156 TH1F *h_E_20GeV_EEMC = (TH1F*)h_base_e->Clone();
158 h_P_1GeV_EEMC->SetName(
"h_P_1GeV_EEMC");
159 h_P_2GeV_EEMC->SetName(
"h_P_2GeV_EEMC");
160 h_P_5GeV_EEMC->SetName(
"h_P_5GeV_EEMC");
161 h_P_10GeV_EEMC->SetName(
"h_P_10GeV_EEMC");
162 h_P_20GeV_EEMC->SetName(
"h_P_20GeV_EEMC");
164 h_E_1GeV_EEMC->SetName(
"h_E_1GeV_EEMC");
165 h_E_2GeV_EEMC->SetName(
"h_E_2GeV_EEMC");
166 h_E_5GeV_EEMC->SetName(
"h_E_5GeV_EEMC");
167 h_E_10GeV_EEMC->SetName(
"h_E_10GeV_EEMC");
168 h_E_20GeV_EEMC->SetName(
"h_E_20GeV_EEMC");
170 TTree *t_P_1GeV_EEMC =
loadTree(
"Pions/Pions1E.root",
"event_cluster");
171 TTree *t_P_2GeV_EEMC =
loadTree(
"Pions/Pions2E.root",
"event_cluster");
172 TTree *t_P_5GeV_EEMC =
loadTree(
"Pions/Pions5E.root",
"event_cluster");
173 TTree *t_P_10GeV_EEMC =
loadTree(
"Pions/Pions10E.root",
"event_cluster");
174 TTree *t_P_20GeV_EEMC =
loadTree(
"Pions/Pions20E.root",
"event_cluster");
176 TTree *t_E_1GeV_EEMC =
loadTree(
"Electrons/Electrons1E.root",
"event_cluster");
177 TTree *t_E_2GeV_EEMC =
loadTree(
"Electrons/Electrons2E.root",
"event_cluster");
178 TTree *t_E_5GeV_EEMC =
loadTree(
"Electrons/Electrons5E.root",
"event_cluster");
179 TTree *t_E_10GeV_EEMC =
loadTree(
"Electrons/Electrons10E.root",
"event_cluster");
180 TTree *t_E_20GeV_EEMC =
loadTree(
"Electrons/Electrons20E.root",
"event_cluster");
187 h_P_1GeV_CEMC=
fillHist(h_P_1GeV_CEMC,t_P_1GeV_CEMC);
188 h_P_2GeV_CEMC=
fillHist(h_P_2GeV_CEMC,t_P_2GeV_CEMC);
189 h_P_5GeV_CEMC=
fillHist(h_P_5GeV_CEMC,t_P_5GeV_CEMC);
190 h_P_10GeV_CEMC=
fillHist(h_P_10GeV_CEMC,t_P_10GeV_CEMC);
191 h_P_20GeV_CEMC=
fillHist(h_P_20GeV_CEMC,t_P_20GeV_CEMC);
202 h_E_1GeV_CEMC=
fillHist(h_E_1GeV_CEMC,t_E_1GeV_CEMC);
203 h_E_2GeV_CEMC=
fillHist(h_E_2GeV_CEMC,t_E_2GeV_CEMC);
204 h_E_5GeV_CEMC=
fillHist(h_E_5GeV_CEMC,t_E_5GeV_CEMC);
205 h_E_10GeV_CEMC=
fillHist(h_E_10GeV_CEMC,t_E_10GeV_CEMC);
206 h_E_20GeV_CEMC=
fillHist(h_E_20GeV_CEMC,t_E_20GeV_CEMC);
219 histToPNG(h_P_1GeV_CEMC,h_E_1GeV_CEMC,
"1GeV CEMC",
"prob_e_pi_1GeV_CEMC.png");
220 histToPNG(h_P_2GeV_CEMC,h_E_2GeV_CEMC,
"2GeV CEMC",
"prob_e_pi_2GeV_CEMC.png");
221 histToPNG(h_P_5GeV_CEMC,h_E_5GeV_CEMC,
"5GeV CEMC",
"prob_e_pi_5GeV_CEMC.png");
222 histToPNG(h_P_10GeV_CEMC,h_E_10GeV_CEMC,
"10GeV CEMC",
"prob_e_pi_10GeV_CEMC.png");
223 histToPNG(h_P_20GeV_CEMC,h_E_20GeV_CEMC,
"20GeV CEMC",
"prob_e_pi_20GeV_CEMC.png");