CMS 3D CMS Logo

LHCInterpolatedOpticalFunctionsSet.cc
Go to the documentation of this file.
1 // Original Author: Jan Kašpar
2 
4 
5 //----------------------------------------------------------------------------------------------------
6 
8 {
9  const unsigned int num_xi_vals = m_xi_values.size();
10 
11  m_splines.resize(m_fcn_values.size());
12  for (unsigned int i = 0; i < m_fcn_values.size(); ++i)
13  m_splines[i] = std::make_shared<TSpline3>("", m_xi_values.data(), m_fcn_values[i].data(), num_xi_vals);
14 }
15 
16 //----------------------------------------------------------------------------------------------------
17 
19  LHCInterpolatedOpticalFunctionsSet::Kinematics &output, bool calculateAngles) const
20 {
21  const double xi = input.xi;
22 
23  output.x = m_splines[exd]->Eval(xi) + m_splines[evx]->Eval(xi) * input.x
24  + m_splines[eLx]->Eval(xi) * input.th_x + m_splines[e14]->Eval(xi) * input.th_y;
25 
26  output.th_x = (!calculateAngles) ? 0. : m_splines[expd]->Eval(xi) + m_splines[evpx]->Eval(xi) * input.x
27  + m_splines[eLpx]->Eval(xi) * input.th_x + m_splines[e24]->Eval(xi) * input.th_y;
28 
29  output.y = m_splines[eyd]->Eval(xi) + m_splines[evy]->Eval(xi) * input.y
30  + m_splines[eLy]->Eval(xi) * input.th_y + m_splines[e32]->Eval(xi) * input.th_x;
31 
32  output.th_y = (!calculateAngles) ? 0. : m_splines[eypd]->Eval(xi) + m_splines[evpy]->Eval(xi) * input.y
33  + m_splines[eLpy]->Eval(xi) * input.th_y + m_splines[e42]->Eval(xi) * input.th_x;
34 
35  output.xi = input.xi;
36 }
static std::string const input
Definition: EdmProvDump.cc:48
std::vector< std::shared_ptr< const TSpline3 > > m_splines
std::vector< double > m_xi_values
void initializeSplines()
builds splines from m_*_values fields
void transport(const Kinematics &input, Kinematics &output, bool calculateAngles=false) const
transports proton according to the splines
std::vector< std::vector< double > > m_fcn_values
length unit cm