Skip to content

Commit adff6af

Browse files
author
Luigi Dello Stritto
committed
fix
1 parent 83ffd3a commit adff6af

File tree

2 files changed

+37
-36
lines changed

2 files changed

+37
-36
lines changed

machine_learning_hep/data/data_run3/database_ml_parameters_D0pp_mult.yml

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ D0ml_pp:
100100
merge:
101101
- {base: reco, ref: evtorig}
102102
- {base: gen, ref: evtoriggen}
103-
- {base: gen, ref: evtorig, left_on: fIndexArrayHFD0COLLBASES, out: genrec,}
103+
- {base: gen, ref: evtorig, left_on: fIndexArrayHFD0COLLBASES, out: genrec}
104+
# workaround for yamlfmt issue #110
104105

105106
write:
106107
evtorig:
@@ -194,7 +195,6 @@ D0ml_pp:
194195
seedmerge: [12] #list of periods
195196
period: [LHC22o] #list of periods
196197
select_period: [1]
197-
# prefix_dir: /data2/MLhep/real/train_235436/
198198
prefix_dir: /data2/MLhep/trains/
199199
unmerged_tree_dir: [489217/alice/] #list of periods
200200
pkl: ['${USER}/train_489217/D0ml/pkl'] #list of periods
@@ -211,14 +211,13 @@ D0ml_pp:
211211
#fracmerge: [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
212212
fracmerge: [1.0] #list of periods
213213
seedmerge: [12] #list of periods
214-
period: [LHC24b1b] #list of periods
214+
period: [LHC24b1c] #list of periods
215215
select_period: [1]
216-
# prefix_dir: /data2/MLhep/sim/train_235437/
217216
prefix_dir: /data2/MLhep/trains/
218-
unmerged_tree_dir: [508674/alice/]
219-
pkl: ['${USER}/train_508674/D0ml/pkl'] #list of periods
220-
pkl_skimmed: ['${USER}/train_508674/D0ml/pklsk'] #list of periods
221-
pkl_skimmed_merge_for_ml: ['${USER}/train_508674/D0ml/pklskml'] #list of periods
217+
unmerged_tree_dir: [610453/alice/]
218+
pkl: ['${USER}/train_610453/D0ml/pkl'] #list of periods
219+
pkl_skimmed: ['${USER}/train_610453/D0ml/pklsk'] #list of periods
220+
pkl_skimmed_merge_for_ml: ['${USER}/train_610453/D0ml/pklskml'] #list of periods
222221
pkl_skimmed_merge_for_ml_all: '${USER}/pass6/D0ml/pp_mc_prod_mltot'
223222
pkl_evtcounter_all: '${USER}/pass6/D0ml/pp_mc_prod_evttot'
224223
mcreweights: [../Analyses] #list of periods
@@ -274,8 +273,8 @@ D0ml_pp:
274273
pkl_skimmed_decmerged: [LHC22pp/MLapplication/prod_LHC22o/skpkldecdatamerged] #list of periods
275274
mc:
276275
prefix_dir_app: /data2/ldellost/MLHEP_d0/
277-
pkl_skimmed_dec: [LHC22pp_mc/MLapplication/LHC24d3a/skpkldecmc] #list of periods
278-
pkl_skimmed_decmerged: [LHC22pp_mc/MLapplication/LHC24d3a/skpkldecmcmerged] #list of periods
276+
pkl_skimmed_dec: [LHC22pp_mc/MLapplication/LHC24h1c/skpkldecmc] #list of periods
277+
pkl_skimmed_decmerged: [LHC22pp_mc/MLapplication/LHC24h1c/skpkldecmcmerged] #list of periods
279278
modelname: xgboost
280279
modelsperptbin: [xgboost_classifierD0ml_pp_dfselection_fPt_0.0_1.0.sav, xgboost_classifierD0ml_pp_dfselection_fPt_1.0_2.0.sav, xgboost_classifierD0ml_pp_dfselection_fPt_2.0_3.0.sav, xgboost_classifierD0ml_pp_dfselection_fPt_3.0_4.0.sav, xgboost_classifierD0ml_pp_dfselection_fPt_4.0_5.0.sav, xgboost_classifierD0ml_pp_dfselection_fPt_5.0_6.0.sav, xgboost_classifierD0ml_pp_dfselection_fPt_6.0_7.0.sav, xgboost_classifierD0ml_pp_dfselection_fPt_7.0_8.0.sav, xgboost_classifierD0ml_pp_dfselection_fPt_8.0_10.0.sav, xgboost_classifierD0ml_pp_dfselection_fPt_10.0_12.0.sav, xgboost_classifierD0ml_pp_dfselection_fPt_12.0_16.0.sav, xgboost_classifierD0ml_pp_dfselection_fPt_16.0_24.0.sav] # sel_skim_binmin bins
281280
probcutpresel:
@@ -324,29 +323,29 @@ D0ml_pp:
324323
label_y: "D^{0} Cross section"
325324

326325
event_weighting_mc:
327-
LHC24h1:
328-
- filepath: data/event_weighting_mc/MultWeigths.root
326+
LHC24b1c:
327+
- filepath: data/event_weighting_mc/D0weights/MultWeigths.root
329328
histo_name: MultWeigths_0_1
330329
according_to: fMultZeqNTracksPV
331-
- filepath: data/event_weighting_mc/MultWeigths.root
330+
- filepath: data/event_weighting_mc/D0weights/MultWeigths.root
332331
histo_name: MultWeigths_85_100
333332
according_to: fMultZeqNTracksPV
334-
- filepath: data/event_weighting_mc/MultWeigths.root
333+
- filepath: data/event_weighting_mc/D0weights/MultWeigths.root
335334
histo_name: MultWeigths_70_85
336335
according_to: fMultZeqNTracksPV
337-
- filepath: data/event_weighting_mc/MultWeigths.root
336+
- filepath: data/event_weighting_mc/D0weights/MultWeigths.root
338337
histo_name: MultWeigths_50_70
339338
according_to: fMultZeqNTracksPV
340-
- filepath: data/event_weighting_mc/MultWeigths.root
339+
- filepath: data/event_weighting_mc/D0weights/MultWeigths.root
341340
histo_name: MultWeigths_30_50
342341
according_to: fMultZeqNTracksPV
343-
- filepath: data/event_weighting_mc/MultWeigths.root
342+
- filepath: data/event_weighting_mc/D0weights/MultWeigths.root
344343
histo_name: MultWeigths_10_30
345344
according_to: fMultZeqNTracksPV
346-
- filepath: data/event_weighting_mc/MultWeigths.root
345+
- filepath: data/event_weighting_mc/D0weights/MultWeigths.root
347346
histo_name: MultWeigths_1_10
348347
according_to: fMultZeqNTracksPV
349-
- filepath: data/event_weighting_mc/MultWeigths.root
348+
- filepath: data/event_weighting_mc/D0weights/MultWeigths.root
350349
histo_name: MultWeigths_0_1
351350
according_to: fMultZeqNTracksPV
352351

@@ -371,17 +370,26 @@ D0ml_pp:
371370
mc:
372371
runselection: [null] #FIXME
373372
prefix_dir_res: /data2/ldellost/D0analysis/
374-
results: [LHC23pp_forw_mc/ResultsFit/prod_LHC24h1/resultsmc/default/default] #list of periods
373+
results: [LHC23pp_forw_mc/ResultsFit/prod_LHC24h1c/resultsmc/default/default] #list of periods
375374
resultsallp: LHC23pp_forw_mc/ResultsFit/prod_LHC23/resultsmctot/default/default
376375

377376
fitcase: D0
378-
latexnamehadron: "D^{0}#arrow{K#pi}"
377+
latexnamehadron: "D^{0}#rightarrow{K#pi}"
379378
latexbin2var: "FT0M"
380379
nevents: 290860860000
381380
dobkgfromsideband: false
382381
mass_fit_lim: [1.5, 2.22] # region for the fit of the invariant mass distribution [GeV/c^2]
383382
bin_width: 0.001 # bin width of the invariant mass histogram
384-
n_rebin: [2, 3, 3, 3, 3, 4, 4, 4, 5, 6, 7, 8] # number of mass bins to merge
383+
n_rebin: [3, 3, 3, 3, 3, 4, 4, 4, 5, 6, 7, 8] # number of mass bins to merge
384+
385+
#n_rebin: [[2, 3, 3, 3, 3, 4, 4, 4, 5, 6, 7, 8],
386+
# [4, 3, 3, 3, 3, 4, 4, 4, 5, 6, 7, 8],
387+
# [4, 3, 3, 3, 3, 4, 4, 4, 5, 6, 7, 8],
388+
# [4, 3, 3, 3, 3, 4, 4, 4, 5, 6, 7, 8],
389+
# [5, 3, 3, 3, 3, 4, 4, 4, 5, 6, 7, 8],
390+
# [2, 3, 3, 3, 3, 4, 4, 4, 5, 6, 7, 8],
391+
# [3, 3, 3, 3, 3, 4, 4, 4, 5, 6, 7, 8],
392+
# [5, 3, 3, 3, 3, 4, 4, 4, 5, 6, 7, 8]]
385393

386394
data_selections:
387395
mcsig:

machine_learning_hep/fitting/roofitter.py

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
USE_EXTMODEL = True
2323

24+
2425
# pylint: disable=too-few-public-methods, too-many-statements
2526
# (temporary until we add more functionality)
2627
class RooFitter:
@@ -70,15 +71,15 @@ def fit_mass_new(
7071
m.setRange("fit", *range_m)
7172
# print(f'using fit range: {range_m}, var range: {m.getRange("fit")}')
7273
res = model.fitTo(dh, Range=(range_m[0], range_m[1]), Save=True, PrintLevel=-1, Strategy=1, MaxCalls=5000)
73-
if level == 'data' and USE_EXTMODEL:
74+
if level == "data" and USE_EXTMODEL:
7475
for v in ws.allVars():
7576
v.setConstant(True)
7677
res = extmodel.fitTo(
7778
dh, Range=(range_m[0], range_m[1]), Save=True, PrintLevel=-1, Strategy=1, MaxCalls=5000
7879
)
7980
else:
8081
res = model.fitTo(dh, Save=True, PrintLevel=-1, Strategy=1, MaxCalls=5000)
81-
if level == 'data' and USE_EXTMODEL:
82+
if level == "data" and USE_EXTMODEL:
8283
for v in ws.allVars():
8384
v.setConstant(True)
8485
res = extmodel.fitTo(dh, Save=True, PrintLevel=-1, Strategy=1, MaxCalls=5000)
@@ -124,18 +125,10 @@ def fit_mass_new(
124125
tmp_frame = m.frame()
125126
dh.plotOn(tmp_frame, ROOT.RooFit.Name("data"))
126127

127-
if (ws.pdf("refl") and ws.pdf("corr")):
128-
model.plotOn(
129-
tmp_frame,
130-
ROOT.RooFit.Components("bkg,refl,corr"),
131-
ROOT.RooFit.Name("bkg_total")
132-
)
128+
if ws.pdf("refl") and ws.pdf("corr"):
129+
model.plotOn(tmp_frame, ROOT.RooFit.Components("bkg,refl,corr"), ROOT.RooFit.Name("bkg_total"))
133130
else:
134-
model.plotOn(
135-
tmp_frame,
136-
ROOT.RooFit.Components("bkg"),
137-
ROOT.RooFit.Name("bkg_total")
138-
)
131+
model.plotOn(tmp_frame, ROOT.RooFit.Components("bkg"), ROOT.RooFit.Name("bkg_total"))
139132

140133
residuals = tmp_frame.residHist("data", "bkg_total")
141134

@@ -191,7 +184,7 @@ def fit_mass(self, hist, fit_spec, plot=False):
191184
def calc_signif(roows, res, pdfnames, param_names, mean_sgn, sigma_sgn):
192185
"""Calculate significance, signal, background, signal/background ratio."""
193186
if not USE_EXTMODEL:
194-
return (0., 0., 0., 0., 0., 0, 0, 0.)
187+
return (0.0, 0.0, 0.0, 0.0, 0.0, 0, 0, 0.0)
195188
f_sig = roows.pdf(pdfnames["pdf_sig"])
196189

197190
# total signal under the fit function

0 commit comments

Comments
 (0)