40 factor_(iConfig.getParameter<double>(
"factor")),
57 desc.
add<
std::string>(
"inputOpticsLabel",
"")->setComment(
"label of the input optics records");
58 desc.
add<
std::string>(
"outputOpticsLabel",
"modified")->setComment(
"label of the output optics records");
60 desc.
add<
std::string>(
"scenario",
"none")->setComment(
"name of modification scenario");
62 desc.
add<
double>(
"factor", 0.)->
setComment(
"size of modification (number of sigmas)");
64 desc.
add<
unsigned int>(
"rpId_45_N", 0)->setComment(
"decimal RP id for 45 near");
65 desc.
add<
unsigned int>(
"rpId_45_F", 0)->setComment(
"decimal RP id for 45 far");
66 desc.
add<
unsigned int>(
"rpId_56_N", 0)->setComment(
"decimal RP id for 56 near");
67 desc.
add<
unsigned int>(
"rpId_56_F", 0)->setComment(
"decimal RP id for 56 far");
69 descriptions.
add(
"ctppsModifiedOpticalFunctionsESSource", desc);
80 std::shared_ptr<LHCInterpolatedOpticalFunctionsSetCollection>
output =
81 std::make_shared<LHCInterpolatedOpticalFunctionsSetCollection>(
input);
85 unsigned int rpId_N = 0, rpId_F = 0;
88 std::map<unsigned int, ArmInfo> armInfo;
90 for (
const auto &fsp : *output) {
92 unsigned int rpDecId = 100 * rpId.
arm() + 10 * rpId.
station() + rpId.
rp();
95 armInfo[0].rpId_N = fsp.first;
97 armInfo[0].rpId_F = fsp.first;
99 armInfo[1].rpId_N = fsp.first;
101 armInfo[1].rpId_F = fsp.first;
105 bool applied =
false;
107 for (
const auto &ap : armInfo) {
108 const auto &arm = ap.first;
112 auto &of_N = output->find(ap.second.rpId_N)->second;
113 auto &of_F = output->find(ap.second.rpId_F)->second;
115 const double z_N = of_N.getScoringPlaneZ();
116 const double z_F = of_F.getScoringPlaneZ();
117 const double de_z = (arm == 0) ? z_N - z_F : z_F - z_N;
121 if (of_N.m_xi_values.size() != of_N.m_xi_values.size())
123 <<
"Different xi sampling of optical functions in near and far RP.";
126 for (
unsigned int i = 0;
i < of_N.m_xi_values.size(); ++
i) {
127 const double xi = of_N.m_xi_values[
i];
143 const double a = 3180.,
b = 40.;
144 const double de_L_x =
factor_ * (a * xi +
b);
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;
185 of_N.initializeSplines();
186 of_F.initializeSplines();
191 edm::LogError(
"CTPPSModifiedOpticalFunctionsESSource") <<
"Could not apply scenario `" +
scenario_ +
"'.";
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
void setComment(std::string const &value)
std::shared_ptr< LHCInterpolatedOpticalFunctionsSetCollection > produce(const CTPPSInterpolatedOpticsRcd &)
static std::string const input
CTPPSModifiedOpticalFunctionsESSource(const edm::ParameterSet &)
unsigned int rpDecId_45_F_
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
unsigned int rpDecId_56_N_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
~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)
unsigned int rpDecId_45_N_
edm::ESGetToken< LHCInterpolatedOpticalFunctionsSetCollection, CTPPSInterpolatedOpticsRcd > inputOpticsToken_
unsigned int rpDecId_56_F_