C Error: Expected Unqualified-id Before '{' Token -
C Error: Expected Unqualified-id Before '{' Token -
what i'm inputting: gcc -o plot plot_na22.c.
what i'm getting: plot_na22.c:1: error: expected unqualified-id before '{' token.
i have no clue i'm doing. else's code , don't know why it's not working. advice?
{ // root style junk gstyle->setoptstat(0); gstyle->settitlefont(132, "xyz"); gstyle->setlabelfont(132, "xyz"); // constants binning double qmin = 0.0; double qmax = 500.0; int qbins = 250; double fmin = 0.0; double fmax = 1.0; int fbins = 200; double rscale = 435.0; double rmin = 0.0; double rmax = pow(435.0 / rscale, 3); int rbins = 200; // 1d charge, fprompt, , scaled centroid histograms th1d* hq = new th1d("hq", "", qbins, qmin, qmax); hq->setlinecolor(4); hq->setxtitle("charge (pe)"); th1d* hf = new th1d("hf", "", fbins, fmin, fmax); hf->setlinecolor(4); hf->setxtitle("f_{p}"); th1d* hr = new th1d("hr", "", rbins, pow(rmin/rscale, 3), rmax); hr->setlinecolor(4); hr->setxtitle("(r / r_{tpb})^{3}"); // 1d reconstructed coordinate histograms th1d* hx = new th1d("hx", "", rbins, -rscale, rscale); hx->setlinecolor(4); hx->setxtitle("position (mm)"); th1d* hy = new th1d("hy", "", rbins, -rscale, rscale); hy->setlinecolor(2); hy->setxtitle("position (mm)"); th1d* hz = new th1d("hz", "", rbins, -rscale, rscale); hz->setlinecolor(3); hz->setxtitle("position (mmm)"); // 2d histograms th2d* hfq = new th2d("hfq", "", qbins, qmin, qmax, fbins, fmin, fmax); hfq->setmarkercolor(4); hfq->setmarkerstyle(20); hfq->setmarkersize(0.3); hfq->setxtitle("charge (pe)"); hfq->setytitle("f_{p}"); th2d* hfr = new th2d("hfr", "", rbins, rmin, rmax, fbins, fmin, fmax); hfr->setmarkercolor(4); hfr->setmarkerstyle(20); hfr->setmarkersize(0.3); hfr->setxtitle("(r / r_{tpb})^{3}"); hfr->setytitle("f_{p}"); th2d* hqr = new th2d("hqr", "", qbins, qmin, qmax, rbins, rmin, rmax); hqr->setmarkercolor(4); hqr->setmarkerstyle(20); hqr->setmarkersize(0.3); hqr->setxtitle("charge (pe)"); hqr->setytitle("(r / r_{tpb})^{3}"); th2d* hang = new th2d("hang", "", rbins/2, -tmath::pi(), tmath::pi(), rbins/2, -1.0,1.0); hang->setmarkerstyle(20); hang->setmarkersize(0.2); hang->setmarkercolor(4); hang->setxtitle("#phi"); hang->setytitle("cos(#theta)"); // create tchain simulated info tchain* tree = new tchain("t", "t"); tree->add("/home/benjiang/fuck/realdata_*.root"); rat::ds::root* ds = new rat::ds::root(); tree->setbranchaddress("ds", &ds); // count number of triggers int ntriggers = 0; // begin reading events for(int iev=0; iev<tree->getentries(); iev++){ if(iev % 10000 == 0) printf("event %i\t of %i\t%i triggers\n", iev, tree->getentries(), ntriggers); tree->getevent(iev); // ignore event if there wasn't event trigger if(ds->getevcount() != 1) continue; rat::ds::ev* ev = ds->getev(0); ntriggers ++; // ignore event if info quality cutting failed reason if(!ev->getpassallcuts()) continue; // values info construction double q = ev->getqpe(); double f = ev->getfprompt(); tvector3 v = ev->getcentroid()->getposition(); double r = pow(v.mag() / rscale, 3.0); // fill histograms hq->fill(q); hr->fill(r); hf->fill(f); hx->fill(v.x()); hy->fill(v.y()); hz->fill(v.z()); hfq->fill(q, f); hfr->fill(r, f); hqr->fill(q, r); hang->fill(v.phi(), tmath::cos(v.theta())); }; // legend 1d coordinate histograms tlegend* plegend = new tlegend(0.6, 0.6, 0.8, 0.8); plegend->setlinecolor(0); plegend->setfillcolor(0); plegend->addentry(hx, "#font[132]{x}", "l"); plegend->addentry(hy, "#font[132]{y}", "l"); plegend->addentry(hz, "#font[132]{z}", "l"); // canvases draw histograms tcanvas* c0 = new tcanvas("c0", "", 0, 0, 1400, 1200); c0->divide(3, 2); c0->cd(1); hq->draw(); c0->cd(2); hf->draw(); c0->cd(3); hr->draw(); c0->cd(4); hfq->draw("colz"); c0->cd(5); hfr->draw("colz"); c0->cd(6); hqr->draw("colz"); c0->update(); tcanvas* c2 = new tcanvas("c2", "", 0, 0, 1400, 600); c2->divide(2, 1); c2->cd(1); hx->draw(); hy->draw("same"); hz->draw("same"); plegend->draw(); c2->cd(2); hang->draw("colz"); c2->update(); // write histograms , canvases root file tfile* outfile = new tfile("plot_na22.root", "recreate"); outfile->cd(); c0->write(); c2->write(); hq->write(); hf->write(); hr->write(); hfq->write(); hfr->write(); hqr->write(); hx->write(); hy->write(); hz->write(); hang->write(); outfile->close(); }
it looks have c file meant root. can't compile on own gcc. i'm unfamiliar root, seek this.
root plot_na22.c c
Comments
Post a Comment