Clever pairwise combinations of tracks in ROOT

Hello,

You can get to your variables and array with TTreeReaderValue and TTreeReaderArrays, as explained in
the other post (Clever track selection in TTree).
From there on is pure C++.

// Here 'tree' is your TTree object
TTreeReader reader(tree);

// Define your variables
TTreeReaderValue<Int_t> nout(reader, "nout");
TTreeReaderArray<Int_t> muon(reader, "muon");
TTreeReaderArray<Int_t> charge(reader, "charge");

// Loop
while (reader.Next()) {
     for (Int_t i = 0; i < *nout; i++) {
         // Select non muons
         if (muon[i] == 1)  continue;
         for (Int_t j = 0; j < *nout; j++) {
              // Select non muons
              if (muon[j] == 1)  continue;
              // Opposite charge
              if ((charge[i]+charge[j]) != 0) continue; 
              // Do stuff
         }
     }
}

Of course you need to add TTreeReaderValues for each variable you need to use.

G Ganis