| 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 |
|
cpuhe->SetBranchAddress("Header",&ch); |
| 197 |
// |
// |
| 198 |
Long64_t ncalibs = tr->GetEntries(); |
Long64_t ncalibs = tr->GetEntries();//cerca il ramo Entries (calibrazioni) |
| 199 |
if ( ncalibs == 0 ){ |
if ( ncalibs == 0 ){ |
| 200 |
printf(" No calibrations in this files! \n Exiting... \n"); |
printf(" No calibrations in this files! \n Exiting... \n"); |
| 201 |
return; |
return; |
| 203 |
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); |
| 204 |
Long64_t minev = 0; |
Long64_t minev = 0; |
| 205 |
Long64_t maxev = ncalibs; |
Long64_t maxev = ncalibs; |
| 206 |
if ( calibnumber ){ |
if ( calibnumber ){//calibnumber e' in ingresso nel main |
| 207 |
minev = (calibnumber - 1)* 4; |
minev = (calibnumber - 1)* 4; |
| 208 |
maxev = minev + 4; |
maxev = minev + 4; |
| 209 |
}; |
}; |
| 210 |
TCanvas *figura1; |
TCanvas *figura1;//finestra grafica che posso suddividere in piu' aree (pads) |
| 211 |
TCanvas *figura2 = 0; |
TCanvas *figura2 = 0; |
| 212 |
TCanvas *figura3; |
TCanvas *figura3; |
| 213 |
TCanvas *rapporto = 0; |
TCanvas *rapporto = 0; |
| 214 |
Int_t cmask = 127 ; |
Int_t cmask = 127 ;//maschera per selezionare i Byte di errore dall'header |
| 215 |
Int_t cestw = 0; |
Int_t cestw = 0; //variabile per contenere i Byte di errore del calorimetro estratti dall'header |
| 216 |
Int_t ver[4][23]; |
Int_t ver[4][23]; //variabile per riportare gli errori(22) su ogni sezione (4) |
| 217 |
// |
|
| 218 |
|
//azzera ver |
| 219 |
for (Int_t k = 0; k < 4; k++ ){ |
for (Int_t k = 0; k < 4; k++ ){ |
| 220 |
for (Int_t m = 0; m < 23 ; m++ ){ |
for (Int_t m = 0; m < 23 ; m++ ){ |
| 221 |
ver[k][m] = 0 ; |
ver[k][m] = 0 ; |
| 237 |
// |
// |
| 238 |
const char *outdir = outDir; |
const char *outdir = outDir; |
| 239 |
const char *format = saveas; |
const char *format = saveas; |
| 240 |
stringstream figsave; |
stringstream figsave; //definisco stringhe i/o |
| 241 |
stringstream figsave1; |
stringstream figsave1; |
| 242 |
stringstream figsave2; |
stringstream figsave2; |
| 243 |
// |
// |
| 244 |
|
|
| 245 |
|
//-----------------inizio CHECK per ricerca errori dal calorimetro------------------- |
| 246 |
// to check or not to check? this is the problem... |
// to check or not to check? this is the problem... |
| 247 |
|
|
| 248 |
|
Bool_t check = false;//azzera flag presenza errori |
| 249 |
|
|
| 250 |
// |
// |
| 251 |
Bool_t check = false; |
//inizio loop su tutti gli header degli eventi di calibrazione |
|
// |
|
| 252 |
for (Int_t ci = minev; ci < maxev ; ci+=4){ |
for (Int_t ci = minev; ci < maxev ; ci+=4){ |
| 253 |
// |
//scorre i pacchetti di 4 in 4 (cioe scorre le calibrazioni) |
| 254 |
Int_t incalrms = 0; |
Int_t incalrms = 0; |
| 255 |
Int_t outcalrms = 0; |
Int_t outcalrms = 0; |
| 256 |
Int_t totcalbad = 0; |
Int_t totcalbad = 0; |
| 262 |
Int_t outcalvar = 0; |
Int_t outcalvar = 0; |
| 263 |
Int_t incalbas = 0; |
Int_t incalbas = 0; |
| 264 |
Int_t outcalbas = 0; |
Int_t outcalbas = 0; |
| 265 |
// |
//dall'albero calibheader, cerco obt dell cpu |
| 266 |
|
cpuhe->GetEntry(ci/4); |
| 267 |
|
cpuobt=ch->GetPscuHeader()->GetOrbitalTime(); |
| 268 |
|
obt0=0; |
| 269 |
|
obt1=0; |
| 270 |
|
obt2=0; |
| 271 |
|
obt3=0; |
| 272 |
|
|
| 273 |
|
//inizio loop su i 4 pacchetti per ogni calibrazione (scorre 4 successivi) |
| 274 |
for ( Int_t s=0 ; s<4 ;s++ ){ |
for ( Int_t s=0 ; s<4 ;s++ ){ |
| 275 |
tr->GetEntry(ci+s); |
|
| 276 |
|
tr->GetEntry(ci+s);//sceglie la entry (calibrazione)del tree in cui ho tutte le sottostrutture |
| 277 |
|
|
| 278 |
|
|
| 279 |
|
//trovo l'OBT della entry (pacchetto) |
| 280 |
|
obt=eh->GetPscuHeader()->GetOrbitalTime();//cerca orbitaltime all'interno di Pscu |
| 281 |
|
/// |
| 282 |
|
|
| 283 |
|
|
| 284 |
calib.iev = ce->iev; |
calib.iev = ce->iev; |
|
// |
|
|
// |
|
|
// |
|
| 285 |
cestw = 0; |
cestw = 0; |
| 286 |
|
//cstwerr e' tutto l'header della sezione, mi interessano gli ultimi 2 Byte(errori del calorimetro) |
| 287 |
if ( ce->cstwerr[s] ){ |
if ( ce->cstwerr[s] ){ |
| 288 |
cestw = ce->cstwerr[s] & cmask ; |
cestw = ce->cstwerr[s] & cmask ; //confronto con la maschera per tenere solo gli |
| 289 |
ver[s][16]++; |
ver[s][16]++;// ultimi 2 Byte (assegnati a cestw) |
| 290 |
}; |
}; |
| 291 |
if ( cestw ){ |
if ( cestw ){//errori dal calorimetro |
| 292 |
if ( cestw & (1 << 0) ) ver[s][6]++ ; |
if ( cestw & (1 << 0) ) ver[s][6]++ ;//spostati di uno e confronto se diverso 0 |
| 293 |
if ( cestw & (1 << 1) ) ver[s][5]++ ; |
if ( cestw & (1 << 1) ) ver[s][5]++ ; |
| 294 |
if ( cestw & (1 << 2) ) ver[s][4]++ ; |
if ( cestw & (1 << 2) ) ver[s][4]++ ; |
| 295 |
if ( cestw & (1 << 3) ) ver[s][3]++ ; |
if ( cestw & (1 << 3) ) ver[s][3]++ ; |
| 297 |
if ( cestw & (1 << 5) ) ver[s][1]++ ; |
if ( cestw & (1 << 5) ) ver[s][1]++ ; |
| 298 |
if ( cestw & (1 << 6) ) ver[s][0]++ ; |
if ( cestw & (1 << 6) ) ver[s][0]++ ; |
| 299 |
}; |
}; |
| 300 |
if ( ce->cperror[s] != 0. ){ |
if ( ce->cperror[s] != 0. ){//errori dallo spacchettamento |
| 301 |
if (ce->cperror[s] == 128) ver[s][7]++ ; |
if (ce->cperror[s] == 128) ver[s][7]++ ; |
| 302 |
if (ce->cperror[s] == 129) ver[s][8]++ ; |
if (ce->cperror[s] == 129) ver[s][8]++ ; |
| 303 |
if (ce->cperror[s] == 130) { |
if (ce->cperror[s] == 130) { |
| 309 |
if (ce->cperror[s] == 141) ver[s][20]++ ; |
if (ce->cperror[s] == 141) ver[s][20]++ ; |
| 310 |
if (ce->cperror[s] == 142) ver[s][22]++ ; |
if (ce->cperror[s] == 142) ver[s][22]++ ; |
| 311 |
}; |
}; |
| 312 |
// |
//lato oscuro :p |
| 313 |
for ( Int_t d=0 ; d<11 ;d++ ){ |
for ( Int_t d=0 ; d<11 ;d++ ){ |
| 314 |
Int_t pre = -1; |
Int_t pre = -1; |
| 315 |
for ( Int_t j=0; j<96 ;j++){ |
for ( Int_t j=0; j<96 ;j++){ |
| 316 |
if ( j%16 == 0 ) pre++; |
if ( j%16 == 0 ) pre++; |
| 317 |
if ( s == 2 ){ |
if ( s == 2 ){ |
| 318 |
|
//aggiungo obt del pacchetto che sta leggendo(obt) |
| 319 |
|
obt2=obt; |
| 320 |
calib.calped[0][2*d+1][j] = ce->calped[3][d][j]; |
calib.calped[0][2*d+1][j] = ce->calped[3][d][j]; |
| 321 |
calib.cstwerr[3] = ce->cstwerr[3]; |
calib.cstwerr[3] = ce->cstwerr[3]; |
| 322 |
calib.cperror[3] = ce->cperror[3]; |
calib.cperror[3] = ce->cperror[3]; |
| 327 |
calib.calvar[0][2*d+1][pre] = ce->calvar[3][d][pre]; |
calib.calvar[0][2*d+1][pre] = ce->calvar[3][d][pre]; |
| 328 |
}; |
}; |
| 329 |
if ( s == 3 ){ |
if ( s == 3 ){ |
| 330 |
|
obt3=obt; |
| 331 |
calib.calped[0][2*d][j] = ce->calped[1][d][j]; |
calib.calped[0][2*d][j] = ce->calped[1][d][j]; |
| 332 |
calib.cstwerr[1] = ce->cstwerr[1]; |
calib.cstwerr[1] = ce->cstwerr[1]; |
| 333 |
calib.cperror[1] = ce->cperror[1]; |
calib.cperror[1] = ce->cperror[1]; |
| 338 |
calib.calvar[0][2*d][pre] = ce->calvar[1][d][pre]; |
calib.calvar[0][2*d][pre] = ce->calvar[1][d][pre]; |
| 339 |
}; |
}; |
| 340 |
if ( s == 0 ){ |
if ( s == 0 ){ |
| 341 |
|
obt0=obt; |
| 342 |
calib.calped[1][2*d][j] = ce->calped[0][d][j]; |
calib.calped[1][2*d][j] = ce->calped[0][d][j]; |
| 343 |
calib.cstwerr[0] = ce->cstwerr[0]; |
calib.cstwerr[0] = ce->cstwerr[0]; |
| 344 |
calib.cperror[0] = ce->cperror[0]; |
calib.cperror[0] = ce->cperror[0]; |
| 349 |
calib.calvar[1][2*d][pre] = ce->calvar[0][d][pre]; |
calib.calvar[1][2*d][pre] = ce->calvar[0][d][pre]; |
| 350 |
}; |
}; |
| 351 |
if ( s == 1 ){ |
if ( s == 1 ){ |
| 352 |
|
obt1=obt; |
| 353 |
calib.calped[1][2*d+1][j] = ce->calped[2][d][j]; |
calib.calped[1][2*d+1][j] = ce->calped[2][d][j]; |
| 354 |
calib.cstwerr[2] = ce->cstwerr[2]; |
calib.cstwerr[2] = ce->cstwerr[2]; |
| 355 |
calib.cperror[2] = ce->cperror[2]; |
calib.cperror[2] = ce->cperror[2]; |
| 360 |
calib.calvar[1][2*d+1][pre] = ce->calvar[2][d][pre]; |
calib.calvar[1][2*d+1][pre] = ce->calvar[2][d][pre]; |
| 361 |
}; |
}; |
| 362 |
}; |
}; |
| 363 |
}; |
};//chiuso for su si(sezioni) |
| 364 |
}; |
};//chiuso for su ci(eventi) |
|
// |
|
|
// Book the histograms: |
|
| 365 |
// |
// |
| 366 |
|
//fine CHECK |
| 367 |
|
|
| 368 |
// |
// |
| 369 |
|
// Book the histograms: |
| 370 |
Int_t i = (ci-minev)/4; |
Int_t i = (ci-minev)/4; |
| 371 |
xviewev.str(""); |
xviewev.str(""); |
| 372 |
xviewev << "x-view event " << (i+1); |
xviewev << "x-view event " << (i+1); |
| 374 |
yviewev << "y-view event " << (i+1); |
yviewev << "y-view event " << (i+1); |
| 375 |
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); |
| 376 |
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); |
| 377 |
// |
|
| 378 |
// figures: |
|
| 379 |
// |
|
| 380 |
|
//prepara gli istogrammi figures: |
| 381 |
gDirectory->Delete("C14"); |
gDirectory->Delete("C14"); |
| 382 |
gDirectory->Delete("C15"); |
gDirectory->Delete("C15"); |
| 383 |
gDirectory->Delete("C16"); |
gDirectory->Delete("C16"); |
| 384 |
//TH1F *calped = new TH1F("C14","calped",4230,-3.5,4227.5); |
//TH1F *calped = new TH1F("C14","calped",4230,-3.5,4227.5); |
| 385 |
// TH1F *calrms = new TH1F("C15","calrms",4230,-3.5,4228.5); |
// TH1F *calrms = new TH1F("C15","calrms",4230,-3.5,4228.5); |
| 386 |
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 |
| 387 |
// TH1F *calrms = new TH1F("C15","calrms",264,-2.,4226.); |
// TH1F *calrms = new TH1F("C15","calrms",264,-2.,4226.); |
| 388 |
TH1F *calrms = new TH1F("C15","calrms",2112,-3.5,4228.5); |
TH1F *calrms = new TH1F("C15","C15 calrms",2112,-3.5,4228.5); |
| 389 |
TH1F *calbad = new TH1F("C16","calgood",4230,-3.5,4228.5); |
TH1F *calbad = new TH1F("C16","C16 calgood",4230,-3.5,4228.5); |
| 390 |
// |
// |
| 391 |
gDirectory->Delete("C17"); |
gDirectory->Delete("C17"); |
| 392 |
gDirectory->Delete("C18"); |
gDirectory->Delete("C18"); |
| 393 |
gDirectory->Delete("C19"); |
gDirectory->Delete("C19"); |
| 394 |
TH1F *calthr = new TH1F("C17","calthr",271,-4.5,268.5); |
TH1F *calthr = new TH1F("C17","C17 calthr",271,-4.5,268.5); |
| 395 |
TH1F *calvar = new TH1F("C18","calvar",271,-4.5,268.5); |
TH1F *calvar = new TH1F("C18","C18 calvar",271,-4.5,268.5); |
| 396 |
TH1F *calbase = new TH1F("C19","calbase",271,-4.5,268.5); |
TH1F *calbase = new TH1F("C19","C19 calbase",271,-4.5,268.5); |
| 397 |
// |
// |
| 398 |
Int_t bgcolor = 10; |
Int_t bgcolor = 10; |
| 399 |
TPad *pd1 = 0; |
TPad *pd1 = 0; |
| 400 |
TPad *pd2 = 0; |
TPad *pd2 = 0; |
| 401 |
TPad *palette = 0; |
TPad *palette = 0; |
| 402 |
TLatex *t=new TLatex(); |
TLatex *t=new TLatex(); |
| 403 |
if ( figmatra ){ |
|
| 404 |
|
// |
| 405 |
|
//pagina visualizzata solo se ci sono problemi |
| 406 |
|
if ( figmatra ){//figmatra e' variabile in ingresso in main |
| 407 |
figura2 = new TCanvas("Calorimeter:_strip_RMS", "Calorimeter:_strip_RMS", 750, 650); |
figura2 = new TCanvas("Calorimeter:_strip_RMS", "Calorimeter:_strip_RMS", 750, 650); |
| 408 |
figura2->SetFillColor(10); |
figura2->SetFillColor(10); |
| 409 |
figura2->Range(0,0,100,100); |
figura2->Range(0,0,100,100); |
| 493 |
}; |
}; |
| 494 |
// |
// |
| 495 |
// run over views and planes |
// run over views and planes |
| 496 |
// |
//verifica quali strip sono state utilizzate per la calibrazione |
| 497 |
Int_t j = 0; |
Int_t j = 0; |
| 498 |
Int_t g = 0; |
Int_t g = 0; |
| 499 |
gStyle->SetOptStat(""); |
gStyle->SetOptStat(""); |
| 500 |
for (Int_t m = 0; m < 22; m++){ |
for (Int_t m = 0; m < 22; m++){//loop sui piani |
| 501 |
for (Int_t l = 0; l < 2; l++){ |
for (Int_t l = 0; l < 2; l++){//loop x y |
| 502 |
for (Int_t n = 0; n < 96; n++){ |
for (Int_t n = 0; n < 96; n++){ //loop sulle strip |
| 503 |
// |
//controlla quante strip hanno piedistallo fuori dai limiti (escludendo quelle difettose) |
| 504 |
calped->Fill((float)j,calib.calped[l][m][n]); |
calped->Fill((float)j,calib.calped[l][m][n]); |
| 505 |
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) ){ |
| 506 |
outcalped++; |
outcalped++; |
| 507 |
} else { |
} else { |
| 508 |
incalped++; |
incalped++; |
| 509 |
}; |
}; |
| 510 |
|
//controlla quali strip hanno rms fuori dai limiti (ponendo un limite diverso(piu' alto) per quelle difettose |
| 511 |
calrms->Fill((float)j,(calib.calrms[l][m][n]/4.)); |
calrms->Fill((float)j,(calib.calrms[l][m][n]/4.)); |
| 512 |
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.)) ){ |
| 513 |
outcalrms++; |
outcalrms++; |
| 514 |
} else { |
} else { |
| 515 |
incalrms++; |
incalrms++; |
| 516 |
}; |
};//controlla (conta) quali strip sono state escluse dalla calibrazione |
| 517 |
calbad->Fill((float)j,(float)calib.calgood[l][m][n]); |
calbad->Fill((float)j,(float)calib.calgood[l][m][n]); |
| 518 |
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 |
| 519 |
// |
// |
| 520 |
|
//preamplificatori(soglia max di calvar portata a 9, prima era 8) |
| 521 |
if ( n < 6 ){ |
if ( n < 6 ){ |
| 522 |
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) |
| 523 |
if ( (calib.calthr[l][m][n] > 21. || calib.calthr[l][m][n] < 12.) && (g < 215 || g > 221) ){ |
//(quelle difettose) |
| 524 |
|
if ( (calib.calthr[l][m][n] > 25. || calib.calthr[l][m][n] < 12.) && (g < 215 || g > 221) ){ |
| 525 |
outcalthr++; |
outcalthr++; |
| 526 |
} else { |
} else { |
| 527 |
incalthr++; |
incalthr++; |
| 528 |
}; |
}; |
| 529 |
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) |
| 530 |
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) ){ |
| 531 |
outcalvar++; |
outcalvar++; |
| 532 |
} else { |
} else { |
| 533 |
incalvar++; |
incalvar++; |
| 534 |
}; |
}; |
| 535 |
calbase->Fill((float)g,(float)calib.calbase[l][m][n]); |
calbase->Fill((float)g,(float)calib.calbase[l][m][n]);//controlla baseline |
| 536 |
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. ){ |
| 537 |
outcalbas++; |
outcalbas++; |
| 538 |
} else { |
} else { |
| 539 |
incalbas++; |
incalbas++; |
| 540 |
}; |
}; |
| 541 |
g++; |
g++;//contatore preamplificatoripassa alla strip successiva (0-286) |
| 542 |
}; |
}; |
| 543 |
// |
// |
| 544 |
j++; |
j++;//contatore strip |
| 545 |
// |
|
| 546 |
|
//istogrammi (solo se ci sono stati problemi) |
| 547 |
if ( figmatra ){ |
if ( figmatra ){ |
| 548 |
figura2->cd(); |
figura2->cd(); |
| 549 |
xviewev.str(""); |
xviewev.str(""); |
| 556 |
yviewev << " event " << n; |
yviewev << " event " << n; |
| 557 |
yviewev << " " << m; |
yviewev << " " << m; |
| 558 |
yviewev << " " << l; |
yviewev << " " << l; |
| 559 |
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 |
| 560 |
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); |
| 561 |
if ( calib.calrms[l][m][n] > 0 ){ |
if ( calib.calrms[l][m][n] > 0 ){ |
| 562 |
Xview->SetFillColor(38); |
Xview->SetFillColor(38); |
| 596 |
pd2->cd(); |
pd2->cd(); |
| 597 |
Yview->Draw("box same"); |
Yview->Draw("box same"); |
| 598 |
}; |
}; |
| 599 |
}; |
};//fine istogrammi |
| 600 |
}; |
};//fine loop strip per piano |
| 601 |
}; |
};//fine loop x y |
| 602 |
}; |
};//fine loop piani |
| 603 |
|
|
| 604 |
|
//disega la figura |
| 605 |
if ( figmatra ){ |
if ( figmatra ){ |
| 606 |
figura2->cd(); |
figura2->cd(); |
| 607 |
gStyle->SetOptStat(""); |
gStyle->SetOptStat(""); |
| 621 |
pd2->Update(); |
pd2->Update(); |
| 622 |
figura2->Update(); |
figura2->Update(); |
| 623 |
}; |
}; |
| 624 |
|
//fine pagina visualizzata solo se ci sono problemi |
| 625 |
// |
// |
| 626 |
figura1 = new TCanvas("Calorimeter_calped_calrms_calgood", "Calorimeter_calped_calrms_calgood", 750, 950); |
|
| 627 |
|
//Prepara le finestre |
| 628 |
|
//finestra con figure C14,C15,C16 |
| 629 |
|
figura1 = new TCanvas("Calorimeter_calped_calrms_calgood", "Calorimeter_calped_calrms_calgood", 750, 950);//nuova finestra |
| 630 |
figura1->SetFillColor(10); |
figura1->SetFillColor(10); |
| 631 |
figura1->Range(0,0,100,100); |
figura1->Range(0,0,100,100); |
| 632 |
// |
// |
| 633 |
ccalped = (float)incalped/((float)outcalped + (float)incalped); |
ccalped = (float)incalped/((float)outcalped + (float)incalped); |
| 634 |
Int_t f1pd1col = 10; |
Int_t f1pd1col = 10;//costante=10 |
| 635 |
if ( ccalped < ccalpedthr ) { |
if ( ccalped < ccalpedthr ) { //se % strip con piedistallo buono < numero minimo segna soglia |
| 636 |
check = true; |
check = true; //flag per segnalare errori |
| 637 |
f1pd1col = 45; |
f1pd1col = 45; // (se ci sono problemi, cambia colore) |
| 638 |
}; |
}; |
| 639 |
// |
// |
| 640 |
ccalrms = (float)incalrms/((float)outcalrms + (float)incalrms); |
ccalrms = (float)incalrms/((float)outcalrms + (float)incalrms); |
| 641 |
Int_t f1pd2col = 10; |
Int_t f1pd2col = 10; |
| 642 |
if ( ccalrms < ccalrmsthr ) { |
if ( ccalrms < ccalrmsthr ) { //se % strip con rms buono< numero minimo segna errore |
| 643 |
check = true; |
check = true; |
| 644 |
f1pd2col = 45; |
f1pd2col = 45; |
| 645 |
}; |
}; |
| 646 |
// |
// |
| 647 |
ccalbad = (float)totcalbad/4224.; |
ccalbad = (float)totcalbad/4224.; |
| 648 |
Int_t f1pd3col = 10; |
Int_t f1pd3col = 10; |
| 649 |
if ( ccalbad > ccalbadthr ) { |
if ( ccalbad > ccalbadthr ) { //se il numero di strip escluse dalla calibrazione e' troppo alto segna errore |
| 650 |
check = true; |
check = true; |
| 651 |
f1pd3col = 45; |
f1pd3col = 45; |
| 652 |
}; |
}; |
| 653 |
// |
// |
| 654 |
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 |
| 655 |
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); |
| 656 |
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); |
| 657 |
figura1->Clear(); |
figura1->Clear(); |
| 663 |
f1pd2->Draw(); |
f1pd2->Draw(); |
| 664 |
f1pd3->Draw(); |
f1pd3->Draw(); |
| 665 |
figura1->Draw(); |
figura1->Draw(); |
| 666 |
|
|
| 667 |
|
//finestra con figure C17,C18,C19 |
| 668 |
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); |
| 669 |
figura3->SetFillColor(10); |
figura3->SetFillColor(10); |
| 670 |
figura3->Range(0,0,100,100); |
figura3->Range(0,0,100,100); |
| 671 |
// |
// |
| 672 |
ccalthr = (float)incalthr/((float)outcalthr + (float)incalthr); |
ccalthr = (float)incalthr/((float)outcalthr + (float)incalthr); |
| 673 |
Int_t f3pd1col = 10; |
Int_t f3pd1col = 10; |
| 674 |
if ( ccalthr < ccalthrthr ) { |
if ( ccalthr < ccalthrthr ) { //controlla % strip fuori soglia |
| 675 |
check = true; |
check = true; |
| 676 |
f3pd1col = 45; |
f3pd1col = 45; |
| 677 |
}; |
}; |
| 678 |
// |
// |
| 679 |
ccalvar = (float)incalvar/((float)outcalvar + (float)incalvar); |
ccalvar = (float)incalvar/((float)outcalvar + (float)incalvar); |
| 680 |
Int_t f3pd2col = 10; |
Int_t f3pd2col = 10; |
| 681 |
if ( ccalvar < ccalvarthr ) { |
if ( ccalvar < ccalvarthr ) { //controlla strip con varianza fuori dai limiti |
| 682 |
check = true; |
check = true; |
| 683 |
f3pd2col = 45; |
f3pd2col = 45; |
| 684 |
}; |
}; |
| 685 |
// |
// |
| 686 |
ccalbas = (float)incalbas/((float)outcalbas + (float)incalbas); |
ccalbas = (float)incalbas/((float)outcalbas + (float)incalbas); |
| 687 |
Int_t f3pd3col = 10; |
Int_t f3pd3col = 10; |
| 688 |
if ( ccalbas < ccalbasthr ) { |
if ( ccalbas < ccalbasthr ) { //controlla strip con baseline fuori dai limiti |
| 689 |
check = true; |
check = true; |
| 690 |
f3pd3col = 45; |
f3pd3col = 45; |
| 691 |
}; |
}; |
| 692 |
// |
// |
| 693 |
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 |
| 694 |
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); |
| 695 |
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); |
| 696 |
figura3->Clear(); |
figura3->Clear();//cancella tutto in figura 3 |
| 697 |
figura3->cd(); |
figura3->cd(); |
| 698 |
f3pd1->SetTicks(); |
f3pd1->SetTicks(); |
| 699 |
f3pd2->SetTicks(); |
f3pd2->SetTicks(); |
| 702 |
f3pd2->Draw(); |
f3pd2->Draw(); |
| 703 |
f3pd3->Draw(); |
f3pd3->Draw(); |
| 704 |
figura3->Draw(); |
figura3->Draw(); |
| 705 |
// |
|
| 706 |
|
|
| 707 |
|
//mette i titoli nella figura 1 |
| 708 |
gStyle->SetOptStat("N"); |
gStyle->SetOptStat("N"); |
| 709 |
figura1->cd(); |
figura1->cd(); |
| 710 |
gStyle->SetNdivisions(322,"x"); |
gStyle->SetNdivisions(322,"x"); |
| 718 |
titolo << file; |
titolo << file; |
| 719 |
titolo << " - calibration number "; |
titolo << " - calibration number "; |
| 720 |
titolo << (i+1); |
titolo << (i+1); |
| 721 |
t->DrawLatex(0.5,97.,titolo.str().c_str()); |
sottotitolo.str(""); |
| 722 |
|
sottotitolo << "CPU OBT:" <<cpuobt; |
| 723 |
|
sottotitolo << " | OBT pk1:" <<obt0; |
| 724 |
|
sottotitolo << " - OBT pk2:"<<obt1; |
| 725 |
|
sottotitolo << " - OBT pk3:"<<obt2; |
| 726 |
|
sottotitolo << " - OBT pk4:"<<obt3; |
| 727 |
|
t->DrawLatex(0.5,98.,titolo.str().c_str()); |
| 728 |
|
t->SetTextSize(0.02); |
| 729 |
|
t->DrawLatex(0.5,96.,sottotitolo.str().c_str()); |
| 730 |
t->SetTextSize(0.03); |
t->SetTextSize(0.03); |
|
f1pd1->cd(); |
|
| 731 |
// |
// |
| 732 |
|
f1pd1->cd(); |
| 733 |
|
//titoli al grafico calped |
| 734 |
calped->GetXaxis()->SetNdivisions(322); |
calped->GetXaxis()->SetNdivisions(322); |
| 735 |
calped->SetXTitle("strip"); |
calped->SetXTitle("strip"); |
| 736 |
calped->SetYTitle("ADC channels"); |
calped->SetYTitle("ADC channels"); |
| 737 |
calped->SetMaximum(3000.); |
calped->SetMaximum(3000.); |
| 738 |
calped->SetMinimum(-3000.); |
calped->SetMinimum(-3000.); |
| 739 |
|
//disegna istogramma calped |
| 740 |
calped->Draw(); |
calped->Draw(); |
| 741 |
|
//disegna la banda di accettazione |
| 742 |
TPolyLine *banda1; |
TPolyLine *banda1; |
| 743 |
Double_t xc[4] = {0.,4224.,4224.,0.}; |
Double_t xc[4] = {0.,4224.,4224.,0.}; |
| 744 |
Double_t yc[4] = {-700.,-700.,700.,700.}; |
Double_t yc[4] = {-700.,-700.,700.,700.}; |
| 747 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
| 748 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
| 749 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
| 750 |
|
//banda per le strip difettose |
| 751 |
TPolyLine *banda2; |
TPolyLine *banda2; |
| 752 |
Double_t xc2[4] = {4031.5,4047.5,4047.5,4031.5}; |
Double_t xc2[4] = {4031.5,4047.5,4047.5,4031.5}; |
| 753 |
// Double_t yc2[4] = {-2500.,-2500.,28000.,28000.}; |
// Double_t yc2[4] = {-2500.,-2500.,28000.,28000.}; |
| 757 |
banda2->SetFillColor(5); |
banda2->SetFillColor(5); |
| 758 |
banda2->SetLineWidth(1); |
banda2->SetLineWidth(1); |
| 759 |
banda2->Draw("fSAME"); |
banda2->Draw("fSAME"); |
| 760 |
|
|
| 761 |
calped->Draw("SAME"); |
calped->Draw("SAME"); |
| 762 |
|
// |
| 763 |
f1pd2->cd(); |
f1pd2->cd(); |
| 764 |
|
//prepara grafico calrms |
| 765 |
f1pd2->SetLogy(); |
f1pd2->SetLogy(); |
| 766 |
calrms->GetXaxis()->SetNdivisions(322); |
calrms->GetXaxis()->SetNdivisions(322); |
| 767 |
|
//disegna istogramma calrms |
| 768 |
calrms->Draw(); |
calrms->Draw(); |
| 769 |
|
//banda di accettazione |
| 770 |
Double_t xd[4] = {0.,4224.,4224.,0.}; |
Double_t xd[4] = {0.,4224.,4224.,0.}; |
| 771 |
Double_t yd[4] = {1.,1.,7.,7.}; |
Double_t yd[4] = {1.,1.,10.,10.}; |
| 772 |
banda1 = new TPolyLine(4,xd,yd); |
banda1 = new TPolyLine(4,xd,yd); |
| 773 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
| 774 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
| 775 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
| 776 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
| 777 |
|
|
| 778 |
Float_t minrm = calrms->GetMinimum(); |
Float_t minrm = calrms->GetMinimum(); |
| 779 |
Float_t maxrm = calrms->GetMaximum(); |
Float_t maxrm = calrms->GetMaximum(); |
| 780 |
Double_t xrm2[4] = {3449.,3551.,3551.,3449.}; |
Double_t xrm2[4] = {3449.,3551.,3551.,3449.}; |
| 781 |
Double_t yrm2[4] = {minrm,minrm,maxrm,maxrm}; |
Double_t yrm2[4] = {minrm,minrm,maxrm,maxrm}; |
| 782 |
|
//banda per strip difettose |
| 783 |
banda2 = new TPolyLine(4,xrm2,yrm2); |
banda2 = new TPolyLine(4,xrm2,yrm2); |
| 784 |
banda2->SetLineColor(5); |
banda2->SetLineColor(5); |
| 785 |
banda2->SetFillColor(5); |
banda2->SetFillColor(5); |
| 786 |
banda2->SetLineWidth(1); |
banda2->SetLineWidth(1); |
| 787 |
banda2->Draw("fSAME"); |
banda2->Draw("fSAME"); |
| 788 |
|
|
| 789 |
calrms->SetXTitle("strip"); |
calrms->SetXTitle("strip"); |
| 790 |
calrms->SetYTitle("ADC channels"); |
calrms->SetYTitle("ADC channels"); |
| 791 |
|
|
| 792 |
calrms->Draw("SAME"); |
calrms->Draw("SAME"); |
| 793 |
|
//prepara grafico calbad |
| 794 |
f1pd3->cd(); |
f1pd3->cd(); |
| 795 |
gStyle->SetNdivisions(344,"x"); |
gStyle->SetNdivisions(344,"x"); |
| 796 |
calbad->GetXaxis()->SetNdivisions(322); |
calbad->GetXaxis()->SetNdivisions(322); |
| 797 |
|
//disegna calbad |
| 798 |
calbad->Draw(); |
calbad->Draw(); |
| 799 |
calbad->SetXTitle("strip"); |
calbad->SetXTitle("strip"); |
| 800 |
calbad->SetYTitle("0=good 255=bad"); |
calbad->SetYTitle("0=good 255=bad"); |
| 801 |
|
// |
| 802 |
f1pd1->Update(); |
f1pd1->Update(); |
| 803 |
f1pd2->Update(); |
f1pd2->Update(); |
| 804 |
f1pd3->Update(); |
f1pd3->Update(); |
| 805 |
figura1->Update(); |
figura1->Update(); |
| 806 |
// |
// |
| 807 |
|
|
| 808 |
|
|
| 809 |
|
//pagina con figure C17,C18,C19 |
| 810 |
figura3->cd(); |
figura3->cd(); |
| 811 |
gStyle->SetNdivisions(644,"x"); |
gStyle->SetNdivisions(644,"x"); |
| 812 |
t=new TLatex(); |
t=new TLatex(); |
| 819 |
titolo << file; |
titolo << file; |
| 820 |
titolo << " - calibration number "; |
titolo << " - calibration number "; |
| 821 |
titolo << (i+1); |
titolo << (i+1); |
| 822 |
t->DrawLatex(0.5,97.,titolo.str().c_str()); |
t->DrawLatex(0.5,98.,titolo.str().c_str()); |
| 823 |
|
t->SetTextSize(0.02); |
| 824 |
|
t->DrawLatex(0.5,96.,sottotitolo.str().c_str()); |
| 825 |
t->SetTextSize(0.03); |
t->SetTextSize(0.03); |
| 826 |
// |
// |
| 827 |
f3pd1->cd(); |
f3pd1->cd(); |
| 830 |
calthr->SetYTitle("ADC channels"); |
calthr->SetYTitle("ADC channels"); |
| 831 |
calthr->Draw(); |
calthr->Draw(); |
| 832 |
Double_t xe[4] = {0.,264.,264.,0.}; |
Double_t xe[4] = {0.,264.,264.,0.}; |
| 833 |
Double_t ye[4] = {12.,12.,21.,21.}; |
Double_t ye[4] = {12.,12.,25.,25.}; |
| 834 |
banda1 = new TPolyLine(4,xe,ye); |
banda1 = new TPolyLine(4,xe,ye); |
| 835 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
| 836 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
| 837 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
| 838 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
| 839 |
// |
|
| 840 |
minrm = calthr->GetMinimum(); |
minrm = calthr->GetMinimum(); |
| 841 |
maxrm = 1.05*calthr->GetMaximum(); |
maxrm = 1.05*calthr->GetMaximum(); |
| 842 |
Double_t xth2[4] = {215.,221.,221.,215.}; |
Double_t xth2[4] = {215.,221.,221.,215.}; |
| 848 |
banda2->Draw("fSAME"); |
banda2->Draw("fSAME"); |
| 849 |
// |
// |
| 850 |
calthr->Draw("SAME"); |
calthr->Draw("SAME"); |
| 851 |
|
|
| 852 |
|
|
| 853 |
f3pd2->cd(); |
f3pd2->cd(); |
| 854 |
// gPad->SetLogy(); |
// gPad->SetLogy(); |
| 855 |
|
//banda di soglia per calvar portata a 9, prima era a 8) |
| 856 |
|
calvar->SetMaximum(25.); |
| 857 |
calvar->GetXaxis()->SetNdivisions(644); |
calvar->GetXaxis()->SetNdivisions(644); |
| 858 |
calvar->SetXTitle("pre-amplifier"); |
calvar->SetXTitle("pre-amplifier"); |
| 859 |
calvar->SetYTitle("ADC channels"); |
calvar->SetYTitle("ADC channels"); |
| 860 |
calvar->Draw(); |
calvar->Draw(); |
| 861 |
Double_t xt[4] = {0.,264.,264.,0.}; |
Double_t xt[4] = {0.,264.,264.,0.}; |
| 862 |
Double_t yt[4] = {1.,1.,8.,8.}; |
Double_t yt[4] = {1.,1.,9.,9.}; |
| 863 |
banda1 = new TPolyLine(4,xt,yt); |
banda1 = new TPolyLine(4,xt,yt); |
| 864 |
banda1->SetLineColor(5); |
banda1->SetLineColor(5); |
| 865 |
banda1->SetFillColor(5); |
banda1->SetFillColor(5); |
| 866 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
| 867 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
| 868 |
// |
|
| 869 |
minrm = calvar->GetMinimum(); |
minrm = calvar->GetMinimum(); |
| 870 |
maxrm = 1.05*calvar->GetMaximum(); |
maxrm = 1.05*calvar->GetMaximum(); |
| 871 |
Double_t xva2[4] = {215.,221.,221.,215.}; |
Double_t xva2[4] = {215.,221.,221.,215.}; |
| 877 |
banda2->Draw("fSAME"); |
banda2->Draw("fSAME"); |
| 878 |
// |
// |
| 879 |
calvar->Draw("SAME"); |
calvar->Draw("SAME"); |
| 880 |
|
|
| 881 |
|
|
| 882 |
f3pd3->cd(); |
f3pd3->cd(); |
| 883 |
calbase->GetXaxis()->SetNdivisions(644); |
calbase->GetXaxis()->SetNdivisions(644); |
| 884 |
calbase->SetXTitle("pre-amplifier"); |
calbase->SetXTitle("pre-amplifier"); |
| 892 |
banda1->SetLineWidth(1); |
banda1->SetLineWidth(1); |
| 893 |
banda1->Draw("fSAME"); |
banda1->Draw("fSAME"); |
| 894 |
calbase->Draw("SAME"); |
calbase->Draw("SAME"); |
| 895 |
|
// |
| 896 |
f3pd1->Update(); |
f3pd1->Update(); |
| 897 |
f3pd2->Update(); |
f3pd2->Update(); |
| 898 |
f3pd3->Update(); |
f3pd3->Update(); |
| 899 |
figura3->Update(); |
figura3->Update(); |
| 900 |
// |
// |
| 901 |
|
//file output |
| 902 |
if ( !strcmp(format,"ps") ) { |
if ( !strcmp(format,"ps") ) { |
| 903 |
if ( ci == minev ) { |
if ( ci == minev ) { |
| 904 |
figsave.str(""); |
figsave.str(""); |
| 958 |
gSystem->Sleep(10); |
gSystem->Sleep(10); |
| 959 |
}; |
}; |
| 960 |
}; |
}; |
| 961 |
}; |
};//fine del loop sulle calibrazioni |
| 962 |
// |
// |
| 963 |
// |
// |
| 964 |
// |
// |
| 1027 |
t->SetTextAlign(12); |
t->SetTextAlign(12); |
| 1028 |
t->DrawLatex(33.,97.,sezione); |
t->DrawLatex(33.,97.,sezione); |
| 1029 |
t->SetTextSize(0.05); |
t->SetTextSize(0.05); |
| 1030 |
|
|
| 1031 |
|
//scorre ver cercando il j tipo di errore: 'si'=sezione |
| 1032 |
for (Int_t j = 0; j < 23; j++){ |
for (Int_t j = 0; j < 23; j++){ |
| 1033 |
if ( ver[si][j] ) { |
if ( ver[si][j] ) {//controlla se le sezioni di ver[si][j] sonoe diverse da zero. |
| 1034 |
t->SetTextColor(50); |
t->SetTextColor(50); //controlla quali sono !=0 e assegna il rispettivo errore |
| 1035 |
if (j == 0) { |
if (j == 0) {//del calorimetro |
| 1036 |
errore.str(""); |
errore.str(""); |
| 1037 |
errore << "* DSP ack error: " << ver[si][j]; |
errore << "* DSP ack error: " << ver[si][j]; |
| 1038 |
errore << " time(s)"; |
errore << " time(s)"; |
| 1039 |
t->DrawLatex(2.,30.,errore.str().c_str()); |
t->DrawLatex(2.,30.,errore.str().c_str()); |
| 1040 |
check = true; |
check = true; |
| 1041 |
} |
} |
| 1042 |
if (j == 1) { |
if (j == 1) {//calorimetro |
| 1043 |
errore.str(""); |
errore.str(""); |
| 1044 |
errore << "* Temperature alarm: " << ver[si][j]; |
errore << "* Temperature alarm: " << ver[si][j]; |
| 1045 |
errore << " time(s)"; |
errore << " time(s)"; |
| 1046 |
t->DrawLatex(2.,74.,errore.str().c_str()); |
t->DrawLatex(2.,74.,errore.str().c_str()); |
| 1047 |
check = true; |
check = true; |
| 1048 |
} |
} |
| 1049 |
if (j == 2) { |
if (j == 2) {//calorimetro |
| 1050 |
errore.str(""); |
errore.str(""); |
| 1051 |
errore << "* Latch up alarm: " << ver[si][j]; |
errore << "* Latch up alarm: " << ver[si][j]; |
| 1052 |
errore << " time(s)."; |
errore << " time(s)."; |
| 1053 |
t->DrawLatex(2.,65.,errore.str().c_str()); |
t->DrawLatex(2.,65.,errore.str().c_str()); |
| 1054 |
check = true; |
check = true; |
| 1055 |
} |
} |
| 1056 |
if (j == 3) { |
if (j == 3) {//calorimetro |
| 1057 |
errore.str(""); |
errore.str(""); |
| 1058 |
errore << "RAW mode: " << ver[si][j]; |
errore << "RAW mode: " << ver[si][j]; |
| 1059 |
errore << " time(s)"; |
errore << " time(s)"; |
| 1060 |
t->SetTextColor(38); |
t->SetTextColor(38); |
| 1061 |
t->DrawLatex(2.,90.,errore.str().c_str()); |
t->DrawLatex(2.,90.,errore.str().c_str()); |
| 1062 |
} |
} |
| 1063 |
if (j == 4) { |
if (j == 4) {//calorimetro |
| 1064 |
errore.str(""); |
errore.str(""); |
| 1065 |
errore << "* CMD length error: " << ver[si][j]; |
errore << "* CMD length error: " << ver[si][j]; |
| 1066 |
errore << " time(s)"; |
errore << " time(s)"; |
| 1067 |
t->DrawLatex(2.,66.,errore.str().c_str()); |
t->DrawLatex(2.,66.,errore.str().c_str()); |
| 1068 |
check = true; |
check = true; |
| 1069 |
} |
} |
| 1070 |
if (j == 5) { |
if (j == 5) {//calorimetro |
| 1071 |
errore.str(""); |
errore.str(""); |
| 1072 |
errore << "* Execution error: " << ver[si][j]; |
errore << "* Execution error: " << ver[si][j]; |
| 1073 |
errore << " time(s)"; |
errore << " time(s)"; |
| 1074 |
t->DrawLatex(2.,62.,errore.str().c_str()); |
t->DrawLatex(2.,62.,errore.str().c_str()); |
| 1075 |
check = true; |
check = true; |
| 1076 |
} |
} |
| 1077 |
if (j == 6) { |
if (j == 6) {//calorimetro |
| 1078 |
errore.str(""); |
errore.str(""); |
| 1079 |
errore << "* CRC error (st. word): " << ver[si][j]; |
errore << "* CRC error (st. word): " << ver[si][j]; |
| 1080 |
errore << " time(s)"; |
errore << " time(s)"; |
| 1145 |
t->SetTextSize(0.035); |
t->SetTextSize(0.035); |
| 1146 |
t->SetTextAlign(12); |
t->SetTextAlign(12); |
| 1147 |
t->DrawLatex(7.,95.,"Calorimeter CALIBRATION quick look: "); |
t->DrawLatex(7.,95.,"Calorimeter CALIBRATION quick look: "); |
| 1148 |
//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); |
| 1149 |
|
|
| 1150 |
|
|
| 1151 |
if ( check ) { |
if ( check ) { |
| 1152 |
t->SetTextColor(50); |
t->SetTextColor(50); |
| 1153 |
t->DrawLatex(65.,95.,"WARNING, CHECK!"); |
t->DrawLatex(65.,95.,"WARNING, CHECK!"); |
| 1182 |
printf("\n"); |
printf("\n"); |
| 1183 |
return; |
return; |
| 1184 |
} |
} |
| 1185 |
|
|