I have trees containing 4 leaves of length 10 double arrays. I would like to prepare a sequence of TMVA::DataLoader objects with each array’s elements as individual variables. If a given DataLoader object contains elements from 1 of these 4 arrays, it must contain all 10 elements from that array. This means AddVariable() will be used to add a minimum of 10 elements and a maximum of 40 elements. Calling these arrays arrA[10], arrB[10], arrC[10], arrD[10], with a DataLoader dlA which is to contain arrA and a DataLoader dlAB containing both arrA and arrB, I can certainly do
for (int idx = 0; idx < 10; ++idx) {
TString arrName;
arrName.Form("arrA[%d]", idx);
dlA -> AddVariable(arrName);
dlAB -> AddVariable(arrName);
arrName.Form("arrB[%d]", idx);
dlAB -> AddVariable(arrName);
}
or I could just do
dlA -> AddVariable("arrA[10]");
dlAB -> AddVariable("arrA[10]");
dlAB -> AddVariable("arrB[10]");
in the hope that each arrA and arrB element will still implicitly get an individual coefficient. I don’t think this works, however, so I was wondering if there are any conventional ways to do this in TMVA, rather than with the above for loop? In particular, the following link makes me think the same can be achieved with
dlA -> AddSpectator("idx");
dlA -> AddVariable("arrA[idx]");
but idx isn’t in the trees by default, or perhaps the max, min optional arguements inside of AddVariable() and AddSpectator() can be used to set array indices? The purpose of max, min aren’t apparent to me from the DataLoader class reference page.