]>
Commit | Line | Data |
---|---|---|
948b38b2 | 1 | void processDrawUDQA(const char *infile="AnalysisResults.root", |
2 | TString suffix = "eps", | |
3 | const char *outfile="DrawUDQA_outfile.root") { | |
4 | ||
5 | TFile *f = TFile::Open(infile, "read"); | |
6 | ||
7 | if(!f) { | |
8 | Printf("FATAL: File doesn't exist"); | |
9 | return; | |
10 | } | |
11 | ||
12 | TList *flistQA = (TList*)f->Get("UpcTree/ListHist"); | |
13 | ||
14 | if(!flistQA) { | |
15 | Printf("FATAL: TList - UpcTree/ListHist - doesn't exist"); | |
16 | return; | |
17 | } | |
18 | ||
19 | ||
20 | ||
21 | TH1D *fHistNeventsJPsi = dynamic_cast<TH1D*> (flistQA->At(0)); | |
22 | fHistNeventsJPsi->GetYaxis()->SetTitle("Counts (Events)"); | |
23 | ||
24 | TH2D *fHistTPCsignalJPsi = dynamic_cast<TH2D*> (flistQA->At(1)); | |
25 | fHistTPCsignalJPsi->GetXaxis()->SetTitle("d#it{E}/d#it{x}^{TPC} (#it{l}^{+}) (a.u.)"); | |
26 | fHistTPCsignalJPsi->GetYaxis()->SetTitle("d#it{E}/d#it{x}^{TPC} (#it{l}^{-}) (a.u.)"); | |
27 | ||
28 | TH2D *fHistDiLeptonPtJPsi = dynamic_cast<TH2D*> (flistQA->At(2)); | |
29 | fHistDiLeptonPtJPsi->GetXaxis()->SetTitle("#it{p}_{T} (#it{l}^{+}) (GeV/#it{c})"); | |
30 | fHistDiLeptonPtJPsi->GetYaxis()->SetTitle("#it{p}_{T} (#it{l}^{-}) (GeV/#it{c})"); | |
31 | ||
32 | TH1D *fHistDiElectronMass = dynamic_cast<TH1D*> (flistQA->At(3)); | |
33 | fHistDiElectronMass->GetYaxis()->SetTitle("dN/dM"); | |
34 | ||
35 | TH1D *fHistDiMuonMass = dynamic_cast<TH1D*> (flistQA->At(4)); | |
36 | fHistDiMuonMass->GetYaxis()->SetTitle("dN/dM"); | |
37 | ||
38 | //___________________________________ | |
39 | // Added by sjena | |
40 | TFile *fout = TFile::Open(outfile,"UPDATE"); | |
41 | fout->ls(); | |
42 | ||
43 | TDirectoryFile *cdd = NULL; | |
44 | cdd = (TDirectoryFile*)fout->Get("UD"); | |
45 | if(!cdd) { | |
46 | Printf("Warning: UD <dir> doesn't exist, creating a new one"); | |
47 | cdd = (TDirectoryFile*)fout->mkdir("UD"); | |
48 | } | |
49 | cdd->cd(); | |
50 | cdd->ls(); | |
51 | ||
52 | fHistNeventsJPsi->Write(); | |
53 | fHistTPCsignalJPsi->Write(); | |
54 | fHistDiLeptonPtJPsi->Write(); | |
55 | fHistDiElectronMass->Write(); | |
56 | fHistDiMuonMass->Write(); | |
57 | fout->Close(); | |
58 | //___________________________________ | |
59 | ||
60 | ||
61 | ||
62 | ||
63 | myOptions(); | |
64 | gROOT->ForceStyle(); | |
65 | ||
66 | TDatime now; | |
67 | int iDate = now.GetDate(); | |
68 | int iYear=iDate/10000; | |
69 | int iMonth=(iDate%10000)/100; | |
70 | int iDay=iDate%100; | |
71 | char* cMonth[12]={"Jan","Feb","Mar","Apr","May","Jun", | |
72 | "Jul","Aug","Sep","Oct","Nov","Dec"}; | |
73 | char cStamp1[25],cStamp2[25]; | |
74 | sprintf(cStamp1,"%i %s %i",iDay, cMonth[iMonth-1], iYear); | |
75 | sprintf(cStamp2,"%i/%.2d/%i",iDay, iMonth, iYear); | |
76 | ||
77 | myHistSetUp(fHistNeventsJPsi); | |
78 | fHistNeventsJPsi->SetLineWidth(3.0); | |
79 | myHistSetUp(fHistTPCsignalJPsi); | |
80 | myHistSetUp(fHistDiLeptonPtJPsi); | |
81 | myHistSetUp(fHistDiElectronMass); | |
82 | fHistDiElectronMass->SetLineWidth(2.0); | |
83 | myHistSetUp(fHistDiMuonMass); | |
84 | fHistDiMuonMass->SetLineWidth(2.0); | |
85 | ||
86 | TCanvas *c1 = new TCanvas("fig_ud_NeventsJPsi"," ",800,400); | |
87 | c1->Draw(); | |
88 | c1->cd(); | |
89 | TPad *myPad1 = new TPad("myPad1", "The pad",0,0,1,1); | |
90 | myPadSetUp(myPad1,0.15,0.1,0.04,0.15); | |
91 | myPad1->SetLogy(); | |
92 | myPad1->Draw(); | |
93 | myPad1->cd(); | |
94 | ||
95 | fHistNeventsJPsi->Draw(); | |
96 | c1->SaveAs(Form("fig_ud_NeventsJPsi.%s",suffix.Data())); | |
97 | ||
98 | ||
99 | TCanvas *c21 = new TCanvas("fig_ud_TPCsignalJPsi"," ",500,500); | |
100 | c21->Draw(); | |
101 | c21->cd(); | |
102 | TPad *myPad21 = new TPad("myPad21", "The pad",0,0,1,1); | |
103 | myPadSetUp(myPad21,0.15,0.15,0.15,0.15); | |
104 | myPad21->Draw(); | |
105 | myPad21->cd(); | |
106 | fHistTPCsignalJPsi->Draw("COLZ"); | |
107 | c21->SaveAs(Form("fig_ud_TPCsignalJPsi.%s",suffix.Data())); | |
108 | ||
109 | ||
110 | TCanvas *c22 = new TCanvas("fig_ud_DiLeptonPtJPsi"," ",500,500); | |
111 | c22->Draw(); | |
112 | c22->cd(); | |
113 | TPad *myPad22 = new TPad("myPad22", "The pad",0,0,1,1); | |
114 | myPadSetUp(myPad22,0.15,0.15,0.15,0.15); | |
115 | myPad22->Draw(); | |
116 | myPad22->cd(); | |
117 | fHistDiLeptonPtJPsi->Draw("COLZ"); | |
118 | c22->SaveAs(Form("fig_ud_DiLeptonPtJPsi.%s",suffix.Data())); | |
119 | ||
120 | ||
121 | TCanvas *c31 = new TCanvas("fig_ud_DiElectronMassJPsi"," ",800,500); | |
122 | c31->Draw(); | |
123 | c31->cd(); | |
124 | TPad *myPad31 = new TPad("myPad31", "The pad",0,0,1,1); | |
125 | myPadSetUp(myPad31,0.15,0.1,0.04,0.15); | |
126 | myPad31->Draw(); | |
127 | myPad31->cd(); | |
128 | fHistDiElectronMass->Draw(); | |
129 | c31->SaveAs(Form("fig_ud_DiElectronMassJPsi.%s",suffix.Data())); | |
130 | ||
131 | ||
132 | TCanvas *c32 = new TCanvas("fig_ud_DiMuonMassJPsi"," ",800,500); | |
133 | c32->Draw(); | |
134 | c32->cd(); | |
135 | TPad *myPad32 = new TPad("myPad32", "The pad",0,0,1,1); | |
136 | myPadSetUp(myPad32,0.15,0.1,0.04,0.15); | |
137 | myPad32->Draw(); | |
138 | myPad32->cd(); | |
139 | fHistDiMuonMass->Draw(); | |
140 | c32->SaveAs(Form("fig_ud_DiMuonMassJPsi.%s",suffix.Data())); | |
141 | ||
142 | ||
143 | /* | |
144 | TFile* outfile = new TFile("fig_ud.root","recreate"); | |
145 | c1->Write(); | |
146 | c21->Write(); | |
147 | c31->Write(); | |
148 | c22->Write(); | |
149 | c32->Write(); | |
150 | */ | |
151 | ||
152 | } | |
153 | ||
154 | void myPadSetUp(TPad *currentPad, float currentLeft=0.11, float currentTop=0.04, float currentRight=0.04, float currentBottom=0.15){ | |
155 | currentPad->SetLeftMargin(currentLeft); | |
156 | currentPad->SetTopMargin(currentTop); | |
157 | currentPad->SetRightMargin(currentRight); | |
158 | currentPad->SetBottomMargin(currentBottom); | |
159 | return; | |
160 | } | |
161 | ||
162 | ||
163 | void myHistSetUp(TH1 *currentGraph=0){ | |
164 | ||
165 | currentGraph->SetLabelSize(0.05,"xyz"); | |
166 | currentGraph->SetLabelFont(42,"xyz"); | |
167 | currentGraph->SetLabelOffset(0.01,"xyz"); | |
168 | currentGraph->SetTitleFont(42,"xyz"); | |
169 | currentGraph->GetXaxis()->SetTitleOffset(1.1); | |
170 | currentGraph->GetYaxis()->SetTitleOffset(1.1); | |
171 | currentGraph->SetTitleSize(0.06,"xyz"); | |
172 | currentGraph->SetStats(kFALSE); | |
173 | currentGraph->SetTitle(""); | |
174 | return; | |
175 | } | |
176 | void myHistSetUp(TH2 *currentGraph=0){ | |
177 | ||
178 | currentGraph->SetLabelSize(0.05,"xyz"); | |
179 | currentGraph->SetLabelFont(42,"xyz"); | |
180 | currentGraph->SetLabelOffset(0.01,"xyz"); | |
181 | currentGraph->SetTitleFont(42,"xyz"); | |
182 | currentGraph->GetXaxis()->SetTitleOffset(1.3); | |
183 | currentGraph->GetYaxis()->SetTitleOffset(1.3); | |
184 | currentGraph->SetTitleSize(0.05,"xyz"); | |
185 | currentGraph->SetStats(kFALSE); | |
186 | currentGraph->SetTitle(""); | |
187 | return; | |
188 | } | |
189 | ||
190 | void myOptions(Int_t lStat=0){ | |
191 | // Set gStyle | |
192 | int font = 42; | |
193 | // From plain | |
194 | gStyle->SetFrameBorderMode(0); | |
195 | gStyle->SetFrameFillColor(0); | |
196 | gStyle->SetCanvasBorderMode(0); | |
197 | gStyle->SetPadBorderMode(0); | |
198 | gStyle->SetPadColor(10); | |
199 | gStyle->SetCanvasColor(10); | |
200 | gStyle->SetTitleFillColor(10); | |
201 | gStyle->SetTitleBorderSize(1); | |
202 | gStyle->SetStatColor(10); | |
203 | gStyle->SetStatBorderSize(1); | |
204 | gStyle->SetLegendBorderSize(1); | |
205 | // | |
206 | gStyle->SetDrawBorder(0); | |
207 | gStyle->SetTextFont(font); | |
208 | gStyle->SetStatFont(font); | |
209 | gStyle->SetStatFontSize(0.05); | |
210 | gStyle->SetStatX(0.97); | |
211 | gStyle->SetStatY(0.98); | |
212 | gStyle->SetStatH(0.03); | |
213 | gStyle->SetStatW(0.3); | |
214 | gStyle->SetTickLength(0.02,"y"); | |
215 | gStyle->SetEndErrorSize(3); | |
216 | gStyle->SetLabelSize(0.05,"xyz"); | |
217 | gStyle->SetLabelFont(font,"xyz"); | |
218 | gStyle->SetLabelOffset(0.01,"xyz"); | |
219 | gStyle->SetTitleFont(font,"xyz"); | |
220 | gStyle->SetTitleOffset(1.0,"xyz"); | |
221 | gStyle->SetTitleSize(0.06,"xyz"); | |
222 | gStyle->SetMarkerSize(1); | |
223 | gStyle->SetPalette(1,0); | |
224 | if (lStat){ | |
225 | gStyle->SetOptTitle(1); | |
226 | gStyle->SetOptStat(1111); | |
227 | gStyle->SetOptFit(1111); | |
228 | } | |
229 | else { | |
230 | gStyle->SetOptTitle(0); | |
231 | gStyle->SetOptStat(0); | |
232 | gStyle->SetOptFit(0); | |
233 | } | |
234 | } | |
235 |