135 Error(
"MakeTree",
"Failed to open output file");
141 Error(
"MakeTree",
"No tree defined!");
183 gSystem->Exec(Form(
"rm -f %s.tex %s.html %s.root %s.pdf",
184 base, base, base, base));
186 fTeX =
new std::ofstream(Form(
"%s.tex", base));
187 fHtml =
new std::ofstream(Form(
"%s.html", base));
190 texTitle.ReplaceAll(
"_",
"-");
192 *
fTeX <<
"\\documentclass[landscape,a4paper,12pt]{article}\n"
194 <<
"\\usepackage[margin=2cm,a4paper]{geometry}\n"
195 <<
"\\usepackage{graphicx}\n"
196 <<
"\\title{{\\Huge\\bf " << texTitle <<
"}}\n"
197 <<
"\\author{{\\LARGE FMD Team}}\n"
198 <<
"\\date{{\\Large \\today}}\n"
199 <<
"\\begin{document}\n"
200 <<
"\\thispagestyle{empty}\n"
201 <<
"\\maketitle" << std::endl;
203 *
fHtml <<
"<!DOCTYPE html>\n"
206 <<
" <title>QA information - " << title <<
"</title>\n"
207 <<
" <link rel='stylesheet' href='style.css'>\n"
208 <<
" <link rel='shortcut icon' href='fmd_favicon.png' "
209 <<
"type='image/x-png'>\n"
211 <<
" function browseRootFile(file) {\n"
212 <<
" var o = document.location.origin;\n"
214 <<
" if (b.search(/aliqafmd.web.cern.ch/)) b += '/aliqafmd/';\n"
215 <<
" b += 'jsRoot/';\n"
216 <<
" var p = o + document.location.pathname;\n"
217 <<
" p=p.replace(/" << base <<
".html/,'');\n"
218 <<
" if (p[p.lenght-1] != '/') p += '/';\n"
219 <<
" var u=encodeURIComponent(p+file)+'&menu=no';\n"
220 <<
" window.open(b + '?url=' + u, '_blank',\n"
221 <<
" 'location=no,menubar=no,status=no,titlebar=no');\n"
226 <<
" <h1>" << title <<
"</h1>\n"
230 gStyle->SetPalette(1);
231 gStyle->SetOptFit(0);
232 gStyle->SetOptStat(0);
233 gStyle->SetOptTitle(1);
234 gStyle->SetTitleW(.4);
235 gStyle->SetTitleH(.1);
237 gStyle->SetTitleStyle(0);
238 gStyle->SetTitleBorderSize(0);
239 gStyle->SetTitleX(.6);
241 fCanvas =
new TCanvas(
"qa", title, 900, 700);
248 fCanvas->SetBottomMargin(0.10);
250 fStore = TFile::Open(Form(
"%s.root",
fTeXName.Data()),
"RECREATE");
252 Warning(
"MakeCanvas",
"Failed to make store %s.root",
fTeXName.Data());
272 fCanvas->SetBottomMargin(0.10);
274 *
fTeX <<
"\\clearpage\n"
275 <<
"%% -----------------------------------------------------"
279 tit.ReplaceAll(
"#LT",
"<");
280 tit.ReplaceAll(
"#GT",
">");
281 tit.ReplaceAll(
"#Delta",
"Δ");
282 tit.ReplaceAll(
"#xi",
"ξ");
283 tit.ReplaceAll(
"#sigma",
"σ");
284 tit.ReplaceAll(
"#chi",
"χ");
285 tit.ReplaceAll(
"#nu",
"ν");
286 tit.ReplaceAll(
"_{p}",
"<sub>p</sub>");
287 tit.ReplaceAll(
"_{z}",
"<sub>z</sub>");
288 tit.ReplaceAll(
"^{2}",
"<sup>2</sup>");
289 *
fHtml <<
"<tr><td>" << tit <<
"</td>" << std::flush;
301 TLatex* topText =
new TLatex(.5, .99, title);
302 topText->SetTextAlign(23);
303 topText->SetTextSize(.038);
304 topText->SetTextFont(42);
305 topText->SetTextColor(kBlue+3);
329 gSystem->Exec(Form(
"rm -f %s.png %s.html", pngName, pngName));
330 fCanvas->SaveAs(Form(
"%s.png", pngName));
331 *
fTeX <<
"\\begin{center}\n"
332 <<
"\\includegraphics[keepaspectratio,height=\\textheight]{"
334 <<
"\\end{center}" << std::endl;
335 *
fHtml <<
"<td><a href='" << pngName <<
".html'>Plot</a></td></tr>"
338 std::ofstream img(Form(
"%s.html", pngName));
339 img <<
"<!DOCTYPE html>\n"
342 <<
" <title>" << pngName <<
"</title>\n"
343 <<
" <link rel='stylesheet' href='style.css'></link>\n"
344 <<
" <link rel='shortcut icon' href='fmd_favicon.png' "
345 <<
"type='image/x-png'>\n"
348 <<
" <h1>" << pngName <<
"</h1>\n"
349 <<
" <div id=\"imap\">\n"
350 <<
" <img src=\"" << pngName <<
".png\">\n";
355 img <<
" " << o->GetName() <<
"\n";
357 img <<
" </div>\n" << std::endl;
360 <<
"</html>" << std::endl;
362 gSystem->Exec(Form(
"chmod g+rw %s.html", pngName));
364 fToDelete.Append(Form(
" %s.png", pngName));
365 TDirectory* d = gDirectory;
378 o <<
"<div class='back'>\n"
379 <<
"<a href='" <<
fTeXName <<
".html'>Back</a>\n"
381 <<
"<div class='change'>\n"
382 <<
" Last update: " << now.AsString() <<
"\n"
383 <<
"</div>" << std::endl;
395 *
fTeX <<
"\\end{document}\n"
396 <<
"%% EOF" << std::endl;
400 gSystem->Exec(Form(
"pdflatex %s.tex > /dev/null 2>&1", base));
401 Info(
"Close",
"PDF file %s.pdf generated", base);
405 *
fHtml <<
"</table>" << std::endl;
408 *
fHtml <<
"</body></html>" << std::endl;
418 TString cmd(Form(
"rm -f %s.log %s.aux %s.tex %s",
422 gSystem->Exec(Form(
"chmod g+rw %s.pdf %s", base,
431 const char* jsRoot =
"http://cern.ch/aliqafmd/jsRoot/";
432 *
fHtml <<
"<h3>Collection of plots</h3>\n"
434 <<
" <li><a href='" <<
fTeXName <<
".pdf'>PDF</a></li>\n"
435 <<
" <li><a href='" <<
fTeXName <<
".root'>ROOT</a>\n"
436 <<
" <button onclick='browseRootFile(\""
437 <<
fTeXName <<
".root\")'>browse online</button></li>\n"
438 <<
"</ul>" << std::endl;
441 fPass.BeginsWith(
"passMC", TString::kIgnoreCase));
443 <<
" <li><a href='https://alimonitor.cern.ch/"
444 << (isMC ?
"job_details.jsp" :
"production/raw.jsp")
445 <<
"?jt_field1=" <<
fPeriod <<
"'>Production(s)</a></li>\n"
446 <<
"</ul>" << std::endl;
455 *
fHtml <<
"<div class='back'>\n"
456 <<
"<a href='index.html'>Back</a>\n"
458 <<
"<div class='change'>\n"
459 <<
" Last update: " << now.AsString() <<
"\n"
460 <<
"</div>" << std::endl;
virtual void WriteLinks()
QABase(const TString &dataType, Int_t prodYear, const TString &period, const TString &pass)
static Global * MakeBranch(TTree *tree)
void Close(bool deletePNGs=true)
void PrintCanvas(const char *pngName, UInt_t)
void PrintCanvas(const char *pngName, TCollection *areas=0)
void CanvasTitle(const char *title)
QABase & operator=(const QABase &)
const char * OutputName() const
Bool_t Init(TTree *tree, bool read=false)
virtual void WriteFooter()
virtual void WriteImageFooter(std::ostream &o, const char *)
void PutCanvasTitle(const char *title)
virtual Bool_t MakeTree(bool read)
Bool_t Init(bool read=false)
void SetOutputName(const char *name)
static Global * SetBranch(TTree *tree)
void MakeCanvas(const char *title)