void DrawEmpirical(const char* filename="Empirical.root", Bool_t fmd=true) { gStyle->SetOptTitle(0); TFile* file = TFile::Open(filename, "READ"); if (!file) return; Double_t yr = 0.3; TCanvas* c = new TCanvas("c","c", 1000,1000); TPad* p1 = new TPad("p1","p1",0,0,1,yr); TPad* p2 = new TPad("p2","p2",0,yr,1,1); c->cd(); p1->Draw(); c->cd(); p2->Draw(); gDirectory->cd("Forward"); THStack* r = DrawOne(p1, yr, false, gDirectory, "ratios"); THStack* e = DrawOne(p2, yr, true, gDirectory, "empirical"); r->SetMinimum(0.945); r->SetMaximum(1.055); r->GetXaxis()->SetTitle("#it{#eta}"); r->GetYaxis()->SetTitle("Ratio to mean"); e->SetMinimum(0.005); e->GetYaxis()->SetTitle("#it{E_{c}}(#it{#eta})"); TIter nextE(e->GetHists()); TIter nextR(r->GetHists()); TH1* hist = 0; Color_t cols[] = { kRed+2, kGreen+2, kBlue+2, kMagenta+2, 0 }; Color_t *ptr = cols; Style_t stys[] = { 20, 21, 22, 23 }; Style_t* sty = stys; while (*ptr) { hist = static_cast<TH1*>(nextE()); hist->SetMarkerColor(*ptr); hist->SetMarkerSize(2); hist->SetMarkerStyle(*sty); hist = static_cast<TH1*>(nextR()); hist->SetMarkerColor(*ptr); hist->SetMarkerSize(2); hist->SetMarkerStyle(*sty); ptr++; sty++; } TLegend* l = p2->BuildLegend(0.35, .2, .65, .8); l->SetFillColor(0); l->SetFillStyle(0); l->SetBorderSize(0); c->Modified(); c->Update(); c->cd(); c->Print("empirical.png"); }
static void process_chat(struct chatctx* ctx, xmlNode* chat) { // one table per chat block xmlNode* table = xmlNewNode(chat->ns,"table"); xmlSetProp(table, "class","chat"); ctx->dest = table; ctx->odd = true; xmlNode* p = chat->children; while(p) { p = nextE(p); if(!p) break; process_paragraph(ctx, p); // paragraph is cleaned out, but next ps should be there. p = p->next; } // okay, done. replace the destroyed chat tag with our table. xmlAddNextSibling(chat,table); xmlUnlinkNode(chat); xmlFreeNode(chat); }