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];
143 const double a = 3180.,
b = 40.;
151 const double a = 0.42,
b = 0.015;
152 const double de_Lp_x =
factor_ * (
a *
xi +
b) * Lp_x;
154 L_x_N -= de_Lp_x * de_z / 2.;
155 L_x_F += de_Lp_x * de_z / 2.;
160 const double d = 0.08;
174 const double a = 2.66,
b = 0.015;
175 const double de_Lp_y =
factor_ * (
a *
xi +
b) * Lp_y;
177 L_y_N -= de_Lp_y * de_z / 2.;
178 L_y_F += de_Lp_y * de_z / 2.;
200 of_N.initializeSplines();
201 of_F.initializeSplines();
206 edm::LogError(
"CTPPSModifiedOpticalFunctionsESSource") <<
"Could not apply scenario `" +
scenario_ +
"'.";
const edm::ESGetToken< LHCInterpolatedOpticalFunctionsSetCollection, CTPPSInterpolatedOpticsRcd > inputOpticsToken_
const std::string scenario_
std::shared_ptr< LHCInterpolatedOpticalFunctionsSetCollection > produce(const CTPPSInterpolatedOpticsRcd &)
const unsigned int rpDecId_56_N_
Log< level::Error, false > LogError
static std::string const input
CTPPSModifiedOpticalFunctionsESSource(const edm::ParameterSet &)
const unsigned int rpDecId_56_F_
const unsigned int rpDecId_45_N_
~CTPPSModifiedOpticalFunctionsESSource() override
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Base class for CTPPS detector IDs.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
const unsigned int rpDecId_45_F_