How do people determine the difference between two TProfiles?
Subtracting the two via Add() behaves differently for TProfiles than for histograms, and thus it’s not giving me the numbers I’m interested in.
Here’s a minimal example of subtracting one TProfile from another:
[code]#!/usr/bin/env python
from ROOT import TProfile, TCanvas, gROOT
gROOT.SetBatch()
profile1 = TProfile(“p1”,“p1”,5,0,5)
profile2 = TProfile(“p2”,“p2”,5,0,5)
for i in range(5):
profile1.SetBinContent(i, 1.0)
profile2.SetBinContent(i, 0.5)
profile1.SetBinEntries(i, 1)
profile2.SetBinEntries(i, 1)
profile1.Add(profile2, -1.0)
canvas = TCanvas(“canvas”,“canvas”,500,310)
profile1.Draw()
canvas.SaveAs(“add_profile.png”)[/code]
The difference between the two profiles is 0.5 in each bin. But what results is 0.25 in each bin! I’m guessing the number of “BinEntries” was added between these two profiles and thus a result of 0.5 gets divided by 2?
So what does one do to get the actual difference between two TProfiles?