]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/SPECTRA/PiKaPr/TestAOD/HighLevelQA/CheckIntegratedRawYield.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / SPECTRA / PiKaPr / TestAOD / HighLevelQA / CheckIntegratedRawYield.C
1 //////////////////////////////////////////////////////////////////////////////
2 // CheckIntegratedRawYield.C (called by AODQAChecks.C)                      //
3 //                                                                          //
4 // Written by John Groh                                                     //
5 //////////////////////////////////////////////////////////////////////////////
6
7 void CheckIntegratedRawYield(AliSpectraAODEventCuts * ecuts,
8                              AliSpectraAODHistoManager * hman,
9                              TH1F*& IntegRawYieldAll,
10                              TH1F*& IntegRawYieldPiPlus,
11                              TH1F*& IntegRawYieldPiMinus,
12                              TH1F*& IntegRawYieldKPlus,
13                              TH1F*& IntegRawYieldKMinus,
14                              TH1F*& IntegRawYieldProton,
15                              TH1F*& IntegRawYieldAntiproton,
16                              Int_t runs[],
17                              Int_t irun,
18                              Int_t nRuns,
19                              TString names[],
20                              Bool_t useMC)
21 {
22   // get total raw yield histogram
23   TH1F * hRaw_allCh = (TH1F*)((TH1F*) hman->GetPtHistogram1D("hHistPtRec",-1,-1))->Clone();
24   // scale it by the number of events
25   hRaw_allCh->Scale(1./ecuts->NumberOfEvents(), "width");
26   
27   // integrate and fill IntegRawYieldAll
28   IntegRawYieldAll->SetBinContent(irun+1,hRaw_allCh->Integral());
29   
30   // get particle raw yield histograms
31   TH1F * hRaw[nCharge*nPart];
32   for (Int_t icharge=0; icharge<nCharge; icharge++)
33     {
34       for (Int_t ipart=0; ipart<nPart; ipart++)
35         {
36           Int_t index = ipart + 3*icharge;
37           TString hname = Form("hHistPtRecSigma%s%s",Particle[ipart].Data(),Sign[icharge].Data());
38           hRaw[index] = (TH1F*)((TH1F*)hman->GetPtHistogram1D(hname.Data(),-1,-1))->Clone();
39           hRaw[index]->Scale(1./ecuts->NumberOfEvents(),"width");
40         }
41     }
42   
43   // integrate and fill IntegRawYield___ (for individual particles)
44   IntegRawYieldPiPlus->Fill(irun,hRaw[0]->Integral());
45   IntegRawYieldKPlus->Fill(irun,hRaw[1]->Integral());
46   IntegRawYieldProton->Fill(irun,hRaw[2]->Integral());
47   IntegRawYieldPiMinus->Fill(irun,hRaw[3]->Integral());
48   IntegRawYieldKMinus->Fill(irun,hRaw[4]->Integral());
49   IntegRawYieldAntiproton->Fill(irun,hRaw[5]->Integral());
50   
51   // temporarily draw individual runs to a canvas
52   TCanvas * cRawYieldIndiv = new TCanvas("cRawYieldIndiv","cRawYieldIndiv");
53   gPad->SetLogy();
54   TLegend * lRawYieldIndiv = new TLegend(0.69,.59,.99,.99);
55   lRawYieldIndiv->SetFillColor(0);
56   hRaw_allCh->SetTitle("Raw Yield;p_{T} (GeV/c);");
57   hRaw_allCh->GetXaxis()->CenterTitle();
58   hRaw_allCh->SetStats(kFALSE);
59   hRaw_allCh->SetMarkerStyle(34);
60   hRaw_allCh->SetMarkerColor(kGreen);
61   hRaw_allCh->SetLineColor(kGreen);
62   hRaw_allCh->GetYaxis()->SetRangeUser(.001,1000);
63   hRaw_allCh->DrawCopy("E1P");
64   lRawYieldIndiv->AddEntry(hRaw_allCh,Form("Run %i",runs[irun]),"");
65   if (useMC) lRawYieldIndiv->AddEntry(hRaw_allCh,"MC","");
66   else lRawYieldIndiv->AddEntry(hRaw_allCh,"DATA","");
67   lRawYieldIndiv->AddEntry(hRaw_allCh,"All Particles","pe");
68
69   Int_t index = 0;
70   Int_t colorIndex;
71   for (Int_t icharge=0; icharge<nCharge; icharge++)
72     {
73       colorIndex = 0; // only 3 colors, so have to reset after inner loop runs
74       for (Int_t ipart=0; ipart<nPart; ipart++)
75         {
76           hRaw[index]->SetStats(kFALSE);
77           hRaw[index]->SetMarkerStyle(Marker[index]);
78           hRaw[index]->SetMarkerColor(Color[colorIndex]);
79           hRaw[index]->SetLineColor(Color[colorIndex]);
80           hRaw[index]->DrawCopy("E1Psame");
81           lRawYieldIndiv->AddEntry(hRaw[index],Names[index].Data(),"pe");
82           colorIndex++;
83           index++;
84         }
85     }
86   lRawYieldIndiv->DrawClone();
87
88   // close the canvas and save to a pdf file
89   if (useMC)
90     {
91       if (irun == 0) cRawYieldIndiv->SaveAs("Plots/MC/RawYieldIndiv.pdf(","pdf");
92       else if (irun < nRuns-1) cRawYieldIndiv->SaveAs("Plots/MC/RawYieldIndiv.pdf","pdf");
93       else if (irun == nRuns-1) cRawYieldIndiv->SaveAs("Plots/MC/RawYieldIndiv.pdf)","pdf");
94       cRawYieldIndiv->Close();
95     }
96   else
97     {
98       if (irun == 0) cRawYieldIndiv->SaveAs("Plots/DATA/RawYieldIndiv.pdf(","pdf");
99       else if (irun < nRuns-1) cRawYieldIndiv->SaveAs("Plots/DATA/RawYieldIndiv.pdf","pdf");
100       else if (irun == nRuns-1) cRawYieldIndiv->SaveAs("Plots/DATA/RawYieldIndiv.pdf)","pdf");
101       cRawYieldIndiv->Close();
102     }
103 }
104