4 #include<TApplication.h>
10 #include<TClonesArray.h>
20 #include<TGraphErrors.h>
43 TApplication myapp(
"myapp", 0, 0);
44 cout <<
" lmd online monitoring studies " << endl;
50 const int nmomenta = 1;
51 double momenta[nmomenta] = {1.5};
52 double pixelsize = 80;
55 double ip_width_z = 5.;
57 vector < double >
z; z.push_back(11.2); z.push_back(11.4); z.push_back(11.5); z.push_back(11.6);
59 const double Rmin = 0.035*0.035;
60 const double Rmax = (0.035+0.05)*(0.035+0.05);
63 const double theta_cut_low = 4.;
64 const double theta_cut_high = 8.;
65 vector < double > Rmin_cuts;
66 vector < double > Rmax_cuts;
67 for (
int iplane = 0; iplane < 4; iplane++ ){
68 Rmin_cuts.push_back(theta_cut_low*1e-3*z[iplane]*theta_cut_low*1e-3*z[iplane]);
69 Rmax_cuts.push_back(theta_cut_high*1e-3*z[iplane]*theta_cut_high*1e-3*z[iplane]);
72 TCanvas canvas(
"canvas",
"canvas", 600, 1000);
75 TCanvas canvas_distributions(
"canvas_distributions",
"distributions", 800, 800);
76 canvas_distributions.Divide(2,2);
79 TTree results(
"asymmetry_results",
"Asymmetry results");
80 double offsetx, offsety, tiltx, tilty, momentum,
81 offsetx_lmd, offsety_lmd, tiltx_lmd, tilty_lmd,
82 offsetx_fit, offsety_fit, tiltx_fit, tilty_fit,
83 meanx_0, meany_0, rmsx_0, rmsy_0,
84 meanx_1, meany_1, rmsx_1, rmsy_1,
85 meanx_2, meany_2, rmsx_2, rmsy_2,
86 meanx_3, meany_3, rmsx_3, rmsy_3;
87 int count_0[10] = {0,0,0,0,0,0,0,0,0,0};
88 int count_1[10] = {0,0,0,0,0,0,0,0,0,0};
89 int count_2[10] = {0,0,0,0,0,0,0,0,0,0};
90 int count_3[10] = {0,0,0,0,0,0,0,0,0,0};
93 results.Branch(
"offsetx", &offsetx);
94 results.Branch(
"offsety", &offsety);
95 results.Branch(
"tiltx", &tiltx);
96 results.Branch(
"tilty", &tilty);
97 results.Branch(
"offsetx_lmd", &offsetx_lmd);
98 results.Branch(
"offsety_lmd", &offsety_lmd);
99 results.Branch(
"tiltx_lmd", &tiltx_lmd);
100 results.Branch(
"tilty_lmd", &tilty_lmd);
101 results.Branch(
"momentum", &momentum);
102 results.Branch(
"offsetx_fit", &offsetx_fit);
103 results.Branch(
"offsety_fit", &offsety_fit);
104 results.Branch(
"tiltx_fit", &tiltx_fit);
105 results.Branch(
"tilty_fit", &tilty_fit);
106 results.Branch(
"meanx_0", &meanx_0);
107 results.Branch(
"meany_0", &meany_0);
108 results.Branch(
"rmsx_0", &rmsx_0);
109 results.Branch(
"rmsy_0", &rmsy_0);
110 results.Branch(
"meanx_1", &meanx_1);
111 results.Branch(
"meany_1", &meany_1);
112 results.Branch(
"rmsx_1", &rmsx_1);
113 results.Branch(
"rmsy_1", &rmsy_1);
114 results.Branch(
"meanx_2", &meanx_2);
115 results.Branch(
"meany_2", &meany_2);
116 results.Branch(
"rmsx_2", &rmsx_2);
117 results.Branch(
"rmsy_2", &rmsy_2);
118 results.Branch(
"meanx_3", &meanx_3);
119 results.Branch(
"meany_3", &meany_3);
120 results.Branch(
"rmsx_3", &rmsx_3);
121 results.Branch(
"rmsy_3", &rmsy_3);
122 results.Branch(
"count_0", count_0,
"count_0[10]/I");
123 results.Branch(
"count_1", count_1,
"count_1[10]/I");
124 results.Branch(
"count_2", count_2,
"count_2[10]/I");
125 results.Branch(
"count_3", count_3,
"count_3[10]/I");
128 vector< string >
files;
132 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.1_0.1_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
133 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_-0.5_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
134 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.001_0.001_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
135 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_-0.0002_-0.0002_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
136 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_-0.0002_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
137 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_-0.0002_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
138 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_-0.0001_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
139 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
140 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_-0.0001_0.0001_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
141 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0002_-0.0002_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
142 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0001_-0.0001_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
143 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0001_0.0001_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
144 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_-0.0001_-0.0001_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
145 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_-0.0002_0.0002_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
146 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0_0.001_0.001/200000/mc_data/asymmetries_results.root");
147 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0_0.001_0.001/200000/mc_data/Lumi_MC_200000.root");
148 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_-0.0001_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
149 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0001_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
150 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0001_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
151 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0002_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
152 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0002_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
153 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.5_0.5_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
154 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.1_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
155 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.5_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
156 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.1_-0.1_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0_0.0_0.0/200000/mc_data/asymmetries_results.root");
157 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.1_-0.1_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
158 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_-0.1_-0.1_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
159 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_-0.1_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
160 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.5_-0.5_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
161 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_-0.5_0.5_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
162 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_-0.5_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
163 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_-0.1_0.1_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
164 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_-0.1_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
165 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.0_0.1_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
166 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_-0.5_-0.5_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
167 files.push_back(
"./dpm_elastic_thmin_0.06deg/ip_offset_XYZDXDYDZ_0.5_0.0_0.0_0.08_0.08_0.35/beam_grad_XYDXDY_0.0_0.0_0.0_0.0/200000/mc_data/Lumi_MC_200000.root");
192 int nfiles = files.size();
193 for (
int ifile = 0; ifile < nfiles; ifile++){
194 cout << endl <<
" file " << ifile <<
" of " << nfiles <<
" = " << files[ifile] << endl;
196 TChain tMC(
"pndsim");
197 tMC.Add((files[ifile]+
"/Lumi_MC*.root").c_str());
200 TClonesArray* true_tracks =
new TClonesArray(
"PndMCTrack");
201 tMC.SetBranchAddress(
"MCTrack", &true_tracks);
203 TClonesArray* true_points =
new TClonesArray(
"PndSdsMCPoint");
204 tMC.SetBranchAddress(
"LMDPoint", &true_points);
206 filename <<
"asymmetry_studies_"<< momentum <<
"_GeVc_x" << offsetx <<
"_mm_y_" << offsety <<
"_mm_dxdz_" << tiltx <<
"_mrad_dydz_" << tilty <<
"_mrad";
209 TH2F hist_gen_theta_phi (
"hist_gen_theta_phi",
"theta phi generated distribution", 100, 2e-3, 9e-3, 100, -3.141, 3.141);
210 TH2F hist_gen_x_y (
"hist_gen_x_y",
"x y generated distribution", 100, -5e-3, 5e-3, 100, -5e-3, 5e-3);
211 TH2F hist_gen_dx_dy (
"hist_gen_dx_dy",
"dx/dz dy/dz generated distribution", 100, -15e-3, 15e-3, 100, -15e-3, 15e-3);
212 TH2F hist_XY_plane_0 (
"hist_XY_plane_0",
"xy distribution at plane 0", 100, -0.100, 0.100, 100, -0.100, 0.100);
213 TH2F hist_XY_plane_1 (
"hist_XY_plane_1",
"xy distribution at plane 1", 100, -0.100, 0.100, 100, -0.100, 0.100);
214 TH2F hist_XY_plane_2 (
"hist_XY_plane_2",
"xy distribution at plane 2", 100, -0.100, 0.100, 100, -0.100, 0.100);
215 TH2F hist_XY_plane_3 (
"hist_XY_plane_3",
"xy distribution at plane 3", 100, -0.100, 0.100, 100, -0.100, 0.100);
216 TH2F* hist_XY_plane[4] = {&hist_XY_plane_0,&hist_XY_plane_1,&hist_XY_plane_2,&hist_XY_plane_3};
231 int nEvents = tMC.GetEntries();
232 int nEvents_counted(0);
243 cout <<
" reading " << nEvents <<
" Events " << endl;
244 for (Int_t j = 0; j <
nEvents ; j++) {
249 int nHits = true_points->GetEntriesFast();
252 const int nParticles = true_tracks->GetEntriesFast();
256 for (Int_t iParticle = 0; iParticle < nParticles; iParticle++) {
262 tiltx += momMC.X()/momMC.Z();
263 tilty += momMC.Y()/momMC.Z();
264 momentum += momMC.Mag();
266 offsetx += posMC.X();
267 offsety += posMC.Y();
268 hist_gen_theta_phi.Fill(momMC.Theta()*1e3, momMC.Phi());
269 hist_gen_x_y.Fill(posMC.X()*10., posMC.X()*10.);
270 hist_gen_dx_dy.Fill(momMC.X()/momMC.Z()*1e3, momMC.Y()/momMC.Z()*1e3);
274 for (Int_t iHit = 0; iHit <
nHits; iHit++) {
276 double theta_ip = 0.;
285 int ihalf, iplane, imodule, iside, idie, isensor;
286 lmddim.
Get_sensor_by_id(sensID, ihalf, iplane, imodule, iside, idie, isensor);
293 double X = hit_pos_lmd.X()*0.01;
294 double Y = hit_pos_lmd.Y()*0.01;
305 offsetx /= (double) npbar;
306 offsety /= (double) npbar;
307 TVector3 offset_ip(offsetx, offsety, 0);
310 tiltx /= (double) npbar;
311 tilty /= (double) npbar;
312 TVector3 tilt_ip(tiltx, tilty, 1.);
315 momentum /= (double) npbar;
318 TVector3 tilt_lmd = tilt_ip;
319 TVector3 offset_lmd = offset_ip;
320 cout <<
" before propagation " << endl;
326 cout <<
" after propagation " << endl;
333 cout <<
" in lmd frame " << endl;
338 offsetx_lmd = offset_lmd.X()/10.;
339 offsety_lmd = offset_lmd.Y()/10.;
340 tiltx_lmd = tilt_lmd.X()/tilt_lmd.Z() * 1000.;
341 tilty_lmd = tilt_lmd.Y()/tilt_lmd.Z() * 1000.;
344 cout <<
" analyzing histograms for momentum " << momentum << endl;
345 cout <<
" mean pos of ip was (generated)" << endl;
346 cout <<
" x = " << hist_gen_x_y.GetMean(1) <<
" mm ("<< offsetx <<
" mm)" << endl;
347 cout <<
" y = " << hist_gen_x_y.GetMean(2) <<
" mm ("<< offsety <<
" mm)" << endl;
349 cout <<
" mean dir of beam was (generated)" << endl;
350 cout <<
" theta = " << hist_gen_theta_phi.GetMean(1) <<
" mrad ("<< tiltx <<
" mrad)" << endl;
351 cout <<
" phi = " << hist_gen_theta_phi.GetMean(2) <<
" rad ("<< tilty <<
" mrad)" << endl;
352 cout <<
" dx/dz = " << hist_gen_dx_dy.GetMean(1) <<
" mrad ("<< tiltx <<
" mrad)" << endl;
353 cout <<
" dy/dz = " << hist_gen_dx_dy.GetMean(2) <<
" mrad ("<< tilty <<
" mrad)" << endl;
355 cout <<
" mean dir of beam was (propagated to lmd)" << endl;
358 cout <<
" dx/dz = " <<
" mrad ("<< tiltx_lmd <<
" mrad)" << endl;
359 cout <<
" dy/dz = " <<
" mrad ("<< tilty_lmd <<
" mrad)" << endl;
361 cout <<
" mean in plane 0,1,2,3 is " << endl;
362 vector < double > means_x;
363 vector < double > widths_x;
364 vector < double > means_y;
365 vector < double > widths_y;
366 vector < double > z_err; z_err.push_back(0); z_err.push_back(0); z_err.push_back(0); z_err.push_back(0);
367 means_x.push_back(hist_XY_plane_0.GetMean(1)); meanx_0 = means_x[0];
368 means_x.push_back(hist_XY_plane_1.GetMean(1)); meanx_1 = means_x[1];
369 means_x.push_back(hist_XY_plane_2.GetMean(1)); meanx_2 = means_x[2];
370 means_x.push_back(hist_XY_plane_3.GetMean(1)); meanx_3 = means_x[3];
371 means_y.push_back(hist_XY_plane_0.GetMean(2)); meany_0 = means_x[0];
372 means_y.push_back(hist_XY_plane_1.GetMean(2)); meany_1 = means_x[1];
373 means_y.push_back(hist_XY_plane_2.GetMean(2)); meany_2 = means_x[2];
374 means_y.push_back(hist_XY_plane_3.GetMean(2)); meany_3 = means_x[3];
376 widths_x.push_back(hist_XY_plane_0.GetRMS(1)/
sqrt(hist_XY_plane_0.GetEntries())); rmsx_0 = hist_XY_plane_0.GetRMS(1);
377 widths_x.push_back(hist_XY_plane_1.GetRMS(1)/
sqrt(hist_XY_plane_1.GetEntries())); rmsx_1 = hist_XY_plane_1.GetRMS(1);
378 widths_x.push_back(hist_XY_plane_2.GetRMS(1)/
sqrt(hist_XY_plane_2.GetEntries())); rmsx_2 = hist_XY_plane_2.GetRMS(1);
379 widths_x.push_back(hist_XY_plane_3.GetRMS(1)/
sqrt(hist_XY_plane_3.GetEntries())); rmsx_3 = hist_XY_plane_3.GetRMS(1);
380 widths_y.push_back(hist_XY_plane_0.GetRMS(2)/
sqrt(hist_XY_plane_0.GetEntries())); rmsy_0 = hist_XY_plane_0.GetRMS(2);
381 widths_y.push_back(hist_XY_plane_1.GetRMS(2)/
sqrt(hist_XY_plane_1.GetEntries())); rmsy_1 = hist_XY_plane_1.GetRMS(2);
382 widths_y.push_back(hist_XY_plane_2.GetRMS(2)/
sqrt(hist_XY_plane_2.GetEntries())); rmsy_2 = hist_XY_plane_2.GetRMS(2);
383 widths_y.push_back(hist_XY_plane_3.GetRMS(2)/
sqrt(hist_XY_plane_3.GetEntries())); rmsy_3 = hist_XY_plane_3.GetRMS(2);
387 canvas_distributions.cd(1);
388 hist_XY_plane_0.Draw(
"COLZ");
391 canvas_distributions.cd(2);
392 hist_XY_plane_1.Draw(
"COLZ");
395 canvas_distributions.cd(3);
396 hist_XY_plane_2.Draw(
"COLZ");
399 canvas_distributions.cd(4);
400 hist_XY_plane_3.Draw(
"COLZ");
407 cout <<
" x = " << meanx_0 <<
", "<< meanx_1 <<
", "<< meanx_2 <<
", "<< meanx_3 << endl;
408 cout <<
" y = " << meany_0 <<
", "<< meany_1 <<
", "<< meany_2 <<
", "<< meany_3 << endl;
409 cout <<
" rms x = " << rmsx_0 <<
", "<< rmsx_1 <<
", "<< rmsx_2 <<
", "<< rmsx_3 << endl;
410 cout <<
" rms y = " << rmsy_0 <<
", "<< rmsy_1 <<
", "<< rmsy_2 <<
", "<< rmsy_3 << endl;
412 TGraphErrors graph_average_x(means_x.size(), &z[0], &means_x[0], NULL, &widths_x[0]);
413 graph_average_x.SetNameTitle(
"graph_average_x",
"average x over z");
416 graph_average_x.Draw(
"ALP");
417 graph_average_x.GetYaxis()->SetRangeUser(-0.02, 0.02);
418 TF1 funcx(
"funcx",
"pol1", -0.1, 0.5);
419 graph_average_x.Fit(&funcx);
423 line.DrawLine(z[0], offsetx_lmd/100., z[3], offsetx_lmd/100.+tiltx_lmd/1000.*(z[3]-z[0]));
428 TGraphErrors graph_average_y(means_y.size(), &z[0], &means_y[0], NULL, &widths_y[0]);
429 graph_average_y.SetNameTitle(
"graph_average_y",
"average y over z");
431 graph_average_y.Draw(
"ALP");
432 graph_average_y.GetYaxis()->SetRangeUser(-0.02, 0.02);
433 TF1 funcy(
"funcy",
"pol1", -0.1, 0.5);
434 graph_average_y.Fit(&funcy);
438 line.DrawLine(z[0], offsety_lmd/100., z[3], offsety_lmd/100.+tilty_lmd/1000.*(z[3]-z[0]));
442 cout <<
" mean pos of ip fit (generated and propagated)" << endl;
443 offsetx_fit = funcx.Eval(z[0])*1e3;
444 offsety_fit = funcy.Eval(z[0])*1e3;
445 cout <<
" x = " << offsetx_fit <<
" mm ("<< offsetx_lmd <<
" mm)" << endl;
446 cout <<
" y = " << offsety_fit <<
" mm ("<< offsety_lmd <<
" mm)" << endl;
448 tiltx_fit = funcx.GetParameter(1)*1e3;
449 tilty_fit = funcy.GetParameter(1)*1e3;
450 cout <<
" mean dir of beam fit (generated and propagated)" << endl;
451 cout <<
" dx/dz = " << tiltx_fit <<
" mrad ("<< tiltx_lmd <<
" mrad)" << endl;
452 cout <<
" dy/dz = " << tilty_fit <<
" mrad ("<< tilty_lmd <<
" mrad)" << endl;
460 TFile treefile(
"asymmetries_results.root",
"RECREATE");
461 results.SetDirectory(&treefile);
464 cout <<
" done " << endl;
472 gROOT->SetStyle(
"Plain");
473 const Int_t NRGBs = 5;
474 const Int_t NCont = 255;
475 Double_t stops[NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 };
476 Double_t red[NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 };
477 Double_t green[NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 };
478 Double_t blue[NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 };
479 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
480 gStyle->SetNumberContours(NCont);
481 gStyle->SetTitleFont(10*13+2,
"xyz");
482 gStyle->SetTitleSize(0.06,
"xyz");
483 gStyle->SetTitleOffset(1,
"xy");
484 gStyle->SetTitleOffset(1.3,
"z");
485 gStyle->SetLabelFont(10*13+2,
"xyz");
486 gStyle->SetLabelSize(0.06,
"xyz");
487 gStyle->SetLabelOffset(0.009,
"xyz");
488 gStyle->SetPadBottomMargin(0.2);
489 gStyle->SetPadTopMargin(0.15);
490 gStyle->SetPadLeftMargin(0.15);
491 gStyle->SetPadRightMargin(0.20);
492 gStyle->SetOptTitle(1);
493 gStyle->SetOptStat(1);
495 gStyle->SetFrameFillColor(0);
496 gStyle->SetFrameFillStyle(0);
497 TGaxis::SetMaxDigits(3);
502 if ((
int) (
last_percent * 100) == (
int) (percent * 100))
508 for (
int i = 0;
i < len; ++
i) {
509 if (
i < static_cast<int> (len * percent)) {
515 cout <<
"[" << progress <<
"] " << (
static_cast<int> (100 * percent))
int main(int argc, char **argv)
TVector3 hit_pos(hit->GetX(), hit->GetY(), hit->GetZ())
void Propagate_fast_ip_to_lmd(TVector3 &pos, TVector3 &mom, double pbeam)
friend F32vec4 sqrt(const F32vec4 &a)
TVector3 Transform_global_to_lmd_local(const TVector3 &point, bool isvector=false, bool aligned=true)
TVector3 GetMomentum() const
void DrawProgressBar(int len, double percent)
int online_monitoring_studies()
std::map< int, TString > files
Int_t GetSensorID() const
Bool_t IsGeneratorCreated(void) const
void Get_sensor_by_id(const int sensor_id, int &ihalf, int &iplane, int &imodule, int &iside, int &idie, int &isensor)
TVector3 GetPosition() const
static PndLmdDim & Get_instance()
TVector3 GetStartVertex() const