Skip to content

Commit

Permalink
Fixing multiplicity analysis workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Luigi Dello Stritto committed Nov 28, 2023
1 parent e9fc860 commit 8352592
Show file tree
Hide file tree
Showing 7 changed files with 430 additions and 41 deletions.
20 changes: 10 additions & 10 deletions machine_learning_hep/analysis/analyzerdhadrons_mult.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,13 @@ def __init__(self, datap, case, typean, period):
[None for _ in range(len(self.lvar2_binmin))])
self.inel0_var = datap["analysis"][self.typean].get("inel0_var", "n_tracklets")

self.d_resultsallpmc = datap["analysis"][typean]["mc"]["results"][period] \
if period is not None else datap["analysis"][typean]["mc"]["resultsallp"]
self.d_resultsallpdata = datap["analysis"][typean]["data"]["results"][period] \
if period is not None else datap["analysis"][typean]["data"]["resultsallp"]
self.dp = datap["analysis"][typean]
self.d_prefix_mc = self.dp["mc"].get("prefix_dir_res")
self.d_prefix_data = self.dp["data"].get("prefix_dir_res")
self.d_resultsallpmc = self.d_prefix_mc + self.dp["mc"]["results"][period] \
if period is not None else self.d_prefix_mc + self.dp["mc"]["resultsallp"]
self.d_resultsallpdata = self.d_prefix_data + dp["data"]["results"][period] \
if period is not None else self.d_prefix_data + self.dp["data"]["resultsallp"]

self.p_corrmb_typean = datap["analysis"][self.typean]["corresp_mb_typean"]
if self.p_corrmb_typean is not None:
Expand Down Expand Up @@ -116,8 +119,7 @@ def __init__(self, datap, case, typean, period):
if not isinstance(self.p_includesecpeaks[0], list):
self.p_inculdesecpeaks = [self.p_includesecpeaks for _ in range(self.p_nbin2)]

self.p_masssecpeak = datap["analysis"][self.typean]["masssecpeak"] \
if self.p_includesecpeaks else None
self.p_masssecpeak = datap["analysis"][self.typean].get("masssecpeak", None)

self.p_fix_masssecpeaks = datap["analysis"][self.typean].get("fix_masssecpeak", None)
if self.p_fix_masssecpeaks is None:
Expand All @@ -127,10 +129,8 @@ def __init__(self, datap, case, typean, period):
if not isinstance(self.p_fix_masssecpeaks[0], list):
self.p_fix_masssecpeaks = [self.p_fix_masssecpeaks for _ in range(self.p_nbin2)]

self.p_widthsecpeak = datap["analysis"][self.typean]["widthsecpeak"] \
if self.p_includesecpeaks else None
self.p_fix_widthsecpeak = datap["analysis"][self.typean]["fix_widthsecpeak"] \
if self.p_includesecpeaks else None
self.p_widthsecpeak = datap["analysis"][self.typean].get("widthsecpeak", None)
self.p_fix_widthsecpeak = datap["analysis"][self.typean].get("fix_widthsecpeak", None)
self.p_fixedmean = datap["analysis"][self.typean]["FixedMean"]
self.p_use_user_gauss_sigma = datap["analysis"][self.typean]["SetInitialGaussianSigma"]
self.p_max_perc_sigma_diff = datap["analysis"][self.typean]["MaxPercSigmaDeviation"]
Expand Down
10 changes: 5 additions & 5 deletions machine_learning_hep/bitwise.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ def tag_bit_df(dfin, namebitmap, activatedbit):
bitson = activatedbit[0]
bitsoff = activatedbit[1]
array_cand_type = dfin.loc[:, namebitmap].values.astype("int")
res_on = pd.Series([True]*len(array_cand_type))
res_off = pd.Series([True]*len(array_cand_type))
res = pd.Series(dtype = 'int')
res_on = pd.Series([True]*len(array_cand_type), dtype=int)
res_off = pd.Series([True]*len(array_cand_type), dtype=int)
res = pd.Series(dtype=int)

if bitson:
mask = reduce(operator.or_, ((1 << bit) for bit in bitson), 0)
bitmapon = selectbiton(array_cand_type, mask)
res_on = pd.Series(bitmapon)
res_on = pd.Series(bitmapon, dtype=int)
if bitsoff:
mask = reduce(operator.or_, ((1 << bit) for bit in bitsoff), 0)
bitmapoff = selectbitoff(array_cand_type, mask)
res_off = pd.Series(bitmapoff)
res_off = pd.Series(bitmapoff, dtype=object)
res = res_on & res_off
return res

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ LcpKpi:
doml: true
mass: 2.286
sel_reco_unp: "fPt>0"
sel_reco_singletrac_unp : null
sel_gen_unp: "fPt>0"
sel_cen_unp: null
sel_good_evt_unp: "fIsEventReject == 0"
Expand Down Expand Up @@ -60,8 +59,8 @@ LcpKpi:
var_jet_match: [df, fIndexHfCand2Prong]
var_jetsub_match: [df, fIndexD0ChargedJets]
var_evt:
data: [fIndexCollisions, fIsEventReject, fNumContrib]
mc: [fIndexCollisions, fIndexMcCollisions, fIsEventReject, fNumContrib]
data: [fIndexCollisions, fIsEventReject, fNumContrib, fMultZeqNTracksPV, fMultZeqFT0A, fMultZeqFT0C, fMultFT0M, fMultZeqFV0A]
mc: [fIndexCollisions, fIndexMcCollisions, fIsEventReject, fNumContrib, fMultZeqNTracksPV, fMultZeqFT0A, fMultZeqFT0C, fMultFT0M, fMultZeqFV0A]
var_gen: [fIndexMcCollisions, fPt, fY, fFlagMc, fOriginMcGen]
var_evt_match: [df, fIndexCollisions]
var_evt_match_mc: [df, fIndexMcCollisions]
Expand Down Expand Up @@ -202,7 +201,7 @@ LcpKpi:
chunksizeskim: [100] #list of periods
fracmerge : [1.0] #list of periods
seedmerge: [12] #list of periods
period: [test] #list of periods
period: [LHC22b1b] #list of periods
select_period: [1]
prefix_dir: /data2/MLhep/
unmerged_tree_dir: [sim/alice/cern.ch/user/a/alihyperloop/jobs/0024] #list of periods
Expand Down Expand Up @@ -286,7 +285,7 @@ LcpKpi:

Run3analysis:
proc_type: Dhadrons
useperiod: [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
useperiod: [1]
plotbin: [1]
usesinglebineff: 0
sel_binmin2: [1,2,4,6,8,12] #list of nbins
Expand All @@ -295,12 +294,12 @@ LcpKpi:
triggerbit: ''
use_cuts: False
cuts:
- "fCPA > 0.95"
- "fCPA > 0.95"
- "fCPA > 0.95"
- "fCPA > 0.95"
- "fCPA > 0.95"
- "fCPA > 0.95"
- "fDecayLength > 0.02 and fCpa > 0.9"
- "fDecayLength > 0.02 and fCpa > 0.9"
- "fDecayLength > 0.02 and fCpa > 0.9"
- "fDecayLength > 0.02 and fCpa > 0.9"
- "fDecayLength > 0.02 and fCpa > 0.9"
- "fDecayLength > 0.02 and fCpa > 0.9"


# To initialize the individual fits in pT bins
Expand All @@ -318,7 +317,7 @@ LcpKpi:
weighttrig: false

data:
runselection: [null, null] #FIXME
runselection: [null] #FIXME
prefix_dir_res: /data2/MLhep/
results: [LHC22pp/Results/prod_LHC22o/resultsdata] #list of periods
resultsallp: LHC22pp/Results/resultsdatatot
Expand All @@ -339,10 +338,9 @@ LcpKpi:
rebin: [6,6,6,6,6,6]
fix_mean: [false,false,false,false,false,false]
fix_sigma: [false,false,false,false,false,false]
masssecpeak: 0.
# Fix mean and/or sigma
FixedMean: False
SetFixGaussianSigma: [true,true,true,true,true,true]
SetFixGaussianSigma: [false,false,false,false,false,false]
# Use value set for "masspeak" for initializing total fit, otherwise what is derived from MC fit is used
SetInitialGaussianMean: true
# Use values set for "sigmaarray" for initializing total fit (per pT bin),
Expand Down
Loading

0 comments on commit 8352592

Please sign in to comment.