I am trying to follow this worksheet from Hance and recreate the invariant mass plot below from his root file. I have attached my code and the root file can be downloaded from the website.HEP_practiceV6.C (33.3 KB) (upload://aoNaWV7GMmHT31s6iq6103497KE.C) (20.4 KB)
I am creating around 20 canvas here by repeating code? Is there some easier way to do this with functions and loops?
ROOT Version: 6.22 Platform: Ubutnu 18.04 Compiler: Not Provided
That’s more of a c++ issue than root, but with a loop you can for example create an array of canvases (e.g. TCanvas *c;) declared outside the loop and then inside the loop create each one as needed, also giving them names that depend on the loop iteration number.