39 : scenario_(iConfig.getParameter<
std::
string>(
"scenario")),
40 factor_(iConfig.getParameter<double>(
"factor")),
41 rpDecId_45_N_(iConfig.getParameter<unsigned
int>(
"rpId_45_N")),
42 rpDecId_45_F_(iConfig.getParameter<unsigned
int>(
"rpId_45_F")),
43 rpDecId_56_N_(iConfig.getParameter<unsigned
int>(
"rpId_56_N")),
44 rpDecId_56_F_(iConfig.getParameter<unsigned
int>(
"rpId_56_F")) {
54 desc.
add<
std::string>(
"inputOpticsLabel",
"")->setComment(
"label of the input optics records");
55 desc.
add<
std::string>(
"outputOpticsLabel",
"modified")->setComment(
"label of the output optics records");
57 desc.
add<
std::string>(
"scenario",
"none")->setComment(
"name of modification scenario");
59 desc.
add<
double>(
"factor", 0.)->
setComment(
"size of modification (number of sigmas)");
61 desc.
add<
unsigned int>(
"rpId_45_N", 0)->setComment(
"decimal RP id for 45 near");
62 desc.
add<
unsigned int>(
"rpId_45_F", 0)->setComment(
"decimal RP id for 45 far");
63 desc.
add<
unsigned int>(
"rpId_56_N", 0)->setComment(
"decimal RP id for 56 near");
64 desc.
add<
unsigned int>(
"rpId_56_F", 0)->setComment(
"decimal RP id for 56 far");
66 descriptions.
add(
"ctppsModifiedOpticalFunctionsESSource", desc);
77 std::shared_ptr<LHCInterpolatedOpticalFunctionsSetCollection>
output =
78 std::make_shared<LHCInterpolatedOpticalFunctionsSetCollection>(
input);
82 unsigned int rpId_N = 0, rpId_F = 0;
85 std::map<unsigned int, ArmInfo> armInfo;
87 for (
const auto &fsp : *
output) {
89 unsigned int rpDecId = 100 *
rpId.arm() + 10 *
rpId.station() +
rpId.rp();
92 armInfo[0].rpId_N = fsp.first;
94 armInfo[0].rpId_F = fsp.first;
96 armInfo[1].rpId_N = fsp.first;
98 armInfo[1].rpId_F = fsp.first;
102 bool applied =
false;
104 for (
const auto &ap : armInfo) {
105 const auto &arm = ap.first;
109 auto &of_N =
output->find(ap.second.rpId_N)->second;
110 auto &of_F =
output->find(ap.second.rpId_F)->second;
112 const double z_N = of_N.getScoringPlaneZ();
113 const double z_F = of_F.getScoringPlaneZ();
114 const double de_z = (arm == 0) ? z_N - z_F : z_F - z_N;
118 if (of_N.m_xi_values.size() != of_N.m_xi_values.size())
120 <<
"Different xi sampling of optical functions in near and far RP.";
123 for (
unsigned int i = 0;
i < of_N.m_xi_values.size(); ++
i) {
124 const double xi = of_N.m_xi_values[
i];
140 const double a = 3180.,
b = 40.;
148 const double a = 0.42,
b = 0.015;
149 const double de_Lp_x =
factor_ * (
a *
xi +
b) * Lp_x;
151 L_x_N -= de_Lp_x * de_z / 2.;
152 L_x_F += de_Lp_x * de_z / 2.;
157 const double d = 0.08;
182 of_N.initializeSplines();
183 of_F.initializeSplines();
188 edm::LogError(
"CTPPSModifiedOpticalFunctionsESSource") <<
"Could not apply scenario `" +
scenario_ +
"'.";