8 #include <TGraphErrors.h> 12 #include <TPaveText.h> 17 #include <TMultiGraph.h> 19 #include <TPaveStats.h> 22 #include <TSQLServer.h> 23 #include <TSQLResult.h> 24 #include <TSQLStatement.h> 62 std::vector<float> fMetricVec;
63 std::vector<float> fTimeVec;
70 bool AddHistogram(TFile
const & file, TTree* header,
int Xstrtime,
int Xsrtime,
int XNow,
int GMToffset);
71 TCanvas* makeHistoCanvas(
std::string can_name,
std::string can_title,
int width,
int height, TPaveText* updateText);
81 fHistName = this_hist_name;
82 fOutputName = this_output_name;
83 fMetricVec = std::vector<float>(Npoint, 0);
84 fTimeVec = std::vector<float>(Npoint, 0);
87 fHistogram =
new TH1F(fHistName.c_str(), hist_title.c_str(), num_bins, min_x, max_x);
92 TH1F *hist_temp = (TH1F*)file.FindObjectAny(fHistName.c_str());
94 fHistogram->Add(hist_temp,1.0);
98 if(hist_temp != 0 && header != 0 && Xsrtime != XNow - GMToffset) {
99 fTimeVec.at(fPlotCount) = Xsrtime;
100 if(fRMSPlot) fMetricVec.at(fPlotCount) = hist_temp->GetRMS(1);
101 else fMetricVec.at(fPlotCount) = hist_temp->GetMean(1);
111 TCanvas *can =
new TCanvas(can_name.c_str(), can_title.c_str(), width, height);
114 gStyle->SetOptStat(111111);
115 fHistogram->SetLineWidth(2);
116 fHistogram->SetLineColor(kRed);
123 TCanvas* can =
new TCanvas(can_name.c_str(), can_title.c_str(), width, height);
126 fGraphTime =
new TGraph(fPlotCount);
127 for(
int i=0;i<fPlotCount;i++) fGraphTime->SetPoint(i, fTimeVec.at(i), fMetricVec.at(i));
129 fGraphTime->SetTitle(can_title.c_str());
130 fGraphTime->SetMarkerColor(kBlue);
131 fGraphTime->GetXaxis()->SetTimeDisplay(1);
132 fGraphTime->GetXaxis()->SetLabelSize(0.03);
133 fGraphTime->GetXaxis()->SetTimeFormat(taxis_labels.c_str());
134 fGraphTime->GetXaxis()->SetLimits(time_ago,XNow);
135 fGraphTime->GetXaxis()->SetTitle(
"(central time)");
136 fGraphTime->Draw(
"A*");
141 double max = 0.0, ave = 0.0;
142 TPaveText *LastPoint =
new TPaveText(0.3,0.88,0.93,0.93,
"NDC");
143 LastPoint->SetLineColor(1);
144 LastPoint->SetFillColor(0);
145 LastPoint->SetBorderSize(1);
150 for(
int i = 0; i < fPlotCount; ++i) {
151 ave += (double)fMetricVec.at(i);
152 if(fTimeVec.at(i) > maxtime) {
153 maxtime = fTimeVec.at(i);
154 max = fMetricVec.at(i);
157 if(fPlotCount > 0) ave = ave/(double)fPlotCount;
158 sprintf(lptext,
"Last Point = %f / Average = %f",max,ave);
160 LastPoint->AddText(lptext);
TCanvas * makeHistoCanvas(TPaveText *updateText, int width=1200, int height=800)
TCanvas * makeGraphTimeCanvas(std::string can_name, std::string can_title, int width, int height)
static int max(int a, int b)
NearlinePlot(std::string this_hist_name, NearlinePlotInfo this_plot_info, NearlinePlotEnables this_plot_enable=NearlinePlotEnables(), NearlinePlotLogScale this_plot_log_scale=NearlinePlotLogScale())
bool AddHistogram(TFile const &file, TTree *header, int Xsrtime, int XNow, int GMToffset, int time_ago)