Problem with ProjectionX

Hi everyone. I have a problem with the function ProjectionX. In particular, I would like to know what’s the role of the first argument.
I’ll explain my situation. I have a set of 2D histos and, for each of them, I want to create a 1D histo corresponding to its projection on the x axis. What I did is:

[code]for(int icent=0; icent<NCENT1; icent++){
for(int ipt1=0; ipt1<NPT1; ipt1++){
for(int ipt2=0; ipt2<NPT2; ipt2++){
for(int it=0; it<NCH; it++){
sprintf(histname,“fg_cent%.2d_pta%d_ptb%.2d_ch%d”,icent,ipt1,ipt2,it);
fg[icent][ipt1][ipt2][it] = (TH2D*) outfile -> Get(histname);

       fg_proj[icent][ipt1][ipt2][it] = fg[icent][ipt1][ipt2][it] -> ProjectionX("fg_proj_cent%.2d_pta%d_ptb%.2d_ch%d", 20, 40);
     }
   }
 }

}
[/code]

Now, to check that I did everything correctly I picked the first of the histograms and I plot both fg_proj and the explicit projection:

[code]TCanvas *c0 = new TCanvas(“c0”,“c0”);
(fg[0][0][0][0] -> ProjectionX(“proj”, 20, 40)) -> Draw();

TCanvas *c1 = new TCanvas(“c1”, “c1”);
fg_proj[0][0][0][0] -> Draw();[/code]

The result is that they are not the same at all. In particular it seems that the cause of that is related to the first argument of the function ProjectX. Does anyone have any idea of what’s going on?

Thanks a lot

It is the name of the resulting TH1.
root.cern.ch/root/htmldoc/TH2.ht … rojectionX