Ntuples in Postprocessing =========================== The CROWN Ntuples can be used by any Postprocessing framework. There are a few things to keep in mind to ensure easy processing. The most important difference is that only quantities affected by a shift are recalculated. This means the postprocessing framework must be able to use a mixture of the original and shifted quantities, when applying shifts. In order to make this step a bit easier, the information which quantities are affected by a shift, is stored in the Ntuple. Quantity mapping ***************** To read the mapping from an Ntuple, the python function listed below may be used. Two types of mapping are available, depending on the actual use case. In the first, the mapping is sorted by shift; in the second the mapping is sorted by quantity. .. code-block:: python import ROOT as r import glob, os def load_crown_mapping(filename, by_shift=False, by_quantity=False): data = {} r.gInterpreter.GenerateDictionary("map >", "map") f = r.TFile.Open(filename) if by_shift and not by_quantity: name = "shift_quantities_map" elif by_quantity and not by_shift: name = "quantities_shift_map" else: print("Choose either by_shift or by_quantity, not both or none") return data print("Reading data") m = f.Get(name) for x, yy in m: data[x] = [] for y in yy: data[x].append(y) f.Close() print("Cleaning up autogenerated files") # cleanup autogenerated files for f in glob.glob("AutoDict_*"): os.remove(f) return data # print(load_crown_mapping("path/to/testfile.root", by_quantity=True))