31 std::shared_ptr<LHCInterpolatedOpticalFunctionsSetCollection>
currentData_;
51 desc.
add<
std::string>(
"lhcInfoLabel",
"")->setComment(
"label of the LHCInfo record");
53 descriptions.
add(
"ctppsInterpolatedOpticalFunctionsESSource", desc);
71 edm::LogInfo(
"CTPPSInterpolatedOpticalFunctionsESSource")
72 <<
"Invalid crossing angle, no optical functions produced.";
76 currentData_ = std::make_shared<LHCInterpolatedOpticalFunctionsSetCollection>();
83 edm::LogInfo(
"CTPPSInterpolatedOpticalFunctionsESSource")
88 edm::LogInfo(
"CTPPSInterpolatedOpticalFunctionsESSource")
89 <<
"No input optics available, no optical functions produced.";
92 currentData_ = std::make_shared<LHCInterpolatedOpticalFunctionsSetCollection>();
98 if (ofColl.size() == 1) {
99 const auto &it = ofColl.begin();
104 <<
"Cannot interpolate: input given only for xangle " << it->first <<
" while interpolation requested for " 107 currentData_ = std::make_shared<LHCInterpolatedOpticalFunctionsSetCollection>();
108 for (
const auto &rp_p : it->second) {
109 const auto rpId = rp_p.first;
119 if (ofColl.size() > 1) {
121 auto it1 = ofColl.begin();
125 for (; it1 != ofColl.end(); ++it1) {
128 if (it2 == ofColl.end()) {
130 it1 = std::prev(it1);
139 const auto &xangle1 = it1->first;
140 const auto &xangle2 = it2->first;
142 const auto &ofs1 = it1->second;
143 const auto &ofs2 = it2->second;
146 currentData_ = std::make_shared<LHCInterpolatedOpticalFunctionsSetCollection>();
147 for (
const auto &rp_p : ofs1) {
148 const auto rpId = rp_p.first;
149 const auto &rp_it2 = ofs2.find(rpId);
150 if (rp_it2 == ofs2.end())
151 throw cms::Exception(
"CTPPSInterpolatedOpticalFunctionsESSource") <<
"RP mismatch between ofs1 and ofs2.";
153 const auto &of1 = rp_p.second;
154 const auto &of2 = rp_it2->second;
156 const size_t num_xi_vals1 = of1.getXiValues().size();
157 const size_t num_xi_vals2 = of2.getXiValues().size();
159 if (num_xi_vals1 != num_xi_vals2)
160 throw cms::Exception(
"CTPPSInterpolatedOpticalFunctionsESSource") <<
"Size mismatch between ofs1 and ofs2.";
162 const size_t num_xi_vals = num_xi_vals1;
165 iof.
m_z = of1.getScoringPlaneZ();
169 for (
size_t fi = 0; fi < of1.getFcnValues().size(); ++fi) {
172 for (
size_t pi = 0;
pi < num_xi_vals; ++
pi) {
173 double xi = of1.getXiValues()[
pi];
174 double xi_control = of2.getXiValues()[
pi];
176 if (fabs(xi - xi_control) > 1
e-6)
177 throw cms::Exception(
"CTPPSInterpolatedOpticalFunctionsESSource") <<
"Xi mismatch between ofs1 and ofs2.";
181 double v1 = of1.getFcnValues()[fi][
pi];
182 double v2 = of2.getFcnValues()[fi][
pi];
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
edm::ESGetToken< LHCInfo, LHCInfoRcd > lhcInfoToken_
std::shared_ptr< LHCInterpolatedOpticalFunctionsSetCollection > currentData_
~CTPPSInterpolatedOpticalFunctionsESSource() override
float currentCrossingAngle_
std::shared_ptr< LHCInterpolatedOpticalFunctionsSetCollection > produce(const CTPPSInterpolatedOpticsRcd &)
float const crossingAngle() const
std::vector< double > m_xi_values
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
void initializeSplines()
builds splines from m_*_values fields
ParameterDescriptionBase * add(U const &iLabel, T const &value)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
edm::ESGetToken< LHCOpticalFunctionsSetCollection, CTPPSOpticsRcd > opticsToken_
CTPPSInterpolatedOpticalFunctionsESSource(const edm::ParameterSet &)
std::vector< std::vector< double > > m_fcn_values
length unit cm
Set of optical functions corresponding to one scoring plane along LHC, including splines for interpol...
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Collection of optical functions for two crossing angle values and various scoring planes...
double m_z
position of the scoring plane, in LHC/TOTEM convention, cm