Skip to content

Modification of the script to add the sum of weights into the ntuples

Miguel Angel Garcia Ruiz requested to merge metadata_optim_code into master

It is modified the ntuple_macro.C file which was reading the ntuples event by event and copying all the branches through the SetBranchAddress function and creating a new root file with the new sum of weights branches. Now, it just clone the original tree and add new branches related to the sum of weights, avoiding the use of unnecessary code. Also, an script is added to run the ntuple_macro.C over all the root files in the ntup folder, and merge all the root files with their sum of weights branches in a single root file. It only requires the path of the ntup and hist folders, the path of the ntuple_macro.C (you would need to change the DSID in the name of the histogram reading line every time you want to use the script in a different dataset) and the final target root file (which would be the target root file after merging all the root files in the ntup folder with the new three branches produced by the ntuple_macro.C).

Merge request reports

Loading