# Profile with variable bin size

Hi ROOTers,

I’ve a profile where I put in X-Axis MC energies values between 0 MeV to 25GeV, in the Y-Axis I’ve calorimeter energies between 0 MeV to 5GeV. I need to create a profile with variable bin size. So that things look a little less crazy. I would say 200 MeV bins up to 1 GeV, then 500 MeV bins up to 5 GeV, then 1 GeV bins up to 10 GeV, and then 2 GeV bins up to 20 GeV.
It is not correct what I am trying to do and I need HELP :

#############################################
file = TFile(‘Result.root’,‘recreate’)
scale = [0,1000,5000,10000,25000]
Scale = array(‘d’,scale)
nbins = len(scale)-1
profile = TProfile(“Result”,“Result”,nbins,Scale)
PrimEnergy = GetPrimaryEnergy()
nP = len(PrimEnergy)
SimEnergy = GetScatterEnergy(channel.rstrip(’\n\r’))
nS = len(SimEnergy)
for i in xrange(nS):
profile.Fill(PrimEnergy[i],SimEnergy[i])
for j in xrange(nP):
Energy = profile.GetBinContent(j)
if Energy<1000 and Energy>0 :
profile.SetBinContent(200,Energy)
if Energy>1000 and Energy<5000 :
profile.SetBinContent(500,Energy)
if Energy<10000 and Energy>5000 :
profile.SetBinContent(1000,Energy)
if Energy10000 :
profile.SetBinContent(2000,Energy)
profile.Draw()
file.Write()
###################################################

So, I obtain a profile with just 4 points for each interval.