CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
LHCOpticsApproximator Class Reference

Class finds the parametrisation of MADX proton transport and transports the protons according to it 5 phase space variables are taken in to configuration: x, y, theta_x, theta_y, xi xi < 0 for momentum losses (that is for diffractive protons) More...

#include <LHCOpticsApproximator.h>

Inheritance diagram for LHCOpticsApproximator:
LHCApertureApproximator

Public Types

enum  beam_type { lhcb1, lhcb2 }
 
enum  polynomials_selection { AUTOMATIC, PREDEFINED }
 

Public Member Functions

void AddRectEllipseAperture (const LHCOpticsApproximator &in, double rect_x, double rect_y, double r_el_x, double r_el_y)
 
bool CheckInputRange (const double *in, bool invert_beam_coord_sytems=true) const
 
beam_type GetBeamType () const
 
double GetDx (double mad_init_x, double mad_init_thx, double mad_init_y, double mad_init_thy, double mad_init_xi, double d_mad_xi=0.001)
 
double GetDxds (double mad_init_x, double mad_init_thx, double mad_init_y, double mad_init_thy, double mad_init_xi, double d_mad_xi=0.001)
 
void GetLinearApproximation (double atPoint[], double &Cx, double &Lx, double &vx, double &Cy, double &Ly, double &vy, double &D, double ep=1E-5)
 
void GetLineariasedTransportMatrixX (double mad_init_x, double mad_init_thx, double mad_init_y, double mad_init_thy, double mad_init_xi, TMatrixD &tr_matrix, double d_mad_x=10e-6, double d_mad_thx=10e-6)
 returns linearised transport matrix for x projection | dx_out/dx_in dx_out/dthx_in | | dthx_out/dx_in dthx_out/dthx_in | More...
 
void GetLineariasedTransportMatrixY (double mad_init_x, double mad_init_thx, double mad_init_y, double mad_init_thy, double mad_init_xi, TMatrixD &tr_matrix, double d_mad_y=10e-6, double d_mad_thy=10e-6)
 returns linearised transport matrix for y projection | dy_out/dy_in dy_out/dthy_in | | dthy_out/dy_in dthy_out/dthy_in | More...
 
 LHCOpticsApproximator ()
 
 LHCOpticsApproximator (std::string name, std::string title, TMultiDimFet::EMDFPolyType polynom_type, std::string beam_direction, double nominal_beam_momentum)
 begin and end position along the beam of the particle to transport, training_tree, prefix of data branch in the tree More...
 
 LHCOpticsApproximator (const LHCOpticsApproximator &org)
 
const LHCOpticsApproximatoroperator= (const LHCOpticsApproximator &org)
 
double ParameterOutOfRangePenalty (double par_m[], bool invert_beam_coord_sytems=true) const
 
void PrintCoordinateOpticalFunctions (TMultiDimFet &parametrization, const std::string &coord_name, const std::vector< std::string > &input_vars)
 
void PrintInputRange ()
 
void PrintOpticalFunctions ()
 
void Test (TTree *inp_tree, TFile *f_out, std::string data_prefix=std::string("def"), std::string base_out_dir=std::string(""))
 
void TestAperture (TTree *in_tree, TTree *out_tree)
 x, theta_x, y, theta_y, ksi, mad_accepted, parametriz_accepted More...
 
void Train (TTree *inp_tree, std::string data_prefix=std::string("def"), polynomials_selection mode=PREDEFINED, int max_degree_x=10, int max_degree_tx=10, int max_degree_y=10, int max_degree_ty=10, bool common_terms=false, double *prec=nullptr)
 
bool Transport (const double *in, double *out, bool check_apertures=false, bool invert_beam_coord_sytems=true) const
 
bool Transport (const MadKinematicDescriptor *in, MadKinematicDescriptor *out, bool check_apertures=false, bool invert_beam_coord_sytems=true) const
 
bool Transport2D (const double *in, double *out, bool check_apertures=false, bool invert_beam_coord_sytems=true) const
 
bool Transport_m_GeV (double in_pos[3], double in_momentum[3], double out_pos[3], double out_momentum[3], bool check_apertures, double z2_z1_dist) const
 pos, momentum: x,y,z; pos in m, momentum in GeV/c More...
 

Private Types

enum  VariableType { VariableType::X, VariableType::THETA_X, VariableType::Y, VariableType::THETA_Y }
 

Private Member Functions

void AllocateErrorHists (TH1D *err_hists[4])
 
void AllocateErrorInputCorHists (TH2D *err_inp_cor_hists[4][5])
 
void AllocateErrorOutputCorHists (TH2D *err_out_cor_hists[4][5])
 
void DeleteErrorCorHistograms (TH2D *err_cor_hists[4][5])
 
void DeleteErrorHists (TH1D *err_hists[4])
 
void FillErrorDataCorHistograms (double errors[4], double var[5], TH2D *err_cor_hists[4][5])
 
void FillErrorHistograms (double errors[4], TH1D *err_hists[4])
 
void Init ()
 
void InitializeApproximators (polynomials_selection mode, int max_degree_x, int max_degree_tx, int max_degree_y, int max_degree_ty, bool common_terms)
 
void SetDefaultAproximatorSettings (TMultiDimFet &approximator, VariableType var_type, int max_degree)
 
void SetTermsManually (TMultiDimFet &approximator, VariableType variable, int max_degree, bool common_terms)
 
void WriteHistograms (TH1D *err_hists[4], TH2D *err_inp_cor_hists[4][5], TH2D *err_out_cor_hists[4][5], TFile *f_out, std::string base_out_dir)
 

Private Attributes

std::vector< LHCApertureApproximatorapertures_
 apertures on the way More...
 
beam_type beam
 
std::vector< std::string > coord_names
 pointers to polynomials More...
 
double nominal_beam_energy_
 GeV. More...
 
double nominal_beam_momentum_
 GeV/c. More...
 
std::vector< TMultiDimFet * > out_polynomials
 
double s_begin_
 begin of transport along the reference orbit More...
 
double s_end_
 end of transport along the reference orbit More...
 
TMultiDimFet theta_x_parametrisation
 polynomial approximation for theta_x More...
 
TMultiDimFet theta_y_parametrisation
 polynomial approximation for theta_y More...
 
bool trained_
 trained polynomials More...
 
TMultiDimFet x_parametrisation
 polynomial approximation for x More...
 
TMultiDimFet y_parametrisation
 polynomial approximation for y More...
 

Friends

class ProtonTransportFunctionsESSource
 

Detailed Description

Class finds the parametrisation of MADX proton transport and transports the protons according to it 5 phase space variables are taken in to configuration: x, y, theta_x, theta_y, xi xi < 0 for momentum losses (that is for diffractive protons)

Definition at line 29 of file LHCOpticsApproximator.h.

Member Enumeration Documentation

◆ beam_type

◆ polynomials_selection

◆ VariableType

Enumerator
THETA_X 
THETA_Y 

Definition at line 182 of file LHCOpticsApproximator.h.

182 { X, THETA_X, Y, THETA_Y };
#define X(str)
Definition: MuonsGrabber.cc:38

Constructor & Destructor Documentation

◆ LHCOpticsApproximator() [1/3]

LHCOpticsApproximator::LHCOpticsApproximator ( )

◆ LHCOpticsApproximator() [2/3]

LHCOpticsApproximator::LHCOpticsApproximator ( std::string  name,
std::string  title,
TMultiDimFet::EMDFPolyType  polynom_type,
std::string  beam_direction,
double  nominal_beam_momentum 
)

begin and end position along the beam of the particle to transport, training_tree, prefix of data branch in the tree

Definition at line 35 of file LHCOpticsApproximator.cc.

References beam, Init(), lhcb1, lhcb2, Skims_PA_cff::name, nominal_beam_energy_, nominal_beam_momentum_, and runGCPTkAlMap::title.

40  : x_parametrisation(5, polynom_type, "k"),
41  theta_x_parametrisation(5, polynom_type, "k"),
42  y_parametrisation(5, polynom_type, "k"),
43  theta_y_parametrisation(5, polynom_type, "k") {
44  this->SetName(name.c_str());
45  this->SetTitle(title.c_str());
46  Init();
47 
48  if (beam_direction == "lhcb1")
49  beam = lhcb1;
50  else if (beam_direction == "lhcb2")
51  beam = lhcb2;
52  else
53  beam = lhcb1;
54 
55  nominal_beam_momentum_ = nominal_beam_momentum;
56  nominal_beam_energy_ = TMath::Sqrt(nominal_beam_momentum_ * nominal_beam_momentum_ + 0.938272029 * 0.938272029);
57 }
TMultiDimFet theta_x_parametrisation
polynomial approximation for theta_x
double nominal_beam_momentum_
GeV/c.
TMultiDimFet theta_y_parametrisation
polynomial approximation for theta_y
TMultiDimFet y_parametrisation
polynomial approximation for y
TMultiDimFet x_parametrisation
polynomial approximation for x

◆ LHCOpticsApproximator() [3/3]

LHCOpticsApproximator::LHCOpticsApproximator ( const LHCOpticsApproximator org)

Definition at line 245 of file LHCOpticsApproximator.cc.

References apertures_, beam, Init(), nominal_beam_energy_, nominal_beam_momentum_, s_begin_, s_end_, and trained_.

246  : TNamed(org),
251  Init();
252  s_begin_ = org.s_begin_;
253  s_end_ = org.s_end_;
254  trained_ = org.trained_;
255  apertures_ = org.apertures_;
256  beam = org.beam;
259 }
std::vector< LHCApertureApproximator > apertures_
apertures on the way
TMultiDimFet theta_x_parametrisation
polynomial approximation for theta_x
double nominal_beam_momentum_
GeV/c.
double s_begin_
begin of transport along the reference orbit
TMultiDimFet theta_y_parametrisation
polynomial approximation for theta_y
bool trained_
trained polynomials
double s_end_
end of transport along the reference orbit
TMultiDimFet y_parametrisation
polynomial approximation for y
TMultiDimFet x_parametrisation
polynomial approximation for x

Member Function Documentation

◆ AddRectEllipseAperture()

void LHCOpticsApproximator::AddRectEllipseAperture ( const LHCOpticsApproximator in,
double  rect_x,
double  rect_y,
double  r_el_x,
double  r_el_y 
)

◆ AllocateErrorHists()

void LHCOpticsApproximator::AllocateErrorHists ( TH1D *  err_hists[4])
private

Definition at line 720 of file LHCOpticsApproximator.cc.

References mps_fire::i.

Referenced by Test().

720  {
721  std::vector<std::string> error_labels;
722  error_labels.push_back("x error");
723  error_labels.push_back("theta_x error");
724  error_labels.push_back("y error");
725  error_labels.push_back("theta_y error");
726 
727  for (int i = 0; i < 4; ++i) {
728  err_hists[i] = new TH1D(error_labels[i].c_str(), error_labels[i].c_str(), 100, -0.0000000001, 0.0000000001);
729  err_hists[i]->SetXTitle(error_labels[i].c_str());
730  err_hists[i]->SetYTitle("counts");
731  err_hists[i]->SetDirectory(nullptr);
732  err_hists[i]->SetCanExtend(TH1::kAllAxes);
733  }
734 }

◆ AllocateErrorInputCorHists()

void LHCOpticsApproximator::AllocateErrorInputCorHists ( TH2D *  err_inp_cor_hists[4][5])
private

Definition at line 779 of file LHCOpticsApproximator.cc.

References Skims_PA_cff::name, AlCaHLTBitMon_QueryRunRegistry::string, and runGCPTkAlMap::title.

Referenced by Test().

779  {
780  std::vector<std::string> error_labels;
781  std::vector<std::string> data_labels;
782 
783  error_labels.push_back("x error");
784  error_labels.push_back("theta_x error");
785  error_labels.push_back("y error");
786  error_labels.push_back("theta_y error");
787 
788  data_labels.push_back("x input");
789  data_labels.push_back("theta_x input");
790  data_labels.push_back("y input");
791  data_labels.push_back("theta_y input");
792  data_labels.push_back("ksi input");
793 
794  for (int eri = 0; eri < 4; ++eri) {
795  for (int dati = 0; dati < 5; ++dati) {
796  std::string name = error_labels[eri] + " vs. " + data_labels[dati];
797  const std::string &title = name;
798  err_inp_cor_hists[eri][dati] =
799  new TH2D(name.c_str(), title.c_str(), 100, -0.0000000001, 0.0000000001, 100, -0.0000000001, 0.0000000001);
800  err_inp_cor_hists[eri][dati]->SetXTitle(error_labels[eri].c_str());
801  err_inp_cor_hists[eri][dati]->SetYTitle(data_labels[dati].c_str());
802  err_inp_cor_hists[eri][dati]->SetDirectory(nullptr);
803  err_inp_cor_hists[eri][dati]->SetCanExtend(TH1::kAllAxes);
804  }
805  }
806 }

◆ AllocateErrorOutputCorHists()

void LHCOpticsApproximator::AllocateErrorOutputCorHists ( TH2D *  err_out_cor_hists[4][5])
private

Definition at line 808 of file LHCOpticsApproximator.cc.

References Skims_PA_cff::name, AlCaHLTBitMon_QueryRunRegistry::string, and runGCPTkAlMap::title.

Referenced by Test().

808  {
809  std::vector<std::string> error_labels;
810  std::vector<std::string> data_labels;
811 
812  error_labels.push_back("x error");
813  error_labels.push_back("theta_x error");
814  error_labels.push_back("y error");
815  error_labels.push_back("theta_y error");
816 
817  data_labels.push_back("x output");
818  data_labels.push_back("theta_x output");
819  data_labels.push_back("y output");
820  data_labels.push_back("theta_y output");
821  data_labels.push_back("ksi output");
822 
823  for (int eri = 0; eri < 4; ++eri) {
824  for (int dati = 0; dati < 5; ++dati) {
825  std::string name = error_labels[eri] + " vs. " + data_labels[dati];
826  const std::string &title = name;
827  err_out_cor_hists[eri][dati] =
828  new TH2D(name.c_str(), title.c_str(), 100, -0.0000000001, 0.0000000001, 100, -0.0000000001, 0.0000000001);
829  err_out_cor_hists[eri][dati]->SetXTitle(error_labels[eri].c_str());
830  err_out_cor_hists[eri][dati]->SetYTitle(data_labels[dati].c_str());
831  err_out_cor_hists[eri][dati]->SetDirectory(nullptr);
832  err_out_cor_hists[eri][dati]->SetCanExtend(TH1::kAllAxes);
833  }
834  }
835 }

◆ CheckInputRange()

bool LHCOpticsApproximator::CheckInputRange ( const double *  in,
bool  invert_beam_coord_sytems = true 
) const

Definition at line 931 of file LHCOpticsApproximator.cc.

References EcalCondDBWriter_cfi::beam, mps_fire::i, and recoMuon::in.

Referenced by Transport().

933 {
934  double in_corrected[5];
935  if (beam == lhcb1 || !invert_beam_coord_sytems) {
936  in_corrected[0] = in[0];
937  in_corrected[1] = in[1];
938  in_corrected[2] = in[2];
939  in_corrected[3] = in[3];
940  in_corrected[4] = in[4];
941  } else {
942  in_corrected[0] = -in[0];
943  in_corrected[1] = -in[1];
944  in_corrected[2] = in[2];
945  in_corrected[3] = in[3];
946  in_corrected[4] = in[4];
947  }
948 
949  const TVectorD *min_var = x_parametrisation.GetMinVariables();
950  const TVectorD *max_var = x_parametrisation.GetMaxVariables();
951  bool res = true;
952 
953  for (int i = 0; i < 5; i++) {
954  res = res && in_corrected[i] >= (*min_var)(i) && in_corrected[i] <= (*max_var)(i);
955  }
956  return res;
957 }
Definition: Electron.h:6
const TVectorD * GetMinVariables() const
Definition: TMultiDimFet.h:166
const TVectorD * GetMaxVariables() const
Definition: TMultiDimFet.h:160
TMultiDimFet x_parametrisation
polynomial approximation for x

◆ DeleteErrorCorHistograms()

void LHCOpticsApproximator::DeleteErrorCorHistograms ( TH2D *  err_cor_hists[4][5])
private

Definition at line 857 of file LHCOpticsApproximator.cc.

Referenced by Test().

857  {
858  for (int eri = 0; eri < 4; ++eri) {
859  for (int dati = 0; dati < 5; ++dati) {
860  delete err_cor_hists[eri][dati];
861  }
862  }
863 }

◆ DeleteErrorHists()

void LHCOpticsApproximator::DeleteErrorHists ( TH1D *  err_hists[4])
private

Definition at line 851 of file LHCOpticsApproximator.cc.

References mps_fire::i.

Referenced by Test().

851  {
852  for (int i = 0; i < 4; ++i) {
853  delete err_hists[i];
854  }
855 }

◆ FillErrorDataCorHistograms()

void LHCOpticsApproximator::FillErrorDataCorHistograms ( double  errors[4],
double  var[5],
TH2D *  err_cor_hists[4][5] 
)
private

Definition at line 843 of file LHCOpticsApproximator.cc.

References trigObjTnPSource_cfi::var.

Referenced by Test().

843  {
844  for (int eri = 0; eri < 4; ++eri) {
845  for (int dati = 0; dati < 5; ++dati) {
846  err_cor_hists[eri][dati]->Fill(errors[eri], var[dati]);
847  }
848  }
849 }
Definition: errors.py:1

◆ FillErrorHistograms()

void LHCOpticsApproximator::FillErrorHistograms ( double  errors[4],
TH1D *  err_hists[4] 
)
private

Definition at line 837 of file LHCOpticsApproximator.cc.

References mps_fire::i.

Referenced by Test().

837  {
838  for (int i = 0; i < 4; ++i) {
839  err_hists[i]->Fill(errors[i]);
840  }
841 }
Definition: errors.py:1

◆ GetBeamType()

beam_type LHCOpticsApproximator::GetBeamType ( ) const
inline

Definition at line 145 of file LHCOpticsApproximator.h.

References beam.

145 { return beam; }

◆ GetDx()

double LHCOpticsApproximator::GetDx ( double  mad_init_x,
double  mad_init_thx,
double  mad_init_y,
double  mad_init_thy,
double  mad_init_xi,
double  d_mad_xi = 0.001 
)

Definition at line 1153 of file LHCOpticsApproximator.cc.

References recoMuon::in, MillePedeFileConverter_cfg::out, Transport(), and testProducerWithPsetDescEmpty_cfi::x1.

1158  {
1159  double in[5];
1160  in[0] = mad_init_x;
1161  in[1] = mad_init_thx;
1162  in[2] = mad_init_y;
1163  in[3] = mad_init_thy;
1164  in[4] = mad_init_xi;
1165 
1166  double out[5];
1167 
1168  Transport(in, out);
1169  double x1 = out[0];
1170 
1171  in[4] = mad_init_xi + d_mad_xi;
1172  Transport(in, out);
1173  double x2_dxi = out[0];
1174  double dispersion = (x2_dxi - x1) / d_mad_xi;
1175 
1176  return dispersion;
1177 }
bool Transport(const double *in, double *out, bool check_apertures=false, bool invert_beam_coord_sytems=true) const

◆ GetDxds()

double LHCOpticsApproximator::GetDxds ( double  mad_init_x,
double  mad_init_thx,
double  mad_init_y,
double  mad_init_thy,
double  mad_init_xi,
double  d_mad_xi = 0.001 
)

Definition at line 1181 of file LHCOpticsApproximator.cc.

References recoMuon::in, MillePedeFileConverter_cfg::out, and Transport().

1186  {
1187  double MADX_momentum_correction_factor = 1.0 + mad_init_xi;
1188  double in[5];
1189  in[0] = mad_init_x;
1190  in[1] = mad_init_thx;
1191  in[2] = mad_init_y;
1192  in[3] = mad_init_thy;
1193  in[4] = mad_init_xi;
1194 
1195  double out[5];
1196 
1197  Transport(in, out);
1198  double thx1 = out[1] / MADX_momentum_correction_factor;
1199 
1200  in[4] = mad_init_xi + d_mad_xi;
1201  Transport(in, out);
1202  double thx2_dxi = out[1] / MADX_momentum_correction_factor;
1203  double dispersion = (thx2_dxi - thx1) / d_mad_xi;
1204 
1205  return dispersion;
1206 }
bool Transport(const double *in, double *out, bool check_apertures=false, bool invert_beam_coord_sytems=true) const

◆ GetLinearApproximation()

void LHCOpticsApproximator::GetLinearApproximation ( double  atPoint[],
double &  Cx,
double &  Lx,
double &  vx,
double &  Cy,
double &  Ly,
double &  vy,
double &  D,
double  ep = 1E-5 
)

returns linear approximation of the transport parameterization takes numerical derivatives (see parameter ep) around point ‘atPoint’ (this array has the same structure as ‘in’ parameter in Transport method) the linearized transport: x = Cx + Lx*theta_x + vx*x_star

Definition at line 1033 of file LHCOpticsApproximator.cc.

References SiStripBadComponentsDQMServiceTemplate_cfg::ep, mps_fire::i, MillePedeFileConverter_cfg::out, Transport2D(), run3scouting_cff::vx, and run3scouting_cff::vy.

1034  {
1035  double out[2];
1036  Transport2D(atPoint, out);
1037  Cx = out[0];
1038  Cy = out[1];
1039 
1040  for (int i = 0; i < 5; i++) {
1041  atPoint[i] += ep;
1042  Transport2D(atPoint, out);
1043  switch (i) {
1044  case 0:
1045  vx = (out[0] - Cx) / ep;
1046  break;
1047  case 1:
1048  Lx = (out[0] - Cx) / ep;
1049  break;
1050  case 2:
1051  vy = (out[1] - Cy) / ep;
1052  break;
1053  case 3:
1054  Ly = (out[1] - Cy) / ep;
1055  break;
1056  case 4:
1057  D = (out[0] - Cx) / ep;
1058  break;
1059  }
1060  atPoint[i] -= ep;
1061  }
1062 }
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
bool Transport2D(const double *in, double *out, bool check_apertures=false, bool invert_beam_coord_sytems=true) const

◆ GetLineariasedTransportMatrixX()

void LHCOpticsApproximator::GetLineariasedTransportMatrixX ( double  mad_init_x,
double  mad_init_thx,
double  mad_init_y,
double  mad_init_thy,
double  mad_init_xi,
TMatrixD &  tr_matrix,
double  d_mad_x = 10e-6,
double  d_mad_thx = 10e-6 
)

returns linearised transport matrix for x projection | dx_out/dx_in dx_out/dthx_in | | dthx_out/dx_in dthx_out/dthx_in |

input: [m], [rad], xi:-1...0

Definition at line 1065 of file LHCOpticsApproximator.cc.

References recoMuon::in, MillePedeFileConverter_cfg::out, Transport(), and testProducerWithPsetDescEmpty_cfi::x1.

1072  {
1073  double MADX_momentum_correction_factor = 1.0 + mad_init_xi;
1074  transp_matrix.ResizeTo(2, 2);
1075  double in[5];
1076  in[0] = mad_init_x;
1077  in[1] = mad_init_thx;
1078  in[2] = mad_init_y;
1079  in[3] = mad_init_thy;
1080  in[4] = mad_init_xi;
1081 
1082  double out[5];
1083 
1084  Transport(in, out);
1085  double x1 = out[0];
1086  double thx1 = out[1];
1087 
1088  in[0] = mad_init_x + d_mad_x;
1089  Transport(in, out);
1090  double x2_dx = out[0];
1091  double thx2_dx = out[1];
1092 
1093  in[0] = mad_init_x;
1094  in[1] = mad_init_thx + d_mad_thx; //?
1095  Transport(in, out);
1096  double x2_dthx = out[0];
1097  double thx2_dthx = out[1];
1098 
1099  // | dx/dx, dx/dthx |
1100  // | dthx/dx, dtchx/dthx |
1101 
1102  transp_matrix(0, 0) = (x2_dx - x1) / d_mad_x;
1103  transp_matrix(1, 0) = (thx2_dx - thx1) / (d_mad_x * MADX_momentum_correction_factor);
1104  transp_matrix(0, 1) = MADX_momentum_correction_factor * (x2_dthx - x1) / d_mad_thx;
1105  transp_matrix(1, 1) = (thx2_dthx - thx1) / d_mad_thx;
1106 }
bool Transport(const double *in, double *out, bool check_apertures=false, bool invert_beam_coord_sytems=true) const

◆ GetLineariasedTransportMatrixY()

void LHCOpticsApproximator::GetLineariasedTransportMatrixY ( double  mad_init_x,
double  mad_init_thx,
double  mad_init_y,
double  mad_init_thy,
double  mad_init_xi,
TMatrixD &  tr_matrix,
double  d_mad_y = 10e-6,
double  d_mad_thy = 10e-6 
)

returns linearised transport matrix for y projection | dy_out/dy_in dy_out/dthy_in | | dthy_out/dy_in dthy_out/dthy_in |

input: [m], [rad], xi:-1...0

Definition at line 1109 of file LHCOpticsApproximator.cc.

References recoMuon::in, MillePedeFileConverter_cfg::out, Transport(), and testProducerWithPsetDescEmpty_cfi::y1.

1116  {
1117  double MADX_momentum_correction_factor = 1.0 + mad_init_xi;
1118  transp_matrix.ResizeTo(2, 2);
1119  double in[5];
1120  in[0] = mad_init_x;
1121  in[1] = mad_init_thx;
1122  in[2] = mad_init_y;
1123  in[3] = mad_init_thy;
1124  in[4] = mad_init_xi;
1125 
1126  double out[5];
1127 
1128  Transport(in, out);
1129  double y1 = out[2];
1130  double thy1 = out[3];
1131 
1132  in[2] = mad_init_y + d_mad_y;
1133  Transport(in, out);
1134  double y2_dy = out[2];
1135  double thy2_dy = out[3];
1136 
1137  in[2] = mad_init_y;
1138  in[3] = mad_init_thy + d_mad_thy; //?
1139  Transport(in, out);
1140  double y2_dthy = out[2];
1141  double thy2_dthy = out[3];
1142 
1143  // | dy/dy, dy/dthy |
1144  // | dthy/dy, dtchy/dthy |
1145 
1146  transp_matrix(0, 0) = (y2_dy - y1) / d_mad_y;
1147  transp_matrix(1, 0) = (thy2_dy - thy1) / (d_mad_y * MADX_momentum_correction_factor);
1148  transp_matrix(0, 1) = MADX_momentum_correction_factor * (y2_dthy - y1) / d_mad_thy;
1149  transp_matrix(1, 1) = (thy2_dthy - thy1) / d_mad_thy;
1150 }
bool Transport(const double *in, double *out, bool check_apertures=false, bool invert_beam_coord_sytems=true) const

◆ Init()

void LHCOpticsApproximator::Init ( void  )
private

Definition at line 15 of file LHCOpticsApproximator.cc.

References apertures_, coord_names, out_polynomials, s_begin_, s_end_, theta_x_parametrisation, theta_y_parametrisation, trained_, x_parametrisation, and y_parametrisation.

Referenced by LHCOpticsApproximator(), and operator=().

15  {
16  out_polynomials.clear();
17  apertures_.clear();
22 
23  coord_names.clear();
24  coord_names.push_back("x");
25  coord_names.push_back("theta_x");
26  coord_names.push_back("y");
27  coord_names.push_back("theta_y");
28  coord_names.push_back("ksi");
29 
30  s_begin_ = 0.0;
31  s_end_ = 0.0;
32  trained_ = false;
33 }
std::vector< LHCApertureApproximator > apertures_
apertures on the way
TMultiDimFet theta_x_parametrisation
polynomial approximation for theta_x
double s_begin_
begin of transport along the reference orbit
TMultiDimFet theta_y_parametrisation
polynomial approximation for theta_y
bool trained_
trained polynomials
std::vector< TMultiDimFet * > out_polynomials
double s_end_
end of transport along the reference orbit
std::vector< std::string > coord_names
pointers to polynomials
TMultiDimFet y_parametrisation
polynomial approximation for y
TMultiDimFet x_parametrisation
polynomial approximation for x

◆ InitializeApproximators()

void LHCOpticsApproximator::InitializeApproximators ( polynomials_selection  mode,
int  max_degree_x,
int  max_degree_tx,
int  max_degree_y,
int  max_degree_ty,
bool  common_terms 
)
private

Definition at line 391 of file LHCOpticsApproximator.cc.

References ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, PREDEFINED, SetDefaultAproximatorSettings(), SetTermsManually(), THETA_X, theta_x_parametrisation, THETA_Y, theta_y_parametrisation, X, x_parametrisation, Y, and y_parametrisation.

Referenced by Train().

396  {
401 
402  if (mode == PREDEFINED) {
403  SetTermsManually(x_parametrisation, VariableType::X, max_degree_x, common_terms);
404  SetTermsManually(theta_x_parametrisation, VariableType::THETA_X, max_degree_tx, common_terms);
405  SetTermsManually(y_parametrisation, VariableType::Y, max_degree_y, common_terms);
406  SetTermsManually(theta_y_parametrisation, VariableType::THETA_Y, max_degree_ty, common_terms);
407  }
408 }
TMultiDimFet theta_x_parametrisation
polynomial approximation for theta_x
void SetTermsManually(TMultiDimFet &approximator, VariableType variable, int max_degree, bool common_terms)
TMultiDimFet theta_y_parametrisation
polynomial approximation for theta_y
void SetDefaultAproximatorSettings(TMultiDimFet &approximator, VariableType var_type, int max_degree)
TMultiDimFet y_parametrisation
polynomial approximation for y
TMultiDimFet x_parametrisation
polynomial approximation for x

◆ operator=()

const LHCOpticsApproximator & LHCOpticsApproximator::operator= ( const LHCOpticsApproximator org)

Definition at line 261 of file LHCOpticsApproximator.cc.

References apertures_, beam, Init(), nominal_beam_energy_, nominal_beam_momentum_, s_begin_, s_end_, theta_x_parametrisation, theta_y_parametrisation, trained_, x_parametrisation, and y_parametrisation.

261  {
262  if (this != &org) {
267  Init();
268 
269  TNamed::operator=(org);
270  s_begin_ = org.s_begin_;
271  s_end_ = org.s_end_;
272  trained_ = org.trained_;
273 
274  apertures_ = org.apertures_;
275  beam = org.beam;
278  }
279  return org;
280 }
std::vector< LHCApertureApproximator > apertures_
apertures on the way
TMultiDimFet theta_x_parametrisation
polynomial approximation for theta_x
double nominal_beam_momentum_
GeV/c.
double s_begin_
begin of transport along the reference orbit
TMultiDimFet theta_y_parametrisation
polynomial approximation for theta_y
bool trained_
trained polynomials
double s_end_
end of transport along the reference orbit
TMultiDimFet y_parametrisation
polynomial approximation for y
TMultiDimFet x_parametrisation
polynomial approximation for x

◆ ParameterOutOfRangePenalty()

double LHCOpticsApproximator::ParameterOutOfRangePenalty ( double  par_m[],
bool  invert_beam_coord_sytems = true 
) const

Definition at line 68 of file LHCOpticsApproximator.cc.

References beam, TMultiDimFet::GetMaxVariables(), TMultiDimFet::GetMinVariables(), mps_fire::i, recoMuon::in, lhcb1, and x_parametrisation.

68  {
69  double in_corrected[5];
70  if (beam == lhcb1 || !invert_beam_coord_sytems) {
71  in_corrected[0] = in[0];
72  in_corrected[1] = in[1];
73  in_corrected[2] = in[2];
74  in_corrected[3] = in[3];
75  in_corrected[4] = in[4];
76  } else {
77  in_corrected[0] = -in[0];
78  in_corrected[1] = -in[1];
79  in_corrected[2] = in[2];
80  in_corrected[3] = in[3];
81  in_corrected[4] = in[4];
82  }
83 
84  const TVectorD *min_var = x_parametrisation.GetMinVariables();
85  const TVectorD *max_var = x_parametrisation.GetMaxVariables();
86  double res = 0.;
87 
88  for (int i = 0; i < 5; i++) {
89  if (in_corrected[i] < (*min_var)(i)) {
90  double dist = TMath::Abs(((*min_var)(i)-in_corrected[i]) / ((*max_var)(i) - (*min_var)(i)));
91  res += 8 * (TMath::Exp(dist) - 1.0);
92  in_corrected[i] = (*min_var)(i);
93  } else if (in_corrected[i] > (*max_var)(i)) {
94  double dist = TMath::Abs((in_corrected[i] - (*max_var)(i)) / ((*max_var)(i) - (*min_var)(i)));
95  res += 8 * (TMath::Exp(dist) - 1.0);
96  in_corrected[i] = (*max_var)(i);
97  }
98  }
99  return res;
100 }
Definition: Electron.h:6
const TVectorD * GetMinVariables() const
Definition: TMultiDimFet.h:166
const TVectorD * GetMaxVariables() const
Definition: TMultiDimFet.h:160
TMultiDimFet x_parametrisation
polynomial approximation for x

◆ PrintCoordinateOpticalFunctions()

void LHCOpticsApproximator::PrintCoordinateOpticalFunctions ( TMultiDimFet parametrization,
const std::string &  coord_name,
const std::vector< std::string > &  input_vars 
)

Definition at line 1002 of file LHCOpticsApproximator.cc.

References MillePedeFileConverter_cfg::e, mps_fire::i, recoMuon::in, dqmiolumiharvest::j, and stringResolutionProvider_cfi::parametrization.

Referenced by PrintOpticalFunctions().

1004  {
1005  double in[5];
1006  // double out;
1007  double d_out_d_in[5];
1008  double d_par = 1e-5;
1009  double bias = 0;
1010 
1011  for (int j = 0; j < 5; j++)
1012  in[j] = 0.0;
1013 
1014  bias = parametrization.Eval(in);
1015 
1016  for (int i = 0; i < 5; i++) {
1017  for (int j = 0; j < 5; j++)
1018  in[j] = 0.0;
1019 
1020  in[i] = d_par;
1021  d_out_d_in[i] = parametrization.Eval(in);
1022  in[i] = 0.0;
1023  d_out_d_in[i] = d_out_d_in[i] - parametrization.Eval(in);
1024  d_out_d_in[i] = d_out_d_in[i] / d_par;
1025  }
1026  edm::LogInfo("LHCOpticsApproximator") << coord_name << " = " << bias;
1027  for (int i = 0; i < 5; i++) {
1028  edm::LogInfo("LHCOpticsApproximator") << " + " << d_out_d_in[i] << "*" << input_vars[i];
1029  }
1030  edm::LogInfo("LHCOpticsApproximator") << "\n";
1031 }
parametrization
specify parametrization (see SWGuidePATKinematicResolutions for more details)
Log< level::Info, false > LogInfo

◆ PrintInputRange()

void LHCOpticsApproximator::PrintInputRange ( )

Definition at line 919 of file LHCOpticsApproximator.cc.

References coord_names, TMultiDimFet::GetMaxVariables(), TMultiDimFet::GetMinVariables(), mps_fire::i, and x_parametrisation.

Referenced by Train().

919  {
920  const TVectorD *min_var = x_parametrisation.GetMinVariables();
921  const TVectorD *max_var = x_parametrisation.GetMaxVariables();
922 
923  edm::LogInfo("LHCOpticsApproximator") << "Covered input parameters range:"
924  << "\n";
925  for (int i = 0; i < 5; i++) {
926  edm::LogInfo("LHCOpticsApproximator") << (*min_var)(i) << " < " << coord_names[i] << " < " << (*max_var)(i) << "\n";
927  }
928  edm::LogInfo("LHCOpticsApproximator") << "\n";
929 }
Log< level::Info, false > LogInfo
const TVectorD * GetMinVariables() const
Definition: TMultiDimFet.h:166
const TVectorD * GetMaxVariables() const
Definition: TMultiDimFet.h:160
std::vector< std::string > coord_names
pointers to polynomials
TMultiDimFet x_parametrisation
polynomial approximation for x

◆ PrintOpticalFunctions()

void LHCOpticsApproximator::PrintOpticalFunctions ( )

Definition at line 993 of file LHCOpticsApproximator.cc.

References coord_names, mps_fire::i, out_polynomials, and PrintCoordinateOpticalFunctions().

993  {
994  edm::LogInfo("LHCOpticsApproximator") << std::endl
995  << "Linear terms of optical functions:"
996  << "\n";
997  for (int i = 0; i < 4; i++) {
999  }
1000 }
void PrintCoordinateOpticalFunctions(TMultiDimFet &parametrization, const std::string &coord_name, const std::vector< std::string > &input_vars)
std::vector< TMultiDimFet * > out_polynomials
Log< level::Info, false > LogInfo
std::vector< std::string > coord_names
pointers to polynomials

◆ SetDefaultAproximatorSettings()

void LHCOpticsApproximator::SetDefaultAproximatorSettings ( TMultiDimFet approximator,
VariableType  var_type,
int  max_degree 
)
private

Definition at line 410 of file LHCOpticsApproximator.cc.

References MillePedeFileConverter_cfg::e, TMultiDimFet::SetMaxAngle(), TMultiDimFet::SetMaxFunctions(), TMultiDimFet::SetMaxPowers(), TMultiDimFet::SetMaxStudy(), TMultiDimFet::SetMaxTerms(), TMultiDimFet::SetMinAngle(), TMultiDimFet::SetMinRelativeError(), TMultiDimFet::SetPowerLimit(), THETA_X, THETA_Y, X, and Y.

Referenced by InitializeApproximators().

412  {
413  if (max_degree < 1 || max_degree > 20)
414  max_degree = 10;
415 
416  if (var_type == VariableType::X || var_type == VariableType::THETA_X) {
417  Int_t mPowers[] = {1, 1, 0, 0, max_degree};
418  approximator.SetMaxPowers(mPowers);
419  approximator.SetMaxFunctions(900);
420  approximator.SetMaxStudy(1000);
421  approximator.SetMaxTerms(900);
422  approximator.SetPowerLimit(1.50);
423  approximator.SetMinAngle(10);
424  approximator.SetMaxAngle(10);
425  approximator.SetMinRelativeError(1e-13);
426  }
427 
428  if (var_type == VariableType::Y || var_type == VariableType::THETA_Y) {
429  Int_t mPowers[] = {0, 0, 1, 1, max_degree};
430  approximator.SetMaxPowers(mPowers);
431  approximator.SetMaxFunctions(900);
432  approximator.SetMaxStudy(1000);
433  approximator.SetMaxTerms(900);
434  approximator.SetPowerLimit(1.50);
435  approximator.SetMinAngle(10);
436  approximator.SetMaxAngle(10);
437  approximator.SetMinRelativeError(1e-13);
438  }
439 }
void SetPowerLimit(Double_t limit=1e-3)
void SetMaxPowers(const Int_t *powers)
void SetMaxTerms(Int_t terms)
Definition: TMultiDimFet.h:206
void SetMinRelativeError(Double_t error)
void SetMaxStudy(Int_t n)
Definition: TMultiDimFet.h:205
void SetMaxFunctions(Int_t n)
Definition: TMultiDimFet.h:203
void SetMinAngle(Double_t angle=1)
void SetMaxAngle(Double_t angle=0)

◆ SetTermsManually()

void LHCOpticsApproximator::SetTermsManually ( TMultiDimFet approximator,
VariableType  variable,
int  max_degree,
bool  common_terms 
)
private

Definition at line 441 of file LHCOpticsApproximator.cc.

References mps_fire::i, TMultiDimFet::SetPowers(), THETA_X, THETA_Y, taus_updatedMVAIds_cff::variable, X, and Y.

Referenced by InitializeApproximators().

444  {
445  if (max_degree < 1 || max_degree > 20)
446  max_degree = 10;
447 
448  //put terms of shape:
449  //1,0,0,0,t 0,1,0,0,t 0,2,0,0,t 0,3,0,0,t 0,0,0,0,t
450  //t: 0,1,...,max_degree
451 
452  std::vector<Int_t> term_literals;
453  term_literals.reserve(5000);
454 
456  //1,0,0,0,t
457  for (int i = 0; i <= max_degree; ++i) {
458  term_literals.push_back(1);
459  term_literals.push_back(0);
460  term_literals.push_back(0);
461  term_literals.push_back(0);
462  term_literals.push_back(i);
463  }
464  //0,1,0,0,t
465  for (int i = 0; i <= max_degree; ++i) {
466  term_literals.push_back(0);
467  term_literals.push_back(1);
468  term_literals.push_back(0);
469  term_literals.push_back(0);
470  term_literals.push_back(i);
471  }
472  //0,2,0,0,t
473  for (int i = 0; i <= max_degree; ++i) {
474  term_literals.push_back(0);
475  term_literals.push_back(2);
476  term_literals.push_back(0);
477  term_literals.push_back(0);
478  term_literals.push_back(i);
479  }
480  //0,3,0,0,t
481  for (int i = 0; i <= max_degree; ++i) {
482  term_literals.push_back(0);
483  term_literals.push_back(3);
484  term_literals.push_back(0);
485  term_literals.push_back(0);
486  term_literals.push_back(i);
487  }
488  //0,0,0,0,t
489  for (int i = 0; i <= max_degree; ++i) {
490  term_literals.push_back(0);
491  term_literals.push_back(0);
492  term_literals.push_back(0);
493  term_literals.push_back(0);
494  term_literals.push_back(i);
495  }
496  }
497 
499  //0,0,1,0,t
500  for (int i = 0; i <= max_degree; ++i) {
501  term_literals.push_back(0);
502  term_literals.push_back(0);
503  term_literals.push_back(1);
504  term_literals.push_back(0);
505  term_literals.push_back(i);
506  }
507  //0,0,0,1,t
508  for (int i = 0; i <= max_degree; ++i) {
509  term_literals.push_back(0);
510  term_literals.push_back(0);
511  term_literals.push_back(0);
512  term_literals.push_back(1);
513  term_literals.push_back(i);
514  }
515  //0,0,0,2,t
516  for (int i = 0; i <= max_degree; ++i) {
517  term_literals.push_back(0);
518  term_literals.push_back(0);
519  term_literals.push_back(0);
520  term_literals.push_back(2);
521  term_literals.push_back(i);
522  }
523  //0,0,0,3,t
524  for (int i = 0; i <= max_degree; ++i) {
525  term_literals.push_back(0);
526  term_literals.push_back(0);
527  term_literals.push_back(0);
528  term_literals.push_back(3);
529  term_literals.push_back(i);
530  }
531  //0,0,0,0,t
532  for (int i = 0; i <= max_degree; ++i) {
533  term_literals.push_back(0);
534  term_literals.push_back(0);
535  term_literals.push_back(0);
536  term_literals.push_back(0);
537  term_literals.push_back(i);
538  }
539  }
540 
541  //push common terms
542  if (common_terms) {
543  term_literals.push_back(1), term_literals.push_back(1), term_literals.push_back(0), term_literals.push_back(0),
544  term_literals.push_back(0);
545  term_literals.push_back(1), term_literals.push_back(0), term_literals.push_back(1), term_literals.push_back(0),
546  term_literals.push_back(0);
547  term_literals.push_back(1), term_literals.push_back(0), term_literals.push_back(0), term_literals.push_back(1),
548  term_literals.push_back(0);
549  term_literals.push_back(0), term_literals.push_back(1), term_literals.push_back(1), term_literals.push_back(0),
550  term_literals.push_back(0);
551  term_literals.push_back(0), term_literals.push_back(1), term_literals.push_back(0), term_literals.push_back(1),
552  term_literals.push_back(0);
553  term_literals.push_back(0), term_literals.push_back(0), term_literals.push_back(1), term_literals.push_back(1),
554  term_literals.push_back(0);
555 
556  term_literals.push_back(1), term_literals.push_back(1), term_literals.push_back(0), term_literals.push_back(0),
557  term_literals.push_back(1);
558  term_literals.push_back(1), term_literals.push_back(0), term_literals.push_back(1), term_literals.push_back(0),
559  term_literals.push_back(1);
560  term_literals.push_back(1), term_literals.push_back(0), term_literals.push_back(0), term_literals.push_back(1),
561  term_literals.push_back(1);
562  term_literals.push_back(0), term_literals.push_back(1), term_literals.push_back(1), term_literals.push_back(0),
563  term_literals.push_back(1);
564  term_literals.push_back(0), term_literals.push_back(1), term_literals.push_back(0), term_literals.push_back(1),
565  term_literals.push_back(1);
566  term_literals.push_back(0), term_literals.push_back(0), term_literals.push_back(1), term_literals.push_back(1),
567  term_literals.push_back(1);
568 
569  term_literals.push_back(1), term_literals.push_back(2), term_literals.push_back(0), term_literals.push_back(0),
570  term_literals.push_back(0);
571  term_literals.push_back(1), term_literals.push_back(0), term_literals.push_back(2), term_literals.push_back(0),
572  term_literals.push_back(0);
573  term_literals.push_back(1), term_literals.push_back(0), term_literals.push_back(0), term_literals.push_back(2),
574  term_literals.push_back(0);
575  term_literals.push_back(2), term_literals.push_back(1), term_literals.push_back(0), term_literals.push_back(0),
576  term_literals.push_back(0);
577  term_literals.push_back(0), term_literals.push_back(1), term_literals.push_back(2), term_literals.push_back(0),
578  term_literals.push_back(0);
579  term_literals.push_back(0), term_literals.push_back(1), term_literals.push_back(0), term_literals.push_back(2),
580  term_literals.push_back(0);
581  term_literals.push_back(2), term_literals.push_back(0), term_literals.push_back(1), term_literals.push_back(0),
582  term_literals.push_back(0);
583  term_literals.push_back(0), term_literals.push_back(2), term_literals.push_back(1), term_literals.push_back(0),
584  term_literals.push_back(0);
585  term_literals.push_back(0), term_literals.push_back(0), term_literals.push_back(1), term_literals.push_back(2),
586  term_literals.push_back(0);
587  term_literals.push_back(2), term_literals.push_back(0), term_literals.push_back(0), term_literals.push_back(1),
588  term_literals.push_back(0);
589  term_literals.push_back(0), term_literals.push_back(2), term_literals.push_back(0), term_literals.push_back(1),
590  term_literals.push_back(0);
591  term_literals.push_back(0), term_literals.push_back(0), term_literals.push_back(2), term_literals.push_back(1),
592  term_literals.push_back(0);
593 
594  term_literals.push_back(1), term_literals.push_back(2), term_literals.push_back(0), term_literals.push_back(0),
595  term_literals.push_back(1);
596  term_literals.push_back(1), term_literals.push_back(0), term_literals.push_back(2), term_literals.push_back(0),
597  term_literals.push_back(1);
598  term_literals.push_back(1), term_literals.push_back(0), term_literals.push_back(0), term_literals.push_back(2),
599  term_literals.push_back(1);
600  term_literals.push_back(2), term_literals.push_back(1), term_literals.push_back(0), term_literals.push_back(0),
601  term_literals.push_back(1);
602  term_literals.push_back(0), term_literals.push_back(1), term_literals.push_back(2), term_literals.push_back(0),
603  term_literals.push_back(1);
604  term_literals.push_back(0), term_literals.push_back(1), term_literals.push_back(0), term_literals.push_back(2),
605  term_literals.push_back(1);
606  term_literals.push_back(2), term_literals.push_back(0), term_literals.push_back(1), term_literals.push_back(0),
607  term_literals.push_back(1);
608  term_literals.push_back(0), term_literals.push_back(2), term_literals.push_back(1), term_literals.push_back(0),
609  term_literals.push_back(1);
610  term_literals.push_back(0), term_literals.push_back(0), term_literals.push_back(1), term_literals.push_back(2),
611  term_literals.push_back(1);
612  term_literals.push_back(2), term_literals.push_back(0), term_literals.push_back(0), term_literals.push_back(1),
613  term_literals.push_back(1);
614  term_literals.push_back(0), term_literals.push_back(2), term_literals.push_back(0), term_literals.push_back(1),
615  term_literals.push_back(1);
616  term_literals.push_back(0), term_literals.push_back(0), term_literals.push_back(2), term_literals.push_back(1),
617  term_literals.push_back(1);
618  }
619 
620  std::vector<Int_t> powers;
621  powers.resize(term_literals.size());
622 
623  for (unsigned int i = 0; i < term_literals.size(); ++i) {
624  powers[i] = term_literals[i];
625  }
626  approximator.SetPowers(&powers[0], term_literals.size() / 5);
627 }
virtual void SetPowers(const Int_t *powers, Int_t terms)

◆ Test()

void LHCOpticsApproximator::Test ( TTree *  inp_tree,
TFile *  f_out,
std::string  data_prefix = std::string("def"),
std::string  base_out_dir = std::string("") 
)

Definition at line 629 of file LHCOpticsApproximator.cc.

References AllocateErrorHists(), AllocateErrorInputCorHists(), AllocateErrorOutputCorHists(), DeleteErrorCorHistograms(), DeleteErrorHists(), TMultiDimFet::Eval(), FillErrorDataCorHistograms(), FillErrorHistograms(), mps_fire::i, AlCaHLTBitMon_QueryRunRegistry::string, theta_x_parametrisation, theta_y_parametrisation, WriteHistograms(), x_parametrisation, and y_parametrisation.

629  {
630  if (inp_tree == nullptr || f_out == nullptr)
631  return;
632 
633  //in-variables
634  //x_in, theta_x_in, y_in, theta_y_in, ksi_in, s_in
635  double in_var[6];
636 
637  //out-variables
638  //x_out, theta_x_out, y_out, theta_y_out, ksi_out, s_out, valid_out;
639  double out_var[7];
640 
641  //in- out-lables
642  std::string x_in_lab = "x_in";
643  std::string theta_x_in_lab = "theta_x_in";
644  std::string y_in_lab = "y_in";
645  std::string theta_y_in_lab = "theta_y_in";
646  std::string ksi_in_lab = "ksi_in";
647  std::string s_in_lab = "s_in";
648 
649  std::string x_out_lab = data_prefix + "_x_out";
650  std::string theta_x_out_lab = data_prefix + "_theta_x_out";
651  std::string y_out_lab = data_prefix + "_y_out";
652  std::string theta_y_out_lab = data_prefix + "_theta_y_out";
653  std::string ksi_out_lab = data_prefix + "_ksi_out";
654  std::string s_out_lab = data_prefix + "_s_out";
655  std::string valid_out_lab = data_prefix + "_valid_out";
656 
657  //disable not needed branches to speed up the readin
658  inp_tree->SetBranchStatus("*", false); //disable all branches
659  inp_tree->SetBranchStatus(x_in_lab.c_str(), true);
660  inp_tree->SetBranchStatus(theta_x_in_lab.c_str(), true);
661  inp_tree->SetBranchStatus(y_in_lab.c_str(), true);
662  inp_tree->SetBranchStatus(theta_y_in_lab.c_str(), true);
663  inp_tree->SetBranchStatus(ksi_in_lab.c_str(), true);
664  inp_tree->SetBranchStatus(x_out_lab.c_str(), true);
665  inp_tree->SetBranchStatus(theta_x_out_lab.c_str(), true);
666  inp_tree->SetBranchStatus(y_out_lab.c_str(), true);
667  inp_tree->SetBranchStatus(theta_y_out_lab.c_str(), true);
668  inp_tree->SetBranchStatus(ksi_out_lab.c_str(), true);
669  inp_tree->SetBranchStatus(valid_out_lab.c_str(), true);
670 
671  //set input data adresses
672  inp_tree->SetBranchAddress(x_in_lab.c_str(), &(in_var[0]));
673  inp_tree->SetBranchAddress(theta_x_in_lab.c_str(), &(in_var[1]));
674  inp_tree->SetBranchAddress(y_in_lab.c_str(), &(in_var[2]));
675  inp_tree->SetBranchAddress(theta_y_in_lab.c_str(), &(in_var[3]));
676  inp_tree->SetBranchAddress(ksi_in_lab.c_str(), &(in_var[4]));
677  inp_tree->SetBranchAddress(s_in_lab.c_str(), &(in_var[5]));
678 
679  //set output data adresses
680  inp_tree->SetBranchAddress(x_out_lab.c_str(), &(out_var[0]));
681  inp_tree->SetBranchAddress(theta_x_out_lab.c_str(), &(out_var[1]));
682  inp_tree->SetBranchAddress(y_out_lab.c_str(), &(out_var[2]));
683  inp_tree->SetBranchAddress(theta_y_out_lab.c_str(), &(out_var[3]));
684  inp_tree->SetBranchAddress(ksi_out_lab.c_str(), &(out_var[4]));
685  inp_tree->SetBranchAddress(s_out_lab.c_str(), &(out_var[5]));
686  inp_tree->SetBranchAddress(valid_out_lab.c_str(), &(out_var[6]));
687 
688  //test histogramms
689  TH1D *err_hists[4];
690  TH2D *err_inp_cor_hists[4][5];
691  TH2D *err_out_cor_hists[4][5];
692 
693  AllocateErrorHists(err_hists);
694  AllocateErrorInputCorHists(err_inp_cor_hists);
695  AllocateErrorOutputCorHists(err_out_cor_hists);
696 
697  Long64_t entries = inp_tree->GetEntries();
698  //set input and output variables for fitting
699  for (Long64_t i = 0; i < entries; ++i) {
700  double errors[4];
701  inp_tree->GetEntry(i);
702 
703  errors[0] = out_var[0] - x_parametrisation.Eval(in_var);
704  errors[1] = out_var[1] - theta_x_parametrisation.Eval(in_var);
705  errors[2] = out_var[2] - y_parametrisation.Eval(in_var);
706  errors[3] = out_var[3] - theta_y_parametrisation.Eval(in_var);
707 
708  FillErrorHistograms(errors, err_hists);
709  FillErrorDataCorHistograms(errors, in_var, err_inp_cor_hists);
710  FillErrorDataCorHistograms(errors, out_var, err_out_cor_hists);
711  }
712 
713  WriteHistograms(err_hists, err_inp_cor_hists, err_out_cor_hists, f_out, base_out_dir);
714 
715  DeleteErrorHists(err_hists);
716  DeleteErrorCorHistograms(err_inp_cor_hists);
717  DeleteErrorCorHistograms(err_out_cor_hists);
718 }
void FillErrorDataCorHistograms(double errors[4], double var[5], TH2D *err_cor_hists[4][5])
void DeleteErrorHists(TH1D *err_hists[4])
TMultiDimFet theta_x_parametrisation
polynomial approximation for theta_x
void AllocateErrorOutputCorHists(TH2D *err_out_cor_hists[4][5])
virtual Double_t Eval(const Double_t *x, const Double_t *coeff=nullptr) const
TMultiDimFet theta_y_parametrisation
polynomial approximation for theta_y
void AllocateErrorHists(TH1D *err_hists[4])
void DeleteErrorCorHistograms(TH2D *err_cor_hists[4][5])
void FillErrorHistograms(double errors[4], TH1D *err_hists[4])
void AllocateErrorInputCorHists(TH2D *err_inp_cor_hists[4][5])
TMultiDimFet y_parametrisation
polynomial approximation for y
Definition: errors.py:1
TMultiDimFet x_parametrisation
polynomial approximation for x
void WriteHistograms(TH1D *err_hists[4], TH2D *err_inp_cor_hists[4][5], TH2D *err_out_cor_hists[4][5], TFile *f_out, std::string base_out_dir)

◆ TestAperture()

void LHCOpticsApproximator::TestAperture ( TTree *  in_tree,
TTree *  out_tree 
)

x, theta_x, y, theta_y, ksi, mad_accepted, parametriz_accepted

Definition at line 736 of file LHCOpticsApproximator.cc.

References mps_splice::entry, mps_fire::i, and Transport().

738 {
739  if (inp_tree == nullptr || out_tree == nullptr)
740  return;
741 
742  Long64_t entries = inp_tree->GetEntries();
743  double entry[7];
744  double parametrization_out[5];
745 
746  inp_tree->SetBranchAddress("x", &(entry[0]));
747  inp_tree->SetBranchAddress("theta_x", &(entry[1]));
748  inp_tree->SetBranchAddress("y", &(entry[2]));
749  inp_tree->SetBranchAddress("theta_y", &(entry[3]));
750  inp_tree->SetBranchAddress("ksi", &(entry[4]));
751  inp_tree->SetBranchAddress("mad_accept", &(entry[5]));
752  inp_tree->SetBranchAddress("par_accept", &(entry[6]));
753 
754  out_tree->SetBranchAddress("x", &(entry[0]));
755  out_tree->SetBranchAddress("theta_x", &(entry[1]));
756  out_tree->SetBranchAddress("y", &(entry[2]));
757  out_tree->SetBranchAddress("theta_y", &(entry[3]));
758  out_tree->SetBranchAddress("ksi", &(entry[4]));
759  out_tree->SetBranchAddress("mad_accept", &(entry[5]));
760  out_tree->SetBranchAddress("par_accept", &(entry[6]));
761 
762  // int ind=0;
763  for (Long64_t i = 0; i < entries; i++) {
764  inp_tree->GetEntry(i);
765 
766  //Don't invert the coordinate systems, appertures are defined in the
767  //coordinate system of the beam - perhaps to be changed
768  bool res = Transport(entry, parametrization_out, true, false);
769 
770  if (res)
771  entry[6] = 1.0;
772  else
773  entry[6] = 0.0;
774 
775  out_tree->Fill();
776  }
777 }
Definition: Electron.h:6
bool Transport(const double *in, double *out, bool check_apertures=false, bool invert_beam_coord_sytems=true) const

◆ Train()

void LHCOpticsApproximator::Train ( TTree *  inp_tree,
std::string  data_prefix = std::string("def"),
polynomials_selection  mode = PREDEFINED,
int  max_degree_x = 10,
int  max_degree_tx = 10,
int  max_degree_y = 10,
int  max_degree_ty = 10,
bool  common_terms = false,
double *  prec = nullptr 
)

Definition at line 282 of file LHCOpticsApproximator.cc.

References TMultiDimFet::AddRow(), coord_names, mps_fire::i, InitializeApproximators(), ALCARECOPromptCalibProdSiPixelAli0T_cff::mode, out_polynomials, PrintInputRange(), s_begin_, s_end_, AlCaHLTBitMon_QueryRunRegistry::string, theta_x_parametrisation, theta_y_parametrisation, trained_, x_parametrisation, and y_parametrisation.

290  {
291  if (inp_tree == nullptr)
292  return;
293 
294  InitializeApproximators(mode, max_degree_x, max_degree_tx, max_degree_y, max_degree_ty, common_terms);
295 
296  //in-variables
297  //x_in, theta_x_in, y_in, theta_y_in, ksi_in, s_in
298  double in_var[6];
299 
300  //out-variables
301  //x_out, theta_x_out, y_out, theta_y_out, ksi_out, s_out, valid_out;
302  double out_var[7];
303 
304  //in- out-lables
305  std::string x_in_lab = "x_in";
306  std::string theta_x_in_lab = "theta_x_in";
307  std::string y_in_lab = "y_in";
308  std::string theta_y_in_lab = "theta_y_in";
309  std::string ksi_in_lab = "ksi_in";
310  std::string s_in_lab = "s_in";
311 
312  std::string x_out_lab = data_prefix + "_x_out";
313  std::string theta_x_out_lab = data_prefix + "_theta_x_out";
314  std::string y_out_lab = data_prefix + "_y_out";
315  std::string theta_y_out_lab = data_prefix + "_theta_y_out";
316  std::string ksi_out_lab = data_prefix + "_ksi_out";
317  std::string s_out_lab = data_prefix + "_s_out";
318  std::string valid_out_lab = data_prefix + "_valid_out";
319 
320  //disable not needed branches to speed up the readin
321  inp_tree->SetBranchStatus("*", false); //disable all branches
322  inp_tree->SetBranchStatus(x_in_lab.c_str(), true);
323  inp_tree->SetBranchStatus(theta_x_in_lab.c_str(), true);
324  inp_tree->SetBranchStatus(y_in_lab.c_str(), true);
325  inp_tree->SetBranchStatus(theta_y_in_lab.c_str(), true);
326  inp_tree->SetBranchStatus(ksi_in_lab.c_str(), true);
327  inp_tree->SetBranchStatus(x_out_lab.c_str(), true);
328  inp_tree->SetBranchStatus(theta_x_out_lab.c_str(), true);
329  inp_tree->SetBranchStatus(y_out_lab.c_str(), true);
330  inp_tree->SetBranchStatus(theta_y_out_lab.c_str(), true);
331  inp_tree->SetBranchStatus(ksi_out_lab.c_str(), true);
332  inp_tree->SetBranchStatus(valid_out_lab.c_str(), true);
333 
334  //set input data adresses
335  inp_tree->SetBranchAddress(x_in_lab.c_str(), &(in_var[0]));
336  inp_tree->SetBranchAddress(theta_x_in_lab.c_str(), &(in_var[1]));
337  inp_tree->SetBranchAddress(y_in_lab.c_str(), &(in_var[2]));
338  inp_tree->SetBranchAddress(theta_y_in_lab.c_str(), &(in_var[3]));
339  inp_tree->SetBranchAddress(ksi_in_lab.c_str(), &(in_var[4]));
340  inp_tree->SetBranchAddress(s_in_lab.c_str(), &(in_var[5]));
341 
342  //set output data adresses
343  inp_tree->SetBranchAddress(x_out_lab.c_str(), &(out_var[0]));
344  inp_tree->SetBranchAddress(theta_x_out_lab.c_str(), &(out_var[1]));
345  inp_tree->SetBranchAddress(y_out_lab.c_str(), &(out_var[2]));
346  inp_tree->SetBranchAddress(theta_y_out_lab.c_str(), &(out_var[3]));
347  inp_tree->SetBranchAddress(ksi_out_lab.c_str(), &(out_var[4]));
348  inp_tree->SetBranchAddress(s_out_lab.c_str(), &(out_var[5]));
349  inp_tree->SetBranchAddress(valid_out_lab.c_str(), &(out_var[6]));
350 
351  Long64_t entries = inp_tree->GetEntries();
352  if (entries > 0) {
353  inp_tree->SetBranchStatus(s_in_lab.c_str(), true);
354  inp_tree->SetBranchStatus(s_out_lab.c_str(), true);
355  inp_tree->GetEntry(0);
356  s_begin_ = in_var[5];
357  s_end_ = out_var[5];
358  inp_tree->SetBranchStatus(s_in_lab.c_str(), false);
359  inp_tree->SetBranchStatus(s_out_lab.c_str(), false);
360  }
361 
362  //set input and output variables for fitting
363  for (Long64_t i = 0; i < entries; ++i) {
364  inp_tree->GetEntry(i);
365  if (out_var[6] != 0) //if out data valid
366  {
367  x_parametrisation.AddRow(in_var, out_var[0], 0);
368  theta_x_parametrisation.AddRow(in_var, out_var[1], 0);
369  y_parametrisation.AddRow(in_var, out_var[2], 0);
370  theta_y_parametrisation.AddRow(in_var, out_var[3], 0);
371  }
372  }
373 
374  edm::LogInfo("LHCOpticsApproximator") << "Optical functions parametrizations from " << s_begin_ << " to " << s_end_
375  << "\n";
376  PrintInputRange();
377  for (int i = 0; i < 4; i++) {
378  double best_precision = 0.0;
379  if (prec)
380  best_precision = prec[i];
381  out_polynomials[i]->FindParameterization(best_precision);
382  edm::LogInfo("LHCOpticsApproximator") << "Out variable " << coord_names[i] << " polynomial"
383  << "\n";
384  out_polynomials[i]->PrintPolynomialsSpecial("M");
385  edm::LogInfo("LHCOpticsApproximator") << "\n";
386  }
387 
388  trained_ = true;
389 }
void InitializeApproximators(polynomials_selection mode, int max_degree_x, int max_degree_tx, int max_degree_y, int max_degree_ty, bool common_terms)
TMultiDimFet theta_x_parametrisation
polynomial approximation for theta_x
double s_begin_
begin of transport along the reference orbit
TMultiDimFet theta_y_parametrisation
polynomial approximation for theta_y
bool trained_
trained polynomials
std::vector< TMultiDimFet * > out_polynomials
virtual void AddRow(const Double_t *x, Double_t D, Double_t E=0)
Log< level::Info, false > LogInfo
double s_end_
end of transport along the reference orbit
std::vector< std::string > coord_names
pointers to polynomials
TMultiDimFet y_parametrisation
polynomial approximation for y
TMultiDimFet x_parametrisation
polynomial approximation for x

◆ Transport() [1/2]

bool LHCOpticsApproximator::Transport ( const double *  in,
double *  out,
bool  check_apertures = false,
bool  invert_beam_coord_sytems = true 
) const

Basic 3D transport method MADX canonical variables IN/OUT: (x, theta_x, y, theta_y, xi) [m, rad, m, rad, 1] returns true if transport possible if theta is calculated from momentum p, use theta_x = p.x() / p.mag() and theta_y = p.y() / p.mag()

Definition at line 102 of file LHCOpticsApproximator.cc.

References apertures_, beam, CheckInputRange(), TMultiDimFet::Eval(), mps_fire::i, recoMuon::in, lhcb1, MillePedeFileConverter_cfg::out, theta_x_parametrisation, theta_y_parametrisation, trained_, x_parametrisation, and y_parametrisation.

Referenced by GetDx(), GetDxds(), GetLineariasedTransportMatrixX(), GetLineariasedTransportMatrixY(), TestAperture(), Transport(), and Transport_m_GeV().

105  {
106  if (in == nullptr || out == nullptr || !trained_)
107  return false;
108 
109  bool res = CheckInputRange(in);
110  double in_corrected[5];
111 
112  if (beam == lhcb1 || !invert_beam_coord_sytems) {
113  in_corrected[0] = in[0];
114  in_corrected[1] = in[1];
115  in_corrected[2] = in[2];
116  in_corrected[3] = in[3];
117  in_corrected[4] = in[4];
118  out[0] = x_parametrisation.Eval(in_corrected);
119  out[1] = theta_x_parametrisation.Eval(in_corrected);
120  out[2] = y_parametrisation.Eval(in_corrected);
121  out[3] = theta_y_parametrisation.Eval(in_corrected);
122  out[4] = in[4];
123  } else {
124  in_corrected[0] = -in[0];
125  in_corrected[1] = -in[1];
126  in_corrected[2] = in[2];
127  in_corrected[3] = in[3];
128  in_corrected[4] = in[4];
129  out[0] = -x_parametrisation.Eval(in_corrected);
130  out[1] = -theta_x_parametrisation.Eval(in_corrected);
131  out[2] = y_parametrisation.Eval(in_corrected);
132  out[3] = theta_y_parametrisation.Eval(in_corrected);
133  out[4] = in[4];
134  }
135 
136  if (check_apertures) {
137  for (unsigned int i = 0; i < apertures_.size(); i++) {
138  res = res && apertures_[i].CheckAperture(in);
139  }
140  }
141  return res;
142 }
std::vector< LHCApertureApproximator > apertures_
apertures on the way
TMultiDimFet theta_x_parametrisation
polynomial approximation for theta_x
virtual Double_t Eval(const Double_t *x, const Double_t *coeff=nullptr) const
Definition: Electron.h:6
TMultiDimFet theta_y_parametrisation
polynomial approximation for theta_y
bool trained_
trained polynomials
bool CheckInputRange(const double *in, bool invert_beam_coord_sytems=true) const
TMultiDimFet y_parametrisation
polynomial approximation for y
TMultiDimFet x_parametrisation
polynomial approximation for x

◆ Transport() [2/2]

bool LHCOpticsApproximator::Transport ( const MadKinematicDescriptor in,
MadKinematicDescriptor out,
bool  check_apertures = false,
bool  invert_beam_coord_sytems = true 
) const

Definition at line 218 of file LHCOpticsApproximator.cc.

References recoMuon::in, input, MillePedeFileConverter_cfg::out, trained_, and Transport().

221  {
222  if (in == nullptr || out == nullptr || !trained_)
223  return false;
224 
225  Double_t input[5];
226  Double_t output[5];
227  input[0] = in->x;
228  input[1] = in->theta_x;
229  input[2] = in->y;
230  input[3] = in->theta_y;
231  input[4] = in->ksi;
232 
233  //transport inverts the coordinate systems
234  bool res = Transport(input, output, check_apertures, invert_beam_coord_sytems);
235 
236  out->x = output[0];
237  out->theta_x = output[1];
238  out->y = output[2];
239  out->theta_y = output[3];
240  out->ksi = output[4];
241 
242  return res;
243 }
Definition: Electron.h:6
static std::string const input
Definition: EdmProvDump.cc:50
bool trained_
trained polynomials
bool Transport(const double *in, double *out, bool check_apertures=false, bool invert_beam_coord_sytems=true) const
Definition: output.py:1

◆ Transport2D()

bool LHCOpticsApproximator::Transport2D ( const double *  in,
double *  out,
bool  check_apertures = false,
bool  invert_beam_coord_sytems = true 
) const

Basic 2D transport method MADX canonical variables IN : (x, theta_x, y, theta_y, xi) [m, rad, m, rad, 1] OUT : (x, y) [m, m] returns true if transport possible

Definition at line 144 of file LHCOpticsApproximator.cc.

References EcalCondDBWriter_cfi::beam, mps_fire::i, recoMuon::in, and MillePedeFileConverter_cfg::out.

Referenced by GetLinearApproximation().

149 {
150  if (in == nullptr || out == nullptr || !trained_)
151  return false;
152 
153  bool res = CheckInputRange(in);
154  double in_corrected[5];
155 
156  if (beam == lhcb1 || !invert_beam_coord_sytems) {
157  in_corrected[0] = in[0];
158  in_corrected[1] = in[1];
159  in_corrected[2] = in[2];
160  in_corrected[3] = in[3];
161  in_corrected[4] = in[4];
162  out[0] = x_parametrisation.Eval(in_corrected);
163  out[1] = y_parametrisation.Eval(in_corrected);
164  } else {
165  in_corrected[0] = -in[0];
166  in_corrected[1] = -in[1];
167  in_corrected[2] = in[2];
168  in_corrected[3] = in[3];
169  in_corrected[4] = in[4];
170  out[0] = -x_parametrisation.Eval(in_corrected);
171  out[1] = y_parametrisation.Eval(in_corrected);
172  }
173 
174  if (check_apertures) {
175  for (unsigned int i = 0; i < apertures_.size(); i++) {
176  res = res && apertures_[i].CheckAperture(in);
177  }
178  }
179  return res;
180 }
std::vector< LHCApertureApproximator > apertures_
apertures on the way
virtual Double_t Eval(const Double_t *x, const Double_t *coeff=nullptr) const
Definition: Electron.h:6
bool trained_
trained polynomials
bool CheckInputRange(const double *in, bool invert_beam_coord_sytems=true) const
TMultiDimFet y_parametrisation
polynomial approximation for y
TMultiDimFet x_parametrisation
polynomial approximation for x

◆ Transport_m_GeV()

bool LHCOpticsApproximator::Transport_m_GeV ( double  in_pos[3],
double  in_momentum[3],
double  out_pos[3],
double  out_momentum[3],
bool  check_apertures,
double  z2_z1_dist 
) const

pos, momentum: x,y,z; pos in m, momentum in GeV/c

Definition at line 182 of file LHCOpticsApproximator.cc.

References mps_fire::i, recoMuon::in, nominal_beam_momentum_, MillePedeFileConverter_cfg::out, and Transport().

Referenced by TotemTransport::transportProton().

187  {
188  double in[5];
189  double out[5];
190  double part_mom = 0.0;
191  for (int i = 0; i < 3; i++)
192  part_mom += in_momentum[i] * in_momentum[i];
193 
194  part_mom = TMath::Sqrt(part_mom);
195 
196  in[0] = in_pos[0];
197  in[1] = in_momentum[0] / nominal_beam_momentum_;
198  in[2] = in_pos[1];
199  in[3] = in_momentum[1] / nominal_beam_momentum_;
201 
202  bool res = Transport(in, out, check_apertures, true);
203 
204  out_pos[0] = out[0];
205  out_pos[1] = out[2];
206  out_pos[2] = in_pos[2] + z2_z1_dist;
207 
208  out_momentum[0] = out[1] * nominal_beam_momentum_;
209  out_momentum[1] = out[3] * nominal_beam_momentum_;
210  double part_out_total_mom = (out[4] + 1) * nominal_beam_momentum_;
211  out_momentum[2] = TMath::Sqrt(part_out_total_mom * part_out_total_mom - out_momentum[0] * out_momentum[0] -
212  out_momentum[1] * out_momentum[1]);
213  out_momentum[2] = TMath::Sign(out_momentum[2], in_momentum[2]);
214 
215  return res;
216 }
double nominal_beam_momentum_
GeV/c.
Definition: Electron.h:6
bool Transport(const double *in, double *out, bool check_apertures=false, bool invert_beam_coord_sytems=true) const

◆ WriteHistograms()

void LHCOpticsApproximator::WriteHistograms ( TH1D *  err_hists[4],
TH2D *  err_inp_cor_hists[4][5],
TH2D *  err_out_cor_hists[4][5],
TFile *  f_out,
std::string  base_out_dir 
)
private

Definition at line 865 of file LHCOpticsApproximator.cc.

References mps_fire::i.

Referenced by Test().

869  {
870  if (f_out == nullptr)
871  return;
872 
873  f_out->cd();
874  if (!gDirectory->cd(base_out_dir.c_str()))
875  gDirectory->mkdir(base_out_dir.c_str());
876 
877  gDirectory->cd(base_out_dir.c_str());
878  gDirectory->mkdir(this->GetName());
879  gDirectory->cd(this->GetName());
880  gDirectory->mkdir("x");
881  gDirectory->mkdir("theta_x");
882  gDirectory->mkdir("y");
883  gDirectory->mkdir("theta_y");
884 
885  gDirectory->cd("x");
886  err_hists[0]->Write("", TObject::kWriteDelete);
887  for (int i = 0; i < 5; i++) {
888  err_inp_cor_hists[0][i]->Write("", TObject::kWriteDelete);
889  err_out_cor_hists[0][i]->Write("", TObject::kWriteDelete);
890  }
891 
892  gDirectory->cd("..");
893  gDirectory->cd("theta_x");
894  err_hists[1]->Write("", TObject::kWriteDelete);
895  for (int i = 0; i < 5; i++) {
896  err_inp_cor_hists[1][i]->Write("", TObject::kWriteDelete);
897  err_out_cor_hists[1][i]->Write("", TObject::kWriteDelete);
898  }
899 
900  gDirectory->cd("..");
901  gDirectory->cd("y");
902  err_hists[2]->Write("", TObject::kWriteDelete);
903  for (int i = 0; i < 5; i++) {
904  err_inp_cor_hists[2][i]->Write("", TObject::kWriteDelete);
905  err_out_cor_hists[2][i]->Write("", TObject::kWriteDelete);
906  }
907 
908  gDirectory->cd("..");
909  gDirectory->cd("theta_y");
910  err_hists[3]->Write("", TObject::kWriteDelete);
911  for (int i = 0; i < 5; i++) {
912  err_inp_cor_hists[3][i]->Write("", TObject::kWriteDelete);
913  err_out_cor_hists[3][i]->Write("", TObject::kWriteDelete);
914  }
915  gDirectory->cd("..");
916  gDirectory->cd("..");
917 }

Friends And Related Function Documentation

◆ ProtonTransportFunctionsESSource

friend class ProtonTransportFunctionsESSource
friend

Definition at line 173 of file LHCOpticsApproximator.h.

Member Data Documentation

◆ apertures_

std::vector<LHCApertureApproximator> LHCOpticsApproximator::apertures_
private

apertures on the way

Definition at line 170 of file LHCOpticsApproximator.h.

Referenced by AddRectEllipseAperture(), Init(), LHCOpticsApproximator(), operator=(), and Transport().

◆ beam

beam_type LHCOpticsApproximator::beam
private

◆ coord_names

std::vector<std::string> LHCOpticsApproximator::coord_names
private

pointers to polynomials

Definition at line 169 of file LHCOpticsApproximator.h.

Referenced by Init(), PrintInputRange(), PrintOpticalFunctions(), and Train().

◆ nominal_beam_energy_

double LHCOpticsApproximator::nominal_beam_energy_
private

GeV.

Definition at line 165 of file LHCOpticsApproximator.h.

Referenced by LHCOpticsApproximator(), and operator=().

◆ nominal_beam_momentum_

double LHCOpticsApproximator::nominal_beam_momentum_
private

GeV/c.

Definition at line 166 of file LHCOpticsApproximator.h.

Referenced by LHCOpticsApproximator(), operator=(), and Transport_m_GeV().

◆ out_polynomials

std::vector<TMultiDimFet *> LHCOpticsApproximator::out_polynomials
private

Definition at line 168 of file LHCOpticsApproximator.h.

Referenced by Init(), PrintOpticalFunctions(), and Train().

◆ s_begin_

double LHCOpticsApproximator::s_begin_
private

begin of transport along the reference orbit

Definition at line 162 of file LHCOpticsApproximator.h.

Referenced by Init(), LHCOpticsApproximator(), operator=(), and Train().

◆ s_end_

double LHCOpticsApproximator::s_end_
private

end of transport along the reference orbit

Definition at line 163 of file LHCOpticsApproximator.h.

Referenced by Init(), LHCOpticsApproximator(), operator=(), and Train().

◆ theta_x_parametrisation

TMultiDimFet LHCOpticsApproximator::theta_x_parametrisation
private

polynomial approximation for theta_x

Definition at line 177 of file LHCOpticsApproximator.h.

Referenced by Init(), InitializeApproximators(), operator=(), Test(), Train(), and Transport().

◆ theta_y_parametrisation

TMultiDimFet LHCOpticsApproximator::theta_y_parametrisation
private

polynomial approximation for theta_y

Definition at line 179 of file LHCOpticsApproximator.h.

Referenced by Init(), InitializeApproximators(), operator=(), Test(), Train(), and Transport().

◆ trained_

bool LHCOpticsApproximator::trained_
private

trained polynomials

Definition at line 167 of file LHCOpticsApproximator.h.

Referenced by Init(), LHCOpticsApproximator(), operator=(), Train(), and Transport().

◆ x_parametrisation

TMultiDimFet LHCOpticsApproximator::x_parametrisation
private

polynomial approximation for x

Definition at line 176 of file LHCOpticsApproximator.h.

Referenced by Init(), InitializeApproximators(), operator=(), ParameterOutOfRangePenalty(), PrintInputRange(), Test(), Train(), and Transport().

◆ y_parametrisation

TMultiDimFet LHCOpticsApproximator::y_parametrisation
private

polynomial approximation for y

Definition at line 178 of file LHCOpticsApproximator.h.

Referenced by Init(), InitializeApproximators(), operator=(), Test(), Train(), and Transport().