Hi everyone,
I am trying to using TPaveText to add text on my histogram as the standard method, however I get the following errors,
Error: Invalid type ‘“CMS’ in declaration of ‘Preliminary”’ histogram.C:27:
Error: Symbol “CMS Preliminary” is not defined in current scope histogram.C:27:
(Remark: without the TPaveText my histogram can plot out normally)
Here is my code:
void histogram(){
gStyle->SetOptStat(kFALSE);
TFile *histo_signal = new TFile("Hinv_Signal_MC.root");
TCanvas *c1 = new TCanvas("met_pt", "met_pt");
c1.SetLogy();
TTree *signal;
histo_signal->GetObject("signal", signal);
Double_t met_pt_signal;
signal->SetBranchAddress("met_pt_signal", &met_pt_signal);
TH1D *h1 = new TH1D("h1", "met_pt_signal", 12,100,400);
for(Int_t i = 0; i < signal->GetEntries(); i++){
signal->GetEntry(i);
h1.Fill(met_pt_signal);
}
h1->SetMaximum(150);
h1->SetLineColor(38);
h1->SetLineWidth(1);
h1->GetXaxis()->SetTitle("MET (GeV)");
h1->GetYaxis()->SetTitle("Events");
//h1->SetFillColor(kBlue);
h1.Draw();
TPaveText *pt = new TPaveText(0.2,0.7,0.4,0.85,"NDC");
pt.SetTextSize(0.04);
pt.SetFillColor(0);
pt.SetTextAlign(12);
pt.AddText(“CMS Preliminary”);
pt.Draw();
Please provide the following information:
ROOT Version (e.g.5.34/36):
Platform, compiler (e.g. CentOS 7.3, gcc6.2):