In C++:
//Reset the data
leptondata->Clear();
metdata->Clear();
jetdata->Clear();
yet in Python:
#Reset the data
leptondata=TClonesArray( "TLorentzVector", nentries)
metdata=TClonesArray( "TLorentzVector", nentries)
jetdata=TClonesArray( "TLorentzVector", nentries)
and you’re surprised that the behavior differs, why?
To be specific, that “problem in C++; program state has been reset” means you got a segfault on the C++ side. The reason is that by overwriting the XYZdata references, the old values are garbage collected even as you had passed pointers to them to C++. Then the GetEntry touches that deleted memory.
Just call Clear() on the clones arrays in Python like you do in C++ …