Hello,
I’m trying to select some signal events from a TTree by applying different cuts in its branches, actually, everything works, and apparently, the cuts done are well applied; Even so, the number of entries change depending on the method i use:
So, I start from a TTree with a known number of entries (28739) which, after applying a cut and using TTree::GetEntries() contains 27315, then i copy the reduced tree to another file. However, if i inspect the new tree using a TBrowser, it shows me a different number of entries (25516). why is this happening? am I doing something wrong? which number is correct?
it will be probably a dumb question, but is running me crazy.
there’s the code i use to apply the cut, and to save the new reduced tree:
TString finput = "Lb2L0Gamma_Offline_mcmatch_L0DD.root";
TString foutput = "data_background_MC.root";
TFile *input =new TFile(finput, "READ");
input->cd("Lb2L0GammaTuple");
TTree *datainput = (TTree*) gDirectory->Get("DecayTree");
datainput->SetBranchStatus("*", 0);
datainput->SetBranchStatus("Lambda_b0_M", 1);
datainput->SetBranchStatus("Lambda_b0_PT",1);
datainput->SetBranchStatus("Lambda_b0_FD_OWNPV",1);
datainput->SetBranchStatus("Lambda_b0_FDCHI2_OWNPV",1);
datainput->SetBranchStatus("Lambda_b0_MTDOCA",1);
datainput->SetBranchStatus("Lambda_b0_MTDOCACHI2",1);
datainput->SetBranchStatus("Lambda_b0_DOCA_12", 1);
datainput->SetBranchStatus("Lambda0_M", 1);
TFile *f = new TFile (foutput, "RECREATE");
f->mkdir("MC");
f->cd("MC")
TTree *dataoutput = datainput->CopyTree("Lambda_b0_M>5270.5 && Lambda_b0_M<5922.3");
cout <<"MC: "<<datainput->GetEntries()<<endl;
cout <<"Lb0 mass cut: "<<dataoutput->GetEntries()<<endl;
when it ends, it prints me the initial number of entries, and the final one, but as i said, if I use a TBrowser to inspect the final tree, the number changes.