Dear experts,
I created a few histograms. But I found after filling a few of entries, the binning of histograms are changed.
The related code are following
(hSignal_D0[imass][ipt])["largeDCA"] = new TH2D(Form("hSignal_mass%d_pt%d_largeDCA", imass, ipt),
"", ana::nEtaBin, ana::etaBegin, ana::etaEnd,
//ana::nPhiBin, ana::phiBegin, ana::phiEnd);
ana::nPhiBin, -1.57, ana::phiEnd);
(hSignal_D0[imass][ipt])["smallDCA"] = new TH2D(Form("hSignal_mass%d_pt%d_smallDCA", imass, ipt),
"", ana::nEtaBin, ana::etaBegin, ana::etaEnd,
//ana::nPhiBin, ana::phiBegin, ana::phiEnd);
ana::nPhiBin, -1.57, ana::phiEnd);
(hSignal_D0[imass][ipt])[strDCA]->Fill(deltaEta, deltaPhi,
1./nMult_trg_eff_d0[imass][ipt]/effks/effweight_ass);
for(int imass=0; imass<ana::nMass; imass++){
for(int ipt=0; ipt<ana::nPt; ipt++){
for(auto& h : hSignal_D0[imass][ipt]) {
std::cout << h.second->GetYaxis()->GetXmin() << std::endl;;
}
}
}
Also I update the log. If you need the source code, I can upload all. But I am not sure whether a few hundred lines of codes are too long.
Many thanks in advance.
log.txt (2.3 KB)
ROOT Version: 6.06/01
Platform: linuxx8664gcc
Compiler: gcc version 5.3.0 (GCC)
Are you sure that always “ana::phiEnd > -1.57
” (if not, the y-axis limits will be automatically computed).
No, I cannot. but would not the smaller value be stored in underflow?
Thanks
See “Histograms with automatic bins” (and then search also for “automatic binning”) in the TH1 class reference.
Hi, Wile, in my case, I used the GetYaxis()->GetXmax() to show the max value of the axis. Actually, every phiEnd larger than -1.57 and positive. But the max value also be changed after filling a few times. Also I used h.second->SetCanExtend(TH1::kNoAxis)
, this does not work yet.
Can you maybe try the newest ROOT version (maybe it’s a bug in your very old version).
The latest version I can use is 6.12/07… I am using cmssw on the cluster… The bug is very annoying. Do you need my macros of full version?
Thanks
couet
June 20, 2019, 10:31am
9
Yes a running macro reproducing the problem would be very helpful. Just a subset of your program will be sufficient as soon as it shows the issue.
Hi, Couet
I just remove all irrelevant parts of my codes. I have attached the source code.
After I commented the hist->Fill()
, bug did not happen. Also I attach the link to the datasets
https://drive.google.com/drive/folders/1Pj8TqCs2e47f9cB74mV8LL7qiDHfdxwP?usp=sharing
d0ana_1.root
would not give bad binning but d0ana_10.root
would.
Many thanks
corr2D.C (6.5 KB)
Event.cxx (3.4 KB)
Event.h (4.3 KB)
myAnaConsts.h (1.4 KB)
Hi, Wile,
Sorry for my mistake, I just mistakenly set wrong range of x axis, and y axis changed with x. Thank you!
Hi, couet
Sorry for my mistake, I just mistakenly set wrong range of x axis, and y axis changed with x. I only checked y axis range before. Thank you!
Yes, in the “myAnaConsts.h” file, you set etaBegin = etaEnd = -4.95
and this triggers the “automatic binning” for the x-axis.
system
Closed
July 4, 2019, 6:17pm
14
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.