1 |
#include <iostream>
|
2 |
#include <sstream>
|
3 |
#include <fstream>
|
4 |
#include <algorithm>
|
5 |
#include <vector>
|
6 |
#include <TROOT.h>
|
7 |
#include <TFile.h>
|
8 |
#include <TText.h>
|
9 |
#include <TH1F.h>
|
10 |
#include <TH2F.h>
|
11 |
#include <TStyle.h>
|
12 |
#include <TAxis.h>
|
13 |
#include <TCanvas.h>
|
14 |
#include <TPad.h>
|
15 |
#include <TProfile.h>
|
16 |
#include <TLine.h>
|
17 |
#include <TLatex.h>
|
18 |
#include "Style.C" // "/afs/cern.ch/cms/L1/rpc/plots/macros/Style.C"
|
19 |
using namespace std;
|
20 |
//
|
21 |
// Extracts sector number from LB name
|
22 |
//
|
23 |
Int_t getSector(const char *lbname) {
|
24 |
if(lbname) {
|
25 |
Int_t sec;
|
26 |
if ( (sscanf(lbname,"LB_RB%*2d_S%2d", &sec)==1 ||
|
27 |
sscanf(lbname,"LB_RE%*2d_S%2d", &sec)==1 ) &&
|
28 |
sec>=1 && sec<=12) {
|
29 |
cout << "getSector: " << lbname << " --> " << sec << endl;
|
30 |
return sec;
|
31 |
}
|
32 |
}
|
33 |
cout << "getSector: " << lbname << " --> BAD" << endl;
|
34 |
return -1;
|
35 |
}
|
36 |
Int_t getSector(TString &lbname) {
|
37 |
return getSector(lbname.Data());
|
38 |
}
|
39 |
//
|
40 |
// Counts how many LBs from the list belongs to a given sector
|
41 |
//
|
42 |
Int_t getNumLbPerSector(const Int_t sec, vector<TString> &list) {
|
43 |
Int_t counter=0;
|
44 |
if( sec>=1 && sec<=12 && list.size()>0 ) {
|
45 |
for(vector<TString>::iterator it=list.begin(); it!=list.end(); it++) {
|
46 |
if(sec==getSector(*it)) counter++;
|
47 |
}
|
48 |
}
|
49 |
return counter;
|
50 |
}
|
51 |
//
|
52 |
// Parses delays.txt file created by synchroMerger and plots:
|
53 |
// - distribution of BX average for LBs
|
54 |
// - distribution of BX rms for LBs
|
55 |
// - cumulative distribution of LBs vs window size around L1A
|
56 |
// that contains a given fraction of LB hits.
|
57 |
//
|
58 |
// version w/ blacklisted LBs
|
59 |
void synchro(// a text file with BX histograms for all links
|
60 |
TString datafile,
|
61 |
std::vector<TString> &blacklist,
|
62 |
TString outfile="",
|
63 |
TString runrange="",
|
64 |
TString datasettype="",
|
65 |
TString geolocation="") {
|
66 |
|
67 |
const Float_t legendFontSize = 0.030;
|
68 |
const Float_t legendOffset = 0.030;
|
69 |
|
70 |
//gROOT->Reset();
|
71 |
setTDRStyle();
|
72 |
TStyle *tdrStyle=(TStyle*)(gROOT->FindObject("tdrStyle"));
|
73 |
tdrStyle->SetOptStat(0);
|
74 |
tdrStyle->SetOptLogy(1);
|
75 |
tdrStyle->SetOptTitle(0);//off title
|
76 |
tdrStyle->SetPadGridY(1);
|
77 |
tdrStyle->SetPadRightMargin(0.02);
|
78 |
tdrStyle->SetPalette(1);
|
79 |
tdrStyle->SetOptTitle(1);
|
80 |
gROOT->ForceStyle();
|
81 |
|
82 |
if(outfile=="") outfile="drawSynchro";
|
83 |
TFile f( (outfile+".root").Data(), "RECREATE");
|
84 |
f.mkdir("Synchro");
|
85 |
f.cd("Synchro");
|
86 |
f.ls();
|
87 |
//tdrStyle->Write();
|
88 |
//gStyle->Write();
|
89 |
|
90 |
cout << "DrawSynchro:"<<endl
|
91 |
<< " Input text file = " << datafile << endl
|
92 |
<< " # of blacklisted LBs = " << blacklist.size() << endl
|
93 |
<< " Output file prefix = " << outfile
|
94 |
<< endl;
|
95 |
|
96 |
// fraction of hits in a window to be studied
|
97 |
vector<Double_t> frac;
|
98 |
frac.push_back(1.00); // 100% of hits within given window
|
99 |
frac.push_back(0.99); // 99% of hits within given window
|
100 |
frac.push_back(0.95); // 95% of hits within given window
|
101 |
frac.push_back(0.90); // 90% of hits within given window
|
102 |
|
103 |
// map LBid BX
|
104 |
const Int_t PEAK_BIN = 3; // L1A position (BX=0) in the input text file
|
105 |
const Int_t MAX_OFFPEAK = 3; // maximum +- 3BX off L1A position (BX=0)
|
106 |
|
107 |
char label[200];
|
108 |
char title[200];
|
109 |
// prepare text labels for BX window categories
|
110 |
vector<TString> category;
|
111 |
for(Int_t nbx=0; nbx<=MAX_OFFPEAK; nbx++) {
|
112 |
if(nbx==0) sprintf(label, "BX=0");
|
113 |
else sprintf(label, "#pm%d BX", nbx);
|
114 |
category.push_back(label);
|
115 |
}
|
116 |
// prepare text labels for Sector names
|
117 |
vector<TString> sector;
|
118 |
for(Int_t sec=1; sec<=12; sec++) {
|
119 |
sprintf(label, "%d", sec);
|
120 |
sector.push_back(label);
|
121 |
}
|
122 |
|
123 |
Int_t nbinsX, nbinsY;
|
124 |
Float_t widthX, widthY;
|
125 |
//
|
126 |
// Histograms that depend on a given threshold for fraction of events
|
127 |
//
|
128 |
// 1D : Number of LBs per window category (text bin labels)
|
129 |
vector<TH1F*> hLB_win;
|
130 |
for(UInt_t ifrac=0; ifrac<frac.size(); ifrac++) {
|
131 |
sprintf(title,"LBs with %.0f%% of hits in a given window;"
|
132 |
"Window wrt L1A with %.0f%% of hits;Link Boards / category",
|
133 |
frac[ifrac]*100, frac[ifrac]*100);
|
134 |
sprintf(label,"hLB_win%.0f", frac[ifrac]*100);
|
135 |
TH1F *h=new TH1F(label, title, MAX_OFFPEAK+1, 0, MAX_OFFPEAK+1);
|
136 |
for(Int_t nbx=0; nbx<=MAX_OFFPEAK; nbx++) {
|
137 |
h->GetXaxis()->SetBinLabel(nbx+1,category[nbx]);
|
138 |
}
|
139 |
h->Sumw2();
|
140 |
h->StatOverflows(true); // to include underflows/overflows in mean/rms
|
141 |
hLB_win.push_back(h);
|
142 |
}
|
143 |
|
144 |
//
|
145 |
// Common histograms (do not depend on fraction of events).
|
146 |
//
|
147 |
|
148 |
|
149 |
// 1D : Hit arrival time
|
150 |
sprintf(title,"RPC hit synchronization;Chamber hit timing wrt L1A [BX];Hits / bin");
|
151 |
widthX=1.0 ; // bin width of 1 BX
|
152 |
nbinsX=7; // nbins for [-3 BX, +3 BX] range
|
153 |
TH1F *hLB_Bx=new TH1F("hLB_Bx", title,
|
154 |
nbinsX,
|
155 |
0.0-(Float_t)nbinsX/2*widthX,
|
156 |
0.0+(Float_t)nbinsX/2*widthX);
|
157 |
hLB_Bx->Sumw2();
|
158 |
hLB_Bx->StatOverflows(true); // to include underflows/overflows in mean/rms
|
159 |
|
160 |
|
161 |
// 1D : Mean BX (1 entry=1 LB)
|
162 |
sprintf(title,"Average signal arrival per Link Board;"
|
163 |
"Avg signal arrival wrt L1A per Link Board [BX];"
|
164 |
"Link Boards / bin");
|
165 |
widthX=1.0/50 ; // bin width of 1/25 BX = 1ns
|
166 |
nbinsX=2*(Int_t)(3.0/widthX)+1; // nbins for [-3 BX, +3 BX] range
|
167 |
TH1F *hLB_Mean=new TH1F("hLB_Mean", title,
|
168 |
nbinsX,
|
169 |
0.0-(Int_t)(nbinsX/2)*widthX,
|
170 |
0.0+(Int_t)(nbinsX/2)*widthX);
|
171 |
hLB_Mean->Sumw2();
|
172 |
hLB_Mean->StatOverflows(true); // to include underflows/overflows in mean/rms
|
173 |
|
174 |
|
175 |
// 1D : Rms BX (1 entry=1 LB)
|
176 |
sprintf(title,"Average signal spread per Link Board;"
|
177 |
"Avg signal spread per Link Board [BX];"
|
178 |
"Link Boards / bin");
|
179 |
widthX=1.0/50 ; // bin width of 1/25 BX = 1ns
|
180 |
nbinsX=(Int_t)(7.0/widthX); // nbins for [0 BX, 7 BX[ range
|
181 |
TH1F *hLB_Rms=new TH1F("hLB_Rms", title,
|
182 |
nbinsX,
|
183 |
0.0,
|
184 |
0.0+nbinsX*widthX);
|
185 |
hLB_Rms->StatOverflows(true); // to include underflows/overflows in mean/rms
|
186 |
hLB_Rms->Sumw2();
|
187 |
|
188 |
|
189 |
// 2D : Mean BX vs Rms BX (1 entry=1 LB)
|
190 |
sprintf(title,"Average signal spread vs average signal arrival per Link Board;"
|
191 |
"Avg signal arrival wrt L1A per Link Board [BX];"
|
192 |
"Avg signal spread per Link Board [BX];"
|
193 |
"Link Boards / bin");
|
194 |
widthX=1.0/50 ; // bin width of 1/25 BX = 1ns
|
195 |
nbinsX=2*(Int_t)(3.0/widthX)+1; // nbins for [-3 BX, +3 BX] range
|
196 |
widthY=1.0/50 ; // bin width of 1/25 BX = 1ns
|
197 |
nbinsY=(Int_t)(7.0/widthY); // nbins for [0 BX, 7 BX[ range
|
198 |
TH2F *hLB_Rms_V_Mean=new TH2F("hLB_Rms_V_Mean", title,
|
199 |
//70*5, -3., 4., 70*5, 0., 7.);
|
200 |
nbinsX,
|
201 |
0.0-(Int_t)(nbinsX/2)*widthX,
|
202 |
0.0+(Int_t)(nbinsX/2)*widthX,
|
203 |
nbinsY,
|
204 |
0.0,
|
205 |
0.0+nbinsY*widthY);
|
206 |
|
207 |
|
208 |
hLB_Rms_V_Mean->StatOverflows(true); // to include underflows/overflows in mean/rms
|
209 |
hLB_Rms_V_Mean->Sumw2();
|
210 |
|
211 |
|
212 |
// 1D : Profile of average hit arrival times per LB vs Sector
|
213 |
sprintf(title,"Average signal arrival time per Link Board vs Sector;"
|
214 |
"Sector;"
|
215 |
"Avg signal arrival wrt L1A per Link Board [BX]");
|
216 |
TProfile *pLB_Mean_V_Sector = new TProfile("pLB_Mean_V_Sector", title, 12, -0.5, 12.5, -3.5, 3.5);
|
217 |
for(Int_t sec=1; sec<=12; sec++) {
|
218 |
sprintf(label, "%d", sec);
|
219 |
pLB_Mean_V_Sector->GetXaxis()->SetBinLabel(sec, label);
|
220 |
}
|
221 |
pLB_Mean_V_Sector->Sumw2();
|
222 |
pLB_Mean_V_Sector->StatOverflows(true); // to include underflows/overflows in mean/rms
|
223 |
|
224 |
|
225 |
// 1D : Profile of hit arrival times vs Sector
|
226 |
sprintf(title,"Average signal arrival time vs Sector;"
|
227 |
"Sector;"
|
228 |
"Avg signal arrival wrt L1A [BX]");
|
229 |
TProfile *pLB_Bx_V_Sector = new TProfile("pLB_Bx_V_Sector",
|
230 |
title, 12, -0.5, 12.5, -3.5, 3.5);
|
231 |
for(Int_t sec=1; sec<=12; sec++) {
|
232 |
sprintf(label, "%d", sec);
|
233 |
pLB_Bx_V_Sector->GetXaxis()->SetBinLabel(sec, label);
|
234 |
}
|
235 |
pLB_Bx_V_Sector->Sumw2();
|
236 |
pLB_Bx_V_Sector->StatOverflows(true); // to include underflows/overflows in mean/rms
|
237 |
|
238 |
|
239 |
// 1D : Number of hits vs Sector
|
240 |
sprintf(title,"Occupancy per Sector;"
|
241 |
"Sector;"
|
242 |
"Number of events");
|
243 |
TH1F *hLB_Evts_V_Sector = new TH1F("hLB_Evts_V_Sector", title, 12, -0.5, 12.5);
|
244 |
for(Int_t sec=1; sec<=12; sec++) {
|
245 |
sprintf(label, "%d", sec);
|
246 |
hLB_Evts_V_Sector->GetXaxis()->SetBinLabel(sec, label);
|
247 |
}
|
248 |
hLB_Evts_V_Sector->Sumw2();
|
249 |
hLB_Evts_V_Sector->StatOverflows(true); // to include underflows/overflows in mean/rms
|
250 |
|
251 |
////////////////////////////////////////////
|
252 |
////////////////////////////////////////////
|
253 |
|
254 |
vector<TString> LB_alive;
|
255 |
vector<TString> LB_dead;
|
256 |
vector<TString> LB_blacklisted;
|
257 |
|
258 |
Int_t nLB_alive = 0; // LBs with non-empty hit BX distribution
|
259 |
Int_t nLB_dead = 0; // LBs with empty hit BX distribution
|
260 |
Int_t nLB_blacklisted = 0; // problematic LBs to be excluded
|
261 |
Int_t nLB_total = 0; // total LBs (empty+alive+excluded)
|
262 |
|
263 |
// parses input text file,
|
264 |
// computes hits fraction for a given window wrt L1A bunch crossing (BX=0),
|
265 |
// computes mean and rms of BX hit distribution.
|
266 |
ifstream file;
|
267 |
file.open(datafile.Data());
|
268 |
file.is_open();
|
269 |
if (file.fail()) {
|
270 |
cout << "ERROR: Can't open input text file: "<<datafile<<endl;
|
271 |
return;
|
272 |
}
|
273 |
while (!file.eof()) {
|
274 |
string line;
|
275 |
getline(file, line);
|
276 |
//cout<<"RAW="<<line<<endl;
|
277 |
size_t beg,end;
|
278 |
if( (beg = line.find("counts:"))!=string::npos &&
|
279 |
(end = line.find("paths:"))!=string::npos ) {
|
280 |
Int_t bin[7]={0, 0, 0, 0, 0, 0, 0};
|
281 |
string sel=line.substr(beg, end-beg);
|
282 |
char lbname[100];
|
283 |
|
284 |
if(sscanf(sel.c_str(),
|
285 |
"counts:%5d%5d%5d%5d%5d%5d%5d",
|
286 |
&(bin[0]),
|
287 |
&(bin[1]),
|
288 |
&(bin[2]),
|
289 |
&(bin[3]),
|
290 |
&(bin[4]),
|
291 |
&(bin[5]),
|
292 |
&(bin[6]) )==7 &&
|
293 |
sscanf(line.c_str(),"%20s", lbname)==1 ) {
|
294 |
|
295 |
// is excluded?
|
296 |
if( find(blacklist.begin(), blacklist.end(), lbname)
|
297 |
!=blacklist.end() ) {
|
298 |
// check for duplicates
|
299 |
if(find(LB_blacklisted.begin(), LB_blacklisted.end(), lbname)
|
300 |
==LB_blacklisted.end()) {
|
301 |
LB_blacklisted.push_back( lbname );
|
302 |
//nLB_alive++;
|
303 |
}
|
304 |
continue;
|
305 |
}
|
306 |
|
307 |
Double_t sumw=0.;
|
308 |
Double_t sumw2=0.;
|
309 |
Double_t mean=0.;
|
310 |
Double_t mean2=0.;
|
311 |
Double_t rms=0.;
|
312 |
for(Int_t i=0; i<7; i++) {
|
313 |
if(bin[i]<0) {
|
314 |
cout<<"ERROR: Number of hit counts must not be < 0"<<endl;
|
315 |
return;
|
316 |
}
|
317 |
if(bin[i]>0) {
|
318 |
/* from ROOT manual:
|
319 |
* By default, for each bin, the sum of weights is computed at fill time. One can also call TH1::Sumw2 to force the storage and computation of the sum of the square of weights per bin. If Sumw2 has been called, the error per bin is computed as the sqrt(sum of squares of weights), otherwise the error is set equal to the sqrt(bin content).
|
320 |
*/
|
321 |
for(Long_t j=0; j<bin[i]; j++) {
|
322 |
hLB_Bx->Fill(i-PEAK_BIN, 1.0); // bin[i]);
|
323 |
}
|
324 |
}
|
325 |
sumw += bin[i];
|
326 |
sumw2 += bin[i]*bin[i];
|
327 |
mean += (i-PEAK_BIN) * bin[i];
|
328 |
mean2 += (i-PEAK_BIN)*(i-PEAK_BIN) * bin[i];
|
329 |
}
|
330 |
if(sumw>0.) {
|
331 |
mean /= sumw;
|
332 |
mean2 /= sumw;
|
333 |
rms = sqrt(mean2-mean*mean);
|
334 |
|
335 |
// fill mean, rms histograms
|
336 |
hLB_Mean->Fill(mean);
|
337 |
hLB_Rms->Fill(rms);
|
338 |
hLB_Rms_V_Mean->Fill(mean, rms);
|
339 |
Int_t sec=getSector(lbname);
|
340 |
if(sec>0) {
|
341 |
pLB_Mean_V_Sector->Fill(sector[sec-1], mean);
|
342 |
/* from ROOT manual:
|
343 |
* By default, for each bin, the sum of weights is computed at fill time. One can also call TH1::Sumw2 to force the storage and computation of the sum of the square of weights per bin. If Sumw2 has been called, the error per bin is computed as the sqrt(sum of squares of weights), otherwise the error is set equal to the sqrt(bin content).
|
344 |
*/
|
345 |
for(Long_t j=0; j<sumw; j++) {
|
346 |
hLB_Evts_V_Sector->Fill(sector[sec-1], 1.0);
|
347 |
}
|
348 |
for(Int_t i=0; i<7; i++) if (bin[i]>0) {
|
349 |
for(Long_t j=0; j<bin[i]; j++) {
|
350 |
pLB_Bx_V_Sector->Fill(sector[sec-1], i-PEAK_BIN, 1.0 );//bin[i]);
|
351 |
}
|
352 |
}
|
353 |
}
|
354 |
|
355 |
// count # of alive LBs
|
356 |
// check for duplicates
|
357 |
if(find(LB_alive.begin(), LB_alive.end(), lbname)==LB_alive.end()) {
|
358 |
LB_alive.push_back( lbname );
|
359 |
//nLB_alive++;
|
360 |
}
|
361 |
|
362 |
} else {
|
363 |
// count # of dead LBs
|
364 |
// check for duplicates
|
365 |
if(find(LB_dead.begin(), LB_dead.end(), lbname)==LB_dead.end()) {
|
366 |
LB_dead.push_back( lbname );
|
367 |
//nLB_dead++;
|
368 |
}
|
369 |
}
|
370 |
|
371 |
cout << lbname << " : mean="<<mean<<", rms="<<rms<<endl;
|
372 |
//cout<<"FOUND="<<bin[0]<<" "<<bin[1]<<" "<<bin[2]<<" "
|
373 |
// <<bin[3]<<" "<<bin[4]<<" "<<bin[5]<<" "<<bin[6]<<endl;
|
374 |
|
375 |
// loop over windows sizes and fill LB distribution histo
|
376 |
for(Int_t nbx=0; nbx<=MAX_OFFPEAK; nbx++) {
|
377 |
Int_t sum_window=0; // LB sum of hits for category
|
378 |
Int_t sum_total=0; // LB total sum of hits
|
379 |
for(Int_t i=0; i<7; i++) {
|
380 |
sum_total += bin[i];
|
381 |
Int_t bx_offset=i-PEAK_BIN; // offset from L1A peak in BX
|
382 |
if ( fabs(bx_offset)<=nbx ) {
|
383 |
sum_window += bin[i];
|
384 |
}
|
385 |
}
|
386 |
// fraction of hits in a given window
|
387 |
Double_t fr=(sum_total>0 ?
|
388 |
(Double_t)sum_window/(Double_t)sum_total : 0.);
|
389 |
// fill the histogram only if fraction of hits is sufficient
|
390 |
cout << lbname << " : size=[" << -nbx << "," <<nbx << "]"
|
391 |
<< ", frac=" << fr
|
392 |
<< ", inside=" << sum_window
|
393 |
<< ", total=" << sum_total << endl;
|
394 |
for(Int_t ifrac=0; ifrac<frac.size(); ifrac++) {
|
395 |
if( fr >= frac[ifrac] ) {
|
396 |
cout << "Filling: fr="<<fr
|
397 |
<< " ifrac="<<ifrac
|
398 |
<< " frac[ifrac]="<<frac[ifrac]
|
399 |
<< " nbx="<<nbx
|
400 |
<< " category[nbx]="<<category[nbx]<<endl;
|
401 |
hLB_win[ifrac]->Fill( category[nbx], 1.0 );
|
402 |
cout << lbname << " : filling category "<<nbx<<endl;
|
403 |
}
|
404 |
} // end of threshold loop
|
405 |
} // end of windows size loop
|
406 |
|
407 |
}
|
408 |
|
409 |
}
|
410 |
}
|
411 |
file.close();
|
412 |
|
413 |
// Total LBs
|
414 |
nLB_alive=LB_alive.size();
|
415 |
nLB_dead=LB_dead.size();
|
416 |
nLB_blacklisted=LB_blacklisted.size();
|
417 |
nLB_total = nLB_alive + nLB_dead + nLB_blacklisted;
|
418 |
cout << "Number of Link Boards: total="<<nLB_total
|
419 |
<< ", non-empty="<<nLB_alive
|
420 |
<< ", empty="<<nLB_dead
|
421 |
<< ", blacklisted="<<nLB_blacklisted<<endl;
|
422 |
if(nLB_blacklisted>0) {
|
423 |
cout << "Excluded LBs that exist in the input file:"<<endl;
|
424 |
for(Int_t i=0; i<nLB_blacklisted; i++) {
|
425 |
cout << LB_blacklisted[i] << endl;
|
426 |
}
|
427 |
}
|
428 |
|
429 |
// temporary pointers
|
430 |
TH1F *h;
|
431 |
TH2F *h2;
|
432 |
TProfile *p;
|
433 |
TCanvas *c1;
|
434 |
TLatex *t;//TLatex *t;
|
435 |
TLine *l;
|
436 |
// position of the legend
|
437 |
Float_t xpos, ypos;
|
438 |
Int_t ioff;
|
439 |
Float_t rangemin,rangemax;
|
440 |
|
441 |
Double_t meanX, meanY, rmsX, rmsY;
|
442 |
// NOTE: Using SetRangeUser(), SetRange() causes ROOT
|
443 |
// recompute MEAN/RMS using bin center values in the
|
444 |
// viewable range! In order to get true MEAN/RMS values
|
445 |
// one has to do GetXaxis()->UnZoom() after drawing the
|
446 |
// canvas and before calling GetMean(), GetRms().
|
447 |
|
448 |
////////////////////////////////////////////////////////////////
|
449 |
|
450 |
h=hLB_Bx;
|
451 |
h->Scale(1.0/h->Integral()); // normalize to 1
|
452 |
h->SetYTitle("Fraction of hits");
|
453 |
// Draw: Normalized distribution of hit BX
|
454 |
// setTDRStyle();
|
455 |
tdrStyle->SetOptStat(0);
|
456 |
tdrStyle->SetOptLogy(1);
|
457 |
tdrStyle->SetOptTitle(0);//off title
|
458 |
tdrStyle->SetPadGridY(1);
|
459 |
tdrStyle->SetPadRightMargin(0.02);
|
460 |
//tdrStyle->SetPaintTextFormat("5.5f"); // for TEXT bin values
|
461 |
tdrStyle->SetPalette(1);
|
462 |
tdrStyle->SetOptStat(000111100);
|
463 |
tdrStyle->SetStatY(0.9);
|
464 |
tdrStyle->SetStatX(0.9);
|
465 |
tdrStyle->SetStatW(0.2);
|
466 |
tdrStyle->SetStatH(0.05);
|
467 |
gROOT->ForceStyle();
|
468 |
c1 = new TCanvas( outfile + "_" + h->GetName(),
|
469 |
h->GetTitle(),
|
470 |
0,0,600,600);
|
471 |
c1->SetTitle( h->GetTitle() );
|
472 |
c1->Draw();
|
473 |
gPad->SetLeftMargin(0.17);
|
474 |
gPad->SetBottomMargin(0.15);
|
475 |
h->SetTitleSize(0.045,"Y");
|
476 |
h->SetTitleSize(0.045,"X");
|
477 |
h->SetTitleOffset(1.5,"Y");
|
478 |
h->SetTitleOffset(1.2,"X");
|
479 |
//gPad->SetLeftMargin(0.12);
|
480 |
//h->SetTitleOffset(.95,"Y");
|
481 |
//h->GetYaxis()->SetTitle("Fraction of hits");
|
482 |
//h->GetXaxis()->SetTitle("Chamber hits timing vs L1A [BX]");
|
483 |
h->SetMarkerSize(1.7); // for TEXT bin values
|
484 |
h->SetMarkerColor(4); // for TEXT bin valued
|
485 |
h->SetLineStyle(1);
|
486 |
h->SetMarkerStyle(1);
|
487 |
h->SetStats(false);
|
488 |
|
489 |
// get statistics for full range
|
490 |
h->GetXaxis()->UnZoom();
|
491 |
meanX = h->GetMean();
|
492 |
rmsX = h->GetRMS();
|
493 |
|
494 |
h->SetFillColor(4); h->SetFillStyle(3003);
|
495 |
h->DrawCopy("E1 E0");
|
496 |
h->DrawCopy("HIST,SAME");
|
497 |
gPad->Update();
|
498 |
|
499 |
// header
|
500 |
//t = new TLatex(0.3,0.94, "RPC Hit Synchronization ");ry #sqrt{s}
|
501 |
//t->SetNDC(true);t->DrawClone();
|
502 |
|
503 |
xpos=0.20;
|
504 |
ypos=0.85;
|
505 |
ioff=0;
|
506 |
|
507 |
//t = new TLatex(.45,.95,"CMS Preliminary #sqrt{s} = 8TeV");
|
508 |
//t->SetNDC(true);t->SetTextSize(0.032); t->DrawClone();
|
509 |
|
510 |
// run range
|
511 |
if(geolocation!="") {
|
512 |
t = new TLatex(xpos, ypos-ioff*legendOffset, geolocation); ioff++;
|
513 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
514 |
}
|
515 |
if(runrange!="") {
|
516 |
t = new TLatex(xpos, ypos-ioff*legendOffset, runrange); ioff++;
|
517 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
518 |
}
|
519 |
if(datasettype!="") {
|
520 |
t = new TLatex(xpos, ypos-ioff*legendOffset, datasettype); ioff++;
|
521 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
522 |
}
|
523 |
// statistics
|
524 |
// NOTE: Using SetRangeUser(), SetRange() causes ROOT
|
525 |
// recompute MEAN/RMS using bin center values in the
|
526 |
// viewable range! In order to get true MEAN/RMS values
|
527 |
// one has to do GetXaxis()->UnZoom() after drawing the
|
528 |
// canvas and before calling GetMean(), GetRms().
|
529 |
//h->GetXaxis()->UnZoom();
|
530 |
sprintf(label,"Avg time = %6.4f BX", meanX);
|
531 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
532 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(2); t->DrawClone();
|
533 |
|
534 |
sprintf(label,"Rms = %6.4f BX", rmsX);
|
535 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
536 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(2); t->DrawClone();
|
537 |
|
538 |
// Hit count
|
539 |
t = new TLatex(xpos, ypos-ioff*legendOffset, "Number of Link Boards:"); ioff++;
|
540 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
541 |
|
542 |
sprintf(label,"%d - total",nLB_total);
|
543 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
544 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
545 |
|
546 |
sprintf(label,"%d - w/o hits",nLB_dead);
|
547 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
548 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
549 |
|
550 |
if(nLB_blacklisted>0) {
|
551 |
sprintf(label,"%d - bad, excluded",nLB_blacklisted);
|
552 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
553 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
554 |
}
|
555 |
|
556 |
//h->Write();
|
557 |
c1->Write();
|
558 |
c1->Print( outfile + "_" + h->GetName() + ".png", "png" );
|
559 |
c1->Print( outfile + "_" + h->GetName() + ".C", "cxx" );
|
560 |
c1->Print( outfile + "_" + h->GetName() + ".pdf", "pdf" );
|
561 |
c1->Print( outfile + "_" + h->GetName() + ".eps", "eps");
|
562 |
|
563 |
////////////////////////////////////////////////////////////////
|
564 |
|
565 |
|
566 |
h=hLB_Mean;
|
567 |
// Draw: Distribution of LB mean BX
|
568 |
// setTDRStyle();
|
569 |
tdrStyle->SetOptStat(0);
|
570 |
tdrStyle->SetOptLogy(1);
|
571 |
tdrStyle->SetOptTitle(0);//off title
|
572 |
tdrStyle->SetPadGridY(1);
|
573 |
tdrStyle->SetPadRightMargin(0.02);
|
574 |
//tdrStyle->SetPaintTextFormat("5.5f"); // for TEXT bin values
|
575 |
tdrStyle->SetPalette(1);
|
576 |
tdrStyle->SetOptStat(000111100);
|
577 |
tdrStyle->SetStatY(0.9);
|
578 |
tdrStyle->SetStatX(0.9);
|
579 |
tdrStyle->SetStatW(0.2);
|
580 |
tdrStyle->SetStatH(0.05);
|
581 |
gROOT->ForceStyle();
|
582 |
c1 = new TCanvas( outfile + "_" + h->GetName(),
|
583 |
h->GetTitle(),
|
584 |
0,0,600,600);
|
585 |
c1->Draw();
|
586 |
gPad->SetLeftMargin(0.17);
|
587 |
gPad->SetBottomMargin(0.15);
|
588 |
h->SetTitleSize(0.045,"Y");
|
589 |
h->SetTitleSize(0.045,"X");
|
590 |
h->SetTitleOffset(1.5,"Y");
|
591 |
h->SetTitleOffset(1.2,"X");
|
592 |
//gPad->SetLeftMargin(0.12);
|
593 |
//h->SetTitleOffset(.95,"Y");
|
594 |
//h->GetYaxis()->SetTitle("Fraction of hits");
|
595 |
//h->GetXaxis()->SetTitle("Chamber hits timing vs L1A [BX]");
|
596 |
h->SetMarkerSize(1.7); // for TEXT bin values
|
597 |
h->SetMarkerColor(4); // for TEXT bin valued
|
598 |
h->SetLineStyle(1);
|
599 |
h->SetMarkerStyle(1);
|
600 |
h->SetStats(false);
|
601 |
|
602 |
// get statistics for full range
|
603 |
meanX = h->GetMean();
|
604 |
rmsY = h->GetRMS();
|
605 |
h->GetXaxis()->SetRangeUser(-0.11, 0.11);
|
606 |
|
607 |
h->GetXaxis()->SetNdivisions(410);
|
608 |
h->SetFillColor(4); h->SetFillStyle(3003);
|
609 |
h->DrawCopy("E1");
|
610 |
h->DrawCopy("HIST,SAME");
|
611 |
gPad->Update();
|
612 |
|
613 |
// header
|
614 |
//t = new TLatex(0.3,0.94, "RPC LB Synchronization ");
|
615 |
//t->SetNDC(true);t->DrawClone();
|
616 |
//t = new TLatex(.45,.95,"CMS Preliminary #sqrt{s} = 8TeV");
|
617 |
//t->SetNDC(true);t->SetTextSize(0.032); t->DrawClone();
|
618 |
|
619 |
xpos=0.20;
|
620 |
ypos=0.85;
|
621 |
ioff=0;
|
622 |
if(geolocation!="") {
|
623 |
t = new TLatex(xpos, ypos-ioff*legendOffset, geolocation); ioff++;
|
624 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
625 |
}
|
626 |
// run range
|
627 |
if(runrange!="") {
|
628 |
t = new TLatex(xpos, ypos-ioff*legendOffset, runrange); ioff++;
|
629 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
630 |
}
|
631 |
if(datasettype!="") {
|
632 |
t = new TLatex(xpos, ypos-ioff*legendOffset, datasettype); ioff++;
|
633 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
634 |
}
|
635 |
// statistics
|
636 |
// NOTE: Using SetRangeUser(), SetRange() causes ROOT
|
637 |
// recompute MEAN/RMS using bin center values in the
|
638 |
// viewable range! In order to get true MEAN/RMS values
|
639 |
// one has to do GetXaxis()->UnZoom() after drawing the
|
640 |
// canvas and before calling GetMean(), GetRms().
|
641 |
// h->GetXaxis()->UnZoom();
|
642 |
sprintf(label,"Avg time = %6.4f BX",meanX);
|
643 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
644 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(2); t->DrawClone();
|
645 |
|
646 |
// LB count
|
647 |
t = new TLatex(xpos, ypos-ioff*legendOffset, "Number of Link Boards:"); ioff++;
|
648 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
649 |
|
650 |
sprintf(label,"%d - total",nLB_total);
|
651 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
652 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
653 |
|
654 |
sprintf(label,"%d - w/o hits",nLB_dead);
|
655 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
656 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
657 |
if(nLB_blacklisted>0) {
|
658 |
sprintf(label,"%d - bad, excluded",nLB_blacklisted);
|
659 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
660 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
661 |
}
|
662 |
|
663 |
//h->Write();
|
664 |
c1->Write();
|
665 |
c1->Print( outfile + "_" + h->GetName() + ".png", "png" );
|
666 |
c1->Print( outfile + "_" + h->GetName() + ".C", "cxx" );
|
667 |
c1->Print( outfile + "_" + h->GetName() + ".pdf", "pdf" );
|
668 |
c1->Print( outfile + "_" + h->GetName() + ".eps", "eps");
|
669 |
|
670 |
////////////////////////////////////////////////////////////////
|
671 |
|
672 |
|
673 |
h=hLB_Rms;
|
674 |
// Draw: Distribution of LB rms BX
|
675 |
// setTDRStyle();
|
676 |
tdrStyle->SetOptStat(0);
|
677 |
tdrStyle->SetOptLogy(1);
|
678 |
tdrStyle->SetOptTitle(0);//off title
|
679 |
tdrStyle->SetPadGridY(1);
|
680 |
tdrStyle->SetPadRightMargin(0.02);
|
681 |
//tdrStyle->SetPaintTextFormat("5.5f"); // for TEXT bin values
|
682 |
tdrStyle->SetPalette(1);
|
683 |
tdrStyle->SetOptStat(000111100);
|
684 |
tdrStyle->SetStatY(0.9);
|
685 |
tdrStyle->SetStatX(0.9);
|
686 |
tdrStyle->SetStatW(0.2);
|
687 |
tdrStyle->SetStatH(0.05);
|
688 |
gROOT->ForceStyle();
|
689 |
c1 = new TCanvas( outfile + "_" + h->GetName(),
|
690 |
h->GetTitle(),
|
691 |
0,0,600,600);
|
692 |
c1->Draw();
|
693 |
gPad->SetLeftMargin(0.17);
|
694 |
gPad->SetBottomMargin(0.15);
|
695 |
h->SetTitleSize(0.045,"Y");
|
696 |
h->SetTitleSize(0.045,"X");
|
697 |
h->SetTitleOffset(1.5,"Y");
|
698 |
h->SetTitleOffset(1.2,"X");
|
699 |
//gPad->SetLeftMargin(0.12);
|
700 |
//h->SetTitleOffset(.95,"Y");
|
701 |
//h->GetYaxis()->SetTitle("Fraction of hits");
|
702 |
//h->GetXaxis()->SetTitle("Chamber hits timing vs L1A [BX]");
|
703 |
h->SetMarkerSize(1.7); // for TEXT bin values
|
704 |
h->SetMarkerColor(4); // for TEXT bin valued
|
705 |
h->SetLineStyle(1);
|
706 |
h->SetMarkerStyle(1);
|
707 |
h->SetStats(false);
|
708 |
|
709 |
// get statistics for full range
|
710 |
h->GetXaxis()->UnZoom();
|
711 |
meanX = h->GetMean();
|
712 |
rmsX = h->GetRMS();
|
713 |
h->GetXaxis()->SetRangeUser(0.0, 0.451);
|
714 |
|
715 |
h->GetXaxis()->SetNdivisions(410);
|
716 |
h->SetFillColor(4); h->SetFillStyle(3003);
|
717 |
h->DrawCopy("E1");
|
718 |
h->DrawCopy("HIST,SAME");
|
719 |
gPad->Update();
|
720 |
|
721 |
// header
|
722 |
//t = new TLatex(0.3,0.94, "RPC LB Synchronization ");
|
723 |
//t->SetNDC(true);t->DrawClone();
|
724 |
//t = new TLatex(.45,.95,"CMS Preliminary #sqrt{s} = 8TeV");
|
725 |
//t->SetNDC(true);t->SetTextSize(0.032); t->DrawClone();
|
726 |
|
727 |
// run range
|
728 |
xpos=0.55;
|
729 |
ypos=0.85;
|
730 |
ioff=0;
|
731 |
if(geolocation!="") {
|
732 |
t = new TLatex(xpos, ypos-ioff*legendOffset, geolocation); ioff++;
|
733 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
734 |
}
|
735 |
if(runrange!="") {
|
736 |
t = new TLatex(xpos, ypos-ioff*legendOffset, runrange); ioff++;
|
737 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
738 |
}
|
739 |
if(datasettype!="") {
|
740 |
t = new TLatex(xpos, ypos-ioff*legendOffset, datasettype); ioff++;
|
741 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
742 |
}
|
743 |
// statistics
|
744 |
// NOTE: Using SetRangeUser(), SetRange() causes ROOT
|
745 |
// recompute MEAN/RMS using bin center values in the
|
746 |
// viewable range! In order to get true MEAN/RMS values
|
747 |
// one has to do GetXaxis()->UnZoom() after drawing the
|
748 |
// canvas and before calling GetMean(), GetRms().
|
749 |
// h->GetXaxis()->UnZoom();
|
750 |
sprintf(label,"Avg spread = %6.4f BX",meanX);
|
751 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
752 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(2); t->DrawClone();
|
753 |
|
754 |
// LB count
|
755 |
t = new TLatex(xpos, ypos-ioff*legendOffset, "Number of Link Boards:"); ioff++;
|
756 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
757 |
|
758 |
sprintf(label,"%d - total",nLB_total);
|
759 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
760 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
761 |
|
762 |
sprintf(label,"%d - w/o hits",nLB_dead);
|
763 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
764 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
765 |
|
766 |
if(nLB_blacklisted>0) {
|
767 |
sprintf(label,"%d - bad, excluded",nLB_blacklisted);
|
768 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
769 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
770 |
}
|
771 |
|
772 |
//h->Write();
|
773 |
c1->Write();
|
774 |
c1->Print( outfile + "_" + h->GetName() + ".png", "png" );
|
775 |
c1->Print( outfile + "_" + h->GetName() + ".C", "cxx" );
|
776 |
c1->Print( outfile + "_" + h->GetName() + ".pdf", "pdf" );
|
777 |
c1->Print( outfile + "_" + h->GetName() + ".eps", "eps");
|
778 |
|
779 |
////////////////////////////////////////////////////////////////
|
780 |
|
781 |
h2=hLB_Rms_V_Mean;
|
782 |
// Draw: 2D distribution of LB rms vs LB timing
|
783 |
// setTDRStyle();
|
784 |
tdrStyle->SetOptStat(0);
|
785 |
tdrStyle->SetOptLogx(0);
|
786 |
tdrStyle->SetOptLogy(0);
|
787 |
tdrStyle->SetOptLogz(1);
|
788 |
tdrStyle->SetOptTitle(0);//off title
|
789 |
tdrStyle->SetPadGridX(1);
|
790 |
tdrStyle->SetPadGridY(1);
|
791 |
tdrStyle->SetPadRightMargin(0.2);
|
792 |
//tdrStyle->SetPaintTextFormat("5.5f"); // for TEXT bin values
|
793 |
tdrStyle->SetPalette(1);
|
794 |
tdrStyle->SetOptStat(000111100);
|
795 |
tdrStyle->SetStatY(0.9);
|
796 |
tdrStyle->SetStatX(0.9);
|
797 |
tdrStyle->SetStatW(0.2);
|
798 |
tdrStyle->SetStatH(0.05);
|
799 |
//tdrStyle->SetLabelOffset(1.0,"X");
|
800 |
gROOT->ForceStyle();
|
801 |
c1 = new TCanvas( outfile + "_" + h2->GetName(),
|
802 |
h2->GetTitle(),
|
803 |
0,0,600,600);
|
804 |
c1->Draw();
|
805 |
gPad->SetLeftMargin(0.17);
|
806 |
gPad->SetBottomMargin(0.15);
|
807 |
h2->SetTitleSize(0.045,"Y");
|
808 |
h2->SetTitleSize(0.045,"X");
|
809 |
h2->SetTitleSize(0.045,"Z");
|
810 |
h2->SetTitleOffset(1.5,"Y");
|
811 |
h2->SetTitleOffset(1.2,"X");
|
812 |
h2->SetTitleOffset(1.2,"Z");
|
813 |
h2->SetMaximum(nLB_total);
|
814 |
h2->GetXaxis()->CenterTitle(true);
|
815 |
//gPad->SetLeftMargin(0.12);
|
816 |
//h2->SetTitleOffset(.95,"Y");
|
817 |
//h2->GetYaxis()->SetTitle("Fraction of hits");
|
818 |
//h2->GetXaxis()->SetTitle("Chamber hits timing vs L1A [BX]");
|
819 |
h2->SetMarkerSize(1.0); // for TEXT bin values
|
820 |
h2->SetMarkerColor(1); // for TEXT bin valued
|
821 |
h2->SetLineStyle(1);
|
822 |
h2->SetMarkerStyle(1);
|
823 |
h2->SetStats(false);
|
824 |
|
825 |
// get statistics for full range
|
826 |
h2->GetXaxis()->UnZoom();
|
827 |
h2->GetYaxis()->UnZoom();
|
828 |
meanX = h2->GetMean(1);
|
829 |
meanY = h2->GetMean(2);
|
830 |
h2->GetXaxis()->SetRangeUser(-0.11, 0.11);
|
831 |
h2->GetYaxis()->SetRangeUser(0.0, 0.45);
|
832 |
|
833 |
h2->GetXaxis()->SetNdivisions(410);
|
834 |
h2->GetYaxis()->SetNdivisions(410);
|
835 |
h2->Draw("COLZ");
|
836 |
h2->Draw("TEXT0,SAME");
|
837 |
gPad->Update();
|
838 |
c1->Modified();
|
839 |
c1->Update();
|
840 |
|
841 |
// header
|
842 |
//t = new TLatex(0.3,0.94, "RPC LB Synchronization ");
|
843 |
//t->SetNDC(true);t->DrawClone();
|
844 |
//t = new TLatex(.45,.95,"CMS Preliminary #sqrt{s} = 8TeV");
|
845 |
//t->SetNDC(true);t->SetTextSize(0.032); t->DrawClone();
|
846 |
|
847 |
//xpos=0.50;
|
848 |
//ypos=0.40;
|
849 |
xpos=0.20;
|
850 |
ypos=0.85;
|
851 |
ioff=0;
|
852 |
if(geolocation!="") {
|
853 |
t = new TLatex(xpos, ypos-ioff*legendOffset, geolocation); ioff++;
|
854 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
855 |
}
|
856 |
// run range
|
857 |
if(runrange!="") {
|
858 |
t = new TLatex(xpos, ypos-ioff*legendOffset, runrange); ioff++;
|
859 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
860 |
}
|
861 |
if(datasettype!="") {
|
862 |
t = new TLatex(xpos, ypos-ioff*legendOffset, datasettype); ioff++;
|
863 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
864 |
}
|
865 |
// statistics
|
866 |
// NOTE: Using SetRangeUser(), SetRange() causes ROOT
|
867 |
// recompute MEAN/RMS using bin center values in the
|
868 |
// viewable range! In order to get true MEAN/RMS values
|
869 |
// one has to do GetXaxis()->UnZoom() after drawing the
|
870 |
// canvas and before calling GetMean(), GetRms().
|
871 |
// h2->GetXaxis()->UnZoom();
|
872 |
// h2->GetYaxis()->UnZoom();
|
873 |
sprintf(label,"Avg time = %6.4f BX",meanX);
|
874 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
875 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(2); t->DrawClone();
|
876 |
|
877 |
sprintf(label,"Avg spread = %6.4f BX",meanY);
|
878 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
879 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(2); t->DrawClone();
|
880 |
|
881 |
// LB count
|
882 |
t = new TLatex(xpos,ypos-ioff*legendOffset, "Number of Link Boards:"); ioff++;
|
883 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
884 |
|
885 |
sprintf(label,"%d - total",nLB_total);
|
886 |
t = new TLatex(xpos,ypos-ioff*legendOffset, label); ioff++;
|
887 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
888 |
|
889 |
sprintf(label,"%d - w/o hits",nLB_dead);
|
890 |
t = new TLatex(xpos,ypos-ioff*legendOffset, label); ioff++;
|
891 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
892 |
|
893 |
if(nLB_blacklisted>0) {
|
894 |
sprintf(label,"%d - bad, excluded",nLB_blacklisted);
|
895 |
t = new TLatex(xpos,ypos-ioff*legendOffset, label); ioff++;
|
896 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
897 |
}
|
898 |
|
899 |
//h2->Write();
|
900 |
c1->Write();
|
901 |
c1->Print( outfile + "_" + h2->GetName() + ".png", "png" );
|
902 |
c1->Print( outfile + "_" + h2->GetName() + ".C", "cxx" );
|
903 |
c1->Print( outfile + "_" + h2->GetName() + ".pdf", "pdf" );
|
904 |
c1->Print( outfile + "_" + h2->GetName() + ".eps", "eps");
|
905 |
|
906 |
////////////////////////////////////////////////////////////////
|
907 |
|
908 |
for(int ifrac=0; ifrac<frac.size(); ifrac++) {
|
909 |
|
910 |
h=hLB_win[ifrac];
|
911 |
// Draw: Number of Link Boards: vs BX window size
|
912 |
// setTDRStyle();
|
913 |
tdrStyle->SetOptStat(0);
|
914 |
tdrStyle->SetOptLogy(0);
|
915 |
tdrStyle->SetOptTitle(0);//off title
|
916 |
tdrStyle->SetPadGridY(1);
|
917 |
tdrStyle->SetPadRightMargin(0.02);
|
918 |
// tdrStyle->SetPaintTextFormat(".0d"); // for TEXT bin values
|
919 |
tdrStyle->SetPalette(1);
|
920 |
gROOT->ForceStyle();
|
921 |
c1 = new TCanvas( outfile + "_" + h->GetName(),
|
922 |
h->GetTitle(),
|
923 |
0,0,600,600);
|
924 |
c1->Draw();
|
925 |
gPad->SetLeftMargin(0.17);
|
926 |
gPad->SetBottomMargin(0.15);
|
927 |
h->SetTitleSize(0.045,"Y");
|
928 |
h->SetTitleSize(0.045,"X");
|
929 |
h->SetTitleOffset(1.5,"Y");
|
930 |
h->SetTitleOffset(1.2,"X");
|
931 |
//h->GetYaxis()->SetTitle("Fraction of hits");
|
932 |
//h->GetXaxis()->SetTitle("Chamber hits timing vs L1A [BX]");
|
933 |
h->SetMarkerSize(1.7); // for TEXT bin values
|
934 |
h->SetMarkerColor(4); // for TEXT bin valued
|
935 |
h->GetXaxis()->SetLabelSize(0.06);
|
936 |
h->SetStats(false);
|
937 |
h->SetFillColor(4); h->SetFillStyle(3003);
|
938 |
h->DrawCopy("HIST,TEXT0");
|
939 |
gPad->Update();
|
940 |
|
941 |
// header
|
942 |
//t = new TLatex(0.3,0.94, "RPC LB Synchronization ");
|
943 |
//t->SetNDC(true);t->DrawClone();
|
944 |
//t = new TLatex(.45,.95,"CMS Preliminary #sqrt{s} = 8TeV");
|
945 |
//t->SetNDC(true);t->SetTextSize(0.032); t->DrawClone();
|
946 |
|
947 |
//xpos=0.65;
|
948 |
//ypos=0.5;
|
949 |
xpos=0.55;
|
950 |
ypos=0.35;
|
951 |
ioff=0;
|
952 |
// run range
|
953 |
if(geolocation!="") {
|
954 |
t = new TLatex(xpos, ypos-ioff*legendOffset, geolocation); ioff++;
|
955 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
956 |
}
|
957 |
if(runrange!="") {
|
958 |
t = new TLatex(xpos, ypos-ioff*legendOffset, runrange); ioff++;
|
959 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
960 |
}
|
961 |
if(datasettype!="") {
|
962 |
t = new TLatex(xpos, ypos-ioff*legendOffset, datasettype); ioff++;
|
963 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
964 |
}
|
965 |
// statistics
|
966 |
// NOTE: Using SetRangeUser(), SetRange() causes ROOT
|
967 |
// recompute MEAN/RMS using bin center values in the
|
968 |
// viewable range! In order to get true MEAN/RMS values
|
969 |
// one has to do GetXaxis()->UnZoom() after drawing the
|
970 |
// canvas and before calling GetMean(), GetRms().
|
971 |
//h->GetXaxis()->UnZoom();
|
972 |
|
973 |
// LB count
|
974 |
t = new TLatex(xpos, ypos-ioff*legendOffset, "Number of Link Boards:"); ioff++;
|
975 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
976 |
|
977 |
sprintf(label,"%d - total",nLB_total);
|
978 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
979 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
980 |
|
981 |
sprintf(label,"%d - w/o hits",nLB_dead);
|
982 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
983 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
984 |
|
985 |
if(nLB_blacklisted>0) {
|
986 |
sprintf(label,"%d - bad, excluded",nLB_blacklisted);
|
987 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
988 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
989 |
}
|
990 |
|
991 |
//h->Write();
|
992 |
c1->Write();
|
993 |
c1->Print( outfile + "_" + h->GetName() + ".png", "png" );
|
994 |
c1->Print( outfile + "_" + h->GetName() + ".C", "cxx" );
|
995 |
c1->Print( outfile + "_" + h->GetName() + ".pdf", "pdf" );
|
996 |
c1->Print( outfile + "_" + h->GetName() + ".eps", "eps");
|
997 |
|
998 |
} // end of threshold loop
|
999 |
|
1000 |
////////////////////////////////////////////////////////////////
|
1001 |
|
1002 |
p=pLB_Mean_V_Sector;
|
1003 |
// Draw: Distribution of LB timing vs Sector
|
1004 |
// setTDRStyle();
|
1005 |
tdrStyle->SetOptStat(0);
|
1006 |
tdrStyle->SetOptLogy(0);
|
1007 |
tdrStyle->SetOptTitle(0);//off title
|
1008 |
tdrStyle->SetPadGridY(1);
|
1009 |
tdrStyle->SetPadRightMargin(0.02);
|
1010 |
//tdrStyle->SetPaintTextFormat("5.5f"); // for TEXT bin values
|
1011 |
tdrStyle->SetPalette(1);
|
1012 |
tdrStyle->SetOptStat(000111100);
|
1013 |
tdrStyle->SetStatY(0.9);
|
1014 |
tdrStyle->SetStatX(0.9);
|
1015 |
tdrStyle->SetStatW(0.2);
|
1016 |
tdrStyle->SetStatH(0.05);
|
1017 |
gROOT->ForceStyle();
|
1018 |
c1 = new TCanvas( outfile + "_" + p->GetName(),
|
1019 |
p->GetTitle(),
|
1020 |
0,0,600,600);
|
1021 |
c1->Draw();
|
1022 |
gPad->SetLeftMargin(0.17);
|
1023 |
gPad->SetBottomMargin(0.15);
|
1024 |
p->SetTitleSize(0.045,"Y");
|
1025 |
p->SetTitleSize(0.045,"X");
|
1026 |
p->SetTitleOffset(1.8,"Y");
|
1027 |
p->SetTitleOffset(1.2,"X");
|
1028 |
//gPad->SetLeftMargin(0.12);
|
1029 |
//p->SetTitleOffset(.95,"Y");
|
1030 |
//p->GetYaxis()->SetTitle("Fraction of hits");
|
1031 |
//p->GetXaxis()->SetTitle("Chamber hits timing vs L1A [BX]");
|
1032 |
p->SetMarkerSize(1.5); // for TEXT bin values
|
1033 |
p->SetMarkerColor(4); // for TEXT bin valued
|
1034 |
p->SetLineStyle(1);
|
1035 |
p->SetMarkerStyle(20);
|
1036 |
p->SetStats(false);
|
1037 |
p->SetFillStyle(0);
|
1038 |
rangemax=p->GetBinContent(p->GetMaximumBin())+p->GetBinError(p->GetMaximumBin());
|
1039 |
rangemin=p->GetBinContent(p->GetMinimumBin())-p->GetBinError(p->GetMinimumBin());
|
1040 |
|
1041 |
// get statistics for full region
|
1042 |
p->GetYaxis()->UnZoom();
|
1043 |
meanY = p->GetMean(2);
|
1044 |
p->GetYaxis()->SetRangeUser(rangemin-0.4*(rangemax-rangemin), rangemax);
|
1045 |
|
1046 |
p->GetYaxis()->SetNdivisions(410);
|
1047 |
p->GetXaxis()->SetNdivisions(-12);
|
1048 |
p->GetXaxis()->SetLabelSize(0.06);
|
1049 |
p->LabelsOption("h","X");
|
1050 |
//p->SetFillColor(4); p->SetFillStyle(3003);
|
1051 |
p->DrawCopy("E1 P");
|
1052 |
p->DrawCopy("E0 P SAME");
|
1053 |
//p->DrawCopy("HIST,SAME");
|
1054 |
gPad->Update();
|
1055 |
|
1056 |
// header
|
1057 |
//t = new TLatex(0.3,0.94, "RPC LB Synchronization ");
|
1058 |
//t->SetNDC(true);t->DrawClone();
|
1059 |
//t = new TLatex(.45,.95,"CMS Preliminary #sqrt{s} = 8TeV");
|
1060 |
//t->SetNDC(true);t->SetTextSize(0.032); t->DrawClone();
|
1061 |
|
1062 |
// run range
|
1063 |
xpos=0.55;
|
1064 |
ypos=0.35;
|
1065 |
ioff=0;
|
1066 |
if(geolocation!="") {
|
1067 |
t = new TLatex(xpos, ypos-ioff*legendOffset, geolocation); ioff++;
|
1068 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
1069 |
}
|
1070 |
if(runrange!="") {
|
1071 |
t = new TLatex(xpos, ypos-ioff*legendOffset, runrange); ioff++;
|
1072 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
1073 |
}
|
1074 |
if(datasettype!="") {
|
1075 |
t = new TLatex(xpos, ypos-ioff*legendOffset, datasettype); ioff++;
|
1076 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
1077 |
}
|
1078 |
// statistics
|
1079 |
// NOTE: Using SetRangeUser(), SetRange() causes ROOT
|
1080 |
// recompute MEAN/RMS using bin center values in the
|
1081 |
// viewable range! In order to get true MEAN/RMS values
|
1082 |
// one has to do GetXaxis()->UnZoom() after drawing the
|
1083 |
// canvas and before calling GetMean(), GetRms().
|
1084 |
sprintf(label,"Avg time = %6.4f BX",meanY);
|
1085 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
1086 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(2); t->DrawClone();
|
1087 |
l = new TLine(0, meanY, 12, meanY);
|
1088 |
l->SetLineColor(2); l->SetLineStyle(9); l->SetLineWidth(2); l->DrawClone();
|
1089 |
|
1090 |
// LB count
|
1091 |
t = new TLatex(xpos, ypos-ioff*legendOffset, "Number of Link Boards:"); ioff++;
|
1092 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
1093 |
|
1094 |
sprintf(label,"%d - total", nLB_total);
|
1095 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
1096 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
1097 |
|
1098 |
sprintf(label,"%d - w/o hits",nLB_dead);
|
1099 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
1100 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
1101 |
|
1102 |
if(nLB_blacklisted>0) {
|
1103 |
sprintf(label,"%d - bad, excluded",nLB_blacklisted);
|
1104 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
1105 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
1106 |
}
|
1107 |
|
1108 |
//p->Write();
|
1109 |
c1->Write();
|
1110 |
c1->Print( outfile + "_" + p->GetName() + ".png", "png" );
|
1111 |
c1->Print( outfile + "_" + p->GetName() + ".C", "cxx" );
|
1112 |
c1->Print( outfile + "_" + p->GetName() + ".pdf", "pdf" );
|
1113 |
c1->Print( outfile + "_" + p->GetName() + ".eps", "eps");
|
1114 |
|
1115 |
////////////////////////////////////////////////////////////////
|
1116 |
|
1117 |
h=hLB_Evts_V_Sector;
|
1118 |
// Draw: Distribution of hit numbers vs Sector
|
1119 |
// setTDRStyle();
|
1120 |
tdrStyle->SetOptStat(0);
|
1121 |
tdrStyle->SetOptLogy(0);
|
1122 |
tdrStyle->SetOptTitle(0);//off title
|
1123 |
tdrStyle->SetPadGridY(1);
|
1124 |
tdrStyle->SetPadRightMargin(0.02);
|
1125 |
//tdrStyle->SetPaintTextFormat("5.5f"); // for TEXT bin values
|
1126 |
tdrStyle->SetPalette(1);
|
1127 |
tdrStyle->SetOptStat(000111100);
|
1128 |
tdrStyle->SetStatY(0.9);
|
1129 |
tdrStyle->SetStatX(0.9);
|
1130 |
tdrStyle->SetStatW(0.2);
|
1131 |
tdrStyle->SetStatH(0.05);
|
1132 |
gROOT->ForceStyle();
|
1133 |
c1 = new TCanvas( outfile + "_" + h->GetName(),
|
1134 |
h->GetTitle(),
|
1135 |
0,0,600,600);
|
1136 |
c1->Draw();
|
1137 |
gPad->SetLeftMargin(0.17);
|
1138 |
gPad->SetBottomMargin(0.15);
|
1139 |
h->SetTitleSize(0.045,"Y");
|
1140 |
h->SetTitleSize(0.045,"X");
|
1141 |
h->SetTitleOffset(1.8,"Y");
|
1142 |
h->SetTitleOffset(1.2,"X");
|
1143 |
//gPad->SetLeftMargin(0.12);
|
1144 |
//h->SetTitleOffset(.95,"Y");
|
1145 |
//h->GetYaxis()->SetTitle("Fraction of hits");
|
1146 |
//h->GetXaxis()->SetTitle("Chamber hits timing vs L1A [BX]");
|
1147 |
h->SetMarkerSize(1.5); // for TEXT bin values
|
1148 |
h->SetMarkerColor(4); // for TEXT bin valued
|
1149 |
h->SetLineStyle(1);
|
1150 |
h->SetMarkerStyle(20);
|
1151 |
h->SetStats(false);
|
1152 |
h->SetFillStyle(0);
|
1153 |
h->GetXaxis()->SetNdivisions(-12);
|
1154 |
h->GetXaxis()->SetLabelSize(0.06);
|
1155 |
h->LabelsOption("h","X");
|
1156 |
rangemax=h->GetBinContent(h->GetMaximumBin())+h->GetBinError(h->GetMaximumBin());
|
1157 |
rangemin=h->GetBinContent(h->GetMinimumBin())-h->GetBinError(h->GetMinimumBin());
|
1158 |
|
1159 |
// get statistics for full range
|
1160 |
h->GetYaxis()->UnZoom();
|
1161 |
meanY = h->GetMean(2);
|
1162 |
h->GetYaxis()->SetRangeUser(rangemin-0.4*(rangemax-rangemin), rangemax);
|
1163 |
|
1164 |
//h->SetMinimum( 0.5*h->GetMaximum() );
|
1165 |
//h->SetFillColor(4); h->SetFillStyle(3003);
|
1166 |
h->DrawCopy("E1 P");
|
1167 |
h->DrawCopy("E0 P SAME");
|
1168 |
//h->DrawCopy("HIST,SAME");
|
1169 |
gPad->Update();
|
1170 |
|
1171 |
// header
|
1172 |
//t = new TLatex(0.3,0.94, "RPC LB Synchronization ");
|
1173 |
//t->SetNDC(true);t->DrawClone();
|
1174 |
//t = new TLatex(.45,.95,"CMS Preliminary #sqrt{s} = 8TeV");
|
1175 |
//t->SetNDC(true);t->SetTextSize(0.032); t->DrawClone();
|
1176 |
|
1177 |
// run range
|
1178 |
xpos=0.55;
|
1179 |
ypos=0.35;
|
1180 |
ioff=0;
|
1181 |
if(geolocation!="") {
|
1182 |
t = new TLatex(xpos, ypos-ioff*legendOffset, geolocation); ioff++;
|
1183 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
1184 |
}
|
1185 |
if(runrange!="") {
|
1186 |
t = new TLatex(xpos, ypos-ioff*legendOffset, runrange); ioff++;
|
1187 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
1188 |
}
|
1189 |
if(datasettype!="") {
|
1190 |
t = new TLatex(xpos, ypos-ioff*legendOffset, datasettype); ioff++;
|
1191 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
1192 |
}
|
1193 |
|
1194 |
// LB count
|
1195 |
t = new TLatex(xpos, ypos-ioff*legendOffset, "Number of Link Boards:"); ioff++;
|
1196 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
1197 |
|
1198 |
sprintf(label,"%d - total", nLB_total);
|
1199 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
1200 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
1201 |
|
1202 |
sprintf(label,"%d - w/o hits",nLB_dead);
|
1203 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
1204 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
1205 |
|
1206 |
if(nLB_blacklisted>0) {
|
1207 |
sprintf(label,"%d - bad, excluded",nLB_blacklisted);
|
1208 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
1209 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
1210 |
}
|
1211 |
|
1212 |
//h->Write();
|
1213 |
c1->Write();
|
1214 |
c1->Print( outfile + "_" + h->GetName() + ".png", "png" );
|
1215 |
c1->Print( outfile + "_" + h->GetName() + ".C", "cxx" );
|
1216 |
c1->Print( outfile + "_" + h->GetName() + ".pdf", "pdf" );
|
1217 |
c1->Print( outfile + "_" + h->GetName() + ".eps", "eps");
|
1218 |
|
1219 |
////////////////////////////////////////////////////////////////
|
1220 |
|
1221 |
p=pLB_Bx_V_Sector;
|
1222 |
// Draw: Distribution of hit timing vs Sector
|
1223 |
// setTDRStyle();
|
1224 |
tdrStyle->SetOptStat(0);
|
1225 |
tdrStyle->SetOptLogy(0);
|
1226 |
tdrStyle->SetOptTitle(0);//off title
|
1227 |
tdrStyle->SetPadGridY(1);
|
1228 |
tdrStyle->SetPadRightMargin(0.02);
|
1229 |
//tdrStyle->SetPaintTextFormat("5.5f"); // for TEXT bin values
|
1230 |
tdrStyle->SetPalette(1);
|
1231 |
tdrStyle->SetOptStat(000111100);
|
1232 |
tdrStyle->SetStatY(0.9);
|
1233 |
tdrStyle->SetStatX(0.9);
|
1234 |
tdrStyle->SetStatW(0.2);
|
1235 |
tdrStyle->SetStatH(0.05);
|
1236 |
gROOT->ForceStyle();
|
1237 |
c1 = new TCanvas( outfile + "_" + p->GetName(),
|
1238 |
p->GetTitle(),
|
1239 |
0,0,600,600);
|
1240 |
c1->Draw();
|
1241 |
gPad->SetLeftMargin(0.17);
|
1242 |
gPad->SetBottomMargin(0.15);
|
1243 |
p->SetTitleSize(0.045,"Y");
|
1244 |
p->SetTitleSize(0.045,"X");
|
1245 |
p->SetTitleOffset(1.8,"Y");
|
1246 |
p->SetTitleOffset(1.2,"X");
|
1247 |
//gPad->SetLeftMargin(0.12);
|
1248 |
//p->SetTitleOffset(.95,"Y");
|
1249 |
//p->GetYaxis()->SetTitle("Fraction of hits");
|
1250 |
//p->GetXaxis()->SetTitle("Chamber hits timing vs L1A [BX]");
|
1251 |
p->SetMarkerSize(1.5); // for TEXT bin values
|
1252 |
p->SetMarkerColor(4); // for TEXT bin valued
|
1253 |
p->SetLineStyle(1);
|
1254 |
p->SetMarkerStyle(20);
|
1255 |
p->SetStats(false);
|
1256 |
p->SetFillStyle(0);
|
1257 |
rangemax=p->GetBinContent(p->GetMaximumBin())+p->GetBinError(p->GetMaximumBin());
|
1258 |
rangemin=p->GetBinContent(p->GetMinimumBin())-p->GetBinError(p->GetMinimumBin());
|
1259 |
|
1260 |
// get statistics for full range
|
1261 |
p->GetYaxis()->UnZoom();
|
1262 |
meanY = p->GetMean(2);
|
1263 |
p->GetYaxis()->SetRangeUser(rangemin-0.4*(rangemax-rangemin), rangemax);
|
1264 |
|
1265 |
p->GetYaxis()->SetNdivisions(410);
|
1266 |
p->GetXaxis()->SetNdivisions(-12);
|
1267 |
p->GetXaxis()->SetLabelSize(0.06);
|
1268 |
p->LabelsOption("h","X");
|
1269 |
//p->SetFillColor(4); p->SetFillStyle(3003);
|
1270 |
p->DrawCopy("E1 P");
|
1271 |
p->DrawCopy("E0 P SAME");
|
1272 |
//p->DrawCopy("HIST,SAME");
|
1273 |
gPad->Update();
|
1274 |
|
1275 |
// header
|
1276 |
//t = new TLatex(0.3,0.94, "RPC LB Synchronization ");
|
1277 |
//t->SetNDC(true);t->DrawClone();
|
1278 |
//t = new TLatex(.45,.95,"CMS Preliminary #sqrt{s} = 8TeV");
|
1279 |
//t->SetNDC(true);t->SetTextSize(0.032); t->DrawClone();
|
1280 |
|
1281 |
// run range
|
1282 |
xpos=0.55;
|
1283 |
ypos=0.35;
|
1284 |
ioff=0;
|
1285 |
if(geolocation!="") {
|
1286 |
t = new TLatex(xpos, ypos-ioff*legendOffset, geolocation); ioff++;
|
1287 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
1288 |
}
|
1289 |
if(runrange!="") {
|
1290 |
t = new TLatex(xpos, ypos-ioff*legendOffset, runrange); ioff++;
|
1291 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
1292 |
}
|
1293 |
if(datasettype!="") {
|
1294 |
t = new TLatex(xpos, ypos-ioff*legendOffset, datasettype); ioff++;
|
1295 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
1296 |
}
|
1297 |
// statistics
|
1298 |
// NOTE: Using SetRangeUser(), SetRange() causes ROOT
|
1299 |
// recompute MEAN/RMS using bin center values in the
|
1300 |
// viewable range! In order to get true MEAN/RMS values
|
1301 |
// one has to do GetXaxis()->UnZoom() after drawing the
|
1302 |
// canvas and before calling GetMean(), GetRms().
|
1303 |
// p->GetYaxis()->UnZoom();
|
1304 |
sprintf(label,"Avg time = %6.4f BX",meanY);
|
1305 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
1306 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(2); t->DrawClone();
|
1307 |
l = new TLine(0, meanY, 12, meanY);
|
1308 |
l->SetLineColor(2); l->SetLineStyle(9); l->SetLineWidth(2); l->DrawClone();
|
1309 |
|
1310 |
// LB count
|
1311 |
t = new TLatex(xpos, ypos-ioff*legendOffset, "Number of Link Boards:"); ioff++;
|
1312 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
1313 |
|
1314 |
sprintf(label,"%d - total", nLB_total);
|
1315 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
1316 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
1317 |
|
1318 |
sprintf(label,"%d - w/o hits",nLB_dead);
|
1319 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
1320 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
1321 |
|
1322 |
if(nLB_blacklisted>0) {
|
1323 |
sprintf(label,"%d - bad, excluded",nLB_blacklisted);
|
1324 |
t = new TLatex(xpos, ypos-ioff*legendOffset, label); ioff++;
|
1325 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(4); t->DrawClone();
|
1326 |
}
|
1327 |
|
1328 |
//p->Write();
|
1329 |
c1->Write();
|
1330 |
c1->Print( outfile + "_" + p->GetName() + ".png", "png" );
|
1331 |
c1->Print( outfile + "_" + p->GetName() + ".C", "cxx" );
|
1332 |
c1->Print( outfile + "_" + p->GetName() + ".pdf", "pdf" );
|
1333 |
c1->Print( outfile + "_" + p->GetName() + ".eps", "eps");
|
1334 |
|
1335 |
////////////////////////////////////////////////////////////////
|
1336 |
|
1337 |
f.Close();
|
1338 |
}
|
1339 |
|
1340 |
//=================================================
|
1341 |
|
1342 |
// version w/o blacklisted LBs
|
1343 |
void synchro(TString datafile,
|
1344 |
TString outfile="",
|
1345 |
TString runrange="",
|
1346 |
TString datasettype="",
|
1347 |
TString geolocation="") {
|
1348 |
vector<TString> blacklist;
|
1349 |
synchro(datafile, blacklist, outfile, runrange, datasettype, geolocation);
|
1350 |
}
|
1351 |
|
1352 |
|
1353 |
//=================================================
|
1354 |
void synchro_history(TString h_name, TString p_name = "",Int_t log=1)
|
1355 |
{
|
1356 |
if (p_name=="") p_name = h_name ;
|
1357 |
|
1358 |
//gROOT->Reset();
|
1359 |
setTDRStyle();
|
1360 |
gROOT->ForceStyle();
|
1361 |
TStyle *tdrStyle=(TStyle*)(gROOT->FindObject("tdrStyle"));
|
1362 |
|
1363 |
tdrStyle->SetOptStat(0);
|
1364 |
tdrStyle->SetOptLogy(log);
|
1365 |
tdrStyle->SetOptTitle(0);//off title
|
1366 |
tdrStyle->SetPadGridY(1);
|
1367 |
tdrStyle->SetPadRightMargin(0.02);
|
1368 |
tdrStyle->SetPalette(1);
|
1369 |
|
1370 |
TFile *f1 = new TFile("/afs/cern.ch/cms/L1/rpc/plots/marcin/LBTimingSettings/all/2010_04_22_delays_2/merge.root");
|
1371 |
TH1F * h1= (TH1F*)f1->Get(h_name);
|
1372 |
TFile *f2 = new TFile("/afs/cern.ch/cms/L1/rpc/plots/marcin/LBTimingSettings/all/2010_05_12_delays/merge.root");
|
1373 |
TH1F * h2= (TH1F*)f2->Get(h_name);
|
1374 |
//TFile *f3 = new TFile("/afs/cern.ch/user/c/cwiok/scratch0/eff_synchro.06072010/results/3synch_ExpressPhys_noHLTFilter.run138560-138751/merge.root");
|
1375 |
TFile *f3 = new TFile("/afs/cern.ch/user/c/cwiok/scratch0/eff_synchro.06072010/results/3synch_ExpressPhys_noHLTFilter.run138560-139458/merge.root");
|
1376 |
TH1F * h3= (TH1F*)f3->Get(h_name);
|
1377 |
//TFile *f4 = new TFile("/afs/cern.ch/user/c/cwiok/scratch0/eff_synchro.06072010/results/3synch_ExpressPhys_noHLTFilter.run138919-139458/merge.root");
|
1378 |
//TH1F * h4= (TH1F*)f4->Get(h_name);
|
1379 |
|
1380 |
TCanvas *c1 = new TCanvas("c1","",0,0,600,600);
|
1381 |
c1->Draw();
|
1382 |
c1->cd(1);
|
1383 |
gPad->SetLeftMargin(0.12);
|
1384 |
|
1385 |
h1->SetLineColor(8); h1->SetMarkerColor(8); h1->SetFillColor(8); h1->SetFillStyle(0); h1->SetLineWidth(2);
|
1386 |
h2->SetLineColor(2); h2->SetMarkerColor(2); h2->SetFillColor(2); h2->SetFillStyle(0); h2->SetLineWidth(2);
|
1387 |
h3->SetLineColor(4); h3->SetMarkerColor(4); h3->SetFillColor(4); h3->SetFillStyle(3003); h3->SetLineWidth(2);
|
1388 |
//h3->SetLineStyle(2);
|
1389 |
//h4->SetLineColor(1); h4->SetFillColor(1); h4->SetLineWidth(2);
|
1390 |
//h4->SetLineStyle(1); h4->SetFillStyle(3003);
|
1391 |
|
1392 |
h1->Sumw2();
|
1393 |
h2->Sumw2();
|
1394 |
h3->Sumw2();
|
1395 |
Double_t scale1 = 1/h1->Integral();h1->Scale(scale1);
|
1396 |
Double_t scale2 = 1/h2->Integral();h2->Scale(scale2);
|
1397 |
Double_t scale3 = 1/h3->Integral();h3->Scale(scale3);
|
1398 |
//Double_t scale4 = 1/h4->Integral();h4->Scale(scale4);
|
1399 |
|
1400 |
int i=4;
|
1401 |
float bxh1 = h1->GetBinContent(i)*100;
|
1402 |
float bxh2 = h2->GetBinContent(i)*100;
|
1403 |
float bxh3 = h3->GetBinContent(i)*100;
|
1404 |
//float bxh4 = h4->GetBinContent(i)*100;
|
1405 |
|
1406 |
char s[100];
|
1407 |
sprintf(s, "%5.2f", bxh1); TString bx1(s);
|
1408 |
sprintf(s, "%5.2f", bxh2); TString bx2(s);
|
1409 |
sprintf(s, "%5.2f", bxh3); TString bx3(s);
|
1410 |
//sprintf(s, "%5.2f", bxh4); TString bx4(s);
|
1411 |
|
1412 |
cout<<" "<<bxh1<< " "<<bx1<<endl;
|
1413 |
cout<<" "<<bxh2<< " "<<bx2<<endl;
|
1414 |
cout<<" "<<bxh3<< " "<<bx3<<endl;
|
1415 |
//cout<<" "<<bxh4<< " "<<bx4<<endl;
|
1416 |
|
1417 |
/////////////////////////////////////////
|
1418 |
// when plotting 2-3 histograms at once
|
1419 |
h1->SetTitleOffset(1.2,"x");
|
1420 |
h1->SetTitleOffset(1.5,"y");
|
1421 |
h1->GetYaxis()->SetTitle("Fraction of hits");
|
1422 |
h1->GetXaxis()->SetTitle("Chamber hits timing vs L1A [BX]");
|
1423 |
h1->GetYaxis()->SetTitleSize(0.04);
|
1424 |
h1->GetXaxis()->SetTitleSize(0.04);
|
1425 |
|
1426 |
h1->SetMaximum(1.5);
|
1427 |
h1->SetMinimum(5.e-6);
|
1428 |
h1->SetAxisRange(-3.5,3);
|
1429 |
|
1430 |
h1->DrawCopy("E1 HIST");
|
1431 |
h2->DrawCopy("E1 HIST SAME");
|
1432 |
h3->DrawCopy("E1 HIST SAME");
|
1433 |
//h4->DrawCopy("same");
|
1434 |
/*
|
1435 |
///////////////////////////////////////////
|
1436 |
// when h3 is plotted alone
|
1437 |
h3->SetTitleOffset(1.2,"x");
|
1438 |
h3->SetTitleOffset(1.5,"y");
|
1439 |
h3->GetYaxis()->SetTitle("Fraction of hits");
|
1440 |
h3->GetXaxis()->SetTitle("Chamber hits timing vs L1A [BX]");
|
1441 |
h3->GetYaxis()->SetTitleSize(0.04);
|
1442 |
h3->GetXaxis()->SetTitleSize(0.04);
|
1443 |
|
1444 |
h3->SetMaximum(1.5);
|
1445 |
h3->SetMinimum(5.e-6);
|
1446 |
h3->SetAxisRange(-3.5,3);
|
1447 |
h3->DrawCopy("E1 HIST");
|
1448 |
//////////////////////////////////////////
|
1449 |
*/
|
1450 |
gPad->Update();
|
1451 |
|
1452 |
TLatex *t = new TLatex(0.17,0.35,"CMS Preliminary 2012 @ 8TeV");
|
1453 |
t->SetNDC(true);t->SetTextSize(0.035);t->SetTextAngle(90); t->SetTextColor(11); t->DrawClone();
|
1454 |
|
1455 |
t = new TLatex(0.3,0.94, "RPC Hit Synchronization ");
|
1456 |
t->SetNDC(true);t->DrawClone();
|
1457 |
|
1458 |
t = new TLatex(0.47,0.78, "BX=0:");t->SetTextAngle(90);
|
1459 |
t->SetNDC(true);t->SetTextSize(0.035); t->SetTextColor(1); t->DrawClone();
|
1460 |
|
1461 |
i=0;
|
1462 |
t = new TLatex(0.50,0.84-i*0.05, bx1+"%"); i++;
|
1463 |
t->SetNDC(true);t->SetTextSize(0.035); t->SetTextColor(8); t->DrawClone();
|
1464 |
t = new TLatex(0.50,0.84-i*0.05, bx2+"%"); i++;
|
1465 |
t->SetNDC(true);t->SetTextSize(0.035); t->SetTextColor(2); t->DrawClone();
|
1466 |
t = new TLatex(0.50,0.84-i*0.05, bx3+"%"); i++;
|
1467 |
t->SetNDC(true);t->SetTextSize(0.035); t->SetTextColor(4); t->DrawClone();
|
1468 |
//t = new TLatex(0.50,0.84-i*0.05, bx4+"%"); i++;
|
1469 |
//t->SetNDC(true);t->SetTextSize(0.035); t->SetTextColor(1); t->DrawClone();
|
1470 |
|
1471 |
|
1472 |
t = new TLatex(0.23,0.78, "Date:");t->SetTextAngle(90);
|
1473 |
t->SetNDC(true);t->SetTextSize(0.035); t->SetTextColor(1); t->DrawClone();
|
1474 |
|
1475 |
i=0;
|
1476 |
t = new TLatex(0.24,0.84-i*0.05, "2010.04.22"); i++;
|
1477 |
t->SetNDC(true);t->SetTextSize(0.025); t->SetTextColor(8); t->DrawClone();
|
1478 |
t = new TLatex(0.24,0.84-i*0.05, "2010.05.12"); i++;
|
1479 |
t->SetNDC(true);t->SetTextSize(0.025); t->SetTextColor(2); t->DrawClone();
|
1480 |
//t = new TLatex(0.24,0.84-i*0.05, "2010.07.01"); i++;
|
1481 |
t = new TLatex(0.24,0.84-i*0.05, "2010.07.06"); i++;// up to 139458 on 6 Jul 2010
|
1482 |
t->SetNDC(true);t->SetTextSize(0.025); t->SetTextColor(4); t->DrawClone();
|
1483 |
//t = new TLatex(0.24,0.84-i*0.05, "2010.07.04"); i++;
|
1484 |
//t->SetNDC(true);t->SetTextSize(0.025); t->SetTextColor(1); t->DrawClone();
|
1485 |
|
1486 |
|
1487 |
t = new TLatex(0.73,0.78, "Runs:");t->SetTextAngle(90);
|
1488 |
t->SetNDC(true);t->SetTextSize(0.035); t->SetTextColor(1); t->DrawClone();
|
1489 |
|
1490 |
i=0;
|
1491 |
t = new TLatex(0.74,0.84-i*0.05, "132440-133483"); i++;
|
1492 |
t->SetNDC(true);t->SetTextSize(0.035); t->SetTextColor(8); t->DrawClone();
|
1493 |
t = new TLatex(0.74,0.84-i*0.05, "133876-134472"); i++;
|
1494 |
t->SetNDC(true);t->SetTextSize(0.035); t->SetTextColor(2); t->DrawClone();
|
1495 |
//t = new TLatex(0.74,0.84-i*0.05, "138560-138751"); i++;
|
1496 |
t = new TLatex(0.74,0.84-i*0.05, "138560-139458"); i++;
|
1497 |
t->SetNDC(true);t->SetTextSize(0.035); t->SetTextColor(4); t->DrawClone();
|
1498 |
//t = new TLatex(0.74,0.84-i*0.05, "138919-139458"); i++;
|
1499 |
//t->SetNDC(true);t->SetTextSize(0.035); t->SetTextColor(1); t->DrawClone();
|
1500 |
|
1501 |
c1->Print( p_name + ".png", "png" );
|
1502 |
c1->Print( p_name + ".C", "cxx" );
|
1503 |
c1->Print( p_name + ".pdf", "pdf" );
|
1504 |
c1->Print( p_name + ".eps", "eps");
|
1505 |
|
1506 |
// c1->Print(p_name+".png");
|
1507 |
//c1->Print(p_name+".eps");
|
1508 |
// c1->Close();
|
1509 |
c1->Draw();
|
1510 |
}
|
1511 |
|
1512 |
//
|
1513 |
// plots BX distribution for top 10 occupancy and top 10 spread LBs
|
1514 |
//
|
1515 |
void top10(TString datafile,
|
1516 |
TString outfile="",
|
1517 |
TString runrange="",
|
1518 |
TString datasettype="",
|
1519 |
TString geolocation="") {
|
1520 |
|
1521 |
const Float_t legendFontSize = 0.030;
|
1522 |
const Float_t legendOffset = 0.030;
|
1523 |
const Int_t PEAK_BIN = 3; // L1A position (BX=0) in the input text file
|
1524 |
|
1525 |
//gROOT->Reset();
|
1526 |
setTDRStyle();
|
1527 |
TStyle *tdrStyle=(TStyle*)(gROOT->FindObject("tdrStyle"));
|
1528 |
tdrStyle->SetOptStat(0);
|
1529 |
tdrStyle->SetOptLogy(0);
|
1530 |
tdrStyle->SetOptTitle(1);
|
1531 |
tdrStyle->SetPadGridY(0);
|
1532 |
tdrStyle->SetPadRightMargin(0.02);
|
1533 |
//tdrStyle->SetPaintTextFormat("5.0f"); // for TEXT bin values
|
1534 |
tdrStyle->SetPalette(1);
|
1535 |
gROOT->ForceStyle();
|
1536 |
|
1537 |
if(outfile=="") outfile="top10";
|
1538 |
TFile f( (outfile+".root").Data(), "RECREATE");
|
1539 |
f.mkdir("Synchro");
|
1540 |
f.cd("Synchro");
|
1541 |
f.ls();
|
1542 |
|
1543 |
cout << "Top10:"<<endl
|
1544 |
<< " Input ROOT file = " << datafile << endl
|
1545 |
<< " Output file prefix = " << outfile
|
1546 |
<< endl;
|
1547 |
|
1548 |
TFile fin( datafile.Data(), "OLD");
|
1549 |
fin.cd();
|
1550 |
fin.ls();
|
1551 |
|
1552 |
TH2D *h;
|
1553 |
TCanvas *c1;
|
1554 |
Float_t xpos,ypos;
|
1555 |
Int_t ioff;
|
1556 |
TLatex *t;
|
1557 |
|
1558 |
////////////////////////////////////////////////////////////////
|
1559 |
|
1560 |
h=(TH2D*)(gROOT->FindObject("topOccup"));
|
1561 |
for(Int_t nbx=0; nbx<h->GetNbinsX(); nbx++) {
|
1562 |
char label[5];
|
1563 |
sprintf(label,"%d",nbx-PEAK_BIN);
|
1564 |
h->GetXaxis()->SetBinLabel(nbx+1,label);
|
1565 |
}
|
1566 |
h->SetTitle("Top 10 occupancy LBs");
|
1567 |
h->GetXaxis()->SetTitle("Chamber hit timing wrt L1 [BX]");
|
1568 |
h->GetXaxis()->SetRange(1,7);
|
1569 |
c1 = new TCanvas( outfile + "_" + h->GetName(),
|
1570 |
h->GetTitle(), 600, 600);
|
1571 |
c1->Draw();
|
1572 |
gPad->SetLeftMargin(0.3);
|
1573 |
//gPad->SetBottomMargin(0.15);
|
1574 |
//h->SetTitleSize(0.045,"Y");
|
1575 |
//h->SetTitleSize(0.045,"X");
|
1576 |
//h->SetTitleOffset(1.8,"Y");
|
1577 |
//h->SetTitleOffset(1.2,"X");
|
1578 |
h->SetStats(0);
|
1579 |
h->SetFillStyle(0);
|
1580 |
h->SetMarkerSize(1.5);
|
1581 |
h->SetMarkerColor(4);
|
1582 |
//h->GetXaxis()->SetLabelSize(0.06);
|
1583 |
h->SetTitleSize(0.04,"X");
|
1584 |
h->SetTitleOffset(1.05,"X");
|
1585 |
h->LabelsOption("h","X");
|
1586 |
h->DrawCopy("TEXT0");
|
1587 |
gPad->Update();
|
1588 |
|
1589 |
// header
|
1590 |
//t = new TLatex(.45,.95,"CMS Preliminary #sqrt{s} = 8TeV");
|
1591 |
//t->SetNDC(true);t->SetTextSize(0.032); t->DrawClone();
|
1592 |
|
1593 |
// run range
|
1594 |
xpos=0.32;
|
1595 |
ypos=0.20;
|
1596 |
ioff=0;
|
1597 |
if(geolocation!="") {
|
1598 |
t = new TLatex(xpos, ypos-ioff*legendOffset, geolocation); ioff++;
|
1599 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
1600 |
}
|
1601 |
if(runrange!="") {
|
1602 |
t = new TLatex(xpos, ypos-ioff*legendOffset, runrange); ioff++;
|
1603 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
1604 |
}
|
1605 |
if(datasettype!="") {
|
1606 |
t = new TLatex(xpos, ypos-ioff*legendOffset, datasettype); ioff++;
|
1607 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
1608 |
}
|
1609 |
|
1610 |
f.cd("Synchro");
|
1611 |
//h->Write();
|
1612 |
c1->Write();
|
1613 |
c1->Print( outfile + "occup" + ".png", "png" );
|
1614 |
c1->Print( outfile + "occup" + ".C", "cxx" );
|
1615 |
c1->Print( outfile + "occup" + ".pdf", "pdf" );
|
1616 |
c1->Print( outfile + "occup" + ".eps", "eps");
|
1617 |
|
1618 |
fin.cd();
|
1619 |
|
1620 |
////////////////////////////////////////////////////////////////
|
1621 |
|
1622 |
h=(TH2D*)(gROOT->FindObject("topSpread"));
|
1623 |
for(Int_t nbx=0; nbx<h->GetNbinsX(); nbx++) {
|
1624 |
char label[5];
|
1625 |
sprintf(label,"%d",nbx-PEAK_BIN);
|
1626 |
h->GetXaxis()->SetBinLabel(nbx+1,label);
|
1627 |
}
|
1628 |
h->SetTitle("Top 10 spread LBs");
|
1629 |
h->GetXaxis()->SetTitle("Chamber hit timing wrt L1 [BX]");
|
1630 |
h->GetXaxis()->SetRange(1,7);
|
1631 |
c1 = new TCanvas( outfile + "_" + h->GetName(),
|
1632 |
h->GetTitle(), 600, 600);
|
1633 |
c1->Draw();
|
1634 |
gPad->SetLeftMargin(0.3);
|
1635 |
//gPad->SetBottomMargin(0.15);
|
1636 |
//h->SetTitleSize(0.045,"Y");
|
1637 |
//h->SetTitleSize(0.045,"X");
|
1638 |
//h->SetTitleOffset(1.8,"Y");
|
1639 |
//h->SetTitleOffset(1.2,"X");
|
1640 |
h->SetStats(0);
|
1641 |
h->SetFillStyle(0);
|
1642 |
h->SetMarkerSize(1.5);
|
1643 |
h->SetMarkerColor(4);
|
1644 |
//h->GetXaxis()->SetLabelSize(0.06);
|
1645 |
h->SetTitleSize(0.04,"X");
|
1646 |
h->SetTitleOffset(1.05,"X");
|
1647 |
h->LabelsOption("h","X");
|
1648 |
h->DrawCopy("TEXT0");
|
1649 |
gPad->Update();
|
1650 |
|
1651 |
// header
|
1652 |
//t = new TLatex(.45,.95,"CMS Preliminary #sqrt{s} = 8TeV");
|
1653 |
//t->SetNDC(true);t->SetTextSize(0.032); t->DrawClone();
|
1654 |
|
1655 |
// run range
|
1656 |
xpos=0.32;
|
1657 |
ypos=0.20;
|
1658 |
ioff=0;
|
1659 |
if(geolocation!="") {
|
1660 |
t = new TLatex(xpos, ypos-ioff*legendOffset, geolocation); ioff++;
|
1661 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
1662 |
}
|
1663 |
if(runrange!="") {
|
1664 |
t = new TLatex(xpos, ypos-ioff*legendOffset, runrange); ioff++;
|
1665 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
1666 |
}
|
1667 |
if(datasettype!="") {
|
1668 |
t = new TLatex(xpos, ypos-ioff*legendOffset, datasettype); ioff++;
|
1669 |
t->SetNDC(true);t->SetTextSize(legendFontSize); t->SetTextColor(1); t->DrawClone();
|
1670 |
}
|
1671 |
|
1672 |
f.cd("Synchro");
|
1673 |
//h->Write();
|
1674 |
c1->Write();
|
1675 |
c1->Print( outfile + "spread" + ".png", "png" );
|
1676 |
c1->Print( outfile + "spread" + ".C", "cxx" );
|
1677 |
c1->Print( outfile + "spread" + ".pdf", "pdf" );
|
1678 |
c1->Print( outfile + "spread" + ".eps", "eps");
|
1679 |
|
1680 |
fin.cd();
|
1681 |
|
1682 |
////////////////////////////////////////////////////////////////
|
1683 |
|
1684 |
f.Close();
|
1685 |
fin.Close();
|
1686 |
|
1687 |
}
|
1688 |
|
1689 |
//========== MAIN ==============
|
1690 |
|
1691 |
void drawSynchro(const TString dir="./",
|
1692 |
const TString runrange="",
|
1693 |
const TString dataset="",
|
1694 |
const TString prefix="synchro") {
|
1695 |
|
1696 |
gROOT->Reset();
|
1697 |
cout << dir << endl;
|
1698 |
cout << runrange << endl;
|
1699 |
cout << dataset << endl;
|
1700 |
cout << prefix << endl;
|
1701 |
/*
|
1702 |
// Superimposes several synchronizations on the same plot
|
1703 |
// Requires merge.root files produced by synchroMerger.py
|
1704 |
// NOTE: File names are hardcoded in the function body.
|
1705 |
synchro_history("delaySummary");
|
1706 |
*/
|
1707 |
|
1708 |
// Draws several statistics plots per Link Board.
|
1709 |
// Also produces normalized distribution of hit arrival times.
|
1710 |
// Requires delays.txt file (not merge.root) produced by synchroMerger.py
|
1711 |
|
1712 |
// All LBs
|
1713 |
//synchro("/afs/cern.ch/user/c/cwiok/scratch0/submit/ExpressPhys_noHLTFilter/runno_139096-140180_ZBunpr_noMu/delays.txt",
|
1714 |
synchro(dir +
|
1715 |
"/delays.txt",
|
1716 |
prefix + "_Barrel+Endcap",
|
1717 |
runrange, // "139096-140180, no #mu",// "Data corresponds"
|
1718 |
dataset, // "ExpressPhysics", // " to XX nb^{-1}"
|
1719 |
"Barrel+Endcap");
|
1720 |
|
1721 |
/*
|
1722 |
// Excluded LBs from the top 10 BX spread list
|
1723 |
vector<TString> blacklist;
|
1724 |
blacklist.push_back("LB_RE-3_S3_EN33_CH0");
|
1725 |
blacklist.push_back("LB_RB+2_S8_BP2D_CH0");
|
1726 |
blacklist.push_back("LB_RB-2_S10_BN2A_CH0");
|
1727 |
blacklist.push_back("LB_RB0_S9_BP0E_CH0");
|
1728 |
blacklist.push_back("LB_RE+3_S3_EP32_CH2");
|
1729 |
blacklist.push_back("LB_RB+1_S6_BP1E_CH0");
|
1730 |
blacklist.push_back("LB_RB-2_S7_BN2B_CH1");
|
1731 |
blacklist.push_back("LB_RB-2_S10_BN2B_CH2");
|
1732 |
blacklist.push_back("LB_RB-2_S10_BN2E_CH0");
|
1733 |
blacklist.push_back("LB_RE-1_S11_EN22_CH1");
|
1734 |
|
1735 |
//synchro("/afs/cern.ch/user/c/cwiok/scratch0/submit/ExpressPhys_noHLTFilter/runno_139096-140180_ZBunpr_noMu/delays.txt",
|
1736 |
synchro(dir +
|
1737 |
"/delays.txt",
|
1738 |
blacklist,
|
1739 |
prefix + "_excl_Barrel+Endcap",
|
1740 |
runrange.Data(), // "139096-140180, no #mu",// "Data corresponds"
|
1741 |
dataset.Data(), // "ExpressPhysics", // " to XX nb^{-1}"
|
1742 |
"Barrel+Endcap");
|
1743 |
*/
|
1744 |
|
1745 |
// BARREL & ENDCAP
|
1746 |
vector<TString> geolocation;
|
1747 |
geolocation.push_back("Barrel");
|
1748 |
geolocation.push_back("Endcap");
|
1749 |
geolocation.push_back("Endcap_Pos");
|
1750 |
geolocation.push_back("Endcap_Neg");
|
1751 |
for(Int_t igeo=0; igeo<geolocation.size(); igeo++) {
|
1752 |
//synchro("/afs/cern.ch/user/c/cwiok/scratch0/submit/ExpressPhys_noHLTFilter/runno_139096-140180_ZBunpr_noMu/"
|
1753 |
synchro(dir +
|
1754 |
"/delays_" + geolocation[igeo] + ".txt",
|
1755 |
prefix + "_" + geolocation[igeo],
|
1756 |
runrange, // "139096-140180, no #mu",// "Data corresponds"
|
1757 |
dataset, // "ExpressPhysics", // " to XX nb^{-1}"
|
1758 |
geolocation[igeo]);
|
1759 |
}
|
1760 |
|
1761 |
// BARREL per WHEEL
|
1762 |
geolocation.resize(0);
|
1763 |
geolocation.push_back("W-2");
|
1764 |
geolocation.push_back("W-1");
|
1765 |
geolocation.push_back("W0");
|
1766 |
geolocation.push_back("W+1");
|
1767 |
geolocation.push_back("W+2");
|
1768 |
for(Int_t igeo=0; igeo<geolocation.size(); igeo++) {
|
1769 |
//synchro("/afs/cern.ch/user/c/cwiok/scratch0/submit/ExpressPhys_noHLTFilter/runno_139096-140180_ZBunpr_noMu/"
|
1770 |
synchro(dir +
|
1771 |
"/delays_Barrel_" + geolocation[igeo] + ".txt",
|
1772 |
prefix + "_Barrel_" + geolocation[igeo],
|
1773 |
runrange, // "139096-140180, no #mu",// "Data corresponds"
|
1774 |
dataset, // "ExpressPhysics", // " to XX nb^{-1}"
|
1775 |
"Wheel " + geolocation[igeo]);
|
1776 |
}
|
1777 |
|
1778 |
// ENDCAP per DISK
|
1779 |
geolocation.resize(0);
|
1780 |
geolocation.push_back("RE+1");
|
1781 |
geolocation.push_back("RE-1");
|
1782 |
geolocation.push_back("RE+2");
|
1783 |
geolocation.push_back("RE-2");
|
1784 |
geolocation.push_back("RE+3");
|
1785 |
geolocation.push_back("RE-3");
|
1786 |
//geolocation.push_back("RE+4");
|
1787 |
//geolocation.push_back("RE-4");
|
1788 |
for(Int_t igeo=0; igeo<geolocation.size(); igeo++) {
|
1789 |
//synchro("/afs/cern.ch/user/c/cwiok/scratch0/submit/ExpressPhys_noHLTFilter/runno_139096-140180_ZBunpr_noMu/"
|
1790 |
synchro(dir +
|
1791 |
"/delays_Endcap_" + geolocation[igeo] + ".txt",
|
1792 |
prefix + "_Endcap_" + geolocation[igeo],
|
1793 |
runrange, // "139096-140180, no #mu",// "Data corresponds"
|
1794 |
dataset, // "ExpressPhysics", // " to XX nb^{-1}"
|
1795 |
"Endcap disk " + geolocation[igeo]);
|
1796 |
}
|
1797 |
|
1798 |
// BARREL per STATION
|
1799 |
geolocation.resize(0);
|
1800 |
geolocation.push_back("RB1");
|
1801 |
geolocation.push_back("RB2");
|
1802 |
geolocation.push_back("RB3");
|
1803 |
geolocation.push_back("RB4");
|
1804 |
for(Int_t igeo=0; igeo<geolocation.size(); igeo++) {
|
1805 |
//synchro("/afs/cern.ch/user/c/cwiok/scratch0/submit/ExpressPhys_noHLTFilter/runno_139096-140180_ZBunpr_noMu/"
|
1806 |
synchro(dir +
|
1807 |
"/delays_Barrel_" + geolocation[igeo] + ".txt",
|
1808 |
prefix + "_Barrel_" + geolocation[igeo],
|
1809 |
runrange, // "139096-140180, no #mu",// "Data corresponds"
|
1810 |
dataset, // "ExpressPhysics", // " to XX nb^{-1}"
|
1811 |
"Barrel station " + geolocation[igeo]);
|
1812 |
}
|
1813 |
|
1814 |
// ENDCAP per STATTION
|
1815 |
geolocation.resize(0);
|
1816 |
geolocation.push_back("RE1");
|
1817 |
geolocation.push_back("RE2");
|
1818 |
geolocation.push_back("RE3");
|
1819 |
//geolocation.push_back("RE4");
|
1820 |
for(Int_t igeo=0; igeo<geolocation.size(); igeo++) {
|
1821 |
//synchro("/afs/cern.ch/user/c/cwiok/scratch0/submit/ExpressPhys_noHLTFilter/runno_139096-140180_ZBunpr_noMu/"
|
1822 |
synchro(dir +
|
1823 |
"/delays_Endcap_" + geolocation[igeo] + ".txt",
|
1824 |
prefix + "_Endcap_" + geolocation[igeo],
|
1825 |
runrange, // "139096-140180, no #mu",// "Data corresponds"
|
1826 |
dataset, // "ExpressPhysics", // " to XX nb^{-1}"
|
1827 |
"Endcap station " + geolocation[igeo]);
|
1828 |
}
|
1829 |
|
1830 |
top10(dir +
|
1831 |
"/merge.root",
|
1832 |
prefix + "_Barrel+Endcap_top10",
|
1833 |
runrange,
|
1834 |
dataset,
|
1835 |
"Barrel+Endcap");
|
1836 |
|
1837 |
return;
|
1838 |
}
|