1 |
mocchiut |
1.1 |
// |
2 |
|
|
// Check for possible errors and shows raw distribution of variables coming from the DSP (no calibrations needed) - Emiliano Mocchiutti |
3 |
|
|
// |
4 |
|
|
// FCaloQLOOK.c version 1.01 (2006-02-28) |
5 |
|
|
// |
6 |
|
|
// The only input needed is the path to the directory created by YODA for the data file you want to analyze. |
7 |
|
|
// |
8 |
|
|
// Changelog: |
9 |
|
|
// |
10 |
|
|
// 1.00 - 1.01 (2006-02-28): Works on YODA v6 output (single file), does not require anymore calocommon package. |
11 |
|
|
// |
12 |
|
|
// 0.00 - 1.00 (2006-02-28): Clone of CaloQLOOK.c (ground software). |
13 |
|
|
// |
14 |
|
|
#include <iostream> |
15 |
|
|
#include <fstream> |
16 |
|
|
// |
17 |
|
|
#include <TObject.h> |
18 |
|
|
#include <TString.h> |
19 |
|
|
#include <TFile.h> |
20 |
|
|
#include <TCanvas.h> |
21 |
|
|
#include <TH1.h> |
22 |
|
|
#include <TH1F.h> |
23 |
|
|
#include <TH2D.h> |
24 |
|
|
#include <TLatex.h> |
25 |
|
|
#include <TPad.h> |
26 |
|
|
#include <TPolyLine.h> |
27 |
|
|
#include <TStyle.h> |
28 |
mocchiut |
1.2 |
#include <TSystem.h> |
29 |
mocchiut |
1.1 |
// |
30 |
|
|
#include <event/PamelaRun.h> |
31 |
|
|
#include <event/physics/calorimeter/CalorimeterEvent.h> |
32 |
|
|
// |
33 |
|
|
#include <FCaloQLOOKfun.h> |
34 |
|
|
// |
35 |
|
|
using namespace std; |
36 |
|
|
// |
37 |
|
|
void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){ |
38 |
|
|
if ( to == 0 ){ |
39 |
|
|
Int_t t2length = s2.Length(); |
40 |
|
|
s1 = ""; |
41 |
|
|
to = t2length; |
42 |
|
|
}; |
43 |
|
|
for (Int_t i = from; i<to; i++){ |
44 |
|
|
s1.Append(s2[i],1); |
45 |
|
|
}; |
46 |
|
|
} |
47 |
|
|
void stringappend(TString& s1, const TString& s2){ |
48 |
|
|
Int_t t2length = s2.Length(); |
49 |
|
|
for (Int_t i = 0; i<t2length; i++){ |
50 |
|
|
s1.Append(s2[i],1); |
51 |
|
|
}; |
52 |
|
|
} |
53 |
|
|
|
54 |
|
|
TString getFilename(const TString filename){ |
55 |
|
|
const string fil = (const char*)filename; |
56 |
|
|
Int_t posiz = fil.find("dw_"); |
57 |
|
|
if ( posiz == -1 ) posiz = fil.find("DW_"); |
58 |
|
|
if ( posiz == -1 ) return 0; |
59 |
|
|
Int_t posiz2 = posiz+13; |
60 |
|
|
TString file2; |
61 |
|
|
stringcopy(file2,filename,posiz,posiz2); |
62 |
|
|
TString pdat(".dat"); |
63 |
|
|
stringappend(file2,pdat); |
64 |
|
|
return file2; |
65 |
|
|
} |
66 |
|
|
|
67 |
|
|
void FCaloQLOOK(TString filename, Int_t fromevent=0, Int_t toevent=0, TString outDir="", TString saveas = "ps"){ |
68 |
|
|
gStyle->SetPaperSize(19.,25.); |
69 |
|
|
const char* startingdir = gSystem->WorkingDirectory(); |
70 |
|
|
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
71 |
|
|
// |
72 |
|
|
// |
73 |
|
|
ifstream myfile; |
74 |
|
|
myfile.open(filename.Data()); |
75 |
|
|
if ( !myfile ){ |
76 |
mocchiut |
1.2 |
printf(" %s :no such file, exiting...\n\n",filename.Data()); |
77 |
mocchiut |
1.1 |
return; |
78 |
|
|
}; |
79 |
|
|
myfile.close(); |
80 |
|
|
// |
81 |
|
|
TFile *File = new TFile(filename.Data()); |
82 |
|
|
TTree *tr = (TTree*)File->Get("Physics"); |
83 |
mocchiut |
1.2 |
if ( !tr ) { |
84 |
|
|
printf(" Physics : no such tree in %s \n",filename.Data()); |
85 |
|
|
printf(" Exiting, are you sure this is a LEVEL0 not corrupted file? \n\n"); |
86 |
|
|
return; |
87 |
|
|
}; |
88 |
mocchiut |
1.1 |
// |
89 |
|
|
// Define variables |
90 |
|
|
// |
91 |
|
|
Float_t ctshitthr = 0.65; |
92 |
|
|
Float_t cbasethr = 0.95; |
93 |
|
|
Float_t cdexythr = 0.995; |
94 |
|
|
Float_t cdexycthr = 0.95; |
95 |
|
|
// |
96 |
|
|
pamela::calorimeter::CalorimeterEvent *ce = 0; |
97 |
|
|
pamela::EventHeader *eh = 0; |
98 |
|
|
pamela::PscuHeader *ph = 0; |
99 |
|
|
// |
100 |
|
|
UInt_t found; |
101 |
|
|
tr->SetBranchStatus("*",0,&found); //disable all branches |
102 |
|
|
// |
103 |
|
|
found = 0; |
104 |
|
|
tr->SetBranchStatus("iev*",1,&found); |
105 |
|
|
// printf("enabled %i branches \n",found); |
106 |
|
|
found = 0; |
107 |
|
|
tr->SetBranchStatus("dexy*",1,&found); |
108 |
|
|
// printf("enabled %i branches \n",found); |
109 |
|
|
found = 0; |
110 |
|
|
tr->SetBranchStatus("stwerr*",1,&found); |
111 |
|
|
// printf("enabled %i branches \n",found); |
112 |
|
|
found = 0; |
113 |
|
|
tr->SetBranchStatus("perror*",1,&found); |
114 |
|
|
// printf("enabled %i branches \n",found); |
115 |
|
|
found = 0; |
116 |
|
|
tr->SetBranchStatus("cal*",1,&found); |
117 |
|
|
// printf("enabled %i branches \n",found); |
118 |
|
|
found = 0; |
119 |
|
|
tr->SetBranchStatus("base*",1,&found); |
120 |
|
|
//printf("enabled %i branches \n",found); |
121 |
|
|
found = 0; |
122 |
|
|
tr->SetBranchStatus("Pscu*",1,&found); |
123 |
|
|
//printf("enabled %i branches \n",found); |
124 |
|
|
found = 0; |
125 |
|
|
tr->SetBranchStatus("Calorimeter*",1,&found); |
126 |
|
|
//printf("calo enabled %i branches \n",found); |
127 |
|
|
found = 0; |
128 |
|
|
tr->SetBranchStatus("Header*",1,&found); |
129 |
|
|
//printf("head enabled %i branches \n",found); |
130 |
|
|
// |
131 |
|
|
tr->SetBranchAddress("Calorimeter", &ce); |
132 |
|
|
tr->SetBranchAddress("Header", &eh); |
133 |
|
|
// |
134 |
|
|
Long64_t nevents = tr->GetEntries(); |
135 |
|
|
if ( nevents < 1 ) { |
136 |
|
|
printf("The file is empty!\n"); |
137 |
|
|
return; |
138 |
|
|
}; |
139 |
|
|
Int_t const size = nevents; |
140 |
|
|
Double_t iev2[size+1]; |
141 |
|
|
Int_t ver[4][23], lver[4][23],shit[4][11], rshit[4][11], se,bl, pl, fulldiff[4],cshit, cpre[4],nullsh[4][11], lalarm[4]; |
142 |
|
|
se = 0; |
143 |
|
|
pl = 0; |
144 |
|
|
Float_t allbase = 0.; |
145 |
|
|
Int_t tshit, trshit, compdata,rawdata, errorfull, calevn1, calevn2, calevn3, calevn4, pshit[4][11]; |
146 |
|
|
tshit = 0; |
147 |
|
|
trshit = 0; |
148 |
|
|
char *sezione; |
149 |
|
|
Bool_t check = false; |
150 |
|
|
sezione = ""; |
151 |
|
|
stringstream errore; |
152 |
|
|
errore.str(""); |
153 |
|
|
// |
154 |
|
|
TString fififile = getFilename(filename); |
155 |
|
|
const char *file = fififile; |
156 |
|
|
// |
157 |
|
|
// book histograms |
158 |
|
|
// |
159 |
|
|
TH1F *h1; |
160 |
|
|
TH1F *h1r; |
161 |
|
|
TH1F *hdiff; |
162 |
|
|
TH1F *Baseline; |
163 |
|
|
TH1F *Dexy; |
164 |
|
|
TH1F *Dexyc; |
165 |
|
|
TH1F *Calstriphit; |
166 |
|
|
TH1F *calev01; |
167 |
|
|
TH1F *calev23; |
168 |
|
|
TH1F *calev03; |
169 |
|
|
TH2D *calev2; |
170 |
|
|
|
171 |
|
|
h1 = new TH1F("C7","Strips hit, compress mode",100,0.,200.); |
172 |
|
|
h1r = new TH1F("C8","Strips hit, raw mode",100,-1,1); |
173 |
|
|
h1r->SetBit(TH1F::kCanRebin); |
174 |
|
|
hdiff = new TH1F("C6","Differences in full mode",100,-3,3); |
175 |
|
|
hdiff->SetBit(TH1F::kCanRebin); |
176 |
|
|
Baseline = new TH1F("C9","baselines",100,0,3); |
177 |
|
|
Baseline->SetBit(TH1F::kCanRebin); |
178 |
|
|
Dexy = new TH1F("C12","dexy",100,0.,37000.); |
179 |
|
|
Dexyc = new TH1F("C10","dexyc",100,0,3); |
180 |
|
|
Dexyc->SetBit(TH1F::kCanRebin); |
181 |
|
|
Calstriphit = new TH1F("C11","calstriphit[1:4]",100,0.,200.); |
182 |
|
|
|
183 |
|
|
calev01 = new TH1F("C3","|calevnum(1)-calevnum(2)|",100,0,1); |
184 |
|
|
calev01->SetBit(TH1F::kCanRebin); |
185 |
|
|
calev23 = new TH1F("C4","|calevnum(3)-calevnum(4)|",100,0,1); |
186 |
|
|
calev23->SetBit(TH1F::kCanRebin); |
187 |
|
|
calev03 = new TH1F("C5","|calevnum(1)-calevnum(4)|",100,0,1); |
188 |
|
|
calev03->SetBit(TH1F::kCanRebin); |
189 |
|
|
calev2 = new TH2D("C2","calevnum(2)%iev",3000,0.,2.,100,0.,2.); |
190 |
|
|
calev2->SetBit(TH2D::kCanRebin); |
191 |
|
|
|
192 |
|
|
// |
193 |
|
|
// run over each event and take out some variables |
194 |
|
|
// |
195 |
|
|
if ( fromevent > toevent && toevent ){ |
196 |
|
|
printf("It must be fromevent < toevent \n"); |
197 |
|
|
return; |
198 |
|
|
}; |
199 |
|
|
|
200 |
|
|
|
201 |
|
|
if ( fromevent > nevents+1 || fromevent < 0 ) { |
202 |
|
|
printf("You can choose fromevent between 0 (all) and %i \n",(int)nevents+1); |
203 |
|
|
return; |
204 |
|
|
}; |
205 |
|
|
|
206 |
|
|
if ( toevent > nevents+1 || toevent < 0 ) { |
207 |
|
|
printf("You can choose toevent between 0 (all) and %i \n",(int)nevents+1); |
208 |
|
|
return; |
209 |
|
|
}; |
210 |
|
|
Int_t minevent = 0; |
211 |
|
|
Int_t maxevent = 0; |
212 |
|
|
if ( fromevent == 0 ) { |
213 |
|
|
minevent = 0; |
214 |
|
|
maxevent = nevents -1; |
215 |
|
|
} else { |
216 |
|
|
minevent = fromevent - 1; |
217 |
|
|
if ( toevent > 0 ){ |
218 |
|
|
maxevent = toevent - 1; |
219 |
|
|
} else { |
220 |
|
|
maxevent = fromevent - 1; |
221 |
|
|
}; |
222 |
|
|
}; |
223 |
|
|
|
224 |
|
|
for (Int_t k = 0; k < 4; k++ ){ |
225 |
|
|
for (Int_t m = 0; m < 23 ; m++ ){ |
226 |
|
|
ver[k][m] = 0 ; |
227 |
|
|
lver[k][m] = 0 ; |
228 |
|
|
cpre[k]=0; |
229 |
|
|
if ( m < 11 ) { |
230 |
|
|
pshit[k][m] = 0; |
231 |
|
|
nullsh[k][m] = 0; |
232 |
|
|
}; |
233 |
|
|
lalarm[k] = 0; |
234 |
|
|
}; |
235 |
|
|
}; |
236 |
|
|
Int_t pdone, bdone; |
237 |
|
|
pdone = 0; |
238 |
|
|
bdone = 0; |
239 |
|
|
bool isCOMP = 0; |
240 |
|
|
bool isFULL = 0; |
241 |
|
|
bool isRAW = 0; |
242 |
|
|
Int_t alldexy=0; |
243 |
|
|
Int_t alldexy2=0; |
244 |
|
|
Int_t stri=0; |
245 |
|
|
Int_t fcheck = 0; |
246 |
|
|
Int_t cestw=0; |
247 |
|
|
Int_t cmask = 127 ; |
248 |
|
|
compdata = 0; |
249 |
|
|
rawdata = 0; |
250 |
|
|
errorfull = 0; |
251 |
|
|
calevn1 = 0; |
252 |
|
|
calevn2 = 0; |
253 |
|
|
calevn3 = 0; |
254 |
|
|
calevn4 = 0; |
255 |
|
|
fulldiff[0] = 0; |
256 |
|
|
fulldiff[1] = 0; |
257 |
|
|
fulldiff[2] = 0; |
258 |
|
|
fulldiff[3] = 0; |
259 |
|
|
printf("\n Processed events: \n\n"); |
260 |
|
|
unsigned short int calev0=0; |
261 |
|
|
unsigned short int oldcalev0; |
262 |
|
|
unsigned short int calev1=0; |
263 |
|
|
unsigned short int oldcalev1; |
264 |
|
|
unsigned short int calevv2=0; |
265 |
|
|
unsigned short int oldcalev2; |
266 |
|
|
unsigned short int calev3=0; |
267 |
|
|
unsigned short int oldcalev3; |
268 |
|
|
Int_t i = minevent; |
269 |
|
|
Float_t headc = 0.; |
270 |
|
|
Float_t headco = 0.; |
271 |
|
|
Bool_t h1rcheck = false; |
272 |
|
|
Int_t intshit = 0; |
273 |
|
|
Int_t outtshit = 0; |
274 |
|
|
Int_t incshit = 0; |
275 |
|
|
Int_t outcshit = 0; |
276 |
|
|
Int_t inbase = 0; |
277 |
|
|
Int_t outbase = 0; |
278 |
|
|
Int_t indexy = 0; |
279 |
|
|
Int_t outdexy = 0; |
280 |
|
|
Int_t indexyc = 0; |
281 |
|
|
Int_t outdexyc = 0; |
282 |
|
|
while ( i < maxevent+1){ |
283 |
|
|
tshit = 0; |
284 |
|
|
trshit = 0; |
285 |
|
|
tr->GetEntry(i); |
286 |
|
|
iev2[i] = ce->iev; |
287 |
|
|
// |
288 |
|
|
ph = eh->GetPscuHeader(); |
289 |
|
|
headco = headc; |
290 |
|
|
headc = ph->GetCounter(); |
291 |
|
|
calevn1 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])); |
292 |
|
|
calevn2 += (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])); |
293 |
|
|
calevn3 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])); |
294 |
|
|
calev01->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[1]))); |
295 |
|
|
calev23->Fill(abs((int)(ce->calevnum[2]-ce->calevnum[3]))); |
296 |
|
|
calev03->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[3]))); |
297 |
|
|
unsigned short calvnm2 = (unsigned short)ce->calevnum[2]; |
298 |
|
|
calev2->Fill(ce->iev,calvnm2); |
299 |
|
|
calevn4 += (int)ce->calevnum[2]; |
300 |
|
|
oldcalev0 = calev0; |
301 |
|
|
calev0 = (int)ce->calevnum[0]; |
302 |
|
|
oldcalev1 = calev1; |
303 |
|
|
calev1 = (int)ce->calevnum[1]; |
304 |
|
|
oldcalev2 = calevv2; |
305 |
|
|
calevv2 = (int)ce->calevnum[2]; |
306 |
|
|
oldcalev3 = calev3; |
307 |
|
|
calev3 = (int)ce->calevnum[3]; |
308 |
|
|
goto jumpprintout; |
309 |
|
|
if ( (headc - headco -1.) == 0. && ((calev0 - oldcalev0 - 1) > 0 || (calev1 - oldcalev1 - 1) > 0 || (calevv2 - oldcalev2 - 1) > 0 || (calev3 - oldcalev3 - 1) > 0) ){ |
310 |
|
|
if ( i != minevent ) { |
311 |
|
|
printf(" %f 0 Event %i: %i\n",headco,i,oldcalev0); |
312 |
|
|
printf(" %f 0 Event %i: %i\n",headc,i+1,calev0); |
313 |
|
|
printf(" %f 1 Event %i: %i\n",headco,i,oldcalev1); |
314 |
|
|
printf(" %f 1 Event %i: %i\n",headc,i+1,calev1); |
315 |
|
|
printf(" %f 2 Event %i: %i\n",headco,i,oldcalev2); |
316 |
|
|
printf(" %f 2 Event %i: %i\n",headc,i+1,calevv2); |
317 |
|
|
printf(" %f 3 Event %i: %i\n",headco,i,oldcalev3); |
318 |
|
|
printf(" %f 3 Event %i: %i\n",headc,i+1,calev3); |
319 |
|
|
isRAW = 0; |
320 |
|
|
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
321 |
|
|
if ( (calev0 - oldcalev0 - 1) > 0 && !isRAW && ce->perror[0] != 129 && oldcalev0 != 0) { |
322 |
|
|
ver[0][10]++; |
323 |
|
|
}; |
324 |
|
|
isRAW = 0; |
325 |
|
|
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
326 |
|
|
if ( (calev1 - oldcalev1 - 1) > 0 && !isRAW && ce->perror[1] != 129 && oldcalev1 != 0 ){ |
327 |
|
|
ver[1][10]++; |
328 |
|
|
}; |
329 |
|
|
isRAW = 0; |
330 |
|
|
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
331 |
|
|
if ( (calevv2 - oldcalev2 - 1) > 0 && !isRAW && ce->perror[2] != 129 && oldcalev2 != 0 ){ |
332 |
|
|
ver[2][10]++; |
333 |
|
|
}; |
334 |
|
|
isRAW = 0; |
335 |
|
|
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
336 |
|
|
if ( (calev3 - oldcalev3 - 1) > 0 && !isRAW && ce->perror[3] != 129 && oldcalev3 != 0 ){ |
337 |
|
|
ver[3][10]++; |
338 |
|
|
}; |
339 |
|
|
} |
340 |
|
|
}; |
341 |
|
|
jumpprintout: |
342 |
|
|
memcpy(shit, nullsh, sizeof(nullsh)); |
343 |
|
|
memcpy(rshit, nullsh, sizeof(nullsh)); |
344 |
|
|
for (Int_t l = 0; l < 2; l++ ){ |
345 |
|
|
for (Int_t ii = 0; ii < 22; ii++){ |
346 |
|
|
if (l == 0 && ii%2 == 0){ |
347 |
|
|
se = 3; |
348 |
|
|
pl = ii/2; |
349 |
|
|
pdone = 0; |
350 |
|
|
}; |
351 |
|
|
if (l == 0 && ii%2 != 0){ |
352 |
|
|
se = 2; |
353 |
|
|
pl = (ii-1)/2; |
354 |
|
|
pdone = 0; |
355 |
|
|
}; |
356 |
|
|
if (l == 1 && ii%2 == 0){ |
357 |
|
|
se = 0; |
358 |
|
|
pl = ii/2; |
359 |
|
|
pdone = 0; |
360 |
|
|
}; |
361 |
|
|
if (l == 1 && ii%2 != 0){ |
362 |
|
|
se = 1; |
363 |
|
|
pl = (ii-1)/2; |
364 |
|
|
pdone = 0; |
365 |
|
|
}; |
366 |
|
|
|
367 |
|
|
isCOMP = 0; |
368 |
|
|
isFULL = 0; |
369 |
|
|
isRAW = 0; |
370 |
|
|
if ( ce->stwerr[se] & (1 << 16) ) isCOMP = 1; |
371 |
|
|
if ( ce->stwerr[se] & (1 << 17) ) isFULL = 1; |
372 |
|
|
if ( ce->stwerr[se] & (1 << 3) ) isRAW = 1; |
373 |
|
|
bl = -1; |
374 |
|
|
for (Int_t kk = 0; kk < 96 ; kk++ ){ |
375 |
|
|
if ( kk%16 == 0 ){ |
376 |
|
|
bdone = 0; |
377 |
|
|
bl++; |
378 |
|
|
allbase = ce->base[l][ii][bl]; |
379 |
|
|
alldexy=0; |
380 |
|
|
alldexy2=0; |
381 |
|
|
stri=0; |
382 |
|
|
for (Int_t e = 0; e < 16 ; e++ ){ |
383 |
|
|
stri = e + 16 * bl; |
384 |
|
|
alldexy += (int)ce->dexyc[l][ii][stri]; |
385 |
|
|
alldexy2 += (int)ce->dexy[l][ii][stri]; |
386 |
|
|
}; |
387 |
|
|
}; |
388 |
|
|
if ( !isRAW ) { |
389 |
|
|
// |
390 |
|
|
if ( !pdone ){ |
391 |
|
|
if ( (ce->base[l][ii][bl]>32000 || ce->base[l][ii][bl] == 0 ) && ( alldexy > 512000 || alldexy == 0) && ce->perror[se] == 0 ) { |
392 |
|
|
pdone = 1; |
393 |
|
|
pshit[se][pl]++ ; |
394 |
|
|
if ( (ce->stwerr[se] & (1 << 4)) == 0 ) lalarm[se]++; |
395 |
|
|
lver[se][2]++ ; |
396 |
|
|
}; |
397 |
|
|
} |
398 |
|
|
// |
399 |
|
|
if ( !bdone ){ |
400 |
|
|
Baseline->Fill(ce->base[l][ii][bl]); |
401 |
|
|
if ( ce->base[l][ii][bl] > 2000. && ce->base[l][ii][bl] < 4500. ){ |
402 |
|
|
inbase++; |
403 |
|
|
} else { |
404 |
|
|
outbase++; |
405 |
|
|
}; |
406 |
|
|
bdone = 1; |
407 |
|
|
}; |
408 |
|
|
// |
409 |
|
|
if (ce->dexyc[l][ii][kk] > 0 ) { |
410 |
|
|
shit[se][pl]++ ; |
411 |
|
|
compdata = 1; |
412 |
|
|
}; |
413 |
|
|
// |
414 |
|
|
if ( isFULL ) { |
415 |
|
|
if ( ce->dexy[l][ii][kk] > 0 && ce->dexy[l][ii][kk] < 32000 ) { |
416 |
|
|
rshit[se][pl]++ ; |
417 |
|
|
rawdata = 1; |
418 |
|
|
}; |
419 |
|
|
Dexy->Fill(ce->dexy[l][ii][kk]); |
420 |
|
|
if ( ce->dexy[l][ii][kk] < 2000. || ce->dexy[l][ii][kk] > 5000. ) { |
421 |
|
|
outdexy++; |
422 |
|
|
} else { |
423 |
|
|
indexy++; |
424 |
|
|
}; |
425 |
|
|
if ( ce->dexyc[l][ii][kk]>0 && (ce->dexy[l][ii][kk]-ce->dexyc[l][ii][kk]) != 0 && ce->perror[se] != 132 && (ce->base[l][ii][bl] == 0 || ce->base[l][ii][bl] >32000) ){ |
426 |
|
|
hdiff->Fill(ce->dexyc[l][ii][kk]-ce->dexy[l][ii][kk]); |
427 |
|
|
fulldiff[se]++; |
428 |
|
|
errorfull = 1; |
429 |
|
|
}; |
430 |
|
|
}; |
431 |
|
|
// |
432 |
|
|
Dexyc->Fill(ce->dexyc[l][ii][kk]); |
433 |
|
|
if ( ce->dexyc[l][ii][kk] != 0. && ( ce->dexyc[l][ii][kk] < 2000. || ce->dexyc[l][ii][kk] > 5000. ) ) { |
434 |
|
|
outdexyc++; |
435 |
|
|
} else { |
436 |
|
|
indexyc++; |
437 |
|
|
}; |
438 |
|
|
// |
439 |
|
|
if (ce->dexyc[l][ii][kk] < 0 ) ver[se][21]++ ; |
440 |
|
|
// |
441 |
|
|
if ( allbase == 0. || allbase > 32000.) { |
442 |
|
|
fcheck = 0; |
443 |
|
|
for (Int_t nn = bl*16; nn < (bl+1)*16 ; nn++){ |
444 |
|
|
if ( ce->dexyc[l][ii][nn] > 0. && ce->dexyc[l][ii][nn] < 32000. ) fcheck++; |
445 |
|
|
}; |
446 |
|
|
if ( fcheck ) { |
447 |
|
|
cpre[se]++; |
448 |
|
|
allbase = 1.; |
449 |
|
|
}; |
450 |
|
|
}; |
451 |
|
|
// |
452 |
|
|
} else { |
453 |
|
|
if ( !pdone ){ |
454 |
|
|
if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
455 |
|
|
pdone = 1; |
456 |
|
|
pshit[se][pl]++ ; |
457 |
|
|
if ( (ce->stwerr[se] & (1 << 4)) == 0 ) lalarm[se]++; |
458 |
|
|
lver[se][2]++ ; |
459 |
|
|
}; |
460 |
|
|
}; |
461 |
|
|
if ( ce->dexy[l][ii][kk] > 0 && ce->dexy[l][ii][kk] < 32000 ) { |
462 |
|
|
rshit[se][pl]++ ; |
463 |
|
|
rawdata = 1; |
464 |
|
|
}; |
465 |
|
|
Dexy->Fill(ce->dexy[l][ii][kk]); |
466 |
|
|
if ( ce->dexy[l][ii][kk] < 2000. || ce->dexy[l][ii][kk] > 5000. ) { |
467 |
|
|
outdexy++; |
468 |
|
|
} else { |
469 |
|
|
indexy++; |
470 |
|
|
}; |
471 |
|
|
}; |
472 |
|
|
}; |
473 |
|
|
}; |
474 |
|
|
}; |
475 |
|
|
cshit = 0; |
476 |
|
|
for (Int_t k = 0; k < 4 ; k++ ){ |
477 |
|
|
isCOMP = 0; |
478 |
|
|
isFULL = 0; |
479 |
|
|
if ( ce->stwerr[se] & (1 << 16) ) isCOMP = 1; |
480 |
|
|
if ( ce->stwerr[se] & (1 << 17) ) isFULL = 1; |
481 |
|
|
if ( isCOMP ) ver[k][16]++; |
482 |
|
|
if ( isFULL ) ver[k][17]++; |
483 |
|
|
cshit += (int)ce->calstriphit[k]; |
484 |
|
|
cestw=0; |
485 |
|
|
if ( ce->stwerr[k] ) cestw = ce->stwerr[k] & cmask ; |
486 |
|
|
if ( cestw ){ |
487 |
|
|
if ( cestw & (1 << 0) ) ver[k][6]++ ; |
488 |
|
|
if ( cestw & (1 << 1) ) ver[k][5]++ ; |
489 |
|
|
if ( cestw & (1 << 2) ) ver[k][4]++ ; |
490 |
|
|
if ( cestw & (1 << 3) ) ver[k][3]++ ; |
491 |
|
|
if ( cestw & (1 << 4) ) ver[k][2]++ ; |
492 |
|
|
if ( cestw & (1 << 5) ) ver[k][1]++ ; |
493 |
|
|
if ( cestw & (1 << 6) ) ver[k][0]++ ; |
494 |
|
|
}; |
495 |
|
|
if ( ce->perror[k] != 0. ){ |
496 |
|
|
if (ce->perror[k] == 128) ver[k][7]++ ; |
497 |
|
|
if (ce->perror[k] == 129) ver[k][8]++ ; |
498 |
|
|
if (ce->perror[k] == 132) ver[k][11]++ ; |
499 |
|
|
if (ce->perror[k] == 133) ver[k][12]++ ; |
500 |
|
|
if (ce->perror[k] == 134) ver[k][13]++ ; |
501 |
|
|
if (ce->perror[k] == 135) ver[k][14]++ ; |
502 |
|
|
if (ce->perror[k] == 136) ver[k][15]++ ; |
503 |
|
|
if (ce->perror[k] == 139) ver[k][18]++ ; |
504 |
|
|
if (ce->perror[k] == 140) ver[k][19]++ ; |
505 |
|
|
if (ce->perror[k] == 141) ver[k][20]++ ; |
506 |
|
|
if (ce->perror[k] == 142) ver[k][22]++ ; |
507 |
|
|
}; |
508 |
|
|
for (Int_t kk = 0; kk < 11 ; kk++ ){ |
509 |
|
|
tshit += shit[k][kk]; |
510 |
|
|
trshit += rshit[k][kk]; |
511 |
|
|
}; |
512 |
|
|
}; |
513 |
|
|
Calstriphit->Fill(cshit); |
514 |
|
|
if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ |
515 |
|
|
incshit++; |
516 |
|
|
} else { |
517 |
|
|
outcshit++; |
518 |
|
|
}; |
519 |
|
|
if ( tshit>0 ) h1->Fill(tshit); |
520 |
|
|
if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ |
521 |
|
|
intshit++; |
522 |
|
|
} else { |
523 |
|
|
outtshit++; |
524 |
|
|
}; |
525 |
|
|
if ( trshit>0 ) { |
526 |
|
|
h1r->Fill(trshit); |
527 |
|
|
if ( trshit < 4210 ){ |
528 |
|
|
h1rcheck = true; |
529 |
|
|
// printf("ma come... trshit %i \n",trshit); |
530 |
|
|
}; |
531 |
|
|
}; |
532 |
|
|
if ( i%1000 == 0 && i > 0 ) printf("%iK\n",i/1000); |
533 |
|
|
i++; |
534 |
|
|
}; |
535 |
|
|
printf("\n"); |
536 |
|
|
|
537 |
|
|
// |
538 |
|
|
// output figures, first sheet: |
539 |
|
|
// |
540 |
|
|
gStyle->SetOptDate(0); |
541 |
|
|
gStyle->SetOptStat(1111); |
542 |
|
|
TCanvas *figura = new TCanvas("Calorimeter_Detector_Report_1/3", "Calorimeter_Detector_Report_1/3", 1100, 900); |
543 |
|
|
figura->SetFillColor(10); |
544 |
|
|
figura->Range(0,0,100,100); |
545 |
|
|
errore.str(""); |
546 |
|
|
errore << "EXPERT -- File: " << file; |
547 |
|
|
errore << " "; |
548 |
|
|
TLatex *t=new TLatex(); |
549 |
|
|
t->SetTextFont(32); |
550 |
|
|
t->SetTextColor(1); |
551 |
|
|
t->SetTextAlign(12); |
552 |
|
|
t->SetTextSize(0.015); |
553 |
|
|
t->DrawLatex(2.,99.,errore.str().c_str()); |
554 |
|
|
TPad *pd5; |
555 |
|
|
TPad *pd6; |
556 |
|
|
TPad *pad1; |
557 |
|
|
TPad *pad2; |
558 |
|
|
TPad *pad3; |
559 |
|
|
TPad *pad4; |
560 |
|
|
TPad *pd1; |
561 |
|
|
TPad *pd2; |
562 |
|
|
TPad *pd3; |
563 |
|
|
TPad *pd4; |
564 |
|
|
// |
565 |
|
|
Double_t h1max; |
566 |
|
|
TPolyLine *banda1; |
567 |
|
|
TPolyLine *banda2; |
568 |
|
|
Float_t ctshit = 0; |
569 |
|
|
Float_t ccshit = 0; |
570 |
|
|
Float_t cbase = 0; |
571 |
|
|
Float_t cdexy = 0; |
572 |
|
|
Float_t cdexyc = 0; |
573 |
|
|
// |
574 |
|
|
if ( compdata && rawdata ){ |
575 |
|
|
ctshit = (float)intshit/((float)outtshit + (float)intshit); |
576 |
|
|
Int_t pd5col = 10; |
577 |
|
|
Int_t pd6col = 10; |
578 |
|
|
if ( ctshit < ctshitthr ) { |
579 |
|
|
check = true; |
580 |
|
|
pd5col = 45; |
581 |
|
|
}; |
582 |
|
|
if ( h1rcheck ) { |
583 |
|
|
check = true; |
584 |
|
|
pd6col = 45; |
585 |
|
|
}; |
586 |
|
|
pd5 = new TPad("pd5","This is pad5",0.51,0.51,0.98,0.98,pd5col); |
587 |
|
|
pd6 = new TPad("pd6","This is pad6",0.51,0.02,0.98,0.49,pd6col); |
588 |
|
|
pd5->SetTicks(); |
589 |
|
|
pd6->SetTicks(); |
590 |
|
|
pd5->Range(0,0,100,100); |
591 |
|
|
pd6->Range(0,0,100,100); |
592 |
|
|
figura->cd(); |
593 |
|
|
pd5->Draw(); |
594 |
|
|
pd5->cd(); |
595 |
|
|
h1->SetXTitle("Number of hit (dexyc>0)"); |
596 |
|
|
h1->SetYTitle("Number of events"); |
597 |
|
|
h1->Draw(); |
598 |
|
|
// |
599 |
|
|
h1max = h1->GetMaximum()*1.05; |
600 |
|
|
Double_t xc[4] = {0.,25.,25.,0.}; |
601 |
|
|
Double_t yc[4] = {0.,0.,h1max,h1max}; |
602 |
|
|
banda1 = new TPolyLine(4,xc,yc); |
603 |
|
|
banda1->SetLineColor(5); |
604 |
|
|
banda1->SetFillColor(5); |
605 |
|
|
banda1->SetLineWidth(1); |
606 |
|
|
banda1->Draw("fSAME"); |
607 |
|
|
Double_t xd[4] = {40.,80.,80.,40.}; |
608 |
|
|
Double_t yd[4] = {0.,0.,h1max,h1max}; |
609 |
|
|
banda2 = new TPolyLine(4,xd,yd); |
610 |
|
|
banda2->SetLineColor(5); |
611 |
|
|
banda2->SetFillColor(5); |
612 |
|
|
banda2->SetLineWidth(1); |
613 |
|
|
banda2->Draw("fSAME"); |
614 |
|
|
h1->Draw("SAME"); |
615 |
|
|
// |
616 |
|
|
figura->cd(); |
617 |
|
|
pd6->Draw(); |
618 |
|
|
pd6->cd(); |
619 |
|
|
gPad->SetLogy(); |
620 |
|
|
h1r->SetXTitle("Number of hit (dexy>0)"); |
621 |
|
|
h1r->SetYTitle("Number of events"); |
622 |
|
|
h1r->Draw(); |
623 |
|
|
h1max = h1r->GetMaximum()*2.05; |
624 |
|
|
Double_t xg[4] = {4220.,4230.,4230.,4220.}; |
625 |
|
|
Double_t yg[4] = {0.,0.,h1max,h1max}; |
626 |
|
|
banda1 = new TPolyLine(4,xg,yg); |
627 |
|
|
banda1->SetLineColor(5); |
628 |
|
|
banda1->SetFillColor(5); |
629 |
|
|
banda1->SetLineWidth(1); |
630 |
|
|
banda1->Draw("fSAME"); |
631 |
|
|
h1r->Draw("SAME"); |
632 |
|
|
}; |
633 |
|
|
if ( (compdata && !rawdata) || (!compdata && rawdata) ){ |
634 |
|
|
if ( tshit !=0 ) { |
635 |
|
|
ctshit = (float)intshit/((float)outtshit + (float)intshit); |
636 |
|
|
Int_t pd5col = 10; |
637 |
|
|
if ( ctshit < ctshitthr ) { |
638 |
|
|
check = true; |
639 |
|
|
pd5col = 45; |
640 |
|
|
}; |
641 |
|
|
pd5 = new TPad("pd5","This is pad5",0.51,0.02,0.98,0.98,pd5col); |
642 |
|
|
pd5->Range(0,0,100,100); |
643 |
|
|
pd5->SetTicks(); |
644 |
|
|
pd5->Draw(); |
645 |
|
|
pd5->cd(); |
646 |
|
|
h1->SetXTitle("Number of hit (dexyc>0)"); |
647 |
|
|
h1->SetYTitle("Number of events"); |
648 |
|
|
h1->Draw(); |
649 |
|
|
h1max = h1->GetMaximum()*1.05; |
650 |
|
|
Double_t xe[4] = {0.,25.,25.,0.}; |
651 |
|
|
Double_t ye[4] = {0.,0.,h1max,h1max}; |
652 |
|
|
banda1 = new TPolyLine(4,xe,ye); |
653 |
|
|
banda1->SetLineColor(5); |
654 |
|
|
banda1->SetFillColor(5); |
655 |
|
|
banda1->SetLineWidth(1); |
656 |
|
|
banda1->Draw("fSAME"); |
657 |
|
|
Double_t xf[4] = {40.,80.,80.,40.}; |
658 |
|
|
Double_t yf[4] = {0.,0.,h1max,h1max}; |
659 |
|
|
banda2 = new TPolyLine(4,xf,yf); |
660 |
|
|
banda2->SetLineColor(5); |
661 |
|
|
banda2->SetFillColor(5); |
662 |
|
|
banda2->SetLineWidth(1); |
663 |
|
|
banda2->Draw("fSAME"); |
664 |
|
|
h1->Draw("SAME"); |
665 |
|
|
}; |
666 |
|
|
if ( trshit !=0 ) { |
667 |
|
|
Int_t pd5col = 10; |
668 |
|
|
if ( h1rcheck ) { |
669 |
|
|
check = true; |
670 |
|
|
pd5col = 45; |
671 |
|
|
}; |
672 |
|
|
pd5 = new TPad("pd5","This is pad5",0.51,0.02,0.98,0.98,pd5col); |
673 |
|
|
pd5->Range(0,0,100,100); |
674 |
|
|
pd5->SetTicks(); |
675 |
|
|
pd5->Draw(); |
676 |
|
|
pd5->cd(); |
677 |
|
|
gPad->SetLogy(); |
678 |
|
|
h1r->SetXTitle("Number of hit (dexyc>0 or dexy>0)"); |
679 |
|
|
h1r->SetYTitle("Number of events"); |
680 |
|
|
h1r->Draw(); |
681 |
|
|
h1max = h1r->GetMaximum()*2.05; |
682 |
|
|
Double_t xh[4] = {4220.,4230.,4230.,4220.}; |
683 |
|
|
Double_t yh[4] = {0.,0.,h1max,h1max}; |
684 |
|
|
banda1 = new TPolyLine(4,xh,yh); |
685 |
|
|
banda1->SetLineColor(5); |
686 |
|
|
banda1->SetFillColor(5); |
687 |
|
|
banda1->SetLineWidth(1); |
688 |
|
|
banda1->Draw("fSAME"); |
689 |
|
|
h1r->Draw("SAME"); |
690 |
|
|
}; |
691 |
|
|
}; |
692 |
|
|
if ( !errorfull ) { |
693 |
|
|
if ( calevn1 || calevn2 || calevn3 ) { |
694 |
|
|
pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.24,0.98,45); |
695 |
|
|
pd2 = new TPad("pd2","This is pad2",0.26,0.51,0.49,0.98,45); |
696 |
|
|
pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.24,0.49,45); |
697 |
|
|
pd4 = new TPad("pd4","This is pad4",0.26,0.02,0.49,0.49,45); |
698 |
|
|
figura->cd(); |
699 |
|
|
// printf("ou2! \n"); |
700 |
|
|
check = true; |
701 |
|
|
pd1->Range(0,0,100,100); |
702 |
|
|
pd2->Range(0,0,100,100); |
703 |
|
|
pd3->Range(0,0,100,100); |
704 |
|
|
pd4->Range(0,0,100,100); |
705 |
|
|
pd1->Draw(); |
706 |
|
|
pd2->Draw(); |
707 |
|
|
pd3->Draw(); |
708 |
|
|
pd4->Draw(); |
709 |
|
|
|
710 |
|
|
pd1->cd(); |
711 |
|
|
gPad->SetLogy(); |
712 |
|
|
calev01->SetXTitle("delta calevnum 1-2"); |
713 |
|
|
calev01->SetYTitle("Number of events"); |
714 |
|
|
calev01->Draw(); |
715 |
|
|
|
716 |
|
|
pd2->cd(); |
717 |
|
|
gPad->SetLogy(); |
718 |
|
|
calev23->SetXTitle("delta calevnum 3-4"); |
719 |
|
|
calev23->SetYTitle("Number of events"); |
720 |
|
|
calev23->Draw(); |
721 |
|
|
|
722 |
|
|
pd3->cd(); |
723 |
|
|
gPad->SetLogy(); |
724 |
|
|
calev03->SetXTitle("delta calevnum 1-4"); |
725 |
|
|
calev03->SetYTitle("Number of events"); |
726 |
|
|
calev03->Draw(); |
727 |
|
|
|
728 |
|
|
pd4->cd(); |
729 |
|
|
calev2->SetYTitle("calevnum 2"); |
730 |
|
|
calev2->SetXTitle("iev"); |
731 |
|
|
calev2->Draw(); |
732 |
|
|
} else { |
733 |
|
|
if ( calevn4 ) { |
734 |
|
|
pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.49,0.98,10); |
735 |
|
|
figura->cd(); |
736 |
|
|
pd3->Range(0,0,100,100); |
737 |
|
|
pd3->Draw(); |
738 |
|
|
pd3->cd(); |
739 |
|
|
calev2->SetYTitle("calevnum 2"); |
740 |
|
|
calev2->SetXTitle("iev"); |
741 |
|
|
calev2->Draw(); |
742 |
|
|
} else { |
743 |
|
|
figura->cd(); |
744 |
|
|
t=new TLatex(); |
745 |
|
|
t->SetTextFont(32); |
746 |
|
|
t->SetTextColor(1); |
747 |
|
|
t->SetTextSize(0.04); |
748 |
|
|
t->SetTextAlign(12); |
749 |
|
|
t->DrawLatex(10.,49.,"No calevnum infos from DSP"); |
750 |
|
|
}; |
751 |
|
|
}; |
752 |
|
|
} else { |
753 |
|
|
figura->cd(); |
754 |
|
|
check = true; |
755 |
|
|
// printf("nou! \n"); |
756 |
|
|
pd1 = new TPad("pd1","This is pad1",0.02,0.02,0.49,0.98,45); |
757 |
|
|
pd1->Range(0,0,100,100); |
758 |
|
|
pd1->Draw(); |
759 |
|
|
pd1->cd(); |
760 |
|
|
gPad->SetLogy(); |
761 |
|
|
hdiff->SetXTitle("Differences in FULL mode"); |
762 |
|
|
hdiff->SetYTitle("Number of events"); |
763 |
|
|
hdiff->Draw(); |
764 |
|
|
}; |
765 |
|
|
|
766 |
|
|
// |
767 |
|
|
// output figures, second sheet: |
768 |
|
|
// |
769 |
|
|
TCanvas *figura2 = new TCanvas("Calorimeter_Detector_Report_2/3","Calorimeter_Detector_Report_2/3", 1100, 900); |
770 |
|
|
if ( compdata ){ |
771 |
|
|
Int_t pd1col = 10; |
772 |
|
|
Int_t pd2col = 10; |
773 |
|
|
Int_t pd3col = 10; |
774 |
|
|
Int_t pd4col = 10; |
775 |
|
|
if ( (outdexy+indexy) ) { |
776 |
|
|
cdexy = (float)indexy/((float)outdexy + (float)indexy); |
777 |
|
|
if ( cdexy < cdexythr ) { |
778 |
|
|
check = true; |
779 |
|
|
pd4col = 45; |
780 |
|
|
}; |
781 |
|
|
}; |
782 |
|
|
if ( (outcshit+incshit) ) { |
783 |
|
|
ccshit = (float)incshit/((float)outcshit + (float)incshit); |
784 |
|
|
if ( ccshit < ctshitthr ) { |
785 |
|
|
check = true; |
786 |
|
|
pd3col = 45; |
787 |
|
|
}; |
788 |
|
|
}; |
789 |
|
|
if ( (outdexyc+indexyc) ) { |
790 |
|
|
cdexyc = (float)indexyc/((float)outdexyc + (float)indexyc); |
791 |
|
|
if ( cdexyc < cdexycthr ) { |
792 |
|
|
check = true; |
793 |
|
|
pd2col = 45; |
794 |
|
|
}; |
795 |
|
|
}; |
796 |
|
|
if ( (outbase+inbase) ) { |
797 |
|
|
cbase = (float)inbase/((float)outbase + (float)inbase); |
798 |
|
|
if ( cbase < cbasethr ) { |
799 |
|
|
check = true; |
800 |
|
|
pd1col = 45; |
801 |
|
|
}; |
802 |
|
|
}; |
803 |
|
|
figura2->SetFillColor(10); |
804 |
|
|
figura2->Range(0,0,100,100); |
805 |
|
|
errore.str(""); |
806 |
|
|
errore << "EXPERT -- File: " << file; |
807 |
|
|
errore << " "; |
808 |
|
|
t=new TLatex(); |
809 |
|
|
t->SetTextFont(32); |
810 |
|
|
t->SetTextColor(1); |
811 |
|
|
t->SetTextAlign(12); |
812 |
|
|
t->SetTextSize(0.015); |
813 |
|
|
t->DrawLatex(2.,99.,errore.str().c_str()); |
814 |
|
|
pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.49,0.98,pd1col); |
815 |
|
|
pd2 = new TPad("pd2","This is pad2",0.51,0.51,0.98,0.98,pd2col); |
816 |
|
|
pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.49,0.49,pd3col); |
817 |
|
|
pd4 = new TPad("pd4","This is pad4",0.51,0.02,0.98,0.49,pd4col); |
818 |
|
|
figura2->cd(); |
819 |
|
|
pd1->Range(0,0,100,100); |
820 |
|
|
pd2->Range(0,0,100,100); |
821 |
|
|
pd3->Range(0,0,100,100); |
822 |
|
|
pd4->Range(0,0,100,100); |
823 |
|
|
pd1->SetTicks(); |
824 |
|
|
pd2->SetTicks(); |
825 |
|
|
pd3->SetTicks(); |
826 |
|
|
pd4->SetTicks(); |
827 |
|
|
pd1->Draw(); |
828 |
|
|
pd2->Draw(); |
829 |
|
|
pd3->Draw(); |
830 |
|
|
pd4->Draw(); |
831 |
|
|
pd1->cd(); |
832 |
|
|
Baseline->SetXTitle("ADC channels"); |
833 |
|
|
Baseline->SetYTitle("Number of events"); |
834 |
|
|
Baseline->Draw(); |
835 |
|
|
h1max = Baseline->GetMaximum()*1.05; |
836 |
|
|
Double_t xc[4] = {2000.,4500.,4500.,2000.}; |
837 |
|
|
Double_t yc[4] = {0.,0.,h1max,h1max}; |
838 |
|
|
banda1 = new TPolyLine(4,xc,yc); |
839 |
|
|
banda1->SetLineColor(5); |
840 |
|
|
banda1->SetFillColor(5); |
841 |
|
|
banda1->SetLineWidth(1); |
842 |
|
|
banda1->Draw("fSAME"); |
843 |
|
|
Baseline->Draw("SAME"); |
844 |
|
|
// |
845 |
|
|
pd2->cd(); |
846 |
|
|
gPad->SetLogy(); |
847 |
|
|
Dexyc->SetXTitle("ADC channels"); |
848 |
|
|
Dexyc->SetYTitle("Number of events"); |
849 |
|
|
Dexyc->Draw(); |
850 |
|
|
h1max = Dexyc->GetMaximum()*2.05; |
851 |
|
|
Double_t xe[4] = {2000.,5000.,5000.,2000.}; |
852 |
|
|
Double_t ye[4] = {0.,0.,h1max,h1max}; |
853 |
|
|
banda1 = new TPolyLine(4,xe,ye); |
854 |
|
|
banda1->SetLineColor(5); |
855 |
|
|
banda1->SetFillColor(5); |
856 |
|
|
banda1->SetLineWidth(1); |
857 |
|
|
banda1->Draw("fSAME"); |
858 |
|
|
Double_t xj[4] = {0.,40.,40.,0.}; |
859 |
|
|
Double_t yj[4] = {0.,0.,h1max,h1max}; |
860 |
|
|
banda2 = new TPolyLine(4,xj,yj); |
861 |
|
|
banda2->SetLineColor(5); |
862 |
|
|
banda2->SetFillColor(5); |
863 |
|
|
banda2->SetLineWidth(1); |
864 |
|
|
banda2->Draw("fSAME"); |
865 |
|
|
Dexyc->Draw("SAME"); |
866 |
|
|
// |
867 |
|
|
pd3->cd(); |
868 |
|
|
Calstriphit->SetXTitle("Number of hit"); |
869 |
|
|
Calstriphit->SetYTitle("Number of events"); |
870 |
|
|
Calstriphit->Draw(); |
871 |
|
|
h1max = Calstriphit->GetMaximum()*1.05; |
872 |
|
|
Double_t xg[4] = {0.,25.,25.,0.}; |
873 |
|
|
Double_t yg[4] = {0.,0.,h1max,h1max}; |
874 |
|
|
banda1 = new TPolyLine(4,xg,yg); |
875 |
|
|
banda1->SetLineColor(5); |
876 |
|
|
banda1->SetFillColor(5); |
877 |
|
|
banda1->SetLineWidth(1); |
878 |
|
|
banda1->Draw("fSAME"); |
879 |
|
|
Double_t xh[4] = {40.,80.,80.,40.}; |
880 |
|
|
Double_t yh[4] = {0.,0.,h1max,h1max}; |
881 |
|
|
banda2 = new TPolyLine(4,xh,yh); |
882 |
|
|
banda2->SetLineColor(5); |
883 |
|
|
banda2->SetFillColor(5); |
884 |
|
|
banda2->SetLineWidth(1); |
885 |
|
|
banda2->Draw("fSAME"); |
886 |
|
|
Calstriphit->Draw("SAME"); |
887 |
|
|
// |
888 |
|
|
pd4->cd(); |
889 |
|
|
Dexy->SetXTitle("ADC channels"); |
890 |
|
|
Dexy->SetYTitle("Number of events"); |
891 |
|
|
Dexy->Draw(); |
892 |
|
|
h1max = Dexy->GetMaximum()*1.05; |
893 |
|
|
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
894 |
|
|
Double_t yd[4] = {0.,0.,h1max,h1max}; |
895 |
|
|
banda1 = new TPolyLine(4,xd,yd); |
896 |
|
|
banda1->SetLineColor(5); |
897 |
|
|
banda1->SetFillColor(5); |
898 |
|
|
banda1->SetLineWidth(1); |
899 |
|
|
banda1->Draw("fSAME"); |
900 |
|
|
Dexy->Draw("SAME"); |
901 |
|
|
} else { |
902 |
|
|
Int_t pd4col = 10; |
903 |
|
|
if ( (outdexy+indexy) ) { |
904 |
|
|
cdexy = (float)indexy/((float)outdexy + (float)indexy); |
905 |
|
|
if ( cdexy < cdexythr ) { |
906 |
|
|
check = true; |
907 |
|
|
pd4col = 45; |
908 |
|
|
}; |
909 |
|
|
}; |
910 |
|
|
figura2->SetFillColor(10); |
911 |
|
|
figura2->Range(0,0,100,100); |
912 |
|
|
errore.str(""); |
913 |
|
|
errore << "EXPERT -- File: " << file; |
914 |
|
|
errore << " "; |
915 |
|
|
t=new TLatex(); |
916 |
|
|
t->SetTextFont(32); |
917 |
|
|
t->SetTextColor(1); |
918 |
|
|
t->SetTextAlign(12); |
919 |
|
|
t->SetTextSize(0.015); |
920 |
|
|
t->DrawLatex(2.,99.,errore.str().c_str()); |
921 |
|
|
pd4 = new TPad("pd4","This is pad4",0.02,0.02,0.98,0.98,pd4col); |
922 |
|
|
figura2->cd(); |
923 |
|
|
pd4->Range(0,0,100,100); |
924 |
|
|
pd4->SetTicks(); |
925 |
|
|
pd4->Draw(); |
926 |
|
|
// |
927 |
|
|
pd4->cd(); |
928 |
|
|
Dexy->SetXTitle("ADC channels"); |
929 |
|
|
Dexy->SetYTitle("Number of events"); |
930 |
|
|
Dexy->Draw(); |
931 |
|
|
h1max = Dexy->GetMaximum()*1.05; |
932 |
|
|
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
933 |
|
|
Double_t yd[4] = {0.,0.,h1max,h1max}; |
934 |
|
|
banda1 = new TPolyLine(4,xd,yd); |
935 |
|
|
banda1->SetLineColor(5); |
936 |
|
|
banda1->SetFillColor(5); |
937 |
|
|
banda1->SetLineWidth(1); |
938 |
|
|
banda1->Draw("fSAME"); |
939 |
|
|
Dexy->Draw("SAME"); |
940 |
|
|
}; |
941 |
|
|
// |
942 |
|
|
// output figures, report sheet: |
943 |
|
|
// |
944 |
|
|
TCanvas *rapporto= new TCanvas("Calorimeter_Detector_Report_3/3", "Calorimeter_Detector_Report_3/3", 1100, 900); |
945 |
|
|
rapporto->SetFillColor(10); |
946 |
|
|
rapporto->Range(0,0,100,100); |
947 |
|
|
t=new TLatex(); |
948 |
|
|
t->SetTextFont(32); |
949 |
|
|
t->SetTextColor(1); |
950 |
|
|
t->SetTextSize(0.05); |
951 |
|
|
t->SetTextAlign(12); |
952 |
|
|
// t->DrawLatex(33.,95.,"Calorimeter quick look: "); |
953 |
|
|
errore.str(""); |
954 |
|
|
errore << "BASIC: C1 - File: " << file; |
955 |
|
|
errore << " "; |
956 |
|
|
t->SetTextSize(0.02); |
957 |
|
|
t->DrawLatex(2.,99.,errore.str().c_str()); |
958 |
|
|
|
959 |
|
|
pad1 = new TPad("pad1","This is pad1",0.02,0.47,0.49,0.90,19); |
960 |
|
|
pad2 = new TPad("pad2","This is pad2",0.51,0.47,0.98,0.90,19); |
961 |
|
|
pad3 = new TPad("pad3","This is pad3",0.02,0.02,0.49,0.45,19); |
962 |
|
|
pad4 = new TPad("pad4","This is pad4",0.51,0.02,0.98,0.45,19); |
963 |
|
|
pad1->Range(0,0,100,100); |
964 |
|
|
pad2->Range(0,0,100,100); |
965 |
|
|
pad3->Range(0,0,100,100); |
966 |
|
|
pad4->Range(0,0,100,100); |
967 |
|
|
|
968 |
|
|
pad1->Draw(); |
969 |
|
|
pad2->Draw(); |
970 |
|
|
pad3->Draw(); |
971 |
|
|
pad4->Draw(); |
972 |
|
|
|
973 |
|
|
for (Int_t i = 0; i < 4; i++){ |
974 |
|
|
if (i == 2) |
975 |
|
|
{ |
976 |
|
|
pad1->cd() ; |
977 |
|
|
sezione = "** Section YE (x even) **"; |
978 |
|
|
} |
979 |
|
|
if (i == 3) |
980 |
|
|
{ |
981 |
|
|
pad2->cd(); |
982 |
|
|
sezione = "** Section YO (x odd) **"; |
983 |
|
|
} |
984 |
|
|
if (i == 0) |
985 |
|
|
{ |
986 |
|
|
pad3->cd(); |
987 |
|
|
sezione = "** Section XE (y odd) **"; |
988 |
|
|
} |
989 |
|
|
if (i == 1) |
990 |
|
|
{ |
991 |
|
|
pad4->cd(); |
992 |
|
|
sezione = "** Section XO (y even) **"; |
993 |
|
|
} |
994 |
|
|
t->SetTextFont(32); |
995 |
|
|
t->SetTextColor(1); |
996 |
|
|
t->SetTextSize(0.05); |
997 |
|
|
t->SetTextAlign(12); |
998 |
|
|
t->DrawLatex(33.,97.,sezione); |
999 |
|
|
t->SetTextSize(0.05); |
1000 |
|
|
for (Int_t j = 0; j < 23; j++){ |
1001 |
|
|
if ( ver[i][j] || lver[i][j] ) { |
1002 |
|
|
t->SetTextColor(50); |
1003 |
|
|
if (j == 0) { |
1004 |
|
|
errore.str(""); |
1005 |
|
|
errore << "* DSP ack error: " << ver[i][j]; |
1006 |
|
|
errore << " time(s)"; |
1007 |
|
|
t->DrawLatex(2.,30.,errore.str().c_str()); |
1008 |
|
|
check = true; |
1009 |
|
|
} |
1010 |
|
|
if (j == 1) { |
1011 |
|
|
errore.str(""); |
1012 |
|
|
errore << "* Temperature alarm: " << ver[i][j]; |
1013 |
|
|
errore << " time(s)"; |
1014 |
|
|
t->DrawLatex(2.,74.,errore.str().c_str()); |
1015 |
|
|
check = true; |
1016 |
|
|
} |
1017 |
|
|
if (j == 2) { |
1018 |
|
|
if ( lalarm[i] ){ |
1019 |
|
|
errore.str(""); |
1020 |
|
|
errore << "* Latch up: " << ver[i][j]; |
1021 |
|
|
errore << " (" << lalarm[i]; |
1022 |
|
|
errore << " NOT rec!): "; |
1023 |
|
|
t->DrawLatex(0.,70.,errore.str().c_str()); |
1024 |
|
|
check = true; |
1025 |
|
|
} else { |
1026 |
|
|
errore.str(""); |
1027 |
|
|
errore << "* Latch up alarm: " << ver[i][j]; |
1028 |
|
|
errore << " time(s). View(s): "; |
1029 |
|
|
t->DrawLatex(2.,70.,errore.str().c_str()); |
1030 |
|
|
check = true; |
1031 |
|
|
}; |
1032 |
|
|
errore.str(""); |
1033 |
|
|
errore << "(" << lver[i][j]; |
1034 |
|
|
errore << " view(s))"; |
1035 |
|
|
t->DrawLatex(27.,65.,errore.str().c_str()); |
1036 |
|
|
Float_t inc=1.; |
1037 |
|
|
for (Int_t e = 0; e < 11; e++){ |
1038 |
|
|
if ( pshit[i][e] ) { |
1039 |
|
|
errore.str(""); |
1040 |
|
|
errore << " " << (e+1); |
1041 |
|
|
errore << " "; |
1042 |
|
|
t->DrawLatex(52.+inc,69.,errore.str().c_str()); |
1043 |
|
|
Int_t numer = pshit[i][e]; |
1044 |
|
|
errore.str(""); |
1045 |
|
|
errore << " (" << numer; |
1046 |
|
|
errore << ") "; |
1047 |
|
|
t->SetTextAngle(-70); |
1048 |
|
|
t->DrawLatex(55.+inc,67.,errore.str().c_str()); |
1049 |
|
|
t->SetTextAngle(0); |
1050 |
|
|
inc += 4.; |
1051 |
|
|
} |
1052 |
|
|
} |
1053 |
|
|
} |
1054 |
|
|
if (j == 3) { |
1055 |
|
|
errore.str(""); |
1056 |
|
|
errore << "RAW mode: " << ver[i][j]; |
1057 |
|
|
errore << " time(s)"; |
1058 |
|
|
t->SetTextColor(32); |
1059 |
|
|
t->DrawLatex(2.,90.,errore.str().c_str()); |
1060 |
|
|
} |
1061 |
|
|
if (j == 4) { |
1062 |
|
|
errore.str(""); |
1063 |
|
|
errore << "* CMD length error: " << ver[i][j]; |
1064 |
|
|
errore << " time(s)"; |
1065 |
|
|
t->DrawLatex(2.,66.,errore.str().c_str()); |
1066 |
|
|
check = true; |
1067 |
|
|
} |
1068 |
|
|
if (j == 5) { |
1069 |
|
|
errore.str(""); |
1070 |
|
|
errore << "* Execution error: " << ver[i][j]; |
1071 |
|
|
errore << " time(s)"; |
1072 |
|
|
t->DrawLatex(2.,62.,errore.str().c_str()); |
1073 |
|
|
check = true; |
1074 |
|
|
} |
1075 |
|
|
if (j == 6) { |
1076 |
|
|
errore.str(""); |
1077 |
|
|
errore << "* CRC error (st. word): " << ver[i][j]; |
1078 |
|
|
errore << " time(s)"; |
1079 |
|
|
t->DrawLatex(2.,58.,errore.str().c_str()); |
1080 |
|
|
check = true; |
1081 |
|
|
} |
1082 |
|
|
if (j == 7) { |
1083 |
|
|
errore.str(""); |
1084 |
|
|
errore << "View or command not recognized: " << ver[i][j]; |
1085 |
|
|
errore << " time(s)"; |
1086 |
|
|
t->DrawLatex(2.,54.,errore.str().c_str()); |
1087 |
|
|
check = true; |
1088 |
|
|
} |
1089 |
|
|
if (j == 8) { |
1090 |
|
|
errore.str(""); |
1091 |
|
|
errore << "Missing section: " << ver[i][j]; |
1092 |
|
|
errore << " time(s)"; |
1093 |
|
|
t->DrawLatex(2.,50.,errore.str().c_str()); |
1094 |
|
|
check = true; |
1095 |
|
|
} |
1096 |
|
|
if (j == 10) { |
1097 |
|
|
errore.str(""); |
1098 |
|
|
errore << "Calevnum jump: " << ver[i][j]; |
1099 |
|
|
errore << " time(s)"; |
1100 |
|
|
t->DrawLatex(2.,42.,errore.str().c_str()); |
1101 |
|
|
check = true; |
1102 |
|
|
} |
1103 |
|
|
if (j == 11) { |
1104 |
|
|
errore.str(""); |
1105 |
|
|
errore << "CRC error (data): " << ver[i][j]; |
1106 |
|
|
errore << " time(s)"; |
1107 |
|
|
t->DrawLatex(2.,38.,errore.str().c_str()); |
1108 |
|
|
check = true; |
1109 |
|
|
} |
1110 |
|
|
if (j == 12) { |
1111 |
|
|
errore.str(""); |
1112 |
|
|
errore << "Length problems in RAW mode: " << ver[i][j]; |
1113 |
|
|
errore << " time(s)"; |
1114 |
|
|
t->DrawLatex(2.,34.,errore.str().c_str()); |
1115 |
|
|
check = true; |
1116 |
|
|
} |
1117 |
|
|
if (j == 13) { |
1118 |
|
|
errore.str(""); |
1119 |
|
|
errore << "Length problems in COMPRESS mode: " << ver[i][j]; |
1120 |
|
|
errore << " time(s)"; |
1121 |
|
|
t->DrawLatex(2.,34.,errore.str().c_str()); |
1122 |
|
|
check = true; |
1123 |
|
|
} |
1124 |
|
|
if (j == 14) { |
1125 |
|
|
errore.str(""); |
1126 |
|
|
errore << "Length problems in FULL mode: " << ver[i][j]; |
1127 |
|
|
errore << " time(s)"; |
1128 |
|
|
t->DrawLatex(2.,26.,errore.str().c_str()); |
1129 |
|
|
check = true; |
1130 |
|
|
} |
1131 |
|
|
if (j == 15) { |
1132 |
|
|
errore.str(""); |
1133 |
|
|
errore << "Acquisition mode problems: " << ver[i][j]; |
1134 |
|
|
errore << " time(s)"; |
1135 |
|
|
t->DrawLatex(2.,22.,errore.str().c_str()); |
1136 |
|
|
check = true; |
1137 |
|
|
} |
1138 |
|
|
if (j == 16) { |
1139 |
|
|
errore.str(""); |
1140 |
|
|
errore << "COMPRESS mode: " << ver[i][j]; |
1141 |
|
|
errore << " time(s)"; |
1142 |
|
|
t->SetTextColor(32); |
1143 |
|
|
t->DrawLatex(2.,86.,errore.str().c_str()); |
1144 |
|
|
} |
1145 |
|
|
if (j == 17) { |
1146 |
|
|
errore.str(""); |
1147 |
|
|
errore << "FULL mode: " << ver[i][j]; |
1148 |
|
|
errore << " time(s)"; |
1149 |
|
|
t->SetTextColor(32); |
1150 |
|
|
t->DrawLatex(2.,82.,errore.str().c_str()); |
1151 |
|
|
} |
1152 |
|
|
if (j == 18) { |
1153 |
|
|
errore.str(""); |
1154 |
|
|
errore << "Problems with coding: " << ver[i][j]; |
1155 |
|
|
errore << " time(s)"; |
1156 |
|
|
t->DrawLatex(2.,18.,errore.str().c_str()); |
1157 |
|
|
check = true; |
1158 |
|
|
} |
1159 |
|
|
if (j == 19) { |
1160 |
|
|
errore.str(""); |
1161 |
|
|
errore << "Pedestal checksum wrong: " << ver[i][j]; |
1162 |
|
|
errore << " time(s)"; |
1163 |
|
|
t->DrawLatex(2.,14.,errore.str().c_str()); |
1164 |
|
|
check = true; |
1165 |
|
|
} |
1166 |
|
|
if (j == 20) { |
1167 |
|
|
errore.str(""); |
1168 |
|
|
errore << "Thresholds checksum wrong: " << ver[i][j]; |
1169 |
|
|
errore << " time(s)"; |
1170 |
|
|
t->DrawLatex(2.,10.,errore.str().c_str()); |
1171 |
|
|
check = true; |
1172 |
|
|
} |
1173 |
|
|
if (j == 21) { |
1174 |
|
|
errore.str(""); |
1175 |
|
|
errore << "WARNING! DEXYC < 0: " << ver[i][j]; |
1176 |
|
|
errore << " time(s)"; |
1177 |
|
|
t->DrawLatex(2.,6.,errore.str().c_str()); |
1178 |
|
|
check = true; |
1179 |
|
|
} |
1180 |
|
|
if (j == 22) { |
1181 |
|
|
errore.str(""); |
1182 |
|
|
errore << "Packet length is zero (YODA input error), skipped: " << ver[i][j]; |
1183 |
|
|
errore << " time(s)"; |
1184 |
|
|
t->DrawLatex(2.,3.,errore.str().c_str()); |
1185 |
|
|
check = true; |
1186 |
|
|
}; |
1187 |
|
|
}; |
1188 |
|
|
}; |
1189 |
|
|
t->SetTextColor(50); |
1190 |
|
|
if ( fulldiff[i] !=0 ) { |
1191 |
|
|
check = true; |
1192 |
|
|
errore.str(""); |
1193 |
|
|
errore << "Full mode, differences between RAW and COMPRESS mode: " << fulldiff[i]; |
1194 |
|
|
errore << " time(s)"; |
1195 |
|
|
t->DrawLatex(2.,46.,errore.str().c_str()); |
1196 |
|
|
}; |
1197 |
|
|
if ( cpre[i] !=0 ) { |
1198 |
|
|
errore.str(""); |
1199 |
|
|
errore << "Preamplifier fully transmitted: " << cpre[i]; |
1200 |
|
|
errore << " time(s)"; |
1201 |
|
|
t->SetTextColor(32); |
1202 |
|
|
t->DrawLatex(2.,78.,errore.str().c_str()); |
1203 |
|
|
}; |
1204 |
|
|
}; |
1205 |
|
|
rapporto->cd(); |
1206 |
|
|
t->SetTextFont(32); |
1207 |
|
|
t->SetTextColor(1); |
1208 |
|
|
t->SetTextSize(0.05); |
1209 |
|
|
t->SetTextAlign(12); |
1210 |
|
|
t->DrawLatex(22.,95.,"Calorimeter quick look: "); |
1211 |
|
|
//printf("check %i \n",check); |
1212 |
|
|
if ( check ){ |
1213 |
|
|
t->SetTextColor(50); |
1214 |
|
|
t->DrawLatex(60.,95.," WARNING, CHECK! "); |
1215 |
|
|
printf("cdexyc %f cdexy %f ctshit %f cbase %f \n",cdexyc,cdexy,ctshit,cbase); |
1216 |
|
|
} else { |
1217 |
|
|
t->SetTextColor(32); |
1218 |
|
|
t->DrawLatex(60.,95.," OK! "); |
1219 |
|
|
}; |
1220 |
|
|
// |
1221 |
|
|
const string fil = (const char*)filename; |
1222 |
|
|
Int_t posiz = fil.find("dw_"); |
1223 |
|
|
if ( posiz == -1 ) posiz = fil.find("DW_"); |
1224 |
|
|
Int_t posiz2 = posiz+13; |
1225 |
|
|
TString file2; |
1226 |
|
|
stringcopy(file2,filename,posiz,posiz2); |
1227 |
|
|
// |
1228 |
|
|
const char *figrec = file2; |
1229 |
|
|
const char *outdir = outDir; |
1230 |
|
|
stringstream figsave; |
1231 |
|
|
stringstream figsave1; |
1232 |
|
|
stringstream figsave2; |
1233 |
|
|
const char *format = saveas; |
1234 |
|
|
if ( !strcmp(format,"ps") ) { |
1235 |
|
|
figsave.str(""); |
1236 |
|
|
figsave << outdir << "/" ; |
1237 |
|
|
figsave << figrec << "_qlook."; |
1238 |
|
|
figsave << format << "("; |
1239 |
|
|
rapporto->Print(figsave.str().c_str(),"Landscape"); |
1240 |
|
|
figsave1.str(""); |
1241 |
|
|
figsave1 << outdir << "/" ; |
1242 |
|
|
figsave1 << figrec << "_qlook."; |
1243 |
|
|
figsave1 << format; |
1244 |
|
|
figura->Print(figsave1.str().c_str(),"Landscape"); |
1245 |
|
|
figsave2.str(""); |
1246 |
|
|
figsave2 << outdir << "/" ; |
1247 |
|
|
figsave2 << figrec << "_qlook."; |
1248 |
|
|
figsave2 << format << ")"; |
1249 |
|
|
figura2->Print(figsave2.str().c_str(),"Landscape"); |
1250 |
|
|
} else { |
1251 |
|
|
figsave.str(""); |
1252 |
|
|
figsave << outdir << "/" ; |
1253 |
|
|
figsave << figrec << "_qlook1."; |
1254 |
|
|
figsave << format; |
1255 |
|
|
figura->SaveAs(figsave.str().c_str()); |
1256 |
|
|
figsave.str(""); |
1257 |
|
|
figsave << outdir << "/" ; |
1258 |
|
|
figsave << figrec << "_qlook2."; |
1259 |
|
|
figsave << format; |
1260 |
|
|
figura2->SaveAs(figsave.str().c_str()); |
1261 |
|
|
figsave.str(""); |
1262 |
|
|
figsave << outdir << "/" ; |
1263 |
|
|
figsave << figrec << "_qlook3."; |
1264 |
|
|
figsave << format; |
1265 |
|
|
rapporto->SaveAs(figsave.str().c_str()); |
1266 |
|
|
}; |
1267 |
|
|
} |
1268 |
|
|
|