35 std::shared_ptr<LHCInterpolatedOpticalFunctionsSetCollection>
currentData_;
56 ->setComment(
"label of the LHCInfo record");
58 descriptions.
add(
"ctppsInterpolatedOpticalFunctionsESSource", desc);
79 edm::LogInfo(
"CTPPSInterpolatedOpticalFunctionsESSource") <<
"Invalid crossing angle, no optical functions produced.";
83 currentData_ = std::make_shared<LHCInterpolatedOpticalFunctionsSetCollection>();
95 edm::LogInfo(
"CTPPSInterpolatedOpticalFunctionsESSource") <<
"No input optics available, no optical functions produced.";
98 currentData_ = std::make_shared<LHCInterpolatedOpticalFunctionsSetCollection>();
104 if (hOFColl->size() == 1)
106 const auto &it = hOFColl->begin();
110 throw cms::Exception(
"CTPPSInterpolatedOpticalFunctionsESSource") <<
"Cannot interpolate: input given only for xangle " 113 currentData_ = std::make_shared<LHCInterpolatedOpticalFunctionsSetCollection>();
114 for (
const auto &rp_p : it->second)
116 const auto rpId = rp_p.first;
126 if (hOFColl->size() > 1)
129 auto it1 = hOFColl->begin();
134 for (; it1 != hOFColl->end(); ++it1)
138 if (it2 == hOFColl->end())
141 it1 = std::prev(it1);
150 const auto &xangle1 = it1->first;
151 const auto &xangle2 = it2->first;
153 const auto &ofs1 = it1->second;
154 const auto &ofs2 = it2->second;
157 currentData_ = std::make_shared<LHCInterpolatedOpticalFunctionsSetCollection>();
158 for (
const auto &rp_p : ofs1)
160 const auto rpId = rp_p.first;
161 const auto &rp_it2 = ofs2.find(rpId);
162 if (rp_it2 == ofs2.end())
163 throw cms::Exception(
"CTPPSInterpolatedOpticalFunctionsESSource") <<
"RP mismatch between ofs1 and ofs2.";
165 const auto &of1 = rp_p.second;
166 const auto &of2 = rp_it2->second;
168 const size_t num_xi_vals1 = of1.getXiValues().size();
169 const size_t num_xi_vals2 = of2.getXiValues().size();
171 if (num_xi_vals1 != num_xi_vals2)
172 throw cms::Exception(
"CTPPSInterpolatedOpticalFunctionsESSource") <<
"Size mismatch between ofs1 and ofs2.";
174 const size_t num_xi_vals = num_xi_vals1;
177 iof.
m_z = of1.getScoringPlaneZ();
181 for (
size_t fi = 0; fi < of1.getFcnValues().size(); ++fi)
185 for (
size_t pi = 0;
pi < num_xi_vals; ++
pi)
187 double xi = of1.getXiValues()[
pi];
188 double xi_control = of2.getXiValues()[
pi];
190 if (fabs(xi - xi_control) > 1
e-6)
191 throw cms::Exception(
"CTPPSInterpolatedOpticalFunctionsESSource") <<
"Xi mismatch between ofs1 and ofs2.";
195 double v1 = of1.getFcnValues()[fi][
pi];
196 double v2 = of2.getFcnValues()[fi][
pi];
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
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
void initializeSplines()
builds splines from m_*_values fields
const DepRecordT getRecord() const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
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)
std::string lhcInfoLabel_
double m_z
position of the scoring plane, in LHC/TOTEM convention, cm