Home | News | Documentation | Download

Problem drawing histogram in different pads (same Canvas)

Hi, this is my first macro in ROOT. I am trying to draw 3 different histograms in a loop using a same TH1F variable ¨histo_proj_Y¨. The problem is that in each step the macro rewrite all pads (1,3,5) with the same histogram : (
I draw these histograms with de procedure:

void Calibrate_strip(TStrip* strip,TH2F* Strip_vs_PAD_histo,TString Strip_histo_name,Int_t strip_number,TFile* File,Int_t Strip_cut_file_number[])

Files:
.C .h and .cxx .txt (15.4 KB) DSSSD_energy_calibration.root (618.5 KB)

I really appreciate your help.
Thanks a lot.
Luis Enrique

Try with:

Strip_vs_PAD_histo->ProjectionY(TString::Format("Projection_Y_%d_%d", strip_number, i), ...
1 Like

Thanks Wilie, I try:

TH1D* histo_proj_Y = Strip_vs_PAD_histo->ProjectionY(“Projection_Y”, 0, 500000, TString::Format("[BidiP%d_%d]", strip_number+1,i+1));

and

TH1D* histo_proj_Y = Strip_vs_PAD_histo->ProjectionY(TString::Format("[BidiP%d_%d]", strip_number+1,i+1));

it works but the problem continue.

So you’ve yet to try:

TH1D *histo_proj_Y = Strip_vs_PAD_histo->ProjectionY(TString::Format("Projection_Y_%d_%d", strip_number, i), 0, 500000, TString::Format("[BidiP%d_%d]", strip_number+1,i+1));

Another idea … right after each “histo_proj_Y->Fit(...);” add “histo_proj_Y->DrawCopy();

Hi Wilie, I try with the idea you gave me before:

TH1D* histo_proj_Y = Strip_vs_PAD_histo->ProjectionY(Form(“Projecting_%d”,strip_number+1), 0, 500000, TString::Format("[BidiP%d_%d]", strip_number+1,i+1));

and it works, thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.