1 |
// |
// |
2 |
// Check for possible errors and shows raw distribution of variables coming from the DSP (no calibrations needed) - Emiliano Mocchiutti |
// 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.07 (2006-05-23) |
// FCaloQLOOK.c version 1.14 (2006-09-29) |
5 |
// |
// |
6 |
// The only input needed is the path to the directory created by YODA for the data file you want to analyze. |
// The only input needed is the path to the directory created by YODA for the data file you want to analyze. |
7 |
// |
// |
8 |
// Changelog: |
// Changelog: |
9 |
// |
// |
10 |
|
// 1.13 - 1.14 (2006-09-29): Flag the last entry in the txt file, count missing section when checking for DSP entries correspondence. |
11 |
|
// |
12 |
|
// 1.12 - 1.13 (2006-09-28): Give wrong number of events in compress mode, fixed. |
13 |
|
// |
14 |
|
// 1.11 - 1.12 (2006-09-22): Check for different number of events, put output in a file and write down errors for each event. Fixed jumpev bug. |
15 |
|
// |
16 |
|
// 1.09 - 1.11 (2006-07-17): Adapted to flight conditions. |
17 |
|
// |
18 |
|
// 1.07 - 1.09 (2006-05-29): Fixed bug in output filename when input is not in the form DW_YYMMDD_NNN. Bug in latchup alarm not coming from the status word, fixed. |
19 |
|
// |
20 |
// 1.06 - 1.07 (2006-05-23): Don't print warning in case of latchup not recognized from the status word, fixed. Added "expert" figures from 21 to 28 which appears only in the |
// 1.06 - 1.07 (2006-05-23): Don't print warning in case of latchup not recognized from the status word, fixed. Added "expert" figures from 21 to 28 which appears only in the |
21 |
// case of latchup alarm. |
// case of latchup alarm. |
22 |
// |
// |
36 |
// |
// |
37 |
#include <iostream> |
#include <iostream> |
38 |
#include <fstream> |
#include <fstream> |
39 |
|
#include <cstdlib> |
40 |
// |
// |
41 |
#include <TObject.h> |
#include <TObject.h> |
42 |
#include <TString.h> |
#include <TString.h> |
43 |
#include <TFile.h> |
#include <TFile.h> |
44 |
|
#include <TROOT.h> |
45 |
#include <TCanvas.h> |
#include <TCanvas.h> |
46 |
#include <TH1.h> |
#include <TH1.h> |
47 |
#include <TH1F.h> |
#include <TH1F.h> |
51 |
#include <TPolyLine.h> |
#include <TPolyLine.h> |
52 |
#include <TStyle.h> |
#include <TStyle.h> |
53 |
#include <TSystem.h> |
#include <TSystem.h> |
54 |
|
#include <TApplication.h> |
55 |
// |
// |
56 |
#include <PamelaRun.h> |
#include <PamelaRun.h> |
57 |
#include <physics/calorimeter/CalorimeterEvent.h> |
#include <physics/calorimeter/CalorimeterEvent.h> |
58 |
// |
// |
59 |
#include <FCaloQLOOKfun.h> |
#include <FCaloQLOOKfun.h> |
60 |
|
#include <sys/stat.h> |
61 |
|
#include <cstdlib> |
62 |
// |
// |
63 |
using namespace std; |
using namespace std; |
64 |
// |
// |
80 |
} |
} |
81 |
|
|
82 |
TString getFilename(const TString filename){ |
TString getFilename(const TString filename){ |
83 |
const string fil = (const char*)filename; |
// |
84 |
Int_t posiz = fil.find("dw_"); |
const string fil = gSystem->BaseName(filename.Data()); |
85 |
if ( posiz == -1 ) posiz = fil.find("DW_"); |
Int_t posiz = fil.find(".root"); |
86 |
if ( posiz == -1 ) return 0; |
// |
|
Int_t posiz2 = posiz+13; |
|
87 |
TString file2; |
TString file2; |
88 |
stringcopy(file2,filename,posiz,posiz2); |
if ( posiz == -1 ){ |
89 |
TString pdat(".dat"); |
file2 = gSystem->BaseName(filename.Data()); |
90 |
stringappend(file2,pdat); |
} else { |
91 |
|
Int_t posiz2 = 0; |
92 |
|
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
93 |
|
TString pdat(".pam"); |
94 |
|
stringappend(file2,pdat); |
95 |
|
}; |
96 |
return file2; |
return file2; |
97 |
} |
} |
98 |
|
|
99 |
void FCaloQLOOK(TString filename, Int_t fromevent=0, Int_t toevent=0, TString outDir="", TString saveas = "ps"){ |
void sighandler(UInt_t pkt_num, UInt_t obt, UInt_t entry, UInt_t section, UInt_t totev, Bool_t &evdone){ |
100 |
|
if ( !evdone ){ |
101 |
|
printf("\n\n=================================================\n"); |
102 |
|
printf("PSCU-Pkt N. %u - OBT %u ms\n",pkt_num,obt); |
103 |
|
printf("Total events %u\n",totev); |
104 |
|
printf("(ROOT-tree entry %u )\n",entry); |
105 |
|
if ( (totev-1) == entry ) printf("NOTICE: this is last entry! \n"); |
106 |
|
printf("=================================================\n"); |
107 |
|
evdone = true; |
108 |
|
}; |
109 |
|
TString sec = "UNKNOWN"; |
110 |
|
if ( section == 0 ) sec = "XE"; |
111 |
|
if ( section == 1 ) sec = "XO"; |
112 |
|
if ( section == 2 ) sec = "YE"; |
113 |
|
if ( section == 3 ) sec = "YO"; |
114 |
|
printf(" Section %s (DSP n. %i) message: ",sec.Data(),section); |
115 |
|
}; |
116 |
|
|
117 |
|
void FCaloQLOOK(TString filename, Int_t fromevent=0, Int_t toevent=0, TString outDir="", TString saveas = "png", Bool_t iactive =false, Bool_t w4i=false){ |
118 |
gStyle->SetPaperSize(19.,25.); |
gStyle->SetPaperSize(19.,25.); |
119 |
const char* startingdir = gSystem->WorkingDirectory(); |
const char* startingdir = gSystem->WorkingDirectory(); |
120 |
|
// printf(" basename is %s \n",gSystem->BaseName(filename.Data())); |
121 |
|
// printf(" getfilename is %s \n",getFilename(filename).Data()); |
122 |
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
123 |
// |
// |
124 |
|
TApplication *app = 0; |
125 |
|
if ( iactive ) app = new TApplication("app",0,0); |
126 |
// |
// |
127 |
ifstream myfile; |
ifstream myfile; |
128 |
myfile.open(filename.Data()); |
myfile.open(filename.Data()); |
144 |
// |
// |
145 |
Float_t ctshitthr = 0.65; |
Float_t ctshitthr = 0.65; |
146 |
Float_t cbasethr = 0.95; |
Float_t cbasethr = 0.95; |
147 |
Float_t cdexythr = 0.995; |
// Float_t cdexythr = 0.995; |
148 |
|
Float_t cdexythr = 0.95; |
149 |
|
//Float_t cdexythr = 0.90; |
150 |
Float_t cdexycthr = 0.95; |
Float_t cdexycthr = 0.95; |
151 |
|
Float_t h1rth = 0.90; |
152 |
|
Int_t calevnth = 13; |
153 |
// |
// |
154 |
pamela::calorimeter::CalorimeterEvent *ce = 0; |
pamela::calorimeter::CalorimeterEvent *ce = 0; |
155 |
pamela::EventHeader *eh = 0; |
pamela::EventHeader *eh = 0; |
195 |
return; |
return; |
196 |
}; |
}; |
197 |
Int_t const size = nevents; |
Int_t const size = nevents; |
198 |
Double_t iev2[size+1]; |
// Double_t iev2[size+1]; |
199 |
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]; |
//aumentata la lunghezza di ver, prima era 23 |
200 |
|
Int_t ver[4][24], lver[4][23],shit[4][11], rshit[4][11], se,bl, pl, fulldiff[4],cshit, cpre[4],nullsh[4][11], lalarm[4]; |
201 |
se = 0; |
se = 0; |
202 |
pl = 0; |
pl = 0; |
203 |
Float_t allbase = 0.; |
Float_t allbase = 0.; |
204 |
Int_t tshit, trshit, compdata,rawdata, errorfull, calevn1, calevn2, calevn3, calevn4, pshit[4][11]; |
Int_t tshit, trshit, compdata,rawdata, errorfull, calevn1, calevn2, calevn3, calevn4, pshit[4][11]; |
205 |
tshit = 0; |
tshit = 0; |
206 |
trshit = 0; |
trshit = 0; |
207 |
char *sezione; |
const char *sezione = ""; |
208 |
Bool_t check = false; |
Bool_t check = false; |
209 |
sezione = ""; |
// sezione = ""; |
210 |
stringstream errore; |
stringstream errore; |
211 |
errore.str(""); |
errore.str(""); |
212 |
// |
// |
236 |
hdiff->SetBit(TH1F::kCanRebin); |
hdiff->SetBit(TH1F::kCanRebin); |
237 |
Baseline = new TH1F("C9","baselines",100,0,3); |
Baseline = new TH1F("C9","baselines",100,0,3); |
238 |
Baseline->SetBit(TH1F::kCanRebin); |
Baseline->SetBit(TH1F::kCanRebin); |
239 |
Dexy = new TH1F("C12","dexy",100,0.,37000.); |
Dexy = new TH1F("C12","dexy",100,0.,10000.); |
240 |
Dexyc = new TH1F("C10","dexyc",100,0,3); |
Dexy->SetBit(TH1F::kCanRebin); |
241 |
Dexyc->SetBit(TH1F::kCanRebin); |
Dexyc = new TH1F("C10","dexyc",100,-100.,37000.); |
242 |
|
// Dexyc->SetBit(TH1F::kCanRebin); |
243 |
Calstriphit = new TH1F("C11","calstriphit[1:4]",100,0.,200.); |
Calstriphit = new TH1F("C11","calstriphit[1:4]",100,0.,200.); |
244 |
|
|
245 |
calev01 = new TH1F("C3","|calevnum(1)-calevnum(2)|",100,0,1); |
calev01 = new TH1F("C3","|calevnum(1)-calevnum(2)|",100,0,1); |
299 |
maxevent = fromevent - 1; |
maxevent = fromevent - 1; |
300 |
}; |
}; |
301 |
}; |
}; |
302 |
|
//azzera i tipi di errore |
303 |
for (Int_t k = 0; k < 4; k++ ){ |
for (Int_t k = 0; k < 4; k++ ){ |
304 |
for (Int_t m = 0; m < 23 ; m++ ){ |
for (Int_t m = 0; m < 23 ; m++ ){ |
305 |
ver[k][m] = 0 ; |
ver[k][m] = 0 ; |
311 |
}; |
}; |
312 |
lalarm[k] = 0; |
lalarm[k] = 0; |
313 |
}; |
}; |
314 |
|
//il 23 lo azzero cosi per non modificare le altre variabili |
315 |
|
ver[k][23]=0; |
316 |
}; |
}; |
317 |
Int_t pdone, bdone; |
Int_t pdone, bdone; |
318 |
pdone = 0; |
pdone = 0; |
319 |
bdone = 0; |
bdone = 0; |
320 |
bool isCOMP = 0; |
bool isCOMP = false; |
321 |
bool isFULL = 0; |
bool isFULL = false; |
322 |
bool isRAW = 0; |
bool isRAW = false; |
323 |
Int_t alldexy=0; |
Int_t alldexy=0; |
324 |
Int_t alldexy2=0; |
Int_t alldexy2=0; |
325 |
Int_t stri=0; |
Int_t planebases=0; |
326 |
|
// Int_t stri=0; |
327 |
Int_t fcheck = 0; |
Int_t fcheck = 0; |
328 |
Int_t cestw=0; |
Int_t cestw=0; |
329 |
Int_t cmask = 127 ; |
Int_t cmask = 127 ; |
338 |
fulldiff[1] = 0; |
fulldiff[1] = 0; |
339 |
fulldiff[2] = 0; |
fulldiff[2] = 0; |
340 |
fulldiff[3] = 0; |
fulldiff[3] = 0; |
341 |
printf("\n Processed events: \n\n"); |
// printf("\n Processed events: \n\n"); |
342 |
|
printf("\n Start processing: \n\n"); |
343 |
unsigned short int calev0=0; |
unsigned short int calev0=0; |
344 |
unsigned short int oldcalev0; |
unsigned short int oldcalev0; |
345 |
unsigned short int calev1=0; |
unsigned short int calev1=0; |
349 |
unsigned short int calev3=0; |
unsigned short int calev3=0; |
350 |
unsigned short int oldcalev3; |
unsigned short int oldcalev3; |
351 |
Int_t i = minevent; |
Int_t i = minevent; |
352 |
Float_t headc = 0.; |
UInt_t headc = 0; |
353 |
Float_t headco = 0.; |
UInt_t headco = 0; |
354 |
Bool_t h1rcheck = false; |
Bool_t h1rcheck = false; |
355 |
|
Int_t h1rin = 0; |
356 |
|
Int_t h1rout = 0; |
357 |
Int_t intshit = 0; |
Int_t intshit = 0; |
358 |
Int_t outtshit = 0; |
Int_t outtshit = 0; |
359 |
Int_t incshit = 0; |
Int_t incshit = 0; |
364 |
Int_t outdexy = 0; |
Int_t outdexy = 0; |
365 |
Int_t indexyc = 0; |
Int_t indexyc = 0; |
366 |
Int_t outdexyc = 0; |
Int_t outdexyc = 0; |
367 |
Int_t obt = 0; |
UInt_t obt = 0; |
368 |
Int_t minobt[4]; |
UInt_t minobt[4]; |
369 |
Int_t maxobt[4]; |
UInt_t maxobt[4]; |
370 |
Int_t swminobt[4]; |
UInt_t swminobt[4]; |
371 |
Int_t swmaxobt[4]; |
UInt_t swmaxobt[4]; |
372 |
Bool_t firstobt[4]; |
Bool_t firstobt[4]; |
373 |
Bool_t swfirstobt[4]; |
Bool_t swfirstobt[4]; |
374 |
for ( Int_t i = 0; i<4; i++){ |
for ( Int_t i = 0; i<4; i++){ |
379 |
firstobt[i] = true; |
firstobt[i] = true; |
380 |
swfirstobt[i] = true; |
swfirstobt[i] = true; |
381 |
}; |
}; |
382 |
|
Bool_t evdone = false; |
383 |
|
// |
384 |
while ( i < maxevent+1){ |
while ( i < maxevent+1){ |
385 |
|
evdone = false; |
386 |
tshit = 0; |
tshit = 0; |
387 |
trshit = 0; |
trshit = 0; |
388 |
tr->GetEntry(i); |
tr->GetEntry(i); |
389 |
iev2[i] = ce->iev; |
|
390 |
|
// iev2[i] = ce->iev; |
391 |
// |
// |
392 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
393 |
headco = headc; |
headco = headc; |
394 |
headc = ph->GetCounter(); |
headc = ph->GetCounter(); |
395 |
obt = ph->GetOrbitalTime(); |
obt = ph->GetOrbitalTime(); |
396 |
calevn1 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])); |
|
397 |
calevn2 += (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])); |
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])) ) calevn1++; |
398 |
calevn3 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])); |
if ( (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])) ) calevn2++; |
399 |
|
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])) ) calevn3++; |
400 |
calev01->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[1]))); |
calev01->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[1]))); |
401 |
calev23->Fill(abs((int)(ce->calevnum[2]-ce->calevnum[3]))); |
calev23->Fill(abs((int)(ce->calevnum[2]-ce->calevnum[3]))); |
402 |
calev03->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[3]))); |
calev03->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[3]))); |
411 |
calevv2 = (int)ce->calevnum[2]; |
calevv2 = (int)ce->calevnum[2]; |
412 |
oldcalev3 = calev3; |
oldcalev3 = calev3; |
413 |
calev3 = (int)ce->calevnum[3]; |
calev3 = (int)ce->calevnum[3]; |
414 |
goto jumpprintout; |
// goto jumpprintout; |
415 |
if ( (headc - headco -1.) == 0. && ((calev0 - oldcalev0 - 1) > 0 || (calev1 - oldcalev1 - 1) > 0 || (calevv2 - oldcalev2 - 1) > 0 || (calev3 - oldcalev3 - 1) > 0) ){ |
if ( (headc - headco -1) == 0. && ((calev0 - oldcalev0 - 1) > 0 || (calev1 - oldcalev1 - 1) > 0 || (calevv2 - oldcalev2 - 1) > 0 || (calev3 - oldcalev3 - 1) > 0) ){ |
416 |
if ( i != minevent ) { |
if ( i != minevent ) { |
417 |
printf(" %f 0 Event %i: %i\n",headco,i,oldcalev0); |
// printf(" %f 0 Event %i: %i\n",headco,i,oldcalev0); |
418 |
printf(" %f 0 Event %i: %i\n",headc,i+1,calev0); |
// printf(" %f 0 Event %i: %i\n",headc,i+1,calev0); |
419 |
printf(" %f 1 Event %i: %i\n",headco,i,oldcalev1); |
// printf(" %f 1 Event %i: %i\n",headco,i,oldcalev1); |
420 |
printf(" %f 1 Event %i: %i\n",headc,i+1,calev1); |
// printf(" %f 1 Event %i: %i\n",headc,i+1,calev1); |
421 |
printf(" %f 2 Event %i: %i\n",headco,i,oldcalev2); |
// printf(" %f 2 Event %i: %i\n",headco,i,oldcalev2); |
422 |
printf(" %f 2 Event %i: %i\n",headc,i+1,calevv2); |
// printf(" %f 2 Event %i: %i\n",headc,i+1,calevv2); |
423 |
printf(" %f 3 Event %i: %i\n",headco,i,oldcalev3); |
// printf(" %f 3 Event %i: %i\n",headco,i,oldcalev3); |
424 |
printf(" %f 3 Event %i: %i\n",headc,i+1,calev3); |
// printf(" %f 3 Event %i: %i\n",headc,i+1,calev3); |
425 |
isRAW = 0; |
isRAW = 0; |
426 |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
427 |
if ( (calev0 - oldcalev0 - 1) > 0 && !isRAW && ce->perror[0] != 129 && oldcalev0 != 0) { |
if ( (calev0 - oldcalev0 - 1) > 0 && !isRAW && ce->perror[0] != 129 && oldcalev0 != 0) { |
428 |
ver[0][10]++; |
ver[0][10]++; |
429 |
|
sighandler(headc,obt,i,0,nevents,evdone); |
430 |
|
printf(" jump in the counter calev is %i oldcalev was %i \n",calev0,oldcalev0); |
431 |
}; |
}; |
432 |
isRAW = 0; |
isRAW = 0; |
433 |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
434 |
if ( (calev1 - oldcalev1 - 1) > 0 && !isRAW && ce->perror[1] != 129 && oldcalev1 != 0 ){ |
if ( (calev1 - oldcalev1 - 1) > 0 && !isRAW && ce->perror[1] != 129 && oldcalev1 != 0 ){ |
435 |
ver[1][10]++; |
ver[1][10]++; |
436 |
|
sighandler(headc,obt,i,1,nevents,evdone); |
437 |
|
printf(" jump in the counter calev is %i oldcalev was %i \n",calev1,oldcalev1); |
438 |
}; |
}; |
439 |
isRAW = 0; |
isRAW = 0; |
440 |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
441 |
if ( (calevv2 - oldcalev2 - 1) > 0 && !isRAW && ce->perror[2] != 129 && oldcalev2 != 0 ){ |
if ( (calevv2 - oldcalev2 - 1) > 0 && !isRAW && ce->perror[2] != 129 && oldcalev2 != 0 ){ |
442 |
ver[2][10]++; |
ver[2][10]++; |
443 |
|
sighandler(headc,obt,i,2,nevents,evdone); |
444 |
|
printf(" jump in the counter calev is %i oldcalev was %i \n",calevv2,oldcalev2); |
445 |
}; |
}; |
446 |
isRAW = 0; |
isRAW = 0; |
447 |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
448 |
if ( (calev3 - oldcalev3 - 1) > 0 && !isRAW && ce->perror[3] != 129 && oldcalev3 != 0 ){ |
if ( (calev3 - oldcalev3 - 1) > 0 && !isRAW && ce->perror[3] != 129 && oldcalev3 != 0 ){ |
449 |
ver[3][10]++; |
ver[3][10]++; |
450 |
|
sighandler(headc,obt,i,3,nevents,evdone); |
451 |
|
printf(" jump in the counter calev is %i oldcalev was %i \n",calev3,oldcalev3); |
452 |
}; |
}; |
453 |
} |
}; |
454 |
}; |
}; |
455 |
jumpprintout: |
// jumpprintout: |
456 |
memcpy(shit, nullsh, sizeof(nullsh)); |
memcpy(shit, nullsh, sizeof(nullsh)); |
457 |
memcpy(rshit, nullsh, sizeof(nullsh)); |
memcpy(rshit, nullsh, sizeof(nullsh)); |
458 |
for (Int_t l = 0; l < 2; l++ ){ |
for (Int_t l = 0; l < 2; l++ ){ |
476 |
se = 1; |
se = 1; |
477 |
pl = (ii-1)/2; |
pl = (ii-1)/2; |
478 |
pdone = 0; |
pdone = 0; |
479 |
}; |
}; |
480 |
|
isCOMP = false; |
481 |
isCOMP = 0; |
isFULL = false; |
482 |
isFULL = 0; |
isRAW = false; |
483 |
isRAW = 0; |
if ( ce->stwerr[se] & (1 << 16) ) isCOMP = true; |
484 |
if ( ce->stwerr[se] & (1 << 16) ) isCOMP = 1; |
if ( ce->stwerr[se] & (1 << 17) ) isFULL = true; |
485 |
if ( ce->stwerr[se] & (1 << 17) ) isFULL = 1; |
if ( ce->stwerr[se] & (1 << 3) ) isRAW = true; |
|
if ( ce->stwerr[se] & (1 << 3) ) isRAW = 1; |
|
486 |
bl = -1; |
bl = -1; |
487 |
for (Int_t kk = 0; kk < 96 ; kk++ ){ |
for (Int_t kk = 0; kk < 96 ; kk++ ){ |
488 |
if ( kk%16 == 0 ){ |
if ( kk%16 == 0 ){ |
489 |
bdone = 0; |
bdone = 0; |
490 |
bl++; |
bl++; |
491 |
allbase = ce->base[l][ii][bl]; |
allbase = ce->base[l][ii][bl]; |
492 |
|
// alldexy=0; |
493 |
|
// alldexy2=0; |
494 |
|
// stri=0; |
495 |
|
// for (Int_t e = 0; e < 16 ; e++ ){ |
496 |
|
// stri = e + 16 * bl; |
497 |
|
// alldexy += (int)ce->dexyc[l][ii][stri]; |
498 |
|
// alldexy2 += (int)ce->dexy[l][ii][stri]; |
499 |
|
// }; |
500 |
|
}; |
501 |
|
// |
502 |
|
if ( kk == 0 ){ |
503 |
|
planebases = 0; |
504 |
alldexy=0; |
alldexy=0; |
505 |
alldexy2=0; |
alldexy2=0; |
506 |
stri=0; |
for (Int_t e = 0; e < 96 ; e++ ){ |
507 |
for (Int_t e = 0; e < 16 ; e++ ){ |
if ( e < 6 ) planebases += (int)ce->base[l][ii][e]; |
508 |
stri = e + 16 * bl; |
alldexy += (int)ce->dexyc[l][ii][e]; |
509 |
alldexy += (int)ce->dexyc[l][ii][stri]; |
alldexy2 += (int)ce->dexy[l][ii][e]; |
|
alldexy2 += (int)ce->dexy[l][ii][stri]; |
|
510 |
}; |
}; |
511 |
}; |
}; |
512 |
|
// |
513 |
if ( !isRAW ) { |
if ( !isRAW ) { |
514 |
// |
// |
515 |
if ( !pdone ){ |
if ( !pdone ){ |
516 |
if ( (ce->base[l][ii][bl]>32000 || ce->base[l][ii][bl] == 0 ) && ( alldexy > 512000 || alldexy == 0) && ce->perror[se] == 0 ) { |
// if ( (ce->base[l][ii][bl]>32000 || ce->base[l][ii][bl] == 0 ) && ( alldexy > 512000 || alldexy == 0) && ce->perror[se] == 0 ) { |
517 |
|
if ( (planebases>192000 || planebases == 0 ) && ( alldexy > 3072000 || alldexy == 0) && ce->perror[se] == 0 ) { |
518 |
pdone = 1; |
pdone = 1; |
519 |
pshit[se][pl]++ ; |
pshit[se][pl]++ ; |
520 |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ) { |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ) { |
524 |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
525 |
}; |
}; |
526 |
lver[se][2]++ ; |
lver[se][2]++ ; |
527 |
|
if ( lver[se][2] == 1000 ){ |
528 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
529 |
|
printf(" latch up (data) in DSP mode alldexy %i planebases %i \n",alldexy,planebases); |
530 |
|
printf(" WARNING TOO MANY LATCHUP ERRORS ON DATA FOR THIS SECTION \n"); |
531 |
|
printf(" THEY WILL NOT BE DISPLAYED HERE ANYMORE FOR THIS FILE! \n"); |
532 |
|
}; |
533 |
|
if ( lver[se][2] < 1000 ){ |
534 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
535 |
|
printf(" latch up (data) in DSP mode alldexy %i planebases %i \n",alldexy,planebases); |
536 |
|
}; |
537 |
}; |
}; |
538 |
} |
} |
539 |
// |
// |
540 |
if ( !bdone ){ |
if ( !bdone ){ |
541 |
Baseline->Fill(ce->base[l][ii][bl]); |
Baseline->Fill(ce->base[l][ii][bl]); |
542 |
if ( ce->base[l][ii][bl] > 2000. && ce->base[l][ii][bl] < 4500. ){ |
if ( ce->base[l][ii][bl] > 2000. && ce->base[l][ii][bl] < 5500. ){ |
543 |
inbase++; |
inbase++; |
544 |
} else { |
} else { |
545 |
outbase++; |
outbase++; |
577 |
indexyc++; |
indexyc++; |
578 |
}; |
}; |
579 |
// |
// |
580 |
if (ce->dexyc[l][ii][kk] < 0 ) ver[se][21]++ ; |
if (ce->dexyc[l][ii][kk] < 0 ){ |
581 |
|
ver[se][21]++ ; |
582 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
583 |
|
printf(" negative ADC values!! ce->dexyc[%i][%i][%i] = %f \n",l,ii,kk,ce->dexyc[l][ii][kk]); |
584 |
|
}; |
585 |
// |
// |
586 |
if ( allbase == 0. || allbase > 32000.) { |
if ( allbase == 0. || allbase > 32000.) { |
587 |
fcheck = 0; |
fcheck = 0; |
596 |
// |
// |
597 |
} else { |
} else { |
598 |
if ( !pdone ){ |
if ( !pdone ){ |
599 |
if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
if ( ( alldexy2 > 3072000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
600 |
|
// if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) |
601 |
pdone = 1; |
pdone = 1; |
602 |
pshit[se][pl]++ ; |
pshit[se][pl]++ ; |
603 |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ){ |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ){ |
607 |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
if ( obt > maxobt[se] ) maxobt[se] = obt; |
608 |
}; |
}; |
609 |
lver[se][2]++ ; |
lver[se][2]++ ; |
610 |
|
if ( lver[se][2] == 1000 ){ |
611 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
612 |
|
printf(" latch up (data) in RAW mode alldexy2 %i \n",alldexy2); |
613 |
|
printf(" WARNING TOO MANY LATCHUP ERRORS ON DATA FOR THIS SECTION \n"); |
614 |
|
printf(" THEY WILL NOT BE DISPLAYED HERE ANYMORE FOR THIS FILE! \n"); |
615 |
|
}; |
616 |
|
if ( lver[se][2] < 1000 ){ |
617 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
618 |
|
printf(" latch up (data) in RAW mode alldexy2 %i \n",alldexy2); |
619 |
|
}; |
620 |
}; |
}; |
621 |
}; |
}; |
622 |
if ( ce->dexy[l][ii][kk] > 0 && ce->dexy[l][ii][kk] < 32000 ) { |
if ( ce->dexy[l][ii][kk] > 0 && ce->dexy[l][ii][kk] < 32000 ) { |
635 |
}; |
}; |
636 |
cshit = 0; |
cshit = 0; |
637 |
for (Int_t k = 0; k < 4 ; k++ ){ |
for (Int_t k = 0; k < 4 ; k++ ){ |
638 |
isCOMP = 0; |
isCOMP = false; |
639 |
isFULL = 0; |
isFULL = false; |
640 |
if ( ce->stwerr[se] & (1 << 16) ) isCOMP = 1; |
cestw=0;// queste righe qui |
641 |
if ( ce->stwerr[se] & (1 << 17) ) isFULL = 1; |
if ( ce->stwerr[k] ) cestw = ce->stwerr[k] & cmask ;// |
642 |
|
if ( ce->stwerr[k] & (1 << 16) && !(cestw & (1 << 3)) ) isCOMP = true; |
643 |
|
if ( ce->stwerr[k] & (1 << 17) && !(cestw & (1 << 3)) ) isFULL = true; |
644 |
|
// |
645 |
if ( isCOMP ) ver[k][16]++; |
if ( isCOMP ) ver[k][16]++; |
646 |
if ( isFULL ) ver[k][17]++; |
if ( isFULL ) ver[k][17]++; |
647 |
cshit += (int)ce->calstriphit[k]; |
cshit += (int)ce->calstriphit[k]; |
|
cestw=0; |
|
|
if ( ce->stwerr[k] ) cestw = ce->stwerr[k] & cmask ; |
|
648 |
if ( cestw ){ |
if ( cestw ){ |
649 |
if ( cestw & (1 << 0) ) ver[k][6]++ ; |
if ( cestw & (1 << 0) ){ |
650 |
if ( cestw & (1 << 1) ) ver[k][5]++ ; |
ver[k][6]++ ; |
651 |
if ( cestw & (1 << 2) ) ver[k][4]++ ; |
sighandler(headc,obt,i,k,nevents,evdone); |
652 |
if ( cestw & (1 << 3) ) ver[k][3]++ ; |
printf(" CRC error (st. word) \n"); |
653 |
|
}; |
654 |
|
if ( cestw & (1 << 1) ){ |
655 |
|
ver[k][5]++ ; |
656 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
657 |
|
printf(" execution error \n"); |
658 |
|
}; |
659 |
|
if ( cestw & (1 << 2) ){ |
660 |
|
ver[k][4]++ ; |
661 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
662 |
|
printf(" CMD length error \n"); |
663 |
|
}; |
664 |
|
if ( cestw & (1 << 3) ) ver[k][3]++ ; // raw mode |
665 |
if ( cestw & (1 << 4) ){ |
if ( cestw & (1 << 4) ){ |
666 |
ver[k][2]++ ; |
ver[k][2]++ ; |
667 |
|
if ( ver[k][2] == 1000 ){ |
668 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
669 |
|
printf(" latch up alarm (st. word)\n"); |
670 |
|
printf(" WARNING TOO MANY LATCHUP ERRORS ON DATA FOR THIS SECTION \n"); |
671 |
|
printf(" THEY WILL NOT BE DISPLAYED HERE ANYMORE FOR THIS FILE! \n"); |
672 |
|
}; |
673 |
|
if ( ver[k][2] < 1000 ){ |
674 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
675 |
|
printf(" latch up alarm (st. word)\n"); |
676 |
|
}; |
677 |
lupstw[k]->Fill(obt); |
lupstw[k]->Fill(obt); |
678 |
if ( swfirstobt[k] ) swminobt[k] = obt; |
if ( swfirstobt[k] ) swminobt[k] = obt; |
679 |
if ( obt > swmaxobt[k] ) swmaxobt[k] = obt; |
if ( obt > swmaxobt[k] ) swmaxobt[k] = obt; |
680 |
}; |
}; |
681 |
if ( cestw & (1 << 5) ) ver[k][1]++ ; |
if ( cestw & (1 << 5) ){ |
682 |
if ( cestw & (1 << 6) ) ver[k][0]++ ; |
ver[k][1]++ ; |
683 |
}; |
sighandler(headc,obt,i,k,nevents,evdone); |
684 |
|
printf(" temperature alarm \n"); |
685 |
|
}; |
686 |
|
if ( cestw & (1 << 6) ){ |
687 |
|
ver[k][0]++ ; |
688 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
689 |
|
printf(" DSP ack error \n"); |
690 |
|
}; |
691 |
|
};// controllo se ci sono errori crc se perr=0 ok! |
692 |
|
if ( ce->stwerr[k] == 0 && ce->perror[k] == 0 ) ver[k][8]++ ; |
693 |
if ( ce->perror[k] != 0. ){ |
if ( ce->perror[k] != 0. ){ |
694 |
if (ce->perror[k] == 128) ver[k][7]++ ; |
if (ce->perror[k] == 128){ |
695 |
if (ce->perror[k] == 129) ver[k][8]++ ; |
ver[k][7]++ ; |
696 |
if (ce->perror[k] == 132) ver[k][11]++ ; |
sighandler(headc,obt,i,k,nevents,evdone); |
697 |
if (ce->perror[k] == 133) ver[k][12]++ ; |
printf(" view or command not recognized \n"); |
698 |
if (ce->perror[k] == 134) ver[k][13]++ ; |
}; |
699 |
if (ce->perror[k] == 135) ver[k][14]++ ; |
if (ce->perror[k] == 129){ |
700 |
if (ce->perror[k] == 136) ver[k][15]++ ; |
ver[k][8]++ ; |
701 |
if (ce->perror[k] == 139) ver[k][18]++ ; |
sighandler(headc,obt,i,k,nevents,evdone); |
702 |
if (ce->perror[k] == 140) ver[k][19]++ ; |
printf(" missing section \n"); |
703 |
if (ce->perror[k] == 141) ver[k][20]++ ; |
}; |
704 |
if (ce->perror[k] == 142) ver[k][22]++ ; |
if (ce->perror[k] == 132){ |
705 |
|
ver[k][11]++ ; |
706 |
|
if ( ver[k][11] < 30 ){ |
707 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
708 |
|
printf(" CRC error (data) \n"); |
709 |
|
}; |
710 |
|
if ( ver[k][11] == 30 ){ |
711 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
712 |
|
printf(" CRC error (data) \n"); |
713 |
|
printf(" WARNING TOO MANY CRC ERRORS ON DATA FOR THIS SECTION \n"); |
714 |
|
printf(" THEY WILL NOT BE DISPLAYED HERE ANYMORE FOR THIS FILE! \n"); |
715 |
|
}; |
716 |
|
}; |
717 |
|
if (ce->perror[k] == 133){ |
718 |
|
ver[k][12]++ ; |
719 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
720 |
|
printf(" length problems in RAW mode \n"); |
721 |
|
}; |
722 |
|
if (ce->perror[k] == 134){ |
723 |
|
ver[k][13]++ ; |
724 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
725 |
|
printf(" length problems in COMPRESS mode \n"); |
726 |
|
}; |
727 |
|
if (ce->perror[k] == 135){ |
728 |
|
ver[k][14]++ ; |
729 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
730 |
|
printf(" length problems in FULL mode \n"); |
731 |
|
}; |
732 |
|
if (ce->perror[k] == 136){ |
733 |
|
ver[k][15]++ ; |
734 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
735 |
|
printf(" acquisition mode problems \n"); |
736 |
|
}; |
737 |
|
if (ce->perror[k] == 139){ |
738 |
|
ver[k][18]++ ; |
739 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
740 |
|
printf(" problems with coding\n"); |
741 |
|
}; |
742 |
|
if (ce->perror[k] == 140){ |
743 |
|
ver[k][19]++ ; |
744 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
745 |
|
printf(" pedestal checksum wrong\n"); |
746 |
|
}; |
747 |
|
if (ce->perror[k] == 141){ |
748 |
|
ver[k][20]++ ; |
749 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
750 |
|
printf(" thresholds checksum wrong\n"); |
751 |
|
}; |
752 |
|
if (ce->perror[k] == 142){ |
753 |
|
ver[k][22]++ ; |
754 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
755 |
|
printf(" packet length is zero (YODA input error), skipped\n"); |
756 |
|
}; |
757 |
|
//aggiunto questo errore |
758 |
|
if (ce->perror[k] == 143){ |
759 |
|
ver[k][23]++ ; |
760 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
761 |
|
printf(" corrupted packet lenght \n"); |
762 |
|
}; |
763 |
}; |
}; |
764 |
for (Int_t kk = 0; kk < 11 ; kk++ ){ |
for (Int_t kk = 0; kk < 11 ; kk++ ){ |
765 |
tshit += shit[k][kk]; |
tshit += shit[k][kk]; |
766 |
trshit += rshit[k][kk]; |
trshit += rshit[k][kk]; |
767 |
}; |
}; |
768 |
}; |
}; |
769 |
Calstriphit->Fill(cshit); |
if (isCOMP || isFULL){ |
770 |
if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ |
Calstriphit->Fill(cshit); |
771 |
incshit++; |
// if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ |
772 |
} else { |
// |
773 |
outcshit++; |
//cambiata la banda di soglia ora 5 prima era 10 |
774 |
}; |
// |
775 |
if ( tshit>0 ) h1->Fill(tshit); |
if ( (cshit > 5 && cshit < 100) ){ |
776 |
if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ |
incshit++; |
777 |
intshit++; |
} else { |
778 |
} else { |
outcshit++; |
779 |
outtshit++; |
}; |
780 |
|
// |
781 |
|
if ( tshit>0 ) h1->Fill(tshit); |
782 |
|
// if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ |
783 |
|
//cambiata la soglia ora 5 prima era 10 |
784 |
|
if ( (tshit > 5 && tshit < 100) ){ |
785 |
|
intshit++; |
786 |
|
} else { |
787 |
|
outtshit++; |
788 |
|
}; |
789 |
}; |
}; |
790 |
if ( trshit>0 ) { |
if ( trshit>0 ) { |
791 |
h1r->Fill(trshit); |
h1r->Fill(trshit); |
792 |
if ( trshit < 4210 ){ |
if ( trshit < 4210 ){ |
793 |
h1rcheck = true; |
h1rout++; |
794 |
// printf("ma come... trshit %i \n",trshit); |
// printf("ma come... trshit %i \n",trshit); |
795 |
|
} else { |
796 |
|
h1rin++; |
797 |
}; |
}; |
798 |
}; |
}; |
799 |
if ( i%1000 == 0 && i > 0 ) printf("%iK\n",i/1000); |
// if ( i%1000 == 0 && i > 0 ) printf("%iK\n",i/1000); |
800 |
i++; |
i++; |
801 |
}; |
}; |
802 |
printf("\n"); |
printf("\n"); |
803 |
|
printf("\n end processing. \n\n"); |
804 |
|
if ( (float)h1rout/((float)h1rin+(float)h1rout) > h1rth ){ |
805 |
|
h1rcheck = true; |
806 |
|
}; |
807 |
// |
// |
808 |
// output figures, first sheet: |
// output figures, first sheet: |
809 |
// |
// |
869 |
h1->Draw(); |
h1->Draw(); |
870 |
// |
// |
871 |
h1max = h1->GetMaximum()*1.05; |
h1max = h1->GetMaximum()*1.05; |
872 |
Double_t xc[4] = {0.,25.,25.,0.}; |
|
873 |
|
//cambiata banda prima era 10 ora 5 |
874 |
|
Double_t xc[4] = {5.,100.,100.,5.}; |
875 |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
876 |
banda1 = new TPolyLine(4,xc,yc); |
banda1 = new TPolyLine(4,xc,yc); |
877 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
878 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
879 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
880 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
881 |
Double_t xd[4] = {40.,80.,80.,40.}; |
// Double_t xd[4] = {40.,80.,80.,40.}; |
882 |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
// Double_t yd[4] = {0.,0.,h1max,h1max}; |
883 |
banda2 = new TPolyLine(4,xd,yd); |
// banda2 = new TPolyLine(4,xd,yd); |
884 |
banda2->SetLineColor(5); |
// banda2->SetLineColor(5); |
885 |
banda2->SetFillColor(5); |
// banda2->SetFillColor(5); |
886 |
banda2->SetLineWidth(1); |
// banda2->SetLineWidth(1); |
887 |
banda2->Draw("fSAME"); |
//banda2->Draw("fSAME"); |
888 |
h1->Draw("SAME"); |
h1->Draw("SAME"); |
889 |
// |
// |
890 |
figura->cd(); |
figura->cd(); |
921 |
h1->SetYTitle("Number of events"); |
h1->SetYTitle("Number of events"); |
922 |
h1->Draw(); |
h1->Draw(); |
923 |
h1max = h1->GetMaximum()*1.05; |
h1max = h1->GetMaximum()*1.05; |
924 |
Double_t xe[4] = {0.,25.,25.,0.}; |
//cambiato banda, prima era 10,ora 5 |
925 |
|
Double_t xe[4] = {5.,100.,100.,5.}; |
926 |
Double_t ye[4] = {0.,0.,h1max,h1max}; |
Double_t ye[4] = {0.,0.,h1max,h1max}; |
927 |
banda1 = new TPolyLine(4,xe,ye); |
banda1 = new TPolyLine(4,xe,ye); |
928 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
929 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
930 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
931 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
932 |
Double_t xf[4] = {40.,80.,80.,40.}; |
// Double_t xf[4] = {40.,80.,80.,40.}; |
933 |
Double_t yf[4] = {0.,0.,h1max,h1max}; |
// Double_t yf[4] = {0.,0.,h1max,h1max}; |
934 |
banda2 = new TPolyLine(4,xf,yf); |
// banda2 = new TPolyLine(4,xf,yf); |
935 |
banda2->SetLineColor(5); |
// banda2->SetLineColor(5); |
936 |
banda2->SetFillColor(5); |
// banda2->SetFillColor(5); |
937 |
banda2->SetLineWidth(1); |
// banda2->SetLineWidth(1); |
938 |
banda2->Draw("fSAME"); |
// banda2->Draw("fSAME"); |
939 |
h1->Draw("SAME"); |
h1->Draw("SAME"); |
940 |
}; |
}; |
941 |
if ( trshit !=0 ) { |
if ( trshit !=0 ) { |
965 |
}; |
}; |
966 |
}; |
}; |
967 |
if ( !errorfull ) { |
if ( !errorfull ) { |
968 |
if ( calevn1 || calevn2 || calevn3 ) { |
if ( calevn1 > calevnth || calevn2 > calevnth || calevn3 > calevnth ) { |
969 |
pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.24,0.98,45); |
pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.24,0.98,45); |
970 |
pd2 = new TPad("pd2","This is pad2",0.26,0.51,0.49,0.98,45); |
pd2 = new TPad("pd2","This is pad2",0.26,0.51,0.49,0.98,45); |
971 |
pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.24,0.49,45); |
pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.24,0.49,45); |
1108 |
Baseline->SetYTitle("Number of events"); |
Baseline->SetYTitle("Number of events"); |
1109 |
Baseline->Draw(); |
Baseline->Draw(); |
1110 |
h1max = Baseline->GetMaximum()*1.05; |
h1max = Baseline->GetMaximum()*1.05; |
1111 |
Double_t xc[4] = {2000.,4500.,4500.,2000.}; |
Double_t xc[4] = {2000.,5500.,5500.,2000.}; |
1112 |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
1113 |
banda1 = new TPolyLine(4,xc,yc); |
banda1 = new TPolyLine(4,xc,yc); |
1114 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
1140 |
Dexyc->Draw("SAME"); |
Dexyc->Draw("SAME"); |
1141 |
// |
// |
1142 |
pd3->cd(); |
pd3->cd(); |
1143 |
|
// gPad->SetLogy(); |
1144 |
Calstriphit->SetXTitle("Number of hit"); |
Calstriphit->SetXTitle("Number of hit"); |
1145 |
Calstriphit->SetYTitle("Number of events"); |
Calstriphit->SetYTitle("Number of events"); |
1146 |
Calstriphit->Draw(); |
Calstriphit->Draw(); |
1147 |
h1max = Calstriphit->GetMaximum()*1.05; |
h1max = Calstriphit->GetMaximum()*1.05; |
1148 |
Double_t xg[4] = {0.,25.,25.,0.}; |
|
1149 |
|
//banda di sogla portata a 5, prima era a 10 |
1150 |
|
Double_t xg[4] = {5.,100.,100.,5.}; |
1151 |
Double_t yg[4] = {0.,0.,h1max,h1max}; |
Double_t yg[4] = {0.,0.,h1max,h1max}; |
1152 |
banda1 = new TPolyLine(4,xg,yg); |
banda1 = new TPolyLine(4,xg,yg); |
1153 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
1154 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
1155 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
1156 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
1157 |
Double_t xh[4] = {40.,80.,80.,40.}; |
// Double_t xh[4] = {40.,80.,80.,40.}; |
1158 |
Double_t yh[4] = {0.,0.,h1max,h1max}; |
// Double_t yh[4] = {0.,0.,h1max,h1max}; |
1159 |
banda2 = new TPolyLine(4,xh,yh); |
// banda2 = new TPolyLine(4,xh,yh); |
1160 |
banda2->SetLineColor(5); |
// banda2->SetLineColor(5); |
1161 |
banda2->SetFillColor(5); |
// banda2->SetFillColor(5); |
1162 |
banda2->SetLineWidth(1); |
// banda2->SetLineWidth(1); |
1163 |
banda2->Draw("fSAME"); |
// banda2->Draw("fSAME"); |
1164 |
Calstriphit->Draw("SAME"); |
Calstriphit->Draw("SAME"); |
1165 |
// |
// |
1166 |
pd4->cd(); |
pd4->cd(); |
1167 |
|
gPad->SetLogy(); |
1168 |
Dexy->SetXTitle("ADC channels"); |
Dexy->SetXTitle("ADC channels"); |
1169 |
Dexy->SetYTitle("Number of events"); |
Dexy->SetYTitle("Number of events"); |
1170 |
Dexy->Draw(); |
Dexy->Draw(); |
1171 |
h1max = Dexy->GetMaximum()*1.05; |
// h1max = Dexy->GetMaximum()*1.05; |
1172 |
|
h1max = Dexy->GetMaximum()*2.05; |
1173 |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
1174 |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
1175 |
banda1 = new TPolyLine(4,xd,yd); |
banda1 = new TPolyLine(4,xd,yd); |
1205 |
pd4->Draw(); |
pd4->Draw(); |
1206 |
// |
// |
1207 |
pd4->cd(); |
pd4->cd(); |
1208 |
|
gPad->SetLogy(); |
1209 |
Dexy->SetXTitle("ADC channels"); |
Dexy->SetXTitle("ADC channels"); |
1210 |
Dexy->SetYTitle("Number of events"); |
Dexy->SetYTitle("Number of events"); |
1211 |
Dexy->Draw(); |
Dexy->Draw(); |
1212 |
h1max = Dexy->GetMaximum()*1.05; |
// h1max = Dexy->GetMaximum()*1.05; |
1213 |
|
h1max = Dexy->GetMaximum()*2.05; |
1214 |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
1215 |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
1216 |
banda1 = new TPolyLine(4,xd,yd); |
banda1 = new TPolyLine(4,xd,yd); |
1276 |
pd7->Draw(); |
pd7->Draw(); |
1277 |
pd8->Draw(); |
pd8->Draw(); |
1278 |
pd1->cd(); |
pd1->cd(); |
1279 |
lup[0]->SetAxisRange((Double_t)minobt[0]*0.9,(Double_t)maxobt[0]*1.1,"X"); |
lup[0]->SetAxisRange((Double_t)min(minobt[0],swminobt[0])*0.9,(Double_t)max(maxobt[0],swmaxobt[0])*1.1,"X"); |
1280 |
|
lup[0]->SetXTitle("OBT"); |
1281 |
|
lup[0]->SetYTitle("Number of events"); |
1282 |
lup[0]->Draw(); |
lup[0]->Draw(); |
1283 |
pd5->cd(); |
pd5->cd(); |
1284 |
lupstw[0]->SetAxisRange((Double_t)swminobt[0]*0.9,(Double_t)swmaxobt[0]*1.1,"X"); |
lupstw[0]->SetAxisRange((Double_t)min(minobt[0],swminobt[0])*0.9,(Double_t)max(maxobt[0],swmaxobt[0])*1.1,"X"); |
1285 |
|
// lupstw[0]->SetAxisRange((Double_t)swminobt[0]*0.9,(Double_t)swmaxobt[0]*1.1,"X"); |
1286 |
|
lupstw[0]->SetXTitle("OBT"); |
1287 |
|
lupstw[0]->SetYTitle("Number of events"); |
1288 |
lupstw[0]->Draw(); |
lupstw[0]->Draw(); |
1289 |
pd2->cd(); |
pd2->cd(); |
1290 |
lup[1]->SetAxisRange((Double_t)minobt[1]*0.9,(Double_t)maxobt[1]*1.1,"X"); |
lup[1]->SetAxisRange((Double_t)min(minobt[1],swminobt[1])*0.9,(Double_t)max(maxobt[1],swmaxobt[1])*1.1,"X"); |
1291 |
|
// lup[1]->SetAxisRange((Double_t)minobt[1]*0.9,(Double_t)maxobt[1]*1.1,"X"); |
1292 |
|
lup[1]->SetXTitle("OBT"); |
1293 |
|
lup[1]->SetYTitle("Number of events"); |
1294 |
lup[1]->Draw(); |
lup[1]->Draw(); |
1295 |
pd6->cd(); |
pd6->cd(); |
1296 |
lupstw[1]->SetAxisRange((Double_t)swminobt[1]*0.9,(Double_t)swmaxobt[1]*1.1,"X"); |
lupstw[1]->SetAxisRange((Double_t)min(minobt[1],swminobt[1])*0.9,(Double_t)max(maxobt[1],swmaxobt[1])*1.1,"X"); |
1297 |
|
// lupstw[1]->SetAxisRange((Double_t)swminobt[1]*0.9,(Double_t)swmaxobt[1]*1.1,"X"); |
1298 |
|
lupstw[1]->SetXTitle("OBT"); |
1299 |
|
lupstw[1]->SetYTitle("Number of events"); |
1300 |
lupstw[1]->Draw(); |
lupstw[1]->Draw(); |
1301 |
pd3->cd(); |
pd3->cd(); |
1302 |
lup[2]->SetAxisRange((Double_t)minobt[2]*0.9,(Double_t)maxobt[2]*1.1,"X"); |
lup[2]->SetAxisRange((Double_t)min(minobt[2],swminobt[2])*0.9,(Double_t)max(maxobt[2],swmaxobt[2])*1.1,"X"); |
1303 |
|
// lup[2]->SetAxisRange((Double_t)minobt[2]*0.9,(Double_t)maxobt[2]*1.1,"X"); |
1304 |
|
lup[2]->SetXTitle("OBT"); |
1305 |
|
lup[2]->SetYTitle("Number of events"); |
1306 |
lup[2]->Draw(); |
lup[2]->Draw(); |
1307 |
pd7->cd(); |
pd7->cd(); |
1308 |
lupstw[2]->SetAxisRange((Double_t)swminobt[2]*0.9,(Double_t)swmaxobt[2]*1.1,"X"); |
lupstw[2]->SetAxisRange((Double_t)min(minobt[2],swminobt[2])*0.9,(Double_t)max(maxobt[2],swmaxobt[2])*1.1,"X"); |
1309 |
|
// lupstw[2]->SetAxisRange((Double_t)swminobt[2]*0.9,(Double_t)swmaxobt[2]*1.1,"X"); |
1310 |
|
lupstw[2]->SetXTitle("OBT"); |
1311 |
|
lupstw[2]->SetYTitle("Number of events"); |
1312 |
lupstw[2]->Draw(); |
lupstw[2]->Draw(); |
1313 |
pd4->cd(); |
pd4->cd(); |
1314 |
lup[3]->SetAxisRange((Double_t)minobt[3]*0.9,(Double_t)maxobt[3]*1.1,"X"); |
lup[3]->SetAxisRange((Double_t)min(minobt[3],swminobt[3])*0.9,(Double_t)max(maxobt[3],swmaxobt[3])*1.1,"X"); |
1315 |
|
// lup[3]->SetAxisRange((Double_t)minobt[3]*0.9,(Double_t)maxobt[3]*1.1,"X"); |
1316 |
|
lup[3]->SetXTitle("OBT"); |
1317 |
|
lup[3]->SetYTitle("Number of events"); |
1318 |
lup[3]->Draw(); |
lup[3]->Draw(); |
1319 |
pd8->cd(); |
pd8->cd(); |
1320 |
lupstw[3]->SetAxisRange((Double_t)swminobt[3]*0.9,(Double_t)swmaxobt[3]*1.1,"X"); |
lupstw[3]->SetAxisRange((Double_t)min(minobt[3],swminobt[3])*0.9,(Double_t)max(maxobt[3],swmaxobt[3])*1.1,"X"); |
1321 |
|
// lupstw[3]->SetAxisRange((Double_t)swminobt[3]*0.9,(Double_t)swmaxobt[3]*1.1,"X"); |
1322 |
|
lupstw[3]->SetXTitle("OBT"); |
1323 |
|
lupstw[3]->SetYTitle("Number of events"); |
1324 |
lupstw[3]->Draw(); |
lupstw[3]->Draw(); |
1325 |
}; |
}; |
1326 |
// |
// |
1354 |
pad2->Draw(); |
pad2->Draw(); |
1355 |
pad3->Draw(); |
pad3->Draw(); |
1356 |
pad4->Draw(); |
pad4->Draw(); |
1357 |
|
// |
1358 |
|
Bool_t redevent = true; |
1359 |
|
// |
1360 |
|
if ( ver[0][3]+ver[0][16]+ver[0][17]+ver[0][8] == ver[1][3]+ver[1][16]+ver[1][17]+ver[1][8] && ver[1][3]+ver[1][16]+ver[1][17]+ver[1][8] == ver[2][3]+ver[2][16]+ver[2][17]+ver[2][8] && ver[2][3]+ver[2][16]+ver[2][17]+ver[2][8] == ver[3][3]+ver[3][16]+ver[3][17]+ver[3][8] ){ |
1361 |
|
redevent = false; |
1362 |
|
}; |
1363 |
|
if ( redevent ) check = true; |
1364 |
|
// |
1365 |
for (Int_t i = 0; i < 4; i++){ |
for (Int_t i = 0; i < 4; i++){ |
1366 |
if (i == 2) |
if (i == 2) |
1367 |
{ |
{ |
1389 |
t->SetTextAlign(12); |
t->SetTextAlign(12); |
1390 |
t->DrawLatex(33.,97.,sezione); |
t->DrawLatex(33.,97.,sezione); |
1391 |
t->SetTextSize(0.05); |
t->SetTextSize(0.05); |
1392 |
for (Int_t j = 0; j < 23; j++){ |
//aggiunto un errore jmax=23 |
1393 |
|
for (Int_t j = 0; j < 24; j++){ |
1394 |
if ( ver[i][j] || lver[i][j] ) { |
if ( ver[i][j] || lver[i][j] ) { |
1395 |
t->SetTextColor(50); |
t->SetTextColor(50); |
1396 |
if (j == 0) { |
if (j == 0) { |
1449 |
errore.str(""); |
errore.str(""); |
1450 |
errore << "RAW mode: " << ver[i][j]; |
errore << "RAW mode: " << ver[i][j]; |
1451 |
errore << " time(s)"; |
errore << " time(s)"; |
1452 |
t->SetTextColor(32); |
if ( !redevent ) t->SetTextColor(32); |
1453 |
t->DrawLatex(2.,90.,errore.str().c_str()); |
t->DrawLatex(2.,90.,errore.str().c_str()); |
1454 |
} |
} |
1455 |
if (j == 4) { |
if (j == 4) { |
1485 |
errore << "Missing section: " << ver[i][j]; |
errore << "Missing section: " << ver[i][j]; |
1486 |
errore << " time(s)"; |
errore << " time(s)"; |
1487 |
t->DrawLatex(2.,50.,errore.str().c_str()); |
t->DrawLatex(2.,50.,errore.str().c_str()); |
1488 |
check = true; |
if ( ver[i][j] > 3 ) check = true; |
1489 |
} |
} |
1490 |
if (j == 10) { |
if (j == 10) { |
1491 |
errore.str(""); |
errore.str(""); |
1492 |
errore << "Calevnum jump: " << ver[i][j]; |
errore << "Calevnum jump: " << ver[i][j]; |
1493 |
errore << " time(s)"; |
errore << " time(s)"; |
1494 |
t->DrawLatex(2.,42.,errore.str().c_str()); |
t->DrawLatex(2.,42.,errore.str().c_str()); |
1495 |
check = true; |
if ( ver[i][j] > 3 ) check = true; |
1496 |
} |
} |
1497 |
if (j == 11) { |
if (j == 11) { |
1498 |
errore.str(""); |
errore.str(""); |
1499 |
errore << "CRC error (data): " << ver[i][j]; |
errore << "CRC error (data): " << ver[i][j]; |
1500 |
errore << " time(s)"; |
errore << " time(s)"; |
1501 |
t->DrawLatex(2.,38.,errore.str().c_str()); |
t->DrawLatex(2.,38.,errore.str().c_str()); |
1502 |
check = true; |
if ( ver[i][j] > 10 ) check = true; |
1503 |
} |
} |
1504 |
if (j == 12) { |
if (j == 12) { |
1505 |
errore.str(""); |
errore.str(""); |
1533 |
errore.str(""); |
errore.str(""); |
1534 |
errore << "COMPRESS mode: " << ver[i][j]; |
errore << "COMPRESS mode: " << ver[i][j]; |
1535 |
errore << " time(s)"; |
errore << " time(s)"; |
1536 |
t->SetTextColor(32); |
if ( !redevent ) t->SetTextColor(32); |
1537 |
t->DrawLatex(2.,86.,errore.str().c_str()); |
t->DrawLatex(2.,86.,errore.str().c_str()); |
1538 |
} |
} |
1539 |
if (j == 17) { |
if (j == 17) { |
1540 |
errore.str(""); |
errore.str(""); |
1541 |
errore << "FULL mode: " << ver[i][j]; |
errore << "FULL mode: " << ver[i][j]; |
1542 |
errore << " time(s)"; |
errore << " time(s)"; |
1543 |
t->SetTextColor(32); |
if ( !redevent ) t->SetTextColor(32); |
1544 |
t->DrawLatex(2.,82.,errore.str().c_str()); |
t->DrawLatex(2.,82.,errore.str().c_str()); |
1545 |
} |
} |
1546 |
if (j == 18) { |
if (j == 18) { |
1578 |
t->DrawLatex(2.,3.,errore.str().c_str()); |
t->DrawLatex(2.,3.,errore.str().c_str()); |
1579 |
check = true; |
check = true; |
1580 |
}; |
}; |
1581 |
}; |
//aggiunto questo errore |
1582 |
}; |
if (j == 23) { |
1583 |
|
errore.str(""); |
1584 |
|
errore << "Corrupted packet lenght " << ver[i][j]; |
1585 |
|
errore << " time(s) "; |
1586 |
|
t->DrawLatex(2.,2.,errore.str().c_str()); |
1587 |
|
check = true; |
1588 |
|
}; |
1589 |
|
}; |
1590 |
|
}; |
1591 |
t->SetTextColor(50); |
t->SetTextColor(50); |
1592 |
if ( fulldiff[i] !=0 ) { |
if ( fulldiff[i] !=0 ) { |
1593 |
check = true; |
check = true; |
1614 |
if ( check ){ |
if ( check ){ |
1615 |
t->SetTextColor(50); |
t->SetTextColor(50); |
1616 |
t->DrawLatex(60.,95.," WARNING, CHECK! "); |
t->DrawLatex(60.,95.," WARNING, CHECK! "); |
|
printf("cdexyc %f cdexy %f ctshit %f cbase %f \n",cdexyc,cdexy,ctshit,cbase); |
|
1617 |
} else { |
} else { |
1618 |
t->SetTextColor(32); |
t->SetTextColor(32); |
1619 |
t->DrawLatex(60.,95.," OK! "); |
t->DrawLatex(60.,95.," OK! "); |
1620 |
}; |
}; |
1621 |
|
printf("cdexyc %f cdexy %f ctshit %f cbase %f \n",cdexyc,cdexy,ctshit,cbase); |
1622 |
// |
// |
1623 |
const string fil = (const char*)filename; |
// const string fil = (const char*)filename; |
1624 |
Int_t posiz = fil.find("dw_"); |
// Int_t posiz = fil.find("dw_"); |
1625 |
if ( posiz == -1 ) posiz = fil.find("DW_"); |
// if ( posiz == -1 ) posiz = fil.find("DW_"); |
1626 |
Int_t posiz2 = posiz+13; |
// Int_t posiz2 = posiz+13; |
1627 |
TString file2; |
// TString file2; |
1628 |
stringcopy(file2,filename,posiz,posiz2); |
// stringcopy(file2,filename,posiz,posiz2); |
1629 |
// |
// |
1630 |
|
const string fil = gSystem->BaseName(filename.Data()); |
1631 |
|
Int_t posiz = fil.find(".root"); |
1632 |
|
// |
1633 |
|
TString file2; |
1634 |
|
if ( posiz == -1 ){ |
1635 |
|
file2 = gSystem->BaseName(filename.Data()); |
1636 |
|
} else { |
1637 |
|
Int_t posiz2 = 0; |
1638 |
|
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
1639 |
|
}; |
1640 |
const char *figrec = file2; |
const char *figrec = file2; |
1641 |
|
// |
1642 |
const char *outdir = outDir; |
const char *outdir = outDir; |
1643 |
stringstream figsave; |
stringstream figsave; |
1644 |
stringstream figsave1; |
stringstream figsave1; |
1647 |
if ( !strcmp(format,"ps") ) { |
if ( !strcmp(format,"ps") ) { |
1648 |
figsave.str(""); |
figsave.str(""); |
1649 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1650 |
figsave << figrec << "_qlook."; |
figsave << figrec << "_CaloQLOOK."; |
1651 |
figsave << format << "("; |
figsave << format << "("; |
1652 |
rapporto->Print(figsave.str().c_str(),"Landscape"); |
rapporto->Print(figsave.str().c_str(),"Landscape"); |
1653 |
figsave1.str(""); |
figsave1.str(""); |
1654 |
figsave1 << outdir << "/" ; |
figsave1 << outdir << "/" ; |
1655 |
figsave1 << figrec << "_qlook."; |
figsave1 << figrec << "_CaloQLOOK."; |
1656 |
figsave1 << format; |
figsave1 << format; |
1657 |
figura->Print(figsave1.str().c_str(),"Landscape"); |
figura->Print(figsave1.str().c_str(),"Landscape"); |
1658 |
figsave2.str(""); |
figsave2.str(""); |
1659 |
figsave2 << outdir << "/" ; |
figsave2 << outdir << "/" ; |
1660 |
figsave2 << figrec << "_qlook."; |
figsave2 << figrec << "_CaloQLOOK."; |
1661 |
if ( printfigure3 ){ |
if ( printfigure3 ){ |
1662 |
figsave2 << format; |
figsave2 << format; |
1663 |
figura2->Print(figsave2.str().c_str(),"Landscape"); |
figura2->Print(figsave2.str().c_str(),"Landscape"); |
1664 |
figsave2.str(""); |
figsave2.str(""); |
1665 |
figsave2 << outdir << "/" ; |
figsave2 << outdir << "/" ; |
1666 |
figsave2 << figrec << "_qlook."; |
figsave2 << figrec << "_CaloQLOOK."; |
1667 |
figsave2 << format << ")"; |
figsave2 << format << ")"; |
1668 |
figura3->Print(figsave2.str().c_str(),"Landscape"); |
figura3->Print(figsave2.str().c_str(),"Landscape"); |
1669 |
} else { |
} else { |
1673 |
} else { |
} else { |
1674 |
figsave.str(""); |
figsave.str(""); |
1675 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1676 |
figsave << figrec << "_qlook1."; |
figsave << figrec << "_CaloQLOOK1."; |
1677 |
figsave << format; |
figsave << format; |
1678 |
figura->SaveAs(figsave.str().c_str()); |
figura->SaveAs(figsave.str().c_str()); |
1679 |
figsave.str(""); |
figsave.str(""); |
1680 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1681 |
figsave << figrec << "_qlook2."; |
figsave << figrec << "_CaloQLOOK2."; |
1682 |
figsave << format; |
figsave << format; |
1683 |
figura2->SaveAs(figsave.str().c_str()); |
figura2->SaveAs(figsave.str().c_str()); |
1684 |
if ( printfigure3 ){ |
if ( printfigure3 ){ |
1685 |
figsave.str(""); |
figsave.str(""); |
1686 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1687 |
figsave << figrec << "_qlook2bis."; |
figsave << figrec << "_CaloQLOOK2bis."; |
1688 |
figsave << format; |
figsave << format; |
1689 |
figura3->SaveAs(figsave.str().c_str()); |
figura3->SaveAs(figsave.str().c_str()); |
1690 |
}; |
}; |
1691 |
figsave.str(""); |
figsave.str(""); |
1692 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1693 |
figsave << figrec << "_qlook3."; |
figsave << figrec << "_CaloQLOOK3."; |
1694 |
figsave << format; |
figsave << format; |
1695 |
rapporto->SaveAs(figsave.str().c_str()); |
rapporto->SaveAs(figsave.str().c_str()); |
1696 |
}; |
}; |
1697 |
|
if ( iactive && w4i ){ |
1698 |
|
while ( gROOT->GetListOfCanvases()->FindObject(rapporto) || gROOT->GetListOfCanvases()->FindObject(figura3) || gROOT->GetListOfCanvases()->FindObject(figura2) || gROOT->GetListOfCanvases()->FindObject(figura) ){ |
1699 |
|
gSystem->ProcessEvents(); |
1700 |
|
gSystem->Sleep(10); |
1701 |
|
}; |
1702 |
|
}; |
1703 |
} |
} |
|
|
|