1 |
// |
// |
2 |
// Check the calorimter calibrations - Emiliano Mocchiutti |
// Check the calorimter calibrations - Emiliano Mocchiutti |
3 |
// |
// |
4 |
// FCaloCHKCALIB.c version 1.12 (2006-08-04) |
// FCaloCHKCALIB.c version 1.13 (2006-09-22) |
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-22): Set upper limit in calvar plot. |
11 |
|
// |
12 |
// 1.07 - 1.12 (2006-08-04): bugs fixed. |
// 1.07 - 1.12 (2006-08-04): bugs fixed. |
13 |
// |
// |
14 |
// 1.07 - 1.11 (2006-07-17): Adapted to flight conditions. |
// 1.07 - 1.11 (2006-07-17): Adapted to flight conditions. |
49 |
#include <TApplication.h> |
#include <TApplication.h> |
50 |
// |
// |
51 |
#include <CalibCalPedEvent.h> |
#include <CalibCalPedEvent.h> |
52 |
|
#include <PamelaRun.h> |
53 |
// |
// |
54 |
using namespace std; |
using namespace std; |
55 |
// |
// |
89 |
|
|
90 |
typedef struct Calib { |
typedef struct Calib { |
91 |
Int_t iev; |
Int_t iev; |
92 |
Int_t cstwerr[4]; |
Int_t cstwerr[4];//per l'header contenente lo stato del calorimetro |
93 |
Float_t cperror[4]; |
Float_t cperror[4]; |
94 |
Float_t mip[2][22][96]; |
Float_t mip[2][22][96];//(xy,piano,strip) |
95 |
Float_t calped[2][22][96]; |
Float_t calped[2][22][96]; |
96 |
Float_t calgood[2][22][96]; |
Float_t calgood[2][22][96]; |
97 |
Float_t calthr[2][22][6]; |
Float_t calthr[2][22][6]; |
101 |
Float_t calpuls[2][22][96]; |
Float_t calpuls[2][22][96]; |
102 |
} calib; |
} calib; |
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
//main |
107 |
void FCaloCHKCALIB(TString filename, Long64_t calibnumber = 0, TString outDir = "", Int_t figmatra = 0, TString saveas = "png", Bool_t iactive =false, Bool_t w4i=false){ |
void FCaloCHKCALIB(TString filename, Long64_t calibnumber = 0, TString outDir = "", Int_t figmatra = 0, TString saveas = "png", Bool_t iactive =false, Bool_t w4i=false){ |
108 |
|
|
109 |
gStyle->SetPaperSize(19.,25.); |
gStyle->SetPaperSize(19.,25.); |
110 |
// |
// |
111 |
TApplication *app = 0; |
TApplication *app = 0; //crea un ambiente root (app) |
112 |
if ( iactive ) app = new TApplication("app",0,0); |
if ( iactive ) app = new TApplication("app",0,0);//verifica se deve essere interattivo |
113 |
Float_t ccalrmsthr=0.99; |
// |
114 |
Float_t ccalpedthr=0.99; |
//definizione delle soglie per valutare problemi nell calibrazione |
115 |
Float_t ccalbadthr=0.03;// 0.005 |
Float_t ccalrmsthr=0.95;// numero di strip con rms entro i limiti (99%) |
116 |
Float_t ccalthrthr=0.98; |
Float_t ccalpedthr=0.95;// numero di strip con piedistallo entro i limiti(99%) |
117 |
Float_t ccalvarthr=0.99; |
Float_t ccalbadthr=0.03;// 0.005 numero massimo di strip non utilizzate (3%) per calibrare |
118 |
Float_t ccalbasthr=0.99; |
Float_t ccalthrthr=0.95; |
119 |
// |
Float_t ccalvarthr=0.95; |
120 |
Float_t ccalrms; |
Float_t ccalbasthr=0.95; |
121 |
Float_t ccalped; |
// |
122 |
Float_t ccalbad; |
Float_t ccalrms = 0.; |
123 |
Float_t ccalthr; |
Float_t ccalped = 0.; |
124 |
Float_t ccalvar; |
Float_t ccalbad = 0.; |
125 |
Float_t ccalbas; |
Float_t ccalthr = 0.; |
126 |
|
Float_t ccalvar = 0.; |
127 |
|
Float_t ccalbas = 0.; |
128 |
// |
// |
129 |
struct Calib calib; |
struct Calib calib; |
130 |
stringstream titolo; |
stringstream titolo, sottotitolo; |
131 |
stringstream xviewev; |
stringstream xviewev; |
132 |
stringstream yviewev; |
stringstream yviewev; |
133 |
|
|
134 |
|
//directory di lavoro |
135 |
const char* startingdir = gSystem->WorkingDirectory(); |
const char* startingdir = gSystem->WorkingDirectory(); |
136 |
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; |
137 |
|
|
138 |
|
//nome del file |
139 |
TString fififile = getFilename(filename); |
TString fififile = getFilename(filename); |
140 |
const char *file; |
const char *file; |
141 |
file = fififile; |
file = fififile; |
142 |
// |
|
143 |
|
//verifica se esiste il file |
144 |
ifstream myfile; |
ifstream myfile; |
145 |
myfile.open(filename.Data()); |
myfile.open(filename.Data()); |
146 |
if ( !myfile ){ |
if ( !myfile ){ |
148 |
return; |
return; |
149 |
}; |
}; |
150 |
myfile.close(); |
myfile.close(); |
151 |
// |
// |
152 |
|
|
153 |
|
//apre il file in 'File' |
154 |
TFile *File = new TFile(filename.Data()); |
TFile *File = new TFile(filename.Data()); |
155 |
// |
|
156 |
|
//crea struttura tree (tr) con il tree "CalibCalPed" in File |
157 |
TTree *tr = (TTree*)File->Get("CalibCalPed"); |
TTree *tr = (TTree*)File->Get("CalibCalPed"); |
158 |
|
//definisco struttura tree per caricare gli header cpu |
159 |
|
TTree *cpuhe = (TTree*)File->Get("CalibHeader"); |
160 |
|
|
161 |
if ( !tr ) { |
if ( !tr ) { |
162 |
printf(" CalibCalPed : no such tree in %s \n",filename.Data()); |
printf(" CalibCalPed : no such tree in %s \n",filename.Data()); |
163 |
printf(" Exiting, are you sure this is a LEVEL0 not corrupted file? \n\n"); |
printf(" Exiting, are you sure this is a LEVEL0 not corrupted file? \n\n"); |
164 |
return; |
return; |
165 |
}; |
}; |
166 |
|
|
167 |
pamela::CalibCalPedEvent *ce = 0; |
pamela::CalibCalPedEvent *ce = 0; |
168 |
|
pamela::EventHeader *eh = 0;//definisco variabili di tipo header |
169 |
|
pamela::EventHeader *ch =0;//definisco la variabile per header cpu |
170 |
|
// pamela::PscuHeader *ph = 0; //definisco variabile di tipo pscu |
171 |
|
|
172 |
// |
// |
173 |
UInt_t found; |
//UInt_t found; |
174 |
tr->SetBranchStatus("*",0,&found); //disable all branches |
UInt_t cpuobt=0, obt=0, obt0=0, obt1=0, obt2=0, obt3=0; |
175 |
// |
|
176 |
found = 0; |
// tr->SetBranchStatus("*",0,&found); //disable all branches |
177 |
tr->SetBranchStatus("iev*",1,&found); |
// |
178 |
found = 0; |
// found = 0; |
179 |
tr->SetBranchStatus("cstwerr*",1,&found); |
// tr->SetBranchStatus("iev*",1,&found); |
180 |
// printf("enabled %i branches \n",found); |
// found = 0; |
181 |
found = 0; |
// tr->SetBranchStatus("cstwerr*",1,&found); |
182 |
tr->SetBranchStatus("cperror*",1,&found); |
// // printf("enabled %i branches \n",found); |
183 |
//printf("enabled %i branches \n",found); |
// found = 0; |
184 |
found = 0; |
// tr->SetBranchStatus("cperror*",1,&found); |
185 |
tr->SetBranchStatus("cal*",1,&found); |
// //printf("enabled %i branches \n",found); |
186 |
//printf("enabled %i branches \n",found); |
// found = 0; |
187 |
found = 0; |
// tr->SetBranchStatus("cal*",1,&found); |
188 |
tr->SetBranchStatus("CalibCalPed*",1,&found); |
// //printf("enabled %i branches \n",found); |
189 |
|
// found = 0; |
190 |
|
// tr->SetBranchStatus("CalibCalPed*",1,&found); |
191 |
//printf("enabled %i branches \n",found); |
//printf("enabled %i branches \n",found); |
192 |
// |
// |
193 |
tr->SetBranchAddress("CalibCalPed", &ce); |
tr->SetBranchAddress("CalibCalPed", &ce);//dichiaro in che ramo trovare quello che voglio puntare con ce |
194 |
|
tr->SetBranchAddress("Header", &eh);//dichiaro dove trovare quello che voglio in he |
195 |
// |
// |
196 |
Long64_t ncalibs = tr->GetEntries(); |
cpuhe->SetBranchAddress("Header",&ch); |
197 |
if ( ncalibs == 0 ){ |
// |
198 |
|
Long64_t ncalibs = tr->GetEntries();//cerca il ramo Entries (calibrazioni) |
199 |
|
if ( ncalibs == 0 || cpuhe->GetEntries() == 0){ |
200 |
printf(" No calibrations in this files! \n Exiting... \n"); |
printf(" No calibrations in this files! \n Exiting... \n"); |
201 |
return; |
return; |
202 |
}; |
}; |
203 |
|
// |
204 |
|
UInt_t cpuhead[1000]; |
205 |
|
memset(cpuhead, 0, 1000*sizeof(UInt_t)); |
206 |
|
for (Int_t i=0; i<cpuhe->GetEntries(); i++){ |
207 |
|
cpuhe->GetEntry(i); |
208 |
|
if ( i < 1000 ) cpuhead[i]=ch->GetPscuHeader()->GetOrbitalTime(); |
209 |
|
if ( i > 1000 ){ |
210 |
|
printf(" ERROR: too many calibrations in this file, cannot handle it \n Exiting... \n"); |
211 |
|
return; |
212 |
|
}; |
213 |
|
}; |
214 |
|
// |
215 |
printf("\n This file contains %i entries which corrispond to %i calibrations \n\n",(int)ncalibs,(int)ncalibs/4); |
printf("\n This file contains %i entries which corrispond to %i calibrations \n\n",(int)ncalibs,(int)ncalibs/4); |
216 |
Long64_t minev = 0; |
Long64_t minev = 0; |
217 |
Long64_t maxev = ncalibs; |
Long64_t maxev = ncalibs; |
218 |
if ( calibnumber ){ |
if ( calibnumber ){//calibnumber e' in ingresso nel main |
219 |
minev = (calibnumber - 1)* 4; |
minev = (calibnumber - 1)* 4; |
220 |
maxev = minev + 4; |
maxev = minev + 4; |
221 |
}; |
}; |
222 |
TCanvas *figura1; |
TCanvas *figura1;//finestra grafica che posso suddividere in piu' aree (pads) |
223 |
TCanvas *figura2 = 0; |
TCanvas *figura2 = 0; |
224 |
TCanvas *figura3; |
TCanvas *figura3; |
225 |
TCanvas *rapporto = 0; |
TCanvas *rapporto = 0; |
226 |
Int_t cmask = 127 ; |
Int_t cmask = 127 ;//maschera per selezionare i Byte di errore dall'header |
227 |
Int_t cestw = 0; |
Int_t cestw = 0; //variabile per contenere i Byte di errore del calorimetro estratti dall'header |
228 |
Int_t ver[4][23]; |
Int_t ver[4][23]; //variabile per riportare gli errori(22) su ogni sezione (4) |
229 |
// |
|
230 |
|
//azzera ver |
231 |
for (Int_t k = 0; k < 4; k++ ){ |
for (Int_t k = 0; k < 4; k++ ){ |
232 |
for (Int_t m = 0; m < 23 ; m++ ){ |
for (Int_t m = 0; m < 23 ; m++ ){ |
233 |
ver[k][m] = 0 ; |
ver[k][m] = 0 ; |
249 |
// |
// |
250 |
const char *outdir = outDir; |
const char *outdir = outDir; |
251 |
const char *format = saveas; |
const char *format = saveas; |
252 |
stringstream figsave; |
stringstream figsave; //definisco stringhe i/o |
253 |
stringstream figsave1; |
stringstream figsave1; |
254 |
stringstream figsave2; |
stringstream figsave2; |
255 |
|
if ( !strcmp(format,"ps") ) { |
256 |
|
figsave.str(""); |
257 |
|
figsave << outdir << "/" ; |
258 |
|
figsave << figrec << "_CaloCHKCALIB."; |
259 |
|
figsave << format; |
260 |
|
figsave << "("; |
261 |
|
}; |
262 |
// |
// |
263 |
|
|
264 |
|
//-----------------inizio CHECK per ricerca errori dal calorimetro------------------- |
265 |
// to check or not to check? this is the problem... |
// to check or not to check? this is the problem... |
266 |
|
|
267 |
|
Bool_t check = false;//azzera flag presenza errori |
268 |
|
|
269 |
// |
// |
270 |
Bool_t check = false; |
Int_t hi = (minev/4)-1; |
271 |
// |
//inizio loop su tutti gli header degli eventi di calibrazione |
272 |
for (Int_t ci = minev; ci < maxev ; ci+=4){ |
// for (Int_t ci = minev; ci < maxev ; ci+=4){ |
273 |
// |
Int_t ci = minev; |
274 |
|
while ( ci < maxev ){ |
275 |
|
//scorre i pacchetti di 4 in 4 (cioe scorre le calibrazioni) |
276 |
Int_t incalrms = 0; |
Int_t incalrms = 0; |
277 |
Int_t outcalrms = 0; |
Int_t outcalrms = 0; |
278 |
Int_t totcalbad = 0; |
Int_t totcalbad = 0; |
284 |
Int_t outcalvar = 0; |
Int_t outcalvar = 0; |
285 |
Int_t incalbas = 0; |
Int_t incalbas = 0; |
286 |
Int_t outcalbas = 0; |
Int_t outcalbas = 0; |
287 |
// |
//dall'albero calibheader, cerco obt dell cpu |
288 |
for ( Int_t s=0 ; s<4 ;s++ ){ |
// cpuhe->GetEntry(ci/4); |
289 |
tr->GetEntry(ci+s); |
hi++; |
290 |
calib.iev = ce->iev; |
// cpuobt=ch->GetPscuHeader()->GetOrbitalTime(); |
291 |
// |
cpuobt=cpuhead[hi]; |
292 |
// |
obt0=0; |
293 |
|
obt1=0; |
294 |
|
obt2=0; |
295 |
|
obt3=0; |
296 |
|
// |
297 |
|
calib.iev=0; |
298 |
|
memset(calib.cstwerr,0,4*sizeof(Int_t)); |
299 |
|
memset(calib.cperror,0,4*sizeof(Float_t)); |
300 |
|
memset(calib.calped,0,2*22*96*sizeof(Float_t)); |
301 |
|
memset(calib.calgood,0,2*22*96*sizeof(Float_t)); |
302 |
|
memset(calib.calrms,0,2*22*96*sizeof(Float_t)); |
303 |
|
memset(calib.calpuls,0,2*22*96*sizeof(Float_t)); |
304 |
|
memset(calib.calthr,0,2*22*6*sizeof(Float_t)); |
305 |
|
memset(calib.calvar,0,2*22*6*sizeof(Float_t)); |
306 |
|
memset(calib.calbase,0,2*22*6*sizeof(Float_t)); |
307 |
|
// |
308 |
|
//inizio loop su i 4 pacchetti per ogni calibrazione (scorre 4 successivi) |
309 |
|
// for ( Int_t s=0 ; s<4 ;s++ ){ |
310 |
|
Int_t s = 0; |
311 |
|
obt = cpuhead[hi]; |
312 |
|
// printf(" qui cpu header : %i hi %i entry %i \n",obt,hi,ci); |
313 |
|
while ( labs((Int_t)(obt-cpuhead[hi])) < 100000 && ci < maxev){ |
314 |
|
|
315 |
|
tr->GetEntry(ci);//sceglie la entry (calibrazione)del tree in cui ho tutte le sottostrutture |
316 |
|
// tr->GetEntry(ci+s);//sceglie la entry (calibrazione)del tree in cui ho tutte le sottostrutture |
317 |
|
|
318 |
|
//trovo l'OBT della entry (pacchetto) |
319 |
|
obt=eh->GetPscuHeader()->GetOrbitalTime();//cerca orbitaltime all'interno di Pscu |
320 |
// |
// |
321 |
cestw = 0; |
//printf(" qui pkt header : %i \n",obt); |
322 |
if ( ce->cstwerr[s] ){ |
|
323 |
cestw = ce->cstwerr[s] & cmask ; |
ci++; |
324 |
ver[s][16]++; |
|
325 |
}; |
if ( labs((Int_t)(obt-cpuhead[hi])) < 100000 ){ |
326 |
if ( cestw ){ |
|
327 |
if ( cestw & (1 << 0) ) ver[s][6]++ ; |
// s++; |
328 |
if ( cestw & (1 << 1) ) ver[s][5]++ ; |
if ( ce->cstwerr[0] ) s = 0; |
329 |
if ( cestw & (1 << 2) ) ver[s][4]++ ; |
if ( ce->cstwerr[1] ) s = 1; |
330 |
if ( cestw & (1 << 3) ) ver[s][3]++ ; |
if ( ce->cstwerr[2] ) s = 2; |
331 |
if ( cestw & (1 << 4) ) ver[s][2]++ ; |
if ( ce->cstwerr[3] ) s = 3; |
332 |
if ( cestw & (1 << 5) ) ver[s][1]++ ; |
//printf(" qua pkt header : %i s = %i hi %i \n",obt,s,hi); |
333 |
if ( cestw & (1 << 6) ) ver[s][0]++ ; |
// |
334 |
}; |
calib.iev = ce->iev; |
335 |
if ( ce->cperror[s] != 0. ){ |
cestw = 0; |
336 |
if (ce->cperror[s] == 128) ver[s][7]++ ; |
//cstwerr e' tutto l'header della sezione, mi interessano gli ultimi 2 Byte(errori del calorimetro) |
337 |
if (ce->cperror[s] == 129) ver[s][8]++ ; |
if ( ce->cstwerr[s] ){ |
338 |
if (ce->cperror[s] == 130) { |
cestw = ce->cstwerr[s] & cmask ; //confronto con la maschera per tenere solo gli |
339 |
ver[s][9]++ ; |
ver[s][16]++;// ultimi 2 Byte (assegnati a cestw) |
|
ver[s][16]--; |
|
340 |
}; |
}; |
341 |
if (ce->cperror[s] == 132) ver[s][11]++ ; |
if ( cestw ){//errori dal calorimetro |
342 |
if (ce->cperror[s] == 140) ver[s][19]++ ; |
if ( cestw & (1 << 0) ) ver[s][6]++ ;//spostati di uno e confronto se diverso 0 |
343 |
if (ce->cperror[s] == 141) ver[s][20]++ ; |
if ( cestw & (1 << 1) ) ver[s][5]++ ; |
344 |
if (ce->cperror[s] == 142) ver[s][22]++ ; |
if ( cestw & (1 << 2) ) ver[s][4]++ ; |
345 |
}; |
if ( cestw & (1 << 3) ) ver[s][3]++ ; |
346 |
// |
if ( cestw & (1 << 4) ) ver[s][2]++ ; |
347 |
for ( Int_t d=0 ; d<11 ;d++ ){ |
if ( cestw & (1 << 5) ) ver[s][1]++ ; |
348 |
Int_t pre = -1; |
if ( cestw & (1 << 6) ) ver[s][0]++ ; |
349 |
for ( Int_t j=0; j<96 ;j++){ |
}; |
350 |
if ( j%16 == 0 ) pre++; |
if ( ce->cperror[s] != 0. ){//errori dallo spacchettamento |
351 |
if ( s == 2 ){ |
if (ce->cperror[s] == 128) ver[s][7]++ ; |
352 |
calib.calped[0][2*d+1][j] = ce->calped[3][d][j]; |
if (ce->cperror[s] == 129) ver[s][8]++ ; |
353 |
calib.cstwerr[3] = ce->cstwerr[3]; |
if (ce->cperror[s] == 130) { |
354 |
calib.cperror[3] = ce->cperror[3]; |
ver[s][9]++ ; |
355 |
calib.calgood[0][2*d+1][j] = ce->calgood[3][d][j]; |
ver[s][16]--; |
|
calib.calthr[0][2*d+1][pre] = ce->calthr[3][d][pre]; |
|
|
calib.calrms[0][2*d+1][j] = ce->calrms[3][d][j]; |
|
|
calib.calbase[0][2*d+1][pre] = ce->calbase[3][d][pre]; |
|
|
calib.calvar[0][2*d+1][pre] = ce->calvar[3][d][pre]; |
|
|
}; |
|
|
if ( s == 3 ){ |
|
|
calib.calped[0][2*d][j] = ce->calped[1][d][j]; |
|
|
calib.cstwerr[1] = ce->cstwerr[1]; |
|
|
calib.cperror[1] = ce->cperror[1]; |
|
|
calib.calgood[0][2*d][j] = ce->calgood[1][d][j]; |
|
|
calib.calthr[0][2*d][pre] = ce->calthr[1][d][pre]; |
|
|
calib.calrms[0][2*d][j] = ce->calrms[1][d][j]; |
|
|
calib.calbase[0][2*d][pre] = ce->calbase[1][d][pre]; |
|
|
calib.calvar[0][2*d][pre] = ce->calvar[1][d][pre]; |
|
|
}; |
|
|
if ( s == 0 ){ |
|
|
calib.calped[1][2*d][j] = ce->calped[0][d][j]; |
|
|
calib.cstwerr[0] = ce->cstwerr[0]; |
|
|
calib.cperror[0] = ce->cperror[0]; |
|
|
calib.calgood[1][2*d][j] = ce->calgood[0][d][j]; |
|
|
calib.calthr[1][2*d][pre] = ce->calthr[0][d][pre]; |
|
|
calib.calrms[1][2*d][j] = ce->calrms[0][d][j]; |
|
|
calib.calbase[1][2*d][pre] = ce->calbase[0][d][pre]; |
|
|
calib.calvar[1][2*d][pre] = ce->calvar[0][d][pre]; |
|
|
}; |
|
|
if ( s == 1 ){ |
|
|
calib.calped[1][2*d+1][j] = ce->calped[2][d][j]; |
|
|
calib.cstwerr[2] = ce->cstwerr[2]; |
|
|
calib.cperror[2] = ce->cperror[2]; |
|
|
calib.calgood[1][2*d+1][j] = ce->calgood[2][d][j]; |
|
|
calib.calthr[1][2*d+1][pre] = ce->calthr[2][d][pre]; |
|
|
calib.calrms[1][2*d+1][j] = ce->calrms[2][d][j]; |
|
|
calib.calbase[1][2*d+1][pre] = ce->calbase[2][d][pre]; |
|
|
calib.calvar[1][2*d+1][pre] = ce->calvar[2][d][pre]; |
|
356 |
}; |
}; |
357 |
|
if (ce->cperror[s] == 132) ver[s][11]++ ; |
358 |
|
if (ce->cperror[s] == 140) ver[s][19]++ ; |
359 |
|
if (ce->cperror[s] == 141) ver[s][20]++ ; |
360 |
|
if (ce->cperror[s] == 142) ver[s][22]++ ; |
361 |
}; |
}; |
362 |
|
//lato oscuro :p |
363 |
|
for ( Int_t d=0 ; d<11 ;d++ ){ |
364 |
|
Int_t pre = -1; |
365 |
|
for ( Int_t j=0; j<96 ;j++){ |
366 |
|
if ( j%16 == 0 ) pre++; |
367 |
|
if ( s == 2 ){ |
368 |
|
//aggiungo obt del pacchetto che sta leggendo(obt) |
369 |
|
obt2=obt; |
370 |
|
calib.calped[0][2*d+1][j] = ce->calped[3][d][j]; |
371 |
|
calib.cstwerr[3] = ce->cstwerr[3]; |
372 |
|
calib.cperror[3] = ce->cperror[3]; |
373 |
|
calib.calgood[0][2*d+1][j] = ce->calgood[3][d][j]; |
374 |
|
calib.calthr[0][2*d+1][pre] = ce->calthr[3][d][pre]; |
375 |
|
calib.calrms[0][2*d+1][j] = ce->calrms[3][d][j]; |
376 |
|
calib.calbase[0][2*d+1][pre] = ce->calbase[3][d][pre]; |
377 |
|
calib.calvar[0][2*d+1][pre] = ce->calvar[3][d][pre]; |
378 |
|
}; |
379 |
|
if ( s == 3 ){ |
380 |
|
obt3=obt; |
381 |
|
calib.calped[0][2*d][j] = ce->calped[1][d][j]; |
382 |
|
calib.cstwerr[1] = ce->cstwerr[1]; |
383 |
|
calib.cperror[1] = ce->cperror[1]; |
384 |
|
calib.calgood[0][2*d][j] = ce->calgood[1][d][j]; |
385 |
|
calib.calthr[0][2*d][pre] = ce->calthr[1][d][pre]; |
386 |
|
calib.calrms[0][2*d][j] = ce->calrms[1][d][j]; |
387 |
|
calib.calbase[0][2*d][pre] = ce->calbase[1][d][pre]; |
388 |
|
calib.calvar[0][2*d][pre] = ce->calvar[1][d][pre]; |
389 |
|
}; |
390 |
|
if ( s == 0 ){ |
391 |
|
obt0=obt; |
392 |
|
calib.calped[1][2*d][j] = ce->calped[0][d][j]; |
393 |
|
calib.cstwerr[0] = ce->cstwerr[0]; |
394 |
|
calib.cperror[0] = ce->cperror[0]; |
395 |
|
calib.calgood[1][2*d][j] = ce->calgood[0][d][j]; |
396 |
|
calib.calthr[1][2*d][pre] = ce->calthr[0][d][pre]; |
397 |
|
calib.calrms[1][2*d][j] = ce->calrms[0][d][j]; |
398 |
|
calib.calbase[1][2*d][pre] = ce->calbase[0][d][pre]; |
399 |
|
calib.calvar[1][2*d][pre] = ce->calvar[0][d][pre]; |
400 |
|
}; |
401 |
|
if ( s == 1 ){ |
402 |
|
obt1=obt; |
403 |
|
calib.calped[1][2*d+1][j] = ce->calped[2][d][j]; |
404 |
|
calib.cstwerr[2] = ce->cstwerr[2]; |
405 |
|
calib.cperror[2] = ce->cperror[2]; |
406 |
|
calib.calgood[1][2*d+1][j] = ce->calgood[2][d][j]; |
407 |
|
calib.calthr[1][2*d+1][pre] = ce->calthr[2][d][pre]; |
408 |
|
calib.calrms[1][2*d+1][j] = ce->calrms[2][d][j]; |
409 |
|
calib.calbase[1][2*d+1][pre] = ce->calbase[2][d][pre]; |
410 |
|
calib.calvar[1][2*d+1][pre] = ce->calvar[2][d][pre]; |
411 |
|
}; |
412 |
|
|
413 |
|
}; |
414 |
|
};//chiuso for su si(sezioni) |
415 |
|
} else { |
416 |
|
ci--; |
417 |
}; |
}; |
418 |
}; |
};//chiuso for su ci(eventi) |
|
// |
|
|
// Book the histograms: |
|
419 |
// |
// |
420 |
|
//fine CHECK |
421 |
|
|
422 |
// |
// |
423 |
Int_t i = (ci-minev)/4; |
// Book the histograms: |
424 |
|
// Int_t i = (ci-minev)/4; |
425 |
|
Int_t i = hi; |
426 |
xviewev.str(""); |
xviewev.str(""); |
427 |
xviewev << "x-view event " << (i+1); |
xviewev << "x-view event " << (i+1); |
428 |
yviewev.str(""); |
yviewev.str(""); |
429 |
yviewev << "y-view event " << (i+1); |
yviewev << "y-view event " << (i+1); |
430 |
TH2F *Xview = new TH2F(xviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); |
TH2F *Xview = new TH2F(xviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); |
431 |
TH2F *Yview = new TH2F(yviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); |
TH2F *Yview = new TH2F(yviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); |
432 |
// |
|
433 |
// figures: |
|
434 |
// |
|
435 |
|
//prepara gli istogrammi figures: |
436 |
gDirectory->Delete("C14"); |
gDirectory->Delete("C14"); |
437 |
gDirectory->Delete("C15"); |
gDirectory->Delete("C15"); |
438 |
gDirectory->Delete("C16"); |
gDirectory->Delete("C16"); |
439 |
//TH1F *calped = new TH1F("C14","calped",4230,-3.5,4227.5); |
//TH1F *calped = new TH1F("C14","calped",4230,-3.5,4227.5); |
440 |
// TH1F *calrms = new TH1F("C15","calrms",4230,-3.5,4228.5); |
// TH1F *calrms = new TH1F("C15","calrms",4230,-3.5,4228.5); |
441 |
TH1F *calped = new TH1F("C14","calped",2112,-3.5,4227.5); |
TH1F *calped = new TH1F("C14","C14 calped",2112,-3.5,4227.5); //istogramma unidimensionale con valori float |
442 |
// TH1F *calrms = new TH1F("C15","calrms",264,-2.,4226.); |
// TH1F *calrms = new TH1F("C15","calrms",264,-2.,4226.); |
443 |
TH1F *calrms = new TH1F("C15","calrms",2112,-3.5,4228.5); |
TH1F *calrms = new TH1F("C15","C15 calrms",2112,-3.5,4228.5); |
444 |
TH1F *calbad = new TH1F("C16","calgood",4230,-3.5,4228.5); |
TH1F *calbad = new TH1F("C16","C16 calgood",4230,-3.5,4228.5); |
445 |
// |
// |
446 |
gDirectory->Delete("C17"); |
gDirectory->Delete("C17"); |
447 |
gDirectory->Delete("C18"); |
gDirectory->Delete("C18"); |
448 |
gDirectory->Delete("C19"); |
gDirectory->Delete("C19"); |
449 |
TH1F *calthr = new TH1F("C17","calthr",271,-4.5,268.5); |
TH1F *calthr = new TH1F("C17","C17 calthr",271,-4.5,268.5); |
450 |
TH1F *calvar = new TH1F("C18","calvar",271,-4.5,268.5); |
TH1F *calvar = new TH1F("C18","C18 calvar",271,-4.5,268.5); |
451 |
TH1F *calbase = new TH1F("C19","calbase",271,-4.5,268.5); |
TH1F *calbase = new TH1F("C19","C19 calbase",271,-4.5,268.5); |
452 |
// |
// |
453 |
Int_t bgcolor = 10; |
Int_t bgcolor = 10; |
454 |
TPad *pd1 = 0; |
TPad *pd1 = 0; |
455 |
TPad *pd2 = 0; |
TPad *pd2 = 0; |
456 |
TPad *palette = 0; |
TPad *palette = 0; |
457 |
TLatex *t=new TLatex(); |
TLatex *t=new TLatex(); |
458 |
if ( figmatra ){ |
|
459 |
|
// |
460 |
|
//pagina visualizzata solo se ci sono problemi |
461 |
|
if ( figmatra ){//figmatra e' variabile in ingresso in main |
462 |
figura2 = new TCanvas("Calorimeter:_strip_RMS", "Calorimeter:_strip_RMS", 750, 650); |
figura2 = new TCanvas("Calorimeter:_strip_RMS", "Calorimeter:_strip_RMS", 750, 650); |
463 |
figura2->SetFillColor(10); |
figura2->SetFillColor(10); |
464 |
figura2->Range(0,0,100,100); |
figura2->Range(0,0,100,100); |
548 |
}; |
}; |
549 |
// |
// |
550 |
// run over views and planes |
// run over views and planes |
551 |
// |
//verifica quali strip sono state utilizzate per la calibrazione |
552 |
Int_t j = 0; |
Int_t j = 0; |
553 |
Int_t g = 0; |
Int_t g = 0; |
554 |
gStyle->SetOptStat(""); |
gStyle->SetOptStat(""); |
555 |
for (Int_t m = 0; m < 22; m++){ |
for (Int_t m = 0; m < 22; m++){//loop sui piani |
556 |
for (Int_t l = 0; l < 2; l++){ |
for (Int_t l = 0; l < 2; l++){//loop x y |
557 |
for (Int_t n = 0; n < 96; n++){ |
for (Int_t n = 0; n < 96; n++){ //loop sulle strip |
558 |
// |
//controlla quante strip hanno piedistallo fuori dai limiti (escludendo quelle difettose) |
559 |
calped->Fill((float)j,calib.calped[l][m][n]); |
calped->Fill((float)j,calib.calped[l][m][n]); |
560 |
if ( (calib.calped[l][m][n] > 700. || calib.calped[l][m][n] < -700.) && (j < 4032 || j > 4048) ){ |
if ( (calib.calped[l][m][n] > 700. || calib.calped[l][m][n] < -700.) && (j < 4032 || j > 4048) ){ |
561 |
outcalped++; |
outcalped++; |
562 |
} else { |
} else { |
563 |
incalped++; |
incalped++; |
564 |
}; |
}; |
565 |
|
//controlla quali strip hanno rms fuori dai limiti (ponendo un limite diverso(piu' alto) per quelle difettose |
566 |
calrms->Fill((float)j,(calib.calrms[l][m][n]/4.)); |
calrms->Fill((float)j,(calib.calrms[l][m][n]/4.)); |
567 |
if ( (((calib.calrms[l][m][n]/4.) > 7. || (calib.calrms[l][m][n]/4.) < 1.) && (j < 3440 || j > 3550)) || ( (j > 3439 && j < 3551) && ((calib.calrms[l][m][n]/4.) > 150. || (calib.calrms[l][m][n]/4.) < 1.)) ){ |
if ( (((calib.calrms[l][m][n]/4.) > 10. || (calib.calrms[l][m][n]/4.) < 1.) && (j < 3440 || j > 3550)) || ( (j > 3439 && j < 3551) && ((calib.calrms[l][m][n]/4.) > 150. || (calib.calrms[l][m][n]/4.) < 1.)) ){ |
568 |
outcalrms++; |
outcalrms++; |
569 |
} else { |
} else { |
570 |
incalrms++; |
incalrms++; |
571 |
}; |
};//controlla (conta) quali strip sono state escluse dalla calibrazione |
572 |
calbad->Fill((float)j,(float)calib.calgood[l][m][n]); |
calbad->Fill((float)j,(float)calib.calgood[l][m][n]); |
573 |
if ( calib.calgood[l][m][n] ) totcalbad++; |
if ( calib.calgood[l][m][n] ) totcalbad++;//strip(orientazione(l),piano(m),numero(n))e' nulla, aumenta il |
574 |
// |
// |
575 |
|
//preamplificatori(soglia max di calvar portata a 9, prima era 8) |
576 |
if ( n < 6 ){ |
if ( n < 6 ){ |
577 |
calthr->Fill((float)g,(float)calib.calthr[l][m][n]); |
calthr->Fill((float)g,(float)calib.calthr[l][m][n]);//controlla quali strip hanno soglia al difuori del limite(esclude) |
578 |
if ( (calib.calthr[l][m][n] > 21. || calib.calthr[l][m][n] < 12.) && (g < 215 || g > 221) ){ |
//(quelle difettose) |
579 |
|
if ( (calib.calthr[l][m][n] > 25. || calib.calthr[l][m][n] < 12.) && (g < 215 || g > 221) ){ |
580 |
outcalthr++; |
outcalthr++; |
581 |
} else { |
} else { |
582 |
incalthr++; |
incalthr++; |
583 |
}; |
}; |
584 |
calvar->Fill((float)g,(float)calib.calvar[l][m][n]); |
calvar->Fill((float)g,(float)calib.calvar[l][m][n]);//controlla la varianza (esclude le difettose) |
585 |
if ( (calib.calvar[l][m][n] > 8. || calib.calvar[l][m][n] < 1. ) && (g < 215 || g > 221) ){ |
if ( (calib.calvar[l][m][n] > 9. || calib.calvar[l][m][n] < 1. ) && (g < 215 || g > 221) ){ |
586 |
outcalvar++; |
outcalvar++; |
587 |
} else { |
} else { |
588 |
incalvar++; |
incalvar++; |
589 |
}; |
}; |
590 |
calbase->Fill((float)g,(float)calib.calbase[l][m][n]); |
calbase->Fill((float)g,(float)calib.calbase[l][m][n]);//controlla baseline |
591 |
if ( calib.calbase[l][m][n] > 4500. || calib.calbase[l][m][n] < 2000. ){ |
if ( calib.calbase[l][m][n] > 4500. || calib.calbase[l][m][n] < 2000. ){ |
592 |
outcalbas++; |
outcalbas++; |
593 |
} else { |
} else { |
594 |
incalbas++; |
incalbas++; |
595 |
}; |
}; |
596 |
g++; |
g++;//contatore preamplificatoripassa alla strip successiva (0-286) |
597 |
}; |
}; |
598 |
// |
// |
599 |
j++; |
j++;//contatore strip |
600 |
// |
|
601 |
|
//istogrammi (solo se ci sono stati problemi) |
602 |
if ( figmatra ){ |
if ( figmatra ){ |
603 |
figura2->cd(); |
figura2->cd(); |
604 |
xviewev.str(""); |
xviewev.str(""); |
611 |
yviewev << " event " << n; |
yviewev << " event " << n; |
612 |
yviewev << " " << m; |
yviewev << " " << m; |
613 |
yviewev << " " << l; |
yviewev << " " << l; |
614 |
TH2F *Xview = new TH2F(xviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); |
TH2F *Xview = new TH2F(xviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);//istogramma 2d |
615 |
TH2F *Yview = new TH2F(yviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); |
TH2F *Yview = new TH2F(yviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); |
616 |
if ( calib.calrms[l][m][n] > 0 ){ |
if ( calib.calrms[l][m][n] > 0 ){ |
617 |
Xview->SetFillColor(38); |
Xview->SetFillColor(38); |
651 |
pd2->cd(); |
pd2->cd(); |
652 |
Yview->Draw("box same"); |
Yview->Draw("box same"); |
653 |
}; |
}; |
654 |
}; |
};//fine istogrammi |
655 |
}; |
};//fine loop strip per piano |
656 |
}; |
};//fine loop x y |
657 |
}; |
};//fine loop piani |
658 |
|
|
659 |
|
//disega la figura |
660 |
if ( figmatra ){ |
if ( figmatra ){ |
661 |
figura2->cd(); |
figura2->cd(); |
662 |
gStyle->SetOptStat(""); |
gStyle->SetOptStat(""); |
676 |
pd2->Update(); |
pd2->Update(); |
677 |
figura2->Update(); |
figura2->Update(); |
678 |
}; |
}; |
679 |
|
//fine pagina visualizzata solo se ci sono problemi |
680 |
// |
// |
681 |
figura1 = new TCanvas("Calorimeter_calped_calrms_calgood", "Calorimeter_calped_calrms_calgood", 750, 950); |
|
682 |
|
//Prepara le finestre |
683 |
|
//finestra con figure C14,C15,C16 |
684 |
|
figura1 = new TCanvas("Calorimeter_calped_calrms_calgood", "Calorimeter_calped_calrms_calgood", 750, 950);//nuova finestra |
685 |
figura1->SetFillColor(10); |
figura1->SetFillColor(10); |
686 |
figura1->Range(0,0,100,100); |
figura1->Range(0,0,100,100); |
687 |
// |
// |
688 |
ccalped = (float)incalped/((float)outcalped + (float)incalped); |
ccalped = (float)incalped/((float)outcalped + (float)incalped); |
689 |
Int_t f1pd1col = 10; |
Int_t f1pd1col = 10;//costante=10 |
690 |
if ( ccalped < ccalpedthr ) { |
if ( ccalped < ccalpedthr ) { //se % strip con piedistallo buono < numero minimo segna soglia |
691 |
check = true; |
check = true; //flag per segnalare errori |
692 |
f1pd1col = 45; |
f1pd1col = 45; // (se ci sono problemi, cambia colore) |
693 |
}; |
}; |
694 |
// |
// |
695 |
ccalrms = (float)incalrms/((float)outcalrms + (float)incalrms); |
ccalrms = (float)incalrms/((float)outcalrms + (float)incalrms); |
696 |
Int_t f1pd2col = 10; |
Int_t f1pd2col = 10; |
697 |
if ( ccalrms < ccalrmsthr ) { |
if ( ccalrms < ccalrmsthr ) { //se % strip con rms buono< numero minimo segna errore |
698 |
check = true; |
check = true; |
699 |
f1pd2col = 45; |
f1pd2col = 45; |
700 |
}; |
}; |
701 |
// |
// |
702 |
ccalbad = (float)totcalbad/4224.; |
ccalbad = (float)totcalbad/4224.; |
703 |
Int_t f1pd3col = 10; |
Int_t f1pd3col = 10; |
704 |
if ( ccalbad > ccalbadthr ) { |
if ( ccalbad > ccalbadthr ) { //se il numero di strip escluse dalla calibrazione e' troppo alto segna errore |
705 |
check = true; |
check = true; |
706 |
f1pd3col = 45; |
f1pd3col = 45; |
707 |
}; |
}; |
708 |
// |
// |
709 |
TPad *f1pd1 = new TPad("f1pd1","This is f1pad1",0.02,0.684,0.98,0.95,f1pd1col); |
TPad *f1pd1 = new TPad("f1pd1","This is f1pad1",0.02,0.684,0.98,0.95,f1pd1col);//prepara le pad di figura1 |
710 |
TPad *f1pd2 = new TPad("f1pd2","This is f1pad2",0.02,0.367,0.98,0.634,f1pd2col); |
TPad *f1pd2 = new TPad("f1pd2","This is f1pad2",0.02,0.367,0.98,0.634,f1pd2col); |
711 |
TPad *f1pd3 = new TPad("f1pd3","This is f1pad3",0.02,0.05,0.98,0.317,f1pd3col); |
TPad *f1pd3 = new TPad("f1pd3","This is f1pad3",0.02,0.05,0.98,0.317,f1pd3col); |
712 |
figura1->Clear(); |
figura1->Clear(); |
718 |
f1pd2->Draw(); |
f1pd2->Draw(); |
719 |
f1pd3->Draw(); |
f1pd3->Draw(); |
720 |
figura1->Draw(); |
figura1->Draw(); |
721 |
|
|
722 |
|
//finestra con figure C17,C18,C19 |
723 |
figura3 = new TCanvas("Calorimeter_calthr_calvar_calbase", "Calorimeter_calthr_calvar_calbase", 750, 950); |
figura3 = new TCanvas("Calorimeter_calthr_calvar_calbase", "Calorimeter_calthr_calvar_calbase", 750, 950); |
724 |
figura3->SetFillColor(10); |
figura3->SetFillColor(10); |
725 |
figura3->Range(0,0,100,100); |
figura3->Range(0,0,100,100); |
726 |
// |
// |
727 |
ccalthr = (float)incalthr/((float)outcalthr + (float)incalthr); |
ccalthr = (float)incalthr/((float)outcalthr + (float)incalthr); |
728 |
Int_t f3pd1col = 10; |
Int_t f3pd1col = 10; |
729 |
if ( ccalthr < ccalthrthr ) { |
if ( ccalthr < ccalthrthr ) { //controlla % strip fuori soglia |
730 |
check = true; |
check = true; |
731 |
f3pd1col = 45; |
f3pd1col = 45; |
732 |
}; |
}; |
733 |
// |
// |
734 |
ccalvar = (float)incalvar/((float)outcalvar + (float)incalvar); |
ccalvar = (float)incalvar/((float)outcalvar + (float)incalvar); |
735 |
Int_t f3pd2col = 10; |
Int_t f3pd2col = 10; |
736 |
if ( ccalvar < ccalvarthr ) { |
if ( ccalvar < ccalvarthr ) { //controlla strip con varianza fuori dai limiti |
737 |
check = true; |
check = true; |
738 |
f3pd2col = 45; |
f3pd2col = 45; |
739 |
}; |
}; |
740 |
// |
// |
741 |
ccalbas = (float)incalbas/((float)outcalbas + (float)incalbas); |
ccalbas = (float)incalbas/((float)outcalbas + (float)incalbas); |
742 |
Int_t f3pd3col = 10; |
Int_t f3pd3col = 10; |
743 |
if ( ccalbas < ccalbasthr ) { |
if ( ccalbas < ccalbasthr ) { //controlla strip con baseline fuori dai limiti |
744 |
check = true; |
check = true; |
745 |
f3pd3col = 45; |
f3pd3col = 45; |
746 |
}; |
}; |
747 |
// |
// |
748 |
TPad *f3pd1 = new TPad("f3pd1","This is f3pad1",0.02,0.684,0.98,0.95,f3pd1col); |
TPad *f3pd1 = new TPad("f3pd1","This is f3pad1",0.02,0.684,0.98,0.95,f3pd1col);//prepara le pad di figura 3 |
749 |
TPad *f3pd2 = new TPad("f3pd2","This is f3pad2",0.02,0.367,0.98,0.634,f3pd2col); |
TPad *f3pd2 = new TPad("f3pd2","This is f3pad2",0.02,0.367,0.98,0.634,f3pd2col); |
750 |
TPad *f3pd3 = new TPad("f3pd3","This is f3pad3",0.02,0.05,0.98,0.317,f3pd3col); |
TPad *f3pd3 = new TPad("f3pd3","This is f3pad3",0.02,0.05,0.98,0.317,f3pd3col); |
751 |
figura3->Clear(); |
figura3->Clear();//cancella tutto in figura 3 |
752 |
figura3->cd(); |
figura3->cd(); |
753 |
f3pd1->SetTicks(); |
f3pd1->SetTicks(); |
754 |
f3pd2->SetTicks(); |
f3pd2->SetTicks(); |
757 |
f3pd2->Draw(); |
f3pd2->Draw(); |
758 |
f3pd3->Draw(); |
f3pd3->Draw(); |
759 |
figura3->Draw(); |
figura3->Draw(); |
760 |
// |
|
761 |
|
|
762 |
|
//mette i titoli nella figura 1 |
763 |
gStyle->SetOptStat("N"); |
gStyle->SetOptStat("N"); |
764 |
figura1->cd(); |
figura1->cd(); |
765 |
gStyle->SetNdivisions(322,"x"); |
gStyle->SetNdivisions(322,"x"); |
773 |
titolo << file; |
titolo << file; |
774 |
titolo << " - calibration number "; |
titolo << " - calibration number "; |
775 |
titolo << (i+1); |
titolo << (i+1); |
776 |
t->DrawLatex(0.5,97.,titolo.str().c_str()); |
sottotitolo.str(""); |
777 |
|
sottotitolo << "CPU OBT:" <<cpuobt; |
778 |
|
sottotitolo << " | OBT pk1:" <<obt0; |
779 |
|
sottotitolo << " - OBT pk2:"<<obt1; |
780 |
|
sottotitolo << " - OBT pk3:"<<obt2; |
781 |
|
sottotitolo << " - OBT pk4:"<<obt3; |
782 |
|
t->DrawLatex(0.5,98.,titolo.str().c_str()); |
783 |
|
t->SetTextSize(0.02); |
784 |
|
t->DrawLatex(0.5,96.,sottotitolo.str().c_str()); |
785 |
t->SetTextSize(0.03); |
t->SetTextSize(0.03); |
|
f1pd1->cd(); |
|
786 |
// |
// |
787 |
|
f1pd1->cd(); |
788 |
|
//titoli al grafico calped |
789 |
calped->GetXaxis()->SetNdivisions(322); |
calped->GetXaxis()->SetNdivisions(322); |
790 |
calped->SetXTitle("strip"); |
calped->SetXTitle("strip"); |
791 |
calped->SetYTitle("ADC channels"); |
calped->SetYTitle("ADC channels"); |
792 |
calped->SetMaximum(3000.); |
calped->SetMaximum(3000.); |
793 |
calped->SetMinimum(-3000.); |
calped->SetMinimum(-3000.); |
794 |
|
//disegna istogramma calped |
795 |
calped->Draw(); |
calped->Draw(); |
796 |
|
//disegna la banda di accettazione |
797 |
TPolyLine *banda1; |
TPolyLine *banda1; |
798 |
Double_t xc[4] = {0.,4224.,4224.,0.}; |
Double_t xc[4] = {0.,4224.,4224.,0.}; |
799 |
Double_t yc[4] = {-700.,-700.,700.,700.}; |
Double_t yc[4] = {-700.,-700.,700.,700.}; |
802 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
803 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
804 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
805 |
|
//banda per le strip difettose |
806 |
TPolyLine *banda2; |
TPolyLine *banda2; |
807 |
Double_t xc2[4] = {4031.5,4047.5,4047.5,4031.5}; |
Double_t xc2[4] = {4031.5,4047.5,4047.5,4031.5}; |
808 |
// Double_t yc2[4] = {-2500.,-2500.,28000.,28000.}; |
// Double_t yc2[4] = {-2500.,-2500.,28000.,28000.}; |
812 |
banda2->SetFillColor(5); |
banda2->SetFillColor(5); |
813 |
banda2->SetLineWidth(1); |
banda2->SetLineWidth(1); |
814 |
banda2->Draw("fSAME"); |
banda2->Draw("fSAME"); |
815 |
|
|
816 |
calped->Draw("SAME"); |
calped->Draw("SAME"); |
817 |
|
// |
818 |
f1pd2->cd(); |
f1pd2->cd(); |
819 |
|
//prepara grafico calrms |
820 |
f1pd2->SetLogy(); |
f1pd2->SetLogy(); |
821 |
calrms->GetXaxis()->SetNdivisions(322); |
calrms->GetXaxis()->SetNdivisions(322); |
822 |
|
//disegna istogramma calrms |
823 |
calrms->Draw(); |
calrms->Draw(); |
824 |
|
//banda di accettazione |
825 |
Double_t xd[4] = {0.,4224.,4224.,0.}; |
Double_t xd[4] = {0.,4224.,4224.,0.}; |
826 |
Double_t yd[4] = {1.,1.,7.,7.}; |
Double_t yd[4] = {1.,1.,10.,10.}; |
827 |
banda1 = new TPolyLine(4,xd,yd); |
banda1 = new TPolyLine(4,xd,yd); |
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 |
|
|
833 |
Float_t minrm = calrms->GetMinimum(); |
Float_t minrm = calrms->GetMinimum(); |
834 |
Float_t maxrm = calrms->GetMaximum(); |
Float_t maxrm = calrms->GetMaximum(); |
835 |
Double_t xrm2[4] = {3449.,3551.,3551.,3449.}; |
Double_t xrm2[4] = {3449.,3551.,3551.,3449.}; |
836 |
Double_t yrm2[4] = {minrm,minrm,maxrm,maxrm}; |
Double_t yrm2[4] = {minrm,minrm,maxrm,maxrm}; |
837 |
|
//banda per strip difettose |
838 |
banda2 = new TPolyLine(4,xrm2,yrm2); |
banda2 = new TPolyLine(4,xrm2,yrm2); |
839 |
banda2->SetLineColor(5); |
banda2->SetLineColor(5); |
840 |
banda2->SetFillColor(5); |
banda2->SetFillColor(5); |
841 |
banda2->SetLineWidth(1); |
banda2->SetLineWidth(1); |
842 |
banda2->Draw("fSAME"); |
banda2->Draw("fSAME"); |
843 |
|
|
844 |
calrms->SetXTitle("strip"); |
calrms->SetXTitle("strip"); |
845 |
calrms->SetYTitle("ADC channels"); |
calrms->SetYTitle("ADC channels"); |
846 |
|
|
847 |
calrms->Draw("SAME"); |
calrms->Draw("SAME"); |
848 |
|
//prepara grafico calbad |
849 |
f1pd3->cd(); |
f1pd3->cd(); |
850 |
gStyle->SetNdivisions(344,"x"); |
gStyle->SetNdivisions(344,"x"); |
851 |
calbad->GetXaxis()->SetNdivisions(322); |
calbad->GetXaxis()->SetNdivisions(322); |
852 |
|
//disegna calbad |
853 |
calbad->Draw(); |
calbad->Draw(); |
854 |
calbad->SetXTitle("strip"); |
calbad->SetXTitle("strip"); |
855 |
calbad->SetYTitle("0=good 255=bad"); |
calbad->SetYTitle("0=good 255=bad"); |
856 |
|
// |
857 |
f1pd1->Update(); |
f1pd1->Update(); |
858 |
f1pd2->Update(); |
f1pd2->Update(); |
859 |
f1pd3->Update(); |
f1pd3->Update(); |
860 |
figura1->Update(); |
figura1->Update(); |
861 |
// |
// |
862 |
|
|
863 |
|
|
864 |
|
//pagina con figure C17,C18,C19 |
865 |
figura3->cd(); |
figura3->cd(); |
866 |
gStyle->SetNdivisions(644,"x"); |
gStyle->SetNdivisions(644,"x"); |
867 |
t=new TLatex(); |
t=new TLatex(); |
874 |
titolo << file; |
titolo << file; |
875 |
titolo << " - calibration number "; |
titolo << " - calibration number "; |
876 |
titolo << (i+1); |
titolo << (i+1); |
877 |
t->DrawLatex(0.5,97.,titolo.str().c_str()); |
t->DrawLatex(0.5,98.,titolo.str().c_str()); |
878 |
|
t->SetTextSize(0.02); |
879 |
|
t->DrawLatex(0.5,96.,sottotitolo.str().c_str()); |
880 |
t->SetTextSize(0.03); |
t->SetTextSize(0.03); |
881 |
// |
// |
882 |
f3pd1->cd(); |
f3pd1->cd(); |
885 |
calthr->SetYTitle("ADC channels"); |
calthr->SetYTitle("ADC channels"); |
886 |
calthr->Draw(); |
calthr->Draw(); |
887 |
Double_t xe[4] = {0.,264.,264.,0.}; |
Double_t xe[4] = {0.,264.,264.,0.}; |
888 |
Double_t ye[4] = {12.,12.,21.,21.}; |
Double_t ye[4] = {12.,12.,25.,25.}; |
889 |
banda1 = new TPolyLine(4,xe,ye); |
banda1 = new TPolyLine(4,xe,ye); |
890 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
891 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
892 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
893 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
894 |
// |
|
895 |
minrm = calthr->GetMinimum(); |
minrm = calthr->GetMinimum(); |
896 |
maxrm = 1.05*calthr->GetMaximum(); |
maxrm = 1.05*calthr->GetMaximum(); |
897 |
Double_t xth2[4] = {215.,221.,221.,215.}; |
Double_t xth2[4] = {215.,221.,221.,215.}; |
903 |
banda2->Draw("fSAME"); |
banda2->Draw("fSAME"); |
904 |
// |
// |
905 |
calthr->Draw("SAME"); |
calthr->Draw("SAME"); |
906 |
|
|
907 |
|
|
908 |
f3pd2->cd(); |
f3pd2->cd(); |
909 |
// gPad->SetLogy(); |
// gPad->SetLogy(); |
910 |
|
//banda di soglia per calvar portata a 9, prima era a 8) |
911 |
|
calvar->SetMaximum(25.); |
912 |
calvar->GetXaxis()->SetNdivisions(644); |
calvar->GetXaxis()->SetNdivisions(644); |
913 |
calvar->SetXTitle("pre-amplifier"); |
calvar->SetXTitle("pre-amplifier"); |
914 |
calvar->SetYTitle("ADC channels"); |
calvar->SetYTitle("ADC channels"); |
915 |
calvar->Draw(); |
calvar->Draw(); |
916 |
Double_t xt[4] = {0.,264.,264.,0.}; |
Double_t xt[4] = {0.,264.,264.,0.}; |
917 |
Double_t yt[4] = {1.,1.,8.,8.}; |
Double_t yt[4] = {1.,1.,9.,9.}; |
918 |
banda1 = new TPolyLine(4,xt,yt); |
banda1 = new TPolyLine(4,xt,yt); |
919 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
920 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
921 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
922 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
923 |
// |
|
924 |
minrm = calvar->GetMinimum(); |
minrm = calvar->GetMinimum(); |
925 |
maxrm = 1.05*calvar->GetMaximum(); |
maxrm = 1.05*calvar->GetMaximum(); |
926 |
Double_t xva2[4] = {215.,221.,221.,215.}; |
Double_t xva2[4] = {215.,221.,221.,215.}; |
932 |
banda2->Draw("fSAME"); |
banda2->Draw("fSAME"); |
933 |
// |
// |
934 |
calvar->Draw("SAME"); |
calvar->Draw("SAME"); |
935 |
|
|
936 |
|
|
937 |
f3pd3->cd(); |
f3pd3->cd(); |
938 |
calbase->GetXaxis()->SetNdivisions(644); |
calbase->GetXaxis()->SetNdivisions(644); |
939 |
calbase->SetXTitle("pre-amplifier"); |
calbase->SetXTitle("pre-amplifier"); |
947 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
948 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
949 |
calbase->Draw("SAME"); |
calbase->Draw("SAME"); |
950 |
|
// |
951 |
f3pd1->Update(); |
f3pd1->Update(); |
952 |
f3pd2->Update(); |
f3pd2->Update(); |
953 |
f3pd3->Update(); |
f3pd3->Update(); |
954 |
figura3->Update(); |
figura3->Update(); |
955 |
// |
// |
956 |
|
//file output |
957 |
if ( !strcmp(format,"ps") ) { |
if ( !strcmp(format,"ps") ) { |
|
if ( ci == minev ) { |
|
|
figsave.str(""); |
|
|
figsave << outdir << "/" ; |
|
|
figsave << figrec << "_CaloCHKCALIB."; |
|
|
figsave << format; |
|
|
figsave << "("; |
|
|
}; |
|
958 |
if ( figmatra ) { |
if ( figmatra ) { |
959 |
figura2->Print(figsave.str().c_str(),"Portrait"); |
figura2->Print(figsave.str().c_str(),"Portrait"); |
960 |
if ( ci == minev ) { |
if ( ci == minev ) { |
1006 |
gSystem->Sleep(10); |
gSystem->Sleep(10); |
1007 |
}; |
}; |
1008 |
}; |
}; |
1009 |
}; |
};//fine del loop sulle calibrazioni |
1010 |
// |
// |
1011 |
// |
// |
1012 |
// |
// |
1075 |
t->SetTextAlign(12); |
t->SetTextAlign(12); |
1076 |
t->DrawLatex(33.,97.,sezione); |
t->DrawLatex(33.,97.,sezione); |
1077 |
t->SetTextSize(0.05); |
t->SetTextSize(0.05); |
1078 |
|
|
1079 |
|
//scorre ver cercando il j tipo di errore: 'si'=sezione |
1080 |
for (Int_t j = 0; j < 23; j++){ |
for (Int_t j = 0; j < 23; j++){ |
1081 |
if ( ver[si][j] ) { |
if ( ver[si][j] ) {//controlla se le sezioni di ver[si][j] sonoe diverse da zero. |
1082 |
t->SetTextColor(50); |
t->SetTextColor(50); //controlla quali sono !=0 e assegna il rispettivo errore |
1083 |
if (j == 0) { |
if (j == 0) {//del calorimetro |
1084 |
errore.str(""); |
errore.str(""); |
1085 |
errore << "* DSP ack error: " << ver[si][j]; |
errore << "* DSP ack error: " << ver[si][j]; |
1086 |
errore << " time(s)"; |
errore << " time(s)"; |
1087 |
t->DrawLatex(2.,30.,errore.str().c_str()); |
t->DrawLatex(2.,30.,errore.str().c_str()); |
1088 |
check = true; |
check = true; |
1089 |
} |
} |
1090 |
if (j == 1) { |
if (j == 1) {//calorimetro |
1091 |
errore.str(""); |
errore.str(""); |
1092 |
errore << "* Temperature alarm: " << ver[si][j]; |
errore << "* Temperature alarm: " << ver[si][j]; |
1093 |
errore << " time(s)"; |
errore << " time(s)"; |
1094 |
t->DrawLatex(2.,74.,errore.str().c_str()); |
t->DrawLatex(2.,74.,errore.str().c_str()); |
1095 |
check = true; |
check = true; |
1096 |
} |
} |
1097 |
if (j == 2) { |
if (j == 2) {//calorimetro |
1098 |
errore.str(""); |
errore.str(""); |
1099 |
errore << "* Latch up alarm: " << ver[si][j]; |
errore << "* Latch up alarm: " << ver[si][j]; |
1100 |
errore << " time(s)."; |
errore << " time(s)."; |
1101 |
t->DrawLatex(2.,65.,errore.str().c_str()); |
t->DrawLatex(2.,65.,errore.str().c_str()); |
1102 |
check = true; |
check = true; |
1103 |
} |
} |
1104 |
if (j == 3) { |
if (j == 3) {//calorimetro |
1105 |
errore.str(""); |
errore.str(""); |
1106 |
errore << "RAW mode: " << ver[si][j]; |
errore << "RAW mode: " << ver[si][j]; |
1107 |
errore << " time(s)"; |
errore << " time(s)"; |
1108 |
t->SetTextColor(38); |
t->SetTextColor(38); |
1109 |
t->DrawLatex(2.,90.,errore.str().c_str()); |
t->DrawLatex(2.,90.,errore.str().c_str()); |
1110 |
} |
} |
1111 |
if (j == 4) { |
if (j == 4) {//calorimetro |
1112 |
errore.str(""); |
errore.str(""); |
1113 |
errore << "* CMD length error: " << ver[si][j]; |
errore << "* CMD length error: " << ver[si][j]; |
1114 |
errore << " time(s)"; |
errore << " time(s)"; |
1115 |
t->DrawLatex(2.,66.,errore.str().c_str()); |
t->DrawLatex(2.,66.,errore.str().c_str()); |
1116 |
check = true; |
check = true; |
1117 |
} |
} |
1118 |
if (j == 5) { |
if (j == 5) {//calorimetro |
1119 |
errore.str(""); |
errore.str(""); |
1120 |
errore << "* Execution error: " << ver[si][j]; |
errore << "* Execution error: " << ver[si][j]; |
1121 |
errore << " time(s)"; |
errore << " time(s)"; |
1122 |
t->DrawLatex(2.,62.,errore.str().c_str()); |
t->DrawLatex(2.,62.,errore.str().c_str()); |
1123 |
check = true; |
check = true; |
1124 |
} |
} |
1125 |
if (j == 6) { |
if (j == 6) {//calorimetro |
1126 |
errore.str(""); |
errore.str(""); |
1127 |
errore << "* CRC error (st. word): " << ver[si][j]; |
errore << "* CRC error (st. word): " << ver[si][j]; |
1128 |
errore << " time(s)"; |
errore << " time(s)"; |
1193 |
t->SetTextSize(0.035); |
t->SetTextSize(0.035); |
1194 |
t->SetTextAlign(12); |
t->SetTextAlign(12); |
1195 |
t->DrawLatex(7.,95.,"Calorimeter CALIBRATION quick look: "); |
t->DrawLatex(7.,95.,"Calorimeter CALIBRATION quick look: "); |
1196 |
//printf("vediamo: ccalped %f ccalrms %f ccalbad %f ccalthr %f ccalvar %f ccalbas %f \n",ccalped,ccalrms,ccalbad,ccalthr,ccalvar,ccalbas); |
printf(" ccalped %f ccalrms %f ccalbad %f ccalthr %f ccalvar %f ccalbas %f \n",ccalped,ccalrms,ccalbad,ccalthr,ccalvar,ccalbas); |
1197 |
|
|
1198 |
|
|
1199 |
if ( check ) { |
if ( check ) { |
1200 |
t->SetTextColor(50); |
t->SetTextColor(50); |
1201 |
t->DrawLatex(65.,95.,"WARNING, CHECK!"); |
t->DrawLatex(65.,95.,"WARNING, CHECK!"); |
1230 |
printf("\n"); |
printf("\n"); |
1231 |
return; |
return; |
1232 |
} |
} |
1233 |
|
|