diff options
| author | tlatorre <tlatorre@uchicago.edu> | 2020-12-15 14:09:26 -0600 | 
|---|---|---|
| committer | tlatorre <tlatorre@uchicago.edu> | 2020-12-15 14:09:26 -0600 | 
| commit | be3b6e19510ddee930df1d9435368d66c18da551 (patch) | |
| tree | 1248fb42e0f6ae40626b4f2dc228481a05a75f7b /utils/chi2 | |
| parent | 5e63a701a8b144093528c063856d513be92a37ed (diff) | |
| download | sddm-be3b6e19510ddee930df1d9435368d66c18da551.tar.gz sddm-be3b6e19510ddee930df1d9435368d66c18da551.tar.bz2 sddm-be3b6e19510ddee930df1d9435368d66c18da551.zip | |
add code to reweight the tau neutrino events
This commit updates the code to reweight the MC data from tau neutrinos
since I stupidly simulated the muon neutrino flux instead of the tau
neutrino flux.
Diffstat (limited to 'utils/chi2')
| -rwxr-xr-x | utils/chi2 | 10 | 
1 files changed, 10 insertions, 0 deletions
| @@ -192,6 +192,9 @@ def get_mc_hists_fast(df_dict,x,bins,scale=1.0,reweight=False):          else:              cdf = fast_cdf(bins[:,np.newaxis],ke,resolution) +        if 'flux_weight' in df.columns: +            cdf *= df.flux_weight.values +          mc_hists[id] = np.sum(cdf[1:] - cdf[:-1],axis=-1)          mc_hists[id] *= scale      return mc_hists @@ -474,6 +477,7 @@ if __name__ == '__main__':      from sddm.plot import *      from sddm import setup_matplotlib      import nlopt +    from sddm.renormalize import *      parser = argparse.ArgumentParser("plot fit results")      parser.add_argument("filenames", nargs='+', help="input files") @@ -490,6 +494,7 @@ if __name__ == '__main__':      parser.add_argument("--walkers", type=int, default=100, help="number of walkers")      parser.add_argument("--thin", type=int, default=10, help="number of steps to thin")      parser.add_argument("--run-list", default=None, help="run list") +    parser.add_argument("--mcpl", nargs='+', required=True, help="GENIE MCPL files")      args = parser.parse_args()      setup_matplotlib(args.save) @@ -520,6 +525,11 @@ if __name__ == '__main__':      muon_mc = get_events(args.muon_mc, merge_fits=True, nhit_thresh=args.nhit_thresh, mc=True)      weights = pd.concat([read_hdf(filename, "weights") for filename in args.weights],ignore_index=True) +    # Add the "flux_weight" column to the ev_mc data since I stupidly simulated +    # the muon neutrino flux for the tau neutrino flux in GENIE. Doh! +    mcpl = load_mcpl_files(args.mcpl) +    ev_mc = renormalize_data(ev_mc.reset_index(),mcpl) +      # There are a handful of weights which turn out to be slightly negative for      # some reason. For example:      # | 
