Segmentation error while creating a tree

Without a reproducer one can only give general comments. A quick look at your file:

  • You are including a lot of headers twice. Include them only once!
  • You are using new TFile(...) to open the input file. Use TFile::Open("...") instead (especially because you are opening a root://... file (which should be a TNetFile)) - and add a check that the file exists, i.e. check that f != nullptr. Also check that the tree exists.
  • In the following code fragment, the second and fourth if can never be true. ```
    if (nSelLeptons != 3) continue;
    if (nSelLeptons > 3) continue;
    if (nvetoLeptons != 0) continue;
    if (nvetoLeptons > 0) continue;
- your program should not compile because you are redefining `VetoMupx, VetoMupy, VetoMupz, VetoMuen, VetoMucharge;` (lines 194+231)
- There is some indentation in your code, yet your indentation doesn't help to find out to which block a line belongs. Use a tool like clang-format to reformat your code!
 This also leads to the next point:
- you are opening the output file inside the event loop! Don't do that, your output tree will only have one event! (Also, you are missing the `delete ff; / delete f;`)
- finally a physics related question: is ` bool passVetoIso( Mu_id[m]==13 ? relIso<0.25 : true)` useful? For -13 no isolation? At least I would add a comment here.