55 double phi0 = 91.0*phi90 - 90.0*phi91;
56 double phi127 = phi0 + 127.0*(phi91-phi90);
58 double BIN_FACTOR = 10.0;
59 double dPhi_BIN = (phi91-phi90)/BIN_FACTOR;
61 double min = phi0 - dPhi_BIN/2.0;
62 double max = phi127 + dPhi_BIN/2.0;
63 int N_BIN = 127*BIN_FACTOR;
67 BH_Q =
new TH1D(
"BH_Q",
"BH_Q", 256, -0.5, 2047.5);
68 BH_Size =
new TH1D(
"BH_Size",
"BH_Size", 21, -0.5, 20.5);
69 BH_QvsSize =
new TH2D(
"BH_QvsSize",
"BH_QvsSize", 256, -0.5, 2047.5, 21, -0.5, 20.5);
70 BH_PhiTic =
new TH1D(
"BH_PhiTic",
"BH_PhiTic", 2*N_BIN, min, max);
71 BH_PhivsR =
new TH2D(
"BH_PhivsR",
"BH_PhivsR", N_BIN, min, max, 16, -0.5, 15.5);
72 BH_Tmax =
new TH1D(
"BH_Tmax",
"BH_Tmax", 300, -5.0, 30.0);
73 BH_Tdiff =
new TH1D(
"BH_Tdiff",
"BH_Tdiff", 20000, -30.0, 30.0);
76 BH_5Residual =
new TH1D(
"BH_5Residual",
"BH_5Residual", 200, -1000.0, 1000.0);
77 BH_5Residual_vsPhi =
new TH2D(
"BH_5Residual_vsPhi",
"BH_5Residual_vsPhi", (
int)(0.2/dPhi_BIN), 1.50, 1.66, 200, -1300.0, 1300.0);
78 BH_5Residual_PC =
new TH1D(
"BH_5Residual_PC",
"BH_5Residual_PC", 200, -1000.0, 1000.0);
79 BH_5Residual_vsPhi_PC =
new TH2D(
"BH_5Residual_vsPhi_PC",
"BH_5Residual_vsPhi_PC", (
int)(0.2/dPhi_BIN), 1.53, 1.63, 200, -1000.0, 1000.0);
80 BH_5Efficiency =
new TH1D(
"BH_5Efficiency",
"BH_5Efficiency", 2, 0, 2);
84 for (
int i=1;
i<15;
i++)
86 sprintf(
name,
"BH_Residual_%d",
i);
88 sprintf(
name,
"BH_Residual_vsPhi_%d",
i);
90 sprintf(
name,
"BH_Residual_PC_%d",
i);
92 sprintf(
name,
"BH_Residual_vsPhi_PC_%d",
i);
94 sprintf(
name,
"BH_Efficiency_%d",
i);
112 for (
int i=1;
i<15;
i++)
132 double RadiusValue[16];
133 for (
int k=0;
k<16;
k++) { RadiusValue[
k] = Tree->
theZigzags[
k]->RCenter(); }
136 for (
int i=0;
i<
Nr;
i++)
141 double Phi = Tree->
theBlobs[
i][
j]->CentroidP();
144 int numZigs = Tree->
theBlobs[
i][
j]->numZigs();
154 double TMAX = Tree->
theBlobs[
i][0]->maxT();
156 for (
int k=0;
k< Tree->
theBlobs[
i][0]->manyZigs.size();
k++)
170 double X4 = Tree->
theBlobs[3][0]->CentroidX(), Y4 = Tree->
theBlobs[3][0]->CentroidY();
171 double X6 = Tree->
theBlobs[5][0]->CentroidX(), Y6 = Tree->
theBlobs[5][0]->CentroidY();
173 double x5a, y5a, x5b, y5b;
174 int found =
line_circle(X4, Y4, X6, Y6, RadiusValue[4], x5a, y5a, x5b, y5b);
178 double X5p = x5a, Y5p = y5a;
181 X5p = x5b; Y5p = y5b;
184 double Phi5p = atan2(Y5p, X5p);
185 double Phi5a = Tree->
theBlobs[4][0]->CentroidP();
186 double Residual5 = Phi5a - Phi5p;
197 if ( (Tree->
theBlobs[3][0]->CentroidP() >= 1.53) && (Tree->
theBlobs[3][0]->CentroidP() <= 1.63) &&
198 (Tree->
theBlobs[5][0]->CentroidP() >= 1.53) && (Tree->
theBlobs[5][0]->CentroidP() <= 1.63) )
205 double X4 = Tree->
theBlobs[3][0]->CentroidX(), Y4 = Tree->
theBlobs[3][0]->CentroidY();
206 double X6 = Tree->
theBlobs[5][0]->CentroidX(), Y6 = Tree->
theBlobs[5][0]->CentroidY();
208 double x5a, y5a, x5b, y5b;
209 int found =
line_circle(X4, Y4, X6, Y6, RadiusValue[4], x5a, y5a, x5b, y5b);
213 double X5p = x5a, Y5p = y5a;
216 X5p = x5b; Y5p = y5b;
219 double Phi5p = atan2(Y5p, X5p);
220 double Phi5a = Tree->
theBlobs[4][0]->CentroidP();
221 double Residual5 = Phi5a - Phi5p;
242 for (
int i=1;
i<15;
i++)
248 double Xpre = Tree->
theBlobs[
i-1][0]->CentroidX(), Ypre = Tree->
theBlobs[
i-1][0]->CentroidY();
249 double Xpost = Tree->
theBlobs[
i+1][0]->CentroidX(), Ypost = Tree->
theBlobs[
i+1][0]->CentroidY();
251 double xia, yia, xib, yib;
252 int found =
line_circle(Xpre, Ypre, Xpost, Ypost, RadiusValue[
i], xia, yia, xib, yib);
256 double Xip = xia, Yip = yia;
257 if (yib > 0) { Xip = xib; Yip = yib; }
259 double Phi_ip = atan2(Yip, Xip);
260 double Phi_ia = Tree->
theBlobs[
i][0]->CentroidP();
261 double Residuali = Phi_ia - Phi_ip;
272 double PC_LOW = 1.53;
273 double PC_HIGH = 1.63;
274 if ( (Tree->
theBlobs[
i-1][0]->CentroidP() >= PC_LOW) && (Tree->
theBlobs[
i-1][0]->CentroidP() <= PC_HIGH) &&
275 (Tree->
theBlobs[
i+1][0]->CentroidP() >= PC_LOW) && (Tree->
theBlobs[
i+1][0]->CentroidP() <= PC_HIGH) )
282 double Xpre = Tree->
theBlobs[
i-1][0]->CentroidX(), Ypre = Tree->
theBlobs[
i-1][0]->CentroidY();
283 double Xpost = Tree->
theBlobs[
i+1][0]->CentroidX(), Ypost = Tree->
theBlobs[
i+1][0]->CentroidY();
285 double xia, yia, xib, yib;
286 int found =
line_circle(Xpre, Ypre, Xpost, Ypost, RadiusValue[
i], xia, yia, xib, yib);
290 double Xip = xia, Yip = yia;
291 if (yib > 0) { Xip = xib; Yip = yib; }
293 double Phi_ip = atan2(Yip, Xip);
294 double Phi_ia = Tree->
theBlobs[
i][0]->CentroidP();
295 double Residuali = Phi_ia - Phi_ip;
318 int line_circle(
double m,
double b,
double r,
double& Xi1,
double& Yi1,
double& Xi2,
double& Yi2)
320 return line_circle( 0.0, b, 1.0, (m+b), r, Xi1, Yi1, Xi2, Yi2);
324 int line_circle(
double X1,
double Y1,
double X2,
double Y2,
double r,
double& Xi1,
double& Yi1,
double& Xi2,
double& Yi2)
328 double dr = sqrt(dx*dx + dy*dy);
329 double D = X1*Y2 - X2*Y1;
331 double DELTA = r*r*dr*dr - D*D;
332 if (DELTA < 0)
return 0;
336 double sign = (dy > 0) - (dy < 0);
342 double sign = (dy > 0) - (dy < 0);
343 Xi1 = ( D*dy + sign*dx*sqrt(DELTA))/(dr*dr);
344 Yi1 = (-D*dx + abs(dy)*sqrt(DELTA))/(dr*dr);
345 Xi2 = ( D*dy - sign*dx*sqrt(DELTA))/(dr*dr);
346 Yi2 = (-D*dx - abs(dy)*sqrt(DELTA))/(dr*dr);