Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
////////////////////////////////////////
// Read reconstruction ROOT output file
// Plot variables
////////////////////////////////////////
int makeplot_pi0(const char* input_fname = "../sim_output/sim_emcal_pi0s_output.root")
{
// Setting figures
gROOT->SetStyle("Plain");
gStyle->SetLineWidth(3);
gStyle->SetOptStat("nem");
gStyle->SetPadTickX(1);
gStyle->SetPadTickY(1);
gStyle->SetPadGridX(1);
gStyle->SetPadGridY(1);
gStyle->SetPadLeftMargin(0.14);
gStyle->SetPadRightMargin(0.14);
// Input ROOT file
TFile *f = new TFile(input_fname,"READ");
TTree *t = (TTree *)f->Get("events");
// Set Branch status and addressed
t->SetMakeClass(1);
t->SetBranchStatus("*", 0);
Int_t EcalClusters_;
t->SetBranchStatus("EcalClusters", 1);
t->SetBranchAddress("EcalClusters", &EcalClusters_);
Int_t RecoEcalHits_;
t->SetBranchStatus("RecoEcalHits", 1);
t->SetBranchAddress("RecoEcalHits", &RecoEcalHits_);
const Int_t kMaxEcalClusters = 100000;
Double_t cluster_x_pos[kMaxEcalClusters];
Double_t cluster_y_pos[kMaxEcalClusters];
Double_t cluster_z_pos[kMaxEcalClusters];
Float_t cluster_energy[kMaxEcalClusters];
t->SetBranchStatus("EcalClusters.position.x",1);
t->SetBranchStatus("EcalClusters.position.y",1);
t->SetBranchStatus("EcalClusters.position.z",1);
t->SetBranchStatus("EcalClusters.energy",1);
t->SetBranchAddress("EcalClusters.position.x",cluster_x_pos);
t->SetBranchAddress("EcalClusters.position.y",cluster_y_pos);
t->SetBranchAddress("EcalClusters.position.z",cluster_z_pos);
t->SetBranchAddress("EcalClusters.energy",cluster_energy);
const Int_t kMaxRecoEcalHits = 100000;
Double_t rec_x_pos[kMaxRecoEcalHits];
Double_t rec_y_pos[kMaxRecoEcalHits];
Double_t rec_energy[kMaxRecoEcalHits];
t->SetBranchStatus("RecoEcalHits.position.x",1);
t->SetBranchStatus("RecoEcalHits.position.y",1);
t->SetBranchStatus("RecoEcalHits.energy",1);
t->SetBranchAddress("RecoEcalHits.position.x",rec_x_pos);
t->SetBranchAddress("RecoEcalHits.position.y",rec_y_pos);
t->SetBranchAddress("RecoEcalHits.energy",rec_energy);
// Setting for Canvas
TCanvas *c1 = new TCanvas("c1", "c1", 500, 500);
TCanvas *c2 = new TCanvas("c2", "c2", 500, 500);
TCanvas *c3 = new TCanvas("c3", "c3", 500, 500);
TCanvas *c4 = new TCanvas("c4", "c4", 500, 500);
TCanvas *c5 = new TCanvas("c5", "c5", 500, 500);
TCanvas *c6 = new TCanvas("c6", "c6", 500, 500);
TCanvas *c7 = new TCanvas("c7", "c7", 500, 500);
TCanvas *c8 = new TCanvas("c8", "c8", 500, 500);
TCanvas *c9 = new TCanvas("c9", "c9", 500, 500);
TCanvas *c10 = new TCanvas("c10","c10", 500, 500);
TCanvas *c11 = new TCanvas("c11","c11", 500, 500);
TCanvas *c12 = new TCanvas("c12","c12", 500, 500);
TCanvas *c13 = new TCanvas("c13","c13", 500, 500);
// Declare histograms
TH1D *h1 = new TH1D("h1", "Scattering Angle(#theta)", 100,130.0,180.0);
TH1D *h2 = new TH1D("h2", "Pseudo-rapidity(#eta)", 100,-5.0,0.0);
TH2D *h3 = new TH2D("h3", "Cluster E vs Pseudo-rapidity", 100,-0.5,30.5,100,-5.0,0.0);
TH1D *h4 = new TH1D("h4", "Reconstructed energy per event", 100,-0.5,30.5);
TH1D *h5 = new TH1D("h5", "Number of Clusters per event", 5,-0.5,4.5);
TH1D *h6 = new TH1D("h6", "Scattering Angle(#theta) with CUT", 100,130.0,180.0);
TH1D *h7 = new TH1D("h7", "Pseudo-rapidity(#eta) with CUT", 100,-5.0,0.0);
TH2D *h8 = new TH2D("h8", "Cluster Hit Position", 62,-62.0,62.0,62,-62.0,62.0);
TH2D *h9 = new TH2D("h9", "All Hit Position", 62,-62.0,62.0,62,-62.0,62.0);
TH1D *h10 = new TH1D("h10","Invariant mass", 60,0.0,300.0);
TH1D *h11 = new TH1D("h11","E1", 100,-0.5,30.5);
TH1D *h12 = new TH1D("h12","E2", 100,-0.5,30.5);
TH1D *h13 = new TH1D("h13","angle", 100,0.0,90.0);
// Declare ellipse for boundary of crystal calorimeter
TEllipse *ell1 = new TEllipse(0.0, 0.0, 60.0, 60.0);
ell1->SetFillStyle(4000);
TEllipse *ell2 = new TEllipse(0.0, 0.0, 12.0, 12.0);
ell2->SetFillStyle(4000);
// Total number of entries
Int_t nentries = t->GetEntries();
// Variables are used in calculation
Double_t r; // Radius [cm]
Double_t phi; // Azimuth [degree]
Double_t theta; // Inclination [degree]
Double_t eta; // Pseudo-rapidity [unitless]
Float_t cluster_e; // Cluster energy [GeV]
Float_t total_cluster_e; // Add up clusters per event [GeV]
Double_t dot_product_pos_clusters; // dot product of positions of two photons
Double_t mag_pos2_cluster_1; // squared magnitude of position
Double_t mag_pos2_cluster_2; // squared magnitude of position
Double_t cosine_clusters; // cos(theta_photons)
Double_t theta_photons; // angle between two photons
Double_t invariant_mass; // M^2 = 2 * p_1 * p_2 * (1 - cos(theta_photons))
// Loop over event by event
for (int ievent = 0; ievent < nentries; ievent++)
{
t->GetEntry(ievent);
Int_t ncluster = EcalClusters_;
Int_t nreconhits = RecoEcalHits_;
total_cluster_e = 0.0;
h5->Fill(ncluster, 1.0);
// Loop over cluster by cluster
for (int icluster=0; icluster < ncluster; icluster++)
{
r = TMath::Sqrt((cluster_x_pos[icluster]*cluster_x_pos[icluster]) +
(cluster_y_pos[icluster]*cluster_y_pos[icluster]) +
(cluster_z_pos[icluster]*cluster_z_pos[icluster]));
phi = TMath::ATan(cluster_y_pos[icluster]/cluster_x_pos[icluster]) * TMath::RadToDeg();
theta = TMath::ACos(cluster_z_pos[icluster] / r) * TMath::RadToDeg();
eta = -1.0 * TMath::Log(TMath::Tan((theta*TMath::DegToRad())/2.0));
cluster_e = cluster_energy[icluster] / 1.e+3;
total_cluster_e += cluster_e;
}
// Select events with two clusters
// To calculate invariant mass
// M^2 = 2p1p2(1-cos(theta))
// p1 = E1
// p2 = E2
// theta: angle between two photons
if(ncluster == 2)
{
h1->Fill(theta, 1.0);
h2->Fill(eta, 1.0);
h3->Fill(cluster_e, eta, 1.0);
h4->Fill(total_cluster_e, 1.0);
h8->Fill(cluster_x_pos[0],cluster_y_pos[0], 1.0);
if(total_cluster_e > 0.5)
{
h6->Fill(theta, 1.0);
h7->Fill(eta, 1.0);
}
// Calculate invariant mass
dot_product_pos_clusters = cluster_x_pos[0]*cluster_x_pos[1] + cluster_y_pos[0]*cluster_y_pos[1] + cluster_z_pos[0]*cluster_z_pos[1];
mag_pos2_cluster_1 = (cluster_x_pos[0]*cluster_x_pos[0]) + (cluster_y_pos[0]*cluster_y_pos[0]) + (cluster_z_pos[0]*cluster_z_pos[0]);
mag_pos2_cluster_2 = (cluster_x_pos[1]*cluster_x_pos[1]) + (cluster_y_pos[1]*cluster_y_pos[1]) + (cluster_z_pos[1]*cluster_z_pos[1]);
cosine_clusters = (dot_product_pos_clusters/TMath::Sqrt(mag_pos2_cluster_1*mag_pos2_cluster_2));
theta_photons = TMath::ACos(cosine_clusters)*TMath::RadToDeg();
invariant_mass = TMath::Sqrt(2.0*cluster_energy[0]*cluster_energy[1]*(1.0 - cosine_clusters));
// Fill histograms
h10->Fill(invariant_mass, 1.0);
h11->Fill(cluster_energy[0], 1.0);
h12->Fill(cluster_energy[1], 1.0);
h13->Fill(theta_photons, 1.0);
}
// Loop over hit by hit
for(int ireconhit=0; ireconhit < nreconhits; ireconhit++)
h9->Fill(rec_x_pos[ireconhit],rec_y_pos[ireconhit], 1.0);
}
// Drawing and Saving figures
c1->cd();
h1->SetLineColor(kBlue);
h1->SetLineWidth(2);
h1->GetYaxis()->SetRangeUser(0.0,h1->GetMaximum()+10.0);
h1->GetXaxis()->SetTitle("#theta [degree]");
h1->GetYaxis()->SetTitle("events");
h1->GetYaxis()->SetTitleOffset(1.4);
h1->DrawClone();
c1->SaveAs("results/pi0_theta_hist_0GeVto30GeV.png");
c1->SaveAs("results/pi0_theta_hist_0GeVto30GeV.pdf");
c2->cd();
h2->SetLineColor(kBlue);
h2->SetLineWidth(2);
h2->GetYaxis()->SetRangeUser(0.0,h2->GetMaximum()+10.0);
h2->GetXaxis()->SetTitle("#eta");
h2->GetYaxis()->SetTitle("events");
h2->GetYaxis()->SetTitleOffset(1.4);
h2->DrawClone();
c2->SaveAs("results/pi0_eta_hist_0GeVto30GeV.png");
c2->SaveAs("results/pi0_eta_hist_0GeVto30GeV.pdf");
c3->cd();
h3->GetXaxis()->SetTitle("Cluster energy [GeV]");
h3->GetYaxis()->SetTitle("#eta");
h3->GetYaxis()->SetTitleOffset(1.4);
h3->DrawClone("COLZ");
c3->SaveAs("results/pi0_E_vs_eta_hist_0GeVto30GeV.png");
c3->SaveAs("results/pi0_E_vs_eta_hist_0GeVto30GeV.pdf");
c4->cd();
c4->SetLogy(1);
h4->SetLineColor(kBlue);
h4->SetLineWidth(2);
h4->GetXaxis()->SetTitle("reconstructed energy [GeV]");
h4->GetYaxis()->SetTitle("events");
h4->GetYaxis()->SetTitleOffset(1.4);
h4->DrawClone();
c4->SaveAs("results/pi0_Erec_hist_0GeVto30GeV.png");
c4->SaveAs("results/pi0_Erec_hist_0GeVto30GeV.pdf");
c5->cd();
c5->SetLogy(1);
h5->SetLineColor(kBlue);
h5->SetLineWidth(2);
h5->GetXaxis()->SetTitle("Number of Clusters");
h5->GetYaxis()->SetTitle("events");
h5->GetYaxis()->SetTitleOffset(1.4);
h5->DrawClone();
c5->SaveAs("results/pi0_ncluster_hist_0GeVto30GeV.png");
c5->SaveAs("results/pi0_ncluster_hist_0GeVto30GeV.pdf");
c6->cd();
h6->SetLineColor(kBlue);
h6->SetLineWidth(2);
h6->GetYaxis()->SetRangeUser(0.0,h1->GetMaximum()+10.0);
h6->GetXaxis()->SetTitle("#theta [degree]");
h6->GetYaxis()->SetTitle("events");
h6->GetYaxis()->SetTitleOffset(1.4);
h6->DrawClone();
c6->SaveAs("results/pi0_theta_hist_CUT_0GeVto30GeV.png");
c6->SaveAs("results/pi0_theta_hist_CUT_0GeVto30GeV.pdf");
c7->cd();
h7->SetLineColor(kBlue);
h7->SetLineWidth(2);
h7->GetYaxis()->SetRangeUser(0.0,h2->GetMaximum()+10.0);
h7->GetXaxis()->SetTitle("#eta");
h7->GetYaxis()->SetTitle("events");
h7->GetYaxis()->SetTitleOffset(1.4);
h7->DrawClone();
c7->SaveAs("results/pi0_eta_hist_CUT_0GeVto30GeV.png");
c7->SaveAs("results/pi0_eta_hist_CUT_0GeVto30GeV.pdf");
c8->cd();
h8->GetXaxis()->SetTitle("Hit position X [cm]");
h8->GetYaxis()->SetTitle("Hit position Y [cm]");
h8->GetYaxis()->SetTitleOffset(1.4);
h8->DrawClone("COLZ");
ell1->Draw("same");
ell2->Draw("same");
c8->SaveAs("results/pi0_hit_pos_cluster_0GeVto30GeV.png");
c8->SaveAs("results/pi0_hit_pos_cluster_0GeVto30GeV.pdf");
c9->cd();
h9->GetXaxis()->SetTitle("Hit position X [cm]");
h9->GetYaxis()->SetTitle("Hit position Y [cm]");
h9->GetYaxis()->SetTitleOffset(1.4);
h9->DrawClone("COLZ");
ell1->Draw("same");
ell2->Draw("same");
c9->SaveAs("results/pi0_hit_pos_all_0GeVto30GeV.png");
c9->SaveAs("results/pi0_hit_pos_all_0GeVto30GeV.pdf");
c10->cd();
h10->SetLineColor(kBlue);
h10->SetLineWidth(2);
h10->GetXaxis()->SetTitle("Invariant mass [MeV]");
h10->GetYaxis()->SetTitle("events");
h10->GetYaxis()->SetTitleOffset(1.4);
h10->DrawClone();
c10->SaveAs("results/pi0_invariant_mass_hist_0GeVto30GeV.png");
c10->SaveAs("results/pi0_invariant_mass_hist_0GeVto30GeV.pdf");
c11->cd();
h11->SetLineColor(kBlue);
h11->SetLineWidth(2);
h11->GetXaxis()->SetTitle("Cluster energy 1 [MeV]");
h11->GetYaxis()->SetTitle("events");
h11->GetYaxis()->SetTitleOffset(1.4);
h11->DrawClone();
c11->SaveAs("results/pi0_E1_hist_0GeVto30GeV.png");
c11->SaveAs("results/pi0_E1_hist_0GeVto30GeV.pdf");
c12->cd();
h12->SetLineColor(kBlue);
h12->SetLineWidth(2);
h12->GetXaxis()->SetTitle("Cluster energy 2 [MeV]");
h12->GetYaxis()->SetTitle("events");
h12->GetYaxis()->SetTitleOffset(1.4);
h12->DrawClone();
c12->SaveAs("results/pi0_E2_hist_0GeVto30GeV.png");
c12->SaveAs("results/pi0_E2_hist_0GeVto30GeV.pdf");
c13->cd();
h13->SetLineColor(kBlue);
h13->SetLineWidth(2);
h13->GetXaxis()->SetTitle("Angle between two photons [degree]");
h13->GetYaxis()->SetTitle("events");
h13->GetYaxis()->SetTitleOffset(1.4);
h13->DrawClone();
c13->SaveAs("results/pi0_angle_2photons_0GeVto30GeV.png");
c13->SaveAs("results/pi0_angle_2photons_0GeVto30GeV.pdf");
return 0;
}