Hi all
I have 3 questions need your help.
Is the 1st jpg in attachment a TH2D or TH3D?
I got a TH2D after looping over the TH1D in attachment 2, how can I get the root file similar to the 1st jpg?
Why is the TH3D after looping over the same TH1D empty?
(code also is uploaded)
Thank in advance,any help will be appreciated. exp.c (511 Bytes) Respense.root (988 Bytes)
Processing exp.c...
In file included from input_line_10:1:
/Users/couet/Downloads/exp.c:16:22: error: cannot cast from type 'Double_t'
(aka 'double') to pointer type 'TH1D *'
Int_t BinContent = (TH1D*)p->GetBinContent(i);
^~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/couet/Downloads/exp.c:17:29: warning: implicit conversion from 'double'
to 'Int_t' (aka 'int') changes value from 5.5 to 5 [-Wliteral-conversion]
response->SetBinContent(i,5.5,BinContent);
~~~~~~~~ ^~~
I have corrected the Int_t Bincontent = (TH1D*)p->GetBinContent(i) to Double_t BinContent = (TH1D*)p->GetBinContent(i); It can performs.
Can u tell me the difference between virtual void TH2::SetBinContent ( Int_t binx,
Int_t biny,
Double_t content)
and virtual void TH2::SetBinContent ( Int_t binx,
Int_t biny,
Int_t,
Double_t content )
Thought I could get a file by using TH2::SetBinContent method just like the 1st picture uploaded, however, I get a scatter diagram.
Hi,couet:
Thanks for your respond!
The result given by your macro seems has little difference with the Response.root I uploaded.
What should I do if I want a file that looks like the image when I firstly posted the question?
It that pic a TH2D or TH3D?
LEGO works! Thanks!
Another problem occurs when I fill TH2D with several histos.
I uploaded the code,part histo files and also the errors on the terminal.
Wish you can help. histo10.root (31.3 KB) histo5.root (31.2 KB) exp2.c (712 Bytes) error.c (309 Bytes)