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