MStatusDisplay *d = new MStatusDisplay; TList list[201]; void Fit(TGraph &g, double rate_start=3e6, double rate_kink=100, double rate_end=10) { double begin = -1; double end = -1; double kinkx = -1; double kinky = 0; TGraph gl; for (int j=0; jSetSelectedPad(0); d->AddTab(tab); gPad->SetGrid(); gPad->SetLogy(); TH1D h0("frame", title, 1000, 0, 1000); h0.SetStats(kFALSE); h0.SetXTitle("Threshold [dac]"); h0.SetYTitle("Trigger rate [Hz]"); h0.SetDirectory(0); h0.SetMaximum(1e8); h0.SetMinimum(0.01); h0.DrawCopy(); } void same(const char *id, const char *fmt, bool fit=true, bool boards=false, bool patches=false) { for (int i=0; i<160; i++) { TGraph *g = (TGraph*)list[i+41].FindObject(id); if (!g) { cout << "==W==> " << id << " not found in i=" << i+41 << endl; return; } g->SetMarkerStyle(kFullDotSmall); g->SetMarkerColor(kGray+1); g->SetLineColor(kGray+1); if (patches) g->DrawClone(fmt); if (g->Eval(400)>10) cout << "Patch " << setw(3) << i << ": C" << i/40 << " B" << (i%40)/4 << " P" << (i%40)%4 << ": " << g->Eval(400) << "Hz @ th=400" << endl; } for (int i=0; i<40; i++) { TGraph *g = (TGraph*)list[i+1].FindObject(id); if (!g) { cout << "==W==> " << id << " not found in i=" << i+1 << endl; return; } g->SetMarkerStyle(kFullDotSmall); g->SetMarkerColor(kGray+2); g->SetLineColor(kGray+2); if (boards) g->DrawClone(fmt); if (g->Eval(400)>10) cout << "Board " << setw(3) << i << ": C" << i/10 << " B" << i%10 << ": " << g->Eval(400) << "Hz @ th=400" << endl; } TGraph *g001 = (TGraph*)list[0].FindObject(id); if (!g001) { cout << "==W==> " << id << " not found in i=0" << endl; return; } g001->SetMarkerStyle(boards||patches?kFullDotMedium:kFullDotSmall); g001->DrawClone(fmt); if (fit) Fit(*g001); } void read(const char *filename) { fits fin(filename); if (!fin) return; cout << '\n' << filename << '\n'; cout << setfill('-') <SetMarkerStyle(kFullDotMedium); g[i]->SetName(name); g[i]->SetTitle(t.GetStringFmt("%H:%M:%S")); list[i].Add(g[i]); } } g[0]->SetPoint(g[0]->GetN(), threshold, Rc/ontime); for (int i=0; i<40; i++) g[i+1]->SetPoint(g[i+1]->GetN(), threshold, Rb[i]); for (int i=0; i<160; i++) g[i+41]->SetPoint(g[i+41]->GetN(), threshold, Rp[i]); } } void ratescan() { cout << setprecision(4); // Read three files read("/loc_data/aux/2012/02/18/20120218.RATE_SCAN_DATA.fits"); read("/loc_data/aux/2012/02/19/20120219.RATE_SCAN_DATA.fits"); read("/loc_data/aux/2012/02/21/20120221.RATE_SCAN_DATA.fits"); // add a new tab plot("0.0V", "Temp control 19.02./22.02. (+0V)"); // Plot a curve, do not fit same("19.02.2012 20:21:26", "LP", false); // plot a curve, fit and plot boards same("22.02.2012 04:19:15", "LP", true, true); // raed another file read("/loc_data/aux/2012/03/25/20120325.RATE_SCAN_DATA.fits"); // add another tab plot("25/03", "Current control 25.03. (+0V)"); // plot curve, fit and plot boards and patches same("26.03.2012 03:01:14", "LP", true, true, true); // plot curve, do not fit, do not draw boards and patches same("26.03.2012 03:21:47", "LP", false); // write result to output file d->SaveAs("/home/tbretz/ratescan.root"); }