-
Notifications
You must be signed in to change notification settings - Fork 0
/
graph_tiles55.c
203 lines (160 loc) · 5.24 KB
/
graph_tiles55.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
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
void graph_tiles55() {
TCanvas *c1 = new TCanvas("plot","plot",200,10,700,500);
c1->SetGrid();
//////////////////////////////////////////////////// 1 = data, 2 = 380, 3 = 190, 4 = 140, 5 = 60, 6 = 38 /////////////////////////////////////////////////////////////
//////////////////////////////////////////////////// 2 = 60 big trigger, 3 = 60 small trigger /////////////////////////////////////////////////////////////
const Int_t n = 1296;
Int_t n2 = 75;
Float_t x2[n];
Float_t y2[n];
Float_t a2[n];
Float_t ea2[n];
Float_t x3[n];
Float_t y3[n];
Float_t a3[n];
Float_t ea3[n];
Float_t x2f[n2];
Float_t a2f[n2];
Float_t ea2f[n2];
Float_t x3f[n2];
Float_t a3f[n2];
Float_t ea3f[n2];
Float_t errors[n2];
Float_t errors_x[n2];
for ( int i = 0; i < n; i++ ) x2[ i ] = 0;
for ( int i = 0; i < n; i++ ) y2[ i ] = 0;
for ( int i = 0; i < n; i++ ) a2[ i ] = 0;
for ( int i = 0; i < n; i++ ) ea2[ i ] = 0;
for ( int i = 0; i < n; i++ ) x3[ i ] = 0;
for ( int i = 0; i < n; i++ ) y3[ i ] = 0;
for ( int i = 0; i < n; i++ ) a3[ i ] = 0;
for ( int i = 0; i < n; i++ ) ea3[ i ] = 0;
for ( int i = 0; i < n2; i++ ) x2f[ i ] = 0;
for ( int i = 0; i < n2; i++ ) a2f[ i ] = 0;
for ( int i = 0; i < n2; i++ ) ea2f[ i ] = 0;
for ( int i = 0; i < n2; i++ ) x3f[ i ] = 0;
for ( int i = 0; i < n2; i++ ) a3f[ i ] = 0;
for ( int i = 0; i < n2; i++ ) ea3f[ i ] = 0;
for ( int i = 0; i < n2; i++ ) errors[ i ] = 0.0;
for ( int i = 0; i < n2; i++ ) errors_x[ i ] = 0.75; // sqrt(1.5);
FILE *file2 = fopen("mc_60_bt.txt", "r");
if ( !(long)file2 ) return;
FILE *file3 = fopen("mc_60_st.txt", "r");
if ( !(long)file3 ) return;
for ( int i = 0; i < n; i++ ) {
fscanf( file2, "%f %f %f %f\n", &x2[i], &y2[i], &a2[i], &ea2[i]);
if ( feof( file2 ) ) break;
}
for ( int i = 0; i < n; i++ ) {
fscanf( file3, "%f %f %f %f\n", &x3[i], &y3[i], &a3[i], &ea3[i]);
if ( feof( file3 ) ) break;
}
printf( "\n" );
printf( "\n" );
printf( "\n" );
cout << "mc_60_bt:" << endl;
for (int i = 0; i < n; i++) {
printf( " %f %f %f %f\n", x2[i], y2[i], a2[i], ea2[i] );
}
cout << "mc_60_st:" << endl;
for (int i = 0; i < n; i++) {
printf( " %f %f %f %f\n", x3[i], y3[i], a3[i], ea3[i] );
}
printf( "\n" );
printf( "\n" );
printf( "\n" );
int i2 = 0;
int i3 = 0;
printf( "\n" );
printf( "\n" );
printf( "\n" );
int count2 = 0;
printf( "MC_60_BT:\n" );
for (int i = 0; i < n; i++) {
if ( y2[ i ] == 1.0 ) { // abs( y2[ i ] ) == 1.0
printf( "%f %f %f %f\n", x2[i], y2[i], a2[i], ea2[i] );
count2++;
x2f[ i2 ] = x2[ i ];
a2f[ i2 ] = a2[ i ];
ea2f[ i2 ] = ea2[ i ];
i2++;
}
}
printf( "count2 = %d\n", count2 );
printf( "i2 = %d\n", i2 );
printf( "\n" );
printf( "\n" );
printf( "\n" );
int count3 = 0;
printf( "MC_60_ST:\n" );
for (int i = 0; i < n; i++) {
if ( y3[ i ] == 1.0 ) { // abs( y3[ i ] ) == 1.0
printf( "%f %f %f %f\n", x3[i], y3[i], a3[i], ea3[i] );
count3++;
x3f[ i3 ] = x3[ i ];
a3f[ i3 ] = a3[ i ];
ea3f[ i3 ] = ea3[ i ];
i3++;
}
}
printf( "count3 = %d\n", count3 );
printf( "i3 = %d\n", i3 );
printf( "\n" );
printf( "\n" );
printf( "\n" );
char fname[ 100 ];
for ( int i = 0; i < 100; i++ ) fname[ i ] = 0;
n2 = n2 - 39;
cout << "mc_60_bt:" << endl;
for (int i = 0; i < n2; i++) {
printf( " %d %f %f %f\n", i + 1, x2f[i], a2f[i], ea2f[i] );
}
cout << "mc_60_st:" << endl;
for (int i = 0; i < n2; i++) {
printf( " %d %f %f %f\n", i + 1, x3f[i], a3f[i], ea3f[i] );
}
printf( "\n" );
printf( "\n" );
printf( "\n" );
cout << "mc_60_bt:" << endl;
for (int i = 0; i < n2; i++) {
x2f[i] = x2f[i] + 27.5;
printf( " %d %f %f %f\n", i + 1, x2f[i], a2f[i], ea2f[i] );
}
cout << "mc_60_st:" << endl;
for (int i = 0; i < n2; i++) {
x3f[i] = x3f[i] + 27.5;
printf( " %d %f %f %f\n", i + 1, x3f[i], a3f[i], ea3f[i] );
}
printf( "\n" );
printf( "\n" );
printf( "\n" );
TGraphErrors *agr;
TGraphErrors *bgr;
c1->cd();
agr = new TGraphErrors( n2, x2f, a2f, errors_x, ea2f );
bgr = new TGraphErrors( n2, x3f, a3f, errors_x, ea3f );
agr->GetYaxis()->SetTitle("Light yield, p.e.");
agr->GetXaxis()->SetTitle("Position, mm");
sprintf( fname, "BC-408, tile wrapped in foil, 55 mm" );
agr->GetYaxis()->SetRangeUser(0.0, 30.0);
agr->SetTitle(fname);
agr->SetMarkerColor(kRed);
agr->SetLineColor(kRed);
agr->SetLineWidth(3);
agr->SetFillColor(kRed);
agr->SetMarkerStyle(20);
agr->Draw("AP");
bgr->SetMarkerColor(kBlue);
bgr->SetLineColor(kBlue);
bgr->SetLineWidth(3);
bgr->SetFillColor(kBlue);
bgr->SetMarkerStyle(20);
bgr->Draw("P SAME");
c1->Update();
TLegend *lsc1 = new TLegend(0.55,0.62,0.90,0.92);
lsc1->AddEntry(agr,"mc, abs = 60 cm, bt","pl");
lsc1->AddEntry(bgr,"mc, abs = 60 cm, st","pl");
c1->cd();
lsc1->Draw();
}