Hi,
I am having trouble getting this function to behave as expected. Short summary: SetRange(2,2) grabs data from bins 2 and 3. I checked this by simultaneously filling an ntuple and using nt->Draw() with the cuts that I expected to implement using SetRange(). Now for the details.
I have filled an ntuple and a 3D histogram in the same block of code:
TFile* myfile = new TFile("electron_merged.root","RECREATE");
TH3* epeak = new TH3F("epeak0","R vs p_{Track} / E_{tower} Vs. Eta",40,-1.,1.,200,0.,10.,10,0.,0.03);
TNtuple* ntup = new TNtuple("nt","","p:energy:r");
....
if(accept()){
ntup->Fill(p,energy,r);
epeak->Fill(eta, p/energy, r);
...
}
so if I open electron_merged.root in an interactive session and call
epeak0->GetZaxis()->SetRange(1,1);
epeak0->Project3D("y")->Draw();
nt->Draw("p/energy","r<0.003","same");
the two plots should show up on top of each other. However, it turns out that the histogram projection is getting data from the first two r bins. The ntuple plot that matches the histogram plot is this one (note the different cut):
nt->Draw("p/energy","r<0.006","same");
Is this a known problem? You can find electron_merged.root at
web.mit.edu/kocolosk/www/electron_merged.root
Note: to see the plots line up exactly, use the “final” key instead of the “energy” key in the ntuple. Thanks,
Adam Kocoloski