TH2D Subtraction problem

I am trying to subtract one 2D histogram from another (both the same size) and store the result in a third, but it’s throwing up an error. Here is what I’m doing:


  TH2D IsoMap("IsoMap","Isotropic Cosmic Ray Map",nBinsX,xmin,xmax,nBinsY,ymin,ymax);
   IsoMap.Fill(ra_iso,dec_iso,1/(nSamp*nShuffles*cos(dec_iso * (kPi/180))));

  TH2D TrueMap("TrueMap","True Cosmic Ray Map",nBinsX,xmin,xmax,nBinsY,ymin,ymax);
    TrueMap.Fill(ra[iTrue],dec[iTrue],1/cos(dec[iTrue] * (kPi/180)));

Whether or not you understand exactly how I’m filling both histograms, just know that they’re both filling fine (I’ve omitted loops corresponding to the variables you see).

These are the two that are involved in the subtraction. I then do this:


  TH2D* Excess = new TH2D("Excess","Excess Cosmic Ray Map",nBinsX,xmin,xmax,nBinsY,ymin,ymax);
  Excess->Add(TrueMap,IsoMap,1,-1);

and I get this error:

error: no matching function for call to ‘TH2D::Add(TH2D&, TH2D&, int, int)’
   Excess->Add(TrueMap,IsoMap,1,-1);

I thought it is fine to use TH1:Add for a TH2, and I definitely have seen that version of constructor for Add, so I don’t understand why it isn’t working.

Excess->Add(&TrueMap, &IsoMap, 1, -1);

You’re a champ, cheers!