]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/macros/PhysSelQA/AliPSQAVisualization.cxx
New input file defined with three columns (run number, fill number, number of events...
[u/mrichter/AliRoot.git] / ANALYSIS / macros / PhysSelQA / AliPSQAVisualization.cxx
1 /////////////////////////////////////\r
2 // Created by: Kevin McDermott     //\r
3 // email: kmcderm3@nd.edu          //\r
4 // CERN Summer Student 2012        //\r
5 // University of Notre Dame du Lac //\r
6 //                                 // \r
7 // Revision: 1.0                   //\r
8 // Created on: August 6, 2012      //\r
9 /////////////////////////////////////\r
10 \r
11 #include "AliPSQAVisualization.h"\r
12 \r
13 ClassImp(AliPSQAVisualization)\r
14 \r
15 AliPSQAVisualization::AliPSQAVisualization(): // Default constructor\r
16 TObject(),\r
17 fRunNumbers(0),\r
18 fFillNumbers(0),\r
19 fRawRunNumbers(0),\r
20 fRawFillNumbers(0),\r
21 fNRuns(0),\r
22 fNRawRuns(0),\r
23 fFillSeparationLine(0x0)\r
24 {\r
25   // Initialize some private data members from AliPSQAV\r
26   fInDirectory = "";\r
27   fROOTInput = "";\r
28   fRunFillFile = "";\r
29   fSavePDFs = kFALSE;\r
30   fOutDirectory = "";\r
31   fOutPDFName = "";\r
32   fOutEPSName = "";\r
33   fDrawOverPlot = kFALSE;\r
34   fOverPlotTitle = "";\r
35   fMaximum = -1000;\r
36   fMinimum =  1000;\r
37   fScaleAuto = kFALSE;\r
38   fUseColorArray = kFALSE;\r
39   fMultMax = 0;\r
40   fDivMin = 0;\r
41   InitializeColorArray("");\r
42   InitializeSelectedPlots("");\r
43 }\r
44 \r
45 //________________________________________________________________________________________________\r
46 AliPSQAVisualization::~AliPSQAVisualization(){\r
47   delete[] fCanvas;\r
48   delete[] fDrawPlot;\r
49   delete[] fFillSeparationLine;\r
50   delete[] fSelectedPlots;\r
51   delete[] fColors;\r
52   delete fOverLegend;\r
53 }\r
54 \r
55 //________________________________________________________________________________________________\r
56 void AliPSQAVisualization::InitializeColorArray(const Char_t * listOfColors){ // Function to custom set color array used for plots, not essential\r
57   Color_t colors; //color enums from list\r
58   ifstream input_data_col; //text file object\r
59   input_data_col.open(listOfColors, ios::in );  //open the text file\r
60   Int_t Ncol = 0; //number of color names to be used\r
61 \r
62   while ( input_data_col >> colors ) { // count number of color names\r
63     Ncol++;\r
64   }\r
65 \r
66   fNColors = Ncol; // Set private data member to total color names to be used\r
67   input_data_col.close(); // reset the file\r
68 \r
69   fColors = new Color_t [fNColors]; // initialize private data member with number of trig names\r
70   input_data_col.open(listOfColors, ios::in );\r
71   for (Int_t icol = 0; icol < fNColors; icol++){\r
72     input_data_col >> fColors[icol];\r
73   }\r
74 \r
75   input_data_col.close();\r
76 }\r
77 \r
78 //________________________________________________________________________________________________\r
79 void AliPSQAVisualization::InitializeSelectedPlots(const Char_t * listOfPlots){\r
80   TString plotnames; //plot names from list\r
81   ifstream input_data_pn; //text file object\r
82   if(!listOfPlots) cout << "No list of plots" << endl;\r
83   input_data_pn.open(listOfPlots, ios::in );  //open the text file\r
84   Int_t Npn = 0; //number of plot names to be used\r
85 \r
86   while ( input_data_pn >> plotnames ) { // count number of plot names\r
87     Npn++;\r
88   }\r
89 \r
90   cout << "Number of initalized plots = " << Npn << endl;\r
91 \r
92   fNSelectedPlots = Npn; // Set private data member to total plot names to be used\r
93   input_data_pn.close(); // reset the file\r
94   //cout << "Number of selected plots = " << fNSelectedPlots << endl;\r
95   fSelectedPlots = new TString [fNSelectedPlots]; // initialize private data member with number of trig names\r
96   input_data_pn.open(listOfPlots, ios::in );\r
97   for (Int_t iplot = 0; iplot < fNSelectedPlots; iplot++){\r
98     input_data_pn >> fSelectedPlots[iplot];\r
99     //cout << "Plots to process :" << fSelectedPlots[iplot] << endl;\r
100   }\r
101 \r
102   input_data_pn.close();\r
103 }\r
104 \r
105 //________________________________________________________________________________________________\r
106 void AliPSQAVisualization::PostProcessQA(){\r
107 \r
108   if(!fROOTInput) cout << "No .root file found" << endl;\r
109 \r
110   //cout << "Sto morendo qua? 1" << endl;\r
111   gStyle->SetOptStat(0);\r
112   gStyle->SetPalette(1);\r
113   gStyle->SetFillColor(10);\r
114   gStyle->SetOptStat(0);\r
115   gStyle->SetOptTitle(1);\r
116   // do not use scientific notation for run number\r
117   TGaxis::SetMaxDigits(6);\r
118   //cout << "Sto morendo qua? 2" << endl;\r
119   ConvertTGraphErrorsToTH1Ds();  // Convert all plots to TH1D's from specified plot list\r
120   //cout << "Sto morendo qua? 3" << endl;\r
121   fCanvas = new TCanvas[fNSelectedPlots]; // Allocate memory for the canvases to draw PostProcessing\r
122    \r
123   if ((fDrawOverPlot) || (fSaveOverPlotPDF) || (fSaveOverPlotEPS)){\r
124     fOverLegend = new TLegend(0.55,0.625,.75,.85);\r
125     if (fScaleAuto){\r
126       ScaleMinAndMax();\r
127     }\r
128   }\r
129 \r
130   if ((fSavePDFs) || (fSaveOverPlotPDF) || (fSaveOverPlotEPS)){\r
131     FileStat_t dummy_filestat;\r
132     if (gSystem->GetPathInfo(fOutDirectory.Data(), dummy_filestat) == 1) { // cache directory does not exist\r
133       MakeDir(fOutDirectory);\r
134     }\r
135   }\r
136 \r
137   // *************************************** LOOP ON PLOTS ***************************************\r
138 \r
139   for (Int_t iplot = 0; iplot < fNSelectedPlots; iplot++){ // Loop over the number of plots to be made pretty and drawn\r
140     DrawSelected(iplot); // Draw the Selected plots, decide later whether to have them open/save them\r
141   \r
142     DrawSameTriggerOnSameCA(iplot);\r
143     cout << "Draw selected - OK " << endl;\r
144 \r
145     if (fSavePDFs){ // Write the canvas to the PDF file if kTRUE\r
146       SavePDFs(iplot);\r
147       SaveToPDFSeparately(iplot);\r
148     }\r
149 \r
150     if (!fDrawSelected){ // Close the canvas if you do not want to see the plot\r
151       fCanvas[iplot].Close();\r
152     }\r
153 \r
154     if ( (fDrawOverPlot) || (fSaveOverPlotPDF) || (fSaveOverPlotEPS) ) { // Set points and draw overplot if any are true\r
155       if (fUseColorArray){\r
156         DrawOverPlotCA(iplot);\r
157       }\r
158       else{\r
159         DrawOverPlotNoCA(iplot);\r
160       }\r
161     }\r
162     else if( (!fDrawOverPlot) && ( (fSaveOverPlotPDF) || (fSaveOverPlotEPS) ) ) { // Set the points to save to and/or pdf/eps but then close it outside the loop\r
163       if (fUseColorArray){\r
164         DrawOverPlotCA(iplot);\r
165       }\r
166       else{\r
167         DrawOverPlotNoCA(iplot);\r
168       }\r
169     }\r
170 \r
171   } // end loop on plots\r
172 \r
173   if (fSaveOverPlotPDF){ // Save the overplot to pdf\r
174     SaveOverPlotPDF();\r
175   }\r
176   if (fSaveOverPlotEPS){ // Save the overplot to eps\r
177     SaveOverPlotEPS();\r
178   }\r
179   if (!fDrawOverPlot){ // Close if you do not want to see it\r
180     fOverCanvas.Close();\r
181   }\r
182 }\r
183 \r
184 //________________________________________________________________________________________________\r
185 Int_t AliPSQAVisualization::MatchGoodRunToFillNumber(Int_t runnumber){\r
186 \r
187   Int_t fill = -1;\r
188 \r
189   for(Int_t irun = 0; irun < fNRawRuns; irun++){\r
190     if(runnumber == fRawRunNumbers[irun]){\r
191       fill = fRawFillNumbers[irun];\r
192       // cout << runnumber << " matched to fill " << fill << endl;\r
193     }\r
194   }\r
195   //   cout << "Matching completed" << endl;\r
196   return fill;\r
197 }\r
198 \r
199 //________________________________________________________________________________________________\r
200 Int_t AliPSQAVisualization::MatchGoodRunToStats(Int_t runnumber){\r
201 \r
202   Int_t Stats = -1;\r
203 \r
204   for(Int_t irun = 0; irun < fNRawRuns; irun++){\r
205     if(runnumber == fRawRunNumbers[irun]){\r
206       Stats = fRawRunStats[irun];\r
207       // cout << runnumber << " matched to fill " << fill << endl;\r
208     }\r
209   }\r
210 \r
211   //   cout << "Matching completed" << endl;\r
212   return Stats;\r
213 }\r
214 \r
215 //________________________________________________________________________________________________\r
216 void AliPSQAVisualization::ConvertTGraphErrorsToTH1Ds(){\r
217 \r
218   cout << "********************** C O N V E R T I N G    TGRAPHS       T O      T H 1 D" << endl;\r
219 \r
220   fRootFile = TFile::Open(Form("%s",fROOTInput.Data()));\r
221   cout << "Opening file " << fROOTInput.Data() << endl;\r
222 \r
223   fDrawPlot = new TH1D[fNSelectedPlots]; // Array of TH1D's to be converted\r
224   fNDiffFills = new Int_t[fNSelectedPlots];\r
225   fFillSeparationLine = new TLine*[fNSelectedPlots];\r
226 \r
227   for (Int_t iplot = 0; iplot < fNSelectedPlots; iplot++){\r
228     // Variables from the old TGraphErrors needed to draw TH1Fs\r
229     // Uncomment if seg fault returns TGraph::GetX (this=0x0), as last printout will say which graph is not correct\r
230     //    cout << fInDirectory.Data() << "/" << fROOTInput.Data() << ": " << fSelectedPlots[iplot].Data() << endl;\r
231     fNDiffFills[iplot] = 0;\r
232 \r
233     // cout << "Problem is here? " << fSelectedPlots[iplot].Data() << endl;\r
234     TGraphErrors * TGEplot  = (TGraphErrors*) fRootFile->Get(fSelectedPlots[iplot].Data());\r
235     if(!TGEplot) {\r
236       //          cout << "Missing plot @ step " << iplot << "plot is -> " <<   fSelectedPlots[iplot].Data() << endl;\r
237       continue;\r
238     }\r
239           \r
240     Double_t     * TGEx     = TGEplot->GetX(); // needed to properly index the x-axis (run numbers)\r
241     Double_t     * TGEy     = TGEplot->GetY(); // array of double_t's, qaval\r
242     Int_t        TGEnpoints = TGEplot->GetN(); // number of points used in the TGE\r
243     Double_t      * TGEey   = TGEplot->GetEY(); // array of double_t's corresponding to the errors in the TGE\r
244     TString      TGEname    = TGEplot->GetName();\r
245     TString      TGEtitle   = TGEplot->GetTitle();\r
246 \r
247     // TGEx = new Double_t[TGEnpoints];\r
248 \r
249     fNRuns = TGEnpoints;\r
250     fRunNumbers = new Int_t[fNRuns];\r
251     fFillNumbers = new Int_t[fNRuns];\r
252     fBinArray = new Int_t[fNRuns];\r
253 \r
254     for (Int_t irun=0; irun<TGEnpoints; irun++){\r
255       fRunNumbers[irun] = TGEx[irun];\r
256       fFillNumbers[irun] = MatchGoodRunToFillNumber(fRunNumbers[irun]);\r
257       cout << "Run number [" << irun << "] - " << fRunNumbers[irun] << " - " << fFillNumbers[irun] << endl;\r
258       fBinArray[irun] = irun;\r
259     }\r
260 \r
261     // make tlines to identify different\r
262 \r
263     // Parameters for the to be drawn TH1D\r
264     TString     TH1Dname  = TGEname.Data();\r
265     TH1Dname  += "_TH1D";\r
266     TString     TH1Dtitle = TGEtitle.Data();\r
267     TH1Dtitle += " TH1D";\r
268     // See Below for the strange numbering of bins\r
269     \r
270     Int_t       TH1Dxnbin = TGEnpoints;\r
271     Int_t       TH1Dxlow  = 1;\r
272     Int_t       TH1Dxhigh = TH1Dxnbin + 1;\r
273     // Declare the new plot to be drawn as a TH1D\r
274     \r
275     fDrawPlot[iplot].SetBins(TH1Dxnbin, TH1Dxlow, TH1Dxhigh); // start with bin label 1, up through bin number +1 (TH1D bin numbering has strange conventions, as zero bin is the underflow bin)\r
276     \r
277     fDrawPlot[iplot].SetNameTitle(TH1Dname.Data(),TH1Dtitle.Data());\r
278     fDrawPlot[iplot].GetXaxis()->SetTitle("Run Number");\r
279     TString TH1Dytitle = SetDrawSelectedYTitle(TGEtitle);\r
280     fDrawPlot[iplot].SetYTitle(TH1Dytitle.Data());\r
281 \r
282     cout << "==================== TEST ============= " << endl;\r
283     cout << "-------------------- iplot = " << iplot << endl;\r
284 \r
285     for (Int_t ibin = 1; ibin < TH1Dxnbin+1; ibin++){ // everything shifted off by one because tgraph starts at zero, th1f starts bins at 1\r
286       fDrawPlot[iplot].SetBinContent(fDrawPlot[iplot].FindBin(ibin),TGEy[ibin-1]); // y[i-1] is the bin in plot\r
287       fDrawPlot[iplot].SetBinError(fDrawPlot[iplot].FindBin(ibin),TGEey[ibin-1]);\r
288 \r
289       if(ibin< TH1Dxnbin){\r
290         if(fFillNumbers[ibin]!=fFillNumbers[ibin-1]){\r
291           cout << "New fill @ " << ibin << endl;\r
292           cout << "Run @ "<< ibin-1 << " = " << fRunNumbers[ibin-1] <<" corresponding to fill " << fFillNumbers[ibin-1] << "; Crosscheck on bin array = " << fBinArray[ibin-1] << endl;\r
293           cout << "Run @ "<< ibin << " = " << fRunNumbers[ibin] <<" corresponding to fill " << fFillNumbers[ibin] << endl;\r
294           fNDiffFills[iplot]++;\r
295           cout << "****************************************" << endl;\r
296         }\r
297       }\r
298 \r
299       Int_t TH1Dx = Int_t(TGEx[ibin-1]); // x[i-1] = actual bin label in plot\r
300       TString TH1DxBinLabel = Form("%i",TH1Dx);\r
301       \r
302       cout << "TH1DxBinLabel = " << TH1DxBinLabel << endl;\r
303 \r
304       fDrawPlot[iplot].GetXaxis()->SetBinLabel(fDrawPlot[iplot].FindBin(ibin), TH1DxBinLabel.Data());\r
305       fDrawPlot[iplot].GetXaxis()->SetTitleSize(.05); // default = 4%, made it 5%\r
306 \r
307     } // end of loop on bins\r
308     \r
309     fFillSeparationLine[iplot] = new TLine[fNDiffFills[iplot]];\r
310 \r
311     TLine * newline = new TLine[fNDiffFills[iplot]];\r
312 \r
313     cout << "Number of different fills = " << fNDiffFills[iplot] << " for iplot index = " << iplot << endl;\r
314     cout << "==================== END TEST ============= " << endl;\r
315 \r
316     //looping again on the bins of the TGE -> filling the TLines\r
317 \r
318     Int_t fillindex = 0;\r
319     for (Int_t ibin = 1; ibin < TH1Dxnbin+1; ibin++){\r
320 \r
321       if(ibin<TH1Dxnbin){\r
322         if(fFillNumbers[ibin]!=fFillNumbers[ibin-1]){\r
323           //newline[fillindex].SetX1((0.5*(fFillNumbers[ibin-1]+fFillNumbers[ibin])));\r
324           //newline[fillindex].SetX2((0.5*(fFillNumbers[ibin-1]+fFillNumbers[ibin])));\r
325           // newline[fillindex].SetX1((0.5*((ibin-1)+ibin)));\r
326           // newline[fillindex].SetX2((0.5*((ibin-1)+ibin)));\r
327           newline[fillindex].SetX1(ibin+1);\r
328           newline[fillindex].SetX2(ibin+1);\r
329           newline[fillindex].SetY1(0.);\r
330           newline[fillindex].SetY2(1.);\r
331           cout << "setting line @  = " << ((0.5*((ibin-1)+ibin))) << endl;\r
332           \r
333           fFillSeparationLine[iplot][fillindex] = newline[fillindex];\r
334 \r
335           fillindex++;\r
336         } // end if on checking different run numbers\r
337       }// end if            \r
338     }// endl loop on bins\r
339     \r
340 \r
341     //\r
342     // adding some drawing options\r
343     //\r
344     fDrawPlot[iplot].SetMarkerStyle(20);\r
345     fDrawPlot[iplot].SetMarkerSize(1.4);\r
346     fDrawPlot[iplot].SetMarkerColor(kBlue);\r
347     fDrawPlot[iplot].SetLineColor(kBlue);\r
348     fDrawPlot[iplot].GetYaxis()->SetRangeUser(-0.001,1.05);\r
349     fDrawPlot[iplot].GetXaxis()->LabelsOption("V");\r
350   } // end loop on plots\r
351 \r
352   cout << "********************** E N D     C O N V E R T I N G    TGRAPHS       T O      T H 1 D" << endl;\r
353 \r
354 }\r
355 \r
356 //________________________________________________________________________________________________\r
357 TString AliPSQAVisualization::SetDrawSelectedYTitle(TString TGEtitle){\r
358 \r
359   Ssiz_t start  = 0;\r
360   Ssiz_t first_o = TGEtitle.First('o'); // o in over, lowercase o that appears first is the over\r
361   Ssiz_t first_f = TGEtitle.First('f');\r
362 \r
363   TString label[2];\r
364   label[0] = TString(TGEtitle( start , first_o - start - 1)); // Shift one over from the 'h'\r
365   label[1] = TString(TGEtitle( first_o + 4, first_f - first_o - 4 ));  //Shift five over from the 'O' \r
366 \r
367   // Make this substitution to make legend smaller\r
368 \r
369   if (label[1].Contains("Trigger class")){\r
370     label[1].ReplaceAll("Trigger class","All");\r
371   }\r
372 \r
373   TString yTH1Dtitle = label[0];\r
374   yTH1Dtitle += " / ";\r
375   yTH1Dtitle += label[1];\r
376 \r
377   return yTH1Dtitle;\r
378 }\r
379 \r
380 //________________________________________________________________________________________________\r
381 void AliPSQAVisualization::ScaleMinAndMax(){ // Get maximum and minimum value of traghs to set bounds for overplot\r
382   Double_t tmp_max; // max values from tgraphs\r
383   Double_t tmp_min; // min values from tgraphs\r
384 \r
385   for (Int_t iplot = 0; iplot < fNSelectedPlots; iplot++){ // Loop over the number of plots to be made \r
386     // Set maximum\r
387     tmp_max = fDrawPlot[iplot].GetMaximum();\r
388     if (tmp_max > fMaximum){\r
389       fMaximum = tmp_max;\r
390     }\r
391     // Set minimum\r
392     tmp_min = fDrawPlot[iplot].GetMinimum();\r
393     if (tmp_max < fMinimum){\r
394       fMinimum = tmp_min;\r
395     }\r
396   }\r
397 \r
398   // Set the min to be lower and max to be higher so that all points can be seen\r
399   fMaximum *= fMultMax;\r
400   fMinimum /= fDivMin;\r
401 }\r
402 \r
403 //________________________________________________________________________________________________\r
404 void AliPSQAVisualization::MakeDir(TString dir){ // have to pass a private data member, kinda ugly, but otherwise use sentinel values or copy this function three times... taken from AliPSQA\r
405   TString mkDir = "mkdir -p ";\r
406   mkDir += dir.Data();\r
407   gSystem->Exec(mkDir); // mkdir for the cache/output\r
408 }\r
409 \r
410 //________________________________________________________________________________________________\r
411 void AliPSQAVisualization::ImportRunAndFillInfo(const Char_t * listOfRunsAndFills){\r
412 \r
413   Int_t run_num; //run number from list\r
414   ifstream input_runsandfill; //text file object\r
415   input_runsandfill.open(listOfRunsAndFills,ios::in );  //open the text file\r
416 \r
417   Int_t NRuns = 0; //number of runs to be processed\r
418   while(input_runsandfill >> run_num) { // count number of runs\r
419     NRuns++;\r
420   }\r
421   input_runsandfill.close();\r
422   cout << "In total there are " << NRuns << " runs in file " << endl;\r
423 \r
424   fNRawRuns = NRuns/3;\r
425   fRawFillNumbers = new Int_t[fNRawRuns];\r
426   fRawRunNumbers = new Int_t[fNRawRuns];\r
427   fRawRunStats = new Int_t[fNRawRuns];\r
428 \r
429   input_runsandfill.open(listOfRunsAndFills,ios::in );\r
430 \r
431   for(Int_t irun = 0; irun < fNRawRuns; irun++){\r
432     input_runsandfill >> fRawRunNumbers[irun] >> fRawFillNumbers[irun] >> fRawRunStats[irun];\r
433     cout << irun << " - " << fRawRunNumbers[irun] <<  " - " << fRawFillNumbers[irun] << " - stats = " << fRawRunStats[irun] <<  endl;\r
434   }\r
435   cout << "DONE " << endl;\r
436   input_runsandfill.close();\r
437   cout << "DONE DONE" << endl;\r
438 }\r
439 \r
440 //________________________________________________________________________________________________\r
441 void AliPSQAVisualization::DrawSelected(Int_t iplot){\r
442   fCanvas[iplot].cd(); // write to this canvas first\r
443   fCanvas[iplot].SetBottomMargin(0.15); // default 0.15\r
444   fCanvas[iplot].SetRightMargin(0.02);\r
445   /*\r
446     cout << ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " << endl;\r
447     cout << "iplot = " << iplot << endl;\r
448     cout << "Number of different fills for this plot " << fNDiffFills[iplot] <<  endl;\r
449     cout << "Plot name " << fSelectedPlots[iplot] << endl;\r
450     cout << " " << endl;\r
451     // here run check\r
452     */\r
453   fDrawPlot[iplot].GetXaxis()->SetTitleOffset(1.6);\r
454 \r
455   fDrawPlot[iplot].Draw("E P X0"); // draw the new plot to canvas\r
456 \r
457   cout << "Drawing " << fSelectedPlots[iplot] << endl;\r
458 \r
459   TLine * line = new TLine[fNDiffFills[iplot]];\r
460   for (Int_t lineIndex = 0; lineIndex < fNDiffFills[iplot]; lineIndex++){\r
461     //     cout << "Index pf plots that are processed = (" << iplot << "," << lineIndex << ")" << endl;\r
462     //   cout << "Copying line " << lineIndex << endl;\r
463     line[lineIndex] = fFillSeparationLine[iplot][lineIndex];\r
464     //  cout << "Copied - drawing line " << lineIndex << endl;\r
465     line[lineIndex].Draw("same");\r
466     //     cout << "Drawn line " << lineIndex << endl;\r
467     // cout << "*****************" << endl;\r
468   }// endl loop on bins\r
469    // cout << "COMPLETED " << endl;\r
470 \r
471 }\r
472 //________________________________________________________________________________________________\r
473 void AliPSQAVisualization::DrawSameTriggerOnSameCA(Int_t iplot){\r
474     \r
475   Bool_t containsstring = kFALSE;\r
476 \r
477   containsstring = fSelectedPlots[iplot].Contains("kINT7",TString::kExact);\r
478     \r
479   if(containsstring) cout << iplot << " - Sting " << fSelectedPlots[iplot] << " - contains string: yes " << endl;\r
480   else cout << iplot << " - Sting " << fSelectedPlots[iplot] << " - contains string: no " << endl;\r
481 }\r
482 \r
483 \r
484 //________________________________________________________________________________________________\r
485 void AliPSQAVisualization::DrawOverPlotCA(Int_t iplot){\r
486   if (iplot == 0){\r
487     fOverCanvas.cd();\r
488     fDrawPlot[iplot].SetMarkerColor(fColors[iplot]); // iplot == 0 for Color_t == white...\r
489     fDrawPlot[iplot].SetMarkerStyle(Style_t(iplot+20)); // 20 = big circle, afterwards, useful styles, otherwise too small\r
490     fDrawPlot[iplot].SetLineColor(fColors[iplot]);\r
491     fDrawPlot[iplot].SetTitle(fOverPlotTitle);\r
492     fOverLegend->AddEntry(&fDrawPlot[iplot],fDrawPlot[iplot].GetYaxis()->GetTitle(),"lep");\r
493     fDrawPlot[iplot].GetYaxis()->SetTitle("");\r
494     fDrawPlot[iplot].GetYaxis()->SetRangeUser(fMinimum, fMaximum);\r
495     // adding fill lines\r
496     \r
497     // end adding fill lines\r
498     fDrawPlot[iplot].Draw("E P X0");\r
499   }\r
500   else if (iplot == (fNSelectedPlots - 1) ){ \r
501     fOverCanvas.cd();\r
502     fDrawPlot[iplot].SetMarkerColor(fColors[iplot]);\r
503     fDrawPlot[iplot].SetMarkerStyle(Style_t(iplot+20)); // 20 = big circle, afterwards, useful styles, otherwise too small\r
504     fDrawPlot[iplot].SetLineColor(fColors[iplot]);\r
505     fDrawPlot[iplot].SetTitle(fOverPlotTitle);\r
506     fOverLegend->AddEntry(&fDrawPlot[iplot],fDrawPlot[iplot].GetYaxis()->GetTitle(),"lep");\r
507     fDrawPlot[iplot].GetYaxis()->SetTitle("");\r
508     fDrawPlot[iplot].Draw("E P X0 SAME");\r
509     //    fOverLegend->Draw();\r
510   }\r
511   else{\r
512     fOverCanvas.cd();\r
513     fDrawPlot[iplot].SetMarkerColor(fColors[iplot]);\r
514     fDrawPlot[iplot].SetMarkerStyle(Style_t(iplot+20)); // 20 = big circle, afterwards, useful styles, otherwise too small\r
515     fDrawPlot[iplot].SetLineColor(fColors[iplot]);\r
516     fDrawPlot[iplot].SetTitle(fOverPlotTitle);\r
517     fOverLegend->AddEntry(&fDrawPlot[iplot],fDrawPlot[iplot].GetYaxis()->GetTitle(),"lep");\r
518     fDrawPlot[iplot].GetYaxis()->SetTitle("");\r
519     fDrawPlot[iplot].Draw("E P X0 SAME");\r
520   }\r
521 }\r
522 \r
523 //________________________________________________________________________________________________\r
524 void AliPSQAVisualization::DrawOverPlotNoCA(Int_t iplot){\r
525   if (iplot == 0){\r
526     fOverCanvas.cd();\r
527     fDrawPlot[iplot].SetMarkerColor(Color_t(iplot+1)); // iplot == 0 for Color_t == white...\r
528     fDrawPlot[iplot].SetMarkerStyle(Style_t(iplot+20)); // 20 = big circle, afterwards, useful styles, otherwise too small\r
529     fDrawPlot[iplot].SetLineColor(Color_t(iplot+1));\r
530     fDrawPlot[iplot].SetTitle(fOverPlotTitle);\r
531     fOverLegend->AddEntry(&fDrawPlot[iplot],fDrawPlot[iplot].GetYaxis()->GetTitle(),"lep");\r
532     fDrawPlot[iplot].GetYaxis()->SetTitle("");\r
533     fDrawPlot[iplot].GetYaxis()->SetRangeUser(fMinimum, fMaximum);\r
534     fDrawPlot[iplot].Draw("E P X0");\r
535   }\r
536   else if (iplot == (fNSelectedPlots - 1) ){ \r
537     fOverCanvas.cd();\r
538     fDrawPlot[iplot].SetMarkerColor(Color_t(iplot+1));\r
539     fDrawPlot[iplot].SetMarkerStyle(Style_t(iplot+20)); // 20 = big circle, afterwards, useful styles, otherwise too small\r
540     fDrawPlot[iplot].SetLineColor(Color_t(iplot+1));\r
541     fDrawPlot[iplot].SetTitle(fOverPlotTitle);\r
542     fOverLegend->AddEntry(&fDrawPlot[iplot],fDrawPlot[iplot].GetYaxis()->GetTitle(),"lep");\r
543     fDrawPlot[iplot].GetYaxis()->SetTitle("");\r
544     fDrawPlot[iplot].Draw("E P X0 SAME");\r
545     fOverLegend->Draw();\r
546   }\r
547   else{\r
548     fOverCanvas.cd();\r
549     fDrawPlot[iplot].SetMarkerColor(Color_t(iplot+1));\r
550     fDrawPlot[iplot].SetMarkerStyle(Style_t(iplot+20)); // 20 = big circle, afterwards, useful styles, otherwise too small\r
551     fDrawPlot[iplot].SetLineColor(Color_t(iplot+1));\r
552     fDrawPlot[iplot].SetTitle(fOverPlotTitle);\r
553     fOverLegend->AddEntry(&fDrawPlot[iplot],fDrawPlot[iplot].GetYaxis()->GetTitle(),"lep");\r
554     fDrawPlot[iplot].GetYaxis()->SetTitle("");\r
555     fDrawPlot[iplot].Draw("P SAME");\r
556   }\r
557 }\r
558 \r
559 //________________________________________________________________________________________________\r
560 void AliPSQAVisualization::SaveToPDFSeparately(Int_t iplot){\r
561   cout << "Saving: " << fOutDirectory << "/" << fSelectedPlots[iplot] <<".pdf"<<endl;\r
562   fCanvas[iplot].SaveAs(Form("%s/%s.pdf",fOutDirectory.Data(),fSelectedPlots[iplot].Data()));\r
563 }\r
564 \r
565 //________________________________________________________________________________________________\r
566 void AliPSQAVisualization::SavePDFs(Int_t iplot){\r
567   if ( iplot == 0 ){ // Open the PDF file if to be saved and save the first plot\r
568     fCanvas[iplot].Print(Form("%s/%s(",fOutDirectory.Data(),fOutPDFName.Data()),"pdf");\r
569   }\r
570   else if ( (iplot == (fNSelectedPlots - 1)) && (!fSaveOverPlotPDF) ){ // Close the PDF and save the last plot\r
571     fCanvas[iplot].Print(Form("%s/%s)",fOutDirectory.Data(),fOutPDFName.Data()),"pdf");\r
572     fCanvas[iplot].SaveAs(Form("%s/%s_%d.pdf",fOutDirectory.Data(),fOutPDFName.Data(),iplot));\r
573   }\r
574   else{ // Save the PDF with the inbetween plots\r
575     fCanvas[iplot].Print(Form("%s/%s",fOutDirectory.Data(),fOutPDFName.Data()),"pdf");\r
576   }\r
577 }\r
578 \r
579 //________________________________________________________________________________________________\r
580 void AliPSQAVisualization::SaveOverPlotPDF(){\r
581   fOverCanvas.cd();\r
582   if (fSavePDFs){\r
583     fOverCanvas.Print(Form("%s/%s)",fOutDirectory.Data(),fOutPDFName.Data()),"pdf");\r
584   }\r
585   else{\r
586     fOverCanvas.Print(Form("%s/%s",fOutDirectory.Data(),fOutPDFName.Data()),"pdf");\r
587   }\r
588 }\r
589 \r
590 //________________________________________________________________________________________________\r
591 void AliPSQAVisualization::SaveOverPlotEPS(){\r
592   fOverCanvas.cd();\r
593   fOverCanvas.Print(Form("%s/%s",fOutDirectory.Data(),fOutEPSName.Data()),"eps");\r
594 }\r
595 \r
596 //________________________________________________________________________________________________\r
597 \r
598 \r