ProjectionY, variable binsize and log scaling

Hi all,

I’m trying to plot a histogram from a 2D scatter plot h using ProjectionY. This works fine except I would like to evenly space the bins in Logx rather than x. Is there a way to adjust the binsizes either manually or automatically to do this?

Also, it seems that the number of bins and the size of the histogram used in this ProjectionY has to be set equal to that of the original file… When I adjust numbins, everything above a certain bin number, all get ProjectionY values of 0 and it also messes up where on the x-axis things occur (i.e. the larger the numbins the more bunched the data with a long tail of zeros and if I put a larger x ‘size’ range, the data is stretched out to cover the entire range) Is there any way to increase or decrease the number of bins correctly?

TH2F h;
double size = 200.;
h = (TH2F
)file ->Get(“DQMData/Tracking/Track/ctfWithMaterial_AssociatorByHits/dxyres_vs_pt1”);
profile = new TH1F(“profile”,"|#eta| > 2.5 ",numbins,0.,size);
gPad->SetLogx();
Float_t a,e;
int numbins =25;

for (int i = 1; i <= numbins; i=i+1){
a = h->ProjectionY("",i,i+1,“o”)->GetRMS();
e = h->ProjectionY("",i,i+1)->GetRMSError();
profile->SetBinContent(i,a);
profile->SetBinError(i,e);
}
profile->Draw();

Cheers.
Mike

Nevermind. I used TGraph instead, made the original root file have more bins and just made variable binsizes.

Cheers anyway,
Mike