19 #include "StEStructPairLUT.h"
39 mPi = TMath::ACos(-1);
43 for (
int i=0;i<4;i++) {
47 for (
int ir2=0;ir2<10;ir2++) {
48 for (
int ir1=0;ir1<=ir2;ir1++) {
56 StEStructPairLUT::~StEStructPairLUT() {
57 for (
int i=0;i<4;i++) {
61 for (
int ir2=0;ir2<10;ir2++) {
62 for (
int ir1=0;ir1<=ir2;ir1++) {
69 double StEStructPairLUT::s (
double Ref,
double Rad,
double eta) {
70 double l = lambda(eta);
71 return Rad*TMath::ACos(1-0.5*TMath::Power(Ref/Rad,2))/TMath::Cos(l);
73 double StEStructPairLUT::alpha (
double Ref,
double Rad,
double eta,
double sign) {
74 double l = lambda(eta);
75 double arc = s(Ref,Rad,eta);
76 return sign*arc*TMath::Cos(l)/Rad;
78 double StEStructPairLUT::lambda (
double eta) {
79 double theta = 2*atan(TMath::Exp(-eta));
80 return 0.5*3.1415926 - theta;
82 double StEStructPairLUT::delZ (
double Ref) {
83 double l1 = lambda(mEta1);
84 double l2 = lambda(mEta2);
85 double s1 = s(Ref,mR1,mEta1);
86 double s2 = s(Ref,mR2,mEta2);
87 return s1*TMath::Sin(l1) - s2*TMath::Sin(l2);
89 double StEStructPairLUT::delXY (
double Ref) {
93 double alpha1 = alpha(Ref,mR1,mEta1,mSign1);
94 double alpha2 = alpha(Ref,mR2,mEta2,mSign2);
95 double x1 = +mSign1*mR1*(TMath::Sin(mPhi1)-TMath::Sin(mPhi1-alpha1));
96 double y1 = -mSign1*mR1*(TMath::Cos(mPhi1)-TMath::Cos(mPhi1-alpha1));
97 double x2 = +mSign2*mR2*(TMath::Sin(mPhi2)-TMath::Sin(mPhi2-alpha2));
98 double y2 = -mSign2*mR2*(TMath::Cos(mPhi2)-TMath::Cos(mPhi2-alpha2));
99 double d = TMath::Sqrt(TMath::Power(x1-x2,2)+TMath::Power(y1-y2,2));
100 mDPhi_Ref = x1*y2-x2*y1;
102 alpha1 = alpha(50,mR1,mEta1,mSign1);
103 alpha2 = alpha(50,mR2,mEta2,mSign2);
104 mX1_50 = +mSign1*mR1*(TMath::Sin(mPhi1)-TMath::Sin(mPhi1-alpha1));
105 mY1_50 = -mSign1*mR1*(TMath::Cos(mPhi1)-TMath::Cos(mPhi1-alpha1));
106 mX2_50 = +mSign2*mR2*(TMath::Sin(mPhi2)-TMath::Sin(mPhi2-alpha2));
107 mY2_50 = -mSign2*mR2*(TMath::Cos(mPhi2)-TMath::Cos(mPhi2-alpha2));
108 mDPhi_50 = mX1_50*mY2_50-mX2_50*mY1_50;
109 if (mDPhi_50*mDPhi_Ref < 0) {
115 void StEStructPairLUT::initHists() {
116 for (
int i=0;i<4;i++) {
121 char bufferPhi[1024];
122 char bufferEta[1024];
123 sprintf(bufferPhi,
"#phi_{1} (#phi_{2}=%f)",mPhi2);
124 sprintf(bufferEta,
"#eta_{1} (#eta_{2}=%f)",mEta2);
125 mDists[0] =
new TH2D(
"dists0",
"#delta#phi vs. Reference radius",nDelPhi,mPhi2-mDelPhi,mPhi2+mDelPhi, 100,50.0,200.0);
126 mDists[0]->GetXaxis()->SetTitle(bufferPhi);
127 mDists[0]->GetYaxis()->SetTitle(
"R_{ref}");
128 mDists[0]->SetMaximum(+5);
129 mDists[0]->SetMinimum(-5);
130 mDists[1] =
new TH2D(
"dists1",
"#delta#eta vs. Reference radius",nDelEta,mEta2-mDelEta,mEta2+mDelEta, 100,50.0,200.0);
131 mDists[1]->GetXaxis()->SetTitle(bufferEta);
132 mDists[1]->GetYaxis()->SetTitle(
"R_{ref}");
133 mDists[1]->SetMaximum(+5);
134 mDists[1]->SetMinimum(-5);
135 mDists[2] =
new TH2D(
"dists2",
"#delta#phi vs. #delta#eta: |#delta_{XY}| < 5cm and |#delta_{Z}| < 5cm",nDelPhi,-mDelPhi,+mDelPhi, nDelEta,-mDelEta,+mDelEta);
136 mDists[2]->GetXaxis()->SetTitle(
"#phi_{1}-#phi_{2}");
137 mDists[2]->GetYaxis()->SetTitle(
"#eta_{1}-#eta_{2}");
138 mDists[3] =
new TH2D(
"dists3",
"#delta#phi vs. #delta#eta: |#delta_{Z}| < 5cm and tracks cross in #phi between 50cm and R_{ref}",nDelPhi,-mDelPhi,+mDelPhi, nDelEta,-mDelEta,+mDelEta);
139 mDists[3]->GetXaxis()->SetTitle(
"#phi_{1}-#phi_{2}");
140 mDists[3]->GetYaxis()->SetTitle(
"#eta_{1}-#eta_{2}");
143 char buf1[1024], buf2[1024];
144 for (
int ir2=0;ir2<10;ir2++) {
145 for (
int ir1=0;ir1<=ir2;ir1++) {
146 sprintf(buf1,
"LS_%i_%i",ir1,ir2);
147 sprintf(buf2,
"cuts for LS, rad1 bin %i, rad2 bin %i",ir1,ir2);
148 if (mCutLS[iR])
delete mCutLS[iR];
151 mCutLS[iR] =
new TH2F(buf1,buf2, 2+nDelPhi,-2*mDelPhi/nDelPhi,mDelPhi, 1+2*nDelEta,-mDelEta,+mDelEta);
152 sprintf(buf1,
"US_%i_%i",ir1,ir2);
153 sprintf(buf2,
"cuts for US, rad1 bin %i, rad2 bin %i",ir1,ir2);
154 if (mCutUS[iR])
delete mCutUS[iR];
155 mCutUS[iR] =
new TH2F(buf1,buf2, 2+nDelPhi,-2*mDelPhi/nDelPhi,mDelPhi, 1+2*nDelEta,-mDelEta,+mDelEta);
160 void StEStructPairLUT::fillDists() {
161 for (
int i=0;i<4;i++) {
167 double saveEta = mEta1;
168 for (mEta1=mEta2-mDelEta;mEta1<mEta2+mDelEta;mEta1+=2*mDelEta/nDelEta) {
170 for (
double rRef=50;rRef<200;rRef+=150/100.0) {
172 mDists[1]->SetBinContent(ix,iy,dZ);
179 double savePhi = mPhi1;
180 for (mPhi1=mPhi2-mDelPhi;mPhi1<mPhi2+mDelPhi;mPhi1+=2*mDelPhi/nDelPhi) {
182 for (
double rRef=50;rRef<200;rRef+=150/100.0) {
184 mDists[0]->SetBinContent(ix,iy,dXY);
195 for (mPhi1=mPhi2-mDelPhi;mPhi1<mPhi2+mDelPhi;mPhi1+=2*mDelPhi/nDelPhi) {
197 for (
double rRef=65;rRef<200;rRef+=150/100.0) {
198 dXY = mDists[0]->GetBinContent(ix,iy);
199 if (TMath::Abs(dXY) < 5) {
201 for (mEta1=mEta2-mDelEta;mEta1<mEta2+mDelEta;mEta1+=2*mDelEta/nDelEta) {
202 dZ = mDists[1]->GetBinContent(iz,iy);
203 if (TMath::Abs(dZ) < 5) {
204 mDists[2]->Fill(mPhi1-mPhi2,mEta1-mEta2,1.0);
212 for (mEta1=mEta2-mDelEta;mEta1<mEta2+mDelEta;mEta1+=2*mDelEta/nDelEta) {
213 dZ = mDists[1]->GetBinContent(iz,iy);
214 if (TMath::Abs(dZ) < 5) {
215 mDists[3]->Fill(mPhi1-mPhi2,mEta1-mEta2,1);
228 void StEStructPairLUT::integrateEta(TH2F *h) {
240 double savePhi1 = mPhi1;
241 double savePhi2 = mPhi2;
244 for (mPhi2=-1.5*mDelPhi/nDelPhi;mPhi2<mDelPhi;mPhi2+=mDelPhi/nDelPhi) {
246 for (
double rRef=mRRefMin;rRef<mRRefMax;rRef+=150/100.0) {
247 double dXY = delXY(rRef);
248 if (dXY < mDelXYCut) {
249 double saveEta1 = mEta1;
250 double saveEta2 = mEta2;
252 for (mEta2=0;mEta2<1.0;mEta2+=0.1) {
254 for (mEta1=mEta2-mDelEta;mEta1<mEta2+mDelEta;mEta1+=mDelEta/nDelEta) {
255 if (TMath::Abs(mEta1) <= 1) {
256 double dZ = delZ(rRef);
257 if (TMath::Abs(dZ) < mDelZCut) {
258 h->Fill(mPhi2,mEta1-mEta2,1.0);
276 void StEStructPairLUT::fillLUTs() {
279 for (
int ir=9;ir>=0;ir--) {
280 mRad[ir] = 750.0/(ir+0.5);
286 for (
int ir2=0;ir2<10;ir2++) {
287 for (
int ir1=0;ir1<=ir2;ir1++) {
292 integrateEta(mCutLS[iR]);
297 integrateEta(mCutUS[iR]);
302 int StEStructPairLUT::cut(
double curvature1,
double curvature2,
double delPhi,
double delEta) {
307 while (delPhi > +2*mPi) delPhi -= 2*mPi;
308 while (delPhi < -2*mPi) delPhi += 2*mPi;
311 if (TMath::Abs(delEta) > mDelEta)
return 0;
312 if (TMath::Abs(delPhi) > mDelPhi)
return 0;
313 int idEta = int( delEta / (mDelEta/nDelEta) );
314 int idPhi = int( delPhi / (mDelPhi/nDelPhi) );
315 int ir1 = int(750*TMath::Abs(curvature1) -0.5);
316 if (ir1 > 9) ir1 = 9;
317 int ir2 = int(750*TMath::Abs(curvature2) -0.5);
318 if (ir2 > 9) ir2 = 9;
323 if (TMath::Abs(curvature1) < TMath::Abs(curvature2)) {
324 iR = ir2*(ir2+1)/2 + ir1;
325 idEta = nDelEta + idEta;
326 is1 = (curvature1 < 0) ? -1 : 1;
327 is2 = (curvature2 < 0) ? -1 : 1;
329 iR = ir1*(ir1+1)/2 + ir2;
330 idEta = nDelEta - idEta;
332 is1 = (curvature2 < 0) ? -1 : 1;
333 is2 = (curvature1 < 0) ? -1 : 1;
341 return int(mCutLS[iR]->GetBinContent(-idPhi+3,idEta+1));
343 return int(mCutUS[iR]->GetBinContent(idPhi+3,idEta+1));
348 return int(mCutUS[iR]->GetBinContent(-idPhi+3,idEta+1));
350 return int(mCutLS[iR]->GetBinContent(idPhi+3,idEta+1));