Macro error for plot

Dear All,

I am trying to make a plot of dsigma/dInvMass, however I am getting error even though I just used same algorithm to plot dsigma/deta.

Part Code:

TH1F * InHist = new TH1F("InvMass","Histogram of InvMass", 100, -10, 10);
  TH1F *Inv = 0;
{
 eta = -log(tan(theta/2));
 InHist->Fill(InvMass);
}
  Float_t binwidth = InHist->GetBinWidth(1); // plot of dsigma/dInvariant Mass
  Float_t norm = sigma/(nevents*binwidth);
  dInv = (TH1F*)InHist->Clone("dInv");
  dInv->SetTitle("gen_dSigma_Mass/InvMass");
  dInv->Scale(norm);
  dInv->Draw();

Error

 error: use of undeclared identifier 'dInv'dInv = (TH1F*)InHist->Clone("dInv");
                                                               ^
 error: use of undeclared identifier 'dInv' dInv->SetTitle("gen_dSigma_Mass/InvMass");
                                                                ^
 error: use of undeclared identifier 'dInv'dInv->Scale(norm);
                                                                 ^
 error: use of undeclared identifier 'dInv'dInv->Draw();

Please help thank you.

TH1F *dInv = (TH1F*)InHist->Clone("dInv");

BTW. When you post “source code” or “output” here, do remember to enclose them into two lines which contain just three characters ``` (see how your post has been edited above).

Thank you for your response but now I got many different errors:

error: address of overloaded function ‘norm’ does not match required type ‘double’
dInv->Scale(norm);
candidate template ignored: could not match ‘_Tp (const complex<_Tp> &)’ against ‘double’
norm(const complex<_Tp>& __c)
^
passing argument to parameter ‘c1’ here
virtual void Scale(Double_t c1=1, Option_t *option="");
error: expected ‘;’ at end of declaration
Float_t binwidth = InHist->GetBinWidth(1); //

You need to rename your “norm” variable (i.e. use another name for it).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.