I'm tring overlapping 2 histograms from a ttree. First I set the same number of bins for both and same range, and then simply I draw one of 2 and the I draw the second one with draw(same).
But I have 2 problems:
Rebinnin the histogram, all data shift in left direction. Before the maximum entry was 0.662, then after set 1000 bins the maximum entry is 0.0662. There is a shift facto 10.
The second problem is that thedata shifs not only of a factor 10 but also of 1 bin in the right direction.
Here a pice of code:
TH1D* Ek_incidenti_tot = (TH1D*)ttree_incident_TOT->GetHistogram()->Clone();
G4double min_Ek_incidenti_tot= Ek_incidenti_tot->GetXaxis()->GetBinCenter(0);
G4double max_Ek_incidenti_tot= Ek_incidenti_tot->GetXaxis()->GetBinCenter(Ek_incidenti_tot->GetNbinsX());
Ek_incidenti_tot->SetBins(1000, min_Ek_incidenti_tot, max_Ek_incidenti_tot);
TH1D* Ek_incidenti_signal = (TH1D*)ttree_Ek_incident_signal->GetHistogram()->Clone();
Ek_incidenti_signal->SetBins(1000, min_Ek_incidenti_tot, max_Ek_incidenti_tot);
I tried also to overlap them manually from the root panel and in this way I don't have problem.
In attached there is the also the root file. The plots wrong is the canvas saved as: "Ek_TOT_incident-signal"
14_07_2017_18_21_58_GIFpp.root (929.7 KB)
Thanks a lot in advance