1 #ifndef TotemRPProtonTransportParametrization_LHC_OPTICS_APPROXIMATOR_H
2 #define TotemRPProtonTransportParametrization_LHC_OPTICS_APPROXIMATOR_H
37 double nominal_beam_momentum);
43 void Train(TTree *inp_tree,
46 int max_degree_x = 10,
47 int max_degree_tx = 10,
48 int max_degree_y = 10,
49 int max_degree_ty = 10,
50 bool common_terms =
false,
51 double *prec =
nullptr);
52 void Test(TTree *inp_tree,
68 bool check_apertures =
false,
69 bool invert_beam_coord_sytems =
true)
const;
72 bool check_apertures =
false,
73 bool invert_beam_coord_sytems =
true)
const;
82 bool check_apertures =
false,
83 bool invert_beam_coord_sytems =
true)
const;
86 double in_momentum[3],
88 double out_momentum[3],
90 double z2_z1_dist)
const;
93 bool CheckInputRange(
const double *
in,
bool invert_beam_coord_sytems =
true)
const;
99 const std::vector<std::string> &input_vars);
114 double d_mad_x = 10
e-6,
115 double d_mad_thx = 10
e-6);
130 double d_mad_y = 10
e-6,
131 double d_mad_thy = 10
e-6);
133 double GetDx(
double mad_init_x,
138 double d_mad_xi = 0.001);
139 double GetDxds(
double mad_init_x,
144 double d_mad_xi = 0.001);
204 TH2D *err_inp_cor_hists[4][5],
205 TH2D *err_out_cor_hists[4][5],
224 bool CheckAperture(
const double *
in,
bool invert_beam_coord_sytems =
true)
const;
232 #endif //TotemRPProtonTransportParametrization_LHC_OPTICS_APPROXIMATOR_H
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 FillErrorDataCorHistograms(double errors[4], double var[5], TH2D *err_cor_hists[4][5])
void DeleteErrorHists(TH1D *err_hists[4])
void TestAperture(TTree *in_tree, TTree *out_tree)
x, theta_x, y, theta_y, ksi, mad_accepted, parametriz_accepted
bool Transport2D(const double *in, double *out, bool check_apertures=false, bool invert_beam_coord_sytems=true) const
bool Transport(const double *in, double *out, bool check_apertures=false, bool invert_beam_coord_sytems=true) const
std::vector< LHCApertureApproximator > apertures_
apertures on the way
beam_type GetBeamType() const
TMultiDimFet theta_x_parametrisation
polynomial approximation for theta_x
friend class ProtonTransportFunctionsESSource
double nominal_beam_momentum_
GeV/c.
void AllocateErrorOutputCorHists(TH2D *err_out_cor_hists[4][5])
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
bool CheckInputRange(const double *in, bool invert_beam_coord_sytems=true) const
void SetTermsManually(TMultiDimFet &approximator, VariableType variable, int max_degree, bool common_terms)
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...
void AddRectEllipseAperture(const LHCOpticsApproximator &in, double rect_x, double rect_y, double r_el_x, double r_el_y)
double ParameterOutOfRangePenalty(double par_m[], bool invert_beam_coord_sytems=true) const
double s_begin_
begin of transport along the reference orbit
double nominal_beam_energy_
GeV.
TMultiDimFet theta_y_parametrisation
polynomial approximation for theta_y
void AllocateErrorHists(TH1D *err_hists[4])
void GetLinearApproximation(double atPoint[], double &Cx, double &Lx, double &vx, double &Cy, double &Ly, double &vy, double &D, double ep=1E-5)
bool trained_
trained polynomials
void PrintCoordinateOpticalFunctions(TMultiDimFet ¶metrization, const std::string &coord_name, const std::vector< std::string > &input_vars)
LHCApertureApproximator()
std::vector< TMultiDimFet * > out_polynomials
list var
if using global norm cols_to_minmax = ['t_delta', 't_hmaxNearP','t_emaxNearP', 't_hAnnular', 't_eAnnular','t_pt','t_nVtx','t_ieta','t_eHcal10', 't_eHcal30','t_rhoh','t_eHcal'] df[cols_to_minmax] = df[cols_to_minmax].apply(lambda x: (x - x.min()) / (x.max() - x.min()) if (x.max() - x.min() > 0) else 1.0/200.0)
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 Test(TTree *inp_tree, TFile *f_out, std::string data_prefix=std::string("def"), std::string base_out_dir=std::string(""))
Class finds the parametrisation of MADX proton transport and transports the protons according to it 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...
void DeleteErrorCorHistograms(TH2D *err_cor_hists[4][5])
void SetDefaultAproximatorSettings(TMultiDimFet &approximator, VariableType var_type, int max_degree)
DecomposeProduct< arg, typename Div::arg > D
double s_end_
end of transport along the reference orbit
void FillErrorHistograms(double errors[4], TH1D *err_hists[4])
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)
void PrintOpticalFunctions()
void AllocateErrorInputCorHists(TH2D *err_inp_cor_hists[4][5])
std::vector< std::string > coord_names
pointers to polynomials
TMultiDimFet y_parametrisation
polynomial approximation for y
TMultiDimFet x_parametrisation
polynomial approximation for x
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)
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)
bool CheckAperture(const double *in, bool invert_beam_coord_sytems=true) const
const LHCOpticsApproximator & operator=(const LHCOpticsApproximator &org)