15 # include <TGraphErrors.h>
16 # include <TGraphAsymmErrors.h>
17 # include <TMultiGraph.h>
106 return ((d == 1 ? kRed : (d == 2 ? kGreen : kBlue))
107 + ((r ==
'I' || r ==
'i') ? 2 : -3));
118 g->SetName(Form(
"FMD%d%c_%s",
fD,
fR, name));
121 Int_t marker = 20+(
fD-1) + (
fR ==
'I' ? 0 : 4);
122 g->SetTitle(Form(
"FMD%d%c",
fD,
fR));
125 g->SetMarkerColor(c);
126 g->SetMarkerStyle(marker);
129 case 20: g->SetMarkerSize(1.2);
break;
130 case 21: g->SetMarkerSize(1.2);
break;
131 case 22: g->SetMarkerSize(1.3);
break;
132 case 26: g->SetMarkerSize(1.1);
break;
153 if (TMath::Abs(y) < 1e-6)
return;
155 g->SetPoint(i, runNo, y);
156 g->SetPointError(i, 0, 0, el, eh);
206 :
QABase(
"", (prodYear < 2000 ? 2000 : 0) + prodYear,
207 Form(
"LHC%02d%c", int(prodYear % 100), prodLetter),
"pass0"),
212 Info(
"QAPlotter",
"Do we use variance? %s",
fUseVar ?
"yes" :
"no");
225 fVz->SetMarkerStyle(20);
226 fVz->SetLineWidth(2);
236 :
QABase(dataType, year, period, pass),
241 Info(
"QAPlotter",
"Do we use variance? %s",
fUseVar ?
"yes" :
"no");
254 fVz->SetMarkerStyle(20);
255 fVz->SetLineWidth(2);
264 fFiles.Add(
new TObjString(filename));
269 Warning(
"GetUserInfo",
"No user information list");
273 TObject* o = l->FindObject(name);
275 Warning(
"GetUserInfo",
"User information %s not found", name);
280 Info(
"GetUserInfo",
"Got user information %s=%s", name, o->GetTitle());
281 return o->GetTitle();
293 if (
fFiles.GetEntriesFast() == 1 && read) {
294 TFile*
file = TFile::Open(
fFiles.At(0)->GetName(),
"READ");
301 if (!chain->AddFileInfoList(&
fFiles))
return false;
316 Error(
"Run",
"No input tree");
325 Info(
"Run",
"Got %d runs", nEntries);
332 for (
UInt_t i = 0; i < nEntries; i++) {
342 Info(
"Run",
"Got run %d with %d accepted events", run, nev);
347 if (nev <= 100)
continue;
367 title.Form(
"QA trends for %s/%s runs %d --- %d",
370 title.Form(
"QA trends for runs %d --- %d",
fFirst,
fLast);
379 l->SetLineColor(kRed+2);
390 TMultiGraph* chi2 =
new TMultiGraph;
391 TMultiGraph*
c =
new TMultiGraph;
392 TMultiGraph* delta =
new TMultiGraph;
393 TMultiGraph* xi =
new TMultiGraph;
394 TMultiGraph*
sigma =
new TMultiGraph;
395 TMultiGraph* low =
new TMultiGraph;
396 TMultiGraph* singles =
new TMultiGraph;
397 TMultiGraph* loss =
new TMultiGraph;
398 TMultiGraph* occ =
new TMultiGraph;
399 TMultiGraph* beta =
new TMultiGraph;
400 chi2 ->SetName(
"chi2");
402 delta ->SetName(
"delta");
404 sigma ->SetName(
"sigma");
405 low ->SetName(
"low");
406 singles ->SetName(
"singles");
407 loss ->SetName(
"loss");
408 beta ->SetName(
"beta");
409 occ ->SetName(
"occupancy");
412 AddToMulti(
fFMD1i,chi2, c, delta, xi, sigma, low, singles, loss, beta, occ);
413 AddToMulti(
fFMD2i,chi2, c, delta, xi, sigma, low, singles, loss, beta, occ);
414 AddToMulti(
fFMD2o,chi2, c, delta, xi, sigma, low, singles, loss, beta, occ);
415 AddToMulti(
fFMD3i,chi2, c, delta, xi, sigma, low, singles, loss, beta, occ);
416 AddToMulti(
fFMD3o,chi2, c, delta, xi, sigma, low, singles, loss, beta, occ);
418 PlotMulti(chi2,
"#LT#chi^{2}/#nu#GT from #Delta fits",
true);
419 PlotMulti(c,
"#LTc#GT from #Delta fits");
420 PlotMulti(delta,
"#LT#Delta_{p}#GT from #Delta fits");
421 PlotMulti(xi,
"#LT#xi#GT from #Delta fits");
422 PlotMulti(sigma,
"#LT#sigma#GT from #Delta fits");
423 PlotMulti(low,
"Bins with too low statistics");
424 PlotMulti(singles,
"Fraction of single hits");
425 PlotMulti(loss,
"% of hits 'lost' due to merging+cuts");
426 PlotMulti(occ,
"#LTOccupancy#GT [%]",
true);
427 PlotMulti(beta,
"Correlation of methods");
441 std::ofstream doc(
".doc");
470 TMultiGraph* singles,
473 TMultiGraph* occupancy)
504 TH1* h = mg->GetHistogram();
507 if (h->GetMinimum() == 0) {
508 min = min - .1*(max-min);
511 Int_t x1 = h->GetXaxis()->GetXmin();
512 Int_t x2 = h->GetXaxis()->GetXmax();
514 TLegend* l =
new TLegend(.1, .91, .97, .95);
520 TIter next(mg->GetListOfGraphs());
521 mg->GetListOfGraphs();
528 while ((g = static_cast<TGraph*>(next()))) {
529 l->AddEntry(g, g->GetTitle(),
"lp");
532 for (
Int_t i = 0; i < n; i++) {
534 runs.SetAt(xs[i], j++);
538 TLine* lm =
new TLine(x1, ymean, xh, ymean);
539 lm->SetLineColor(g->GetLineColor());
543 TLatex* al =
new TLatex(xh, ymean, g->GetTitle());
544 al->SetTextColor(g->GetLineColor());
546 al->SetTextSize(.02);
547 al->SetTextAlign(12);
554 AddRuns(h, title, &runs, &areas);
568 std::sort(&(runs.fArray[0]), &(runs.fArray[runs.GetSize()]));
569 Int_t idx = TMath::BinarySearch(runs.GetSize(), runs.fArray, run);
570 if (idx >= runs.GetSize() || idx < 0 || runs[idx] != run)
return -1;
584 h->GetXaxis()->SetNoExponent();
587 if (
fUseVar) ytitle.Append(
" (errors: variance)");
588 else ytitle.Append(
" (errors: min/max)");
589 h->SetYTitle(ytitle.Data());
590 h->SetXTitle(
"Run #");
594 Int_t r1 = h->GetXaxis()->GetXmin();
595 Int_t r2 = h->GetXaxis()->GetXmax();
606 if (r < r1 || r > r2)
continue;
616 if (TMath::Abs(x - lx) < tx) y += dy;
617 else y =
fCanvas->GetBottomMargin() + dy;
627 Color_t
color = kBlue+3;
628 if (idx >= 0 && idx < na && r == xa[idx] &&
632 TLatex* ll =
new TLatex(x, y, Form(
"%d", r));
634 ll->SetTextAlign(21);
635 ll->SetTextSize(0.02);
636 ll->SetTextColor(color);
640 TLine* tl =
new TLine(x, y, x, 1-
fCanvas->GetTopMargin());
641 tl->SetBit(TLine::kLineNDC);
643 tl->SetLineColor(color);
646 if (!areas)
continue;
648 TObjString* area =
new TObjString;
649 TString& spec = area->String();
650 spec.Form(
"<span style=\"left: %d%%; bottom: %d%%;\" "
651 "onClick='window.location=\"%09d/index.html\"' "
652 "onMouseOver='this.style.cursor=\"pointer\"' "
658 spec.Form(
"<area shape='rect' alt='%d' title='%d' href='qa_%09d.html' "
659 "coords='%d,%d,%d,%d'>", r, r, r,
672 o <<
"<div class='jobid'><!--JOBID--></div>\n"
673 <<
"<div class='runs'>\n"
676 o <<
"<a href='" << Form(
"%09d",
fRuns[i]) <<
"/index.html'>"
677 <<
fRuns[i] <<
"</a> " << std::flush;
680 <<
"</div>" << std::endl;
Int_t color[]
print message on plot with ok/not ok
Ring(UShort_t d, Char_t r, Bool_t useVar=false)
QAPlotter(const TString &dataType, Int_t year, const TString &period, const TString &pass, Bool_t useVar=true)
static Color_t RingColor(UShort_t d, Char_t r)
Int_t FindRun(const TArrayI &runs, Int_t run)
const char * GetUserInfo(TList *l, const char *name, const char *def) const
TGraphAsymmErrors * fGDelta
void AddFile(const char *filename)
void Close(bool deletePNGs=true)
void PrintCanvas(const char *pngName, UInt_t)
Bool_t Update(UInt_t n, UInt_t runNo)
TGraphAsymmErrors * fGSigma
Bool_t MakeTree(bool read)
void CanvasTitle(const char *title)
TGraphAsymmErrors * fGOccupancy
void PlotMulti(TMultiGraph *mg, const char *title, Bool_t logy=false)
void WriteRuns(std::ostream &o)
Base class for QA active classes.
TGraphAsymmErrors * fGChi2
QAPlotter(Long_t prodYear, Char_t prodLetter, Bool_t useVar)
void WriteImageFooter(std::ostream &o, const char *pngName)
virtual void WriteFooter()
void AddRuns(TH1 *h, const char *title, TArrayI *runs=0, TList *areas=0)
virtual void WriteImageFooter(std::ostream &o, const char *)
void PutCanvasTitle(const char *title)
virtual Bool_t MakeTree(bool read)
RingQuantity * fOccupancy
void UpdateGraph(TGraphAsymmErrors *g, RingQuantity &q, UInt_t runNo, UInt_t)
void SetAtt(TGraph *g, const char *name, const char *)
Bool_t Init(bool read=false)
TFile * file
TList with histograms for a given trigger.
void AddToMulti(QARing *qr, TMultiGraph *chi2, TMultiGraph *c, TMultiGraph *delta, TMultiGraph *xi, TMultiGraph *sigma, TMultiGraph *low, TMultiGraph *singles, TMultiGraph *loss, TMultiGraph *beta, TMultiGraph *occupancy)
void MakeCanvas(const char *title)
Correlation * fCorrelation