AliPhysics  32954cd (32954cd)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DrawProductionComparison.C
Go to the documentation of this file.
1 
40 
41 //---------------------------------------------------------
42 // Set includes and declare methods for compilation
43 
44 #if !defined(__CINT__) || defined(__MAKECINT__)
45 
46 #include <TFile.h>
47 #include <TDirectoryFile.h>
48 #include <TList.h>
49 #include <TString.h>
50 #include <TROOT.h>
51 #include <TStyle.h>
52 #include <TH1F.h>
53 #include <TH2F.h>
54 #include <TCanvas.h>
55 #include <TPad.h>
56 #include <TLegend.h>
57 #include <TObject.h>
58 #include <TAxis.h>
59 #include <TGaxis.h>
60 #include <TLine.h>
61 #include <TF1.h>
62 #include <TMath.h>
63 
64 #endif
65 
66 void ProcessTrigger
67 (TString trigName = "default",
68  TString fileName = "AnalysisResults.root",
69  TString listName = "Pi0IM_GammaTrackCorr_EMCAL");
70 
71 void CaloQA (Int_t icalo);
72 void CorrelQA (Int_t icalo);
73 
74 void TrackQA ();
75 void VertexQA();
76 void CentralityQA();
77 
78 TObject * GetHisto (TString histoName, Int_t iprod);
80 //
81 //---------------------------------------------------------
82 
83 //-----------------------
84 // Some global variables
85 
87 TString prod [] = {"DCAoffPIDoff","DCAonPIDoff","DCAoffPIDon","DCAonPIDon"};
89 TString prodLeg[] = {"DCA off - PID off","DCA on - PID off","DCA off - PID on","DCA on - PID on"};
90 const Int_t nProd = 4;
91 
92 TDirectoryFile *dir[nProd];
94 TFile *file [nProd];
96 
98 TString format = "eps";
99 
101 Int_t color[]={kBlack,kRed,kBlue,kOrange+1,kYellow+1,kGreen+2,kCyan+1,kViolet,kMagenta+2,kGray};
102 //-----------------------
103 
104 //_______________________________________________________________________
110 //_______________________________________________________________________
112 (
113  TString listName = "Pi0IM_GammaTrackCorr_EMCAL",
114  TString fileName = "AnalysisResults.root",
115  TString fileFormat = "eps"
116  )
117 {
118  format = fileFormat;
119 
120  printf("Open <%s>; Get List : <%s>; format %s\n",fileName.Data(),listName.Data(),format.Data());
121 
122  // Process each of the triggers
123  //
124  ProcessTrigger("default" ,fileName,listName);
125  ProcessTrigger("EMCAL_L0",fileName,listName);
126  ProcessTrigger("EMCAL_L1",fileName,listName);
127  ProcessTrigger("EMCAL_L2",fileName,listName);
128  ProcessTrigger("DCAL_L0" ,fileName,listName);
129  ProcessTrigger("DCAL_L1" ,fileName,listName);
130  ProcessTrigger("DCAL_L2" ,fileName,listName);
131 }
132 
147 //_______________________________________________________________________
148 void ProcessTrigger(TString trigName, TString fileName, TString listName)
149 {
150  // Access the file and list of histograms, global variables
151  // Check first that the requested trigger exist
152  Bool_t ok = GetFileAndList(fileName, listName, trigName);
153  if ( !ok ) return;
154 
155  gStyle->SetOptTitle(1);
156  gStyle->SetOptStat(0);
157  gStyle->SetOptFit(000000);
158  gStyle->SetPadRightMargin(0.02);
159  //gStyle->SetPadTopMargin(0.02);
160  //gStyle->SetPadLeftMargin(0.15);
161  gStyle->SetTitleFontSize(0.05);
162 
163  Int_t nCalo = 2;
164  Int_t calo = 0;
165  if (trigName.Contains("EMCAL")) { calo = 0 ; nCalo = 1 ; }
166  else if(trigName.Contains("DCAL" )) { calo = 1 ; nCalo = 2 ; }
167 
168  TString caloString [] = {"EMCAL","DCAL"};
169 
170  histoTag = trigName;
171 
172  // Plot basic Track QA
173  TrackQA();
174 
175  VertexQA();
176 
177  CentralityQA();
178 
179  for(Int_t icalo = calo; icalo < nCalo; icalo++)
180  {
181  if(trigName.Contains("default")) histoTag=Form("%s_%s",caloString[icalo].Data(),trigName.Data());
182 
183  // Plot basic QA
184  CaloQA(icalo);
185 
186  // Plot basic correlation QA
187  CorrelQA(icalo);
188  }
189 }
190 
200 //______________________________________
201 void CaloQA(Int_t icalo)
202 {
203  // Declare the different histograms, arrays input is production
204  TH1F* hRaw [nProd];
205  TH1F* hCorr[nProd];
206  TH1F* hTM [nProd];
207  TH1F* hShSh[nProd];
208 
209  TH1F* hRatRaw [nProd-1];
210  TH1F* hRatCorr[nProd-1];
211  TH1F* hRatTM [nProd-1];
212  TH1F* hRatShSh[nProd-1];
213 
214  TH2F* h2TrackMatchResEtaNeg[nProd];
215  TH2F* h2TrackMatchResEtaPos[nProd];
216  TH2F* h2TrackMatchResPhiNeg[nProd];
217  TH2F* h2TrackMatchResPhiPos[nProd];
218 
219  TH1F* hTrackMatchResEtaNeg[nProd];
220  TH1F* hTrackMatchResEtaPos[nProd];
221  TH1F* hTrackMatchResPhiNeg[nProd];
222  TH1F* hTrackMatchResPhiPos[nProd];
223 
224  TH1F* hRatTrackMatchResEtaNeg[nProd-1];
225  TH1F* hRatTrackMatchResEtaPos[nProd-1];
226  TH1F* hRatTrackMatchResPhiNeg[nProd-1];
227  TH1F* hRatTrackMatchResPhiPos[nProd-1];
228 
229  TH2F* h2TrackMatchResEtaNegTrackPt[nProd];
230  TH2F* h2TrackMatchResEtaPosTrackPt[nProd];
231  TH2F* h2TrackMatchResPhiNegTrackPt[nProd];
232  TH2F* h2TrackMatchResPhiPosTrackPt[nProd];
233 
234  TH1F* hTrackMatchResEtaNegTrackPt[nProd];
235  TH1F* hTrackMatchResEtaPosTrackPt[nProd];
236  TH1F* hTrackMatchResPhiNegTrackPt[nProd];
237  TH1F* hTrackMatchResPhiPosTrackPt[nProd];
238 
239  TH1F* hRatTrackMatchResEtaNegTrackPt[nProd-1];
240  TH1F* hRatTrackMatchResEtaPosTrackPt[nProd-1];
241  TH1F* hRatTrackMatchResPhiNegTrackPt[nProd-1];
242  TH1F* hRatTrackMatchResPhiPosTrackPt[nProd-1];
243 
244  //Legend for productions
245  TLegend lprod(0.6,0.475,0.95,0.675);
246  lprod.SetTextSize(0.04);
247  lprod.SetBorderSize(0);
248  lprod.SetFillColor(0);
249 
250  for(Int_t iprod = 0; iprod < nProd; iprod++)
251  {
252  hRaw [iprod] = (TH1F*) GetHisto(Form("AnaPhoton_Calo%d_hPt_Cut_0_Open" ,icalo),iprod);
253  hCorr[iprod] = (TH1F*) GetHisto(Form("AnaPhoton_Calo%d_hPt_Cut_4_NCells" ,icalo),iprod);
254  hTM [iprod] = (TH1F*) GetHisto(Form("AnaPhoton_Calo%d_hPt_Cut_7_Matching",icalo),iprod);
255  hShSh[iprod] = (TH1F*) GetHisto(Form("AnaPhoton_Calo%d_hPt_Cut_9_PID" ,icalo),iprod);
256 
257  if(!hRaw[iprod]) return;
258 
259  hRaw [iprod]->Sumw2();
260  hCorr[iprod]->Sumw2();
261  hTM [iprod]->Sumw2();
262  hShSh[iprod]->Sumw2();
263 
264  hRaw [iprod]->Scale(1./nEvents[iprod]);
265  hCorr[iprod]->Scale(1./nEvents[iprod]);
266  hTM [iprod]->Scale(1./nEvents[iprod]);
267  hShSh[iprod]->Scale(1./nEvents[iprod]);
268 
269  hRaw[iprod]->SetMarkerColor(color[iprod]);
270  hRaw[iprod]->SetMarkerStyle(24);
271 
272  hCorr[iprod]->SetTitle("Cluster spectra with/out cuts");
273  hCorr[iprod]->SetYTitle("1/N_{events} dN/dp_{T}");
274 
275  hCorr[iprod]->SetTitleOffset(1.5,"Y");
276  hCorr[iprod]->SetMarkerColor(color[iprod]);
277  hCorr[iprod]->SetMarkerStyle(20);
278  hCorr[iprod]->SetAxisRange(0.,30.,"X");
279  //hCorr[iprod]->SetMaximum(1.1);
280  //hCorr[iprod]->SetMinimum(0);
281 
282  hTM [iprod]->SetMarkerColor(color[iprod]);
283  hTM [iprod]->SetMarkerStyle(21);
284 
285  hShSh[iprod]->SetMarkerColor(color[iprod]);
286  hShSh[iprod]->SetMarkerStyle(22);
287 
288  hRaw [iprod]->SetTitleOffset(1.5,"Y");
289  hTM [iprod]->SetTitleOffset(1.5,"Y");
290  hShSh[iprod]->SetTitleOffset(1.5,"Y");
291  hCorr[iprod]->SetTitleOffset(1.5,"Y");
292 
293  if(iprod > 0)
294  {
295  hRatRaw [iprod-1] = (TH1F*)hRaw [iprod]->Clone(Form("hRatRaw%s_%s" ,prod[iprod].Data(),histoTag.Data()));
296  hRatCorr[iprod-1] = (TH1F*)hCorr[iprod]->Clone(Form("hRatCorr%s_%s",prod[iprod].Data(),histoTag.Data()));
297  hRatTM [iprod-1] = (TH1F*)hTM [iprod]->Clone(Form("hRatTM%s_%s" ,prod[iprod].Data(),histoTag.Data()));
298  hRatShSh[iprod-1] = (TH1F*)hShSh[iprod]->Clone(Form("hRatShSh%s_%s",prod[iprod].Data(),histoTag.Data()));
299 
300  hRatRaw [iprod-1]->Divide(hRatRaw [iprod-1],hRaw [0],1.000,1,"B");
301  hRatCorr[iprod-1]->Divide(hRatCorr[iprod-1],hCorr[0],0.975,1,"B");
302  hRatTM [iprod-1]->Divide(hRatTM [iprod-1],hTM [0],0.950,1,"B");
303  hRatShSh[iprod-1]->Divide(hRatShSh[iprod-1],hShSh[0],0.925,1,"B");
304  }
305 
306  // Cluster-Track Matching Residuals
307 
308  // E cluster bin
309  h2TrackMatchResEtaNeg[iprod] = (TH2F*) GetHisto(Form("AnaPhoton_Calo%d_hTrackMatchedDEtaNegNoCut",icalo),iprod);
310  h2TrackMatchResEtaPos[iprod] = (TH2F*) GetHisto(Form("AnaPhoton_Calo%d_hTrackMatchedDEtaPosNoCut",icalo),iprod);
311  h2TrackMatchResPhiNeg[iprod] = (TH2F*) GetHisto(Form("AnaPhoton_Calo%d_hTrackMatchedDPhiNegNoCut",icalo),iprod);
312  h2TrackMatchResPhiPos[iprod] = (TH2F*) GetHisto(Form("AnaPhoton_Calo%d_hTrackMatchedDPhiPosNoCut",icalo),iprod);
313 
314  Float_t emin = 0.5;
315  Float_t emax = 2.5;
316  if ( histoTag.Contains("L0") )
317  {
318  emin = 2.5;
319  emax = 5;
320  }
321  else if ( histoTag.Contains("L1") )
322  {
323  emin = 5;
324  emax = 15;
325  }
326  else if ( histoTag.Contains("L2") )
327  {
328  emin = 5;
329  emax = 15;
330  }
331 
332  Float_t binMin = h2TrackMatchResEtaNeg[iprod]->GetXaxis()->FindBin(emin);
333  Float_t binMax = h2TrackMatchResEtaNeg[iprod]->GetXaxis()->FindBin(emax);
334 
335  hTrackMatchResEtaNeg[iprod] =
336  (TH1F*) h2TrackMatchResEtaNeg[iprod]->ProjectionY(Form("TMProjEtaNeg%s_%s",
337  prod[iprod].Data(),histoTag.Data()),binMin, binMax);
338  hTrackMatchResEtaPos[iprod] =
339  (TH1F*) h2TrackMatchResEtaPos[iprod]->ProjectionY(Form("TMProjEtaPos%s_%s",
340  prod[iprod].Data(),histoTag.Data()),binMin, binMax);
341  hTrackMatchResPhiNeg[iprod] =
342  (TH1F*) h2TrackMatchResPhiNeg[iprod]->ProjectionY(Form("TMProjPhiNeg%s_%s",
343  prod[iprod].Data(),histoTag.Data()),binMin, binMax);
344  hTrackMatchResPhiPos[iprod] =
345  (TH1F*) h2TrackMatchResPhiPos[iprod]->ProjectionY(Form("TMProjPhiPos%s_%s",
346  prod[iprod].Data(),histoTag.Data()),binMin, binMax);
347 
348  hTrackMatchResEtaNeg[iprod]->SetXTitle("#Delta #eta");
349  hTrackMatchResEtaNeg[iprod]->SetYTitle("Entries / N events");
350  hTrackMatchResEtaNeg[iprod]->SetTitle(Form("Track-cluster #eta residuals, %2.1f < #it{E}^{cluster} < %2.1f GeV",emin,emax));
351  hTrackMatchResEtaNeg[iprod]->SetAxisRange(-0.025,0.025,"X");
352  hTrackMatchResEtaNeg[iprod]->Sumw2();
353  hTrackMatchResEtaNeg[iprod]->SetMarkerStyle(24);
354  hTrackMatchResEtaNeg[iprod]->SetMarkerColor(color[iprod]);
355 
356  hTrackMatchResEtaPos[iprod]->Sumw2();
357  hTrackMatchResEtaPos[iprod]->SetYTitle("Entries / N events");
358  hTrackMatchResEtaPos[iprod]->SetXTitle("#Delta #eta");
359  hTrackMatchResEtaPos[iprod]->SetTitle(Form("Track-cluster #eta residuals, %2.1f < #it{E}^{cluster} < %2.1f GeV",emin,emax));
360  hTrackMatchResEtaPos[iprod]->SetAxisRange(-0.025,0.025,"X");
361  hTrackMatchResEtaPos[iprod]->SetMarkerStyle(25);
362  hTrackMatchResEtaPos[iprod]->SetMarkerColor(color[iprod]);
363 
364  hTrackMatchResPhiNeg[iprod]->SetXTitle("#Delta #varphi");
365  hTrackMatchResPhiNeg[iprod]->SetTitle(Form("Track-cluster #varphi residuals, %2.1f < #it{E}^{cluster} < %2.1f GeV",emin,emax));
366  hTrackMatchResPhiNeg[iprod]->SetYTitle("entries / N events");
367  hTrackMatchResPhiNeg[iprod]->SetAxisRange(-0.025,0.025,"X");
368  hTrackMatchResPhiNeg[iprod]->Sumw2();
369  hTrackMatchResPhiNeg[iprod]->SetMarkerStyle(24);
370  hTrackMatchResPhiNeg[iprod]->SetMarkerColor(color[iprod]);
371 
372  hTrackMatchResPhiPos[iprod]->Sumw2();
373  hTrackMatchResPhiPos[iprod]->SetYTitle("Entries / N events");
374  hTrackMatchResPhiPos[iprod]->SetXTitle("#Delta #varphi");
375  hTrackMatchResPhiPos[iprod]->SetTitle(Form("Track-cluster #varphi residuals, %2.1f < #it{E}^{cluster} < %2.1f GeV",emin,emax));
376  hTrackMatchResPhiPos[iprod]->SetAxisRange(-0.025,0.025,"X");
377  hTrackMatchResPhiPos[iprod]->SetMarkerStyle(25);
378  hTrackMatchResPhiPos[iprod]->SetMarkerColor(color[iprod]);
379 
380  hTrackMatchResEtaNeg[iprod]->Scale(1./nEvents[iprod]);
381  hTrackMatchResEtaPos[iprod]->Scale(1./nEvents[iprod]);
382  hTrackMatchResPhiNeg[iprod]->Scale(1./nEvents[iprod]);
383  hTrackMatchResPhiPos[iprod]->Scale(1./nEvents[iprod]);
384 
385  hTrackMatchResEtaNeg[iprod]->SetTitleOffset(1.5,"Y");
386  hTrackMatchResEtaPos[iprod]->SetTitleOffset(1.5,"Y");
387  hTrackMatchResPhiNeg[iprod]->SetTitleOffset(1.5,"Y");
388  hTrackMatchResPhiPos[iprod]->SetTitleOffset(1.5,"Y");
389 
390  if(iprod > 0)
391  {
392  hRatTrackMatchResPhiPos[iprod-1] =
393  (TH1F*)hTrackMatchResPhiPos[iprod]->Clone(Form("hRatPhiPos%s_%s",prod[iprod].Data(),histoTag.Data()));
394  hRatTrackMatchResPhiNeg[iprod-1] =
395  (TH1F*)hTrackMatchResPhiNeg[iprod]->Clone(Form("hRatPhiNeg%s_%s",prod[iprod].Data(),histoTag.Data()));
396  hRatTrackMatchResEtaPos[iprod-1] =
397  (TH1F*)hTrackMatchResEtaPos[iprod]->Clone(Form("hRatEtaPos%s_%s",prod[iprod].Data(),histoTag.Data()));
398  hRatTrackMatchResEtaNeg[iprod-1] =
399  (TH1F*)hTrackMatchResEtaNeg[iprod]->Clone(Form("hRatEtaNeg%s_%s",prod[iprod].Data(),histoTag.Data()));
400 
401  hRatTrackMatchResPhiPos[iprod-1]->Divide(hRatTrackMatchResPhiPos[iprod-1],hTrackMatchResPhiPos[0],1.000,1,"B");
402  hRatTrackMatchResPhiNeg[iprod-1]->Divide(hRatTrackMatchResPhiNeg[iprod-1],hTrackMatchResPhiNeg[0],1.000,1,"B");
403  hRatTrackMatchResEtaPos[iprod-1]->Divide(hRatTrackMatchResEtaPos[iprod-1],hTrackMatchResEtaPos[0],1.000,1,"B");
404  hRatTrackMatchResEtaNeg[iprod-1]->Divide(hRatTrackMatchResEtaNeg[iprod-1],hTrackMatchResEtaNeg[0],1.000,1,"B");
405  }
406 
407  // pt track bin
408  h2TrackMatchResEtaNegTrackPt[iprod] = (TH2F*) GetHisto(Form("AnaPhoton_Calo%d_hTrackMatchedDEtaNegTrackPtNoCut",icalo),iprod);
409  h2TrackMatchResEtaPosTrackPt[iprod] = (TH2F*) GetHisto(Form("AnaPhoton_Calo%d_hTrackMatchedDEtaPosTrackPtNoCut",icalo),iprod);
410  h2TrackMatchResPhiNegTrackPt[iprod] = (TH2F*) GetHisto(Form("AnaPhoton_Calo%d_hTrackMatchedDPhiNegTrackPtNoCut",icalo),iprod);
411  h2TrackMatchResPhiPosTrackPt[iprod] = (TH2F*) GetHisto(Form("AnaPhoton_Calo%d_hTrackMatchedDPhiPosTrackPtNoCut",icalo),iprod);
412 
413  if ( !h2TrackMatchResEtaNegTrackPt[iprod] ) continue;
414 
415  binMin = h2TrackMatchResEtaNegTrackPt[iprod]->GetXaxis()->FindBin(emin);
416  binMax = h2TrackMatchResEtaNegTrackPt[iprod]->GetXaxis()->FindBin(emax);
417 
418  hTrackMatchResEtaNegTrackPt[iprod] =
419  (TH1F*) h2TrackMatchResEtaNegTrackPt[iprod]->ProjectionY(Form("TMProjEtaNegTrackPt%s_%s",
420  prod[iprod].Data(),histoTag.Data()),binMin, binMax);
421  hTrackMatchResEtaPosTrackPt[iprod] =
422  (TH1F*) h2TrackMatchResEtaPosTrackPt[iprod]->ProjectionY(Form("TMProjEtaPosTrackPt%s_%s",
423  prod[iprod].Data(),histoTag.Data()),binMin, binMax);
424  hTrackMatchResPhiNegTrackPt[iprod] =
425  (TH1F*) h2TrackMatchResPhiNegTrackPt[iprod]->ProjectionY(Form("TMProjPhiNegTrackPt%s_%s",
426  prod[iprod].Data(),histoTag.Data()),binMin, binMax);
427  hTrackMatchResPhiPosTrackPt[iprod] =
428  (TH1F*) h2TrackMatchResPhiPosTrackPt[iprod]->ProjectionY(Form("TMProjPhiPosTrackPt%s_%s",
429  prod[iprod].Data(),histoTag.Data()),binMin, binMax);
430 
431  hTrackMatchResEtaNegTrackPt[iprod]->SetXTitle("#Delta #eta");
432  hTrackMatchResEtaNegTrackPt[iprod]->SetYTitle("Entries / N events");
433  hTrackMatchResEtaNegTrackPt[iprod]->SetTitle(Form("Track-cluster #eta residuals, %2.1f < #it{p}_{T}^{track} < %2.1f GeV",emin,emax));
434  hTrackMatchResEtaNegTrackPt[iprod]->SetAxisRange(-0.025,0.025,"X");
435  hTrackMatchResEtaNegTrackPt[iprod]->Sumw2();
436  hTrackMatchResEtaNegTrackPt[iprod]->SetMarkerStyle(24);
437  hTrackMatchResEtaNegTrackPt[iprod]->SetMarkerColor(color[iprod]);
438 
439  hTrackMatchResEtaPosTrackPt[iprod]->Sumw2();
440  hTrackMatchResEtaPosTrackPt[iprod]->SetYTitle("Entries / N events");
441  hTrackMatchResEtaPosTrackPt[iprod]->SetXTitle("#Delta #eta");
442  hTrackMatchResEtaPosTrackPt[iprod]->SetTitle(Form("Track-cluster #eta residuals, %2.1f < #it{p}_{T}^{track} < %2.1f GeV",emin,emax));
443  hTrackMatchResEtaPosTrackPt[iprod]->SetAxisRange(-0.025,0.025,"X");
444  hTrackMatchResEtaPosTrackPt[iprod]->SetMarkerStyle(25);
445  hTrackMatchResEtaPosTrackPt[iprod]->SetMarkerColor(color[iprod]);
446 
447  hTrackMatchResPhiNegTrackPt[iprod]->SetXTitle("#Delta #varphi");
448  hTrackMatchResPhiNegTrackPt[iprod]->SetTitle(Form("Track-cluster #varphi residuals, %2.1f < #it{p}_{T}^{track} < %2.1f GeV",emin,emax));
449  hTrackMatchResPhiNegTrackPt[iprod]->SetYTitle("entries / N events");
450  hTrackMatchResPhiNegTrackPt[iprod]->SetAxisRange(-0.025,0.025,"X");
451  hTrackMatchResPhiNegTrackPt[iprod]->Sumw2();
452  hTrackMatchResPhiNegTrackPt[iprod]->SetMarkerStyle(24);
453  hTrackMatchResPhiNegTrackPt[iprod]->SetMarkerColor(color[iprod]);
454 
455  hTrackMatchResPhiPosTrackPt[iprod]->Sumw2();
456  hTrackMatchResPhiPosTrackPt[iprod]->SetYTitle("Entries / N events");
457  hTrackMatchResPhiPosTrackPt[iprod]->SetXTitle("#Delta #varphi");
458  hTrackMatchResPhiPosTrackPt[iprod]->SetTitle(Form("Track-cluster #varphi residuals, %2.1f < #it{p}_{T}^{track} < %2.1f GeV",emin,emax));
459  hTrackMatchResPhiPosTrackPt[iprod]->SetAxisRange(-0.025,0.025,"X");
460  hTrackMatchResPhiPosTrackPt[iprod]->SetMarkerStyle(25);
461  hTrackMatchResPhiPosTrackPt[iprod]->SetMarkerColor(color[iprod]);
462 
463  hTrackMatchResEtaNegTrackPt[iprod]->Scale(1./nEvents[iprod]);
464  hTrackMatchResEtaPosTrackPt[iprod]->Scale(1./nEvents[iprod]);
465  hTrackMatchResPhiNegTrackPt[iprod]->Scale(1./nEvents[iprod]);
466  hTrackMatchResPhiPosTrackPt[iprod]->Scale(1./nEvents[iprod]);
467 
468  hTrackMatchResEtaNegTrackPt[iprod]->SetTitleOffset(1.5,"Y");
469  hTrackMatchResEtaPosTrackPt[iprod]->SetTitleOffset(1.5,"Y");
470  hTrackMatchResPhiNegTrackPt[iprod]->SetTitleOffset(1.5,"Y");
471  hTrackMatchResPhiPosTrackPt[iprod]->SetTitleOffset(1.5,"Y");
472 
473  if(iprod > 0)
474  {
475  hRatTrackMatchResPhiPosTrackPt[iprod-1] =
476  (TH1F*)hTrackMatchResPhiPosTrackPt[iprod]->Clone(Form("hRatPhiPos%s_%s",prod[iprod].Data(),histoTag.Data()));
477  hRatTrackMatchResPhiNegTrackPt[iprod-1] =
478  (TH1F*)hTrackMatchResPhiNegTrackPt[iprod]->Clone(Form("hRatPhiNeg%s_%s",prod[iprod].Data(),histoTag.Data()));
479  hRatTrackMatchResEtaPosTrackPt[iprod-1] =
480  (TH1F*)hTrackMatchResEtaPosTrackPt[iprod]->Clone(Form("hRatEtaPos%s_%s",prod[iprod].Data(),histoTag.Data()));
481  hRatTrackMatchResEtaNegTrackPt[iprod-1] =
482  (TH1F*)hTrackMatchResEtaNegTrackPt[iprod]->Clone(Form("hRatEtaNeg%s_%s",prod[iprod].Data(),histoTag.Data()));
483 
484  hRatTrackMatchResPhiPosTrackPt[iprod-1]->Divide(hRatTrackMatchResPhiPosTrackPt[iprod-1],hTrackMatchResPhiPosTrackPt[0],1.000,1,"B");
485  hRatTrackMatchResPhiNegTrackPt[iprod-1]->Divide(hRatTrackMatchResPhiNegTrackPt[iprod-1],hTrackMatchResPhiNegTrackPt[0],1.000,1,"B");
486  hRatTrackMatchResEtaPosTrackPt[iprod-1]->Divide(hRatTrackMatchResEtaPosTrackPt[iprod-1],hTrackMatchResEtaPosTrackPt[0],1.000,1,"B");
487  hRatTrackMatchResEtaNegTrackPt[iprod-1]->Divide(hRatTrackMatchResEtaNegTrackPt[iprod-1],hTrackMatchResEtaNegTrackPt[0],1.000,1,"B");
488  }
489 
490  } // prod loop
491 
492 
494  // Make the plots
496  {
497  TCanvas * ccalo = new TCanvas(Form("Cluster_%s",histoTag.Data()),"",1000,500);
498  ccalo->Divide(2,1);
499 
500  ccalo->cd(1);
501  gPad->SetLogy();
502  //gPad->SetLogx();
503 
504  hCorr[0]->Draw();
505  for(Int_t iprod = 0; iprod < nProd; iprod++)
506  {
507  hRaw [iprod]->Draw("same");
508  hCorr[iprod]->Draw("same");
509  hTM [iprod]->Draw("same");
510  hShSh[iprod]->Draw("same");
511 
512  lprod.AddEntry(hRaw[iprod],prodLeg[iprod],"P");
513  }
514 
515  lprod.Draw();
516 
517  TLegend lcl(0.55,0.7,0.95,0.89);
518  lcl.SetTextSize(0.04);
519  lcl.SetBorderSize(0);
520  lcl.SetFillColor(0);
521  lcl.AddEntry(hRaw [0],"Raw","P");
522  lcl.AddEntry(hCorr[0],"No Exotics + non lin.","P");
523  lcl.AddEntry(hTM [0], "+ Track matching","P");
524  lcl.AddEntry(hShSh[0],"+ #lambda^{2}_{0} < 0.4","P");
525  lcl.Draw();
526 
527  ccalo->cd(2);
528  //gPad->SetLogy();
529  //gPad->SetLogx();
530 
531  hRatCorr[0]->SetTitle("Cluster spectra ratio");
532  hRatCorr[0]->SetYTitle(Form("Ratio data X / %s",prodLeg[0].Data()));
533  hRatCorr[0]->SetMinimum(0.850);
534  hRatCorr[0]->SetMaximum(1.025);
535  hRatCorr[0]->Draw("");
536 
537  for(Int_t iprod = 0; iprod < nProd-1; iprod++)
538  {
539  hRatRaw [iprod]->Draw("same");
540  hRatCorr[iprod]->Draw("same");
541  hRatTM [iprod]->Draw("same");
542  hRatShSh[iprod]->Draw("same");
543  }
544 
545  TLine l1(0,1,30,1);
546  TLine l2(0,0.975,30,0.975);
547  TLine l3(0,0.95,30,0.95);
548  TLine l4(0,0.925,30,0.925);
549 
550  l1.Draw("same");
551  l2.Draw("same");
552  l3.Draw("same");
553  l4.Draw("same");
554 
555  ccalo->Print(Form("%s_ClusterSpectraComp.%s",histoTag.Data(),format.Data()));
556  }
557 
558  // Cluster-Track Matching Residual
559  {
560  TGaxis::SetMaxDigits(3);
561 
562  TLine l0Eta(0,hTrackMatchResEtaNeg[0]->GetMinimum(),0,hTrackMatchResEtaNeg[0]->GetMaximum());
563 
564  TLegend lres(0.6,0.75,0.84,0.89);
565  lres.SetTextSize(0.04);
566  //lres.SetBorderSize(0);
567  lres.SetFillColor(0);
568  lres.AddEntry(hTrackMatchResEtaNeg[0],"Negative","P");
569  lres.AddEntry(hTrackMatchResEtaPos[0],"Positive","P");
570  lres.Draw();
571 
572  TCanvas * ccalo2 = new TCanvas(Form("MatchingResiduals_%s",histoTag.Data()),"",1000,1000);
573  ccalo2->Divide(2,2);
574 
575  ccalo2->cd(1);
576  //gPad->SetLogy();
577 
578  hTrackMatchResEtaPos[0]->SetMaximum(hTrackMatchResEtaPos[0]->GetMaximum()*1.3);
579 
580  hTrackMatchResEtaPos[0]->Draw("");
581  for(Int_t iprod = 0; iprod < nProd; iprod++)
582  {
583  hTrackMatchResEtaNeg[iprod]->Draw("same");
584  hTrackMatchResEtaPos[iprod]->Draw("same");
585  }
586 
587  l0Eta.SetLineColor(2);
588  l0Eta.SetLineWidth(2);
589  l0Eta.Draw("same");
590 
591  lres.Draw();
592  lprod.Draw();
593  ccalo2->cd(2);
594 
595  hTrackMatchResPhiPos[0]->Draw("");
596  for(Int_t iprod = 0; iprod < nProd; iprod++)
597  {
598  hTrackMatchResPhiNeg[iprod]->Draw("same");
599  hTrackMatchResPhiPos[iprod]->Draw("same");
600  }
601 
602  TLine l0Phi(0,hTrackMatchResPhiNeg[0]->GetMinimum(),0,hTrackMatchResPhiNeg[0]->GetMaximum());
603  l0Phi.SetLineColor(2);
604  l0Phi.SetLineWidth(2);
605  l0Phi.Draw("same");
606 
607  ccalo2->cd(3);
608  //gPad->SetLogy();
609 
610  hRatTrackMatchResEtaPos[0]->SetMaximum(1.2);
611  hRatTrackMatchResEtaPos[0]->SetMinimum(0.8);
612  hRatTrackMatchResEtaPos[0]->Draw("");
613  hRatTrackMatchResEtaPos[0]->SetYTitle(Form("Ratio data X / %s",prodLeg[0].Data()));
614  for(Int_t iprod = 0; iprod < nProd-1; iprod++)
615  {
616  hRatTrackMatchResEtaNeg[iprod]->Draw("same");
617  hRatTrackMatchResEtaPos[iprod]->Draw("same");
618  }
619 
620  //l0.Draw("same");
621 
622  ccalo2->cd(4);
623 
624  hRatTrackMatchResPhiPos[0]->SetMaximum(1.2);
625  hRatTrackMatchResPhiPos[0]->SetMinimum(0.8);
626  hRatTrackMatchResPhiPos[0]->Draw("");
627  hRatTrackMatchResPhiPos[0]->SetYTitle(Form("Ratio data X / %s",prodLeg[0].Data()));
628  for(Int_t iprod = 0; iprod < nProd-1; iprod++)
629  {
630  hRatTrackMatchResPhiNeg[iprod]->Draw("same");
631  hRatTrackMatchResPhiPos[iprod]->Draw("same");
632  }
633 
634  ccalo2->Print(Form("%s_MatchingResidualsComp.%s",histoTag.Data(),format.Data()));
635  }
636 
637  // Cluster-Track Matching Residual, pT track bin
638  if ( h2TrackMatchResEtaNegTrackPt[0] )
639  {
640  TGaxis::SetMaxDigits(3);
641 
642  TLine l0Eta(0,hTrackMatchResEtaNeg[0]->GetMinimum(),0,hTrackMatchResEtaNeg[0]->GetMaximum());
643 
644  TLegend lres(0.6,0.75,0.84,0.89);
645  lres.SetTextSize(0.04);
646  //lres.SetBorderSize(0);
647  lres.SetFillColor(0);
648  lres.AddEntry(hTrackMatchResEtaNeg[0],"Negative","P");
649  lres.AddEntry(hTrackMatchResEtaPos[0],"Positive","P");
650  lres.Draw();
651 
652  TCanvas * ccalo3 = new TCanvas(Form("MatchingResiduals_TrackPtBin_%s",histoTag.Data()),"",1000,1000);
653  ccalo3->Divide(2,2);
654 
655  ccalo3->cd(1);
656  //gPad->SetLogy();
657 
658  hTrackMatchResEtaPosTrackPt[0]->SetMaximum(hTrackMatchResEtaPosTrackPt[0]->GetMaximum()*1.3);
659 
660  hTrackMatchResEtaPosTrackPt[0]->Draw("");
661  for(Int_t iprod = 0; iprod < nProd; iprod++)
662  {
663  hTrackMatchResEtaNegTrackPt[iprod]->Draw("same");
664  hTrackMatchResEtaPosTrackPt[iprod]->Draw("same");
665  }
666 
667  l0Eta.SetLineColor(2);
668  l0Eta.SetLineWidth(2);
669  l0Eta.Draw("same");
670 
671  lres.Draw();
672  lprod.Draw();
673  ccalo3->cd(2);
674 
675  hTrackMatchResPhiPosTrackPt[0]->Draw("");
676  for(Int_t iprod = 0; iprod < nProd; iprod++)
677  {
678  hTrackMatchResPhiNegTrackPt[iprod]->Draw("same");
679  hTrackMatchResPhiPosTrackPt[iprod]->Draw("same");
680  }
681 
682  TLine l0Phi(0,hTrackMatchResPhiNegTrackPt[0]->GetMinimum(),0,hTrackMatchResPhiNegTrackPt[0]->GetMaximum());
683  l0Phi.SetLineColor(2);
684  l0Phi.SetLineWidth(2);
685  l0Phi.Draw("same");
686 
687  ccalo3->cd(3);
688  //gPad->SetLogy();
689 
690  hRatTrackMatchResEtaPosTrackPt[0]->SetMaximum(1.2);
691  hRatTrackMatchResEtaPosTrackPt[0]->SetMinimum(0.8);
692  hRatTrackMatchResEtaPosTrackPt[0]->Draw("");
693  hRatTrackMatchResEtaPosTrackPt[0]->SetYTitle(Form("Ratio data X / %s",prodLeg[0].Data()));
694  for(Int_t iprod = 0; iprod < nProd-1; iprod++)
695  {
696  hRatTrackMatchResEtaNegTrackPt[iprod]->Draw("same");
697  hRatTrackMatchResEtaPosTrackPt[iprod]->Draw("same");
698  }
699 
700  //l0.Draw("same");
701 
702  ccalo3->cd(4);
703 
704  hRatTrackMatchResPhiPosTrackPt[0]->SetMaximum(1.2);
705  hRatTrackMatchResPhiPosTrackPt[0]->SetMinimum(0.8);
706  hRatTrackMatchResPhiPosTrackPt[0]->Draw("");
707  hRatTrackMatchResPhiPosTrackPt[0]->SetYTitle(Form("Ratio data X / %s",prodLeg[0].Data()));
708  for(Int_t iprod = 0; iprod < nProd-1; iprod++)
709  {
710  hRatTrackMatchResPhiNegTrackPt[iprod]->Draw("same");
711  hRatTrackMatchResPhiPosTrackPt[iprod]->Draw("same");
712  }
713 
714  ccalo3->Print(Form("%s_MatchingResidualsTrackPtBinComp.%s",histoTag.Data(),format.Data()));
715  }
716 }
717 
721 //______________________________________
722 void TrackQA()
723 {
724  TH1F * hTrackPt[nProd] ;
725  TH1F * hTrackPtSPD[nProd] ;
726  TH1F * hTrackPtNoSPD[nProd] ;
727  TH1F * hRatTrackPt[nProd-1] ;
728  TH1F * hRatTrackPtSPD[nProd-1] ;
729  TH1F * hRatTrackPtNoSPD[nProd-1] ;
730 
731  TH2F * hTrackEtaPhi[nProd] ;
732  TH2F * hTrackEtaPhiSPD[nProd] ;
733  TH2F * hTrackEtaPhiNoSPD[nProd] ;
734  TH1F * hTrackPhi[nProd] ;
735  TH1F * hTrackPhiSPD[nProd] ;
736  TH1F * hTrackPhiNoSPD[nProd] ;
737  TH1F * hRatTrackPhi[nProd-1] ;
738  TH1F * hRatTrackPhiSPD[nProd-1] ;
739  TH1F * hRatTrackPhiNoSPD[nProd-1] ;
740 
741  //Legend for productions
742  TLegend lprod(0.3,0.475,0.84,0.675);
743  lprod.SetTextSize(0.04);
744  lprod.SetBorderSize(0);
745  lprod.SetFillColor(0);
746 
747  for(Int_t iprod = 0; iprod < nProd; iprod++)
748  {
749  hTrackPt [iprod] = (TH1F*) GetHisto("AnaHadrons_hPt" ,iprod);
750  if ( !hTrackPt[iprod] ) return;
751 
752  hTrackPtSPD [iprod] = (TH1F*) GetHisto("AnaHadrons_hPtSPDRefit" ,iprod);
753  hTrackPtNoSPD [iprod] = (TH1F*) GetHisto("AnaHadrons_hPtNoSPDRefit" ,iprod);
754  hTrackEtaPhiSPD [iprod] = (TH2F*) GetHisto("AnaHadrons_hEtaPhiSPDRefitPt02" ,iprod);
755  hTrackEtaPhiNoSPD[iprod] = (TH2F*) GetHisto("AnaHadrons_hEtaPhiNoSPDRefitPt02",iprod);
756  hTrackEtaPhi [iprod] = (TH2F*) GetHisto("AnaHadrons_hEtaPhiPositive" ,iprod);
757  hTrackEtaPhi [iprod]->Add((TH2F*) GetHisto("AnaHadrons_hEtaPhiNegative" ,iprod));
758 
759  hTrackPhiSPD [iprod] = (TH1F*)hTrackEtaPhiSPD [iprod]->ProjectionY(Form("hTrackPhiSPD%s" ,prod[iprod].Data()),0,1000);
760  hTrackPhiNoSPD [iprod] = (TH1F*)hTrackEtaPhiNoSPD[iprod]->ProjectionY(Form("hTrackPhiNoSPD%s",prod[iprod].Data()),0,1000);
761  hTrackPhi [iprod] = (TH1F*)hTrackEtaPhi [iprod]->ProjectionY(Form("hTrackPhi%s" ,prod[iprod].Data()),0,1000);
762 
763  hTrackPt [iprod]->Sumw2();
764  hTrackPtSPD [iprod]->Sumw2();
765  hTrackPtNoSPD[iprod]->Sumw2();
766 
767  hTrackPt [iprod]->Scale(1./nEvents[iprod]);
768  hTrackPtSPD [iprod]->Scale(1./nEvents[iprod]);
769  hTrackPtNoSPD[iprod]->Scale(1./nEvents[iprod]);
770 
771  hTrackPhi [iprod]->Sumw2();
772  hTrackPhiSPD [iprod]->Sumw2();
773  hTrackPhiNoSPD[iprod]->Sumw2();
774 
775  hTrackPhi [iprod]->Scale(1./nEvents[iprod]);
776  hTrackPhiSPD [iprod]->Scale(1./nEvents[iprod]);
777  hTrackPhiNoSPD[iprod]->Scale(1./nEvents[iprod]);
778 
779  hTrackPt[iprod]->SetTitle("Track spectra with/out SPD");
780  hTrackPt[iprod]->SetYTitle("1/N_{events} dN/dp_{T}");
781  hTrackPt[iprod]->SetTitleOffset(1.5,"Y");
782  hTrackPt[iprod]->SetMarkerColor(color[iprod]);
783  hTrackPt[iprod]->SetMarkerStyle(20);
784  hTrackPt[iprod]->SetAxisRange(0.,30.,"X");
785  //hTrackPt[iprod]->SetMaximum(1.1);
786  //hTrackPt[iprod]->SetMinimum(0);
787 
788  hTrackPtSPD[iprod]->SetMarkerColor(color[iprod]);
789  hTrackPtSPD[iprod]->SetMarkerStyle(26);
790 
791  hTrackPtNoSPD[iprod]->SetMarkerColor(color[iprod]);
792  hTrackPtNoSPD[iprod]->SetMarkerStyle(25);
793 
794  hTrackPhi[iprod]->SetTitle("Track #varphi with/out SPD");
795  hTrackPhi[iprod]->SetYTitle("1/N_{events} dN/d#varphi");
796  hTrackPhi[iprod]->SetTitleOffset(1.5,"Y");
797  hTrackPhi[iprod]->SetMarkerColor(color[iprod]);
798  hTrackPhi[iprod]->SetMarkerStyle(20);
799  hTrackPhi[iprod]->SetAxisRange(0.,30.,"X");
800  //hTrackPhi[iprod]->SetMaximum(1.1);
801  //hTrackPhi[iprod]->SetMinimum(0);
802 
803  hTrackPhiSPD[iprod]->SetMarkerColor(color[iprod]);
804  hTrackPhiSPD[iprod]->SetMarkerStyle(26);
805 
806  hTrackPhiNoSPD[iprod]->SetMarkerColor(color[iprod]);
807  hTrackPhiNoSPD[iprod]->SetMarkerStyle(25);
808 
809  if(iprod > 0)
810  {
811  hRatTrackPhi [iprod-1] = (TH1F*)hTrackPhi [iprod]->Clone(Form("hRatTrackPhi%s" ,prod[iprod].Data()));
812  hRatTrackPhiNoSPD[iprod-1] = (TH1F*)hTrackPhiNoSPD[iprod]->Clone(Form("hRatTrackPhiNoSPD%s",prod[iprod].Data()));
813  hRatTrackPhiSPD [iprod-1] = (TH1F*)hTrackPhiSPD [iprod]->Clone(Form("hRatTrackPhiSPD%s" ,prod[iprod].Data()));
814 
815  hRatTrackPhi [iprod-1]->Divide(hRatTrackPhi [iprod-1],hTrackPhi [0],1.000,1,"B");
816  hRatTrackPhiSPD [iprod-1]->Divide(hRatTrackPhiSPD [iprod-1],hTrackPhiSPD [0],1.000,1,"B");
817  hRatTrackPhiNoSPD[iprod-1]->Divide(hRatTrackPhiNoSPD[iprod-1],hTrackPhiNoSPD[0],1.000,1,"B");
818 
819  hRatTrackPt [iprod-1] = (TH1F*)hTrackPt [iprod]->Clone(Form("hRatTrackPt%s" ,prod[iprod].Data()));
820  hRatTrackPtNoSPD[iprod-1] = (TH1F*)hTrackPtNoSPD[iprod]->Clone(Form("hRatTrackPtNoSPD%s",prod[iprod].Data()));
821  hRatTrackPtSPD [iprod-1] = (TH1F*)hTrackPtSPD [iprod]->Clone(Form("hRatTrackPtSPD%s" ,prod[iprod].Data()));
822 
823  hRatTrackPt [iprod-1]->Divide(hRatTrackPt [iprod-1],hTrackPt [0],1.000,1,"B");
824  hRatTrackPtSPD [iprod-1]->Divide(hRatTrackPtSPD [iprod-1],hTrackPtSPD [0],1.000,1,"B");
825  hRatTrackPtNoSPD[iprod-1]->Divide(hRatTrackPtNoSPD[iprod-1],hTrackPtNoSPD[0],1.000,1,"B");
826  }
827  }
828 
829 
831  // Make the plots
833 
834  // Hybrid tracks
835  {
836  TLegend ltrack(0.6,0.75,0.84,0.89);
837  ltrack.SetTextSize(0.04);
838  //ltrack.SetBorderSize(0);
839  ltrack.SetFillColor(0);
840  ltrack.AddEntry(hTrackPt [0],"All","P");
841  ltrack.AddEntry(hTrackPtSPD [0],"SPD","P");
842  ltrack.AddEntry(hTrackPtNoSPD[0],"No SPD","P");
843 
844  TCanvas * ctrack = new TCanvas(Form("TrackHisto_%s",histoTag.Data()),"",1500,1500);
845  ctrack->Divide(2,2);
846  ctrack->cd(1);
847  gPad->SetLogy();
848  hTrackPt[0]->Draw("");
849  for(Int_t iprod = 0; iprod < nProd; iprod++)
850  {
851  hTrackPt [iprod]->Draw("same");
852  hTrackPtSPD [iprod]->Draw("same");
853  hTrackPtNoSPD[iprod]->Draw("same");
854  }
855 
856  ltrack.Draw();
857  lprod.Draw();
858 
859  ctrack->cd(2);
860 
861  hRatTrackPt[0]->SetMaximum(1.05);
862  hRatTrackPt[0]->SetMinimum(0.95);
863  hRatTrackPt[0]->Draw("");
864  hRatTrackPt[0]->SetYTitle(Form("Ratio data X / %s",prodLeg[0].Data()));
865  for(Int_t iprod = 0; iprod < nProd-1; iprod++)
866  {
867  hRatTrackPt [iprod]->Draw("same");
868  hRatTrackPtSPD [iprod]->Draw("same");
869  hRatTrackPtNoSPD[iprod]->Draw("same");
870  }
871 
872  ctrack->cd(3);
873  hTrackPhi[0]->SetMaximum(3.);
874  hTrackPhi[0]->SetMinimum(0.);
875  hTrackPhi[0]->Draw("");
876  for(Int_t iprod = 0; iprod < nProd; iprod++)
877  {
878  hTrackPhi [iprod]->Draw("same");
879  hTrackPhiSPD [iprod]->Draw("same");
880  hTrackPhiNoSPD[iprod]->Draw("same");
881  }
882 
883  ctrack->cd(4);
884  //gPad->SetLogy();
885 
886  hRatTrackPhi[0]->SetMaximum(1.05);
887  hRatTrackPhi[0]->SetMinimum(0.95);
888  hRatTrackPhi[0]->Draw("");
889  hRatTrackPhi[0]->SetYTitle(Form("Ratio data X / %s",prodLeg[0].Data()));
890  for(Int_t iprod = 0; iprod < nProd-1; iprod++)
891  {
892  hRatTrackPhi [iprod]->Draw("same");
893  hRatTrackPhiSPD [iprod]->Draw("same");
894  hRatTrackPhiNoSPD[iprod]->Draw("same");
895  }
896 
897  ctrack->Print(Form("%s_TrackComp.%s",histoTag.Data(),format.Data()));
898  }
899 }
900 
907 //______________________________________
908 void CorrelQA(Int_t icalo)
909 {
910  TH2F* h2XE[nProd];
911  TH2F* h2XEUE[nProd];
912  TH1F* hXE[nProd];
913  TH1F* hXEUE[nProd];
914  TH1F* hRatXE[nProd-1];
915  TH1F* hRatXEUE[nProd-1];
916 
917  //Legend for productions
918  TLegend lprod(0.3,0.475,0.84,0.675);
919  lprod.SetTextSize(0.04);
920  lprod.SetBorderSize(0);
921  lprod.SetFillColor(0);
922 
923  for(Int_t iprod = 0; iprod < nProd; iprod++)
924  {
925  h2XE [iprod]= (TH2F*) GetHisto(Form("AnaPhotonHadronCorr_Calo%d_hXECharged" ,icalo),iprod);
926  h2XEUE [iprod]= (TH2F*) GetHisto(Form("AnaPhotonHadronCorr_Calo%d_hXEUeCharged",icalo),iprod);
927 
928  if ( !h2XE[iprod] ) return;
929 
930  Float_t minClusterE = 8;
931  TH1F * hTrigger = (TH1F*) GetHisto("AnaPhotonHadronCorr_hPtTrigger",iprod);
932  Int_t minClusterEBin = hTrigger->FindBin(minClusterE);
933  Float_t nTrig = hTrigger->Integral(minClusterE,100000);
934 
935  hXE [iprod] = (TH1F*)h2XE [iprod]->ProjectionY(Form("hXE%s_%s" ,prod[iprod].Data(),histoTag.Data()),minClusterEBin,1000);
936  hXEUE[iprod] = (TH1F*)h2XEUE[iprod]->ProjectionY(Form("hXEUE%s_%s",prod[iprod].Data(),histoTag.Data()),minClusterEBin,1000);
937 
938  hXE [iprod]->Sumw2();
939  hXEUE[iprod]->Sumw2();
940 
941  hXE [iprod]->Scale(1./nTrig);
942  hXEUE[iprod]->Scale(1./nTrig);
943 
944  hXE[iprod]->SetTitle(Form("#gamma-hadron x_{E}, p_{T,Trig}>%2.1f GeV/c",minClusterE));
945  hXE[iprod]->SetYTitle("1/N_{trigger} dN/dx_{E}");
946  hXE[iprod]->SetTitleOffset(1.5,"Y");
947  hXE[iprod]->SetMarkerColor(color[iprod]);
948  hXE[iprod]->SetMarkerStyle(20);
949  hXE[iprod]->SetAxisRange(0.,1.,"X");
950  //hXE[iprod]->SetMaximum(1.1);
951  //hXE[iprod]->SetMinimum(0);
952 
953  hXEUE[iprod]->SetMarkerColor(color[iprod]);
954  hXEUE[iprod]->SetMarkerStyle(25);
955 
956  if(iprod > 0)
957  {
958  hRatXE [iprod-1] = (TH1F*)hXE [iprod]->Clone(Form("hRatXE%s_%s" ,prod[iprod].Data(),histoTag.Data()));
959  hRatXEUE[iprod-1] = (TH1F*)hXEUE[iprod]->Clone(Form("hRatXEUE%s_%s",prod[iprod].Data(),histoTag.Data()));
960 
961  hRatXE [iprod-1]->Divide(hRatXE [iprod-1],hXE [0],1.000,1,"B");
962  hRatXEUE[iprod-1]->Divide(hRatXEUE[iprod-1],hXEUE[0],1.000,1,"B");
963  }
964  }
965 
967  // Make the plots
969 
970  // XE
971  {
972  TLegend lxe(0.6,0.75,0.84,0.89);
973  lxe.SetTextSize(0.04);
974  //lxe.SetBorderSize(0);
975  lxe.SetFillColor(0);
976  lxe.AddEntry(hXE [0],"Signal+bkg","P");
977  lxe.AddEntry(hXEUE[0],"Und. Event","P");
978 
979  TCanvas * cxe = new TCanvas(Form("XEHisto_%s_%s",histoTag.Data(),histoTag.Data()),"",1000,500);
980  cxe->Divide(2,1);
981  cxe->cd(1);
982  gPad->SetLogy();
983  hXE[0]->Draw("");
984  for(Int_t iprod = 0; iprod < nProd; iprod++)
985  {
986  hXE [iprod]->Draw("same");
987  hXEUE[iprod]->Draw("same");
988  }
989 
990  lxe.Draw();
991  lprod.Draw();
992 
993  cxe->cd(2);
994 
995  hRatXE[0]->SetMaximum(1.05);
996  hRatXE[0]->SetMinimum(0.95);
997  hRatXE[0]->Draw("");
998  hRatXE[0]->SetYTitle(Form("Ratio data X / %s",prodLeg[0].Data()));
999  for(Int_t iprod = 0; iprod < nProd-1; iprod++)
1000  {
1001  hRatXE [iprod]->Draw("same");
1002  hRatXEUE[iprod]->Draw("same");
1003  }
1004 
1005  cxe->Print(Form("%s_XEComp.%s",histoTag.Data(),format.Data()));
1006  }
1007 
1008 }
1009 
1012 //______________________________________
1014 {
1015  TH1F* hCen [nProd];
1016  TH1F* hRatCen[nProd-1];
1017 
1018  //Legend for productions
1019  TLegend lprod(0.3,0.475,0.84,0.675);
1020  lprod.SetTextSize(0.04);
1021  lprod.SetBorderSize(0);
1022  lprod.SetFillColor(0);
1023 
1024  for(Int_t iprod = 0; iprod < nProd; iprod++)
1025  {
1026  hCen[iprod] = (TH1F*) GetHisto("hCentrality",iprod);
1027 
1028  if ( !hCen[iprod] ) return;
1029 
1030 
1031  hCen[iprod]->Sumw2();
1032 
1033  hCen[iprod]->Scale(1./nEvents[iprod]);
1034 
1035  hCen[iprod]->SetTitle("Centrality");
1036  hCen[iprod]->SetYTitle("1/N_{events} dN/d centrality");
1037  hCen[iprod]->SetTitleOffset(1.5,"Y");
1038  hCen[iprod]->SetMarkerColor(color[iprod]);
1039  hCen[iprod]->SetMarkerStyle(20);
1040  //hCen[iprod]->SetAxisRange(0.,30.,"X");
1041  //hCen[iprod]->SetMaximum(1.1);
1042  //hCen[iprod]->SetMinimum(0);
1043 
1044  if(iprod > 0)
1045  {
1046  hRatCen[iprod-1] = (TH1F*)hCen[iprod]->Clone(Form("hRatCen%s" ,prod[iprod].Data()));
1047 
1048  hRatCen[iprod-1]->Divide(hRatCen[iprod-1],hCen [0],1.000,1,"B");
1049  }
1050  }
1051 
1053  // Make the plots
1055  // Centrality
1056  {
1057  TCanvas * ccen = new TCanvas(Form("Centrality_%s",histoTag.Data()),"",1000,500);
1058  ccen->Divide(2,1);
1059 
1060  ccen->cd(1);
1061  //gPad->SetLogy();
1062 
1063  hCen[0]->Draw();
1064  for(Int_t iprod = 0; iprod < nProd; iprod++)
1065  {
1066  hCen[iprod]->Draw("same");
1067  }
1068 
1069  lprod.Draw();
1070 
1071  ccen->cd(2);
1072  //gPad->SetLogy();
1073 
1074  hRatCen[0]->SetTitle("Centrality");
1075  hRatCen[0]->SetYTitle(Form("Ratio data X / %s",prodLeg[0].Data()));
1076  hRatCen[0]->SetMinimum(0.95);
1077  hRatCen[0]->SetMaximum(1.05);
1078  hRatCen[0]->Draw("");
1079 
1080  for(Int_t iprod = 0; iprod < nProd-1; iprod++)
1081  {
1082  hRatCen [iprod]->Draw("same");
1083  }
1084 
1085  TLine l1(0,1,100,1);
1086 
1087  l1.Draw("same");
1088 
1089  ccen->Print(Form("%s_CentralityComp.%s",histoTag.Data(),format.Data()));
1090  }
1091 
1092 }
1093 
1097 //______________________________________
1098 void VertexQA()
1099 {
1100  TH1F* hVertex [3][nProd];
1101  TH1F* hRatVertex[3][nProd-1];
1102 
1103  //Legend for productions
1104  TLegend lprod(0.6,0.6,0.97,0.85);
1105  lprod.SetTextSize(0.04);
1106  lprod.SetBorderSize(0);
1107  lprod.SetFillColor(0);
1108 
1109  for(Int_t iprod = 0; iprod < nProd; iprod++)
1110  {
1111  hVertex[0][iprod] = (TH1F*) GetHisto("hZVertex",iprod);
1112  hVertex[1][iprod] = (TH1F*) GetHisto("hYVertex",iprod);
1113  hVertex[2][iprod] = (TH1F*) GetHisto("hXVertex",iprod);
1114 
1115  if ( !hVertex[0][iprod] ) return;
1116 
1117  hVertex[0][iprod]->Sumw2();
1118  hVertex[1][iprod]->Sumw2();
1119  hVertex[2][iprod]->Sumw2();
1120 
1121  lprod.AddEntry(hVertex[0][iprod],prodLeg[iprod],"P");
1122 
1123  for(Int_t ivertex = 0; ivertex < 3; ivertex++)
1124  {
1125  //hVertex[ivertex][iprod]->Sumw2();
1126 
1127  hVertex[ivertex][iprod]->Scale(1./nEvents[iprod]);
1128 
1129  //hVertex[ivertex][iprod]->SetTitle("Centrality");
1130  hVertex[ivertex][iprod]->SetYTitle("1/N_{events} dN/ d vertex");
1131  hVertex[ivertex][iprod]->SetTitleOffset(1.5,"Y");
1132  hVertex[ivertex][iprod]->SetMarkerColor(color[iprod]);
1133  hVertex[ivertex][iprod]->SetLineColor(color[iprod]);
1134  hVertex[ivertex][iprod]->SetMarkerStyle(20);
1135  if(ivertex==0)hVertex[ivertex][iprod]->SetAxisRange(-10,10.,"X");
1136  else hVertex[ivertex][iprod]->SetAxisRange(-1.5,1.5,"X");
1137  //hVertex[ivertex][iprod]->SetMaximum(1.1);
1138  //hVertex[ivertex][iprod]->SetMinimum(0);
1139 
1140  if(iprod > 0)
1141  {
1142  hRatVertex[ivertex][iprod-1] = (TH1F*)hVertex[ivertex][iprod]->Clone(Form("hRatVertex%s_%d" ,prod[iprod].Data(),ivertex));
1143 
1144  hRatVertex[ivertex][iprod-1]->Divide(hRatVertex[ivertex][iprod-1],hVertex[ivertex][0],1.000,1,"B");
1145  }
1146  }
1147  }
1148 
1150  // Make the plots
1152  // Vertex
1153  {
1154  TCanvas * cvertex = new TCanvas(Form("Vertex_%s",histoTag.Data()),"",3*500,2*500);
1155  cvertex->Divide(3,2);
1156  Int_t npannel = 1;
1157  for(Int_t ivertex = 0; ivertex < 3; ivertex++)
1158  {
1159  cvertex->cd(npannel);
1160  //gPad->SetLogy();
1161 
1162  //hVertex[ivertex][0]->Draw();
1163  for(Int_t iprod = 0; iprod < nProd; iprod++)
1164  {
1165  hVertex[ivertex][iprod]->Draw("same");
1166  }
1167 
1168  //lprod.Draw();
1169 
1170  cvertex->cd(npannel+3);
1171  gPad->SetGridy();
1172 
1173  //hRatVertex[ivertex][0]->SetTitle("");
1174  hRatVertex[ivertex][0]->SetYTitle(Form("Ratio data X / %s",prodLeg[0].Data()));
1175  hRatVertex[ivertex][0]->SetMinimum(0.90);
1176  hRatVertex[ivertex][0]->SetMaximum(1.10);
1177  hRatVertex[ivertex][0]->Draw("");
1178 
1179  for(Int_t iprod = 0; iprod < nProd-1; iprod++)
1180  {
1181  hRatVertex[ivertex][iprod]->Draw("same");
1182  }
1183  lprod.Draw();
1184 
1185  npannel++;
1186  }
1187  cvertex->Print(Form("%s_VertexComp.%s",histoTag.Data(),format.Data()));
1188  }
1189 }
1190 
1198 //_____________________________________________________
1200 {
1201  Bool_t ok = kTRUE;
1202  for(Int_t iprod = 0; iprod < nProd; iprod++)
1203  {
1204  // First, init to 0
1205  file [iprod] = 0;
1206  dir [iprod] = 0;
1207  histArr[iprod] = 0;
1208  nEvents[iprod] = 0;
1209 
1210  // now get them
1211  file[iprod] = new TFile(Form("%s/%s",prod[iprod].Data(),fileName.Data()),"read");
1212  if(file[iprod]->Get("hNEvents"))
1213  {
1214  nEvents[iprod] = ((TH1F*)file[iprod]->Get("hNEvents"))->GetEntries();
1215  printf("%s: nEvents %e\n",prod[iprod].Data(),nEvents[iprod]);
1216  }
1217 
1218  dir[iprod] = (TDirectoryFile*) file[iprod]->Get(listName);
1219  if(dir[iprod])
1220  {
1221  histArr[iprod] = (TList*) dir[iprod]->Get(trigName);
1222 
1223  if ( !histArr[iprod] ) continue;
1224  if ( histArr[iprod]->GetEntries() <= 0 ) continue;
1225 
1226  nEvents[iprod] = ((TH1F*)histArr[iprod]->FindObject("hNEvents"))->GetEntries();
1227  printf("%s: nEvents %e\n",prod[iprod].Data(),nEvents[iprod]);
1228  }
1229  else
1230  {
1231  histArr[iprod] = (TList*) file[iprod]->Get(trigName);
1232 
1233  if ( !histArr[iprod] ) continue;
1234  if ( histArr[iprod]->GetEntries() <= 0 ) continue;
1235 
1236  nEvents[iprod] = ((TH1F*)histArr[iprod]->FindObject("hNEvents"))->GetEntries();
1237  printf("%s: nEvents %e\n",prod[iprod].Data(),nEvents[iprod]);
1238  }
1239 
1240  if(!histArr[iprod])
1241  {
1242  printf("list %s not found\n",trigName.Data());
1243  ok = kFALSE;
1244  }
1245  }
1246 
1247  return ok;
1248 }
1249 
1258 //___________________________________
1259 TObject * GetHisto(TString histoName, Int_t iprod)
1260 {
1261  if ( histArr[iprod] )
1262  return histArr[iprod]->FindObject(histoName);
1263  else
1264  return file[iprod]->Get (histoName);
1265 }
1266 
TObject * GetHisto(TString histoName, Int_t iprod)
Definition: External.C:236
TString fileName
TString format
file names tag, basically the trigger and calorimeter combination
void VertexQA()
TList * histArr[nProd]
TDirectory file where lists per trigger are stored in train ouput.
int Int_t
Definition: External.C:63
const Int_t nProd
float Float_t
Definition: External.C:68
TDirectoryFile * dir[nProd]
total number of productions to compare
TString prodLeg[]
productions name used in legends
void CaloQA(Int_t icalo)
TFile * file[nProd]
TList with histograms for a given trigger.
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
TObject * FindObject(int bin, const char *nameH, const TList *lst, Bool_t normPerEvent=kTRUE)
Float_t nEvents[nProd]
Input train file.
void TrackQA()
void CentralityQA()
void CorrelQA(Int_t icalo)
TString histoTag
number of events container
Int_t color[]
output plots format: eps, pdf, etc.
bool Bool_t
Definition: External.C:53
void ProcessTrigger(TString trigName="default", TString fileName="AnalysisResults.root", TString listName="Pi0IM_GammaTrackCorr_EMCAL")
void DrawProductionComparison(TString listName="Pi0IM_GammaTrackCorr_EMCAL", TString fileName="AnalysisResults.root", TString fileFormat="eps")
TString prod[]
productions to be compared, directory name
Bool_t GetFileAndList(TString fileName, TString listName, TString trigName)