AliPhysics  64bcec2 (64bcec2)
readMCPerform.C
Go to the documentation of this file.
1 #if !defined(__CINT__) || defined(__MAKECINT__)
2 #include "Riostream.h"
3 #include "TFile.h"
4 #include "TString.h"
5 #include "TSystem.h"
6 #include "TStyle.h"
7 #include "TROOT.h"
8 #include "TFileMerger.h"
9 #include "TMap.h"
10 #include "TH1.h"
11 #include "TH2.h"
12 #include "TH3.h"
13 #include "TTree.h"
14 #include "TPaveStats.h"
15 #include "TLegend.h"
16 #include "TCanvas.h"
17 #include "TProfile.h"
18 #include "TGridResult.h"
19 #include "TObjString.h"
20 #endif
21 
22 void readMCPerform(TString filename="QAresults_AOD.root", Int_t drawOnlyDzerDplus = 1, Int_t runNumber=-1)
23 {
24 
25  const Int_t totTrending=5;
26  Float_t vecForTrend[totTrending];
27  TString varForTrending[totTrending]={"nDzeroCandperEv","nDplusCandperEv","nDsCandperEv","nLcCandperEv","nDstarCandperEv"};
28 
29 
30 
31  TTree* trtree=new TTree("trendingHF","tree of trending variables");
32  trtree->Branch("nrun",&runNumber,"nrun/I");
33  for(Int_t j=0; j<totTrending; j++){
34  trtree->Branch(varForTrending[j].Data(),&vecForTrend[j],Form("%s/F",varForTrending[j].Data()));
35  vecForTrend[j]=-99.;
36  }
37 
38  TFile *ff = new TFile(filename.Data());
39 
40  Int_t color[5] = {kBlack, kRed, kGreen, kBlue, kOrange};
41 
42  TDirectoryFile *dirD2H = (TDirectoryFile *)ff->Get("PWG3_D2H_QA");
43  if(!dirD2H){
44  printf("Directory PWG3_D2H_QA not found in file %s\n",filename.Data());
45  return;
46  }
47  TList *listD2H = (TList *)dirD2H->Get("nEntriesQA");
48  if(!listD2H){
49  printf("TList nEntriesQA not found in file %s\n",filename.Data());
50  return;
51  }
52  TH1F *hNentries = (TH1F *)listD2H->FindObject("hNentries");
53  TH2F *hHasSelBit = (TH2F *)listD2H->FindObject("HasSelBit");
54 
55  TCanvas *cqa = new TCanvas("cqa", "cqa", 800, 500);
56  cqa->Divide(2, 1);
57  cqa->cd(1);
58  hNentries->Draw();
59  cqa->cd(2);
60  hHasSelBit->Draw("colz");
61  cqa->SaveAs("plot_D2HQA.png");
62 
63  Double_t nEv=hNentries->GetBinContent(10);
64  vecForTrend[0]=hHasSelBit->GetBinContent(1)/nEv;
65  vecForTrend[1]=hHasSelBit->GetBinContent(2)/nEv;
66  vecForTrend[2]=hHasSelBit->GetBinContent(3)/nEv;
67  vecForTrend[3]=hHasSelBit->GetBinContent(4)/nEv;
68  vecForTrend[4]=hHasSelBit->GetBinContent(5)/nEv;
69 
70 
71  TDirectoryFile *dir = (TDirectoryFile *)ff->Get("PWGHF_D2H_MCPerform");
72  TList* list = 0x0;
73  if (dir)
74  {
75  list = (TList *)dir->Get("coutputDperfQA");
76  if(list){
77 
78  TH1F *hn = (TH1F *)list->FindObject("fHistNEvents");
79  TH1F *hnGenD = (TH1F *)list->FindObject("fHistNGenD");
80  Int_t entries = hn->GetBinContent(3);
81 
82  TH2F *fHistNCand = (TH2F *)list->FindObject("fHistNCand");
83  TH1F *fHistNCandDzero = (TH1F *)fHistNCand->ProjectionY("fHistNCandDzero", 1, 1);
84  TH1F *fHistNCandDplus = (TH1F *)fHistNCand->ProjectionY("fHistNCandDplus", 2, 2);
85  TH1F *fHistNCandDstar = (TH1F *)fHistNCand->ProjectionY("fHistNCandDstar", 3, 3);
86  TH1F *fHistNCandDs = (TH1F *)fHistNCand->ProjectionY("fHistNCandDs", 4, 4);
87  TH1F *fHistNCandLc = (TH1F *)fHistNCand->ProjectionY("fHistNCandLc", 5, 5);
88 
89  TString names[5] = {"Dzero", "Dplus", "Dstar", "Ds", "Lc2pkpi"};
90  TString type[2] = {"Prompt", "Feeddown"};
91  const Int_t nDecays = 5;
92  TH2F *fHistXvtxResVsPt[2 * nDecays];
93  TH2F *fHistYvtxResVsPt[2 * nDecays];
94  TH2F *fHistZvtxResVsPt[2 * nDecays];
95  TH2F *fHistInvMassVsPt[2 * nDecays];
96  TH2F *fHistDecLenVsPt[2 * nDecays];
97  TH2F *fHistNormDLxyVsPt[2 * nDecays];
98  TH2F *fHistCosPointVsPt[2 * nDecays];
99 
100  TH3F *fHistPtYMultGenDauInAcc[2 * nDecays];
101  TH3F *fHistPtYMultRecoFilt[2 * nDecays];
102 
103  TProfile *fHistXvtxRes[2 * nDecays];
104  TProfile *fHistYvtxRes[2 * nDecays];
105  TProfile *fHistZvtxRes[2 * nDecays];
106  TProfile *fHistXvtxMean[2 * nDecays];
107  TProfile *fHistYvtxMean[2 * nDecays];
108  TProfile *fHistZvtxMean[2 * nDecays];
109 
110  TH1F *fHistXvtxRes2[2 * nDecays];
111  TH1F *fHistYvtxRes2[2 * nDecays];
112  TH1F *fHistZvtxRes2[2 * nDecays];
113 
114  TProfile *fHistInvMass[2 * nDecays];
115  TProfile *fHistDecLen[2 * nDecays];
116  TProfile *fHistCosp[2 * nDecays];
117 
118  TH1F *fHistInvMassRes[2 * nDecays];
119 
120  TH1F *hEffPt[2 * nDecays];
121  TH1F *htemp;
122 
123  for (Int_t j = 0; j < 5; j++)
124  { //decays
125  for (Int_t i = 0; i < 2; i++)
126  { //prompt and fd
127  Int_t index = j * 2 + i;
128  fHistXvtxResVsPt[index] = (TH2F *)list->FindObject(Form("hXvtxResVsPt%s%s", type[i].Data(), names[j].Data()));
129  fHistYvtxResVsPt[index] = (TH2F *)list->FindObject(Form("hYvtxResVsPt%s%s", type[i].Data(), names[j].Data()));
130  fHistZvtxResVsPt[index] = (TH2F *)list->FindObject(Form("hZvtxResVsPt%s%s", type[i].Data(), names[j].Data()));
131  fHistInvMassVsPt[index] = (TH2F *)list->FindObject(Form("hInvMassVsPt%s%s", type[i].Data(), names[j].Data()));
132  fHistDecLenVsPt[index] = (TH2F *)list->FindObject(Form("hDecLenVsPt%s%s", type[i].Data(), names[j].Data()));
133  fHistCosPointVsPt[index] = (TH2F *)list->FindObject(Form("hCosPointVsPt%s%s", type[i].Data(), names[j].Data()));
134  fHistPtYMultGenDauInAcc[index] = (TH3F *)list->FindObject(Form("hPtYMult%sGenDauInAcc%s", type[i].Data(), names[j].Data()));
135  fHistPtYMultRecoFilt[index] = (TH3F *)list->FindObject(Form("hPtYMult%sRecoFilt%s", type[i].Data(), names[j].Data()));
136 
137  fHistXvtxMean[index] = (TProfile *)fHistXvtxResVsPt[index]->ProfileX(Form("hXvtxMean%s%s", type[i].Data(), names[j].Data()));
138  fHistXvtxMean[index]->SetLineColor(color[j]);
139  fHistXvtxMean[index]->SetLineWidth(2);
140  fHistXvtxMean[index]->GetXaxis()->SetTitle("pT (GeV/c)");
141  fHistXvtxMean[index]->GetYaxis()->SetTitle("Xvtx (reco-true) mean (#mum)");
142  fHistXvtxMean[index]->SetTitle("Xvtx residual vs pT");
143 
144  fHistYvtxMean[index] = (TProfile *)fHistYvtxResVsPt[index]->ProfileX(Form("hYvtxMean%s%s", type[i].Data(), names[j].Data()));
145  fHistYvtxMean[index]->SetLineColor(color[j]);
146  fHistYvtxMean[index]->SetLineWidth(2);
147  fHistYvtxMean[index]->GetXaxis()->SetTitle("pT (GeV/c)");
148  fHistYvtxMean[index]->GetYaxis()->SetTitle("Yvtx (reco-true) mean (#mum)");
149  fHistYvtxMean[index]->SetTitle("Yvtx residual vs pT");
150 
151  fHistZvtxMean[index] = (TProfile *)fHistZvtxResVsPt[index]->ProfileX(Form("hZvtxMean%s%s", type[i].Data(), names[j].Data()));
152  fHistZvtxMean[index]->SetLineColor(color[j]);
153  fHistZvtxMean[index]->SetLineWidth(2);
154  fHistZvtxMean[index]->GetXaxis()->SetTitle("pT (GeV/c)");
155  fHistZvtxMean[index]->GetYaxis()->SetTitle("Zvtx (reco-true) mean (#mum)");
156  fHistZvtxMean[index]->SetTitle("Zvtx residual vs pT");
157 
158  fHistXvtxRes[index] = (TProfile *)fHistXvtxResVsPt[index]->ProfileX(Form("hXvtxRes%s%s", type[i].Data(), names[j].Data()), 1, -1, "s");
159  fHistYvtxRes[index] = (TProfile *)fHistYvtxResVsPt[index]->ProfileX(Form("hYvtxRes%s%s", type[i].Data(), names[j].Data()), 1, -1, "s");
160  fHistZvtxRes[index] = (TProfile *)fHistZvtxResVsPt[index]->ProfileX(Form("hZvtxRes%s%s", type[i].Data(), names[j].Data()), 1, -1, "s");
161  fHistXvtxRes2[index] = (TH1F *)fHistXvtxResVsPt[index]->ProjectionX(Form("hXvtxRes2%s%s", type[i].Data(), names[j].Data()));
162  fHistYvtxRes2[index] = (TH1F *)fHistYvtxResVsPt[index]->ProjectionX(Form("hYvtxRes2%s%s", type[i].Data(), names[j].Data()));
163  fHistZvtxRes2[index] = (TH1F *)fHistZvtxResVsPt[index]->ProjectionX(Form("hZvtxRes2%s%s", type[i].Data(), names[j].Data()));
164  fHistXvtxRes[index]->GetXaxis()->SetTitle("pT (GeV/c)");
165  fHistXvtxRes[index]->GetYaxis()->SetTitle("Xvtx (reco-true) RMS (#mum)");
166  fHistXvtxRes[index]->SetTitle("Xvtx resolution vs pT");
167  fHistYvtxRes[index]->GetXaxis()->SetTitle("pT (GeV/c)");
168  fHistYvtxRes[index]->GetYaxis()->SetTitle("Yvtx (reco-true) RMS (#mum)");
169  fHistYvtxRes[index]->SetTitle("Yvtx resolution vs pT");
170  fHistZvtxRes[index]->GetXaxis()->SetTitle("pT (GeV/c)");
171  fHistZvtxRes[index]->GetYaxis()->SetTitle("Zvtx (reco-true) RMS (#mum)");
172  fHistZvtxRes[index]->SetTitle("Zvtx resolution vs pT");
173 
174  fHistXvtxRes2[index]->GetXaxis()->SetTitle("pT (GeV/c)");
175  fHistXvtxRes2[index]->GetYaxis()->SetTitle("Xvtx (reco-true) RMS (#mum)");
176  fHistXvtxRes2[index]->SetTitle("Xvtx resolution vs pT");
177  fHistYvtxRes2[index]->GetXaxis()->SetTitle("pT (GeV/c)");
178  fHistYvtxRes2[index]->GetYaxis()->SetTitle("Yvtx (reco-true) RMS (#mum)");
179  fHistYvtxRes2[index]->SetTitle("Yvtx resolution vs pT");
180  fHistZvtxRes2[index]->GetXaxis()->SetTitle("pT (GeV/c)");
181  fHistZvtxRes2[index]->GetYaxis()->SetTitle("Zvtx (reco-true) RMS (#mum)");
182  fHistZvtxRes2[index]->SetTitle("Zvtx resolution vs pT");
183 
184  fHistXvtxRes2[index]->SetLineColor(color[j]);
185  fHistYvtxRes2[index]->SetLineColor(color[j]);
186  fHistZvtxRes2[index]->SetLineColor(color[j]);
187  fHistXvtxRes2[index]->SetMarkerColor(color[j]);
188  fHistXvtxRes2[index]->SetMarkerStyle(20);
189  fHistYvtxRes2[index]->SetMarkerColor(color[j]);
190  fHistYvtxRes2[index]->SetMarkerStyle(20);
191  fHistZvtxRes2[index]->SetMarkerColor(color[j]);
192  fHistZvtxRes2[index]->SetMarkerStyle(20);
193  fHistXvtxRes2[index]->SetLineWidth(2);
194  fHistYvtxRes2[index]->SetLineWidth(2);
195  fHistZvtxRes2[index]->SetLineWidth(2);
196  fHistXvtxRes2[index]->Sumw2();
197  fHistYvtxRes2[index]->Sumw2();
198  fHistZvtxRes2[index]->Sumw2();
199 
200  fHistInvMass[index] = (TProfile *)fHistInvMassVsPt[index]->ProfileX(Form("hInvMassVsPt%s%s", type[i].Data(), names[j].Data()));
201  fHistInvMass[index]->SetLineColor(color[j]);
202  fHistInvMass[index]->SetLineWidth(2);
203  fHistInvMass[index]->GetXaxis()->SetTitle("pT (GeV/c)");
204  fHistInvMass[index]->GetYaxis()->SetTitle("Inv Mass (GeV/c2)");
205  fHistInvMass[index]->SetTitle("Inv Mass vs pT");
206 
207  fHistDecLen[index] = (TProfile *)fHistDecLenVsPt[index]->ProfileX(Form("hDecLenVsPt%s%s", type[i].Data(), names[j].Data()));
208  fHistDecLen[index]->SetLineColor(color[j]);
209  fHistDecLen[index]->SetLineWidth(2);
210  fHistDecLen[index]->GetXaxis()->SetTitle("pT (GeV/c)");
211  fHistDecLen[index]->GetYaxis()->SetTitle("Dec Len (#mum)");
212  fHistDecLen[index]->SetTitle("Prompt Dec Len vs pT");
213 
214  fHistCosp[index] = (TProfile *)fHistCosPointVsPt[index]->ProfileX(Form("hCosPVsPt%s%s", type[i].Data(), names[j].Data()));
215  fHistCosp[index]->SetLineColor(color[j]);
216  fHistCosp[index]->SetLineWidth(2);
217  fHistCosp[index]->GetXaxis()->SetTitle("pT (GeV/c)");
218  fHistCosp[index]->GetYaxis()->SetTitle("Cos Point");
219  fHistCosp[index]->SetTitle("Prompt CosPoint vs pT");
220 
221  if (index % 2 == 1)
222  fHistDecLen[index]->SetTitle("FeedDown Dec Len vs pT");
223 
224  htemp = (TH1F *)fHistPtYMultGenDauInAcc[index]->ProjectionX(Form("hPtDen%s%s", type[i].Data(), names[j].Data()));
225  hEffPt[index] = (TH1F *)fHistPtYMultRecoFilt[index]->ProjectionX(Form("hPtNum%s%s", type[i].Data(), names[j].Data()));
226  fHistPtYMultGenDauInAcc[index]->Sumw2();
227  fHistPtYMultRecoFilt[index]->Sumw2();
228  hEffPt[index]->Sumw2();
229  hEffPt[index]->Divide(htemp);
230  hEffPt[index]->SetLineColor(color[j]);
231  hEffPt[index]->SetLineWidth(2);
232  hEffPt[index]->GetXaxis()->SetTitle("pT (GeV/c)");
233  hEffPt[index]->GetYaxis()->SetTitle("Prompt Efficiency");
234  hEffPt[index]->SetTitle("Prompt Efficiency");
235  hEffPt[index]->SetStats(0);
236  fHistCosp[index]->SetStats(0);
237  fHistDecLen[index]->SetStats(0);
238 
239  if (index % 2 == 1)
240  {
241  hEffPt[index]->GetYaxis()->SetTitle("Feeddown Efficiency");
242  hEffPt[index]->SetTitle("Feeddown Efficiency");
243  }
244 
245  fHistInvMassRes[index] = new TH1F(*hEffPt[index]);
246  for (Int_t jj = 1; jj < hEffPt[index]->GetNbinsX() + 1; jj++)
247  {
248  TH1F *hTemp = (TH1F *)fHistInvMassVsPt[index]->ProjectionY("htemp", jj, jj);
249  fHistInvMassRes[index]->SetBinContent(jj, hTemp->GetRMS());
250  fHistInvMassRes[index]->SetBinError(jj, hTemp->GetRMSError());
251  fHistInvMassRes[index]->SetLineColor(color[j]);
252  fHistInvMassRes[index]->SetLineWidth(2);
253  fHistInvMassRes[index]->GetXaxis()->SetTitle("pT (GeV/c)");
254  fHistInvMassRes[index]->GetYaxis()->SetTitle("Inv Mass RMS (GeV/c2)");
255  fHistInvMassRes[index]->SetTitle("Inv Mass RMS vs pT");
256  if (index == 0)
257  printf("D0: pt=%f, res=%f \n", fHistInvMassRes[index]->GetBinCenter(jj), fHistInvMassRes[index]->GetBinContent(jj));
258  TH1F *hTempX = (TH1F *)fHistXvtxResVsPt[index]->ProjectionY("htempX", jj, jj);
259  TH1F *hTempY = (TH1F *)fHistYvtxResVsPt[index]->ProjectionY("htempY", jj, jj);
260  TH1F *hTempZ = (TH1F *)fHistZvtxResVsPt[index]->ProjectionY("htempZ", jj, jj);
261 
262  fHistXvtxRes2[index]->SetBinContent(jj, hTempX->GetRMS());
263  fHistXvtxRes2[index]->SetBinError(jj, hTempX->GetRMSError());
264 
265  fHistYvtxRes2[index]->SetBinContent(jj, hTempY->GetRMS());
266  fHistYvtxRes2[index]->SetBinError(jj, hTempY->GetRMSError());
267 
268  fHistZvtxRes2[index]->SetBinContent(jj, hTempZ->GetRMS());
269  fHistZvtxRes2[index]->SetBinError(jj, hTempZ->GetRMSError());
270  }
271  }
272  }
273 
274  fHistNCandDplus->SetLineColor(2);
275  fHistNCandDstar->SetLineColor(3);
276  fHistNCandDs->SetLineColor(4);
277  fHistNCandLc->SetLineColor(kOrange);
278  fHistNCandDplus->SetLineWidth(2);
279  fHistNCandDstar->SetLineWidth(2);
280  fHistNCandDs->SetLineWidth(2);
281  fHistNCandLc->SetLineWidth(2);
282 
283  fHistNCandDzero->GetXaxis()->SetTitle("pT (GeV/c)");
284  fHistNCandDzero->GetYaxis()->SetTitle("counts");
285  TLegend *leg = new TLegend(0.6, 0.7, 0.8, 0.9);
286  leg->AddEntry(fHistNCandDzero, "Dzero", "l");
287  leg->AddEntry(fHistNCandDplus, "Dplus", "l");
288  leg->AddEntry(fHistNCandDstar, "Dstar", "l");
289  leg->AddEntry(fHistNCandDs, "Ds", "l");
290  leg->AddEntry(fHistNCandLc, "Lc", "l");
291 
292  TLegend *leg1 = new TLegend(0.5, 0.7, 0.7, 0.9);
293  leg1->AddEntry(fHistYvtxRes2[0], "Dzero", "pl");
294  leg1->AddEntry(fHistYvtxRes2[2], "Dplus", "pl");
295  if (drawOnlyDzerDplus == 0)
296  leg1->AddEntry(fHistYvtxRes2[6], "Ds", "pl");
297  if (drawOnlyDzerDplus == 0)
298  leg1->AddEntry(fHistYvtxRes2[8], "Lc", "pl");
299 
300  TLegend *leg2 = new TLegend(0.5, 0.7, 0.7, 0.9);
301  leg2->AddEntry(fHistYvtxMean[0], "Dzero", "l");
302  leg2->AddEntry(fHistYvtxMean[2], "Dplus", "l");
303  if (drawOnlyDzerDplus == 0)
304  leg2->AddEntry(fHistYvtxMean[6], "Ds", "l");
305  if (drawOnlyDzerDplus == 0)
306  leg2->AddEntry(fHistYvtxMean[8], "Lc", "l");
307 
308  TLegend *leg3 = new TLegend(0.2, 0.7, 0.4, 0.9);
309  leg3->AddEntry(fHistNCandDzero, "Dzero", "l");
310  leg3->AddEntry(fHistNCandDplus, "Dplus", "l");
311  if (drawOnlyDzerDplus == 0)
312  leg3->AddEntry(fHistNCandDstar, "Dstar", "l");
313  if (drawOnlyDzerDplus == 0)
314  leg3->AddEntry(fHistNCandDs, "Ds", "l");
315  if (drawOnlyDzerDplus == 0)
316  leg3->AddEntry(fHistNCandLc, "Lc", "l");
317 
318  TLegend *leg4 = new TLegend(0.7, 0.7, 0.9, 0.9);
319  leg4->AddEntry(fHistNCandDzero, "Dzero", "l");
320  leg4->AddEntry(fHistNCandDplus, "Dplus", "l");
321  if (drawOnlyDzerDplus == 0)
322  leg4->AddEntry(fHistNCandDstar, "Dstar", "l");
323  if (drawOnlyDzerDplus == 0)
324  leg4->AddEntry(fHistNCandDs, "Ds", "l");
325  if (drawOnlyDzerDplus == 0)
326  leg4->AddEntry(fHistNCandLc, "Lc", "l");
327 
328  TCanvas *c0_1 = new TCanvas("c0_1", "c0_1", 500, 500);
329  hnGenD->SetTitle("number of generated D mesons");
330  hnGenD->Draw();
331  c0_1->SaveAs("plotDgen.png");
332 
333  TCanvas *c0_2 = new TCanvas("c0_2", "c0_2", 500, 500);
334  c0_2->SetLogy();
335 
336  fHistNCandDs->SetTitle("Candidates passing filtering cuts");
337  fHistNCandDs->Draw("");
338  c0_2->Update();
339  TPaveStats *stats = (TPaveStats *)c0_2->GetPrimitive("stats");
340  stats->SetName("h1stats");
341  stats->SetY1NDC(0.5);
342  stats->SetY2NDC(0.35);
343  c0_2->Update();
344 
345  fHistNCandDplus->Draw("sames");
346  c0_2->Update();
347  TPaveStats *stats2 = (TPaveStats *)c0_2->GetPrimitive("stats");
348  stats2->SetName("h2stats");
349  stats2->SetY1NDC(0.8);
350  stats2->SetY2NDC(.65);
351  c0_2->Update();
352 
353  fHistNCandDstar->Draw("sames");
354  c0_2->Update();
355  TPaveStats *stats3 = (TPaveStats *)c0_2->GetPrimitive("stats");
356  stats3->SetName("h3stats");
357  stats3->SetY1NDC(0.65);
358  stats3->SetY2NDC(.5);
359  c0_2->Update();
360 
361  fHistNCandDzero->Draw("sames");
362  c0_2->Update();
363  TPaveStats *stats4 = (TPaveStats *)c0_2->GetPrimitive("stats");
364  stats4->SetName("h4stats");
365  stats4->SetY1NDC(0.95);
366  stats4->SetY2NDC(.8);
367  c0_2->Update();
368 
369  fHistNCandLc->Draw("sames");
370  c0_2->Update();
371  TPaveStats *stats5 = (TPaveStats *)c0_2->GetPrimitive("stats");
372  stats5->SetName("h1stats");
373  stats5->SetY1NDC(0.35);
374  stats5->SetY2NDC(.2);
375  c0_2->Update();
376  leg->Draw();
377  c0_2->SaveAs("plotDcandpt.png");
378 
379  TCanvas *c0_3 = new TCanvas("c0_3", "c0_3", 500, 500);
380  fHistInvMass[0]->SetMinimum(1.6);
381  fHistInvMass[0]->SetMaximum(2.4);
382  fHistInvMass[0]->Draw();
383  fHistInvMass[2]->Draw("sames");
384  fHistInvMass[4]->Draw("sames");
385  fHistInvMass[6]->Draw("sames");
386  fHistInvMass[8]->Draw("sames");
387  leg->Draw();
388  c0_3->SaveAs("plotDcandInvMass.png");
389 
390  TCanvas *c0_4 = new TCanvas("c0_4", "c0_4", 500, 500);
391  //fHistInvMassRes[0]->SetMinimum(1.6);
392  //fHistInvMassRes[0]->SetMaximum(2.4);
393 
394  fHistInvMassRes[0]->GetYaxis()->SetTitleOffset(1.4);
395  fHistInvMassRes[0]->SetTitle("D0 Inv Mass RMS vs pT");
396  fHistInvMassRes[0]->Draw("");
397  // fHistInvMassRes[2]->Draw("sames");
398  if (drawOnlyDzerDplus == 0)
399  fHistInvMassRes[4]->Draw("sames");
400  if (drawOnlyDzerDplus == 0)
401  fHistInvMassRes[6]->Draw("sames");
402  if (drawOnlyDzerDplus == 0)
403  fHistInvMassRes[8]->Draw("sames");
404  //leg->Draw();
405  c0_4->SaveAs("plotD0candInvMassWidth.png");
406 
407  fHistXvtxMean[0]->SetStats(0);
408  fHistYvtxMean[0]->SetStats(0);
409  fHistZvtxMean[0]->SetStats(0);
410  fHistXvtxMean[2]->SetStats(0);
411  fHistYvtxMean[2]->SetStats(0);
412  fHistZvtxMean[2]->SetStats(0);
413  fHistXvtxRes2[0]->SetStats(0);
414  fHistYvtxRes2[0]->SetStats(0);
415  fHistZvtxRes2[0]->SetStats(0);
416  fHistXvtxRes2[2]->SetStats(0);
417  fHistYvtxRes2[2]->SetStats(0);
418  fHistZvtxRes2[2]->SetStats(0);
419 
420  TCanvas *cc = new TCanvas("cc", "cc", 1200, 500);
421  cc->Divide(3, 1);
422  cc->cd(1);
423  fHistXvtxMean[0]->GetYaxis()->SetTitleOffset(1.4);
424  fHistXvtxMean[0]->SetMinimum(-300.);
425  fHistXvtxMean[0]->SetMaximum(300.);
426  fHistXvtxMean[0]->Draw();
427 
428  fHistXvtxMean[2]->Draw("sames");
429  leg2->Draw();
430 
431  cc->cd(2);
432 
433  fHistYvtxMean[0]->GetYaxis()->SetTitleOffset(1.4);
434  fHistYvtxMean[0]->SetMinimum(-300.);
435  fHistYvtxMean[0]->SetMaximum(300.);
436  fHistYvtxMean[0]->Draw();
437  fHistYvtxMean[2]->Draw("sames");
438  leg2->Draw();
439 
440  cc->cd(3);
441  fHistZvtxMean[0]->GetYaxis()->SetTitleOffset(1.4);
442  fHistZvtxMean[0]->SetMinimum(-300.);
443  fHistZvtxMean[0]->SetMaximum(300.);
444  fHistZvtxMean[0]->Draw();
445  fHistZvtxMean[2]->Draw("sames");
446  leg2->Draw();
447  cc->SaveAs("plotXYZVtxMean.png");
449 
450  TCanvas *ccr = new TCanvas("ccr", "ccr", 1200, 500);
451  ccr->Divide(3, 1);
452  ccr->cd(1);
453  fHistXvtxRes2[0]->GetYaxis()->SetTitleOffset(1.4);
454  fHistXvtxRes2[0]->SetMinimum(0.);
455  fHistXvtxRes2[0]->SetMaximum(500.);
456  fHistXvtxRes2[0]->Draw();
457  fHistXvtxRes2[2]->Draw("sames");
458  leg2->Draw();
459 
460  ccr->cd(2);
461  fHistYvtxRes2[0]->GetYaxis()->SetTitleOffset(1.4);
462  fHistYvtxRes2[0]->SetMinimum(0.);
463  fHistYvtxRes2[0]->SetMaximum(500.);
464  fHistYvtxRes2[0]->Draw();
465  fHistYvtxRes2[2]->Draw("sames");
466  leg2->Draw();
467 
468  ccr->cd(3);
469  fHistZvtxRes2[0]->GetYaxis()->SetTitleOffset(1.4);
470  fHistZvtxRes2[0]->SetMinimum(0.);
471  fHistZvtxRes2[0]->SetMaximum(500.);
472  fHistZvtxRes2[0]->Draw();
473  fHistZvtxRes2[2]->Draw("sames");
474  leg2->Draw();
475  ccr->SaveAs("plotXYZVtxRMS.png");
476 
477  TCanvas *ccc = new TCanvas("ccc", "ccc", 1200, 800);
478  ccc->Divide(3, 2);
479  ccc->cd(1);
480  fHistDecLen[0]->GetYaxis()->SetTitleOffset(1.45);
481  fHistDecLen[0]->Draw();
482  fHistDecLen[2]->Draw("sames");
483  if (drawOnlyDzerDplus == 0)
484  fHistDecLen[4]->Draw("sames");
485  if (drawOnlyDzerDplus == 0)
486  fHistDecLen[6]->Draw("sames");
487  if (drawOnlyDzerDplus == 0)
488  fHistDecLen[8]->Draw("sames");
489  leg3->Draw();
490 
491  ccc->cd(2);
492  fHistCosp[0]->GetYaxis()->SetTitleOffset(1.45);
493  fHistCosp[0]->Draw();
494  fHistCosp[2]->Draw("sames");
495  if (drawOnlyDzerDplus == 0)
496  fHistCosp[4]->Draw("sames");
497  if (drawOnlyDzerDplus == 0)
498  fHistCosp[6]->Draw("sames");
499  if (drawOnlyDzerDplus == 0)
500  fHistCosp[8]->Draw("sames");
501  leg4->Draw();
502 
503  ccc->cd(3);
504  hEffPt[0]->GetYaxis()->SetTitleOffset(1.45);
505  hEffPt[0]->Draw();
506  hEffPt[2]->Draw("sames");
507  if (drawOnlyDzerDplus == 0)
508  hEffPt[4]->Draw("sames");
509  if (drawOnlyDzerDplus == 0)
510  hEffPt[6]->Draw("sames");
511  if (drawOnlyDzerDplus == 0)
512  hEffPt[8]->Draw("sames");
513  leg3->Draw();
514 
515  ccc->cd(4);
516  fHistDecLen[1]->GetYaxis()->SetTitleOffset(1.45);
517  fHistDecLen[1]->Draw();
518  fHistDecLen[3]->Draw("sames");
519  if (drawOnlyDzerDplus == 0)
520  fHistDecLen[5]->Draw("sames");
521  if (drawOnlyDzerDplus == 0)
522  fHistDecLen[7]->Draw("sames");
523  if (drawOnlyDzerDplus == 0)
524  fHistDecLen[9]->Draw("sames");
525  leg3->Draw();
526 
527  ccc->cd(5);
528  fHistCosp[1]->GetYaxis()->SetTitleOffset(1.45);
529  fHistCosp[1]->Draw();
530  fHistCosp[3]->Draw("sames");
531  if (drawOnlyDzerDplus == 0)
532  fHistCosp[5]->Draw("sames");
533  if (drawOnlyDzerDplus == 0)
534  fHistCosp[7]->Draw("sames");
535  if (drawOnlyDzerDplus == 0)
536  fHistCosp[9]->Draw("sames");
537  leg4->Draw();
538 
539  ccc->cd(6);
540  hEffPt[1]->GetYaxis()->SetTitleOffset(1.45);
541  hEffPt[1]->Draw();
542  hEffPt[3]->Draw("sames");
543  if (drawOnlyDzerDplus == 0)
544  hEffPt[5]->Draw("sames");
545  if (drawOnlyDzerDplus == 0)
546  hEffPt[7]->Draw("sames");
547  if (drawOnlyDzerDplus == 0)
548  hEffPt[9]->Draw("sames");
549  leg3->Draw();
550 
551  ccc->SaveAs("plot_DL_cosp_Eff_prompt_fd.png");
552  }
553  }
554 
555  trtree->Fill();
556 
557  if(runNumber>0){
558  TFile* foutfile=new TFile("trendingHF.root","recreate");
559  trtree->Write();
560  TDirectory* outdir=foutfile->mkdir(dirD2H->GetName());
561  outdir->cd();
562  listD2H->Write(listD2H->GetName(),1);
563  foutfile->cd();
564  if(dir && list){
565  TDirectory* outdir2=foutfile->mkdir(dir->GetName());
566  outdir2->cd();
567  list->Write(list->GetName(),1);
568  }
569  foutfile->Close();
570  delete foutfile;
571  }
572 }
Int_t color[]
print message on plot with ok/not ok
const char * filename
Definition: TestFCM.C:1
const Color_t cc[]
Definition: DrawKs.C:1
double Double_t
Definition: External.C:58
Definition: External.C:260
Definition: External.C:236
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
void readMCPerform(TString filename="QAresults_AOD.root", Int_t drawOnlyDzerDplus=1, Int_t runNumber=-1)
Definition: readMCPerform.C:22
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)
TDirectoryFile * dir