#include "Plotter.h" #include namespace Mask { Plotter::Plotter() : table(new THashTable()) { } Plotter::~Plotter() { for(unsigned int i=0; iFindObject(name); if(h) { h->Fill(val); } else { h = new TH1F(name, title, bins, min, max); h->Fill(val); table->Add(h); } } void Plotter::MyFill(const char* name, const char* title, int binsx, float minx, float maxx, int binsy, float miny, float maxy, double valx, double valy) { TH2F* h = (TH2F*) table->FindObject(name); if(h) { h->Fill(valx, valy); } else { h = new TH2F(name, title, binsx, minx, maxx, binsy, miny, maxy); h->Fill(valx, valy); table->Add(h); } } void Plotter::MyFill(const char* name, const char* title, double valx, double valy, int color) { for(auto& g : graphs) { if(g.name == name) { g.xvec.push_back(valx); g.yvec.push_back(valy); return; } } GraphData new_g; new_g.name = name; new_g.title = title; new_g.xvec.push_back(valx); new_g.yvec.push_back(valy); new_g.color = color; graphs.push_back(new_g); } void Plotter::GenerateGraphs() { for(auto& g : graphs) { TGraph* graph = new TGraph(g.xvec.size(), &(g.xvec[0]), &(g.yvec[0])); graph->SetName(g.name.c_str()); graph->SetTitle(g.title.c_str()); graph->SetMarkerColor(g.color); table->Add(graph); garbage_collection.push_back(graph); } } };