Hi ROOT Family,
It is me again. I saved my data to a tree with two branches x1 and x2. And I copied my x2 branch to an array c[ ] (with the amount of 48777 data). I used the “unique” function to delete the duplicate data, and I only needed the non-duplicate data, so I saved all my non-duplicate data to another array d[ ] (with the amount of 20000 data). Then, I would like to copy the data from d[ ] to x2_new which is a new branch. Now, the x2_new branch only has the non-duplicate data, and the amount is 20000. I would like to keep the x1 the corresponding data only, i.e. the data which corresponds to the 20000 non-duplicate x2 data. So, I defined a new branch x11, and filled the tree. But, my result was wrong. None of my x2_new nor x11 branch saved the data I needed. I saw there were 48777 data in both of them, but not 20000 as desired. Could anyone help with my problems? I must made a mistake by defining these two new branches, but I could not figure it out. Thanks so much for any helps.
double x11;
TBranch* branch_x1 = tree->Branch("x11", &x11, "x11/D");
double x2_new;
TBranch* branch_x2 = tree->Branch("x2_new", &x2_new, "x2_new/D");
for (int i5 = 0; i5 < n; i5++) {
tree->GetEntry(i5);
x2_new = d[i5];
branch_x2->Fill();
branch_x1->Fill(); // Fill "x1" with corresponding values
}
daya_1.C (2.5 KB)
cross_dmp.txt (2.3 MB)