umd-lhcb / lhcb-ntuples-gen

ntuples generation with DaVinci and in-house offline components
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

Generate step-2 ntuples for FullSim (FS) MC #90

Closed yipengsun closed 2 years ago

yipengsun commented 2 years ago

I've generated the step-2 FS MC ntuples, and are now thinking about doing validations:

yipengsun commented 2 years ago

Checking the FF weights:

MC ID: 12675011 (D**)
  Tree: TupleB0/DecayTree (X)
    Reweight success rate: 0.13
    FF avg wt: 1.667, max wt: 4.444, wt > 1 ratio: 0.89
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.49
    FF avg wt: 1.749, max wt: 8.247, wt > 1 ratio: 0.94
MC ID: 12895400
  This is a DDX MC, skipping...
MC ID: 11894200
  This is a DDX MC, skipping...
MC ID: 12895000
  This is a DDX MC, skipping...
MC ID: 12773410 (norm)
  Tree: TupleB0/DecayTree (X)
    Reweight success rate: 0.14
    FF avg wt: 0.812, max wt: 4.144, wt > 1 ratio: 0.07
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.62
    FF avg wt: 0.805, max wt: 33.599, wt > 1 ratio: 0.07
MC ID: 12573001 (sig)
  Tree: TupleB0/DecayTree (X)
    Reweight success rate: 0.00
    FF avg wt: 0.886, max wt: 1.131, wt > 1 ratio: 0.40
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.99
    FF avg wt: 1.012, max wt: 6.151, wt > 1 ratio: 0.97
MC ID: 11894600
  This is a DDX MC, skipping...
MC ID: 11874430
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.90
    FF avg wt: 2.391, max wt: 9.850, wt > 1 ratio: 0.87
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.99
    FF avg wt: 3.179, max wt: 9.850, wt > 1 ratio: 0.91
MC ID: 11674401 (D** -> Dpipi)
  Tree: TupleB0/DecayTree (X)
    Reweight success rate: 0.17
    FF avg wt: 1.668, max wt: 3.379, wt > 1 ratio: 0.90
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.50
    FF avg wt: 1.747, max wt: 5.000, wt > 1 ratio: 0.94
MC ID: 12875440 (D** -> Dpipi)
  Tree: TupleB0/DecayTree (X)
    Reweight success rate: 0.19
    FF avg wt: 1.581, max wt: 3.584, wt > 1 ratio: 0.85
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.49
    FF avg wt: 1.747, max wt: 7.558, wt > 1 ratio: 0.94
MC ID: 12895000
  This is a DDX MC, skipping...
MC ID: 11894600
  This is a DDX MC, skipping...
MC ID: 11574010
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.99
    FF avg wt: 0.834, max wt: 60.803, wt > 1 ratio: 0.12
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.99
    FF avg wt: 0.870, max wt: 1496.308, wt > 1 ratio: 0.13
MC ID: 12873460
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.92
    FF avg wt: 2.268, max wt: 56.687, wt > 1 ratio: 0.95
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.99
    FF avg wt: 4.938, max wt: 5936.068, wt > 1 ratio: 0.97
MC ID: 12895400
  This is a DDX MC, skipping...
MC ID: 11894200
  This is a DDX MC, skipping...
MC ID: 11894210
  This is a DDX MC, skipping...
MC ID: 11894610
  This is a DDX MC, skipping...
MC ID: 11676012 (D** -> Dpipi, Prob?)
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.47
    FF avg wt: 1.744, max wt: 5.926, wt > 1 ratio: 0.94
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.49
    FF avg wt: 1.746, max wt: 5.926, wt > 1 ratio: 0.94
MC ID: 12773400 (sig)
  Tree: TupleB0/DecayTree (X)
    Reweight success rate: 0.12
    FF avg wt: 0.873, max wt: 4.707, wt > 1 ratio: 0.10
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.62
    FF avg wt: 1.002, max wt: 11343.795, wt > 1 ratio: 0.13
MC ID: 11874440
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.88
    FF avg wt: 2.545, max wt: 63.781, wt > 1 ratio: 0.96
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.99
    FF avg wt: 5.177, max wt: 6254.263, wt > 1 ratio: 0.96
MC ID: 12873450
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.93
    FF avg wt: 2.145, max wt: 10.791, wt > 1 ratio: 0.87
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.99
    FF avg wt: 3.133, max wt: 14.896, wt > 1 ratio: 0.90
MC ID: 12573012 (norm)
  Tree: TupleB0/DecayTree (X)
    Reweight success rate: 0.01
    FF avg wt: 1.036, max wt: 4.830, wt > 1 ratio: 0.23
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.99
    FF avg wt: 1.016, max wt: 7.502, wt > 1 ratio: 1.00
MC ID: 12675402 (D** -> Dpipi)
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.48
    FF avg wt: 1.751, max wt: 4.476, wt > 1 ratio: 0.94
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.49
    FF avg wt: 1.751, max wt: 4.476, wt > 1 ratio: 0.95
MC ID: 11894610
  This is a DDX MC, skipping...
MC ID: 11574021
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.98
    FF avg wt: 0.831, max wt: 32.072, wt > 1 ratio: 0.09
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.99
    FF avg wt: 0.832, max wt: 32.072, wt > 1 ratio: 0.09
MC ID: 11894210
  This is a DDX MC, skipping...
MC ID: 12893610
  This is a DDX MC, skipping...
MC ID: 12773400 (sig)
  Tree: TupleB0/DecayTree (X)
    Reweight success rate: 0.12
    FF avg wt: 0.897, max wt: 4.319, wt > 1 ratio: 0.14
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.61
    FF avg wt: 0.883, max wt: 239.970, wt > 1 ratio: 0.13
MC ID: 13674000 (D**s)
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.00
    FF avg wt: 0.849, max wt: 1.493, wt > 1 ratio: 0.08
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.00
    FF avg wt: 1.361, max wt: 6.725, wt > 1 ratio: 0.32
MC ID: 12873460
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.92
    FF avg wt: 2.280, max wt: 167.211, wt > 1 ratio: 0.96
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.99
    FF avg wt: 6.995, max wt: 73759.886, wt > 1 ratio: 0.97
MC ID: 11574010
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.99
    FF avg wt: 0.958, max wt: 3987.171, wt > 1 ratio: 0.13
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.99
    FF avg wt: 0.919, max wt: 3987.171, wt > 1 ratio: 0.13
MC ID: 11574021
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.98
    FF avg wt: 0.832, max wt: 41.276, wt > 1 ratio: 0.09
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.99
    FF avg wt: 0.832, max wt: 41.276, wt > 1 ratio: 0.09
MC ID: 12675011 (D** -> Dpipi)
  Tree: TupleB0/DecayTree (X)
    Reweight success rate: 0.13
    FF avg wt: 1.669, max wt: 4.119, wt > 1 ratio: 0.90
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.49
    FF avg wt: 1.746, max wt: 6.402, wt > 1 ratio: 0.94
MC ID: 12573012 (norm)
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.01 (X)
    FF avg wt: 1.012, max wt: 4.164, wt > 1 ratio: 0.24
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.99
    FF avg wt: 1.016, max wt: 7.221, wt > 1 ratio: 1.00
MC ID: 13674000 (D**s)
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.00
    FF avg wt: 0.816, max wt: 1.013, wt > 1 ratio: 0.08
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.00
    FF avg wt: 0.891, max wt: 2.214, wt > 1 ratio: 0.30
MC ID: 11674401
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.16
    FF avg wt: 1.649, max wt: 3.199, wt > 1 ratio: 0.89
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.49
    FF avg wt: 1.746, max wt: 6.358, wt > 1 ratio: 0.94
MC ID: 11574011
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.97
    FF avg wt: 0.926, max wt: 1942.545, wt > 1 ratio: 0.17
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.99
    FF avg wt: 0.922, max wt: 1942.545, wt > 1 ratio: 0.17
MC ID: 12875440 (D** -> Dpipi)
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.19
    FF avg wt: 1.580, max wt: 3.848, wt > 1 ratio: 0.84
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.49
    FF avg wt: 1.749, max wt: 6.590, wt > 1 ratio: 0.95
MC ID: 12893610
  This is a DDX MC, skipping...
MC ID: 11874430
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.89
    FF avg wt: 2.401, max wt: 10.069, wt > 1 ratio: 0.87
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.99
    FF avg wt: 3.178, max wt: 11.827, wt > 1 ratio: 0.91
MC ID: 12773410 (norm)
  Tree: TupleB0/DecayTree (X)
    Reweight success rate: 0.14
    FF avg wt: 0.813, max wt: 4.105, wt > 1 ratio: 0.07
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.61
    FF avg wt: 0.805, max wt: 16.688, wt > 1 ratio: 0.07
MC ID: 12675402 (D** -> Dpipi)
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.48
    FF avg wt: 1.747, max wt: 4.337, wt > 1 ratio: 0.95
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.49
    FF avg wt: 1.749, max wt: 7.407, wt > 1 ratio: 0.95
MC ID: 12893600
  This is a DDX MC, skipping...
MC ID: 12573001 (sig)
  Tree: TupleB0/DecayTree (X)
    Reweight success rate: 0.01
    FF avg wt: 1.078, max wt: 4.340, wt > 1 ratio: 0.17
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.99
    FF avg wt: 1.012, max wt: 7.342, wt > 1 ratio: 0.97
MC ID: 13874020 (D**s)
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.00
    FF avg wt: 1.020, max wt: 3.691, wt > 1 ratio: 0.08
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.00
    FF avg wt: 1.200, max wt: 6.392, wt > 1 ratio: 0.44
MC ID: 13874020 (D**s)
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.00
    FF avg wt: 1.075, max wt: 4.196, wt > 1 ratio: 0.12
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.00
    FF avg wt: 1.438, max wt: 6.435, wt > 1 ratio: 0.49
MC ID: 11874440
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.87
    FF avg wt: 2.921, max wt: 132.717, wt > 1 ratio: 0.95
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.99
    FF avg wt: 4.736, max wt: 2303.136, wt > 1 ratio: 0.96
MC ID: 11676012 (D** -> Dpipi)
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.47
    FF avg wt: 1.743, max wt: 5.977, wt > 1 ratio: 0.94
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.49
    FF avg wt: 1.746, max wt: 5.977, wt > 1 ratio: 0.95
MC ID: 12873450
  Tree: TupleB0/DecayTree
    Reweight success rate: 0.93
    FF avg wt: 2.147, max wt: 15.258, wt > 1 ratio: 0.87
  Tree: TupleBminus/DecayTree
    Reweight success rate: 0.99
    FF avg wt: 3.130, max wt: 15.258, wt > 1 ratio: 0.91
MC ID: 12893600
  This is a DDX MC, skipping...

(Manually annotated)

Concerned about why there's lots of duplicated modes (Duplicates are mostly due to having both polarities!). Other than that, it's not too bad. Also, I think for D**s, we should also exclude them from FF reweighting?

yipengsun commented 2 years ago

Step-2 ntuples annexed to https://github.com/umd-lhcb/rdx-run2-analysis/tree/master/ntuples/0.9.5-bugfix/Dst_D0-mc.

@afernez @manuelfs

manuelfs commented 2 years ago

Thank you Yipeng.

By the way,

For PID weighs (efficiencies really), we apply them directly from the pidcalib histograms, so nothing to check

Well, you still need to check that the weights are correctly applied, but perhaps you already did that.

yipengsun commented 2 years ago

I checked PID weights for a single candidate in 11574011:

make rdx-ntuple-run2-mc-demo
cd gen/rdx-ntuple-run2-mc-demo/ntuple
root D0--21_11_02--mc--11574011--2016--md.root  # date 21_11_02 may change based on the generation date

In ROOT prompt:

tree = (TTree*)_file0->Get("tree")
tree->Scan("ntracks:k_p:k_eta:wpid_k:pi_p:pi_eta:wpid_pi:mu_p:mu_eta:wpid_mu")
auto ntp_k = new TFile("../../../run2-rdx/reweight/pid/root-run2-rdx_oldcut/run2-rdx-2016-md-K-p_eta_ntracks_all_offline.root")
auto histo_k = (TH3D*)ntp_k->Get("eff")
histo_k->FindBin(27.247093e3,3.3243223,206)  // Need e3 because we use GeV in step-2 but PID histos are in MeV
histo_k->GetBinContent(425)  // 0.94889471, bingo
auto ntp_pi = new TFile("../../../run2-rdx/reweight/pid/root-run2-rdx_oldcut/run2-rdx-2016-md-Pi-p_eta_ntracks_all_offline.root")
auto histo_pi = (TH3D*)ntp_pi->Get("eff")
histo_pi->FindBin(6.8366283e3,2.3438025,206)  // 381
histo_pi->GetBinContent(381)  // 0.88318960, correct
auto ntp_mu = new TFile("../../../run2-rdx/reweight/pid/root-run2-rdx_oldcut/run2-rdx-2016-md-Mu_nopt-p_eta_ntracks_all_offline.root")
auto histo_mu = (TH3D*)ntp_mu->Get("eff")
histo_mu->FindBin(13.538933e3,2.1951549,206)  // 290
histo_mu->GetBinContent(290)  // 0.80064332, also correct

The scanned table:

************************************************************************************************************************************
*    Row   *   ntracks *       k_p *     k_eta *    wpid_k *      pi_p *    pi_eta *   wpid_pi *      mu_p *    mu_eta *   wpid_mu *
************************************************************************************************************************************
*        0 *       206 * 27.247093 * 3.3243223 * 0.9488947 * 6.8366283 * 2.3438025 * 0.8831896 * 13.538933 * 2.1951549 * 0.8006433 *
*        1 *        73 * 101.80251 * 3.6971521 *         0 * 8.8713602 * 3.0812876 * 0.9054793 * 14.259970 * 3.4070747 * 0.7907587 *
*        2 *       103 * 6.3618626 * 2.8768824 * 0.8833108 * 28.527739 * 2.3866895 * 0.9774350 * 10.490251 * 2.7744213 * 0.8589472 *
*        3 *       431 * 142.57228 * 4.4131472 *         0 * 33.869008 * 3.7161386 * 0.9397256 * 58.366537 * 3.7633061 * 0.8764123 *
*        4 *        94 * 51.758213 * 2.5595824 * 0.8664444 * 9.5149205 * 3.2173817 * 0.9578863 * 7.0320589 * 2.8500935 * 0.9046342 *
*        5 *       301 * 10.697247 * 2.2313725 * 0.9531251 * 17.800951 * 2.2941731 * 0.9688868 * 12.577235 * 1.9356502 * 0.8073939 *
*        6 *       296 * 24.648012 * 1.9798235 * 0.9708642 * 34.151594 * 2.1893617 * 0.9585041 * 17.651452 * 2.0390066 * 0.8738923 *
*        7 *        38 * 66.199541 * 2.7526327 * 0.8378593 * 41.646967 * 2.9554904 * 0.9448961 * 23.269415 * 2.7053391 * 0.9278922 *
*        8 *        60 * 8.1823021 * 2.0670753 * 0.9558874 * 17.079763 * 2.8760083 * 0.9759392 * 24.038122 * 2.3880646 * 0.9268576 *
*        9 *        87 * 5.2126815 * 2.6121700 * 0.8833108 * 33.711069 * 2.7511880 * 0.9644179 * 7.5743787 * 2.1072804 * 0.7737887 *
*       10 *       229 * 36.473986 * 2.5695570 * 0.9272464 * 22.633014 * 2.2393216 * 0.9846668 * 14.391548 * 2.3470097 * 0.8006433 *
*       11 *       150 * 116.92970 * 4.0925614 *         0 * 57.056619 * 3.5978439 * 0.9337036 * 78.092721 * 3.6130753 * 0.9428198 *
*       12 *        34 * 31.923231 * 3.9408257 * 0.9511140 * 23.983942 * 3.2719434 * 0.9761565 * 5.5325632 * 2.7578261 * 0.7581476 *
*       13 *        96 * 18.576732 * 3.3402094 * 0.9566297 * 18.008896 *  2.604987 * 0.9759392 * 7.9248175 * 2.8879797 * 0.9046342 *
*       14 *       213 * 21.384538 * 3.1895787 * 0.9716825 * 63.895924 * 3.8396120 * 0.9055843 * 36.459713 * 3.5267782 * 0.8481023 *
*       15 *        21 * 9.8005869 * 2.2974004 * 0.9415164 * 31.395066 * 2.5912257 * 0.9677458 * 7.7739080 * 2.1229044 * 0.7781254 *
*       16 *       209 * 11.739024 * 2.8889893 * 0.9425154 * 95.174465 * 3.0689195 * 0.8753505 * 11.871580 * 3.0517120 * 0.8479226 *
*       17 *       126 * 49.570627 * 3.5232217 * 0.9300137 * 61.976463 * 3.2615674 * 0.9337036 * 28.308188 * 3.9141678 * 0.8334092 *
*       18 *       144 *  99.37804 * 4.1334565 * 0.2474619 * 5.4378099 * 2.9923964 * 0.9054793 * 23.927575 * 4.1463663 * 0.7106667 *
*       19 *       131 * 14.510294 * 2.5805279 * 0.9508304 * 19.162440 * 2.5743349 * 0.9798866 * 28.514055 * 2.4512737 * 0.9515883 *
*       20 *       144 * 139.22286 * 4.1364204 *         0 * 148.15736 * 4.3449829 *         0 * 53.401957 * 4.0556519 * 0.9026779 *
*       21 *        71 * 13.570988 * 2.6596765 * 0.9508304 * 24.994056 * 3.3038938 * 0.9716015 * 60.820951 * 3.2321997 * 0.9692842 *
*       22 *        92 * 11.300273 * 2.3674008 * 0.9625395 * 9.6266382 * 3.5510993 * 0.9434301 * 6.0805345 * 2.7975645 * 0.9046342 *
*       23 *       134 * 88.789358 * 4.0246198 * 0.5026192 * 57.573629 * 4.9742823 * 0.9041270 * 21.358001 * 3.8411323 * 0.7684652 *
*       24 *       315 * 15.725784 * 2.6663847 * 0.9520834 *  22.34046 * 3.6304115 * 0.9377307 * 13.754894 * 2.2718275 * 0.8073939 *
Type <CR> to continue or q to quit ==> q
************************************************************************************************************************************

So now I consider the PID application correct