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