parameterisation ycorr done and now do magnet z position

This commit is contained in:
cetin 2024-02-27 15:59:53 +01:00
parent aa2649befc
commit d5157fe232
8 changed files with 1219 additions and 857 deletions

14
main.py
View File

@ -53,14 +53,22 @@ parser.add_argument(
) )
args = parser.parse_args() args = parser.parse_args()
selected = "data/tracking_losses_ntuple_B_def_selected.root" selected = "data/tracking_losses_ntuple_B_BJpsi_def_selected.root"
if args.prepare_params_data: if args.prepare_params_data:
selection = "fromSignal == 1 && isElectron == 1 && pt > 10 && p > 1500 && p < 100000 && !std::isnan(ideal_state_770_x) && !std::isnan(ideal_state_9410_x) && !std::isnan(ideal_state_10000_x)" selection = "isElectron == 1 && pt > 10 && p > 1500 && p < 100000 && !std::isnan(ideal_state_770_x) && !std::isnan(ideal_state_9410_x) && !std::isnan(ideal_state_10000_x) && std::abs(match_chi2) < 5"
print("Run selection cuts =", selection) print("Run selection cuts =", selection)
selected_md = preselection( selected_b = preselection(
cuts=selection, cuts=selection,
input_file="data/tracking_losses_ntuple_B_def.root", input_file="data/tracking_losses_ntuple_B_def.root",
) )
selected_bj = preselection(
cuts=selection,
input_file="data/tracking_losses_ntuple_BJpsi_def.root",
)
merge_cmd = ["hadd", "-fk", selected, selected_b, selected_bj]
print("Concatenate polarities ...")
subprocess.run(merge_cmd, check=True)
cpp_files = [] cpp_files = []
if args.field_params: if args.field_params:

View File

@ -40,7 +40,7 @@ tested by mc_matching_example.py
""" """
decay = "B" decay = "BJpsi"
options.evt_max = -1 options.evt_max = -1
@ -63,7 +63,7 @@ options.simulation = True
options.input_type = "ROOT" options.input_type = "ROOT"
options.ntuple_file = ( options.ntuple_file = (
f"/work/cetin/LHCb/reco_tuner/data/tracking_losses_ntuple_{decay}_default.root" f"/work/cetin/LHCb/reco_tuner/data/tracking_losses_ntuple_{decay}_def.root"
) )

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -43,6 +43,8 @@ def parameterise_magnet_kink(
+ array["ideal_state_9410_tx"] * array["ideal_state_9410_z"] + array["ideal_state_9410_tx"] * array["ideal_state_9410_z"]
) / array["dSlope_xEndT"] ) / array["dSlope_xEndT"]
# array = array[(array["z_mag_xEndT"] < 5500) & (array["z_mag_xEndT"] > 5000)]
model_endt, poly_features_endt = fit_linear_regression_model( model_endt, poly_features_endt = fit_linear_regression_model(
array, array,
target_feat="z_mag_xEndT", target_feat="z_mag_xEndT",

View File

@ -54,8 +54,10 @@ def parameterise_track_model(
"dSlope_yEndT", "dSlope_yEndT",
], ],
keep=[ keep=[
"ideal_state_770_ty dSlope_yEndT^2", "dSlope_yEndT", # keep
"ideal_state_770_ty dSlope_xEndT^2", "dSlope_xEndT dSlope_yEndT", # keep
"ideal_state_770_ty dSlope_xEndT^2", # keep
"ideal_state_770_ty dSlope_yEndT^2", # keep
], ],
degree=3, degree=3,
fit_intercept=False, fit_intercept=False,

View File

@ -1,7 +1,9 @@
// param[0]*ideal_state_770_ty dSlope_xEndT^2 + param[1]*ideal_state_770_ty // param[0]*dSlope_yEndT + param[1]*dSlope_xEndT dSlope_yEndT +
// param[2]*ideal_state_770_ty dSlope_xEndT^2 + param[3]*ideal_state_770_ty
// dSlope_yEndT^2 // dSlope_yEndT^2
static constexpr std::array<float, 2> bendYParamsMatch{-1604.57100708853f, static constexpr std::array<float, 4> bendYParamsMatch{
66.0556032125645f}; 4378.628600433391f, 38.37918880066809f, 1223.4312216138976f,
-18070.58880714184f};
// param[0]*dSlope_yEndT + param[1]*ideal_state_770_ty dSlope_xEndT_abs + // param[0]*dSlope_yEndT + param[1]*ideal_state_770_ty dSlope_xEndT_abs +
// param[2]*ideal_state_770_ty dSlope_yEndT_abs + param[3]*ideal_state_770_ty // param[2]*ideal_state_770_ty dSlope_yEndT_abs + param[3]*ideal_state_770_ty
// ideal_state_770_tx dSlope_xEndT + param[4]*ideal_state_770_ty dSlope_xEndT^2 // ideal_state_770_tx dSlope_xEndT + param[4]*ideal_state_770_ty dSlope_xEndT^2
@ -10,6 +12,6 @@ static constexpr std::array<float, 2> bendYParamsMatch{-1604.57100708853f,
// dSlope_xEndT_abs + param[8]*ideal_state_770_ty^3 ideal_state_770_tx // dSlope_xEndT_abs + param[8]*ideal_state_770_ty^3 ideal_state_770_tx
// dSlope_xEndT // dSlope_xEndT
static constexpr std::array<float, 9> bendYParams{ static constexpr std::array<float, 9> bendYParams{
292.25509372378673f, -102.98897190277876f, -3210.784313935311f, 2728.3487088712513f, 175.88471572180072f, -1794.526612484905f,
5496.265661754457f, -296.2025342631322f, 4252.751889560355f, 2743.4537706915407f, 460.1711356139729f, 41200.84474708236f,
621.5026566906829f, 2860.5216504191094f, 25376.702017410385f}; 3211.085060418981f, -399.0908682713831f, 21207.05933957606f};

View File

@ -1,5 +1,5 @@
// param[0] + param[1]*dSlope_xEndT_abs + param[2]*x_EndT_abs + // param[0] + param[1]*dSlope_xEndT_abs + param[2]*x_EndT_abs +
// param[3]*ideal_state_770_tx^2 + param[4]*dSlope_xEndT^2 // param[3]*ideal_state_770_tx^2 + param[4]*dSlope_xEndT^2
static constexpr std::array<float, 5> zMagnetParamsEndT{ static constexpr std::array<float, 5> zMagnetParamsEndT{
5182.686831161441f, 751.3593035656784f, 0.013739767853469087f, 5309.217539295354f, 37.908060765784256f, 0.011167156481561233f,
-3123.1016408330274f, -41.266857851983644f}; -1735.25693147613f, 293.74242595645825f};