1 #if !defined(__CINT__) || defined(__MAKECINT__)
11 #include "TObjArray.h"
12 #include "TObjString.h"
19 TString convertedFilename = filename;
20 convertedFilename.ReplaceAll(
".pdf",
".txt");
21 return convertedFilename;
27 TObjArray* arr = trigName.Tokenize(
"-");
28 TString shortName = arr->At(0)->GetName();
29 if ( arr->GetEntries() > 2 ) {
30 shortName.Append(Form(
"-%s",arr->At(1)->GetName()));
37 Int_t
GetPage ( TString pattern, TString filename )
41 if ( gSystem->AccessPathName(convertedFilename.Data()) != 0 ) {
42 gSystem->Exec(Form(
"gs -dBATCH -dNOPAUSE -sDEVICE=txtwrite -sOutputFile=- %s > %s",filename.Data(),convertedFilename.Data()));
45 ifstream inFile(convertedFilename.Data());
46 if ( ! inFile.is_open() )
return -1;
48 TObjArray* patternArr = pattern.Tokenize(
"&");
49 TArrayI foundPages(patternArr->GetEntries());
52 TString currLine =
"";
54 Bool_t allOk = kFALSE;
55 while ( ! inFile.eof() ) {
56 currLine.ReadLine(inFile);
57 if ( currLine.Contains(
"Page") ) {
59 currPage = currLine.Atoi();
63 for ( Int_t ipat=0; ipat<patternArr->GetEntries(); ipat++ ) {
64 TString currPattern =
static_cast<TObjString*
>(patternArr->At(ipat))->GetString();
65 if ( currLine.Contains(currPattern.Data()) ) {
66 foundPages[ipat] = currPage;
67 Bool_t matchAll = kTRUE;
68 for ( Int_t jpat=0; jpat<patternArr->GetEntries(); jpat++ ) {
69 if ( foundPages[ipat] != foundPages[jpat] ) {
86 printf(
"Warning: cannot find %s\n",pattern.Data());
96 str.ReplaceAll(
"\\",
"");
97 TString specials =
"_";
98 TObjArray* specialList = specials.Tokenize(
" ");
99 for ( Int_t ichar=0; ichar<specialList->GetEntries(); ichar++ ) {
100 TString currChar =
static_cast<TObjString*
>(specialList->At(ichar))->GetString();
101 if ( str.Contains(currChar.Data()) ) str.ReplaceAll(currChar.Data(),Form(
"\\\%s",currChar.Data()));
110 outFile <<
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
111 outFile <<
"\\begin{frame}" << endl;
112 outFile <<
" \\frametitle{" << title.Data() <<
"}" << endl;
118 outFile <<
"\\end{frame}" << endl;
124 outFile <<
"\\begin{itemize}" << endl;
125 outFile <<
" \\item " << defaultItem.Data() << endl;
126 outFile <<
"\\end{itemize}" << endl;
132 Int_t pageNum =
GetPage(pattern,filename);
138 outFile <<
" \\begin{columns}[onlytextwidth]" << endl;
139 outFile <<
" \\column{\\textwidth}" << endl;
140 outFile <<
" \\centering" << endl;
141 outFile <<
" \\includegraphics[width=0.98\\textwidth,height=0.92\\textheight,page=" << pageNum <<
"]{" << gSystem->BaseName(filename.Data()) <<
"}" <<endl;
142 outFile <<
" \\end{columns}" << endl;
150 BeginFrame(
"Trigger chamber efficiencies", outFile);
151 outFile <<
" \\begin{columns}[onlytextwidth]" << endl;
152 outFile <<
" \\column{0.66\\textwidth}" << endl;
153 outFile <<
" \\centering" << endl;
154 for ( Int_t ich=0; ich<4; ich++ ) {
155 if ( ich%2 == 0 ) outFile << endl;
156 Int_t ipage =
GetPage(Form(
"Trigger chamber efficiency vs run for chamber %i",11+ich),filename);
157 outFile <<
" \\includegraphics[width=0.48\\textwidth,page=" << ipage <<
"]{" << filename.Data() <<
"}" << endl;
159 outFile <<
" \\column{0.34\\textwidth}" << endl;
160 outFile <<
" \\centering" << endl;
161 Int_t ipage =
GetPage(
"Multinomial probability",filename);
162 outFile <<
" \\includegraphics[width=0.98\\textwidth,page=" << ipage <<
"]{" << filename.Data() <<
"}" << endl;
163 outFile <<
" \\end{columns}" << endl;
171 BeginFrame(
"Trigger chamber efficiencies per RPC",outFile);
172 outFile <<
" \\begin{columns}[onlytextwidth]" << endl;
173 outFile <<
" \\column{\\textwidth}" << endl;
174 outFile <<
" \\centering" << endl;
175 for ( Int_t ich=0; ich<4; ich++ ) {
176 if ( ich%2 == 0 ) outFile << endl;
177 Int_t ipage =
GetPage(Form(
"Trigger chamber efficiency vs run for chamber %i&RPC",11+ich),filename);
178 outFile <<
" \\includegraphics[width=0.37\\textwidth,page=" << ipage <<
"]{" << filename.Data() <<
"}" << endl;
180 outFile <<
" \\end{columns}" << endl;
189 outFile <<
"General informations" << endl;
190 outFile <<
"\\begin{itemize}" << endl;
191 outFile <<
" \\item Runs selected for MUON on ALICE logbook:" << endl;
192 outFile <<
" \\begin{itemize}" << endl;
193 outFile <<
" \\item Period: " << period.Data() << endl;
194 outFile <<
" \\item Run Type: PHYSICS" << endl;
195 outFile <<
" \\item Beam: STABLE" << endl;
196 outFile <<
" \\item At least [ MUON\\_TRG \\& MUON\\_TRK \\& SPD ] as Readout" << endl;
197 outFile <<
" \\item Quality: globaly GOOD and NOT BAD for readout Detectors" << endl;
198 outFile <<
" \\item Duration: at least 10 min" << endl;
199 outFile <<
" \\end{itemize}" << endl;
200 outFile <<
"\\end{itemize}" << endl;
202 outFile <<
" \\vspace{5mm}" << endl;
204 outFile <<
"\\begin{columns}[onlytextwidth]" << endl;
205 outFile <<
" \\column{\\textwidth}" << endl;
206 outFile <<
" \\centering" << endl;
207 outFile <<
" \\begin{tabular}{|l|lll|}" << endl;
208 outFile <<
" \\hline" << endl;
209 outFile <<
" & Total runs & CMUL & CMSL \\\\" << endl;
210 outFile <<
" \\hline" << endl;
211 outFile <<
" ALICE logbook & xx & xx & xx\\\\" << endl;
212 outFile <<
" Good from QA & xx & xx & xx\\\\" << endl;
213 outFile <<
" \\hline" << endl;
214 outFile <<
" \\end{tabular}" << endl;
215 outFile <<
"\\end{columns}" << endl;
220 outFile <<
"General:" << endl;
223 outFile <<
"MTR efficiency:" << endl;
224 MakeDefaultItem(outFile,
"More than xx\\% efficiency in trigger chambers, stable");
226 outFile <<
"MCH and MUON data quality:" << endl;
231 outFile <<
" \\begin{columns}[onlytextwidth,T]" << endl;
232 outFile <<
" \\footnotesize" << endl;
233 outFile <<
" \\column{0.5\\textwidth}" << endl;
234 outFile <<
" \\centering" << endl;
235 outFile <<
" \\begin{tabular}{|cp{0.63\\textwidth}|}" << endl;
236 outFile <<
" \\hline" << endl;
237 outFile <<
" \\runTab[\\errorColor]{xxx}{xxx}" << endl;
238 outFile <<
" \\hline" << endl;
239 outFile <<
" \\end{tabular}" << endl;
241 outFile <<
" \\column{0.5\\textwidth}" << endl;
242 outFile <<
" \\begin{tabular}{|cp{0.63\\textwidth}|}" << endl;
243 outFile <<
" \\hline" << endl;
244 outFile <<
" \\colorLegend" << endl;
245 outFile <<
" \\hline" << endl;
246 outFile <<
" \\end{tabular}" << endl;
247 outFile <<
" \\end{columns}" << endl;
254 outFile <<
"\\documentclass[9pt,table]{beamer}" << endl;
255 outFile <<
"\\mode<presentation>" << endl;
256 outFile <<
"\\usepackage[T1]{fontenc}" << endl;
257 outFile <<
"\\usepackage{lmodern}" << endl;
258 outFile <<
"\\usepackage{amsmath}" << endl;
259 outFile <<
"\\usepackage{color,graphicx}" << endl;
260 outFile <<
"\\usepackage{colortbl}" << endl;
261 outFile <<
"\\usepackage{multirow}" << endl;
262 outFile <<
"\\usepackage{pifont}" << endl;
263 outFile <<
"\\usepackage{wasysym}" << endl;
264 outFile <<
"\\usepackage{appendixnumberbeamer}" << endl;
265 outFile <<
"\\usepackage[absolute,overlay]{textpos}" << endl;
266 outFile <<
"\\usetheme{Madrid}" << endl;
267 outFile <<
"\\useoutertheme{shadow}" << endl;
269 outFile <<
"\\setbeamersize{text margin left=0.5cm, text margin right=0.5cm}" << endl;
271 outFile <<
"% Slightly change the template" << endl;
272 outFile <<
"\\setbeamertemplate{navigation symbols}{} %suppress navigation symbols (bottom-right of frame)" << endl;
274 outFile <<
"\\setbeamercolor*{author in head/foot}{parent=palette tertiary}" << endl;
275 outFile <<
"\\setbeamercolor*{title in head/foot}{parent=palette secondary}" << endl;
276 outFile <<
"\\setbeamercolor*{date in head/foot}{parent=palette primary}" << endl;
277 outFile <<
"\\setbeamercolor*{section in head/foot}{parent=palette tertiary}" << endl;
278 outFile <<
"\\setbeamercolor*{subsection in head/foot}{parent=palette primary}" << endl;
279 outFile <<
"\\newcommand{\\changeFootline}[1]{" << endl;
280 outFile <<
" \\setbeamertemplate{footline}{" << endl;
281 outFile <<
" \\hbox{%" << endl;
282 outFile <<
" \\begin{beamercolorbox}[wd=.2\\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%" << endl;
283 outFile <<
" \\insertshortauthor%~~(\\insertshortinstitute)" << endl;
284 outFile <<
" \\end{beamercolorbox}%" << endl;
285 outFile <<
" \\begin{beamercolorbox}[wd=.6\\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%" << endl;
286 outFile <<
" \\insertshorttitle" << endl;
287 outFile <<
" \\hspace*{2em}\\insertshortdate{}" << endl;
288 outFile <<
" \\end{beamercolorbox}%" << endl;
289 outFile <<
" \\begin{beamercolorbox}[wd=.2\\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%" << endl;
290 outFile <<
" #1\\hspace*{2ex}" << endl;
291 outFile <<
" \\end{beamercolorbox}}%" << endl;
292 outFile <<
" }}" << endl;
293 outFile <<
"\\changeFootline{\\insertframenumber{} / \\inserttotalframenumber}" << endl;
294 outFile <<
"\\setbeamertemplate{headline}{}" << endl;
297 outFile <<
"\\newcommand{\\errorColor}{red!50!white}" << endl;
298 outFile <<
"\\newcommand{\\warningColor}{orange!50!white}" << endl;
299 outFile <<
"\\newcommand{\\pendingColor}{yellow!50!white}" << endl;
300 outFile <<
"\\newcommand{\\newColor}{blue!20!white}" << endl;
301 outFile <<
"\\newcommand{\\colorLegend}{" << endl;
302 outFile <<
" \\multicolumn{2}{|l|}{\\colorbox{\\newColor}{~~} = newly analyzed}\\\\" << endl;
303 outFile <<
" \\multicolumn{2}{|l|}{\\colorbox{\\pendingColor}{~~} = pending statement}\\\\" << endl;
304 outFile <<
" \\multicolumn{2}{|l|}{\\colorbox{\\warningColor}{~~} = possible problem}\\\\" << endl;
305 outFile <<
" \\multicolumn{2}{|l|}{\\colorbox{\\errorColor}{~~} = problem spotted}\\\\}" << endl;
306 outFile <<
"\\newcommand{\\runTab}[3][white]{\\cellcolor{#1} #2 & \\cellcolor{#1} #3\\\\}" << endl;
308 outFile <<
"\\newcommand{\\pik}{\\ensuremath{\\pi\\mathrm{/K}}}" << endl;
309 outFile <<
"\\newcommand{\\mum}{\\mbox{$\\mu {\\rm m}$}}" << endl;
310 outFile <<
"\\newcommand{\\mom}{\\mbox{GeV$\\kern-0.15em /\\kern-0.12em c$}}" << endl;
311 outFile <<
"\\newcommand{\\pt}{\\ensuremath{p_{\\mathrm{T}}}}" << endl;
312 outFile <<
"\\newcommand{\\dd}{\\text{d}}" << endl;
313 outFile <<
"\\newcommand{\\raa}{\\ensuremath{R_{AA}}}" << endl;
317 void BeginSlides ( TString period, TString pass, TString authors, ofstream &outFile )
319 TString authorsShort =
"";
320 Bool_t previousIsLetter = kFALSE;
321 for ( Int_t ichar=0; ichar<authors.Length(); ichar++ ) {
322 TString currChar = authors[ichar];
324 Int_t currentIsLetter = currChar.IsAlpha();
325 if ( currentIsLetter && ! previousIsLetter ) authorsShort += currChar +
".";
326 if ( currChar ==
"," ) authorsShort +=
",";
327 previousIsLetter = currentIsLetter;
330 outFile <<
"\\title{Muon QA: " << period.Data() <<
" " << pass.Data() <<
"}" << endl;
331 outFile <<
"\\author[" << authorsShort.Data() <<
"]{" << authors.Data() <<
"}" << endl;
332 outFile <<
"\\date{\\today}" << endl;
334 outFile <<
"\\begin{document}" << endl;
335 outFile <<
"\\setlength{\\TPHorizModule}{1bp}" << endl;
336 outFile <<
"\\setlength{\\TPVertModule}{1bp}" << endl;
337 outFile <<
"\\textblockorigin{0bp}{0bp}" << endl;
339 outFile <<
"\\graphicspath{{images/}}" << endl;
342 outFile <<
"\\begin{frame}" << endl;
343 outFile <<
" \\titlepage" << endl;
344 outFile <<
"\\end{frame}" << endl;
350 outFile <<
"\\end{document}" << endl;
359 outFile <<
"\\AtBeginSection[] % Do nothing for \\section*" << endl;
360 outFile <<
"{" << endl;
361 outFile <<
" \\begin{frame}<beamer>" << endl;
362 outFile <<
" \\begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}" << endl;
363 outFile <<
" \\usebeamerfont{title}\\insertsectionhead" << endl;
364 outFile <<
" \\end{beamercolorbox}" << endl;
365 outFile <<
" \\end{frame}" << endl;
366 outFile <<
"}" << endl;
368 outFile <<
"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << endl;
369 outFile <<
"\\appendix" << endl;
370 outFile <<
"\\changeFootline{A.\\insertframenumber{}}" << endl;
371 outFile <<
"\\section{\\huge Backup slides}" << endl;
375 void MakeSlides ( TString period, TString pass, TString triggerList, TString authors, TString trackerQA =
"QA_muon_tracker.pdf", TString triggerQA =
"QA_muon_trigger.pdf", TString texFilename =
"muonQA.tex" )
377 if ( gSystem->AccessPathName(texFilename.Data()) == 0 ) {
378 printf(
"Output file %s already exists\nPlease remove it!\n", texFilename.Data());
382 TString hasGs = gSystem->GetFromPipe(
"which gs");
383 if ( hasGs.IsNull() ) {
384 printf(
"The macro selects the pdf page with gs, but the program was not found on this machine. Sorry, but slides cannot be automatically generated on this machine.\n");
391 TObjArray* trigList = triggerList.Tokenize(
",");
393 ofstream outFile(texFilename);
400 MakeSingleFigureSlide(
"L2A from QA",triggerQA,
"Reconstruction: reconstructed triggers in QA wrt L2A from OCDB scalers",outFile);
403 for ( Int_t itrig=0; itrig<trigList->GetEntries(); itrig++ ) {
404 TString currTrig = trigList->At(itrig)->GetName();
406 MakeSingleFigureSlide(Form(
"Number of Tracks /%s",currTrig.Data()),trackerQA,Form(
"Muon tracks / event in %s events",shortTrig.Data()),outFile);
407 MakeSingleFigureSlide(Form(
"Sum of trigger tracks (matched + trigger-only) / # events in %s",currTrig.Data()),trackerQA,Form(
"Muon tracker-trigger tracks / event in %s events",shortTrig.Data()),outFile);
408 MakeSingleFigureSlide(Form(
"Matched tracks charge asymmetry for %s with acc. cuts",currTrig.Data()),trackerQA,Form(
"Charge asymmetry in %s events",shortTrig.Data()),outFile);
409 MakeSingleFigureSlide(Form(
"Identified beam-gas tracks (pxDCA cuts) in matched tracks for %s",currTrig.Data()),trackerQA,Form(
"Rel. num. of beam-gas tracks (id. by p$\\times$DCA cuts) in %s events",shortTrig.Data()),outFile);
411 MakeSingleFigureSlide(
"averaged number of associated clusters or of the number of chamber hit per track",trackerQA,
"Average number of clusters per track and dispersion",outFile);
412 MakeSingleFigureSlide(
"averaged number of clusters in chamber i per track",trackerQA,
"Average number of clusters per chamber",outFile);
415 MakeSingleFigureSlide(
"Phys. Sel. for all selected triggers",trackerQA,
"Physics selection effects",outFile);
416 MakeSingleFigureSlide(
"<X> of clusters - associated to a track - in chamber i",trackerQA,
"Average cluster position per chamber",outFile);
423 outFile <<
"MUON Trigger" << endl;
426 outFile <<
"MUON tracker" << endl;
435 TString filenames[2] = {trackerQA, triggerQA};
436 for ( Int_t ifile=0; ifile<2; ifile++ ) {
438 if ( gSystem->AccessPathName(convertedFilename.Data()) == 0 ) gSystem->Exec(Form(
"rm %s",convertedFilename.Data()));
void BeginSlides(TString period, TString pass, TString authors, ofstream &outFile)
Bool_t MakeTriggerSlide(TString filename, ofstream &outFile)
void MakeDefaultItem(ofstream &outFile, TString defaultItem="")
void BeginFrame(TString title, ofstream &outFile)
Bool_t MakeSingleFigureSlide(TString pattern, TString filename, TString title, ofstream &outFile)
Bool_t MakeTriggerRPCslide(TString filename, ofstream &outFile)
void MakePreamble(ofstream &outFile)
void EscapeSpecialChars(TString &str)
void EndSlides(ofstream &outFile)
void EndFrame(ofstream &outFile)
Int_t GetPage(TString pattern, TString filename)
void MakeSummary(TString period, ofstream &outFile)
void StartAppendix(ofstream &outFile)
TString GetConvertedFilename(TString filename)
void MakeSlides(TString period, TString pass, TString triggerList, TString authors, TString trackerQA="QA_muon_tracker.pdf", TString triggerQA="QA_muon_trigger.pdf", TString texFilename="muonQA.tex")
TString GetTriggerShort(TString trigName)