]>
Commit | Line | Data |
---|---|---|
063775bb | 1 | #ifndef __CINT__ |
c0d2a42f | 2 | #include "TFile.h" |
3 | #include "TTree.h" | |
4 | #include "TH1D.h" | |
5 | #include "TCanvas.h" | |
6 | #include "TStyle.h" | |
063775bb | 7 | #include "AliDAQ.h" |
8 | #endif | |
c0d2a42f | 9 | #include "map" |
10 | using namespace std; | |
11 | // TODO read number of bits from AliVEvent? | |
12 | #define NBITS 29 | |
063775bb | 13 | #define NMAXCLASSES 100 |
14 | ||
c0d2a42f | 15 | TString bitNames[NBITS] = { |
16 | "kMB", | |
17 | "kINT7", | |
18 | "kMUON", | |
19 | "kHighMult", | |
20 | "kEMC1", | |
21 | "kCINT5", | |
22 | "kCMUS5", | |
23 | "kMUSH7", | |
24 | "kMUL7", | |
25 | "kMUU7", | |
26 | "kEMC7", | |
27 | "kMUS7", | |
28 | "kPHI1", | |
063775bb | 29 | "kPHI78", |
c0d2a42f | 30 | "kEMCEJE", |
31 | "kEMCEGA", | |
32 | "kCentral", | |
33 | "kSemiCentral", | |
34 | "kDG5", | |
35 | "kZED", | |
063775bb | 36 | "kSPI78", |
c0d2a42f | 37 | "kINT8", |
38 | "kMuonSingleLowPt8", | |
39 | "kMuonSingleHighPt8", | |
40 | "kMuonLikeLowPt8", | |
41 | "kMuonUnlikeLowPt8", | |
42 | "kMuonUnlikeLowPt0", | |
43 | "kUserDefined", | |
44 | "kTRD" | |
45 | }; | |
46 | ||
47 | void SetHisto(TH1D* h); | |
063775bb | 48 | void SetHisto(TH2D* h); |
c0d2a42f | 49 | void AddFillSeparationLines(TH1D* h, map<Int_t,Int_t> &fills); |
50 | ||
063775bb | 51 | //void periodLevelQA(TString inputFileName ="/afs/cern.ch/work/a/aliqaevs/www/data/2012/LHC12h/pass1/trending.root"){ |
c0d2a42f | 52 | void periodLevelQA(TString inputFileName ="trending.root"){ |
063775bb | 53 | gStyle->SetOptStat(0); |
54 | gStyle->SetLineScalePS(1.5); | |
55 | gStyle->SetPadGridX(0); | |
56 | gStyle->SetPadGridY(1); | |
57 | ||
c0d2a42f | 58 | TFile* f = new TFile(inputFileName.Data()); |
59 | TTree* t = (TTree*) f->Get("trending"); | |
063775bb | 60 | TObjArray* classes = new TObjArray(); |
61 | TObjString* activeDetectors = new TObjString(); | |
62 | Int_t run = 0; | |
63 | Int_t fill = 0; | |
64 | Double_t run_duration = 0; | |
65 | Int_t nBCsPerOrbit = 0; | |
66 | Double_t refl0b = 0; | |
67 | Double_t mu = 0; | |
68 | Double_t lumi_seen = 0; | |
69 | Double_t interactionRate = 0; | |
70 | ULong64_t class_l0b[NMAXCLASSES] = {0}; | |
71 | ULong64_t class_l0a[NMAXCLASSES] = {0}; | |
72 | ULong64_t class_l1b[NMAXCLASSES] = {0}; | |
73 | ULong64_t class_l1a[NMAXCLASSES] = {0}; | |
74 | ULong64_t class_l2b[NMAXCLASSES] = {0}; | |
75 | ULong64_t class_l2a[NMAXCLASSES] = {0}; | |
76 | Double_t class_lifetime[NMAXCLASSES] = {0}; | |
77 | Double_t class_lumi[NMAXCLASSES] = {0}; | |
78 | ULong64_t alias_recorded[NBITS] = {0}; | |
79 | ULong64_t alias_reconstructed[NBITS] = {0}; | |
80 | ULong64_t alias_accepted[NBITS] = {0}; | |
81 | Double_t alias_l0b_rate[NBITS] = {0}; | |
82 | Double_t alias_lifetime[NBITS] = {0}; | |
83 | Double_t alias_lumi_recorded[NBITS] = {0}; | |
84 | Double_t alias_lumi_reconstructed[NBITS] = {0}; | |
85 | Double_t alias_lumi_accepted[NBITS] = {0}; | |
c0d2a42f | 86 | |
87 | t->SetBranchAddress("run",&run); | |
88 | t->SetBranchAddress("fill",&fill); | |
89 | t->SetBranchAddress("bcs",&nBCsPerOrbit); | |
063775bb | 90 | t->SetBranchAddress("run_duration",&run_duration); |
c0d2a42f | 91 | t->SetBranchAddress("mu",&mu); |
063775bb | 92 | t->SetBranchAddress("interactionRate",&interactionRate); |
93 | t->SetBranchAddress("refl0b",&refl0b); | |
c0d2a42f | 94 | t->SetBranchAddress("lumi_seen",&lumi_seen); |
063775bb | 95 | t->SetBranchAddress("classes",&classes); |
96 | t->SetBranchAddress("class_l0b",&class_l0b); | |
97 | t->SetBranchAddress("class_l0a",&class_l0a); | |
98 | t->SetBranchAddress("class_l1b",&class_l1b); | |
99 | t->SetBranchAddress("class_l1a",&class_l1a); | |
100 | t->SetBranchAddress("class_l2b",&class_l2b); | |
101 | t->SetBranchAddress("class_l2a",&class_l2a); | |
102 | t->SetBranchAddress("class_lifetime",&class_lifetime); | |
103 | t->SetBranchAddress("class_lumi",&class_lumi); | |
104 | t->SetBranchAddress("alias_recorded",&alias_recorded); | |
105 | t->SetBranchAddress("alias_reconstructed",&alias_reconstructed); | |
106 | t->SetBranchAddress("alias_accepted",&alias_accepted); | |
107 | t->SetBranchAddress("alias_l0b_rate",&alias_lifetime); | |
108 | t->SetBranchAddress("alias_lifetime",&alias_lifetime); | |
109 | t->SetBranchAddress("alias_lumi_recorded",&alias_lumi_recorded); | |
110 | t->SetBranchAddress("alias_lumi_reconstructed",&alias_lumi_reconstructed); | |
111 | t->SetBranchAddress("alias_lumi_accepted",&alias_lumi_accepted); | |
112 | t->SetBranchAddress("activeDetectors",&activeDetectors); | |
113 | ||
c0d2a42f | 114 | Int_t nRuns = t->GetEntries(); |
063775bb | 115 | TH2D* hClassL0BvsRun = new TH2D("hClassL0BVsRun","Class L0B vs run",nRuns,0,nRuns,1,0,1); |
116 | TH2D* hClassL2AvsRun = new TH2D("hClassL2AVsRun","Class L2A vs run",nRuns,0,nRuns,1,0,1); | |
117 | TH2D* hClassLifetimeVsRun = new TH2D("hClassLifetimeVsRun","Lifetime class-by-class vs run",nRuns,0,nRuns,1,0,1); | |
118 | TH2D* hClassLumiVsRun = new TH2D("hClassLumiVsRun","Luminosity class-by-class vs run",nRuns,0,nRuns,1,0,1); | |
119 | hClassL0BvsRun->SetBit(TH1::kCanRebin); | |
120 | hClassL2AvsRun->SetBit(TH1::kCanRebin); | |
121 | hClassLifetimeVsRun->SetBit(TH1::kCanRebin); | |
122 | hClassLumiVsRun->SetBit(TH1::kCanRebin); | |
123 | for (Int_t r=0;r<nRuns;r++){ | |
124 | t->GetEntry(r); | |
125 | printf("run=%i\n",run); | |
126 | hClassL0BvsRun->GetXaxis()->SetBinLabel(r+1,Form("%i",run)); | |
127 | hClassL2AvsRun->GetXaxis()->SetBinLabel(r+1,Form("%i",run)); | |
128 | hClassLifetimeVsRun->GetXaxis()->SetBinLabel(r+1,Form("%i",run)); | |
129 | hClassLumiVsRun->GetXaxis()->SetBinLabel(r+1,Form("%i",run)); | |
130 | for (Int_t i=0;i<classes->GetEntriesFast();i++){ | |
131 | TString className = classes->At(i)->GetName(); | |
132 | if (className.Contains("-A-")) continue; | |
133 | else if (className.Contains("-C-")) continue; | |
134 | else if (className.Contains("-E-")) continue; | |
135 | else if (className.Contains("-AC-")) continue; | |
136 | else if (className.Contains("-ACE-")) continue; | |
137 | else if (className.Contains("-GA-")) continue; | |
138 | else if (className.Contains("-GC-")) continue; | |
139 | else if (className.Contains("1A-ABCE-")) continue; | |
140 | else if (className.Contains("1C-ABCE-")) continue; | |
141 | else if (className.Contains("C0LSR-ABCE-")) continue; | |
142 | // printf("%30s %12lli %10lli %10lli %10lli %10lli %10lli\n",className.Data(),L0B[i],L0A[i],L1B[i],L1A[i],L2B[i],L2A[i]); | |
143 | hClassL0BvsRun->Fill(Form("%i",run),className.Data(),Double_t(class_l0b[i])); | |
144 | hClassL2AvsRun->Fill(Form("%i",run),className.Data(),Double_t(class_l2a[i])); | |
145 | hClassLifetimeVsRun->Fill(Form("%i",run),className.Data(),class_lifetime[i]); | |
146 | hClassLumiVsRun ->Fill(Form("%i",run),className.Data(),class_lumi[i]); | |
147 | } | |
148 | } | |
c0d2a42f | 149 | |
063775bb | 150 | hClassL0BvsRun->LabelsDeflate("Y"); |
151 | hClassL2AvsRun->LabelsDeflate("Y"); | |
152 | hClassLifetimeVsRun->LabelsDeflate("Y"); | |
153 | hClassLumiVsRun->LabelsDeflate("Y"); | |
c0d2a42f | 154 | |
063775bb | 155 | map<Int_t,Int_t> fills; |
156 | TH1D* hRecorded[NBITS] = {0x0}; | |
157 | TH1D* hReconstructed[NBITS] = {0x0}; | |
158 | TH1D* hAccepted[NBITS] = {0x0}; | |
159 | TH1D* hRejected[NBITS] = {0x0}; | |
160 | TH1D* hAcceptedFraction[NBITS] = {0x0}; | |
161 | TH1D* hRejectedFraction[NBITS] = {0x0}; | |
162 | TH1D* hLumiRecorded[NBITS] = {0x0}; | |
163 | TH1D* hLumiReconstructed[NBITS] = {0x0}; | |
164 | TH1D* hLumiAccepted[NBITS] = {0x0}; | |
165 | ||
166 | TH2D* hActiveDetectors = new TH2D("hActiveDetectors","Active detectors",nRuns,0,nRuns,AliDAQ::kNDetectors,0,AliDAQ::kNDetectors); | |
167 | TH1D* hInteractionRate = new TH1D("hInteractionRate","Minimum bias interaction rate [Hz]",nRuns,0,nRuns); | |
c0d2a42f | 168 | TH1D* hMu = new TH1D("hMu","Average number of minimum bias collisions per BC",nRuns,0,nRuns); |
169 | TH1D* hBCs = new TH1D("hBCs","Number of colliding bunches",nRuns,0,nRuns); | |
170 | TH1D* hDuration = new TH1D("hDuration","Duration, s",nRuns,0,nRuns); | |
171 | TH1D* hLumiSeen = new TH1D("hLumiSeen","Luminosity seen, nb-1",nRuns,0,nRuns); | |
172 | ||
063775bb | 173 | for (Int_t iDet=0;iDet<AliDAQ::kNDetectors;iDet++) { |
174 | // if (!TString(AliDAQ::DetectorName(iDet)).CompareTo("HLT")) continue; | |
175 | // else if (!TString(AliDAQ::DetectorName(iDet)).CompareTo("TRG")) continue; | |
176 | // else if (!TString(AliDAQ::DetectorName(iDet)).CompareTo("MFT")) continue; | |
177 | // else if (!TString(AliDAQ::DetectorName(iDet)).CompareTo("FIT")) continue; | |
178 | // else if (!TString(AliDAQ::DetectorName(iDet)).CompareTo("CPV")) continue; | |
179 | // else if (!TString(AliDAQ::DetectorName(iDet)).CompareTo("DAQ_TEST")) continue; | |
180 | hActiveDetectors->GetYaxis()->SetBinLabel(iDet+1,AliDAQ::DetectorName(iDet)); | |
181 | } | |
182 | ||
c0d2a42f | 183 | for (Int_t r=0;r<nRuns;r++){ |
184 | t->GetEntry(r); | |
063775bb | 185 | hActiveDetectors->GetXaxis()->SetBinLabel(r+1,Form("%i",run)); |
186 | hInteractionRate->GetXaxis()->SetBinLabel(r+1,Form("%i",run)); | |
c0d2a42f | 187 | hMu->GetXaxis()->SetBinLabel(r+1,Form("%i",run)); |
188 | hBCs->GetXaxis()->SetBinLabel(r+1,Form("%i",run)); | |
189 | hDuration->GetXaxis()->SetBinLabel(r+1,Form("%i",run)); | |
190 | hLumiSeen->GetXaxis()->SetBinLabel(r+1,Form("%i",run)); | |
063775bb | 191 | for (Int_t iDet=0;iDet<AliDAQ::kNDetectors;iDet++) { |
192 | // if (!TString(AliDAQ::DetectorName(iDet)).CompareTo("HLT")) continue; | |
193 | // else if (!TString(AliDAQ::DetectorName(iDet)).CompareTo("TRG")) continue; | |
194 | // else if (!TString(AliDAQ::DetectorName(iDet)).CompareTo("MFT")) continue; | |
195 | // else if (!TString(AliDAQ::DetectorName(iDet)).CompareTo("FIT")) continue; | |
196 | // else if (!TString(AliDAQ::DetectorName(iDet)).CompareTo("CPV")) continue; | |
197 | // else if (!TString(AliDAQ::DetectorName(iDet)).CompareTo("DAQ_TEST")) continue; | |
198 | hActiveDetectors->Fill(Form("%i",run),AliDAQ::DetectorName(iDet),activeDetectors->String().Contains(AliDAQ::DetectorName(iDet))); | |
199 | } | |
200 | hInteractionRate->SetBinContent(r+1,interactionRate); | |
c0d2a42f | 201 | hMu->SetBinContent(r+1,mu); |
202 | hBCs->SetBinContent(r+1,nBCsPerOrbit); | |
063775bb | 203 | hDuration->SetBinContent(r+1,run_duration); |
204 | hLumiSeen->SetBinContent(r+1,lumi_seen); | |
c0d2a42f | 205 | fills[run]=fill; |
206 | } | |
063775bb | 207 | |
208 | TFile* fclassL0B = new TFile("class_L0B_counts.root","recreate"); | |
209 | TCanvas* cClassL0B = new TCanvas("cClassL0B","Class L0B vs run",1800,900); | |
210 | gPad->SetMargin(0.15,0.01,0.08,0.06); | |
211 | SetHisto(hClassL0BvsRun); | |
212 | hClassL0BvsRun->Draw("col"); | |
213 | gPad->Print("class_L0B_counts.pdf("); | |
214 | hClassL0BvsRun->Write(); | |
215 | TCanvas* cL0B = new TCanvas("cL0B","L0B vs run",1800,500); | |
216 | cL0B->SetMargin(0.05,0.01,0.18,0.06); | |
217 | for (Int_t i=1;i<=hClassL0BvsRun->GetNbinsY();i++){ | |
218 | TH1D* h = (TH1D*) hClassL0BvsRun->ProjectionX(Form("hClassL0BvsRun_%02i",i),i,i); | |
219 | h->SetTitle(Form("%s L0B counts: %.0f",hClassL0BvsRun->GetYaxis()->GetBinLabel(i),h->Integral())); | |
220 | SetHisto(h); | |
221 | h->Draw(); | |
222 | AddFillSeparationLines(h,fills); | |
223 | gPad->Print("class_L0B_counts.pdf"); | |
224 | h->Write(); | |
225 | } | |
226 | gPad->Print("class_L0B_counts.pdf]"); | |
227 | fclassL0B->Close(); | |
228 | ||
229 | TFile* fclassL2A = new TFile("class_L2A_counts.root","recreate"); | |
230 | TCanvas* cClassL2A = new TCanvas("cClassL2A","Class L2A vs run",1800,900); | |
231 | gPad->SetMargin(0.15,0.01,0.08,0.06); | |
232 | SetHisto(hClassL2AvsRun); | |
233 | hClassL2AvsRun->Draw("col"); | |
234 | gPad->Print("class_L2A_counts.pdf("); | |
235 | hClassL2AvsRun->Write(); | |
236 | TCanvas* cL2A = new TCanvas("cL2A","L2A vs run",1800,500); | |
237 | cL2A->SetMargin(0.05,0.01,0.18,0.06); | |
238 | for (Int_t i=1;i<=hClassL2AvsRun->GetNbinsY();i++){ | |
239 | TH1D* h = (TH1D*) hClassL2AvsRun->ProjectionX(Form("hClassL2AvsRun_%02i",i),i,i); | |
240 | h->SetTitle(Form("%s L2A counts: %.0f",hClassL2AvsRun->GetYaxis()->GetBinLabel(i),h->Integral())); | |
241 | SetHisto(h); | |
242 | h->Draw(); | |
243 | AddFillSeparationLines(h,fills); | |
244 | gPad->Print("class_L2A_counts.pdf"); | |
245 | h->Write(); | |
246 | } | |
247 | gPad->Print("class_L2A_counts.pdf]"); | |
248 | fclassL2A->Close(); | |
249 | ||
250 | TFile* fclassLifetime = new TFile("class_lifetime.root","recreate"); | |
251 | TCanvas* cClassLifetime = new TCanvas("cClassLifetime","Lifetime class-by-class vs run",1800,900); | |
252 | gPad->SetMargin(0.15,0.01,0.08,0.06); | |
253 | SetHisto(hClassLifetimeVsRun); | |
254 | hClassLifetimeVsRun->Draw("col"); | |
255 | gPad->Print("class_lifetime.pdf("); | |
256 | hClassLifetimeVsRun->Write(); | |
257 | TCanvas* cL2A = new TCanvas("cLifetime","Lifetime vs run",1800,500); | |
258 | cL2A->SetMargin(0.05,0.01,0.18,0.06); | |
259 | for (Int_t i=1;i<=hClassLifetimeVsRun->GetNbinsY();i++){ | |
260 | TH1D* h = (TH1D*) hClassLifetimeVsRun->ProjectionX(Form("hClassLifetimeVsRun_%02i",i),i,i); | |
261 | h->SetTitle(Form("%s lifetime",hClassLifetimeVsRun->GetYaxis()->GetBinLabel(i))); | |
262 | SetHisto(h); | |
263 | h->SetFillColor(0); | |
264 | h->Draw(""); | |
265 | AddFillSeparationLines(h,fills); | |
266 | gPad->Print("class_lifetime.pdf"); | |
267 | h->Write(); | |
268 | } | |
269 | gPad->Print("class_lifetime.pdf]"); | |
270 | fclassLifetime->Close(); | |
271 | ||
272 | TFile* fclassLumi = new TFile("class_lumi.root","recreate"); | |
273 | TCanvas* cClassLumi = new TCanvas("cClassLumi","Luminosity class-by-class vs run",1800,900); | |
274 | gPad->SetMargin(0.15,0.01,0.08,0.06); | |
275 | SetHisto(hClassLumiVsRun); | |
276 | hClassLumiVsRun->Draw("col"); | |
277 | gPad->Print("class_lumi.pdf("); | |
278 | TCanvas* clumi = new TCanvas("clumi","lumi vs run",1800,500); | |
279 | clumi->SetMargin(0.05,0.01,0.18,0.06); | |
280 | ||
281 | for (Int_t i=1;i<=hClassLumiVsRun->GetNbinsY();i++){ | |
282 | TH1D* h = (TH1D*) hClassLumiVsRun->ProjectionX(Form("hClassLumiVsRun_%02i",i),i,i); | |
283 | h->SetTitle(Form("%s luminosity [ub-1]: %.0g",hClassLumiVsRun->GetYaxis()->GetBinLabel(i),h->Integral())); | |
284 | SetHisto(h); | |
285 | h->Draw(); | |
286 | AddFillSeparationLines(h,fills); | |
287 | gPad->Print("class_lumi.pdf"); | |
288 | } | |
289 | gPad->Print("class_lumi.pdf]"); | |
290 | fclassLumi->Close(); | |
291 | ||
292 | SetHisto(hActiveDetectors); | |
293 | SetHisto(hInteractionRate); | |
c0d2a42f | 294 | SetHisto(hMu); |
295 | SetHisto(hBCs); | |
296 | SetHisto(hDuration); | |
297 | SetHisto(hLumiSeen); | |
063775bb | 298 | |
299 | TCanvas* cActiveDetectors = new TCanvas("active_detectors","Active Detectors",1800,500); | |
300 | cActiveDetectors->SetMargin(0.05,0.01,0.18,0.06); | |
301 | hActiveDetectors->GetYaxis()->SetLabelOffset(0.001); | |
302 | hActiveDetectors->SetMaximum(2); | |
303 | hActiveDetectors->Draw("col"); | |
304 | AddFillSeparationLines(hMu,fills); | |
305 | gPad->Print("global_properties.pdf("); | |
306 | ||
307 | TCanvas* cInteractionRate = new TCanvas("cInteractionRate","Interaction Rate",1800,500); | |
308 | cInteractionRate->SetMargin(0.05,0.01,0.18,0.06); | |
309 | hInteractionRate->SetFillColor(0); | |
310 | hInteractionRate->Draw(); | |
311 | AddFillSeparationLines(hMu,fills); | |
312 | gPad->Print("global_properties.pdf"); | |
313 | ||
c0d2a42f | 314 | TCanvas* cMu = new TCanvas("mu","mu",1800,500); |
315 | cMu->SetMargin(0.05,0.01,0.18,0.06); | |
063775bb | 316 | hMu->SetFillColor(0); |
c0d2a42f | 317 | hMu->Draw("h"); |
318 | AddFillSeparationLines(hMu,fills); | |
319 | gPad->Print("global_properties.pdf"); | |
320 | ||
321 | TCanvas* cBCs = new TCanvas("bcs","bcs",1800,500); | |
322 | cBCs->SetMargin(0.05,0.01,0.18,0.06); | |
063775bb | 323 | hBCs->SetFillColor(0); |
c0d2a42f | 324 | hBCs->Draw("h"); |
325 | AddFillSeparationLines(hBCs,fills); | |
326 | gPad->Print("global_properties.pdf"); | |
327 | ||
328 | TCanvas* cDuration = new TCanvas("duration","duration",1800,500); | |
329 | cDuration->SetMargin(0.05,0.01,0.18,0.06); | |
330 | hDuration->SetTitle(Form("Duration in seconds: total= %.0f s = %.0f h",hDuration->Integral(),hDuration->Integral()/3600)); | |
331 | hDuration->Draw("h"); | |
332 | AddFillSeparationLines(hDuration,fills); | |
333 | gPad->Print("global_properties.pdf"); | |
334 | ||
335 | TCanvas* cLumiSeen = new TCanvas("lumiseen","lumi seen",1800,500); | |
336 | cLumiSeen->SetMargin(0.05,0.01,0.18,0.06); | |
063775bb | 337 | hLumiSeen->SetTitle(Form("Luminosity seen [1/ub]: total= %.0g",hLumiSeen->Integral())); |
c0d2a42f | 338 | hLumiSeen->Draw("h"); |
339 | AddFillSeparationLines(hLumiSeen,fills); | |
063775bb | 340 | gPad->Print("global_properties.pdf)"); |
c0d2a42f | 341 | |
063775bb | 342 | TCanvas* dummy = new TCanvas("dummy","dummy",1800,500); |
343 | gPad->SetMargin(0.05,0.01,0.18,0.06); | |
344 | gPad->Print("alias_event_statistics.pdf["); | |
345 | gPad->Print("alias_lumi_statistics.pdf["); | |
346 | gPad->Print("accepted_fraction.pdf["); | |
347 | gPad->Print("rejected_fraction.pdf["); | |
c0d2a42f | 348 | |
063775bb | 349 | TCanvas* cCounts = new TCanvas("c_alias_counts" ,"c_alias_counts" ,1800,500); |
350 | TCanvas* cLumi = new TCanvas("c_lumi" ,"c_lumi" ,1800,500); | |
351 | TCanvas* cAcceptedFraction = new TCanvas("accepted_fraction","accepted fraction",1800,500); | |
352 | TCanvas* cRejectedFraction = new TCanvas("rejected_fraction","rejected fraction",1800,500); | |
353 | cCounts ->SetMargin(0.05,0.01,0.18,0.06); | |
354 | cLumi ->SetMargin(0.05,0.01,0.18,0.06); | |
355 | cAcceptedFraction->SetMargin(0.05,0.01,0.18,0.06); | |
356 | cRejectedFraction->SetMargin(0.05,0.01,0.18,0.06); | |
357 | cRejectedFraction->SetLogy(); | |
c0d2a42f | 358 | |
359 | for (Int_t ibit=0;ibit<NBITS;ibit++) { | |
c0d2a42f | 360 | const char* bitName = bitNames[ibit]; |
063775bb | 361 | |
362 | hRecorded[ibit] = new TH1D(Form("hRecorded%02i" ,ibit),Form("Recorded: %s" ,bitName),nRuns,0,nRuns); | |
363 | hReconstructed[ibit] = new TH1D(Form("hReconstructed%02i" ,ibit),Form("Reconstructed: %s" ,bitName),nRuns,0,nRuns); | |
364 | hAccepted[ibit] = new TH1D(Form("hAccepted%02i" ,ibit),Form("Accepted: %s" ,bitName),nRuns,0,nRuns); | |
365 | hRejected[ibit] = new TH1D(Form("hRejected%02i" ,ibit),Form("Rejected: %s" ,bitName),nRuns,0,nRuns); | |
366 | hLumiRecorded[ibit] = new TH1D(Form("hLumiRecorded%02i" ,ibit),Form("Lumi recorded: %s" ,bitName),nRuns,0,nRuns); | |
367 | hLumiReconstructed[ibit] = new TH1D(Form("hLumiReconstructed%02i",ibit),Form("Lumi reconstructed: %s",bitName),nRuns,0,nRuns); | |
368 | hLumiAccepted[ibit] = new TH1D(Form("hLumiAccepted%02i" ,ibit),Form("Lumi accepted: %s" ,bitName),nRuns,0,nRuns); | |
369 | ||
c0d2a42f | 370 | for (Int_t r=0;r<nRuns;r++){ |
371 | t->GetEntry(r); | |
063775bb | 372 | hRecorded[ibit] ->GetXaxis()->SetBinLabel(r+1,Form("%i",run)); |
373 | hReconstructed[ibit] ->GetXaxis()->SetBinLabel(r+1,Form("%i",run)); | |
374 | hAccepted[ibit] ->GetXaxis()->SetBinLabel(r+1,Form("%i",run)); | |
375 | hRejected[ibit] ->GetXaxis()->SetBinLabel(r+1,Form("%i",run)); | |
376 | hLumiRecorded[ibit] ->GetXaxis()->SetBinLabel(r+1,Form("%i",run)); | |
377 | hLumiReconstructed[ibit]->GetXaxis()->SetBinLabel(r+1,Form("%i",run)); | |
378 | hLumiAccepted[ibit] ->GetXaxis()->SetBinLabel(r+1,Form("%i",run)); | |
379 | // printf("recorded = %i",alias_recorded[ibit]); | |
380 | // printf("reconstructed = %i",alias_reconstructed[ibit]); | |
381 | hRecorded[ibit] ->SetBinContent(r+1,alias_recorded[ibit]); | |
382 | hReconstructed[ibit] ->SetBinContent(r+1,alias_reconstructed[ibit]); | |
383 | hAccepted[ibit] ->SetBinContent(r+1,alias_accepted[ibit]); | |
384 | hRejected[ibit] ->SetBinContent(r+1,alias_reconstructed[ibit]-alias_accepted[ibit]); | |
385 | hLumiRecorded[ibit] ->SetBinContent(r+1,alias_lumi_recorded[ibit]); | |
386 | hLumiReconstructed[ibit]->SetBinContent(r+1,alias_lumi_reconstructed[ibit]); | |
387 | hLumiAccepted[ibit] ->SetBinContent(r+1,alias_lumi_accepted[ibit]); | |
c0d2a42f | 388 | } |
063775bb | 389 | if (hRecorded[ibit]->Integral()<1) continue; |
390 | printf("bit=%i %s\n",ibit,bitName); | |
391 | ||
392 | SetHisto(hRecorded[ibit]); | |
393 | SetHisto(hReconstructed[ibit]); | |
c0d2a42f | 394 | SetHisto(hAccepted[ibit]); |
395 | SetHisto(hRejected[ibit]); | |
063775bb | 396 | SetHisto(hLumiRecorded[ibit]); |
397 | SetHisto(hLumiReconstructed[ibit]); | |
398 | SetHisto(hLumiAccepted[ibit]); | |
399 | hRecorded[ibit]->Sumw2(); | |
400 | hReconstructed[ibit]->Sumw2(); | |
c0d2a42f | 401 | hAccepted[ibit]->Sumw2(); |
402 | hRejected[ibit]->Sumw2(); | |
063775bb | 403 | hRecorded[ibit]->SetLineColor(kRed+2); |
404 | hRecorded[ibit]->SetFillColor(kRed+2); | |
405 | hReconstructed[ibit]->SetLineColor(kBlue); | |
406 | hReconstructed[ibit]->SetFillColor(kBlue); | |
c0d2a42f | 407 | hAccepted[ibit]->SetLineColor(kGreen+2); |
408 | hAccepted[ibit]->SetFillColor(kGreen+2); | |
063775bb | 409 | hLumiRecorded[ibit]->SetLineColor(kRed+2); |
410 | hLumiRecorded[ibit]->SetFillColor(kRed+2); | |
411 | hLumiReconstructed[ibit]->SetLineColor(kBlue); | |
412 | hLumiReconstructed[ibit]->SetFillColor(kBlue); | |
413 | hLumiAccepted[ibit]->SetLineColor(kGreen+2); | |
414 | hLumiAccepted[ibit]->SetFillColor(kGreen+2); | |
415 | ||
416 | cCounts->cd(); | |
417 | hRecorded[ibit]->SetTitle(Form("%s trigger counts: recorded=%0.f, total=%.0f, accepted=%.0f",bitName,hRecorded[ibit]->Integral(),hReconstructed[ibit]->Integral(),hAccepted[ibit]->Integral())); | |
418 | hRecorded[ibit]->Draw("h"); | |
419 | hReconstructed[ibit]->Draw("h same"); | |
420 | hAccepted[ibit]->Draw("h same"); | |
421 | AddFillSeparationLines(hAccepted[ibit],fills); | |
422 | gPad->RedrawAxis(); | |
423 | gPad->Print("alias_event_statistics.pdf"); | |
424 | ||
425 | cLumi->cd(); | |
426 | hLumiRecorded[ibit]->SetTitle(Form("%s luminosity [ub-1]: recorded=%.0g, total=%.0g, accepted=%.0g",bitName,hLumiRecorded[ibit]->Integral(),hLumiReconstructed[ibit]->Integral(),hLumiAccepted[ibit]->Integral())); | |
427 | hLumiRecorded[ibit]->Draw("h"); | |
428 | hLumiReconstructed[ibit]->Draw("h same"); | |
429 | hLumiAccepted[ibit]->Draw("h same"); | |
430 | AddFillSeparationLines(hLumiAccepted[ibit],fills); | |
431 | gPad->RedrawAxis(); | |
432 | gPad->Print("alias_lumi_statistics.pdf"); | |
433 | ||
434 | if (hReconstructed[ibit]->Integral()<1) continue; | |
435 | hAcceptedFraction[ibit] = (TH1D*) hReconstructed[ibit]->Clone(Form("hAcceptedFraction%02i",ibit)); | |
c0d2a42f | 436 | hAcceptedFraction[ibit]->SetTitle(Form("Accepted fraction: %s",bitName)); |
063775bb | 437 | hAcceptedFraction[ibit]->Divide(hAccepted[ibit],hReconstructed[ibit],1,1,"B"); |
c0d2a42f | 438 | hAcceptedFraction[ibit]->SetFillColor(0); |
439 | hAcceptedFraction[ibit]->SetLineWidth(2); | |
063775bb | 440 | hRejectedFraction[ibit] = (TH1D*) hReconstructed[ibit]->Clone(Form("hRejectedFraction%02i",ibit)); |
c0d2a42f | 441 | hRejectedFraction[ibit]->SetTitle(Form("Rejected fraction: %s",bitName)); |
063775bb | 442 | hRejectedFraction[ibit]->Divide(hRejected[ibit],hReconstructed[ibit],1,1,"B"); |
c0d2a42f | 443 | hRejectedFraction[ibit]->SetFillColor(0); |
444 | hRejectedFraction[ibit]->SetLineWidth(2); | |
063775bb | 445 | |
446 | cAcceptedFraction->cd(); | |
447 | hAcceptedFraction[ibit]->SetTitle(Form("%s: average accepted fraction = %.3f",bitName,hAccepted[ibit]->Integral()/hReconstructed[ibit]->Integral())); | |
c0d2a42f | 448 | hAcceptedFraction[ibit]->Draw(); |
449 | AddFillSeparationLines(hAcceptedFraction[ibit],fills); | |
450 | gPad->Print("accepted_fraction.pdf"); | |
451 | ||
063775bb | 452 | cRejectedFraction->cd(); |
453 | hRejectedFraction[ibit]->SetMaximum(1); | |
454 | hRejectedFraction[ibit]->SetTitle(Form("%s: average rejected fraction = %.3f",bitName,hRejected[ibit]->Integral()/hReconstructed[ibit]->Integral())); | |
c0d2a42f | 455 | hRejectedFraction[ibit]->Draw(); |
456 | AddFillSeparationLines(hRejectedFraction[ibit],fills); | |
457 | gPad->Print("rejected_fraction.pdf"); | |
458 | ||
459 | } | |
063775bb | 460 | dummy->Print("alias_event_statistics.pdf]"); |
461 | dummy->Print("alias_lumi_statistics.pdf]"); | |
c0d2a42f | 462 | dummy->Print("accepted_fraction.pdf]"); |
463 | dummy->Print("rejected_fraction.pdf]"); | |
464 | ||
5cbc06d4 | 465 | TFile* fglobal = new TFile("global_properties.root","recreate"); |
466 | hMu->Write(); | |
467 | hBCs->Write(); | |
468 | hDuration->Write(); | |
469 | hLumiSeen->Write(); | |
470 | fglobal->Close(); | |
471 | ||
472 | TFile* fstat = new TFile("accepted_event_statistics.root","recreate"); | |
c0d2a42f | 473 | for (Int_t ibit=0;ibit<NBITS;ibit++) { |
063775bb | 474 | if (hRecorded[ibit]) hRecorded[ibit]->Write(); |
475 | if (hReconstructed[ibit]) hReconstructed[ibit]->Write(); | |
476 | if (hAccepted[ibit]) hAccepted[ibit]->Write(); | |
5cbc06d4 | 477 | } |
478 | fstat->Close(); | |
479 | ||
480 | TFile* faccepted = new TFile("accepted_fraction.root","recreate"); | |
481 | for (Int_t ibit=0;ibit<NBITS;ibit++) { | |
063775bb | 482 | if (hAcceptedFraction[ibit]) hAcceptedFraction[ibit]->Write(); |
c0d2a42f | 483 | } |
5cbc06d4 | 484 | faccepted->Close(); |
485 | ||
486 | TFile* frejected = new TFile("rejected_fraction.root","recreate"); | |
487 | for (Int_t ibit=0;ibit<NBITS;ibit++) { | |
488 | if (hRejectedFraction[ibit]) hRejectedFraction[ibit]->Write(); | |
489 | } | |
490 | frejected->Close(); | |
491 | ||
c0d2a42f | 492 | } |
493 | ||
494 | void SetHisto(TH1D* h){ | |
495 | h->SetTitleFont(43); | |
496 | h->SetTitleSize(25); | |
497 | h->GetYaxis()->SetTitleFont(43); | |
498 | h->GetXaxis()->SetLabelFont(43); | |
499 | h->GetYaxis()->SetLabelFont(43); | |
500 | h->GetYaxis()->SetTitleSize(25); | |
501 | h->GetXaxis()->SetLabelSize(15); | |
502 | h->GetYaxis()->SetLabelSize(25); | |
503 | h->GetYaxis()->SetTickLength(0.01); | |
504 | h->GetYaxis()->SetTitleOffset(0.6); | |
505 | h->GetYaxis()->SetDecimals(1); | |
063775bb | 506 | h->SetLineColor(kBlue); |
507 | h->SetFillColor(kBlue); | |
c0d2a42f | 508 | h->LabelsOption("av"); |
509 | h->SetLineWidth(2); | |
063775bb | 510 | h->SetMinimum(0); |
511 | } | |
512 | ||
513 | void SetHisto(TH2D* h){ | |
514 | h->SetTitleFont(43); | |
515 | h->SetTitleSize(15); | |
516 | h->GetYaxis()->SetTitleFont(43); | |
517 | h->GetXaxis()->SetLabelFont(43); | |
518 | h->GetYaxis()->SetLabelFont(43); | |
519 | h->GetZaxis()->SetLabelFont(43); | |
520 | h->GetYaxis()->SetTitleSize(25); | |
521 | h->GetXaxis()->SetLabelSize(15); | |
522 | h->GetYaxis()->SetLabelSize(15); | |
523 | h->GetZaxis()->SetLabelSize(15); | |
524 | h->GetYaxis()->SetTickLength(0.01); | |
525 | h->GetYaxis()->SetDecimals(1); | |
526 | h->GetXaxis()->LabelsOption("av"); | |
527 | h->GetYaxis()->LabelsOption("a"); | |
528 | h->SetLineWidth(2); | |
c0d2a42f | 529 | h->SetLineColor(kBlue); |
530 | h->SetMinimum(0); | |
531 | } | |
532 | ||
533 | void AddFillSeparationLines(TH1D* h, map<Int_t,Int_t> &fills){ | |
534 | gPad->Update(); | |
535 | Double_t ymin = gPad->GetUymin(); | |
536 | Double_t ymax = gPad->GetUymax(); | |
537 | TLine * fillSeparationLine = new TLine(); | |
538 | fillSeparationLine->SetLineColor(kRed); | |
539 | fillSeparationLine->SetLineWidth(1); | |
540 | for(Int_t iBin = 1; iBin < h->GetXaxis()->GetNbins(); iBin++) { | |
541 | UInt_t runOld = atoi(h->GetXaxis()->GetBinLabel(iBin)); | |
542 | UInt_t runNew = atoi(h->GetXaxis()->GetBinLabel(iBin + 1)); | |
543 | if (fills[runOld]==fills[runNew]) continue; | |
544 | fillSeparationLine->DrawLine(iBin,ymin,iBin,ymax); | |
545 | } | |
546 | } |