39 : inputOpticsToken_(setWhatProduced(this, iConfig.getParameter<
std::
string>(
"outputOpticsLabel"))
41 scenario_(iConfig.getParameter<
std::
string>(
"scenario")),
42 factor_(iConfig.getParameter<double>(
"factor")),
43 rpDecId_45_N_(iConfig.getParameter<unsigned
int>(
"rpId_45_N")),
44 rpDecId_45_F_(iConfig.getParameter<unsigned
int>(
"rpId_45_F")),
45 rpDecId_56_N_(iConfig.getParameter<unsigned
int>(
"rpId_56_N")),
46 rpDecId_56_F_(iConfig.getParameter<unsigned
int>(
"rpId_56_F")) {}
53 desc.add<
std::string>(
"inputOpticsLabel",
"")->setComment(
"label of the input optics records");
54 desc.add<
std::string>(
"outputOpticsLabel",
"modified")->setComment(
"label of the output optics records");
56 desc.add<
std::string>(
"scenario",
"none")->setComment(
"name of modification scenario");
58 desc.add<
double>(
"factor", 0.)->setComment(
"size of modification (number of sigmas)");
60 desc.add<
unsigned int>(
"rpId_45_N", 0)->setComment(
"decimal RP id for 45 near");
61 desc.add<
unsigned int>(
"rpId_45_F", 0)->setComment(
"decimal RP id for 45 far");
62 desc.add<
unsigned int>(
"rpId_56_N", 0)->setComment(
"decimal RP id for 56 near");
63 desc.add<
unsigned int>(
"rpId_56_F", 0)->setComment(
"decimal RP id for 56 far");
65 descriptions.
add(
"ctppsModifiedOpticalFunctionsESSource",
desc);
76 std::shared_ptr<LHCInterpolatedOpticalFunctionsSetCollection>
output =
77 std::make_shared<LHCInterpolatedOpticalFunctionsSetCollection>(
input);
81 unsigned int rpId_N = 0, rpId_F = 0;
84 std::map<unsigned int, ArmInfo> armInfo;
86 for (
const auto &fsp : *
output) {
88 unsigned int rpDecId = 100 *
rpId.arm() + 10 *
rpId.station() +
rpId.rp();
91 armInfo[0].rpId_N = fsp.first;
93 armInfo[0].rpId_F = fsp.first;
95 armInfo[1].rpId_N = fsp.first;
97 armInfo[1].rpId_F = fsp.first;
101 bool applied =
false;
103 for (
const auto &ap : armInfo) {
104 const auto &
arm = ap.first;
108 auto &of_N =
output->find(ap.second.rpId_N)->second;
109 auto &of_F =
output->find(ap.second.rpId_F)->second;
111 const double z_N = of_N.getScoringPlaneZ();
112 const double z_F = of_F.getScoringPlaneZ();
113 const double de_z = (
arm == 0) ? z_N - z_F : z_F - z_N;
117 if (of_N.m_xi_values.size() != of_N.m_xi_values.size())
119 <<
"Different xi sampling of optical functions in near and far RP.";
122 for (
unsigned int i = 0;
i < of_N.m_xi_values.size(); ++
i) {
123 const double xi = of_N.m_xi_values[
i];
139 const double a = 3180.,
b = 40.;
147 const double a = 0.42,
b = 0.015;
148 const double de_Lp_x =
factor_ * (
a *
xi +
b) * Lp_x;
150 L_x_N -= de_Lp_x * de_z / 2.;
151 L_x_F += de_Lp_x * de_z / 2.;
156 const double d = 0.08;
181 of_N.initializeSplines();
182 of_F.initializeSplines();
187 edm::LogError(
"CTPPSModifiedOpticalFunctionsESSource") <<
"Could not apply scenario `" +
scenario_ +
"'.";