22 const double M_PI = 3.1415926;
24 TChain * trk =
new TChain(
"trk");
25 trk->Add(
"hough_hist_test.root");
30 Int_t trk_trackId[100];
34 Double_t trk_phi0[100];
35 Double_t trk_kappa[100];
37 Double_t trk_tanl[100];
47 Double_t trk_truth_dr[100];
48 Double_t trk_truth_phi0[100];
49 Double_t trk_truth_kappa[100];
50 Double_t trk_truth_dz[100];
51 Double_t trk_truth_tanl[100];
52 Double_t trk_truth_Xc[100];
53 Double_t trk_truth_Yc[100];
54 Double_t trk_truth_R[100];
55 Double_t trk_truth_cosTheta[100];
56 Double_t trk_truth_p[100];
57 Double_t trk_truth_pt[100];
58 Double_t trk_truth_px[100];
59 Double_t trk_truth_py[100];
60 Double_t trk_truth_pz[100];
61 Int_t trk_truth_q[100];
64 trk->SetBranchAddress(
"trk_run",&trk_run);
65 trk->SetBranchAddress(
"trk_evt",&trk_evt);
66 trk->SetBranchAddress(
"trk_ntrk",&trk_ntrk);
67 trk->SetBranchAddress(
"trk_trackId",trk_trackId);
68 trk->SetBranchAddress(
"trk_nhop",trk_nhop);
69 trk->SetBranchAddress(
"trk_nhot",trk_nhot);
70 trk->SetBranchAddress(
"trk_dr",trk_dr);
71 trk->SetBranchAddress(
"trk_phi0",trk_phi0);
72 trk->SetBranchAddress(
"trk_kappa",trk_kappa);
73 trk->SetBranchAddress(
"trk_dz",trk_dz);
74 trk->SetBranchAddress(
"trk_tanl",trk_tanl);
75 trk->SetBranchAddress(
"trk_Xc",trk_Xc);
76 trk->SetBranchAddress(
"trk_Yc",trk_Yc);
77 trk->SetBranchAddress(
"trk_R",trk_R);
78 trk->SetBranchAddress(
"trk_p",trk_p);
79 trk->SetBranchAddress(
"trk_pt",trk_pt);
80 trk->SetBranchAddress(
"trk_px",trk_px);
81 trk->SetBranchAddress(
"trk_py",trk_py);
82 trk->SetBranchAddress(
"trk_pz",trk_pz);
83 trk->SetBranchAddress(
"trk_q",trk_q);
84 trk->SetBranchAddress(
"trk_truth_dr",trk_truth_dr);
85 trk->SetBranchAddress(
"trk_truth_phi0",trk_truth_phi0);
86 trk->SetBranchAddress(
"trk_truth_kappa",trk_truth_kappa);
87 trk->SetBranchAddress(
"trk_truth_dz",trk_truth_dz);
88 trk->SetBranchAddress(
"trk_truth_tanl",trk_truth_tanl);
89 trk->SetBranchAddress(
"trk_truth_Xc",trk_truth_Xc);
90 trk->SetBranchAddress(
"trk_truth_Yc",trk_truth_Yc);
91 trk->SetBranchAddress(
"trk_truth_R",trk_truth_R);
92 trk->SetBranchAddress(
"trk_truth_cosTheta",trk_truth_cosTheta);
93 trk->SetBranchAddress(
"trk_truth_p",trk_truth_p);
94 trk->SetBranchAddress(
"trk_truth_pt",trk_truth_pt);
95 trk->SetBranchAddress(
"trk_truth_px",trk_truth_px);
96 trk->SetBranchAddress(
"trk_truth_py",trk_truth_py);
97 trk->SetBranchAddress(
"trk_truth_pz",trk_truth_pz);
98 trk->SetBranchAddress(
"trk_truth_q",trk_truth_q);
122 gStyle->SetOptFit(0111);
123 TChain * hit =
new TChain(
"hit");
124 hit->Add(
"hough_hist_test.root");
129 Int_t hit_hitid[1000];
130 Int_t hit_layer[1000];
131 Int_t hit_wire[1000];
132 Double_t hit_x[1000];
133 Double_t hit_y[1000];
134 Double_t hit_z[1000];
135 Double_t hit_driftdist[1000];
136 Double_t hit_drifttime[10000];
137 Int_t hit_flag[1000];
138 Double_t hit_truth_x[1000];
139 Double_t hit_truth_y[1000];
140 Double_t hit_truth_z[1000];
141 Double_t hit_truth_drift[1000];
142 Int_t hit_truth_ambig[1000];
145 hit->SetBranchAddress(
"hit_run",&hit_run);
146 hit->SetBranchAddress(
"hit_evt",&hit_evt);
147 hit->SetBranchAddress(
"hit_nhit",&hit_nhit);
148 hit->SetBranchAddress(
"hit_hitid",hit_hitid);
149 hit->SetBranchAddress(
"hit_layer",hit_layer);
150 hit->SetBranchAddress(
"hit_wire",hit_wire);
151 hit->SetBranchAddress(
"hit_x",hit_x);
152 hit->SetBranchAddress(
"hit_y",hit_y);
153 hit->SetBranchAddress(
"hit_z",hit_z);
154 hit->SetBranchAddress(
"hit_driftdist",hit_driftdist);
155 hit->SetBranchAddress(
"hit_drifttime",hit_drifttime);
156 hit->SetBranchAddress(
"hit_flag",hit_flag);
157 hit->SetBranchAddress(
"hit_truth_x",hit_truth_x);
158 hit->SetBranchAddress(
"hit_truth_y",hit_truth_y);
159 hit->SetBranchAddress(
"hit_truth_z",hit_truth_z);
160 hit->SetBranchAddress(
"hit_truth_drift",hit_truth_drift);
161 hit->SetBranchAddress(
"hit_truth_ambig",hit_truth_ambig);
185 TFile* f = TFile::Open(
"hough_hist_test.root");
186 TChain * hot =
new TChain(
"hot");
187 hot->Add(
"hough_hist_test.root");
193 Int_t hot_hitid[1000];
194 Int_t hot_layer[1000];
195 Int_t hot_wire[1000];
196 Double_t hot_x[1000];
197 Double_t hot_y[1000];
198 Double_t hot_z[1000];
199 Double_t hot_drift[1000];
200 Int_t hot_flag[1000];
201 Double_t hot_deltaD[1000];
202 Double_t hot_truth_x[1000];
203 Double_t hot_truth_y[1000];
204 Double_t hot_truth_z[1000];
205 Double_t hot_truth_drift[1000];
206 Int_t hot_truth_ambig[1000];
209 hot->SetBranchAddress(
"hot_run",&hot_run);
210 hot->SetBranchAddress(
"hot_evt",&hot_evt);
211 hot->SetBranchAddress(
"hot_trk",&hot_trk);
212 hot->SetBranchAddress(
"hot_nhot",&hot_nhot);
213 hot->SetBranchAddress(
"hot_hitid",hot_hitid);
214 hot->SetBranchAddress(
"hot_layer",hot_layer);
215 hot->SetBranchAddress(
"hot_wire",hot_wire);
216 hot->SetBranchAddress(
"hot_x",hot_x);
217 hot->SetBranchAddress(
"hot_y",hot_y);
218 hot->SetBranchAddress(
"hot_z",hot_z);
219 hot->SetBranchAddress(
"hot_drift",hot_drift);
220 hot->SetBranchAddress(
"hot_flag",hot_flag);
221 hot->SetBranchAddress(
"hot_deltaD",hot_deltaD);
222 hot->SetBranchAddress(
"hot_truth_x",hot_truth_x);
223 hot->SetBranchAddress(
"hot_truth_y",hot_truth_y);
224 hot->SetBranchAddress(
"hot_truth_z",hot_truth_z);
225 hot->SetBranchAddress(
"hot_truth_drift",hot_truth_drift);
226 hot->SetBranchAddress(
"hot_truth_ambig",hot_truth_ambig);
232 Long64_t
nentries = trk->GetEntries();
237 for (Long64_t i=event; i<
event+1;i++)
239 nbytes += trk->GetEntry(i);
240 cout<<trk_evt<<
" "<<trk_ntrk<<endl;
241 for(
int j=0;j<trk_ntrk;j++){
242 TAxis *x_axis,*y_axis;
255 Long64_t
nentries = hit->GetEntries();
257 for (Long64_t ii=0; ii<
nentries;ii++)
261 nbytes += hit->GetEntry(ii);
262 if(hit_evt!=trk_evt)
continue;
263 TH2D* hough =
new TH2D(
"hough",
"hough",x_bin,0,x_max,y_bin,-y_max,y_max);
264 TH2D *houghhit[1000];
267 for(
int jj=0;jj<hit_nhit;jj++){
268 if(hit_flag[jj] !=0)
continue;
274 ssname <<
"layer:"<<hit_layer[jj]<<
" ,wire"<<hit_wire[jj];
275 sname = ssname.str();
276 name = sname.c_str();
277 houghhit[ihit] =
new TH2D(name,name,x_bin,0,x_max,y_bin,-y_max,y_max);
278 fill_histogram(hit_x[jj],hit_y[jj],hit_driftdist[jj],x_bin*2,houghhit[ihit]);
279 hough->Add(houghhit[ihit]);
291 hough->GetMaximumBin(binx,biny,binz);
292 double theta = hough->GetXaxis()->GetBinCenter(binx);
293 double rho = hough->GetYaxis()->GetBinCenter(biny);
294 double t = trk_phi0[j];
295 double r = trk_kappa[j]/333.567;
299 cout<<
" rec: "<<
t<<setw(15)<<r<<endl;
300 cout<<
" map: "<<theta<<setw(15)<<rho<<endl;
301 double dtheta = fabs(theta-
t);
302 double drho = fabs(rho-r);
303 double theta_bin =
M_PI/100.;
304 double rho_bin = 0.1/100.;
305 cout<<
"diff: "<<dtheta<<setw(15)<<drho<<endl;
306 cout<<
"nbin: "<<dtheta/theta_bin<<setw(15)<<drho/rho_bin<<endl;
307 cout<<
"rec bin: "<<
t/theta_bin<<setw(15)<<r/rho_bin<<endl;
308 cout<<
"map bin: "<<theta/theta_bin<<setw(15)<<rho/rho_bin<<endl;
313 for(
int ihit=0;ihit<nhit;ihit++){
315 delete houghhit[ihit];
317 double Xc =
cos(theta)/rho;
318 double Yc =
sin(theta)/rho;
319 double Rc = 1./fabs(rho);
320 double d0 = sqrt( Xc*Xc + Yc*Yc )-Rc;
321 double phi0 = atan2(Yc,Xc)+
M_PI/2.;
326 while(phi0<0)phi0+=2*
M_PI;
327 double kappa = -omega*333.567;
329 cout<<hit_evt<<
" "<<Xc<<
" "<<Yc<<
" "<<Rc<<endl;
330 cout<<trk_evt<<
" "<<trk_Xc[j]<<
" "<<trk_Yc[j]<<
" "<<trk_R[j]<<endl;
332 for(
int jj=0;jj<hit_nhit;jj++){
333 if(hit_flag[jj] !=0)
continue;
334 if(hit_layer[jj] <3){
335 double r_cgem = sqrt(hit_x[jj]*hit_x[jj]+hit_y[jj]*hit_y[jj]);
337 double phih_cluster = atan2(hit_y[jj],hit_x[jj]);
338 double dphi = phih_cluster - phi_cross;
341 deltaD = r_cgem*dphi;
343 double l1l2 = sqrt((hit_x[jj]-Xc)*(hit_x[jj]-Xc)+(hit_y[jj]-Yc)*(hit_y[jj]-Yc));
344 if(l1l2>Rc)deltaD = l1l2-Rc-hit_driftdist[jj];
345 else deltaD = l1l2-Rc+hit_driftdist[jj];
348 Long64_t
nentries = hot->GetEntries();
350 for (Long64_t iii=0; iii<
nentries;iii++)
354 nbytes += hot->GetEntry(iii);
355 if(hot_evt!=hit_evt)
continue;
356 for(
int jjj=0;jjj<hot_nhot;jjj++){
357 if(hot_flag[jjj] !=0)
continue;
358 if(hot_layer[jjj]==hit_layer[jj]&&hot_wire[jjj]==hit_wire[jj]&&hot_hitid[jjj]==hit_hitid[jj]){
359 cout<<setw(5)<<hot_layer[jjj]<<setw(15)<<deltaD<<setw(15)<<hot_deltaD[jjj]<<setw(15)<<deltaD-hot_deltaD[jjj]<<endl;
371 if(nbin<500)
bin = 50;
372 else if(nbin<1000)
bin =100;
373 else if(nbin<2000)
bin =100;
374 else if(nbin<5000)
bin =500;
387 const double M_PI = 3.1415926;
389 double phi_center = atan2(y_center,x_center);
390 double r_center = sqrt(x_center*x_center+y_center*y_center);
391 if(charge==0)
return 9999;
392 while(phi_center<0) phi_center += 2*
M_PI;
393 while(phi_center>2*
M_PI) phi_center -= 2*
M_PI;
394 if(r_center<r_cylinder/2)
return -9999;
395 double dphi = acos( r_cylinder/(2*r_center) );
396 if(charge<0) phi = phi_center + dphi;
397 else phi = phi_center - dphi;
398 while(phi<0) phi += 2*
M_PI;
405 const double M_PI = 3.1415926;
406 double U = 2*
x/(
x*
x+y*y-r*r);
407 double V = 2*y/(
x*
x+y*y-r*r);
408 double R = 2*r/(
x*
x+y*y-r*r);
409 double delta_phi = 2.*
M_PI/nbin;
410 double phi = -delta_phi/2;
411 for(
int i =0; i<nbin; i++){
413 double u = U + R*
cos(phi);
414 double v = V + R*
sin(phi);
415 double normal = (
v-V)/(u-U);
416 double k = -1./normal;
418 double u_cross = -b/(k+1/k);
419 double v_cross = b/(1+k*k);
421 double rho=sqrt(u_cross*u_cross+v_cross*v_cross);
422 double theta=atan2(v_cross,u_cross);
423 double slant = V*
cos(theta)-U*
sin(theta);
424 if( fabs(slant)<0.03 )
continue;
429 if( normal ==0 &&
x>0) {
433 if( normal ==0 &&
x<0) {
437 if(fabs(rho)>0.1)
continue;
438 hough->Fill(theta,rho);
*******INTEGER m_nBinMax INTEGER m_NdiMax !No of bins in histogram for cell exploration division $ !Last vertex $ !Last active cell $ !Last cell in buffer $ !No of sampling when dividing cell $ !No of function total $ !Flag for random ceel for $ !Flag for type of for WtMax $ !Flag which decides whether vertices are included in the sampling $ entire domain is hyp !Maximum effective eevents per bin
double sin(const BesAngle a)
double cos(const BesAngle a)
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
void fill_histogram(double x, double y, double r, int nbin, TH2D *hough)
double intersect_cylinder(int charge, double x_center, double y_center, double r_cylinder)