80 std::map<unsigned int, RPPlots>
rp_plots_;
109 : opticsLabel_(iConfig.getParameter<
std::
string>(
"opticsLabel")),
111 rpId_45_N_(iConfig.getParameter<unsigned
int>(
"rpId_45_N")),
112 rpId_45_F_(iConfig.getParameter<unsigned
int>(
"rpId_45_F")),
113 rpId_56_N_(iConfig.getParameter<unsigned
int>(
"rpId_56_N")),
114 rpId_56_F_(iConfig.getParameter<unsigned
int>(
"rpId_56_F")),
116 outputFile_(iConfig.getParameter<
string>(
"outputFile")) {
136 if (hOpticalFunctions->empty())
140 for (
const auto& it : *hOpticalFunctions) {
142 unsigned int rpDecId =
rpId.arm() * 100 +
rpId.station() * 10 +
rpId.rp();
148 it.second.transport(k_in_beam, k_out_beam);
150 const double vtx_ep = 1E-4;
151 const double th_ep = 1E-6;
153 for (
double xi = 0.;
xi < 0.30001;
xi += 0.001) {
156 it.second.transport(k_in_xi, k_out_xi);
160 it.second.transport(k_in_xi_vtx_x, k_out_xi_vtx_x);
164 it.second.transport(k_in_xi_th_x, k_out_xi_th_x);
168 it.second.transport(k_in_xi_vtx_y, k_out_xi_vtx_y);
172 it.second.transport(k_in_xi_th_y, k_out_xi_th_y);
174 int idx = pl.g_v_x_vs_xi->GetN();
176 pl.g_v_x_vs_xi->SetPoint(
idx,
xi, (k_out_xi_vtx_x.
x - k_out_xi.
x) / vtx_ep);
177 pl.g_L_x_vs_xi->SetPoint(
idx,
xi, (k_out_xi_th_x.
x - k_out_xi.
x) / th_ep);
178 pl.g_x_D_vs_xi->SetPoint(
idx,
xi, k_out_xi.
x - k_out_beam.
x);
180 pl.g_v_y_vs_xi->SetPoint(
idx,
xi, (k_out_xi_vtx_y.
y - k_out_xi.
y) / vtx_ep);
181 pl.g_L_y_vs_xi->SetPoint(
idx,
xi, (k_out_xi_th_y.
y - k_out_xi.
y) / th_ep);
182 pl.g_y_D_vs_xi->SetPoint(
idx,
xi, k_out_xi.
y - k_out_beam.
y);
184 pl.h_y_vs_x_disp->SetPoint(
idx, k_out_xi.
x - k_out_beam.
x, k_out_xi.
y - k_out_beam.
y);
193 for (
const auto& it : *hOpticalFunctions) {
195 unsigned int rpDecId =
rpId.arm() * 100 +
rpId.station() * 10 +
rpId.rp();
197 if (rpDecId == ap.second.id_N)
199 if (rpDecId == ap.second.id_F)
203 if (!opt_N || !opt_F) {
204 edm::LogError(
"CTPPSOpticsPlotter::analyze") <<
"Cannot find optics objects for arm " << ap.first;
211 opt_N->
transport(k_in_beam, k_out_beam_N);
212 opt_F->transport(k_in_beam, k_out_beam_F);
214 for (
double xi = 0.;
xi < 0.30001;
xi += 0.001) {
219 opt_F->transport(k_in_xi, k_out_xi_F);
221 int idx = ap.second.g_de_x_vs_x_disp->GetN();
223 ap.second.g_de_x_vs_x_disp->SetPoint(
224 idx, k_out_xi_N.
x - k_out_beam_N.
x, (k_out_xi_F.
x - k_out_beam_F.
x) - (k_out_xi_N.
x - k_out_beam_N.
x));
225 ap.second.g_de_y_vs_x_disp->SetPoint(
226 idx, k_out_xi_N.
x - k_out_beam_N.
x, (k_out_xi_F.
y - k_out_beam_F.
y) - (k_out_xi_N.
y - k_out_beam_N.
y));
234 auto f_out = std::make_unique<TFile>(
outputFile_.c_str(),
"recreate");
237 gDirectory = f_out->mkdir(Form(
"%u",
p.first));
242 gDirectory = f_out->mkdir(Form(
"arm %u",
p.first));