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.01 (2006-02-28) |
// FCaloQLOOK.c version 1.13 (2006-09-28) |
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.12 - 1.13 (2006-09-28): Give wrong number of events in compress mode, fixed. |
11 |
|
// |
12 |
|
// 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. |
13 |
|
// |
14 |
|
// 1.09 - 1.11 (2006-07-17): Adapted to flight conditions. |
15 |
|
// |
16 |
|
// 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. |
17 |
|
// |
18 |
|
// 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 |
19 |
|
// case of latchup alarm. |
20 |
|
// |
21 |
|
// 1.05 - 1.06 (2006-03-22): Add optimize flag in compiling the script! |
22 |
|
// |
23 |
|
// 1.04 - 1.05 (2006-03-22): Corrected wrong .C files. |
24 |
|
// |
25 |
|
// 1.03 - 1.04 (2006-03-20): Documentation updated. |
26 |
|
// |
27 |
|
// 1.02 - 1.03 (2006-03-20): Changed name of shared libraries (from FCaloQLOOK_cxx.so to libFCaloQLOOK.so). |
28 |
|
// |
29 |
|
// 1.01 - 1.02 (2006-03-13): Include files from YODA without "event" directory. |
30 |
|
// |
31 |
// 1.00 - 1.01 (2006-02-28): Works on YODA v6 output (single file), does not require anymore calocommon package. |
// 1.00 - 1.01 (2006-02-28): Works on YODA v6 output (single file), does not require anymore calocommon package. |
32 |
// |
// |
33 |
// 0.00 - 1.00 (2006-02-28): Clone of CaloQLOOK.c (ground software). |
// 0.00 - 1.00 (2006-02-28): Clone of CaloQLOOK.c (ground software). |
46 |
#include <TPad.h> |
#include <TPad.h> |
47 |
#include <TPolyLine.h> |
#include <TPolyLine.h> |
48 |
#include <TStyle.h> |
#include <TStyle.h> |
49 |
|
#include <TSystem.h> |
50 |
|
#include <TApplication.h> |
51 |
// |
// |
52 |
#include <event/PamelaRun.h> |
#include <PamelaRun.h> |
53 |
#include <event/physics/calorimeter/CalorimeterEvent.h> |
#include <physics/calorimeter/CalorimeterEvent.h> |
54 |
// |
// |
55 |
#include <FCaloQLOOKfun.h> |
#include <FCaloQLOOKfun.h> |
56 |
// |
// |
74 |
} |
} |
75 |
|
|
76 |
TString getFilename(const TString filename){ |
TString getFilename(const TString filename){ |
77 |
const string fil = (const char*)filename; |
// |
78 |
Int_t posiz = fil.find("dw_"); |
const string fil = gSystem->BaseName(filename.Data()); |
79 |
if ( posiz == -1 ) posiz = fil.find("DW_"); |
Int_t posiz = fil.find(".root"); |
80 |
if ( posiz == -1 ) return 0; |
// |
|
Int_t posiz2 = posiz+13; |
|
81 |
TString file2; |
TString file2; |
82 |
stringcopy(file2,filename,posiz,posiz2); |
if ( posiz == -1 ){ |
83 |
TString pdat(".dat"); |
file2 = gSystem->BaseName(filename.Data()); |
84 |
stringappend(file2,pdat); |
} else { |
85 |
|
Int_t posiz2 = 0; |
86 |
|
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
87 |
|
TString pdat(".dat"); |
88 |
|
stringappend(file2,pdat); |
89 |
|
}; |
90 |
return file2; |
return file2; |
91 |
} |
} |
92 |
|
|
93 |
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){ |
94 |
|
if ( !evdone ){ |
95 |
|
printf("\n\n=================================================\n"); |
96 |
|
printf("PSCU-Pkt N. %u - OBT %u ms\n",pkt_num,obt); |
97 |
|
printf("Total events %u\n",totev); |
98 |
|
printf("(ROOT-tree entry %u )\n",entry); |
99 |
|
printf("=================================================\n"); |
100 |
|
evdone = true; |
101 |
|
}; |
102 |
|
TString sec = "UNKNOWN"; |
103 |
|
if ( section == 0 ) sec = "XE"; |
104 |
|
if ( section == 1 ) sec = "XO"; |
105 |
|
if ( section == 2 ) sec = "YE"; |
106 |
|
if ( section == 3 ) sec = "YO"; |
107 |
|
printf(" Section %s (DSP n. %i) message: ",sec.Data(),section); |
108 |
|
}; |
109 |
|
|
110 |
|
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){ |
111 |
gStyle->SetPaperSize(19.,25.); |
gStyle->SetPaperSize(19.,25.); |
112 |
const char* startingdir = gSystem->WorkingDirectory(); |
const char* startingdir = gSystem->WorkingDirectory(); |
113 |
|
// printf(" basename is %s \n",gSystem->BaseName(filename.Data())); |
114 |
|
// printf(" getfilename is %s \n",getFilename(filename).Data()); |
115 |
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
116 |
// |
// |
117 |
|
TApplication *app = 0; |
118 |
|
if ( iactive ) app = new TApplication("app",0,0); |
119 |
// |
// |
120 |
ifstream myfile; |
ifstream myfile; |
121 |
myfile.open(filename.Data()); |
myfile.open(filename.Data()); |
122 |
if ( !myfile ){ |
if ( !myfile ){ |
123 |
printf(" No such file, exiting...\n"); |
printf(" %s :no such file, exiting...\n\n",filename.Data()); |
124 |
return; |
return; |
125 |
}; |
}; |
126 |
myfile.close(); |
myfile.close(); |
127 |
// |
// |
128 |
TFile *File = new TFile(filename.Data()); |
TFile *File = new TFile(filename.Data()); |
129 |
TTree *tr = (TTree*)File->Get("Physics"); |
TTree *tr = (TTree*)File->Get("Physics"); |
130 |
|
if ( !tr ) { |
131 |
|
printf(" Physics : no such tree in %s \n",filename.Data()); |
132 |
|
printf(" Exiting, are you sure this is a LEVEL0 not corrupted file? \n\n"); |
133 |
|
return; |
134 |
|
}; |
135 |
// |
// |
136 |
// Define variables |
// Define variables |
137 |
// |
// |
138 |
Float_t ctshitthr = 0.65; |
Float_t ctshitthr = 0.65; |
139 |
Float_t cbasethr = 0.95; |
Float_t cbasethr = 0.95; |
140 |
Float_t cdexythr = 0.995; |
Float_t cdexythr = 0.995; |
141 |
|
//Float_t cdexythr = 0.90; |
142 |
Float_t cdexycthr = 0.95; |
Float_t cdexycthr = 0.95; |
143 |
|
Float_t h1rth = 0.90; |
144 |
|
Int_t calevnth = 13; |
145 |
// |
// |
146 |
pamela::calorimeter::CalorimeterEvent *ce = 0; |
pamela::calorimeter::CalorimeterEvent *ce = 0; |
147 |
pamela::EventHeader *eh = 0; |
pamela::EventHeader *eh = 0; |
216 |
TH1F *calev01; |
TH1F *calev01; |
217 |
TH1F *calev23; |
TH1F *calev23; |
218 |
TH1F *calev03; |
TH1F *calev03; |
219 |
|
TH1F *lupstw[4]; |
220 |
|
TH1F *lup[4]; |
221 |
TH2D *calev2; |
TH2D *calev2; |
222 |
|
|
223 |
h1 = new TH1F("C7","Strips hit, compress mode",100,0.,200.); |
h1 = new TH1F("C7","Strips hit, compress mode",100,0.,200.); |
227 |
hdiff->SetBit(TH1F::kCanRebin); |
hdiff->SetBit(TH1F::kCanRebin); |
228 |
Baseline = new TH1F("C9","baselines",100,0,3); |
Baseline = new TH1F("C9","baselines",100,0,3); |
229 |
Baseline->SetBit(TH1F::kCanRebin); |
Baseline->SetBit(TH1F::kCanRebin); |
230 |
Dexy = new TH1F("C12","dexy",100,0.,37000.); |
Dexy = new TH1F("C12","dexy",100,0.,10000.); |
231 |
Dexyc = new TH1F("C10","dexyc",100,0,3); |
Dexy->SetBit(TH1F::kCanRebin); |
232 |
Dexyc->SetBit(TH1F::kCanRebin); |
Dexyc = new TH1F("C10","dexyc",100,-100.,37000.); |
233 |
|
// Dexyc->SetBit(TH1F::kCanRebin); |
234 |
Calstriphit = new TH1F("C11","calstriphit[1:4]",100,0.,200.); |
Calstriphit = new TH1F("C11","calstriphit[1:4]",100,0.,200.); |
235 |
|
|
236 |
calev01 = new TH1F("C3","|calevnum(1)-calevnum(2)|",100,0,1); |
calev01 = new TH1F("C3","|calevnum(1)-calevnum(2)|",100,0,1); |
241 |
calev03->SetBit(TH1F::kCanRebin); |
calev03->SetBit(TH1F::kCanRebin); |
242 |
calev2 = new TH2D("C2","calevnum(2)%iev",3000,0.,2.,100,0.,2.); |
calev2 = new TH2D("C2","calevnum(2)%iev",3000,0.,2.,100,0.,2.); |
243 |
calev2->SetBit(TH2D::kCanRebin); |
calev2->SetBit(TH2D::kCanRebin); |
244 |
|
|
245 |
|
stringstream oss; |
246 |
|
stringstream noss; |
247 |
|
for ( Int_t i=0; i<4; i++){ |
248 |
|
oss.str(""); |
249 |
|
oss << "OBT stw latch up section " << i; |
250 |
|
noss.str(""); |
251 |
|
noss << "C" << 21+i; |
252 |
|
lupstw[i] = new TH1F(noss.str().c_str(),oss.str().c_str(),100,-1,1); |
253 |
|
lupstw[i]->SetBit(TH1F::kCanRebin); |
254 |
|
oss.str(""); |
255 |
|
oss << "OBT no stw latch up section " << i; |
256 |
|
noss.str(""); |
257 |
|
noss << "C" << 25+i; |
258 |
|
lup[i] = new TH1F(noss.str().c_str(),oss.str().c_str(),100,-1,1); |
259 |
|
lup[i]->SetBit(TH1F::kCanRebin); |
260 |
|
}; |
261 |
|
|
262 |
// |
// |
263 |
// run over each event and take out some variables |
// run over each event and take out some variables |
264 |
// |
// |
306 |
Int_t pdone, bdone; |
Int_t pdone, bdone; |
307 |
pdone = 0; |
pdone = 0; |
308 |
bdone = 0; |
bdone = 0; |
309 |
bool isCOMP = 0; |
bool isCOMP = false; |
310 |
bool isFULL = 0; |
bool isFULL = false; |
311 |
bool isRAW = 0; |
bool isRAW = false; |
312 |
Int_t alldexy=0; |
Int_t alldexy=0; |
313 |
Int_t alldexy2=0; |
Int_t alldexy2=0; |
314 |
Int_t stri=0; |
Int_t planebases=0; |
315 |
|
// Int_t stri=0; |
316 |
Int_t fcheck = 0; |
Int_t fcheck = 0; |
317 |
Int_t cestw=0; |
Int_t cestw=0; |
318 |
Int_t cmask = 127 ; |
Int_t cmask = 127 ; |
327 |
fulldiff[1] = 0; |
fulldiff[1] = 0; |
328 |
fulldiff[2] = 0; |
fulldiff[2] = 0; |
329 |
fulldiff[3] = 0; |
fulldiff[3] = 0; |
330 |
printf("\n Processed events: \n\n"); |
// printf("\n Processed events: \n\n"); |
331 |
|
printf("\n Start processing: \n\n"); |
332 |
unsigned short int calev0=0; |
unsigned short int calev0=0; |
333 |
unsigned short int oldcalev0; |
unsigned short int oldcalev0; |
334 |
unsigned short int calev1=0; |
unsigned short int calev1=0; |
338 |
unsigned short int calev3=0; |
unsigned short int calev3=0; |
339 |
unsigned short int oldcalev3; |
unsigned short int oldcalev3; |
340 |
Int_t i = minevent; |
Int_t i = minevent; |
341 |
Float_t headc = 0.; |
UInt_t headc = 0; |
342 |
Float_t headco = 0.; |
UInt_t headco = 0; |
343 |
Bool_t h1rcheck = false; |
Bool_t h1rcheck = false; |
344 |
|
Int_t h1rin = 0; |
345 |
|
Int_t h1rout = 0; |
346 |
Int_t intshit = 0; |
Int_t intshit = 0; |
347 |
Int_t outtshit = 0; |
Int_t outtshit = 0; |
348 |
Int_t incshit = 0; |
Int_t incshit = 0; |
353 |
Int_t outdexy = 0; |
Int_t outdexy = 0; |
354 |
Int_t indexyc = 0; |
Int_t indexyc = 0; |
355 |
Int_t outdexyc = 0; |
Int_t outdexyc = 0; |
356 |
|
UInt_t obt = 0; |
357 |
|
UInt_t minobt[4]; |
358 |
|
UInt_t maxobt[4]; |
359 |
|
UInt_t swminobt[4]; |
360 |
|
UInt_t swmaxobt[4]; |
361 |
|
Bool_t firstobt[4]; |
362 |
|
Bool_t swfirstobt[4]; |
363 |
|
for ( Int_t i = 0; i<4; i++){ |
364 |
|
minobt[i] = 0; |
365 |
|
maxobt[i] = 0; |
366 |
|
swminobt[i] = 0; |
367 |
|
swmaxobt[i] = 0; |
368 |
|
firstobt[i] = true; |
369 |
|
swfirstobt[i] = true; |
370 |
|
}; |
371 |
|
Bool_t evdone = false; |
372 |
|
// |
373 |
while ( i < maxevent+1){ |
while ( i < maxevent+1){ |
374 |
|
evdone = false; |
375 |
tshit = 0; |
tshit = 0; |
376 |
trshit = 0; |
trshit = 0; |
377 |
tr->GetEntry(i); |
tr->GetEntry(i); |
380 |
ph = eh->GetPscuHeader(); |
ph = eh->GetPscuHeader(); |
381 |
headco = headc; |
headco = headc; |
382 |
headc = ph->GetCounter(); |
headc = ph->GetCounter(); |
383 |
calevn1 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])); |
obt = ph->GetOrbitalTime(); |
384 |
calevn2 += (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])); |
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])) ) calevn1++; |
385 |
calevn3 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])); |
if ( (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])) ) calevn2++; |
386 |
|
if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])) ) calevn3++; |
387 |
calev01->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[1]))); |
calev01->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[1]))); |
388 |
calev23->Fill(abs((int)(ce->calevnum[2]-ce->calevnum[3]))); |
calev23->Fill(abs((int)(ce->calevnum[2]-ce->calevnum[3]))); |
389 |
calev03->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[3]))); |
calev03->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[3]))); |
398 |
calevv2 = (int)ce->calevnum[2]; |
calevv2 = (int)ce->calevnum[2]; |
399 |
oldcalev3 = calev3; |
oldcalev3 = calev3; |
400 |
calev3 = (int)ce->calevnum[3]; |
calev3 = (int)ce->calevnum[3]; |
401 |
goto jumpprintout; |
// goto jumpprintout; |
402 |
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) ){ |
403 |
if ( i != minevent ) { |
if ( i != minevent ) { |
404 |
printf(" %f 0 Event %i: %i\n",headco,i,oldcalev0); |
// printf(" %f 0 Event %i: %i\n",headco,i,oldcalev0); |
405 |
printf(" %f 0 Event %i: %i\n",headc,i+1,calev0); |
// printf(" %f 0 Event %i: %i\n",headc,i+1,calev0); |
406 |
printf(" %f 1 Event %i: %i\n",headco,i,oldcalev1); |
// printf(" %f 1 Event %i: %i\n",headco,i,oldcalev1); |
407 |
printf(" %f 1 Event %i: %i\n",headc,i+1,calev1); |
// printf(" %f 1 Event %i: %i\n",headc,i+1,calev1); |
408 |
printf(" %f 2 Event %i: %i\n",headco,i,oldcalev2); |
// printf(" %f 2 Event %i: %i\n",headco,i,oldcalev2); |
409 |
printf(" %f 2 Event %i: %i\n",headc,i+1,calevv2); |
// printf(" %f 2 Event %i: %i\n",headc,i+1,calevv2); |
410 |
printf(" %f 3 Event %i: %i\n",headco,i,oldcalev3); |
// printf(" %f 3 Event %i: %i\n",headco,i,oldcalev3); |
411 |
printf(" %f 3 Event %i: %i\n",headc,i+1,calev3); |
// printf(" %f 3 Event %i: %i\n",headc,i+1,calev3); |
412 |
isRAW = 0; |
isRAW = 0; |
413 |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
414 |
if ( (calev0 - oldcalev0 - 1) > 0 && !isRAW && ce->perror[0] != 129 && oldcalev0 != 0) { |
if ( (calev0 - oldcalev0 - 1) > 0 && !isRAW && ce->perror[0] != 129 && oldcalev0 != 0) { |
415 |
ver[0][10]++; |
ver[0][10]++; |
416 |
|
sighandler(headc,obt,i,0,nevents,evdone); |
417 |
|
printf(" jump in the counter calev is %i oldcalev was %i \n",calev0,oldcalev0); |
418 |
}; |
}; |
419 |
isRAW = 0; |
isRAW = 0; |
420 |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
421 |
if ( (calev1 - oldcalev1 - 1) > 0 && !isRAW && ce->perror[1] != 129 && oldcalev1 != 0 ){ |
if ( (calev1 - oldcalev1 - 1) > 0 && !isRAW && ce->perror[1] != 129 && oldcalev1 != 0 ){ |
422 |
ver[1][10]++; |
ver[1][10]++; |
423 |
|
sighandler(headc,obt,i,1,nevents,evdone); |
424 |
|
printf(" jump in the counter calev is %i oldcalev was %i \n",calev1,oldcalev1); |
425 |
}; |
}; |
426 |
isRAW = 0; |
isRAW = 0; |
427 |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
428 |
if ( (calevv2 - oldcalev2 - 1) > 0 && !isRAW && ce->perror[2] != 129 && oldcalev2 != 0 ){ |
if ( (calevv2 - oldcalev2 - 1) > 0 && !isRAW && ce->perror[2] != 129 && oldcalev2 != 0 ){ |
429 |
ver[2][10]++; |
ver[2][10]++; |
430 |
|
sighandler(headc,obt,i,2,nevents,evdone); |
431 |
|
printf(" jump in the counter calev is %i oldcalev was %i \n",calevv2,oldcalev2); |
432 |
}; |
}; |
433 |
isRAW = 0; |
isRAW = 0; |
434 |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
if ( ce->stwerr[0] & (1 << 3)) isRAW = 1; |
435 |
if ( (calev3 - oldcalev3 - 1) > 0 && !isRAW && ce->perror[3] != 129 && oldcalev3 != 0 ){ |
if ( (calev3 - oldcalev3 - 1) > 0 && !isRAW && ce->perror[3] != 129 && oldcalev3 != 0 ){ |
436 |
ver[3][10]++; |
ver[3][10]++; |
437 |
|
sighandler(headc,obt,i,3,nevents,evdone); |
438 |
|
printf(" jump in the counter calev is %i oldcalev was %i \n",calev3,oldcalev3); |
439 |
}; |
}; |
440 |
} |
} |
441 |
}; |
}; |
442 |
jumpprintout: |
// jumpprintout: |
443 |
memcpy(shit, nullsh, sizeof(nullsh)); |
memcpy(shit, nullsh, sizeof(nullsh)); |
444 |
memcpy(rshit, nullsh, sizeof(nullsh)); |
memcpy(rshit, nullsh, sizeof(nullsh)); |
445 |
for (Int_t l = 0; l < 2; l++ ){ |
for (Int_t l = 0; l < 2; l++ ){ |
463 |
se = 1; |
se = 1; |
464 |
pl = (ii-1)/2; |
pl = (ii-1)/2; |
465 |
pdone = 0; |
pdone = 0; |
466 |
}; |
}; |
467 |
|
isCOMP = false; |
468 |
isCOMP = 0; |
isFULL = false; |
469 |
isFULL = 0; |
isRAW = false; |
470 |
isRAW = 0; |
if ( ce->stwerr[se] & (1 << 16) ) isCOMP = true; |
471 |
if ( ce->stwerr[se] & (1 << 16) ) isCOMP = 1; |
if ( ce->stwerr[se] & (1 << 17) ) isFULL = true; |
472 |
if ( ce->stwerr[se] & (1 << 17) ) isFULL = 1; |
if ( ce->stwerr[se] & (1 << 3) ) isRAW = true; |
|
if ( ce->stwerr[se] & (1 << 3) ) isRAW = 1; |
|
473 |
bl = -1; |
bl = -1; |
474 |
for (Int_t kk = 0; kk < 96 ; kk++ ){ |
for (Int_t kk = 0; kk < 96 ; kk++ ){ |
475 |
if ( kk%16 == 0 ){ |
if ( kk%16 == 0 ){ |
476 |
bdone = 0; |
bdone = 0; |
477 |
bl++; |
bl++; |
478 |
allbase = ce->base[l][ii][bl]; |
allbase = ce->base[l][ii][bl]; |
479 |
|
// alldexy=0; |
480 |
|
// alldexy2=0; |
481 |
|
// stri=0; |
482 |
|
// for (Int_t e = 0; e < 16 ; e++ ){ |
483 |
|
// stri = e + 16 * bl; |
484 |
|
// alldexy += (int)ce->dexyc[l][ii][stri]; |
485 |
|
// alldexy2 += (int)ce->dexy[l][ii][stri]; |
486 |
|
// }; |
487 |
|
}; |
488 |
|
// |
489 |
|
if ( kk == 0 ){ |
490 |
|
planebases = 0; |
491 |
alldexy=0; |
alldexy=0; |
492 |
alldexy2=0; |
alldexy2=0; |
493 |
stri=0; |
for (Int_t e = 0; e < 96 ; e++ ){ |
494 |
for (Int_t e = 0; e < 16 ; e++ ){ |
if ( e < 6 ) planebases += (int)ce->base[l][ii][e]; |
495 |
stri = e + 16 * bl; |
alldexy += (int)ce->dexyc[l][ii][e]; |
496 |
alldexy += (int)ce->dexyc[l][ii][stri]; |
alldexy2 += (int)ce->dexy[l][ii][e]; |
|
alldexy2 += (int)ce->dexy[l][ii][stri]; |
|
497 |
}; |
}; |
498 |
}; |
}; |
499 |
|
// |
500 |
if ( !isRAW ) { |
if ( !isRAW ) { |
501 |
// |
// |
502 |
if ( !pdone ){ |
if ( !pdone ){ |
503 |
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 ) { |
504 |
|
if ( (planebases>192000 || planebases == 0 ) && ( alldexy > 3072000 || alldexy == 0) && ce->perror[se] == 0 ) { |
505 |
pdone = 1; |
pdone = 1; |
506 |
pshit[se][pl]++ ; |
pshit[se][pl]++ ; |
507 |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ) lalarm[se]++; |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ) { |
508 |
lver[se][2]++ ; |
lalarm[se]++; |
509 |
|
lup[se]->Fill(obt); |
510 |
|
if ( firstobt[se] ) minobt[se] = obt; |
511 |
|
if ( obt > maxobt[se] ) maxobt[se] = obt; |
512 |
|
}; |
513 |
|
lver[se][2]++ ; |
514 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
515 |
|
printf(" latch up (data) in DSP mode alldexy %i planebases %i \n",alldexy,planebases); |
516 |
}; |
}; |
517 |
} |
} |
518 |
// |
// |
556 |
indexyc++; |
indexyc++; |
557 |
}; |
}; |
558 |
// |
// |
559 |
if (ce->dexyc[l][ii][kk] < 0 ) ver[se][21]++ ; |
if (ce->dexyc[l][ii][kk] < 0 ){ |
560 |
|
ver[se][21]++ ; |
561 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
562 |
|
printf(" negative ADC values!! ce->dexyc[%i][%i][%i] = %f \n",l,ii,kk,ce->dexyc[l][ii][kk]); |
563 |
|
}; |
564 |
// |
// |
565 |
if ( allbase == 0. || allbase > 32000.) { |
if ( allbase == 0. || allbase > 32000.) { |
566 |
fcheck = 0; |
fcheck = 0; |
575 |
// |
// |
576 |
} else { |
} else { |
577 |
if ( !pdone ){ |
if ( !pdone ){ |
578 |
if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
if ( ( alldexy2 > 3072000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
579 |
|
// if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) { |
580 |
pdone = 1; |
pdone = 1; |
581 |
pshit[se][pl]++ ; |
pshit[se][pl]++ ; |
582 |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ) lalarm[se]++; |
if ( (ce->stwerr[se] & (1 << 4)) == 0 ){ |
583 |
|
lalarm[se]++; |
584 |
|
lup[se]->Fill(obt); |
585 |
|
if ( firstobt[se] ) minobt[se] = obt; |
586 |
|
if ( obt > maxobt[se] ) maxobt[se] = obt; |
587 |
|
}; |
588 |
lver[se][2]++ ; |
lver[se][2]++ ; |
589 |
|
sighandler(headc,obt,i,se,nevents,evdone); |
590 |
|
printf(" latch up (data) in RAW mode alldexy2 %i \n",alldexy2); |
591 |
}; |
}; |
592 |
}; |
}; |
593 |
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 ) { |
606 |
}; |
}; |
607 |
cshit = 0; |
cshit = 0; |
608 |
for (Int_t k = 0; k < 4 ; k++ ){ |
for (Int_t k = 0; k < 4 ; k++ ){ |
609 |
isCOMP = 0; |
isCOMP = false; |
610 |
isFULL = 0; |
isFULL = false; |
611 |
if ( ce->stwerr[se] & (1 << 16) ) isCOMP = 1; |
cestw=0; |
612 |
if ( ce->stwerr[se] & (1 << 17) ) isFULL = 1; |
if ( ce->stwerr[k] ) cestw = ce->stwerr[k] & cmask ; |
613 |
|
if ( ce->stwerr[k] & (1 << 16) && !(cestw & (1 << 3)) ) isCOMP = true; |
614 |
|
if ( ce->stwerr[k] & (1 << 17) && !(cestw & (1 << 3)) ) isFULL = true; |
615 |
|
// |
616 |
if ( isCOMP ) ver[k][16]++; |
if ( isCOMP ) ver[k][16]++; |
617 |
if ( isFULL ) ver[k][17]++; |
if ( isFULL ) ver[k][17]++; |
618 |
cshit += (int)ce->calstriphit[k]; |
cshit += (int)ce->calstriphit[k]; |
|
cestw=0; |
|
|
if ( ce->stwerr[k] ) cestw = ce->stwerr[k] & cmask ; |
|
619 |
if ( cestw ){ |
if ( cestw ){ |
620 |
if ( cestw & (1 << 0) ) ver[k][6]++ ; |
if ( cestw & (1 << 0) ){ |
621 |
if ( cestw & (1 << 1) ) ver[k][5]++ ; |
ver[k][6]++ ; |
622 |
if ( cestw & (1 << 2) ) ver[k][4]++ ; |
sighandler(headc,obt,i,k,nevents,evdone); |
623 |
if ( cestw & (1 << 3) ) ver[k][3]++ ; |
printf(" CRC error (st. word) \n"); |
624 |
if ( cestw & (1 << 4) ) ver[k][2]++ ; |
}; |
625 |
if ( cestw & (1 << 5) ) ver[k][1]++ ; |
if ( cestw & (1 << 1) ){ |
626 |
if ( cestw & (1 << 6) ) ver[k][0]++ ; |
ver[k][5]++ ; |
627 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
628 |
|
printf(" execution error \n"); |
629 |
|
}; |
630 |
|
if ( cestw & (1 << 2) ){ |
631 |
|
ver[k][4]++ ; |
632 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
633 |
|
printf(" CMD length error \n"); |
634 |
|
}; |
635 |
|
if ( cestw & (1 << 3) ) ver[k][3]++ ; // raw mode |
636 |
|
if ( cestw & (1 << 4) ){ |
637 |
|
ver[k][2]++ ; |
638 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
639 |
|
printf(" latch up alarm (st. word)\n"); |
640 |
|
lupstw[k]->Fill(obt); |
641 |
|
if ( swfirstobt[k] ) swminobt[k] = obt; |
642 |
|
if ( obt > swmaxobt[k] ) swmaxobt[k] = obt; |
643 |
|
}; |
644 |
|
if ( cestw & (1 << 5) ){ |
645 |
|
ver[k][1]++ ; |
646 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
647 |
|
printf(" temperature alarm \n"); |
648 |
|
}; |
649 |
|
if ( cestw & (1 << 6) ){ |
650 |
|
ver[k][0]++ ; |
651 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
652 |
|
printf(" DSP ack error \n"); |
653 |
|
}; |
654 |
}; |
}; |
655 |
|
if ( ce->stwerr[k] == 0 && ce->perror[k] == 0 ) ver[k][8]++ ; |
656 |
if ( ce->perror[k] != 0. ){ |
if ( ce->perror[k] != 0. ){ |
657 |
if (ce->perror[k] == 128) ver[k][7]++ ; |
if (ce->perror[k] == 128){ |
658 |
if (ce->perror[k] == 129) ver[k][8]++ ; |
ver[k][7]++ ; |
659 |
if (ce->perror[k] == 132) ver[k][11]++ ; |
sighandler(headc,obt,i,k,nevents,evdone); |
660 |
if (ce->perror[k] == 133) ver[k][12]++ ; |
printf(" view or command not recognized \n"); |
661 |
if (ce->perror[k] == 134) ver[k][13]++ ; |
}; |
662 |
if (ce->perror[k] == 135) ver[k][14]++ ; |
if (ce->perror[k] == 129){ |
663 |
if (ce->perror[k] == 136) ver[k][15]++ ; |
ver[k][8]++ ; |
664 |
if (ce->perror[k] == 139) ver[k][18]++ ; |
sighandler(headc,obt,i,k,nevents,evdone); |
665 |
if (ce->perror[k] == 140) ver[k][19]++ ; |
printf(" missing section \n"); |
666 |
if (ce->perror[k] == 141) ver[k][20]++ ; |
}; |
667 |
if (ce->perror[k] == 142) ver[k][22]++ ; |
if (ce->perror[k] == 132){ |
668 |
|
ver[k][11]++ ; |
669 |
|
if ( ver[k][11] < 30 ){ |
670 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
671 |
|
printf(" CRC error (data) \n"); |
672 |
|
}; |
673 |
|
if ( ver[k][11] == 30 ){ |
674 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
675 |
|
printf(" CRC error (data) \n"); |
676 |
|
printf(" WARNING TOO MANY CRC ERRORS ON DATA FOR THIS SECTION \n"); |
677 |
|
printf(" THEY WILL NOT BE DISPLAYED HERE ANYMORE FOR THIS FILE! \n"); |
678 |
|
}; |
679 |
|
}; |
680 |
|
if (ce->perror[k] == 133){ |
681 |
|
ver[k][12]++ ; |
682 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
683 |
|
printf(" length problems in RAW mode \n"); |
684 |
|
}; |
685 |
|
if (ce->perror[k] == 134){ |
686 |
|
ver[k][13]++ ; |
687 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
688 |
|
printf(" length problems in COMPRESS mode \n"); |
689 |
|
}; |
690 |
|
if (ce->perror[k] == 135){ |
691 |
|
ver[k][14]++ ; |
692 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
693 |
|
printf(" length problems in FULL mode \n"); |
694 |
|
}; |
695 |
|
if (ce->perror[k] == 136){ |
696 |
|
ver[k][15]++ ; |
697 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
698 |
|
printf(" acquisition mode problems \n"); |
699 |
|
}; |
700 |
|
if (ce->perror[k] == 139){ |
701 |
|
ver[k][18]++ ; |
702 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
703 |
|
printf(" problems with coding\n"); |
704 |
|
}; |
705 |
|
if (ce->perror[k] == 140){ |
706 |
|
ver[k][19]++ ; |
707 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
708 |
|
printf(" pedestal checksum wrong\n"); |
709 |
|
}; |
710 |
|
if (ce->perror[k] == 141){ |
711 |
|
ver[k][20]++ ; |
712 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
713 |
|
printf(" thresholds checksum wrong\n"); |
714 |
|
}; |
715 |
|
if (ce->perror[k] == 142){ |
716 |
|
ver[k][22]++ ; |
717 |
|
sighandler(headc,obt,i,k,nevents,evdone); |
718 |
|
printf(" packet length is zero (YODA input error), skipped\n"); |
719 |
|
}; |
720 |
}; |
}; |
721 |
for (Int_t kk = 0; kk < 11 ; kk++ ){ |
for (Int_t kk = 0; kk < 11 ; kk++ ){ |
722 |
tshit += shit[k][kk]; |
tshit += shit[k][kk]; |
723 |
trshit += rshit[k][kk]; |
trshit += rshit[k][kk]; |
724 |
}; |
}; |
725 |
}; |
}; |
726 |
Calstriphit->Fill(cshit); |
if (isCOMP || isFULL){ |
727 |
if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ |
Calstriphit->Fill(cshit); |
728 |
incshit++; |
// if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){ |
729 |
} else { |
if ( (cshit > 10 && cshit < 100) ){ |
730 |
outcshit++; |
incshit++; |
731 |
}; |
} else { |
732 |
if ( tshit>0 ) h1->Fill(tshit); |
outcshit++; |
733 |
if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ |
}; |
734 |
intshit++; |
// |
735 |
} else { |
if ( tshit>0 ) h1->Fill(tshit); |
736 |
outtshit++; |
// if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){ |
737 |
|
if ( (tshit > 10 && tshit < 100) ){ |
738 |
|
intshit++; |
739 |
|
} else { |
740 |
|
outtshit++; |
741 |
|
}; |
742 |
}; |
}; |
743 |
if ( trshit>0 ) { |
if ( trshit>0 ) { |
744 |
h1r->Fill(trshit); |
h1r->Fill(trshit); |
745 |
if ( trshit < 4210 ){ |
if ( trshit < 4210 ){ |
746 |
h1rcheck = true; |
h1rout++; |
747 |
// printf("ma come... trshit %i \n",trshit); |
// printf("ma come... trshit %i \n",trshit); |
748 |
|
} else { |
749 |
|
h1rin++; |
750 |
}; |
}; |
751 |
}; |
}; |
752 |
if ( i%1000 == 0 && i > 0 ) printf("%iK\n",i/1000); |
// if ( i%1000 == 0 && i > 0 ) printf("%iK\n",i/1000); |
753 |
i++; |
i++; |
754 |
}; |
}; |
755 |
printf("\n"); |
printf("\n"); |
756 |
|
printf("\n end processing. \n\n"); |
757 |
|
if ( (float)h1rout/((float)h1rin+(float)h1rout) > h1rth ){ |
758 |
|
h1rcheck = true; |
759 |
|
}; |
760 |
// |
// |
761 |
// output figures, first sheet: |
// output figures, first sheet: |
762 |
// |
// |
776 |
t->DrawLatex(2.,99.,errore.str().c_str()); |
t->DrawLatex(2.,99.,errore.str().c_str()); |
777 |
TPad *pd5; |
TPad *pd5; |
778 |
TPad *pd6; |
TPad *pd6; |
779 |
|
TPad *pd7; |
780 |
|
TPad *pd8; |
781 |
TPad *pad1; |
TPad *pad1; |
782 |
TPad *pad2; |
TPad *pad2; |
783 |
TPad *pad3; |
TPad *pad3; |
822 |
h1->Draw(); |
h1->Draw(); |
823 |
// |
// |
824 |
h1max = h1->GetMaximum()*1.05; |
h1max = h1->GetMaximum()*1.05; |
825 |
Double_t xc[4] = {0.,25.,25.,0.}; |
Double_t xc[4] = {10.,100.,100.,10.}; |
826 |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
Double_t yc[4] = {0.,0.,h1max,h1max}; |
827 |
banda1 = new TPolyLine(4,xc,yc); |
banda1 = new TPolyLine(4,xc,yc); |
828 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
829 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
830 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
831 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
832 |
Double_t xd[4] = {40.,80.,80.,40.}; |
// Double_t xd[4] = {40.,80.,80.,40.}; |
833 |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
// Double_t yd[4] = {0.,0.,h1max,h1max}; |
834 |
banda2 = new TPolyLine(4,xd,yd); |
// banda2 = new TPolyLine(4,xd,yd); |
835 |
banda2->SetLineColor(5); |
// banda2->SetLineColor(5); |
836 |
banda2->SetFillColor(5); |
// banda2->SetFillColor(5); |
837 |
banda2->SetLineWidth(1); |
// banda2->SetLineWidth(1); |
838 |
banda2->Draw("fSAME"); |
//banda2->Draw("fSAME"); |
839 |
h1->Draw("SAME"); |
h1->Draw("SAME"); |
840 |
// |
// |
841 |
figura->cd(); |
figura->cd(); |
872 |
h1->SetYTitle("Number of events"); |
h1->SetYTitle("Number of events"); |
873 |
h1->Draw(); |
h1->Draw(); |
874 |
h1max = h1->GetMaximum()*1.05; |
h1max = h1->GetMaximum()*1.05; |
875 |
Double_t xe[4] = {0.,25.,25.,0.}; |
Double_t xe[4] = {10.,100.,100.,10.}; |
876 |
Double_t ye[4] = {0.,0.,h1max,h1max}; |
Double_t ye[4] = {0.,0.,h1max,h1max}; |
877 |
banda1 = new TPolyLine(4,xe,ye); |
banda1 = new TPolyLine(4,xe,ye); |
878 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
879 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
880 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
881 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
882 |
Double_t xf[4] = {40.,80.,80.,40.}; |
// Double_t xf[4] = {40.,80.,80.,40.}; |
883 |
Double_t yf[4] = {0.,0.,h1max,h1max}; |
// Double_t yf[4] = {0.,0.,h1max,h1max}; |
884 |
banda2 = new TPolyLine(4,xf,yf); |
// banda2 = new TPolyLine(4,xf,yf); |
885 |
banda2->SetLineColor(5); |
// banda2->SetLineColor(5); |
886 |
banda2->SetFillColor(5); |
// banda2->SetFillColor(5); |
887 |
banda2->SetLineWidth(1); |
// banda2->SetLineWidth(1); |
888 |
banda2->Draw("fSAME"); |
// banda2->Draw("fSAME"); |
889 |
h1->Draw("SAME"); |
h1->Draw("SAME"); |
890 |
}; |
}; |
891 |
if ( trshit !=0 ) { |
if ( trshit !=0 ) { |
915 |
}; |
}; |
916 |
}; |
}; |
917 |
if ( !errorfull ) { |
if ( !errorfull ) { |
918 |
if ( calevn1 || calevn2 || calevn3 ) { |
if ( calevn1 > calevnth || calevn2 > calevnth || calevn3 > calevnth ) { |
919 |
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); |
920 |
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); |
921 |
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); |
1090 |
Dexyc->Draw("SAME"); |
Dexyc->Draw("SAME"); |
1091 |
// |
// |
1092 |
pd3->cd(); |
pd3->cd(); |
1093 |
|
// gPad->SetLogy(); |
1094 |
Calstriphit->SetXTitle("Number of hit"); |
Calstriphit->SetXTitle("Number of hit"); |
1095 |
Calstriphit->SetYTitle("Number of events"); |
Calstriphit->SetYTitle("Number of events"); |
1096 |
Calstriphit->Draw(); |
Calstriphit->Draw(); |
1097 |
h1max = Calstriphit->GetMaximum()*1.05; |
h1max = Calstriphit->GetMaximum()*1.05; |
1098 |
Double_t xg[4] = {0.,25.,25.,0.}; |
Double_t xg[4] = {10.,100.,100.,10.}; |
1099 |
Double_t yg[4] = {0.,0.,h1max,h1max}; |
Double_t yg[4] = {0.,0.,h1max,h1max}; |
1100 |
banda1 = new TPolyLine(4,xg,yg); |
banda1 = new TPolyLine(4,xg,yg); |
1101 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
1102 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
1103 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
1104 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
1105 |
Double_t xh[4] = {40.,80.,80.,40.}; |
// Double_t xh[4] = {40.,80.,80.,40.}; |
1106 |
Double_t yh[4] = {0.,0.,h1max,h1max}; |
// Double_t yh[4] = {0.,0.,h1max,h1max}; |
1107 |
banda2 = new TPolyLine(4,xh,yh); |
// banda2 = new TPolyLine(4,xh,yh); |
1108 |
banda2->SetLineColor(5); |
// banda2->SetLineColor(5); |
1109 |
banda2->SetFillColor(5); |
// banda2->SetFillColor(5); |
1110 |
banda2->SetLineWidth(1); |
// banda2->SetLineWidth(1); |
1111 |
banda2->Draw("fSAME"); |
// banda2->Draw("fSAME"); |
1112 |
Calstriphit->Draw("SAME"); |
Calstriphit->Draw("SAME"); |
1113 |
// |
// |
1114 |
pd4->cd(); |
pd4->cd(); |
1115 |
|
gPad->SetLogy(); |
1116 |
Dexy->SetXTitle("ADC channels"); |
Dexy->SetXTitle("ADC channels"); |
1117 |
Dexy->SetYTitle("Number of events"); |
Dexy->SetYTitle("Number of events"); |
1118 |
Dexy->Draw(); |
Dexy->Draw(); |
1119 |
h1max = Dexy->GetMaximum()*1.05; |
// h1max = Dexy->GetMaximum()*1.05; |
1120 |
|
h1max = Dexy->GetMaximum()*2.05; |
1121 |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
1122 |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
1123 |
banda1 = new TPolyLine(4,xd,yd); |
banda1 = new TPolyLine(4,xd,yd); |
1153 |
pd4->Draw(); |
pd4->Draw(); |
1154 |
// |
// |
1155 |
pd4->cd(); |
pd4->cd(); |
1156 |
|
gPad->SetLogy(); |
1157 |
Dexy->SetXTitle("ADC channels"); |
Dexy->SetXTitle("ADC channels"); |
1158 |
Dexy->SetYTitle("Number of events"); |
Dexy->SetYTitle("Number of events"); |
1159 |
Dexy->Draw(); |
Dexy->Draw(); |
1160 |
h1max = Dexy->GetMaximum()*1.05; |
// h1max = Dexy->GetMaximum()*1.05; |
1161 |
|
h1max = Dexy->GetMaximum()*2.05; |
1162 |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
Double_t xd[4] = {2000.,5000.,5000.,2000.}; |
1163 |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
Double_t yd[4] = {0.,0.,h1max,h1max}; |
1164 |
banda1 = new TPolyLine(4,xd,yd); |
banda1 = new TPolyLine(4,xd,yd); |
1169 |
Dexy->Draw("SAME"); |
Dexy->Draw("SAME"); |
1170 |
}; |
}; |
1171 |
// |
// |
1172 |
|
TCanvas *figura3 = 0; |
1173 |
|
Bool_t printfigure3 = false; |
1174 |
|
for (Int_t i = 0; i<4; i++){ |
1175 |
|
if ( ver[i][2] || lver[i][2] ){ |
1176 |
|
printfigure3 = true; |
1177 |
|
break; |
1178 |
|
}; |
1179 |
|
}; |
1180 |
|
if ( printfigure3 ){ |
1181 |
|
figura3 = new TCanvas("Calorimeter_Detector_Report_2bis/3","Calorimeter_Detector_Report_2bis/3", 1100, 900); |
1182 |
|
figura3->SetFillColor(10); |
1183 |
|
figura3->Range(0,0,100,100); |
1184 |
|
errore.str(""); |
1185 |
|
errore << "EXPERT -- File: " << file; |
1186 |
|
errore << " "; |
1187 |
|
t=new TLatex(); |
1188 |
|
t->SetTextFont(32); |
1189 |
|
t->SetTextColor(1); |
1190 |
|
t->SetTextAlign(12); |
1191 |
|
t->SetTextSize(0.015); |
1192 |
|
t->DrawLatex(2.,99.,errore.str().c_str()); |
1193 |
|
pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.49,0.73,45); |
1194 |
|
pd5 = new TPad("pd5","This is pad5",0.02,0.76,0.49,0.98,45); |
1195 |
|
pd2 = new TPad("pd2","This is pad2",0.51,0.51,0.98,0.73,45); |
1196 |
|
pd6 = new TPad("pd6","This is pad6",0.51,0.76,0.98,0.98,45); |
1197 |
|
pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.49,0.23,45); |
1198 |
|
pd7 = new TPad("pd7","This is pad7",0.02,0.26,0.49,0.49,45); |
1199 |
|
pd4 = new TPad("pd4","This is pad4",0.51,0.02,0.98,0.23,45); |
1200 |
|
pd8 = new TPad("pd8","This is pad8",0.51,0.26,0.98,0.49,45); |
1201 |
|
figura3->cd(); |
1202 |
|
pd1->Range(0,0,100,100); |
1203 |
|
pd2->Range(0,0,100,100); |
1204 |
|
pd3->Range(0,0,100,100); |
1205 |
|
pd4->Range(0,0,100,100); |
1206 |
|
pd1->SetTicks(); |
1207 |
|
pd2->SetTicks(); |
1208 |
|
pd3->SetTicks(); |
1209 |
|
pd4->SetTicks(); |
1210 |
|
pd1->Draw(); |
1211 |
|
pd2->Draw(); |
1212 |
|
pd3->Draw(); |
1213 |
|
pd4->Draw(); |
1214 |
|
pd5->Range(0,0,100,100); |
1215 |
|
pd6->Range(0,0,100,100); |
1216 |
|
pd7->Range(0,0,100,100); |
1217 |
|
pd8->Range(0,0,100,100); |
1218 |
|
pd5->SetTicks(); |
1219 |
|
pd6->SetTicks(); |
1220 |
|
pd7->SetTicks(); |
1221 |
|
pd8->SetTicks(); |
1222 |
|
pd5->Draw(); |
1223 |
|
pd6->Draw(); |
1224 |
|
pd7->Draw(); |
1225 |
|
pd8->Draw(); |
1226 |
|
pd1->cd(); |
1227 |
|
lup[0]->SetAxisRange((Double_t)min(minobt[0],swminobt[0])*0.9,(Double_t)max(maxobt[0],swmaxobt[0])*1.1,"X"); |
1228 |
|
lup[0]->SetXTitle("OBT"); |
1229 |
|
lup[0]->SetYTitle("Number of events"); |
1230 |
|
lup[0]->Draw(); |
1231 |
|
pd5->cd(); |
1232 |
|
lupstw[0]->SetAxisRange((Double_t)min(minobt[0],swminobt[0])*0.9,(Double_t)max(maxobt[0],swmaxobt[0])*1.1,"X"); |
1233 |
|
// lupstw[0]->SetAxisRange((Double_t)swminobt[0]*0.9,(Double_t)swmaxobt[0]*1.1,"X"); |
1234 |
|
lupstw[0]->SetXTitle("OBT"); |
1235 |
|
lupstw[0]->SetYTitle("Number of events"); |
1236 |
|
lupstw[0]->Draw(); |
1237 |
|
pd2->cd(); |
1238 |
|
lup[1]->SetAxisRange((Double_t)min(minobt[1],swminobt[1])*0.9,(Double_t)max(maxobt[1],swmaxobt[1])*1.1,"X"); |
1239 |
|
// lup[1]->SetAxisRange((Double_t)minobt[1]*0.9,(Double_t)maxobt[1]*1.1,"X"); |
1240 |
|
lup[1]->SetXTitle("OBT"); |
1241 |
|
lup[1]->SetYTitle("Number of events"); |
1242 |
|
lup[1]->Draw(); |
1243 |
|
pd6->cd(); |
1244 |
|
lupstw[1]->SetAxisRange((Double_t)min(minobt[1],swminobt[1])*0.9,(Double_t)max(maxobt[1],swmaxobt[1])*1.1,"X"); |
1245 |
|
// lupstw[1]->SetAxisRange((Double_t)swminobt[1]*0.9,(Double_t)swmaxobt[1]*1.1,"X"); |
1246 |
|
lupstw[1]->SetXTitle("OBT"); |
1247 |
|
lupstw[1]->SetYTitle("Number of events"); |
1248 |
|
lupstw[1]->Draw(); |
1249 |
|
pd3->cd(); |
1250 |
|
lup[2]->SetAxisRange((Double_t)min(minobt[2],swminobt[2])*0.9,(Double_t)max(maxobt[2],swmaxobt[2])*1.1,"X"); |
1251 |
|
// lup[2]->SetAxisRange((Double_t)minobt[2]*0.9,(Double_t)maxobt[2]*1.1,"X"); |
1252 |
|
lup[2]->SetXTitle("OBT"); |
1253 |
|
lup[2]->SetYTitle("Number of events"); |
1254 |
|
lup[2]->Draw(); |
1255 |
|
pd7->cd(); |
1256 |
|
lupstw[2]->SetAxisRange((Double_t)min(minobt[2],swminobt[2])*0.9,(Double_t)max(maxobt[2],swmaxobt[2])*1.1,"X"); |
1257 |
|
// lupstw[2]->SetAxisRange((Double_t)swminobt[2]*0.9,(Double_t)swmaxobt[2]*1.1,"X"); |
1258 |
|
lupstw[2]->SetXTitle("OBT"); |
1259 |
|
lupstw[2]->SetYTitle("Number of events"); |
1260 |
|
lupstw[2]->Draw(); |
1261 |
|
pd4->cd(); |
1262 |
|
lup[3]->SetAxisRange((Double_t)min(minobt[3],swminobt[3])*0.9,(Double_t)max(maxobt[3],swmaxobt[3])*1.1,"X"); |
1263 |
|
// lup[3]->SetAxisRange((Double_t)minobt[3]*0.9,(Double_t)maxobt[3]*1.1,"X"); |
1264 |
|
lup[3]->SetXTitle("OBT"); |
1265 |
|
lup[3]->SetYTitle("Number of events"); |
1266 |
|
lup[3]->Draw(); |
1267 |
|
pd8->cd(); |
1268 |
|
lupstw[3]->SetAxisRange((Double_t)min(minobt[3],swminobt[3])*0.9,(Double_t)max(maxobt[3],swmaxobt[3])*1.1,"X"); |
1269 |
|
// lupstw[3]->SetAxisRange((Double_t)swminobt[3]*0.9,(Double_t)swmaxobt[3]*1.1,"X"); |
1270 |
|
lupstw[3]->SetXTitle("OBT"); |
1271 |
|
lupstw[3]->SetYTitle("Number of events"); |
1272 |
|
lupstw[3]->Draw(); |
1273 |
|
}; |
1274 |
|
// |
1275 |
// output figures, report sheet: |
// output figures, report sheet: |
1276 |
// |
// |
1277 |
TCanvas *rapporto= new TCanvas("Calorimeter_Detector_Report_3/3", "Calorimeter_Detector_Report_3/3", 1100, 900); |
TCanvas *rapporto= new TCanvas("Calorimeter_Detector_Report_3/3", "Calorimeter_Detector_Report_3/3", 1100, 900); |
1302 |
pad2->Draw(); |
pad2->Draw(); |
1303 |
pad3->Draw(); |
pad3->Draw(); |
1304 |
pad4->Draw(); |
pad4->Draw(); |
1305 |
|
// |
1306 |
|
Bool_t redevent = true; |
1307 |
|
// |
1308 |
|
if ( ver[0][3]+ver[0][16]+ver[0][17] == ver[1][3]+ver[1][16]+ver[1][17] && ver[1][3]+ver[1][16]+ver[1][17] == ver[2][3]+ver[2][16]+ver[2][17] && ver[2][3]+ver[2][16]+ver[2][17] == ver[3][3]+ver[3][16]+ver[3][17] ){ |
1309 |
|
redevent = false; |
1310 |
|
}; |
1311 |
|
if ( redevent ) check = true; |
1312 |
|
// |
1313 |
for (Int_t i = 0; i < 4; i++){ |
for (Int_t i = 0; i < 4; i++){ |
1314 |
if (i == 2) |
if (i == 2) |
1315 |
{ |
{ |
1355 |
check = true; |
check = true; |
1356 |
} |
} |
1357 |
if (j == 2) { |
if (j == 2) { |
1358 |
|
// printf("boh! lalarm[%i] = %i \n",i,lalarm[i]); |
1359 |
if ( lalarm[i] ){ |
if ( lalarm[i] ){ |
1360 |
errore.str(""); |
errore.str(""); |
1361 |
errore << "* Latch up: " << ver[i][j]; |
errore << "* Latch up: " << ver[i][j]; |
1362 |
errore << " (" << lalarm[i]; |
errore << " (" << lalarm[i]; |
1363 |
errore << " NOT rec!): "; |
errore << " NOT rec!): "; |
1364 |
t->DrawLatex(0.,70.,errore.str().c_str()); |
t->DrawLatex(2.,70.,errore.str().c_str()); |
1365 |
check = true; |
check = true; |
1366 |
} else { |
} else { |
1367 |
errore.str(""); |
errore.str(""); |
1396 |
errore.str(""); |
errore.str(""); |
1397 |
errore << "RAW mode: " << ver[i][j]; |
errore << "RAW mode: " << ver[i][j]; |
1398 |
errore << " time(s)"; |
errore << " time(s)"; |
1399 |
t->SetTextColor(32); |
if ( !redevent ) t->SetTextColor(32); |
1400 |
t->DrawLatex(2.,90.,errore.str().c_str()); |
t->DrawLatex(2.,90.,errore.str().c_str()); |
1401 |
} |
} |
1402 |
if (j == 4) { |
if (j == 4) { |
1432 |
errore << "Missing section: " << ver[i][j]; |
errore << "Missing section: " << ver[i][j]; |
1433 |
errore << " time(s)"; |
errore << " time(s)"; |
1434 |
t->DrawLatex(2.,50.,errore.str().c_str()); |
t->DrawLatex(2.,50.,errore.str().c_str()); |
1435 |
check = true; |
if ( ver[i][j] > 3 ) check = true; |
1436 |
} |
} |
1437 |
if (j == 10) { |
if (j == 10) { |
1438 |
errore.str(""); |
errore.str(""); |
1439 |
errore << "Calevnum jump: " << ver[i][j]; |
errore << "Calevnum jump: " << ver[i][j]; |
1440 |
errore << " time(s)"; |
errore << " time(s)"; |
1441 |
t->DrawLatex(2.,42.,errore.str().c_str()); |
t->DrawLatex(2.,42.,errore.str().c_str()); |
1442 |
check = true; |
if ( ver[i][j] > 3 ) check = true; |
1443 |
} |
} |
1444 |
if (j == 11) { |
if (j == 11) { |
1445 |
errore.str(""); |
errore.str(""); |
1446 |
errore << "CRC error (data): " << ver[i][j]; |
errore << "CRC error (data): " << ver[i][j]; |
1447 |
errore << " time(s)"; |
errore << " time(s)"; |
1448 |
t->DrawLatex(2.,38.,errore.str().c_str()); |
t->DrawLatex(2.,38.,errore.str().c_str()); |
1449 |
check = true; |
if ( ver[i][j] > 10 ) check = true; |
1450 |
} |
} |
1451 |
if (j == 12) { |
if (j == 12) { |
1452 |
errore.str(""); |
errore.str(""); |
1480 |
errore.str(""); |
errore.str(""); |
1481 |
errore << "COMPRESS mode: " << ver[i][j]; |
errore << "COMPRESS mode: " << ver[i][j]; |
1482 |
errore << " time(s)"; |
errore << " time(s)"; |
1483 |
t->SetTextColor(32); |
if ( !redevent ) t->SetTextColor(32); |
1484 |
t->DrawLatex(2.,86.,errore.str().c_str()); |
t->DrawLatex(2.,86.,errore.str().c_str()); |
1485 |
} |
} |
1486 |
if (j == 17) { |
if (j == 17) { |
1487 |
errore.str(""); |
errore.str(""); |
1488 |
errore << "FULL mode: " << ver[i][j]; |
errore << "FULL mode: " << ver[i][j]; |
1489 |
errore << " time(s)"; |
errore << " time(s)"; |
1490 |
t->SetTextColor(32); |
if ( !redevent ) t->SetTextColor(32); |
1491 |
t->DrawLatex(2.,82.,errore.str().c_str()); |
t->DrawLatex(2.,82.,errore.str().c_str()); |
1492 |
} |
} |
1493 |
if (j == 18) { |
if (j == 18) { |
1559 |
t->DrawLatex(60.,95.," OK! "); |
t->DrawLatex(60.,95.," OK! "); |
1560 |
}; |
}; |
1561 |
// |
// |
1562 |
const string fil = (const char*)filename; |
// const string fil = (const char*)filename; |
1563 |
Int_t posiz = fil.find("dw_"); |
// Int_t posiz = fil.find("dw_"); |
1564 |
if ( posiz == -1 ) posiz = fil.find("DW_"); |
// if ( posiz == -1 ) posiz = fil.find("DW_"); |
1565 |
Int_t posiz2 = posiz+13; |
// Int_t posiz2 = posiz+13; |
1566 |
TString file2; |
// TString file2; |
1567 |
stringcopy(file2,filename,posiz,posiz2); |
// stringcopy(file2,filename,posiz,posiz2); |
1568 |
// |
// |
1569 |
|
const string fil = gSystem->BaseName(filename.Data()); |
1570 |
|
Int_t posiz = fil.find(".root"); |
1571 |
|
// |
1572 |
|
TString file2; |
1573 |
|
if ( posiz == -1 ){ |
1574 |
|
file2 = gSystem->BaseName(filename.Data()); |
1575 |
|
} else { |
1576 |
|
Int_t posiz2 = 0; |
1577 |
|
stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); |
1578 |
|
}; |
1579 |
const char *figrec = file2; |
const char *figrec = file2; |
1580 |
|
// |
1581 |
const char *outdir = outDir; |
const char *outdir = outDir; |
1582 |
stringstream figsave; |
stringstream figsave; |
1583 |
stringstream figsave1; |
stringstream figsave1; |
1586 |
if ( !strcmp(format,"ps") ) { |
if ( !strcmp(format,"ps") ) { |
1587 |
figsave.str(""); |
figsave.str(""); |
1588 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1589 |
figsave << figrec << "_qlook."; |
figsave << figrec << "_CaloQLOOK."; |
1590 |
figsave << format << "("; |
figsave << format << "("; |
1591 |
rapporto->Print(figsave.str().c_str(),"Landscape"); |
rapporto->Print(figsave.str().c_str(),"Landscape"); |
1592 |
figsave1.str(""); |
figsave1.str(""); |
1593 |
figsave1 << outdir << "/" ; |
figsave1 << outdir << "/" ; |
1594 |
figsave1 << figrec << "_qlook."; |
figsave1 << figrec << "_CaloQLOOK."; |
1595 |
figsave1 << format; |
figsave1 << format; |
1596 |
figura->Print(figsave1.str().c_str(),"Landscape"); |
figura->Print(figsave1.str().c_str(),"Landscape"); |
1597 |
figsave2.str(""); |
figsave2.str(""); |
1598 |
figsave2 << outdir << "/" ; |
figsave2 << outdir << "/" ; |
1599 |
figsave2 << figrec << "_qlook."; |
figsave2 << figrec << "_CaloQLOOK."; |
1600 |
figsave2 << format << ")"; |
if ( printfigure3 ){ |
1601 |
figura2->Print(figsave2.str().c_str(),"Landscape"); |
figsave2 << format; |
1602 |
|
figura2->Print(figsave2.str().c_str(),"Landscape"); |
1603 |
|
figsave2.str(""); |
1604 |
|
figsave2 << outdir << "/" ; |
1605 |
|
figsave2 << figrec << "_CaloQLOOK."; |
1606 |
|
figsave2 << format << ")"; |
1607 |
|
figura3->Print(figsave2.str().c_str(),"Landscape"); |
1608 |
|
} else { |
1609 |
|
figsave2 << format << ")";; |
1610 |
|
figura2->Print(figsave2.str().c_str(),"Landscape"); |
1611 |
|
}; |
1612 |
} else { |
} else { |
1613 |
figsave.str(""); |
figsave.str(""); |
1614 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1615 |
figsave << figrec << "_qlook1."; |
figsave << figrec << "_CaloQLOOK1."; |
1616 |
figsave << format; |
figsave << format; |
1617 |
figura->SaveAs(figsave.str().c_str()); |
figura->SaveAs(figsave.str().c_str()); |
1618 |
figsave.str(""); |
figsave.str(""); |
1619 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1620 |
figsave << figrec << "_qlook2."; |
figsave << figrec << "_CaloQLOOK2."; |
1621 |
figsave << format; |
figsave << format; |
1622 |
figura2->SaveAs(figsave.str().c_str()); |
figura2->SaveAs(figsave.str().c_str()); |
1623 |
|
if ( printfigure3 ){ |
1624 |
|
figsave.str(""); |
1625 |
|
figsave << outdir << "/" ; |
1626 |
|
figsave << figrec << "_CaloQLOOK2bis."; |
1627 |
|
figsave << format; |
1628 |
|
figura3->SaveAs(figsave.str().c_str()); |
1629 |
|
}; |
1630 |
figsave.str(""); |
figsave.str(""); |
1631 |
figsave << outdir << "/" ; |
figsave << outdir << "/" ; |
1632 |
figsave << figrec << "_qlook3."; |
figsave << figrec << "_CaloQLOOK3."; |
1633 |
figsave << format; |
figsave << format; |
1634 |
rapporto->SaveAs(figsave.str().c_str()); |
rapporto->SaveAs(figsave.str().c_str()); |
1635 |
}; |
}; |
1636 |
|
if ( iactive && w4i ){ |
1637 |
|
while ( gROOT->GetListOfCanvases()->FindObject(rapporto) || gROOT->GetListOfCanvases()->FindObject(figura3) || gROOT->GetListOfCanvases()->FindObject(figura2) || gROOT->GetListOfCanvases()->FindObject(figura) ){ |
1638 |
|
gSystem->ProcessEvents(); |
1639 |
|
gSystem->Sleep(10); |
1640 |
|
}; |
1641 |
|
}; |
1642 |
} |
} |
1643 |
|
|