-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrawEBDC06.C
More file actions
146 lines (108 loc) · 3.64 KB
/
drawEBDC06.C
File metadata and controls
146 lines (108 loc) · 3.64 KB
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
void drawEBDC06(){
gROOT->LoadMacro("sPhenixStyle.C");
SetsPhenixStyle();
TFile *f = new TFile("inputFiles/ebdc06_0000_clusterizer_new.root","READ");
TTree *t = (TTree*)f->Get("hitTree");
double X = 0.0;
double Y = 0.0;
double ADC = 0.0;
int layer = 0.0;
double binw = 0.0054541539;
//TH2D *h = new TH2D("h","Run11011 sector18 south hits, 1k events;#phi;Pad Row;ADC",37,2.8775927,3.0255927,18,21.5,39.5);
TH2D *h = new TH2D("h",";#phi;Pad Row;ADC",40,-0.42579939,-0.26579939,19,21.5,40.5);
cout << "center " << h->GetXaxis()->GetBinCenter(21) << endl;
t->SetBranchAddress("X",&X);
t->SetBranchAddress("Y",&Y);
t->SetBranchAddress("ADC",&ADC);
t->SetBranchAddress("layer",&layer);
for(int i=0; i<t->GetEntries(); i++){
t->GetEntry(i);
if(layer < 23 || layer > 38) continue;
double phiV = atan2(Y,X);
//if(phiV < 0) phiV += 2*TMath::Pi();
if(phiV > -0.42179939) h->Fill(phiV,1.0*layer,ADC);
}
for(int i=1; i<=40; i++){
for(int j=1; j<=19; j++){
//if(h->GetBinContent(i,j) < (0.2e6)) h->SetBinContent(i,j,0.0);
}
}
TFile *ft = new TFile("inputFiles/truthSectors.root","READ");
TTree *tree = (TTree*)ft->Get("truthTree");
unsigned int id = 0;
TVector3 *vec = nullptr;
tree->SetBranchAddress("truthID",&id);
tree->SetBranchAddress("truthPos",&vec);
vector<double> row, phi;
for(int i=0; i<tree->GetEntries(); i++){
tree->GetEntry(i);
int pet = id/10000;
if(pet < 18) continue;
int rowV = (id - (pet*10000))/100;
//cout << "rowV: " << rowV << endl;
double rowPhi = atan2(vec->Y(),vec->X());
//if(rowPhi < 0) rowPhi += 2*TMath::Pi();
rowPhi += TMath::Pi()/18 - 0.005;
//std::cout << "rowPhi: " << rowPhi << endl;
if(rowV >= 16 && rowV <= 22){
//cout << "good row" << endl;
//if(rowPhi > 2.885 && rowPhi < 3.02){
if(rowPhi > -0.42 && rowPhi < -0.27){
//cout << "filling vectors" << endl;
row.push_back(23.5 + 2*(rowV-16));
phi.push_back(rowPhi);
}
}
}
gStyle->SetOptStat(0);
TGraph *gr = new TGraph(phi.size(),&phi[0],&row[0]);
gr->SetMarkerStyle(20);
gr->SetMarkerSize(1.5);
gr->SetMarkerColor(kRed);
gr->GetXaxis()->SetTitle("#phi");
//gr->GetXaxis()->SetTitleOffset(1.2f);
gr->GetYaxis()->SetTitle("Stripe Row");
//gr->GetYaxis()->SetTitleOffset(1.2f);
gr->SetTitle("");
TLatex sPHENIX;
sPHENIX.SetTextFont(42);
sPHENIX.SetTextAlign(12);
sPHENIX.SetTextSize(0.035);
TLatex TPC;
TPC.SetTextSize(42);
TPC.SetTextAlign(12);
TPC.SetTextSize(0.035);
TLatex laser;
laser.SetTextSize(42);
laser.SetTextAlign(12);
laser.SetTextSize(0.035);
TLatex date;
date.SetTextSize(35);
date.SetTextAlign(12);
date.SetTextSize(0.035);
TCanvas *c1 = new TCanvas("c1","",1000,1000);
c1->SetTopMargin(0.055);
c1->SetRightMargin(0.2f);
c1->SetLeftMargin(0.15);
//cout << "label size: " << h->GetXaxis()->GetLabelSize() << endl;
h->GetXaxis()->SetLabelSize(0.04);
h->GetZaxis()->SetMaxDigits(2);
h->GetZaxis()->SetTitleOffset(1.4);
h->Draw("COLZ");
//gr->Draw("PSAME");
sPHENIX.DrawLatexNDC(0.175,0.915,"#bf{#it{sPHENIX}} Preliminary");
laser.DrawLatexNDC(0.175,0.885,"Diffuse Laser Test");
TPC.DrawLatexNDC(0.175,0.85,"TPC hits sector 23 R2 south");
date.DrawLatexNDC(0.67,0.97,"#it{08/30/2023}");
//Run11011 sector18 south hits, 1k events
//TPaveText *hTitle = new TPaveText(0.25,0.92,0.75,0.98,"NDC");
//hTitle->SetFillStyle(0);
//hTitle->SetBorderSize(0);
//hTitle->SetTextFont(42);
//hTitle->SetTextSize(0.05);
//hTitle->AddText("Run11011 sector18 R2 south hits, 1k events");
//hTitle->AddText("Run11011 sector23 R2 south hits, 1k events");
//hTitle->Draw("same");
c1->SaveAs("Run11011_ebdc06_hits_truth_new.svg");
c1->SaveAs("Run11011_ebdc06_hits_truth_new.png");
}