root [8] TH1F *hist=new TH1F("tt","tt",1000,-1,1);
root [9] tree->Draw("nbdt>>hist","track.rgt2[0]/rich.beta*::TMath::Sqrt(1-rich.beta*rich.beta)<-1.5&&track.rgt2[0]/rich.beta*::TMath::Sqrt(1-rich.beta*rich.beta)>-2&&nbdt>-8")
Info in <TCanvas::MakeDefCanvas>: created default TCanvas with name c1
(long long) 36313
root [10] hist->Draw()
Info in <TCanvas::MakeDefCanvas>: created default TCanvas with name c1
I redirect the drawing to hist, however, hist is empty, why?
Can you try to repeat the operation with no selection, and then incrementally add cuts?
Moreover, please consider using RDataFrame for this kind of operations: it is intuitive, performant and well supported and your productivity might increase!
Hi,
I repeat it with no selection:
root [7] TH1F *hist=new TH1F()
(TH1F *) 0x4b14c40
root [8] Int_t a=tree->Draw(“nbdt>>hist”,“”,“goff”)
(int) 6940509
root [9] hist->GetEntries()
(double) 0.0000000
root [10]
There is still something wrong.
Thanks @bellenot ! I did not see that, my bad. Indeed it cannot see the name of the C++ variable, however, the name of the ROOT object yes, it’s registered.