-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdrawS0R.C
124 lines (123 loc) · 3.71 KB
/
drawS0R.C
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
void drawS0R(int run_num){
TChain* T = new TChain("T");
T->Add(Form("/lustre19/expphy/volatile/halla/parity/ryanrich/prexRootFiles/prexRHRS_%d_-1_file0.root",run_num));
TCanvas* c3n = new TCanvas("c3n","S0A and S0B hits",1000,800);
c3n->Divide(2,2);
c3n->cd(1);
gPad->SetLogy(1);
T->Draw("Ndata.P.S0AtdcR");
c3n->cd(2);
gPad->SetLogy(1);
T->Draw("Ndata.P.S0BtdcR");
int nhitAmax = T->GetMaximum("Ndata.P.S0AtdcR");
int nhitBmax = T->GetMaximum("Ndata.P.S0BtdcR");
c3n->cd(3);
gPad->SetLogy(1);
gStyle->SetOptStat(0);
cout<<Form("nhitAmax: %d, nhitBmax: %d",nhitAmax, nhitBmax)<<endl;
const int nhit = nhitAmax;
TH1F* hA[nhit];
for(int i=0;i<nhit;i++){
T->Draw(Form("P.S0AtdcR[%d]>>h%d",i,i),"","goff");
hA[i] = (TH1F*)gDirectory->FindObject(Form("h%d",i));
}
T->Draw("P.S0AtdcR>>hAA","","goff");
TH1F* hAA = (TH1F*)gDirectory->FindObject("hAA");
hAA->SetLineColor(30);
hAA->Draw();
for(int i=0;i<nhit;i++){
if(i==4)
hA[i]->SetLineColor(7);
else
hA[i]->SetLineColor(i+1);
hA[i]->Draw("same");
}
TLatex latex;
latex.SetTextSize(0.04);
latex.SetNDC();
latex.SetTextColor(30);
latex.DrawLatex(0.6,0.85,"P.S0AtdcR");
latex.SetTextColor(1);
latex.DrawLatex(0.6,0.80,"P.S0AtdcR[0]");
latex.SetTextColor(2);
latex.DrawLatex(0.6,0.75,"P.S0AtdcR[1]");
latex.SetTextColor(3);
latex.DrawLatex(0.6,0.70,"P.S0AtdcR[2]");
latex.SetTextColor(4);
latex.DrawLatex(0.6,0.65,"P.S0AtdcR[3]");
latex.SetTextColor(7);
latex.DrawLatex(0.6,0.60,"P.S0AtdcR[4]");
latex.SetTextColor(6);
latex.DrawLatex(0.6,0.55,"P.S0AtdcR[5]");
c3n->cd(4);
gPad->SetLogy(1);
TH1F* hB[nhit];
for(int i=0;i<nhit;i++){
T->Draw(Form("P.S0BtdcR[%d]>>hB%d",i,i),"","goff");
hB[i] = (TH1F*)gDirectory->FindObject(Form("hB%d",i));
}
T->Draw("P.S0BtdcR>>hBB","","goff");
TH1F* hBB = (TH1F*)gDirectory->FindObject("hBB");
hBB->SetLineColor(30);
hBB->Draw();
for(int i=0;i<nhit;i++){
if(i==4)
hB[i]->SetLineColor(7);
else
hB[i]->SetLineColor(i+1);
hB[i]->Draw("same");
}
latex.SetTextColor(30);
latex.DrawLatex(0.6,0.85,"P.S0BtdcR");
latex.SetTextColor(1);
latex.DrawLatex(0.6,0.80,"P.S0BtdcR[0]");
latex.SetTextColor(2);
latex.DrawLatex(0.6,0.75,"P.S0BtdcR[1]");
latex.SetTextColor(3);
latex.DrawLatex(0.6,0.70,"P.S0BtdcR[2]");
latex.SetTextColor(4);
latex.DrawLatex(0.6,0.65,"P.S0BtdcR[3]");
latex.SetTextColor(7);
latex.DrawLatex(0.6,0.60,"P.S0BtdcR[4]");
latex.SetTextColor(6);
latex.DrawLatex(0.6,0.55,"P.S0BtdcR[5]");
TCanvas* ct = new TCanvas("ct","t_A-t_B vs VDC",600,400);
T->Draw("P.S0AtdcR-P.S0BtdcR:R.tr.x[0]>>hABX(200,-0.5,0.5,200,-2500,2500)");
TCanvas* c3 = new TCanvas("c3","S0A and S0B hits",1200,800);
c3->Divide(3,2);
c3->cd(1);
gPad->SetLogy(1);
T->Draw("Ndata.P.S0AtdcR");
c3->cd(2);
gPad->SetLogy(1);
gStyle->SetOptStat(0);
T->SetLineColor(1);
T->Draw("P.S0AtdcR[0]");
c3->cd(3);
T->Draw("P.S0AtdcR[0]>>hAA0");
TH1F* hAA0 = (TH1F*)gDirectory->FindObject("hAA0");
hAA0->GetYaxis()->SetRangeUser(-100,1000);
hAA0->Draw();
c3->cd(4);
gPad->SetLogy(1);
T->Draw("Ndata.P.S0BtdcR");
c3->cd(5);
gPad->SetLogy(1);
T->Draw("P.S0BtdcR[0]");
gPad->Update();
c3->cd(6);
T->Draw("P.S0BtdcR[0]>>hBB0");
TH1F* hBB0 = (TH1F*)gDirectory->FindObject("hBB0");
hBB0->GetYaxis()->SetRangeUser(-100,1000);
hBB0->Draw();
TCanvas* ct1 = new TCanvas("ct1","t_A-t_B vs VDC",1000,1000);
ct1->Divide(2,2);
ct1->cd(1);
T->Draw("P.S0AtdcR[0]-P.S0BtdcR[0]:R.tr.x[0]>>hABX1(200,-1,1,200,-100,100)");
ct1->cd(2);
T->Draw("P.S0AtdcR[0]-P.S0BtdcR[0]>>hAB1(200,-100,100)");
ct1->cd(3);
T->Draw("P.S0AtdcR[0]-P.S0BtdcR[0]:R.tr.x[0]>>hABX2(200,-1,1,200,-500,500)");
ct1->cd(4);
T->Draw("P.S0AtdcR[0]-P.S0BtdcR[0]>>hAB2(200,-500,500)");
}