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>
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 LHCOpticsApproximator & | operator= (const LHCOpticsApproximator &org) |
double | ParameterOutOfRangePenalty (double par_m[], bool invert_beam_coord_sytems=true) const |
void | PrintCoordinateOpticalFunctions (TMultiDimFet ¶metrization, 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< LHCApertureApproximator > | apertures_ |
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 |
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.
|
strongprivate |
Enumerator | |
---|---|
X | |
THETA_X | |
Y | |
THETA_Y |
Definition at line 182 of file LHCOpticsApproximator.h.
LHCOpticsApproximator::LHCOpticsApproximator | ( | ) |
Definition at line 59 of file LHCOpticsApproximator.cc.
References beam, Init(), lhcb1, nominal_beam_energy_, and nominal_beam_momentum_.
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.
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_.
void LHCOpticsApproximator::AddRectEllipseAperture | ( | const LHCOpticsApproximator & | in, |
double | rect_x, | ||
double | rect_y, | ||
double | r_el_x, | ||
double | r_el_y | ||
) |
Definition at line 959 of file LHCOpticsApproximator.cc.
References apertures_, recoMuon::in, and LHCApertureApproximator::RECTELLIPSE.
|
private |
Definition at line 720 of file LHCOpticsApproximator.cc.
References mps_fire::i.
Referenced by Test().
|
private |
Definition at line 779 of file LHCOpticsApproximator.cc.
References Skims_PA_cff::name, AlCaHLTBitMon_QueryRunRegistry::string, and runGCPTkAlMap::title.
Referenced by Test().
|
private |
Definition at line 808 of file LHCOpticsApproximator.cc.
References Skims_PA_cff::name, AlCaHLTBitMon_QueryRunRegistry::string, and runGCPTkAlMap::title.
Referenced by Test().
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().
|
private |
Definition at line 857 of file LHCOpticsApproximator.cc.
Referenced by Test().
|
private |
Definition at line 851 of file LHCOpticsApproximator.cc.
References mps_fire::i.
Referenced by Test().
|
private |
Definition at line 843 of file LHCOpticsApproximator.cc.
References trigObjTnPSource_cfi::var.
Referenced by Test().
|
private |
Definition at line 837 of file LHCOpticsApproximator.cc.
References mps_fire::i.
Referenced by Test().
|
inline |
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.
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().
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, and Transport2D().
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.
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.
|
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=().
|
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().
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.
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.
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().
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().
void LHCOpticsApproximator::PrintOpticalFunctions | ( | ) |
Definition at line 993 of file LHCOpticsApproximator.cc.
References coord_names, mps_fire::i, out_polynomials, and PrintCoordinateOpticalFunctions().
|
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().
|
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().
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.
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().
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.
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().
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().
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().
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().
|
private |
Definition at line 865 of file LHCOpticsApproximator.cc.
References mps_fire::i.
Referenced by Test().
|
friend |
Definition at line 173 of file LHCOpticsApproximator.h.
|
private |
apertures on the way
Definition at line 170 of file LHCOpticsApproximator.h.
Referenced by AddRectEllipseAperture(), Init(), LHCOpticsApproximator(), operator=(), and Transport().
|
private |
Definition at line 164 of file LHCOpticsApproximator.h.
Referenced by GetBeamType(), LHCOpticsApproximator(), operator=(), ParameterOutOfRangePenalty(), and Transport().
|
private |
pointers to polynomials
Definition at line 169 of file LHCOpticsApproximator.h.
Referenced by Init(), PrintInputRange(), PrintOpticalFunctions(), and Train().
|
private |
GeV.
Definition at line 165 of file LHCOpticsApproximator.h.
Referenced by LHCOpticsApproximator(), and operator=().
|
private |
GeV/c.
Definition at line 166 of file LHCOpticsApproximator.h.
Referenced by LHCOpticsApproximator(), operator=(), and Transport_m_GeV().
|
private |
Definition at line 168 of file LHCOpticsApproximator.h.
Referenced by Init(), PrintOpticalFunctions(), and Train().
|
private |
begin of transport along the reference orbit
Definition at line 162 of file LHCOpticsApproximator.h.
Referenced by Init(), LHCOpticsApproximator(), operator=(), and Train().
|
private |
end of transport along the reference orbit
Definition at line 163 of file LHCOpticsApproximator.h.
Referenced by Init(), LHCOpticsApproximator(), operator=(), and Train().
|
private |
polynomial approximation for theta_x
Definition at line 177 of file LHCOpticsApproximator.h.
Referenced by Init(), InitializeApproximators(), operator=(), Test(), Train(), and Transport().
|
private |
polynomial approximation for theta_y
Definition at line 179 of file LHCOpticsApproximator.h.
Referenced by Init(), InitializeApproximators(), operator=(), Test(), Train(), and Transport().
|
private |
trained polynomials
Definition at line 167 of file LHCOpticsApproximator.h.
Referenced by Init(), LHCOpticsApproximator(), operator=(), Train(), and Transport().
|
private |
polynomial approximation for x
Definition at line 176 of file LHCOpticsApproximator.h.
Referenced by Init(), InitializeApproximators(), operator=(), ParameterOutOfRangePenalty(), PrintInputRange(), Test(), Train(), and Transport().
|
private |
polynomial approximation for y
Definition at line 178 of file LHCOpticsApproximator.h.
Referenced by Init(), InitializeApproximators(), operator=(), Test(), Train(), and Transport().