]>
Commit | Line | Data |
---|---|---|
d63bea74 | 1 | /*************************************************** |
2 | processJETriggerQA: | |
3 | To procees JE Triggere QA wagon's output | |
4 | ||
5 | ****************************************************/ | |
6 | ||
7 | ||
8 | ||
9 | const Float_t ptmin = 0. ; //lower cutoff of jet pt spectrum | |
10 | ||
11 | void processJETriggerQA_V2(TString strFileIn = "AnalysisResults.root", | |
12 | TString suftype = "eps", | |
13 | Float_t jetR = 0.2, | |
14 | Float_t minTrkPT = 0.15, | |
15 | Float_t minClusterET = 0.3, | |
16 | Int_t run = 0, | |
17 | TString trigsuffix = "", | |
18 | const char* outfile = "JETriggerQA_outfile.root" | |
19 | ){ | |
20 | ||
21 | gStyle->SetOptStat(0); | |
22 | gStyle->SetOptTitle(0); | |
23 | ||
24 | TString prefix = "fig_je_TriggerQA_"; | |
25 | ||
26 | TFile * f1 = TFile::Open(strFileIn.Data()); | |
27 | ||
28 | if(!trigsuffix=="" || !trigsuffix=="EJE" || !trigsuffix=="EGA") | |
29 | {cout << "Unknown trigger suffix. It should be either empty, EJE or EGA." << endl; return;} | |
30 | ||
31 | //Load histogram list | |
32 | TString folder = Form("TriggerQA_Jet_AKTFullR%02d0_PicoTracks_pT%04d_CaloClustersCorr_ET%04d_pt_scheme_Jet_AKTChargedR%02d0_PicoTracks_pT%04d_CaloClustersCorr_ET%04d_pt_scheme_TC%s/TriggerQA_Jet_AKTFullR%02d0_PicoTracks_pT%04d_CaloClustersCorr_ET%04d_pt_scheme_Jet_AKTChargedR%02d0_PicoTracks_pT%04d_CaloClustersCorr_ET%04d_pt_scheme_TC%s", | |
33 | TMath::Nint(jetR*10), TMath::Nint(minTrkPT*1000), TMath::Nint(minClusterET*1000), | |
34 | TMath::Nint(jetR*10), TMath::Nint(minTrkPT*1000), TMath::Nint(minClusterET*1000),trigsuffix.Data(), | |
35 | TMath::Nint(jetR*10), TMath::Nint(minTrkPT*1000), TMath::Nint(minClusterET*1000), | |
36 | TMath::Nint(jetR*10), TMath::Nint(minTrkPT*1000), TMath::Nint(minClusterET*1000),trigsuffix.Data()); | |
37 | TList *histList = 0x0; | |
38 | histList = (TList*)f1->Get(folder); | |
39 | if(histList==0){ | |
40 | cout << "Could not find " << folder << " in " << strFileIn << endl; | |
41 | return; | |
42 | } | |
43 | ||
44 | //--------------------------------------------------------------------------------------------------- | |
45 | // jet histograms | |
46 | //--------------------------------------------------------------------------------------------------- | |
47 | ||
48 | const Int_t kJetType = 2; | |
49 | TString suffix[kJetType] = {"Charged","Full"}; | |
50 | TH3F *h3PtEtaPhiJet[kJetType]; | |
51 | TH1F *hPtJet[kJetType]; | |
52 | TH2F *hEtaPhiJet[kJetType]; | |
53 | TH2F *hRhoCent[kJetType]; | |
54 | ||
55 | TH1F *hNEventSel = histList->FindObject("fhNEvents"); | |
56 | Float_t nEvents = hNEventSel->GetBinContent(2); | |
57 | ||
58 | TProfile *hTriggerbit = histList->FindObject("fhTriggerbit"); | |
59 | UInt_t triggerbit = hTriggerbit->GetBinContent(1); | |
60 | ||
61 | for(Int_t itype = 0; itype < kJetType; itype++){ | |
62 | ||
63 | h3PtEtaPhiJet[itype] = (TH3F*) histList->FindObject(Form("fh3PtEtaPhiJet%s",suffix[itype].Data())); | |
64 | if(! h3PtEtaPhiJet[itype]) continue; | |
65 | ||
66 | //jet pt spectra | |
67 | Int_t binMin = 1; | |
68 | if(ptmin>0.) binMin = h3PtEtaPhiJet[itype]->GetXaxis()->FindBin(ptmin+0.00001); | |
69 | h3PtEtaPhiJet[itype]->GetXaxis()->SetRange(binMin, h3PtEtaPhiJet[itype]->GetNbinsX()); | |
70 | ||
71 | hPtJet[itype] = (TH1F*) h3PtEtaPhiJet[itype]->Project3D("x"); | |
72 | hPtJet[itype]->Scale(1./nEvents,"width"); | |
73 | SetHist((TH1F*) hPtJet[itype],"p_{T,corr}^{jet} (GeV)","1/N_{evt} dN/dp_{T,corr}^{jet} (GeV^{-1})"); | |
74 | hPtJet[itype]->SetName(Form("hPtJet%s",suffix[itype].Data())); | |
75 | ||
76 | //eta versus phi | |
77 | hEtaPhiJet[itype] = (TH2F*) h3PtEtaPhiJet[itype]->Project3D("yz"); | |
78 | SetHist((TH1F*) hEtaPhiJet[itype],"#varphi^{jet} (rad)","#eta^{jet}"); | |
79 | hEtaPhiJet[itype]->SetName(Form("hEtaPhiJet%s",suffix[itype].Data())); | |
80 | } | |
81 | ||
82 | for(Int_t itype = 0; itype < kJetType; itype++){ | |
83 | //rho versus centrality | |
84 | hRhoCent[itype] = (TH2F*) histList->FindObject(Form("fHistRhovsCent%s",suffix[itype].Data())); | |
85 | if(!hRhoCent[itype]) continue; | |
86 | SetHist((TH1F*) hRhoCent[itype], "Centrality (%)", Form("%s#rho (GeV/c*rad^{-1})", (suffix[itype]=="Full")?"s":"" )); | |
87 | hRhoCent[itype]->SetName(Form("hRhoCent%s",suffix[itype].Data())); | |
88 | } | |
89 | ||
90 | //______________ | |
91 | //Draw histograms | |
92 | ||
93 | TCanvas *c[100]; | |
94 | TH1F *frame[100]; | |
95 | Int_t nCan = 0; | |
96 | TLegend *leg; | |
97 | ||
98 | TString longtrigname = ""; | |
99 | UInt_t emcalPhysSelbit = 1<<31; | |
100 | if(triggerbit==AliVEvent::kAny) longtrigname = "kAny"; | |
101 | else if(triggerbit==AliVEvent::kAnyINT) longtrigname = "kAnyINT"; | |
102 | else if(triggerbit==emcalPhysSelbit) longtrigname = "EmcalPhysicsSelectionTask"; | |
103 | else { | |
104 | if(triggerbit & AliVEvent::kCentral) longtrigname += "kCentral"; | |
105 | if(triggerbit & AliVEvent::kSemiCentral) longtrigname += "kSemiCentral"; | |
106 | if(triggerbit & AliVEvent::kMB) longtrigname += "kMB"; | |
107 | } | |
108 | ||
109 | if(trigsuffix=="EJE") longtrigname += "AndkEMCEJE"; | |
110 | if(trigsuffix=="EGA") longtrigname += "AndkEMCEGA"; | |
111 | ||
112 | for(Int_t itype = 0; itype < kJetType; itype++){ //loop over charged and full jets | |
113 | ||
114 | //draw pt spectrum | |
115 | if(!hPtJet[itype]) continue; | |
116 | c[nCan] = new TCanvas(Form("c%d",nCan),Form("c%d: Pt %s jets",nCan,suffix[itype].Data()),600,450); | |
117 | SetCanvas((TCanvas*) c[nCan]); | |
118 | c[nCan]->SetLogy(); | |
119 | ||
120 | frame[nCan] = gPad->DrawFrame(hPtJet[itype]->GetBinLowEdge(1), | |
121 | 1e-7, | |
122 | hPtJet[itype]->GetBinLowEdge(hPtJet[itype]->GetNbinsX()+1), | |
123 | hPtJet[itype]->GetBinContent(hPtJet[itype]->GetMaximumBin())*2.); | |
124 | ||
125 | SetHist((TH1F*) frame[nCan],hPtJet[itype]->GetXaxis()->GetTitle(),hPtJet[itype]->GetYaxis()->GetTitle()); | |
126 | ||
127 | ||
128 | hPtJet[itype]->DrawCopy("same"); | |
129 | ||
130 | leg = new TLegend(0.15,0.5,0.88,0.88); | |
131 | SetLeg(leg); | |
132 | ||
133 | TString txt = Form("%s jets AKT R=%.1f",suffix[itype].Data(),jetR); | |
134 | if(run>0) txt += Form(" run:%d",run); | |
135 | leg->AddEntry((TObject*) 0, txt.Data(),""); | |
136 | leg->AddEntry((TObject*) 0, Form("Trigger: %s",longtrigname.Data()),""); | |
137 | leg->AddEntry((TObject*) 0, Form("p_{T,trk}> %d MeV",TMath::Nint(minTrkPT*1000)),""); | |
138 | if(itype==1) leg->AddEntry((TObject*) 0, Form("E_{T}>%d MeV",TMath::Nint(minClusterET*1000)),""); | |
139 | leg->AddEntry((TObject*) 0, Form("#it{N}_{events} = %.0f",nEvents),""); | |
140 | leg->Draw(); | |
141 | ||
142 | c[nCan]->SaveAs(Form("%s_Pt_AKT%02d_pT%04d_ET%04d_Run%d_Trigger%s_%s.%s",prefix.Data(),TMath::Nint(jetR*10), | |
143 | TMath::Nint(minTrkPT*1000),TMath::Nint(minClusterET*1000), run, longtrigname.Data(), suffix[itype].Data(), suftype.Data())); | |
144 | ||
145 | nCan++; | |
146 | }//end of loop over charged and full jets | |
147 | //_________________ | |
148 | //draw eta versus phi | |
149 | for(Int_t itype = 0; itype < kJetType; itype++){ //loop over charged and full jets | |
150 | if(!hEtaPhiJet[itype]) continue; | |
151 | c[nCan] = new TCanvas(Form("c%d",nCan),Form("c%d: eta-phi %s jets",nCan,suffix[itype].Data()),600,450); | |
152 | SetCanvas((TCanvas*) c[nCan]); | |
153 | c[nCan]->SetRightMargin(0.15); | |
154 | ||
155 | frame[nCan] = gPad->DrawFrame(hEtaPhiJet[itype]->GetXaxis()->GetBinLowEdge(1), | |
156 | hEtaPhiJet[itype]->GetYaxis()->GetBinLowEdge(1), | |
157 | hEtaPhiJet[itype]->GetXaxis()->GetBinLowEdge(hEtaPhiJet[itype]->GetNbinsX()), | |
158 | hEtaPhiJet[itype]->GetYaxis()->GetBinLowEdge(hEtaPhiJet[itype]->GetNbinsY())); | |
159 | ||
160 | SetHist((TH1F*) frame[nCan],hEtaPhiJet[itype]->GetXaxis()->GetTitle(),hEtaPhiJet[itype]->GetYaxis()->GetTitle()); | |
161 | ||
162 | ||
163 | hEtaPhiJet[itype]->DrawCopy("same,colz"); | |
164 | ||
165 | leg = new TLegend(0.15,0.5,0.88,0.88); | |
166 | SetLeg(leg); | |
167 | ||
168 | TString txt = Form("%s jets AKT R=%.1f",suffix[itype].Data(),jetR); | |
169 | if(run>0) txt += Form(" run:%d",run); | |
170 | leg->AddEntry((TObject*) 0, txt.Data(),""); | |
171 | leg->AddEntry((TObject*) 0, Form("Trigger: %s",longtrigname.Data()),""); | |
172 | leg->AddEntry((TObject*) 0, Form("p_{T,trk}> %d MeV",TMath::Nint(minTrkPT*1000)),""); | |
173 | if(itype==1) leg->AddEntry((TObject*) 0, Form("E_{T}>%d MeV",TMath::Nint(minClusterET*1000)),""); | |
174 | leg->AddEntry((TObject*) 0, Form("#it{N}_{events} = %.0f",nEvents),""); | |
175 | leg->AddEntry((TObject*) 0, Form("p_{T,corr}^{jet} > %.1f GeV", ptmin),""); | |
176 | leg->Draw(); | |
177 | ||
178 | c[nCan]->SaveAs(Form("%s_EtaPhi_AKT%02d_pT%04d_ET%04d_Run%d_Trigger%s_%s.%s",prefix.Data(),TMath::Nint(jetR*10), | |
179 | TMath::Nint(minTrkPT*1000),TMath::Nint(minClusterET*1000), run, longtrigname.Data(), suffix[itype].Data(), suftype.Data())); | |
180 | ||
181 | nCan++; | |
182 | }//end of the loop over charged and full jets | |
183 | //_________________ | |
184 | //draw rho versus centrality | |
185 | for(Int_t itype = 0; itype < kJetType; itype++){ //loop over charged and full jets | |
186 | if(hRhoCent[itype]) { | |
187 | c[nCan] = new TCanvas(Form("c%d",nCan),Form("c%d: Rho-Cent",nCan),600,450); | |
188 | SetCanvas((TCanvas*) c[nCan]); | |
189 | c[nCan]->SetRightMargin(0.15); | |
190 | c[nCan]->SetLogz(); | |
191 | ||
192 | frame[nCan] = gPad->DrawFrame(hRhoCent[itype]->GetXaxis()->GetBinLowEdge(1), | |
193 | hRhoCent[itype]->GetYaxis()->GetBinLowEdge(1), | |
194 | hRhoCent[itype]->GetXaxis()->GetBinLowEdge(hRhoCent[itype]->GetNbinsX()), | |
195 | hRhoCent[itype]->GetYaxis()->GetBinLowEdge(hRhoCent[itype]->GetNbinsY())); | |
196 | ||
197 | SetHist((TH1F*) frame[nCan],hRhoCent[itype]->GetXaxis()->GetTitle(),hRhoCent[itype]->GetYaxis()->GetTitle()); | |
198 | ||
199 | hRhoCent[itype]->DrawCopy("colz"); | |
200 | ||
201 | leg = new TLegend(0.15,0.5,0.88,0.88); | |
202 | SetLeg(leg); | |
203 | ||
204 | TString txt = Form("%s jets AKT R=%.1f",suffix[itype].Data(),jetR); | |
205 | if(run>0) txt += Form(" run:%d",run); | |
206 | ||
207 | leg->AddEntry((TObject*) 0, txt.Data(),""); | |
208 | leg->AddEntry((TObject*) 0, Form("Trigger: %s",longtrigname.Data()),""); | |
209 | leg->AddEntry((TObject*) 0, Form("#it{N}_{events} = %.0f",nEvents),""); | |
210 | leg->Draw(); | |
211 | ||
212 | c[nCan]->SaveAs(Form("%s_RhoCent_AKT%02d_pT%04d_ET%04d_Run%d_Trigger%s_%s.%s",prefix.Data(),TMath::Nint(jetR*10), | |
213 | TMath::Nint(minTrkPT*1000),TMath::Nint(minClusterET*1000), run, longtrigname.Data(), suffix[itype].Data(), suftype.Data())); | |
214 | nCan++; | |
215 | } | |
216 | }//end of the loop over charged and full jets | |
217 | ||
218 | //--------------------------------------------------------------------------------------------------- | |
219 | // WRITE OUTPUT TO ROOT FILE | |
220 | //--------------------------------------------------------------------------------------------------- | |
221 | ||
222 | ||
223 | /* Standalone output | |
224 | TFile *histOut = new TFile(Form("%s_AKT%02d_pT%04d_ET%04d_jetPtMin%.1f_Run%d.root",prefix.Data(), | |
225 | TMath::Nint(jetR*10), TMath::Nint(minTrkPT*1000), TMath::Nint(minClusterET*1000),ptmin,run),"RECREATE"); | |
226 | ||
227 | for(Int_t itype = 0; itype < kJetType; itype++){ //loop over charged and full jets | |
228 | ||
229 | if(hPtJet[itype]) hPtJet[itype]->Write(); | |
230 | if(hEtaPhiJet[itype]) hEtaPhiJet[itype]->Write(); | |
231 | if(hRhoCent[itype]) hRhoCent[itype]->Write(); | |
232 | } | |
233 | ||
234 | histOut->Close(); | |
235 | ||
236 | */ | |
237 | ||
238 | // Common output - | |
239 | // Added by sjena | |
240 | ||
241 | TFile *fout = TFile::Open(outfile,"UPDATE"); | |
242 | fout->ls(); | |
243 | ||
244 | TDirectoryFile *cdd = NULL; | |
245 | cdd = (TDirectoryFile*)fout->Get("JE"); | |
246 | if(!cdd) { | |
247 | Printf("Warning: JE <dir> doesn't exist, creating a new one"); | |
248 | cdd = (TDirectoryFile*)fout->mkdir("JE"); | |
249 | } | |
250 | cdd->cd(); | |
251 | cdd->ls(); | |
252 | ||
253 | for(Int_t itype = 0; itype < kJetType; itype++){ //loop over charged and full jets | |
254 | ||
255 | if(hPtJet[itype]) hPtJet[itype]->Write(Form("%s%d_%s",prefix.Data(), itype, hPtJet[itype]->GetName())); | |
256 | if(hEtaPhiJet[itype]) hEtaPhiJet[itype]->Write(Form("%s%d_%s",prefix.Data(), itype, hEtaPhiJet[itype]->GetName())); | |
257 | if(hRhoCent[itype]) hRhoCent[itype]->Write(Form("%s%d_%s",prefix.Data(), itype, hRhoCent[itype]->GetName())); | |
258 | } | |
259 | ||
260 | fout->Close(); | |
261 | ||
262 | ||
263 | ||
264 | } | |
265 | //__________________________________________________________ | |
266 | ||
267 | void SetHist(TH1* h,TString titx, TString tity){ | |
268 | ||
269 | h->GetXaxis()->SetTitle(titx.Data()); | |
270 | h->GetYaxis()->SetTitle(tity.Data()); | |
271 | h->GetXaxis()->SetTitleSize(0.06); | |
272 | h->GetYaxis()->SetTitleSize(0.06); | |
273 | h->GetYaxis()->SetTitleOffset(1.); | |
274 | h->GetXaxis()->SetTitleOffset(1.); | |
275 | h->SetLineWidth(3); | |
276 | ||
277 | } | |
278 | //_____________________________________________________________________ | |
279 | ||
280 | void SetCanvas(TCanvas* c){ | |
281 | c->SetLeftMargin(0.15); | |
282 | c->SetBottomMargin(0.15); | |
283 | c->SetRightMargin(0.05); | |
284 | c->SetTopMargin(0.05); | |
285 | c->SetTickx(); | |
286 | c->SetTicky(); | |
287 | } | |
288 | //_____________________________________________________________________ | |
289 | ||
290 | void SetLeg(TLegend* le){ | |
291 | le->SetFillColor(10); | |
292 | le->SetBorderSize(0); | |
293 | le->SetFillStyle(0); | |
294 | le->SetTextSize(0.05); | |
295 | } |