TH1F Integral to obtaine normalisation

Dear ROOT-experts,

I’m trying to estimate a normalisation factor by taking the ration of the integral of data and data driven BG in the dedicated selection. This factor is then applied as weights to BG. Naively I would expect that taking the ration again for the same selection after rescaling the BG gives 1 but instead I find differences of the order of a view percent.
Here’s what I did (eventWeight is always =1 here):

weightList=['eventWeight']
cutsCRQ='(veto==0 || veto==410500) && dPhi < 0.200000 && abs(jetEta[1]) <= 2.800000 && abs(jetEta[0]) <= 2.800000 && met >= 250.000000 && nJet >= 2 && jetPt[0] >= 200.000000 && jetPt[1] >= 50.000000 && meffInc >= 800 && (abs(jetEta[0])>2.4 || jet1Chf/jetFracSamplingMax[0]>0.1) && (abs(jetEta[1])>2.4 || jet2Chf/jetFracSamplingMax[1]>0.1) && (dPhiBadTile>0.3 || RunNumber>284484) && ((cleaning & 0x30F)==0) && (abs(timing)<4 || timing==-99999)'
smearTree=smear.Get('Data_SRAll')
dataTree=data.Get('Data_SRAll')

smearSRhistoROOT=ROOT.TH1F('smearSRhistoROOT', '', 20,0.,4.) 
dataSRhistoROOT=ROOT.TH1F('dataSRhistoROOT', '', 20,0.,4.) 

smearTree.Draw('dPhi>>smearCRQhistoROOT', cutsCRQ)
smearCRQhistoROOT=ROOT.gPad.GetPrimitive('smearCRQhistoROOT')

dataTree.Draw('dPhi>>dataCRQhistoROOT', cutsCRQ)
dataCRQhistoROOT=ROOT.gPad.GetPrimitive('dataCRQhistoROOT')

print "\n integral smear histo from Tree.Draw(): ", smearCRQhistoROOT.Integral()
print " integral data histo from Tree.Draw(): ", dataCRQhistoROOT.Integral()
normFactorROOT=dataCRQhistoROOT.Integral()/smearCRQhistoROOT.Integral()

print "\n =>normfactor from ROOT only: ", normFactorROOT

smearCRQhistoROOTNorm=ROOT.TH1F('smearCRQhistoROOTNorm', '', 20,0.,4.) 
dataCRQhistoROOTNorm=ROOT.TH1F('dataCRQhistoROOTNorm', '', 20,0.,4.) 
 
dataTree.Draw('dPhi>>dataCRQhistoROOTNorm', '(%s)*(%s)' %(cutsCRQ, '*'.join(weightList)))
dataCRQhistoROOTNorm=ROOT.gPad.GetPrimitive('dataCRQhistoROOTNorm')

smearTree.Draw('dPhi>>smearCRQhistoROOTNorm', '(%s)*(%s*%s)' %(cutsCRQ, '*'.join(weightList), normFactorROOT))
smearCRQhistoROOTNorm=ROOT.gPad.GetPrimitive('smearCRQhistoROOTNorm')

print "\nnorm integral smear histo from Tree.Draw(): ", smearCRQhistoROOTNorm.Integral()
print "norm integral data histo from Tree.Draw(): ", dataCRQhistoROOTNorm.Integral()
print "\n => normalised norm factor (should be 1): ",  dataCRQhistoROOTNorm.Integral()/smearCRQhistoROOTNorm.Integral()

What am I missing?

Many thanks,
Veronika

Hi,

I would use TH1D. It is possible that the difference is caused by the limited precision of the TH1F.
Normally the are no reasons (only in case of a huge number of bins, e.g in case of 3d histograms) to use TH1F instead of TH1D

Lorenzo

Hi Lorenzo,

just realised I never replied here. So even if it’s way too late… this was indeed the issue. Thanks a lot for your help :slight_smile: