Trying to run a simple code without success - a beginner

Hi,

I am trying to run the code attached at the end of this post, but I get these errors:

Error: Missing one of ‘,)’ expected at or after line 34.
Error: Unexpected end of file (G__fgetstream_template():2) C:\root_v5.34.36\macros\cut.C(49)
Error: Missing one of ‘,;{(’ expected at or after line 49.
Error: Unexpected end of file (G__fgetstream_template():2) C:\root_v5.34.36\macros\cut.C(49)
Error: Missing one of ‘{’ expected at or after line 49.
Error: Unexpected end of file (G__fignorestream():3) C:\root_v5.34.36\macros\cut.C(49)
*** Interpreter error recovered ***

What should I change in the code? Thanks in advance!

TFile f1(“d3pd-ckt12rmd2030pp-pyj4.root”);
TTree* t1 = (TTree*) f1.Get(“dibjet”);
TH1D* h1a = new TH1D(“h1a”, “nhits”, 100, 0, 1500);
TH1D* h1b = new TH1D(“h1b”, “nhits”, 100, 0, 1500);
TH1D* h1c = new TH1D(“h1c”, “nhits”, 100, 0, 1500);
t1->Draw(“jet1_pt>>h1a”, “wt”, “he”);
t1->Draw(“jet1_e>>h1b”, “wt”, “he”);
t1->Draw(“jet1_groosplit12>>h1c”, “wt”, “he”);

h1a->SetFillColor(kRed);
h1a->SetFillStyle(3002);

h1a->Draw(“he”);
h1b->Draw(“he same”);

TFile f2(“d3pd-ckt12rmd2030pp-wp_wz_qqqq_1600.root”);
TTree* t2 = (TTree*) f2.Get(“dibjet”);
TH1D* h2a = new TH1D(“h2a”, “nhits”, 100, 0, 1500);
TH1D* h2b = new TH1D(“h2b”, “nhits”, 100, 0, 1500);
TH1D* h2c = new TH1D(“h2c”, “nhits”, 100, 0, 1500);
t2->Draw(“jet1_pt>>h2a”, “wt”, “he”);
t2->Draw(“jet1_e>>h2b”, “wt”, “he”);
t2->Draw(“jet1_groosplit12>>h2c”, “wt”, “he”);

TH1D *hpt = new TH1D(“hsum”, “Cut”, 100, 0, 1500);
TH1D *hen = new TH1D(“hen”, “Cut”, 100, 0, 1500);
TH1D *hsplit = new TH1D(“hsplit”, “Cut”, 100, 0, 1500);

Int_t sum_pt = 0;
Int_t sum_en = 0;
Int_t sum_split = 0;

for (Int_t i=1;i<=100;i++) /this is line 34/
{
if (sqrt(h1a->GetBinContent(i)) < h2a->GetBinContent(i)) & (sqrt(h1b->GetBinContent(i)) < h2b->GetBinContent(i)) & (sqrt(h1c->GetBinContent(i)) < h2c->GetBinContent(i))
{
sum_pt = h1a->GetBinContent(i);
sum_en = h2a->GetBinContent(i);
sum_split = h3a->GetBinContent(i);
hpt->SetBinContent(i,sum_pt);
hen->SetBinContent(i,sum_en);
hsplit->SetBinContent(i,sum_split);
}
}

hpt->Draw();
hen->Draw();
hsplit->Draw(); /this is line 49/


ROOT Version: 5.34/36
Platform, compiler: Windows 10


{
  TFile f1("d3pd-ckt12rmd2030pp-pyj4.root");
  // ...
  for (Int_t i=1;i<=100;i++) /*this is line 34*/
    {
      if ( (std::sqrt(h1a->GetBinContent(i)) < h2a->GetBinContent(i)) && (std::sqrt(h1b->GetBinContent(i)) < h2b->GetBinContent(i)) && (std::sqrt(h1c->GetBinContent(i)) < h2c->GetBinContent(i)) )
	{
	  // ...
  // ...
  hsplit->Draw(); /*this is line 49*/
}
1 Like

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