Add branch to one tree to another one, strange peak

Hi all, I have two trees and I have to add a branch of one tree to the other one. I succeeded to do this adding the branch and looping over all the events of the tree to fill it…

but I have a strange peak in the distribution of the new branch, even if the loop seems ok.

I have to add a branch from t2 to t1…This is the piece of code:

Int_t nentries = (Int_t)t1->GetEntries();
auto treew = t1->CloneTree(-1,"fast");

float bdtg;
float Lcbdtg;

TBranch* Lc_bdtg = treew->Branch("Lc_bdtg",&bdtg, "bdtg/F");
for (int i=0; i<nentries; i++){




Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided

if (t1->GetEntries() != t2->GetEntries()) std::cout << "Expect problems." << std::endl;

Thanks for the response. the entries are not the same, but I don’t have problem with another set of data, it’s strange

if (t1->GetEntries() > t2->GetEntries()) std::cout << "Expect a strange peak in the distribution." << std::endl;