23 # include <TLegendEntry.h> 25 # include <TLinearFitter.h> 30 # include <TParameter.h> 85 return static_cast<TList*
>(o);
114 for (
Int_t i = 1; i <= h->GetNbinsX(); i++) {
118 if (y <= 1e-12)
continue;
119 if (e != 0) w = 1 / (e*e);
122 min = TMath::Min(min, y);
123 max = TMath::Max(max, y);
134 q->
mean = sum / sumw;
135 q->
var = TMath::Sqrt(1/sumw);
149 if (!det)
return false;
155 Warning(
"ProcessEnergyLoss",
"Neither FitResults nor elossResults found");
170 Warning(
"ProcessEnergyLoss",
"Neither status nor elossStatus found");
193 if (!det)
return false;
197 if (!before || !after)
return false;
199 if (before->GetMaximum() > 0) p->SetLogz();
201 if (
fD == 3) p->SetRightMargin(0.15);
203 before->SetTitle(Form(
"FMD%d%c",
fD,
fR));
204 before->Draw(
"colz");
205 after->Draw(
"same box");
207 before->GetXaxis()->SetRangeUser(-.5, 2);
208 before->GetYaxis()->SetRangeUser(-.5, 2);
210 TLatex* ltx =
new TLatex(p->GetLeftMargin()+.01,
211 p->GetBottomMargin()+.01,
214 ltx->SetTextSize(.07);
230 if (!det)
return false;
239 if (!one || !two || !three)
return false;
241 Int_t nOne = one->GetEntries();
242 Int_t nTwo = two->GetEntries();
243 Int_t nThree = three->GetEntries();
244 Int_t total = nOne + nTwo + nThree;
254 one->SetTitle(Form(
"FMD%d%c",
fD,
fR));
255 one->GetXaxis()->SetRangeUser(0, 8);
257 if (one->GetMaximum() > 0) p->SetLogy();
259 if ((p->GetNumber() % 3) != 1) p->SetLeftMargin(.1);
261 one->SetLineStyle(1);
262 two->SetLineStyle(2);
263 three->SetLineStyle(3);
270 Double_t y = 1-p->GetTopMargin()-1.2*gStyle->GetTitleH();
271 Double_t x = p->GetLeftMargin() + .25;
272 TLatex* ltx =
new TLatex(x, y,
"Fraction of ...");
274 ltx->SetTextColor(kBlue+3);
275 ltx->SetTextAlign(13);
277 ltx->SetTextSize(.07);
301 if (!det1)
return false;
304 if (!det2)
return false;
311 if (!before || !after || !presented || !used)
return false;
315 Int_t low = before->GetXaxis()->FindBin(lowCut);
316 Int_t ib =
Int_t(before->Integral(low,before->GetNbinsX()));
317 Int_t ia =
Int_t(after->Integral(low,after->GetNbinsX()));
318 Int_t ip =
Int_t(presented->Integral(low,presented->GetNbinsX()));
319 Int_t iu =
Int_t(used->Integral(low,used->GetNbinsX()));
321 Double_t dba = ib > 0 ? (100.*(ia-ib))/ib : 0;
322 Double_t dbp = ib > 0 ? (100.*(ip-ib))/ib : 0;
323 Double_t dbu = ib > 0 ? (100.*(iu-ib))/ib : 0;
324 Double_t dap = ia > 0 ? (100.*(ip-ia))/ia : 0;
325 Double_t dau = ia > 0 ? (100.*(iu-ia))/ia : 0;
326 Double_t dpu = ip > 0 ? (100.*(iu-ip))/ip : 0;
334 if (before->GetMaximum() > 0) p->SetLogy();
336 before->SetTitle(Form(
"FMD%d%c",
fD,
fR));
338 before->SetLineStyle(1);
339 after->SetLineStyle(2);
340 used->SetLineStyle(3);
344 presented->Draw(
"same");
348 Double_t x = p->GetLeftMargin() + .25;
349 Double_t y = 1-p->GetTopMargin()-gStyle->GetTitleH()+ts;
350 TLatex* ltx =
new TLatex(x, y, Form(
"FMD%d%c",
fD,
fR));
352 ltx->SetTextAlign(13);
353 ltx->SetTextSize(ts);
354 ltx->SetTextColor(kBlue+3);
357 TString inte(Form(
"Integral [%4.2f,#infty]", lowCut));
358 DrawText(ltx, x, y, Form(
"%s before:", inte.Data()), Form(
"%9d", ib));
359 DrawText(ltx, x, y, Form(
"%s after:", inte.Data()), Form(
"%9d", ia));
360 DrawText(ltx, x, y, Form(
"%s input:", inte.Data()), Form(
"%9d", ip));
361 DrawText(ltx, x, y, Form(
"%s user:", inte.Data()), Form(
"%9d", iu));
362 TLine* l =
new TLine;
364 l->DrawLineNDC(x, y-0.9*ts, 1-p->GetRightMargin()-0.01, y-0.9*ts);
365 if (ib != 0 && ia != 0) {
366 DrawText(ltx, x, y,
"Change (merging)", Form(
"%5.1f%%", dba));
367 DrawText(ltx, x, y,
"Change (input)", Form(
"%5.1f%% (%5.1f%%)",
369 DrawText(ltx, x, y,
"Change (use)", Form(
"%5.1f%% (%5.1f%%)",
372 before->GetXaxis()->SetRangeUser(0, 4);
388 if (!det)
return false;
391 if (!occ)
return false;
398 for (
Int_t i = occ->GetNbinsX(); i >= 1; i--) {
400 if (y < 1e-6)
continue;
408 if (occ->GetMaximum() > 0) p->SetLogy();
410 p->SetRightMargin(0.01);
412 occ->SetTitle(Form(
"FMD%d%c",
fD,
fR));
416 Double_t y = 1-p->GetTopMargin()-1.2*gStyle->GetTitleH();
417 Double_t x = p->GetLeftMargin() + .25;
418 TLatex* ltx =
new TLatex(x, y,
"");
420 ltx->SetTextColor(kBlue+3);
421 ltx->SetTextAlign(13);
423 ltx->SetTextSize(.07);
446 if (!det)
return false;
449 if (!co)
return false;
450 TH2* corr =
static_cast<TH2*
>(co);
461 Double_t xmax = corr->GetXaxis()->GetXmax();
463 if (corr->GetEntries() > 0) {
471 Double_t cxy = corr->GetCovariance();
475 if (TMath::Abs(cxy) > 1e-6) {
477 TMath::Sqrt(TMath::Power(sy2-delta*sx2,2) +
478 4*delta*cxy*cxy)) / 2 / cxy);
484 TLinearFitter*
fitter =
new TLinearFitter(1);
485 fitter->SetFormula(
"1 ++ x");
486 for (
Int_t i = 1; i <= corr->GetNbinsX(); i++) {
487 Double_t x = corr->GetXaxis()->GetBinCenter(i);
488 if (x < -1 || x > xmax)
continue;
489 for (
Int_t j = 1; j <= corr->GetNbinsY(); j++) {
490 Double_t y = corr->GetYaxis()->GetBinCenter(j);
491 if (y < -1 || y > xmax)
continue;
493 if (c < .1)
continue;
494 fitter->AddPoint(&x, y, c);
502 Double_t chi2 = fitter->GetChisquare();
503 Int_t ndf = (fitter->GetNpoints() -
504 fitter->GetNumberFreeParameters() );
512 if (corr->GetMaximum() > 0) p->SetLogz();
515 corr->GetXaxis()->SetRangeUser(-1,xmax);
516 corr->GetYaxis()->SetRangeUser(-1,xmax);
517 corr->SetTitle(Form(
"FMD%d%c",
fD,
fR));
520 TF1* f =
new TF1(
"f",
"[0]+[1]*x", xmin, xmax);
526 TLine* l =
new TLine(-1,-1,xmax,xmax);
529 l->SetLineColor(kBlack);
532 Double_t x = p->GetLeftMargin() + .05;
533 Double_t y = 1-p->GetTopMargin()-gStyle->GetTitleH();
534 TLatex* ltx =
new TLatex(x, y,
"Deming regression: y=#alpha+#beta x");
536 ltx->SetTextAlign(13);
537 ltx->SetTextSize(0.06);
538 ltx->SetTextColor(kBlue+3);
545 DrawText(ltx, x, y,
"A:", Form(
"%5.3f#pm%5.3f",
548 DrawText(ltx, x, y,
"B:", Form(
"%5.3f#pm%5.3f",
571 :
QABase(
"data", (prodYear < 2000 ? 2000 : 0) + prodYear,
572 Form(
"LHC%02d%c", (prodYear%2000), prodLetter),
"pass0"),
604 :
QABase(dataType, prodYear, period, pass),
656 fFiles.Add(
new TObjString(filename));
669 while ((o = next())) {
691 std::ofstream doc(
".doc");
706 Error(
"ProcessOne",
"Failed to open %s", filename);
725 const char* subs[] = {
"",
727 "trending_barrel.root",
729 const char** psub = subs;
733 if ((*psub)[0] !=
'\0') {
734 Int_t hash = fn.Index(
"#");
736 fn.Replace(hash+1,fn.Length()-hash-1,*psub);
741 Info(
"ProcessOne",
"Trying %s", fn.Data());
744 Info(
"ProcessOne",
"No success, try the next");
747 if (!ret)
return false;
750 Error(
"ProcessOne",
"Failed to get global stuff from %s", filename);
756 title.Form(
"QA plots for %s/%s run %ld (%s)",
767 return eloss && merge && dense;
778 if (!oRun)
return false;
784 if (!oAcc)
return false;
800 TList* l = stack->GetHists();
801 if (!l || l->GetEntries() <= 0) {
802 Warning(
"CleanStack",
"No histograms in stack %s", stack->GetName());
813 TObjLink* lnk = l->FirstLink();
817 if (s.Contains(what)) {
818 TObjLink* keep = lnk->Next();
844 if (!chi2)
return false;
845 if (!c)
return false;
846 if (!delta)
return false;
847 if (!xi)
return false;
848 if (!sigma)
return false;
854 THStack* stacks[] = { chi2,
c, delta, xi,
sigma, 0 };
855 for (
int i = 0; i < 5; i++) {
856 THStack*
stack = stacks[i];
857 if (!stack->GetHists() || stack->GetHists()->GetEntries() < 0) {
858 Warning(
"",
"No histograms in stack %s", stack->GetName());
861 TVirtualPad* p =
GetPad(i+1);
864 p->SetLeftMargin(.6/nL);
865 p->SetTopMargin(.01);
866 p->SetRightMargin(.01);
870 stack->Draw(
"nostack");
871 stack->GetHistogram()->SetYTitle(stack->GetTitle());
872 stack->GetHistogram()->SetXTitle(
"#eta");
874 TAxis* yaxis = stack->GetHistogram()->GetYaxis();
875 if (i == 0) yaxis->SetRangeUser(0,20);
876 if (i == 1) stack->SetMaximum(1);
877 if (i == 2) stack->SetMaximum(1);
878 if (i == 3) stack->SetMaximum(0.1);
879 if (i == 4) stack->SetMaximum(0.5);
881 yaxis->SetTitleSize(0.3/nL);
882 yaxis->SetLabelSize(0.08);
883 yaxis->SetTitleOffset(3/nL);
884 yaxis->SetNdivisions(5);
885 yaxis->SetTitleFont(42);
886 yaxis->SetLabelFont(42);
887 yaxis->SetDecimals();
889 TAxis* xaxis = stack->GetHistogram()->GetXaxis();
890 xaxis->SetTitleSize(0.3/nL);
891 xaxis->SetLabelSize(0.08);
892 xaxis->SetTitleOffset(2./nL);
893 xaxis->SetNdivisions(10);
894 xaxis->SetTitleFont(42);
895 xaxis->SetLabelFont(42);
896 xaxis->SetDecimals();
898 stack->Draw(
"nostack");
901 TVirtualPad* p =
GetPad(6);
902 p->SetFillColor(kWhite);
905 TLatex* l =
new TLatex(x, y,
"Fits to #Delta (energy loss) spectra");
906 l->SetTextColor(kBlue+3);
910 y -= 2 * 1.2*l->GetTextSize();
911 l->DrawLatex(x, y,
"F(#Delta;c,#Delta_{p},#xi,#sigma)=" 912 "#frac{c}{#sqrt{2#pi}#sigma}#int_{-#infty}^{#infty}d#Delta'" 913 "L(#Delta;#Delta',#xi) G(#Delta_{p};#Delta',#sigma^{2})");
914 y -= 1.2*l->GetTextSize();
916 DrawText(l, x, y,
"#chi^{2}/#nu",
"Goodness of fit", .2);
917 DrawText(l, x, y,
"c",
"Overall constant", .2);
918 DrawText(l, x, y,
"#Delta_{p}",
"Most probable value", .2);
919 DrawText(l, x, y,
"#xi",
"'Width' of Landau (L)", .2);
920 DrawText(l, x, y,
"#sigma",
"'Width' of Gaussian (G)", .2);
946 for (
Int_t i = 1; i <= 6; i++) {
947 TVirtualPad* p =
GetPad(i);
956 p->SetFillColor(kWhite);
958 TLatex* l =
new TLatex(.2, .7,
"Gradient: before merging");
960 l->SetTextColor(kBlue+3);
962 l->DrawText(.2, .6,
"Boxes: after merging");
971 for (
Int_t i = 1; i <= 6; i++) {
980 TLegend* ll =
new TLegend(.2, .2, .8, .8);
982 ll->SetBorderSize(0);
983 TLegendEntry* e = ll->AddEntry(
"dummy",
"Singles",
"l");
985 e = ll->AddEntry(
"dummy",
"Doubles",
"l");
987 e = ll->AddEntry(
"dummy",
"Triples",
"l");
1006 for (
Int_t i = 1; i <= 6; i++) {
1007 TVirtualPad* p =
GetPad(i);
1016 TLegend* ll =
new TLegend(.2, .2, .8, .8);
1017 ll->SetFillColor(0);
1018 ll->SetBorderSize(0);
1019 TLegendEntry* e = ll->AddEntry(
"dummy",
"From ESDs",
"l");
1021 e = ll->AddEntry(
"dummy",
"After Merging",
"l");
1023 e = ll->AddEntry(
"dummy",
"Used",
"l");
1033 for (
Int_t i = 1; i <= 6; i++) {
1042 TLatex* ltx =
new TLatex(.2, .8,
"Calculated assuming Poisson stat.");
1044 ltx->SetTextColor(kBlue+3);
1050 ltx->DrawLatex(.2, .7, Form(
"Regions of %s strips #times %s sectors",
1051 etaL->GetTitle(), phiL->GetTitle()));
1059 for (
Int_t i = 1; i <= 6; i++) {
1068 TLatex* ltx =
new TLatex(.2, .8,
"Correlation of N_{ch} methods");
1070 ltx->SetTextColor(kBlue+3);
1072 ltx->DrawLatex(.24, .7,
"From #DeltaE fits along x");
1073 ltx->DrawLatex(.24, .6,
"From Poisson assumption along y");
1074 ltx->DrawLatex(.24, .4,
"Solid line: regression");
1075 ltx->DrawLatex(.24, .3,
"Dashed line: x=y to guide the eye");
1109 const char* lbUrl =
"https://alice-logbook.cern.ch/logbook/date_online.php";
1110 const char* crUrl =
"http://alimonitor.cern.ch/configuration/index.jsp";
1111 const char* rpUrl =
"http://alimonitor.cern.ch/runview/?run=";
1115 if (!
gSystem->AccessPathName(
"QAresults.root"))
1116 results = TFile::Open(
"QAresults.root",
"READ");
1118 *
fHtml <<
"<h3>QA results</h3>\n" 1120 <<
"<li><a href='QAresults.root'>ROOT file</a></li>\n" 1126 *
fHtml <<
"<h3>External links</h3>\n" 1128 <<
" <li><a target='_blank' href='" << lbUrl
1130 <<
"&p_tab=dqm&p_dqmagent=FMDQAshifter'>DQM plots</a>" 1131 <<
" (restricted)</li>\n" 1132 <<
" <li><a target='_blank' href='" << crUrl
1136 *
fHtml <<
"'>Condition Table</a></li>\n" 1137 <<
" <li><a target='_blank' href='" << rpUrl <<
fGlobal->
runNo 1138 <<
"'>Processing Details</a></li>\n" 1139 <<
"</ul>" << std::endl;
1153 case 1: r =
fFMD1i;
break;
1154 case 2: r =
fFMD2i;
break;
1155 case 3: r =
fFMD3i;
break;
1156 case 5: r =
fFMD2o;
break;
1157 case 6: r =
fFMD3o;
break;
1159 if (r)
return static_cast<Ring*
>(r);
1172 TVirtualPad* p =
fCanvas->cd(padNo);
1175 p->SetFillColor(kWhite);
1205 TList* tmp =
static_cast<TList*
>(parent->FindObject(name));
1208 Error(
"GetSubLists",
"List %s not found in %s", name,
1224 const char* folder =
"ForwardResults";
1227 const char* folder2 =
"ForwardQAResults";
1230 const char* folder3 =
"forwardQAResults";
1234 Error(
"GetLists",
"List %s/%s/%s not found in %s",
1243 const char* sfolder =
"ForwardSums";
1272 if (!list)
return 0;
1273 TObject* o = list->FindObject(name);
1276 Error(
"GetObject",
"Failed to find object %s in %s",
1277 name, list->GetName());
1294 return static_cast<TH1*
>(
GetObject(list, name, verbose));
1310 y -= 1.2*l->GetTextSize();
1311 l->DrawLatex(x, y, c1);
1312 l->DrawLatex(x+dx, y, c2);
virtual void WriteLinks()
TList * fDensityCalculator
static void DrawText(TLatex *l, Double_t x, Double_t &y, const char *c1, const char *c2, Double_t dx=.4)
Bool_t ProcessEnergyLoss(const TList *parent)
static TH1 * GetHistogram(const TList *list, const char *name, Bool_t verbose=true)
void CleanStack(THStack *stack, const char *what)
Bool_t ProcessDensityCalculator()
QATrender operator=(const QATrender &)
static TObject * GetObject(const TList *list, const char *name, Bool_t verbose=true)
QATrender(Bool_t keep, Bool_t, Int_t prodYear, char prodLetter)
Bool_t GetLists(Bool_t verbose=true)
void Close(bool deletePNGs=true)
QATrender(Bool_t keep, const TString &dataType, Int_t prodYear, const TString &period, const TString &pass, Long_t runNo)
void PrintCanvas(const char *pngName, UInt_t)
Bool_t ProcessELossFitter()
void CanvasTitle(const char *title)
TList * GetDetectorList(const TList *parent) const
Bool_t GetInputLists(const char *filename)
QATrender(const QATrender &o)
Bool_t ExtractYQuantity(const TList *parent, const char *name, Quantity *q)
const char * OutputName() const
static TList * GetSubList(const TList *parent, const char *name, Bool_t verbose=true)
Ring(UShort_t d, Char_t r)
Bool_t ProcessOne(const char *filename)
Base class for QA active classes.
Bool_t ProcessCorrelation(const TList *parent, TVirtualPad *p)
Bool_t Init(TTree *tree, bool read=false)
void MakeCanvasTitle(const char *what)
virtual void WriteLinks()
Ring * GetRing(Int_t padNo)
Bool_t Process123(const TList *parent, TVirtualPad *p)
RingQuantity * fOccupancy
Bool_t ProcessELoss(TList *p1, TList *p2, TVirtualPad *p)
Bool_t ProcessOccupancy(const TList *parent, TVirtualPad *p)
Data structures used in QA trending tree.
Bool_t ProcessNeighbors(const TList *parent, TVirtualPad *p)
void MakeCanvas(const char *title)
Bool_t ProcessSharingFilter()
TVirtualPad * GetPad(Int_t padNo)
void AddFile(const char *filename)
Correlation * fCorrelation