| 1 | 
 // | 
 // | 
| 2 | 
 //   Check the calorimter calibrations - Emiliano Mocchiutti | 
 //   Check the calorimter calibrations - Emiliano Mocchiutti | 
| 3 | 
 // | 
 // | 
| 4 | 
 //   FCaloCHKCALIB.c      version 1.01  (2006-03-02) | 
 //   FCaloCHKCALIB.c      version 1.14  (2007-07-18) | 
| 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.14 (2007-07-18): 05953 bug fixed (infinite loop). | 
| 11 | 
  | 
 // | 
| 12 | 
  | 
 //   1.12 - 1.13 (2006-09-22): Set upper limit in calvar plot. | 
| 13 | 
  | 
 // | 
| 14 | 
  | 
 //   1.07 - 1.12 (2006-08-04): bugs fixed. | 
| 15 | 
  | 
 // | 
| 16 | 
  | 
 //   1.07 - 1.11 (2006-07-17): Adapted to flight conditions. | 
| 17 | 
  | 
 // | 
| 18 | 
  | 
 //   1.06 - 1.07 (2006-05-29): Fixed bug in output filename when input is not in the form DW_YYMMDD_NNN. Changed threshold for bad strip warning (from 0.005 to 0.03). | 
| 19 | 
  | 
 // | 
| 20 | 
  | 
 //   1.05 - 1.06 (2006-03-22): Add optimize flag in compiling the script! | 
| 21 | 
  | 
 // | 
| 22 | 
  | 
 //   1.04 - 1.05 (2006-03-22): Corrected wrong .C files. | 
| 23 | 
  | 
 // | 
| 24 | 
  | 
 //   1.03 - 1.04 (2006-03-20): Documentation updated. | 
| 25 | 
  | 
 // | 
| 26 | 
  | 
 //   1.02 - 1.03 (2006-03-20): Changed name of shared libraries (for example from FCaloQLOOK_cxx.so to libFCaloQLOOK.so). | 
| 27 | 
  | 
 // | 
| 28 | 
  | 
 //   1.01 - 1.02 (2006-03-13): Include files from YODA without "event" directory. | 
| 29 | 
  | 
 // | 
| 30 | 
 //   1.00 - 1.01 (2006-03-02): Works on YODA v6 output (single file), does not require anymore calocommon package. | 
 //   1.00 - 1.01 (2006-03-02): Works on YODA v6 output (single file), does not require anymore calocommon package. | 
| 31 | 
 // | 
 // | 
| 32 | 
 //   0.00 - 1.00 (2006-03-02): Clone of CaloCHKCALIB.c | 
 //   0.00 - 1.00 (2006-03-02): Clone of CaloCHKCALIB.c | 
| 33 | 
 // | 
 // | 
| 34 | 
 #include <iostream> | 
 #include <iostream> | 
| 35 | 
 #include <fstream> | 
 #include <fstream> | 
| 36 | 
  | 
 #include <cstdlib> | 
| 37 | 
 // | 
 // | 
| 38 | 
  | 
 #include <TROOT.h> | 
| 39 | 
 #include <TTree.h> | 
 #include <TTree.h> | 
| 40 | 
 #include <TObject.h> | 
 #include <TObject.h> | 
| 41 | 
 #include <TString.h> | 
 #include <TString.h> | 
| 49 | 
 #include <TPad.h> | 
 #include <TPad.h> | 
| 50 | 
 #include <TPaveLabel.h> | 
 #include <TPaveLabel.h> | 
| 51 | 
 #include <TStyle.h> | 
 #include <TStyle.h> | 
| 52 | 
  | 
 #include <TSystem.h> | 
| 53 | 
  | 
 #include <TApplication.h> | 
| 54 | 
 // | 
 // | 
| 55 | 
 #include <event/CalibCalPedEvent.h> | 
 #include <CalibCalPedEvent.h> | 
| 56 | 
  | 
 #include <PamelaRun.h> | 
| 57 | 
 // | 
 // | 
| 58 | 
 using namespace std; | 
 using namespace std; | 
| 59 | 
 // | 
 // | 
| 60 | 
 void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){     | 
 void stringcopy(TString& s1, const TString& s2, Int_t from=0, Int_t to=0){     | 
| 61 | 
     if ( to == 0 ){ | 
   if ( to == 0 ){ | 
| 62 | 
         Int_t t2length = s2.Length(); | 
     Int_t t2length = s2.Length(); | 
| 63 | 
         s1 = ""; | 
     s1 = ""; | 
| 64 | 
         to = t2length; | 
     to = t2length; | 
| 65 | 
     }; | 
   }; | 
| 66 | 
     for (Int_t i = from; i<to; i++){ | 
   for (Int_t i = from; i<to; i++){ | 
| 67 | 
         s1.Append(s2[i],1); | 
     s1.Append(s2[i],1); | 
| 68 | 
     }; | 
   }; | 
| 69 | 
 } | 
 } | 
| 70 | 
 void stringappend(TString& s1, const TString& s2){     | 
 void stringappend(TString& s1, const TString& s2){     | 
| 71 | 
     Int_t t2length = s2.Length(); | 
   Int_t t2length = s2.Length(); | 
| 72 | 
     for (Int_t i = 0; i<t2length; i++){ | 
   for (Int_t i = 0; i<t2length; i++){ | 
| 73 | 
         s1.Append(s2[i],1); | 
     s1.Append(s2[i],1); | 
| 74 | 
     }; | 
   }; | 
| 75 | 
 } | 
 } | 
| 76 | 
  | 
  | 
| 77 | 
 TString getFilename(const TString filename){ | 
 TString getFilename(const TString filename){ | 
| 78 | 
     const string fil = (const char*)filename; | 
   // | 
| 79 | 
     Int_t posiz = fil.find("dw_"); | 
   const string fil = gSystem->BaseName(filename.Data()); | 
| 80 | 
     if ( posiz == -1 ) posiz = fil.find("DW_"); | 
   Int_t posiz = fil.find(".root"); | 
| 81 | 
     if ( posiz == -1 ) return 0; | 
   // | 
| 82 | 
     Int_t posiz2 = posiz+13; | 
   TString file2; | 
| 83 | 
     TString file2; | 
   if ( posiz == -1 ){ | 
| 84 | 
     stringcopy(file2,filename,posiz,posiz2); | 
     file2 = gSystem->BaseName(filename.Data()); | 
| 85 | 
  | 
   } else { | 
| 86 | 
  | 
     Int_t posiz2 = 0; | 
| 87 | 
  | 
     stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); | 
| 88 | 
     TString pdat(".dat"); | 
     TString pdat(".dat"); | 
| 89 | 
     stringappend(file2,pdat); | 
     stringappend(file2,pdat);   | 
| 90 | 
     return file2; | 
   }; | 
| 91 | 
  | 
   return file2; | 
| 92 | 
 } | 
 } | 
| 93 | 
  | 
  | 
| 94 | 
 typedef struct Calib { | 
 typedef struct Calib { | 
| 95 | 
     Int_t iev; | 
   Int_t iev; | 
| 96 | 
     Int_t cstwerr[4]; | 
   Int_t cstwerr[4];//per l'header contenente lo stato del calorimetro | 
| 97 | 
     Float_t cperror[4]; | 
   Float_t cperror[4]; | 
| 98 | 
     Float_t mip[2][22][96]; | 
   Float_t mip[2][22][96];//(xy,piano,strip) | 
| 99 | 
     Float_t calped[2][22][96]; | 
   Float_t calped[2][22][96]; | 
| 100 | 
     Float_t calgood[2][22][96]; | 
   Float_t calgood[2][22][96]; | 
| 101 | 
     Float_t calthr[2][22][6]; | 
   Float_t calthr[2][22][6]; | 
| 102 | 
     Float_t calrms[2][22][96]; | 
   Float_t calrms[2][22][96]; | 
| 103 | 
     Float_t calbase[2][22][6]; | 
   Float_t calbase[2][22][6]; | 
| 104 | 
     Float_t calvar[2][22][6]; | 
   Float_t calvar[2][22][6]; | 
| 105 | 
     Float_t calpuls[2][22][96]; | 
   Float_t calpuls[2][22][96]; | 
| 106 | 
 } calib; | 
 } calib; | 
| 107 | 
  | 
  | 
| 108 | 
 void FCaloCHKCALIB(TString filename, Long64_t calibnumber = 0, TString outDir = "", Int_t figmatra = 0, TString saveas = "ps"){ | 
  | 
| 109 | 
     gStyle->SetPaperSize(19.,25.); | 
  | 
| 110 | 
  | 
 //main | 
| 111 | 
  | 
 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){ | 
| 112 | 
  | 
    | 
| 113 | 
  | 
   gStyle->SetPaperSize(19.,25.); | 
| 114 | 
  | 
   // | 
| 115 | 
  | 
   TApplication *app = 0; //crea un ambiente root (app) | 
| 116 | 
  | 
   if ( iactive ) app = new TApplication("app",0,0);//verifica se deve essere interattivo | 
| 117 | 
  | 
   // | 
| 118 | 
  | 
   //definizione delle soglie per valutare problemi nell calibrazione | 
| 119 | 
  | 
   Float_t ccalrmsthr=0.95;// numero di strip con rms entro i limiti (99%) | 
| 120 | 
  | 
   Float_t ccalpedthr=0.95;// numero di strip con piedistallo entro i limiti(99%) | 
| 121 | 
  | 
   Float_t ccalbadthr=0.03;// 0.005 numero massimo di strip non utilizzate (3%)  per calibrare | 
| 122 | 
  | 
   Float_t ccalthrthr=0.95; | 
| 123 | 
  | 
   Float_t ccalvarthr=0.95; | 
| 124 | 
  | 
   Float_t ccalbasthr=0.95; | 
| 125 | 
  | 
   // | 
| 126 | 
  | 
   Float_t ccalrms = 0.; | 
| 127 | 
  | 
   Float_t ccalped = 0.; | 
| 128 | 
  | 
   Float_t ccalbad = 0.; | 
| 129 | 
  | 
   Float_t ccalthr = 0.; | 
| 130 | 
  | 
   Float_t ccalvar = 0.; | 
| 131 | 
  | 
   Float_t ccalbas = 0.; | 
| 132 | 
  | 
   // | 
| 133 | 
  | 
   struct Calib calib; | 
| 134 | 
  | 
   stringstream titolo, sottotitolo; | 
| 135 | 
  | 
   stringstream xviewev; | 
| 136 | 
  | 
   stringstream yviewev; | 
| 137 | 
  | 
    | 
| 138 | 
  | 
   //directory di lavoro | 
| 139 | 
  | 
   const char* startingdir = gSystem->WorkingDirectory(); | 
| 140 | 
  | 
   if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; | 
| 141 | 
  | 
    | 
| 142 | 
  | 
   //nome del file  | 
| 143 | 
  | 
   TString fififile =  getFilename(filename); | 
| 144 | 
  | 
   const char *file; | 
| 145 | 
  | 
   file = fififile; | 
| 146 | 
  | 
    | 
| 147 | 
  | 
   //verifica se esiste il file | 
| 148 | 
  | 
   ifstream myfile; | 
| 149 | 
  | 
   myfile.open(filename.Data()); | 
| 150 | 
  | 
   if ( !myfile ){ | 
| 151 | 
  | 
     printf(" %s :no such file, exiting...\n\n",filename.Data()); | 
| 152 | 
  | 
     return; | 
| 153 | 
  | 
   }; | 
| 154 | 
  | 
   myfile.close(); | 
| 155 | 
  | 
 // | 
| 156 | 
  | 
  | 
| 157 | 
  | 
   //apre il file in 'File' | 
| 158 | 
  | 
   TFile *File = new TFile(filename.Data()); | 
| 159 | 
  | 
    | 
| 160 | 
  | 
   //crea struttura tree (tr) con il tree "CalibCalPed" in File | 
| 161 | 
  | 
   TTree *tr = (TTree*)File->Get("CalibCalPed"); | 
| 162 | 
  | 
   //definisco struttura tree per caricare gli header cpu | 
| 163 | 
  | 
   TTree *cpuhe = (TTree*)File->Get("CalibHeader");  | 
| 164 | 
  | 
  | 
| 165 | 
  | 
   if ( !tr ) { | 
| 166 | 
  | 
     printf(" CalibCalPed : no such tree in %s \n",filename.Data()); | 
| 167 | 
  | 
     printf(" Exiting, are you sure this is a LEVEL0 not corrupted file? \n\n"); | 
| 168 | 
  | 
     return; | 
| 169 | 
  | 
   }; | 
| 170 | 
  | 
  | 
| 171 | 
  | 
   pamela::CalibCalPedEvent *ce = 0; | 
| 172 | 
  | 
   pamela::EventHeader *eh = 0;//definisco variabili di tipo header | 
| 173 | 
  | 
   pamela::EventHeader *ch =0;//definisco la variabile per header cpu | 
| 174 | 
  | 
   //  pamela::PscuHeader *ph = 0; //definisco variabile di tipo pscu | 
| 175 | 
  | 
  | 
| 176 | 
  | 
   // | 
| 177 | 
  | 
   //UInt_t found; | 
| 178 | 
  | 
   UInt_t  cpuobt=0, obt=0, obt0=0, obt1=0, obt2=0, obt3=0; | 
| 179 | 
  | 
  | 
| 180 | 
  | 
 //  tr->SetBranchStatus("*",0,&found); //disable all branches | 
| 181 | 
  | 
 // | 
| 182 | 
  | 
 //   found = 0; | 
| 183 | 
  | 
 //   tr->SetBranchStatus("iev*",1,&found); | 
| 184 | 
  | 
 //   found = 0; | 
| 185 | 
  | 
 //   tr->SetBranchStatus("cstwerr*",1,&found); | 
| 186 | 
  | 
 //   //    printf("enabled %i branches \n",found); | 
| 187 | 
  | 
 //   found = 0; | 
| 188 | 
  | 
 //   tr->SetBranchStatus("cperror*",1,&found); | 
| 189 | 
  | 
 //   //printf("enabled %i branches \n",found); | 
| 190 | 
  | 
 //   found = 0; | 
| 191 | 
  | 
 //   tr->SetBranchStatus("cal*",1,&found); | 
| 192 | 
  | 
 //   //printf("enabled %i branches \n",found); | 
| 193 | 
  | 
 //   found = 0; | 
| 194 | 
  | 
 //   tr->SetBranchStatus("CalibCalPed*",1,&found); | 
| 195 | 
  | 
   //printf("enabled %i branches \n",found); | 
| 196 | 
  | 
   // | 
| 197 | 
  | 
   tr->SetBranchAddress("CalibCalPed", &ce);//dichiaro in che ramo trovare quello che voglio puntare con ce | 
| 198 | 
  | 
   tr->SetBranchAddress("Header", &eh);//dichiaro dove trovare quello che voglio in he | 
| 199 | 
  | 
   // | 
| 200 | 
  | 
   cpuhe->SetBranchAddress("Header",&ch); | 
| 201 | 
  | 
   // | 
| 202 | 
  | 
   Long64_t ncalibs    = tr->GetEntries();//cerca il ramo Entries (calibrazioni) | 
| 203 | 
  | 
   if ( ncalibs == 0 || cpuhe->GetEntries() == 0){ | 
| 204 | 
  | 
     printf(" No calibrations in this files! \n Exiting... \n"); | 
| 205 | 
  | 
     return; | 
| 206 | 
  | 
   }; | 
| 207 | 
  | 
   // | 
| 208 | 
  | 
   UInt_t cpuhead[1000]; | 
| 209 | 
  | 
   memset(cpuhead, 0, 1000*sizeof(UInt_t)); | 
| 210 | 
  | 
   for (Int_t i=0; i<cpuhe->GetEntries(); i++){ | 
| 211 | 
  | 
     cpuhe->GetEntry(i); | 
| 212 | 
  | 
     if ( i < 1000 ) cpuhead[i]=ch->GetPscuHeader()->GetOrbitalTime(); | 
| 213 | 
  | 
     if ( i > 1000 ){ | 
| 214 | 
  | 
       printf(" ERROR: too many calibrations in this file, cannot handle it \n Exiting... \n"); | 
| 215 | 
  | 
       return; | 
| 216 | 
  | 
     }; | 
| 217 | 
  | 
   }; | 
| 218 | 
  | 
   // | 
| 219 | 
  | 
   printf("\n This file contains %i entries which corrispond to %i calibrations \n\n",(int)ncalibs,(int)ncalibs/4); | 
| 220 | 
  | 
   Long64_t minev = 0; | 
| 221 | 
  | 
   Long64_t maxev = ncalibs; | 
| 222 | 
  | 
   if ( calibnumber ){//calibnumber e' in ingresso nel main | 
| 223 | 
  | 
     minev = (calibnumber - 1)* 4; | 
| 224 | 
  | 
     maxev = minev + 4; | 
| 225 | 
  | 
   }; | 
| 226 | 
  | 
   TCanvas *figura1;//finestra grafica che posso suddividere in piu' aree (pads) | 
| 227 | 
  | 
   TCanvas *figura2 = 0; | 
| 228 | 
  | 
   TCanvas *figura3; | 
| 229 | 
  | 
   TCanvas *rapporto = 0; | 
| 230 | 
  | 
   Int_t cmask = 127 ;//maschera per selezionare i Byte di errore dall'header | 
| 231 | 
  | 
   Int_t cestw = 0;   //variabile per contenere i Byte di errore del calorimetro estratti dall'header | 
| 232 | 
  | 
   Int_t ver[4][23];  //variabile per riportare gli errori(22) su ogni sezione (4) | 
| 233 | 
  | 
    | 
| 234 | 
  | 
   //azzera ver  | 
| 235 | 
  | 
   for (Int_t k = 0; k < 4; k++ ){ | 
| 236 | 
  | 
     for (Int_t m = 0; m < 23 ; m++ ){ | 
| 237 | 
  | 
       ver[k][m] = 0 ; | 
| 238 | 
  | 
     }; | 
| 239 | 
  | 
   }; | 
| 240 | 
  | 
   // | 
| 241 | 
  | 
   // | 
| 242 | 
  | 
   const string fil = gSystem->BaseName(filename.Data()); | 
| 243 | 
  | 
   Int_t posiz = fil.find(".root"); | 
| 244 | 
  | 
   // | 
| 245 | 
  | 
   TString file2; | 
| 246 | 
  | 
   if ( posiz == -1 ){ | 
| 247 | 
  | 
     file2 = gSystem->BaseName(filename.Data()); | 
| 248 | 
  | 
   } else { | 
| 249 | 
  | 
     Int_t posiz2 = 0; | 
| 250 | 
  | 
     stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz); | 
| 251 | 
  | 
   }; | 
| 252 | 
  | 
   const char *figrec = file2; | 
| 253 | 
  | 
   // | 
| 254 | 
  | 
   const char *outdir = outDir; | 
| 255 | 
  | 
   const char *format = saveas; | 
| 256 | 
  | 
   stringstream figsave;    //definisco stringhe i/o | 
| 257 | 
  | 
   stringstream figsave1;     | 
| 258 | 
  | 
   stringstream figsave2;     | 
| 259 | 
  | 
   if ( !strcmp(format,"ps") ) { | 
| 260 | 
  | 
     figsave.str(""); | 
| 261 | 
  | 
     figsave << outdir << "/" ; | 
| 262 | 
  | 
     figsave << figrec << "_CaloCHKCALIB."; | 
| 263 | 
  | 
     figsave << format; | 
| 264 | 
  | 
     figsave << "("; | 
| 265 | 
  | 
   };                 | 
| 266 | 
  | 
   // | 
| 267 | 
  | 
  | 
| 268 | 
  | 
 //-----------------inizio CHECK per ricerca errori dal calorimetro------------------- | 
| 269 | 
  | 
   // to check or not to check? this is the problem... | 
| 270 | 
  | 
  | 
| 271 | 
  | 
   Bool_t check = false;//azzera flag presenza errori | 
| 272 | 
  | 
    | 
| 273 | 
  | 
   // | 
| 274 | 
  | 
   Int_t hi = (minev/4)-1; | 
| 275 | 
  | 
   //inizio loop su tutti gli header degli eventi di calibrazione | 
| 276 | 
  | 
   //  for (Int_t ci = minev; ci < maxev ; ci+=4){ | 
| 277 | 
  | 
   Int_t ci = minev; | 
| 278 | 
  | 
   while ( ci < maxev ){ | 
| 279 | 
  | 
     //scorre i pacchetti di 4 in 4 (cioe scorre le calibrazioni) | 
| 280 | 
  | 
     Int_t incalrms = 0; | 
| 281 | 
  | 
     Int_t outcalrms = 0; | 
| 282 | 
  | 
     Int_t totcalbad = 0; | 
| 283 | 
  | 
     Int_t incalped = 0; | 
| 284 | 
  | 
     Int_t outcalped = 0; | 
| 285 | 
  | 
     Int_t incalthr = 0; | 
| 286 | 
  | 
     Int_t outcalthr = 0; | 
| 287 | 
  | 
     Int_t incalvar = 0; | 
| 288 | 
  | 
     Int_t outcalvar = 0; | 
| 289 | 
  | 
     Int_t incalbas = 0; | 
| 290 | 
  | 
     Int_t outcalbas = 0; | 
| 291 | 
  | 
     //dall'albero calibheader, cerco obt dell cpu  | 
| 292 | 
  | 
     //    cpuhe->GetEntry(ci/4); | 
| 293 | 
  | 
     hi++; | 
| 294 | 
  | 
     //    cpuobt=ch->GetPscuHeader()->GetOrbitalTime(); | 
| 295 | 
  | 
     cpuobt=cpuhead[hi]; | 
| 296 | 
  | 
     obt0=0; | 
| 297 | 
  | 
     obt1=0; | 
| 298 | 
  | 
     obt2=0; | 
| 299 | 
  | 
     obt3=0; | 
| 300 | 
  | 
     // | 
| 301 | 
  | 
     calib.iev=0; | 
| 302 | 
  | 
     memset(calib.cstwerr,0,4*sizeof(Int_t)); | 
| 303 | 
  | 
     memset(calib.cperror,0,4*sizeof(Float_t)); | 
| 304 | 
  | 
     memset(calib.calped,0,2*22*96*sizeof(Float_t)); | 
| 305 | 
  | 
     memset(calib.calgood,0,2*22*96*sizeof(Float_t)); | 
| 306 | 
  | 
     memset(calib.calrms,0,2*22*96*sizeof(Float_t)); | 
| 307 | 
  | 
     memset(calib.calpuls,0,2*22*96*sizeof(Float_t)); | 
| 308 | 
  | 
     memset(calib.calthr,0,2*22*6*sizeof(Float_t)); | 
| 309 | 
  | 
     memset(calib.calvar,0,2*22*6*sizeof(Float_t)); | 
| 310 | 
  | 
     memset(calib.calbase,0,2*22*6*sizeof(Float_t)); | 
| 311 | 
     // | 
     // | 
| 312 | 
     Float_t ccalrmsthr=0.99; | 
     //inizio loop su i 4 pacchetti per ogni calibrazione (scorre 4 successivi) | 
| 313 | 
     Float_t ccalpedthr=0.99; | 
     //    for ( Int_t s=0 ; s<4 ;s++  ){ | 
| 314 | 
     Float_t ccalbadthr=0.005; | 
     Int_t s = 0; | 
| 315 | 
     Float_t ccalthrthr=0.98; | 
     obt = cpuhead[hi]; | 
| 316 | 
     Float_t ccalvarthr=0.99; | 
     //    printf(" qui cpu header : %i hi %i entry %i \n",obt,hi,ci); | 
| 317 | 
     Float_t ccalbasthr=0.99; | 
     if ( !obt ) break; | 
| 318 | 
     // | 
     while ( (labs((Int_t)(obt-cpuhead[hi])) < 100000 && ci < maxev) || !cpuobt ){ | 
| 319 | 
     Float_t ccalrms; | 
  | 
| 320 | 
     Float_t ccalped; | 
       tr->GetEntry(ci);//sceglie la entry (calibrazione)del tree in cui ho tutte le sottostrutture | 
| 321 | 
     Float_t ccalbad; | 
       //      tr->GetEntry(ci+s);//sceglie la entry (calibrazione)del tree in cui ho tutte le sottostrutture | 
| 322 | 
     Float_t ccalthr; | 
        | 
| 323 | 
     Float_t ccalvar; | 
       //trovo l'OBT della entry (pacchetto) | 
| 324 | 
     Float_t ccalbas; | 
       obt=eh->GetPscuHeader()->GetOrbitalTime();//cerca orbitaltime all'interno di Pscu  | 
| 325 | 
     // | 
       // | 
| 326 | 
     struct Calib calib; | 
       //printf(" qui pkt header : %i  \n",obt); | 
| 327 | 
     stringstream titolo; | 
  | 
| 328 | 
     stringstream xviewev; | 
       ci++; | 
| 329 | 
     stringstream yviewev; | 
        | 
| 330 | 
     const char* startingdir = gSystem->WorkingDirectory(); | 
       if ( labs((Int_t)(obt-cpuhead[hi])) < 100000 ){ | 
| 331 | 
     if ( !strcmp(outDir.Data(),"") ) outDir = startingdir; | 
  | 
| 332 | 
     TString fififile =  getFilename(filename); | 
         //      s++; | 
| 333 | 
     const char *file; | 
         if ( ce->cstwerr[0] ) s = 0; | 
| 334 | 
     file = fififile; | 
         if ( ce->cstwerr[1] ) s = 1; | 
| 335 | 
     // | 
         if ( ce->cstwerr[2] ) s = 2; | 
| 336 | 
     ifstream myfile; | 
         if ( ce->cstwerr[3] ) s = 3; | 
| 337 | 
     myfile.open(filename.Data()); | 
         //printf(" qua pkt header : %i s = %i hi %i \n",obt,s,hi); | 
| 338 | 
     if ( !myfile ){ | 
         // | 
| 339 | 
         printf(" No such file, exiting...\n"); | 
         calib.iev = ce->iev; | 
| 340 | 
         return; | 
         cestw = 0; | 
| 341 | 
     }; | 
         //cstwerr e' tutto l'header della sezione, mi interessano gli ultimi 2 Byte(errori del calorimetro) | 
| 342 | 
     myfile.close(); | 
         if ( ce->cstwerr[s] ){ | 
| 343 | 
     // | 
           cestw =  ce->cstwerr[s] & cmask ; //confronto con la maschera per tenere solo gli  | 
| 344 | 
     TFile *File = new TFile(filename.Data()); | 
           ver[s][16]++;//                     ultimi 2 Byte (assegnati a cestw) | 
 | 
     // | 
  | 
 | 
     TTree *tr = (TTree*)File->Get("CalibCalPed"); | 
  | 
 | 
     pamela::CalibCalPedEvent *ce = 0; | 
  | 
 | 
     // | 
  | 
 | 
     UInt_t found; | 
  | 
 | 
     tr->SetBranchStatus("*",0,&found); //disable all branches | 
  | 
 | 
     // | 
  | 
 | 
     found = 0; | 
  | 
 | 
     tr->SetBranchStatus("iev*",1,&found); | 
  | 
 | 
     found = 0; | 
  | 
 | 
     tr->SetBranchStatus("cstwerr*",1,&found); | 
  | 
 | 
     //    printf("enabled %i branches \n",found); | 
  | 
 | 
     found = 0; | 
  | 
 | 
     tr->SetBranchStatus("cperror*",1,&found); | 
  | 
 | 
     //printf("enabled %i branches \n",found); | 
  | 
 | 
     found = 0; | 
  | 
 | 
     tr->SetBranchStatus("cal*",1,&found); | 
  | 
 | 
     //printf("enabled %i branches \n",found); | 
  | 
 | 
     found = 0; | 
  | 
 | 
     tr->SetBranchStatus("CalibCalPed*",1,&found); | 
  | 
 | 
     //printf("enabled %i branches \n",found); | 
  | 
 | 
     // | 
  | 
 | 
     tr->SetBranchAddress("CalibCalPed", &ce); | 
  | 
 | 
     // | 
  | 
 | 
     Long64_t ncalibs    = tr->GetEntries(); | 
  | 
 | 
     if ( ncalibs == 0 ){ | 
  | 
 | 
         printf(" No calibrations in this files! \n Exiting... \n"); | 
  | 
 | 
         return; | 
  | 
 | 
     }; | 
  | 
 | 
     printf("\n This file contains %i entries which corrispond to %i calibrations \n\n",(int)ncalibs,(int)ncalibs/4); | 
  | 
 | 
     Long64_t minev = 0; | 
  | 
 | 
     Long64_t maxev = ncalibs; | 
  | 
 | 
     if ( calibnumber ){ | 
  | 
 | 
         minev = (calibnumber - 1)* 4; | 
  | 
 | 
         maxev = minev + 4; | 
  | 
 | 
     }; | 
  | 
 | 
     TCanvas *figura1; | 
  | 
 | 
     TCanvas *figura2 = 0; | 
  | 
 | 
     TCanvas *figura3; | 
  | 
 | 
     TCanvas *rapporto = 0; | 
  | 
 | 
     Int_t cmask = 127 ; | 
  | 
 | 
     Int_t cestw = 0; | 
  | 
 | 
     Int_t ver[4][23]; | 
  | 
 | 
     // | 
  | 
 | 
     for (Int_t k = 0; k < 4; k++ ){ | 
  | 
 | 
         for (Int_t m = 0; m < 23 ; m++ ){ | 
  | 
 | 
             ver[k][m] = 0 ; | 
  | 
| 345 | 
         }; | 
         }; | 
| 346 | 
     }; | 
         if ( cestw ){//errori dal calorimetro | 
| 347 | 
  | 
           if ( cestw & (1 << 0) ) ver[s][6]++ ;//spostati di uno e confronto se diverso 0 | 
| 348 | 
  | 
           if ( cestw & (1 << 1) ) ver[s][5]++ ; | 
| 349 | 
  | 
           if ( cestw & (1 << 2) )       ver[s][4]++ ; | 
| 350 | 
  | 
           if ( cestw & (1 << 3) ) ver[s][3]++ ; | 
| 351 | 
  | 
           if ( cestw & (1 << 4) ) ver[s][2]++ ; | 
| 352 | 
  | 
           if ( cestw & (1 << 5) ) ver[s][1]++ ; | 
| 353 | 
  | 
           if ( cestw & (1 << 6) ) ver[s][0]++ ;          | 
| 354 | 
  | 
         }; | 
| 355 | 
  | 
         if ( ce->cperror[s] != 0. ){//errori dallo spacchettamento | 
| 356 | 
  | 
           if (ce->cperror[s] == 128) ver[s][7]++ ;  | 
| 357 | 
  | 
           if (ce->cperror[s] == 129) ver[s][8]++ ; | 
| 358 | 
  | 
           if (ce->cperror[s] == 130) { | 
| 359 | 
  | 
             ver[s][9]++ ; | 
| 360 | 
  | 
             ver[s][16]--; | 
| 361 | 
  | 
           }; | 
| 362 | 
  | 
           if (ce->cperror[s] == 132) ver[s][11]++ ; | 
| 363 | 
  | 
           if (ce->cperror[s] == 140) ver[s][19]++ ;  | 
| 364 | 
  | 
           if (ce->cperror[s] == 141) ver[s][20]++ ;  | 
| 365 | 
  | 
           if (ce->cperror[s] == 142) ver[s][22]++ ;  | 
| 366 | 
  | 
         }; | 
| 367 | 
  | 
         //lato oscuro :p | 
| 368 | 
  | 
         for ( Int_t d=0 ; d<11 ;d++  ){ | 
| 369 | 
  | 
           Int_t pre = -1; | 
| 370 | 
  | 
           for ( Int_t j=0; j<96 ;j++){ | 
| 371 | 
  | 
             if ( j%16 == 0 ) pre++; | 
| 372 | 
  | 
             if ( s == 2 ){ | 
| 373 | 
  | 
               //aggiungo obt del pacchetto che sta leggendo(obt) | 
| 374 | 
  | 
               obt2=obt; | 
| 375 | 
  | 
               calib.calped[0][2*d+1][j] = ce->calped[3][d][j]; | 
| 376 | 
  | 
               calib.cstwerr[3] = ce->cstwerr[3]; | 
| 377 | 
  | 
               calib.cperror[3] = ce->cperror[3]; | 
| 378 | 
  | 
               calib.calgood[0][2*d+1][j] = ce->calgood[3][d][j]; | 
| 379 | 
  | 
               calib.calthr[0][2*d+1][pre] = ce->calthr[3][d][pre]; | 
| 380 | 
  | 
               calib.calrms[0][2*d+1][j] = ce->calrms[3][d][j]; | 
| 381 | 
  | 
               calib.calbase[0][2*d+1][pre] = ce->calbase[3][d][pre]; | 
| 382 | 
  | 
               calib.calvar[0][2*d+1][pre] = ce->calvar[3][d][pre]; | 
| 383 | 
  | 
             }; | 
| 384 | 
  | 
             if ( s == 3 ){ | 
| 385 | 
  | 
               obt3=obt; | 
| 386 | 
  | 
               calib.calped[0][2*d][j] = ce->calped[1][d][j]; | 
| 387 | 
  | 
               calib.cstwerr[1] = ce->cstwerr[1]; | 
| 388 | 
  | 
               calib.cperror[1] = ce->cperror[1]; | 
| 389 | 
  | 
               calib.calgood[0][2*d][j] = ce->calgood[1][d][j]; | 
| 390 | 
  | 
               calib.calthr[0][2*d][pre] = ce->calthr[1][d][pre]; | 
| 391 | 
  | 
               calib.calrms[0][2*d][j] = ce->calrms[1][d][j]; | 
| 392 | 
  | 
               calib.calbase[0][2*d][pre] = ce->calbase[1][d][pre]; | 
| 393 | 
  | 
               calib.calvar[0][2*d][pre] = ce->calvar[1][d][pre]; | 
| 394 | 
  | 
             }; | 
| 395 | 
  | 
             if ( s == 0 ){ | 
| 396 | 
  | 
               obt0=obt; | 
| 397 | 
  | 
               calib.calped[1][2*d][j] = ce->calped[0][d][j]; | 
| 398 | 
  | 
               calib.cstwerr[0] = ce->cstwerr[0]; | 
| 399 | 
  | 
               calib.cperror[0] = ce->cperror[0]; | 
| 400 | 
  | 
               calib.calgood[1][2*d][j] = ce->calgood[0][d][j]; | 
| 401 | 
  | 
               calib.calthr[1][2*d][pre] = ce->calthr[0][d][pre]; | 
| 402 | 
  | 
               calib.calrms[1][2*d][j] = ce->calrms[0][d][j]; | 
| 403 | 
  | 
               calib.calbase[1][2*d][pre] = ce->calbase[0][d][pre]; | 
| 404 | 
  | 
               calib.calvar[1][2*d][pre] = ce->calvar[0][d][pre]; | 
| 405 | 
  | 
             }; | 
| 406 | 
  | 
             if ( s == 1 ){ | 
| 407 | 
  | 
               obt1=obt; | 
| 408 | 
  | 
               calib.calped[1][2*d+1][j] = ce->calped[2][d][j]; | 
| 409 | 
  | 
               calib.cstwerr[2] = ce->cstwerr[2]; | 
| 410 | 
  | 
               calib.cperror[2] = ce->cperror[2]; | 
| 411 | 
  | 
               calib.calgood[1][2*d+1][j] = ce->calgood[2][d][j]; | 
| 412 | 
  | 
               calib.calthr[1][2*d+1][pre] = ce->calthr[2][d][pre]; | 
| 413 | 
  | 
               calib.calrms[1][2*d+1][j] = ce->calrms[2][d][j]; | 
| 414 | 
  | 
               calib.calbase[1][2*d+1][pre] = ce->calbase[2][d][pre]; | 
| 415 | 
  | 
               calib.calvar[1][2*d+1][pre] = ce->calvar[2][d][pre]; | 
| 416 | 
  | 
             }; | 
| 417 | 
  | 
          | 
| 418 | 
  | 
           };       | 
| 419 | 
  | 
         };//chiuso for su si(sezioni) | 
| 420 | 
  | 
       } else { | 
| 421 | 
  | 
         ci--; | 
| 422 | 
  | 
       }; | 
| 423 | 
  | 
     };//chiuso for su ci(eventi) | 
| 424 | 
  | 
     // | 
| 425 | 
  | 
     //fine CHECK | 
| 426 | 
  | 
      | 
| 427 | 
     // | 
     // | 
| 428 | 
  | 
     // Book the histograms: | 
| 429 | 
  | 
     //    Int_t i = (ci-minev)/4; | 
| 430 | 
  | 
     Int_t i = hi; | 
| 431 | 
  | 
     xviewev.str(""); | 
| 432 | 
  | 
     xviewev << "x-view event " << (i+1); | 
| 433 | 
  | 
     yviewev.str(""); | 
| 434 | 
  | 
     yviewev << "y-view event " << (i+1); | 
| 435 | 
  | 
     TH2F *Xview = new TH2F(xviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5); | 
| 436 | 
  | 
     TH2F *Yview = new TH2F(yviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);  | 
| 437 | 
  | 
     | 
| 438 | 
  | 
  | 
| 439 | 
  | 
  | 
| 440 | 
  | 
     //prepara gli istogrammi figures: | 
| 441 | 
  | 
     gDirectory->Delete("C14"); | 
| 442 | 
  | 
     gDirectory->Delete("C15"); | 
| 443 | 
  | 
     gDirectory->Delete("C16"); | 
| 444 | 
  | 
     //TH1F *calped = new TH1F("C14","calped",4230,-3.5,4227.5); | 
| 445 | 
  | 
     //  TH1F *calrms = new TH1F("C15","calrms",4230,-3.5,4228.5); | 
| 446 | 
  | 
     TH1F *calped = new TH1F("C14","C14 calped",2112,-3.5,4227.5);        //istogramma unidimensionale con valori float | 
| 447 | 
  | 
     //  TH1F *calrms = new TH1F("C15","calrms",264,-2.,4226.); | 
| 448 | 
  | 
     TH1F *calrms = new TH1F("C15","C15 calrms",2112,-3.5,4228.5); | 
| 449 | 
  | 
     TH1F *calbad = new TH1F("C16","C16 calgood",4230,-3.5,4228.5); | 
| 450 | 
     // | 
     // | 
| 451 | 
     const string fil = (const char*)filename; | 
     gDirectory->Delete("C17"); | 
| 452 | 
     Int_t posiz = fil.find("dw_"); | 
     gDirectory->Delete("C18"); | 
| 453 | 
     if ( posiz == -1 ) posiz = fil.find("DW_"); | 
     gDirectory->Delete("C19"); | 
| 454 | 
     Int_t posiz2 = posiz+13; | 
     TH1F *calthr = new TH1F("C17","C17 calthr",271,-4.5,268.5); | 
| 455 | 
     TString file2; | 
     TH1F *calvar = new TH1F("C18","C18 calvar",271,-4.5,268.5); | 
| 456 | 
     stringcopy(file2,filename,posiz,posiz2); | 
     TH1F *calbase = new TH1F("C19","C19 calbase",271,-4.5,268.5); | 
 | 
     // | 
  | 
 | 
     const char *figrec = file2; | 
  | 
 | 
     const char *outdir = outDir; | 
  | 
 | 
     const char *format = saveas; | 
  | 
 | 
     stringstream figsave;     | 
  | 
 | 
     stringstream figsave1;     | 
  | 
 | 
     stringstream figsave2;     | 
  | 
| 457 | 
     // | 
     // | 
| 458 | 
     // to check or not to check? this is the problem... | 
     Int_t bgcolor = 10; | 
| 459 | 
  | 
     TPad *pd1 = 0; | 
| 460 | 
  | 
     TPad *pd2 = 0; | 
| 461 | 
  | 
     TPad *palette = 0; | 
| 462 | 
  | 
     TLatex *t=new TLatex(); | 
| 463 | 
  | 
  | 
| 464 | 
     // | 
     // | 
| 465 | 
     Bool_t check = false; | 
     //pagina visualizzata solo se ci sono problemi | 
| 466 | 
  | 
     if ( figmatra ){//figmatra e' variabile in ingresso in main | 
| 467 | 
  | 
       figura2 = new TCanvas("Calorimeter:_strip_RMS", "Calorimeter:_strip_RMS", 750, 650); | 
| 468 | 
  | 
       figura2->SetFillColor(10); | 
| 469 | 
  | 
       figura2->Range(0,0,100,100); | 
| 470 | 
  | 
       bgcolor = 10; | 
| 471 | 
  | 
       pd1 = new TPad("pd1","This is pad1",0.02,0.05,0.88,0.49,bgcolor); | 
| 472 | 
  | 
       pd2 = new TPad("pd2","This is pad2",0.02,0.51,0.88,0.95,bgcolor); | 
| 473 | 
  | 
       palette = new TPad("palette","This is palette",0.90,0.05,0.98,0.90,bgcolor); | 
| 474 | 
  | 
       figura2->cd(); | 
| 475 | 
  | 
       gStyle->SetOptStat(""); | 
| 476 | 
  | 
       t=new TLatex(); | 
| 477 | 
  | 
       t->SetTextFont(32); | 
| 478 | 
  | 
       t->SetTextColor(1); | 
| 479 | 
  | 
       t->SetTextSize(0.03); | 
| 480 | 
  | 
       t->SetTextAlign(12); | 
| 481 | 
  | 
       t->DrawLatex(90.,92.5,"ADC ch."); | 
| 482 | 
  | 
       pd1->Range(0,0,100,100); | 
| 483 | 
  | 
       pd2->Range(0,0,100,100); | 
| 484 | 
  | 
       palette->Range(0,0,100,100); | 
| 485 | 
  | 
       pd1->SetTicks(); | 
| 486 | 
  | 
       pd2->SetTicks(); | 
| 487 | 
  | 
       pd1->Draw(); | 
| 488 | 
  | 
       pd2->Draw(); | 
| 489 | 
  | 
       palette->Draw(); | 
| 490 | 
  | 
       palette->cd(); | 
| 491 | 
  | 
       // palette | 
| 492 | 
  | 
       TPaveLabel *box1 = new TPaveLabel(2,2,98,14,"OFF",""); | 
| 493 | 
  | 
       box1->SetTextFont(32); | 
| 494 | 
  | 
       box1->SetTextColor(1);     | 
| 495 | 
  | 
       box1->SetTextSize(0.25);   | 
| 496 | 
  | 
       box1->SetFillColor(10); | 
| 497 | 
  | 
       box1->Draw(); | 
| 498 | 
  | 
       TPaveLabel *box2 = new TPaveLabel(2,16,98,28,"0-1.5",""); | 
| 499 | 
  | 
       box2->SetTextFont(32); | 
| 500 | 
  | 
       box2->SetTextColor(1);             | 
| 501 | 
  | 
       box2->SetTextSize(0.25);   | 
| 502 | 
  | 
       box2->SetFillColor(38); | 
| 503 | 
  | 
       box2->Draw(); | 
| 504 | 
  | 
       TPaveLabel *box3 = new TPaveLabel(2,30,98,42,"1.5-4",""); | 
| 505 | 
  | 
       box3->SetTextFont(32); | 
| 506 | 
  | 
       box3->SetTextColor(1);     | 
| 507 | 
  | 
       box3->SetTextSize(0.25);   | 
| 508 | 
  | 
       box3->SetFillColor(4); | 
| 509 | 
  | 
       box3->Draw(); | 
| 510 | 
  | 
       TPaveLabel *box4 = new TPaveLabel(2,44,98,56,"4-6.5",""); | 
| 511 | 
  | 
       box4->SetTextFont(32); | 
| 512 | 
  | 
       box4->SetTextColor(1);     | 
| 513 | 
  | 
       box4->SetTextSize(0.25);   | 
| 514 | 
  | 
       box4->SetFillColor(3); | 
| 515 | 
  | 
       box4->Draw(); | 
| 516 | 
  | 
       TPaveLabel *box5 = new TPaveLabel(2,58,98,70,"6.5-11.5",""); | 
| 517 | 
  | 
       box5->SetTextFont(32); | 
| 518 | 
  | 
       box5->SetTextColor(1);     | 
| 519 | 
  | 
       box5->SetTextSize(0.25);   | 
| 520 | 
  | 
       box5->SetFillColor(2); | 
| 521 | 
  | 
       box5->Draw(); | 
| 522 | 
  | 
       TPaveLabel *box6 = new TPaveLabel(2,72,98,84,">11.5",""); | 
| 523 | 
  | 
       box6->SetTextFont(32); | 
| 524 | 
  | 
       box6->SetTextColor(1);     | 
| 525 | 
  | 
       box6->SetTextSize(0.25);   | 
| 526 | 
  | 
       box6->SetFillColor(6); | 
| 527 | 
  | 
       box6->Draw(); | 
| 528 | 
  | 
       TPaveLabel *box7 = new TPaveLabel(2,86,98,98,"BAD",""); | 
| 529 | 
  | 
       box7->SetTextFont(32); | 
| 530 | 
  | 
       box7->SetTextColor(10);    | 
| 531 | 
  | 
       box7->SetTextSize(0.25);   | 
| 532 | 
  | 
       box7->SetFillColor(1); | 
| 533 | 
  | 
       box7->Draw(); | 
| 534 | 
  | 
       // | 
| 535 | 
  | 
       pd1->cd();            | 
| 536 | 
  | 
       gStyle->SetOptStat(""); | 
| 537 | 
  | 
       Xview->SetXTitle("strip"); | 
| 538 | 
  | 
       Xview->SetYTitle("X - plane"); | 
| 539 | 
  | 
       Xview->GetYaxis()->SetTitleOffset(0.5); | 
| 540 | 
  | 
       Xview->SetFillColor(bgcolor);          | 
| 541 | 
  | 
       Xview->Fill(1.,1.,1.);         | 
| 542 | 
  | 
       Xview->Draw("box"); | 
| 543 | 
  | 
       pd1->Update(); | 
| 544 | 
  | 
       pd2->cd(); | 
| 545 | 
  | 
       gStyle->SetOptStat(""); | 
| 546 | 
  | 
       Yview->SetXTitle("strip"); | 
| 547 | 
  | 
       Yview->SetYTitle("Y - plane"); | 
| 548 | 
  | 
       Yview->GetYaxis()->SetTitleOffset(0.5);    | 
| 549 | 
  | 
       Yview->SetFillColor(bgcolor);          | 
| 550 | 
  | 
       Yview->Fill(1.,1.,1.);         | 
| 551 | 
  | 
       Yview->Draw("box"); | 
| 552 | 
  | 
       pd2->Update(); | 
| 553 | 
  | 
     }; | 
| 554 | 
     // | 
     // | 
| 555 | 
     for (Int_t ci = minev; ci < maxev ; ci+=4){ | 
     // run over views and planes | 
| 556 | 
         // | 
     //verifica quali strip sono state utilizzate per la calibrazione | 
| 557 | 
         Int_t incalrms = 0; | 
     Int_t j = 0; | 
| 558 | 
         Int_t outcalrms = 0; | 
     Int_t g = 0; | 
| 559 | 
         Int_t totcalbad = 0; | 
     gStyle->SetOptStat(""); | 
| 560 | 
         Int_t incalped = 0; | 
     for (Int_t m = 0; m < 22; m++){//loop sui piani | 
| 561 | 
         Int_t outcalped = 0; | 
       for (Int_t l = 0; l < 2; l++){//loop x y | 
| 562 | 
         Int_t incalthr = 0; | 
         for (Int_t n = 0; n < 96; n++){ //loop sulle strip | 
| 563 | 
         Int_t outcalthr = 0; | 
           //controlla quante strip hanno piedistallo fuori dai limiti (escludendo quelle difettose) | 
| 564 | 
         Int_t incalvar = 0; | 
           calped->Fill((float)j,calib.calped[l][m][n]);                              | 
| 565 | 
         Int_t outcalvar = 0; | 
           if ( (calib.calped[l][m][n] > 700. || calib.calped[l][m][n] < -700.) && (j < 4032 || j > 4048) ){ | 
| 566 | 
         Int_t incalbas = 0; | 
             outcalped++; | 
| 567 | 
         Int_t outcalbas = 0; | 
           } else { | 
| 568 | 
         // | 
             incalped++; | 
| 569 | 
         for ( Int_t s=0 ; s<4 ;s++  ){ | 
           }; | 
| 570 | 
             tr->GetEntry(ci+s); | 
           //controlla quali strip hanno rms fuori dai limiti (ponendo un limite diverso(piu' alto) per quelle difettose | 
| 571 | 
             calib.iev = ce->iev; | 
           calrms->Fill((float)j,(calib.calrms[l][m][n]/4.));                                 | 
| 572 | 
             // | 
           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.)) ){ | 
| 573 | 
             // | 
             outcalrms++; | 
| 574 | 
             // | 
           } else { | 
| 575 | 
             cestw = 0; | 
             incalrms++; | 
| 576 | 
             if ( ce->cstwerr[s] ){ | 
           };//controlla (conta) quali strip sono state escluse dalla calibrazione | 
| 577 | 
                 cestw =  ce->cstwerr[s] & cmask ; | 
           calbad->Fill((float)j,(float)calib.calgood[l][m][n]);                              | 
| 578 | 
                 ver[s][16]++; | 
           if ( calib.calgood[l][m][n] ) totcalbad++;//strip(orientazione(l),piano(m),numero(n))e' nulla, aumenta il | 
| 579 | 
             }; | 
           //   | 
| 580 | 
             if ( cestw ){ | 
           //preamplificatori(soglia max di calvar portata a 9, prima era 8) | 
| 581 | 
                 if ( cestw & (1 << 0) ) ver[s][6]++ ; | 
           if ( n < 6 ){                  | 
| 582 | 
                 if ( cestw & (1 << 1) ) ver[s][5]++ ; | 
             calthr->Fill((float)g,(float)calib.calthr[l][m][n]);//controlla quali strip hanno soglia al difuori del limite(esclude) | 
| 583 | 
                 if ( cestw & (1 << 2) ) ver[s][4]++ ; | 
                                                                 //(quelle difettose) | 
| 584 | 
                 if ( cestw & (1 << 3) ) ver[s][3]++ ; | 
             if ( (calib.calthr[l][m][n] > 25. || calib.calthr[l][m][n] < 12.) && (g < 215 || g > 221) ){ | 
| 585 | 
                 if ( cestw & (1 << 4) ) ver[s][2]++ ; | 
               outcalthr++; | 
| 586 | 
                 if ( cestw & (1 << 5) ) ver[s][1]++ ; | 
             } else { | 
| 587 | 
                 if ( cestw & (1 << 6) ) ver[s][0]++ ;            | 
               incalthr++; | 
 | 
             }; | 
  | 
 | 
             if ( ce->cperror[s] != 0. ){ | 
  | 
 | 
                 if (ce->cperror[s] == 128) ver[s][7]++ ;  | 
  | 
 | 
                 if (ce->cperror[s] == 129) ver[s][8]++ ; | 
  | 
 | 
                 if (ce->cperror[s] == 130) { | 
  | 
 | 
                     ver[s][9]++ ; | 
  | 
 | 
                     ver[s][16]--; | 
  | 
 | 
                 }; | 
  | 
 | 
                 if (ce->cperror[s] == 132) ver[s][11]++ ; | 
  | 
 | 
                 if (ce->cperror[s] == 140) ver[s][19]++ ;  | 
  | 
 | 
                 if (ce->cperror[s] == 141) ver[s][20]++ ;  | 
  | 
 | 
                 if (ce->cperror[s] == 142) ver[s][22]++ ;  | 
  | 
 | 
             }; | 
  | 
 | 
             // | 
  | 
 | 
             for ( Int_t d=0 ; d<11 ;d++  ){ | 
  | 
 | 
                 Int_t pre = -1; | 
  | 
 | 
                 for ( Int_t j=0; j<96 ;j++){ | 
  | 
 | 
                     if ( j%16 == 0 ) pre++; | 
  | 
 | 
                     if ( s == 2 ){ | 
  | 
 | 
                         calib.calped[0][2*d+1][j] = ce->calped[3][d][j]; | 
  | 
 | 
                         calib.cstwerr[3] = ce->cstwerr[3]; | 
  | 
 | 
                         calib.cperror[3] = ce->cperror[3]; | 
  | 
 | 
                         calib.calgood[0][2*d+1][j] = ce->calgood[3][d][j]; | 
  | 
 | 
                         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]; | 
  | 
 | 
                     }; | 
  | 
 | 
                 }; | 
  | 
| 588 | 
             }; | 
             }; | 
| 589 | 
         }; | 
             calvar->Fill((float)g,(float)calib.calvar[l][m][n]);//controlla la varianza (esclude le difettose) | 
| 590 | 
         // | 
             if ( (calib.calvar[l][m][n] > 9. || calib.calvar[l][m][n] < 1. ) && (g < 215 || g > 221) ){ | 
| 591 | 
         // Book the histograms: | 
               outcalvar++; | 
| 592 | 
         // | 
             } else { | 
| 593 | 
         // | 
               incalvar++; | 
 | 
         Int_t i = (ci-minev)/4; | 
  | 
 | 
         xviewev.str(""); | 
  | 
 | 
         xviewev << "x-view event " << (i+1); | 
  | 
 | 
         yviewev.str(""); | 
  | 
 | 
         yviewev << "y-view event " << (i+1); | 
  | 
 | 
         TH2F *Xview = new TH2F(xviewev.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);      | 
  | 
 | 
         // | 
  | 
 | 
         // figures: | 
  | 
 | 
         // | 
  | 
 | 
         gDirectory->Delete("C14"); | 
  | 
 | 
         gDirectory->Delete("C15"); | 
  | 
 | 
         gDirectory->Delete("C16"); | 
  | 
 | 
         TH1F *calped = new TH1F("C14","calped",4230,-3.5,4227.5); | 
  | 
 | 
         TH1F *calrms = new TH1F("C15","calrms",4230,-3.5,4228.5); | 
  | 
 | 
         TH1F *calbad = new TH1F("C16","calgood",4230,-3.5,4228.5); | 
  | 
 | 
         // | 
  | 
 | 
         gDirectory->Delete("C17"); | 
  | 
 | 
         gDirectory->Delete("C18"); | 
  | 
 | 
         gDirectory->Delete("C19"); | 
  | 
 | 
         TH1F *calthr = new TH1F("C17","calthr",271,-4.5,268.5); | 
  | 
 | 
         TH1F *calvar = new TH1F("C18","calvar",271,-4.5,268.5); | 
  | 
 | 
         TH1F *calbase = new TH1F("C19","calbase",271,-4.5,268.5); | 
  | 
 | 
         // | 
  | 
 | 
         Int_t bgcolor = 10; | 
  | 
 | 
         TPad *pd1 = 0; | 
  | 
 | 
         TPad *pd2 = 0; | 
  | 
 | 
         TPad *palette = 0; | 
  | 
 | 
         TLatex *t=new TLatex(); | 
  | 
 | 
         if ( figmatra ){ | 
  | 
 | 
             figura2 = new TCanvas("Calorimeter:_strip_RMS", "Calorimeter:_strip_RMS", 750, 650); | 
  | 
 | 
             figura2->SetFillColor(10); | 
  | 
 | 
             figura2->Range(0,0,100,100); | 
  | 
 | 
             bgcolor = 10; | 
  | 
 | 
             pd1 = new TPad("pd1","This is pad1",0.02,0.05,0.88,0.49,bgcolor); | 
  | 
 | 
             pd2 = new TPad("pd2","This is pad2",0.02,0.51,0.88,0.95,bgcolor); | 
  | 
 | 
             palette = new TPad("palette","This is palette",0.90,0.05,0.98,0.90,bgcolor); | 
  | 
 | 
             figura2->cd(); | 
  | 
 | 
             gStyle->SetOptStat(""); | 
  | 
 | 
             t=new TLatex(); | 
  | 
 | 
             t->SetTextFont(32); | 
  | 
 | 
             t->SetTextColor(1); | 
  | 
 | 
             t->SetTextSize(0.03); | 
  | 
 | 
             t->SetTextAlign(12); | 
  | 
 | 
             t->DrawLatex(90.,92.5,"ADC ch."); | 
  | 
 | 
             pd1->Range(0,0,100,100); | 
  | 
 | 
             pd2->Range(0,0,100,100); | 
  | 
 | 
             palette->Range(0,0,100,100); | 
  | 
 | 
             pd1->SetTicks(); | 
  | 
 | 
             pd2->SetTicks(); | 
  | 
 | 
             pd1->Draw(); | 
  | 
 | 
             pd2->Draw(); | 
  | 
 | 
             palette->Draw(); | 
  | 
 | 
             palette->cd(); | 
  | 
 | 
             // palette | 
  | 
 | 
             TPaveLabel *box1 = new TPaveLabel(2,2,98,14,"OFF",""); | 
  | 
 | 
             box1->SetTextFont(32); | 
  | 
 | 
             box1->SetTextColor(1);       | 
  | 
 | 
             box1->SetTextSize(0.25);     | 
  | 
 | 
             box1->SetFillColor(10); | 
  | 
 | 
             box1->Draw(); | 
  | 
 | 
             TPaveLabel *box2 = new TPaveLabel(2,16,98,28,"0-1.5",""); | 
  | 
 | 
             box2->SetTextFont(32); | 
  | 
 | 
             box2->SetTextColor(1);               | 
  | 
 | 
             box2->SetTextSize(0.25);     | 
  | 
 | 
             box2->SetFillColor(38); | 
  | 
 | 
             box2->Draw(); | 
  | 
 | 
             TPaveLabel *box3 = new TPaveLabel(2,30,98,42,"1.5-4",""); | 
  | 
 | 
             box3->SetTextFont(32); | 
  | 
 | 
             box3->SetTextColor(1);       | 
  | 
 | 
             box3->SetTextSize(0.25);     | 
  | 
 | 
             box3->SetFillColor(4); | 
  | 
 | 
             box3->Draw(); | 
  | 
 | 
             TPaveLabel *box4 = new TPaveLabel(2,44,98,56,"4-6.5",""); | 
  | 
 | 
             box4->SetTextFont(32); | 
  | 
 | 
             box4->SetTextColor(1);       | 
  | 
 | 
             box4->SetTextSize(0.25);     | 
  | 
 | 
             box4->SetFillColor(3); | 
  | 
 | 
             box4->Draw(); | 
  | 
 | 
             TPaveLabel *box5 = new TPaveLabel(2,58,98,70,"6.5-11.5",""); | 
  | 
 | 
             box5->SetTextFont(32); | 
  | 
 | 
             box5->SetTextColor(1);       | 
  | 
 | 
             box5->SetTextSize(0.25);     | 
  | 
 | 
             box5->SetFillColor(2); | 
  | 
 | 
             box5->Draw(); | 
  | 
 | 
             TPaveLabel *box6 = new TPaveLabel(2,72,98,84,">11.5",""); | 
  | 
 | 
             box6->SetTextFont(32); | 
  | 
 | 
             box6->SetTextColor(1);       | 
  | 
 | 
             box6->SetTextSize(0.25);     | 
  | 
 | 
             box6->SetFillColor(6); | 
  | 
 | 
             box6->Draw(); | 
  | 
 | 
             TPaveLabel *box7 = new TPaveLabel(2,86,98,98,"BAD",""); | 
  | 
 | 
             box7->SetTextFont(32); | 
  | 
 | 
             box7->SetTextColor(10);      | 
  | 
 | 
             box7->SetTextSize(0.25);     | 
  | 
 | 
             box7->SetFillColor(1); | 
  | 
 | 
             box7->Draw(); | 
  | 
 | 
             // | 
  | 
 | 
             pd1->cd();      | 
  | 
 | 
             gStyle->SetOptStat(""); | 
  | 
 | 
             Xview->SetXTitle("strip"); | 
  | 
 | 
             Xview->SetYTitle("X - plane"); | 
  | 
 | 
             Xview->GetYaxis()->SetTitleOffset(0.5); | 
  | 
 | 
             Xview->SetFillColor(bgcolor);            | 
  | 
 | 
             Xview->Fill(1.,1.,1.);           | 
  | 
 | 
             Xview->Draw("box"); | 
  | 
 | 
             pd1->Update(); | 
  | 
 | 
             pd2->cd(); | 
  | 
 | 
             gStyle->SetOptStat(""); | 
  | 
 | 
             Yview->SetXTitle("strip"); | 
  | 
 | 
             Yview->SetYTitle("Y - plane"); | 
  | 
 | 
             Yview->GetYaxis()->SetTitleOffset(0.5);      | 
  | 
 | 
             Yview->SetFillColor(bgcolor);            | 
  | 
 | 
             Yview->Fill(1.,1.,1.);           | 
  | 
 | 
             Yview->Draw("box"); | 
  | 
 | 
             pd2->Update(); | 
  | 
 | 
         }; | 
  | 
 | 
         // | 
  | 
 | 
         // run over views and planes | 
  | 
 | 
         // | 
  | 
 | 
         Int_t j = 0; | 
  | 
 | 
         Int_t g = 0; | 
  | 
 | 
         gStyle->SetOptStat(""); | 
  | 
 | 
         for (Int_t m = 0; m < 22; m++){ | 
  | 
 | 
             for (Int_t l = 0; l < 2; l++){ | 
  | 
 | 
                 for (Int_t n = 0; n < 96; n++){  | 
  | 
 | 
                     // | 
  | 
 | 
                     calped->Fill((float)j,calib.calped[l][m][n]);                                    | 
  | 
 | 
                     if ( (calib.calped[l][m][n] > 700. || calib.calped[l][m][n] < -700.) && (j < 4032 || j > 4048) ){ | 
  | 
 | 
                         outcalped++; | 
  | 
 | 
                     } else { | 
  | 
 | 
                         incalped++; | 
  | 
 | 
                     }; | 
  | 
 | 
                     calrms->Fill((float)j,(calib.calrms[l][m][n]/4.));                               | 
  | 
 | 
                     if ( (calib.calrms[l][m][n]/4.) > 7. || (calib.calrms[l][m][n]/4.) < 1. ){ | 
  | 
 | 
                         outcalrms++; | 
  | 
 | 
                     } else { | 
  | 
 | 
                         incalrms++; | 
  | 
 | 
                     }; | 
  | 
 | 
                     calbad->Fill((float)j,(float)calib.calgood[l][m][n]);                                    | 
  | 
 | 
                     if ( calib.calgood[l][m][n] ) totcalbad++; | 
  | 
 | 
                     // | 
  | 
 | 
                     if ( n < 6 ){                        | 
  | 
 | 
                         calthr->Fill((float)g,(float)calib.calthr[l][m][n]);                                                     | 
  | 
 | 
                         if ( calib.calthr[l][m][n] > 21. || calib.calthr[l][m][n] < 12. ){ | 
  | 
 | 
                             outcalthr++; | 
  | 
 | 
                         } else { | 
  | 
 | 
                             incalthr++; | 
  | 
 | 
                         }; | 
  | 
 | 
                         calvar->Fill((float)g,(float)calib.calvar[l][m][n]);                                                     | 
  | 
 | 
                         if ( calib.calvar[l][m][n] > 8. || calib.calvar[l][m][n] < 1. ){ | 
  | 
 | 
                             outcalvar++; | 
  | 
 | 
                         } else { | 
  | 
 | 
                             incalvar++; | 
  | 
 | 
                         }; | 
  | 
 | 
                         calbase->Fill((float)g,(float)calib.calbase[l][m][n]);                                                   | 
  | 
 | 
                         if ( calib.calbase[l][m][n] > 4500. || calib.calbase[l][m][n] < 2000. ){ | 
  | 
 | 
                             outcalbas++; | 
  | 
 | 
                         } else { | 
  | 
 | 
                             incalbas++; | 
  | 
 | 
                         }; | 
  | 
 | 
                         g++; | 
  | 
 | 
                     }; | 
  | 
 | 
                     // | 
  | 
 | 
                     j++; | 
  | 
 | 
                     // | 
  | 
 | 
                     if ( figmatra ){                     | 
  | 
 | 
                         figura2->cd(); | 
  | 
 | 
                         xviewev.str(""); | 
  | 
 | 
                         xviewev << "x-view " << i; | 
  | 
 | 
                         xviewev << " event " << n; | 
  | 
 | 
                         xviewev << " " << m; | 
  | 
 | 
                         xviewev << " " << l; | 
  | 
 | 
                         yviewev.str(""); | 
  | 
 | 
                         yviewev << "y-view " << i; | 
  | 
 | 
                         yviewev << " event " << n; | 
  | 
 | 
                         yviewev << " " << m; | 
  | 
 | 
                         yviewev << " " << l; | 
  | 
 | 
                         TH2F *Xview = new TH2F(xviewev.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);                         | 
  | 
 | 
                         if ( calib.calrms[l][m][n] > 0 ){ | 
  | 
 | 
                             Xview->SetFillColor(38); | 
  | 
 | 
                             Yview->SetFillColor(38); | 
  | 
 | 
                         }; | 
  | 
 | 
                         if ( calib.calrms[l][m][n] > 6 ){ | 
  | 
 | 
                             Xview->SetFillColor(4); | 
  | 
 | 
                             Yview->SetFillColor(4); | 
  | 
 | 
                         }; | 
  | 
 | 
                         if ( calib.calrms[l][m][n] > 16 ){ | 
  | 
 | 
                             Xview->SetFillColor(3); | 
  | 
 | 
                             Yview->SetFillColor(3); | 
  | 
 | 
                         }; | 
  | 
 | 
                         if ( calib.calrms[l][m][n] > 26 ){ | 
  | 
 | 
                             Xview->SetFillColor(2); | 
  | 
 | 
                             Yview->SetFillColor(2); | 
  | 
 | 
                         }; | 
  | 
 | 
                         if ( calib.calrms[l][m][n] > 46 ){ | 
  | 
 | 
                             Xview->SetFillColor(6); | 
  | 
 | 
                             Yview->SetFillColor(6); | 
  | 
 | 
                         }; | 
  | 
 | 
                         if ( calib.calrms[l][m][n] <= 0 || calib.calrms[l][m][n] >30000 || calib.calped[l][m][n]>25000){ | 
  | 
 | 
                             Xview->SetFillColor(10); | 
  | 
 | 
                             Yview->SetFillColor(10); | 
  | 
 | 
                         }; | 
  | 
 | 
                         if ( calib.calgood[l][m][n] != 0 ){ | 
  | 
 | 
                             Xview->SetFillColor(1); | 
  | 
 | 
                             Yview->SetFillColor(1); | 
  | 
 | 
                         }; | 
  | 
 | 
                         if ( l == 0 ) { | 
  | 
 | 
                             Xview->Fill(n,m,1.); | 
  | 
 | 
                             pd1->cd();                               | 
  | 
 | 
                             Xview->Draw("box same"); | 
  | 
 | 
                         };                                   | 
  | 
 | 
                         if ( l == 1 ) { | 
  | 
 | 
                             Yview->Fill(n,m,1.); | 
  | 
 | 
                             pd2->cd(); | 
  | 
 | 
                             Yview->Draw("box same"); | 
  | 
 | 
                         };                   | 
  | 
 | 
                     }; | 
  | 
 | 
                 }; | 
  | 
| 594 | 
             }; | 
             }; | 
| 595 | 
         }; | 
             calbase->Fill((float)g,(float)calib.calbase[l][m][n]);//controlla baseline                                                   | 
| 596 | 
         if ( figmatra ){ | 
             if ( calib.calbase[l][m][n] > 5500. || calib.calbase[l][m][n] < 2000. ){ | 
| 597 | 
  | 
               outcalbas++; | 
| 598 | 
  | 
             } else { | 
| 599 | 
  | 
               incalbas++; | 
| 600 | 
  | 
             }; | 
| 601 | 
  | 
             g++;//contatore preamplificatoripassa alla strip successiva (0-286) | 
| 602 | 
  | 
           }; | 
| 603 | 
  | 
           // | 
| 604 | 
  | 
           j++;//contatore strip | 
| 605 | 
  | 
            | 
| 606 | 
  | 
           //istogrammi (solo se ci sono stati problemi) | 
| 607 | 
  | 
           if ( figmatra ){                       | 
| 608 | 
             figura2->cd(); | 
             figura2->cd(); | 
| 609 | 
             gStyle->SetOptStat(""); | 
             xviewev.str(""); | 
| 610 | 
             gStyle->SetOptDate(0); | 
             xviewev << "x-view " << i; | 
| 611 | 
             t=new TLatex(); | 
             xviewev << " event " << n; | 
| 612 | 
             t->SetTextFont(32); | 
             xviewev << " " << m; | 
| 613 | 
             t->SetTextColor(1); | 
             xviewev << " " << l; | 
| 614 | 
             t->SetTextSize(0.03); | 
             yviewev.str(""); | 
| 615 | 
             t->SetTextAlign(12); | 
             yviewev << "y-view " << i; | 
| 616 | 
             titolo.str(""); | 
             yviewev << " event " << n; | 
| 617 | 
             titolo << "C13 - Calorimeter: strip RMS - file "; | 
             yviewev << " " << m; | 
| 618 | 
             titolo << file; | 
             yviewev << " " << l; | 
| 619 | 
             titolo << " - calibration number "; | 
             TH2F *Xview = new TH2F(xviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);//istogramma 2d | 
| 620 | 
             titolo << (i+1); | 
             TH2F *Yview = new TH2F(yviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);                     | 
| 621 | 
             t->DrawLatex(0.5,97.,titolo.str().c_str()); | 
             if ( calib.calrms[l][m][n] > 0 ){ | 
| 622 | 
             pd1->Update(); | 
               Xview->SetFillColor(38); | 
| 623 | 
             pd2->Update(); | 
               Yview->SetFillColor(38); | 
| 624 | 
             figura2->Update(); | 
             }; | 
| 625 | 
         }; | 
             if ( calib.calrms[l][m][n] > 6 ){ | 
| 626 | 
         // | 
               Xview->SetFillColor(4); | 
| 627 | 
         figura1 = new TCanvas("Calorimeter_calped_calrms_calgood", "Calorimeter_calped_calrms_calgood", 750, 950); | 
               Yview->SetFillColor(4); | 
| 628 | 
         figura1->SetFillColor(10); | 
             }; | 
| 629 | 
         figura1->Range(0,0,100,100); | 
             if ( calib.calrms[l][m][n] > 16 ){ | 
| 630 | 
         // | 
               Xview->SetFillColor(3); | 
| 631 | 
         ccalped = (float)incalped/((float)outcalped + (float)incalped); | 
               Yview->SetFillColor(3); | 
| 632 | 
         Int_t f1pd1col = 10; | 
             }; | 
| 633 | 
         if ( ccalped < ccalpedthr ) {  | 
             if ( calib.calrms[l][m][n] > 26 ){ | 
| 634 | 
             check = true;        | 
               Xview->SetFillColor(2); | 
| 635 | 
             f1pd1col = 45; | 
               Yview->SetFillColor(2); | 
| 636 | 
         }; | 
             }; | 
| 637 | 
         // | 
             if ( calib.calrms[l][m][n] > 46 ){ | 
| 638 | 
         ccalrms = (float)incalrms/((float)outcalrms + (float)incalrms); | 
               Xview->SetFillColor(6); | 
| 639 | 
         Int_t f1pd2col = 10; | 
               Yview->SetFillColor(6); | 
| 640 | 
         if ( ccalrms < ccalrmsthr ) {  | 
             }; | 
| 641 | 
             check = true;        | 
             if ( calib.calrms[l][m][n] <= 0 || calib.calrms[l][m][n] >30000 || calib.calped[l][m][n]>25000){ | 
| 642 | 
             f1pd2col = 45; | 
               Xview->SetFillColor(10); | 
| 643 | 
         }; | 
               Yview->SetFillColor(10); | 
| 644 | 
         // | 
             }; | 
| 645 | 
         ccalbad = (float)totcalbad/4224.; | 
             if ( calib.calgood[l][m][n] != 0 ){ | 
| 646 | 
         Int_t f1pd3col = 10; | 
               Xview->SetFillColor(1); | 
| 647 | 
         if ( ccalbad > ccalbadthr ) {  | 
               Yview->SetFillColor(1); | 
| 648 | 
             check = true;        | 
             }; | 
| 649 | 
             f1pd3col = 45; | 
             if ( l == 0 ) { | 
| 650 | 
         }; | 
               Xview->Fill(n,m,1.); | 
| 651 | 
         // | 
               pd1->cd();                                     | 
| 652 | 
         TPad *f1pd1 = new TPad("f1pd1","This is f1pad1",0.02,0.684,0.98,0.95,f1pd1col); | 
               Xview->Draw("box same"); | 
| 653 | 
         TPad *f1pd2 = new TPad("f1pd2","This is f1pad2",0.02,0.367,0.98,0.634,f1pd2col); | 
             };                               | 
| 654 | 
         TPad *f1pd3 = new TPad("f1pd3","This is f1pad3",0.02,0.05,0.98,0.317,f1pd3col); | 
             if ( l == 1 ) { | 
| 655 | 
         figura1->Clear(); | 
               Yview->Fill(n,m,1.); | 
| 656 | 
         figura1->cd(); | 
               pd2->cd(); | 
| 657 | 
         f1pd1->SetTicks(); | 
               Yview->Draw("box same"); | 
| 658 | 
         f1pd2->SetTicks(); | 
             };               | 
| 659 | 
         f1pd3->SetTicks(); | 
           };//fine istogrammi | 
| 660 | 
         f1pd1->Draw(); | 
         };//fine loop strip per piano | 
| 661 | 
         f1pd2->Draw(); | 
       };//fine loop x y | 
| 662 | 
         f1pd3->Draw(); | 
     };//fine loop piani | 
| 663 | 
         figura1->Draw(); | 
  | 
| 664 | 
         figura3 = new TCanvas("Calorimeter_calthr_calvar_calbase", "Calorimeter_calthr_calvar_calbase", 750, 950); | 
     //disega la figura | 
| 665 | 
         figura3->SetFillColor(10); | 
     if ( figmatra ){ | 
| 666 | 
         figura3->Range(0,0,100,100); | 
       figura2->cd(); | 
| 667 | 
         // | 
       gStyle->SetOptStat(""); | 
| 668 | 
         ccalthr = (float)incalthr/((float)outcalthr + (float)incalthr); | 
       gStyle->SetOptDate(0); | 
| 669 | 
         Int_t f3pd1col = 10; | 
       t=new TLatex(); | 
| 670 | 
         if ( ccalthr < ccalthrthr ) {  | 
       t->SetTextFont(32); | 
| 671 | 
             check = true;        | 
       t->SetTextColor(1); | 
| 672 | 
             f3pd1col = 45; | 
       t->SetTextSize(0.03); | 
| 673 | 
         }; | 
       t->SetTextAlign(12); | 
| 674 | 
         // | 
       titolo.str(""); | 
| 675 | 
         ccalvar = (float)incalvar/((float)outcalvar + (float)incalvar); | 
       titolo << "C13 - Calorimeter: strip RMS - file "; | 
| 676 | 
         Int_t f3pd2col = 10; | 
       titolo << file; | 
| 677 | 
         if ( ccalvar < ccalvarthr ) {  | 
       titolo << " - calibration number "; | 
| 678 | 
             check = true;        | 
       titolo << (i+1); | 
| 679 | 
             f3pd2col = 45; | 
       t->DrawLatex(0.5,97.,titolo.str().c_str()); | 
| 680 | 
         }; | 
       pd1->Update(); | 
| 681 | 
         // | 
       pd2->Update(); | 
| 682 | 
         ccalbas = (float)incalbas/((float)outcalbas + (float)incalbas); | 
       figura2->Update(); | 
| 683 | 
         Int_t f3pd3col = 10; | 
     }; | 
| 684 | 
         if ( ccalbas < ccalbasthr ) {  | 
     //fine pagina visualizzata solo se ci sono problemi | 
| 685 | 
             check = true;        | 
     // | 
| 686 | 
             f3pd3col = 45; | 
  | 
| 687 | 
  | 
     //Prepara le finestre  | 
| 688 | 
  | 
        //finestra con figure C14,C15,C16 | 
| 689 | 
  | 
     figura1 = new TCanvas("Calorimeter_calped_calrms_calgood", "Calorimeter_calped_calrms_calgood", 750, 950);//nuova finestra | 
| 690 | 
  | 
     figura1->SetFillColor(10); | 
| 691 | 
  | 
     figura1->Range(0,0,100,100); | 
| 692 | 
  | 
     // | 
| 693 | 
  | 
     ccalped = (float)incalped/((float)outcalped + (float)incalped); | 
| 694 | 
  | 
     Int_t f1pd1col = 10;//costante=10 | 
| 695 | 
  | 
     if ( ccalped < ccalpedthr ) { //se % strip con piedistallo buono < numero minimo segna soglia   | 
| 696 | 
  | 
       check = true;     //flag per segnalare errori | 
| 697 | 
  | 
       f1pd1col = 45;    // (se ci sono problemi, cambia colore) | 
| 698 | 
  | 
     }; | 
| 699 | 
  | 
     // | 
| 700 | 
  | 
     ccalrms = (float)incalrms/((float)outcalrms + (float)incalrms); | 
| 701 | 
  | 
     Int_t f1pd2col = 10; | 
| 702 | 
  | 
     if ( ccalrms < ccalrmsthr ) { //se % strip con rms buono< numero minimo segna errore | 
| 703 | 
  | 
       check = true;      | 
| 704 | 
  | 
       f1pd2col = 45; | 
| 705 | 
  | 
     }; | 
| 706 | 
  | 
     // | 
| 707 | 
  | 
     ccalbad = (float)totcalbad/4224.; | 
| 708 | 
  | 
     Int_t f1pd3col = 10; | 
| 709 | 
  | 
     if ( ccalbad > ccalbadthr ) { //se il numero di strip escluse dalla calibrazione e' troppo alto segna errore | 
| 710 | 
  | 
       check = true;      | 
| 711 | 
  | 
       f1pd3col = 45; | 
| 712 | 
  | 
     }; | 
| 713 | 
  | 
     // | 
| 714 | 
  | 
     TPad *f1pd1 = new TPad("f1pd1","This is f1pad1",0.02,0.684,0.98,0.95,f1pd1col);//prepara le pad di figura1 | 
| 715 | 
  | 
     TPad *f1pd2 = new TPad("f1pd2","This is f1pad2",0.02,0.367,0.98,0.634,f1pd2col); | 
| 716 | 
  | 
     TPad *f1pd3 = new TPad("f1pd3","This is f1pad3",0.02,0.05,0.98,0.317,f1pd3col); | 
| 717 | 
  | 
     figura1->Clear(); | 
| 718 | 
  | 
     figura1->cd(); | 
| 719 | 
  | 
     f1pd1->SetTicks(); | 
| 720 | 
  | 
     f1pd2->SetTicks(); | 
| 721 | 
  | 
     f1pd3->SetTicks(); | 
| 722 | 
  | 
     f1pd1->Draw(); | 
| 723 | 
  | 
     f1pd2->Draw(); | 
| 724 | 
  | 
     f1pd3->Draw(); | 
| 725 | 
  | 
     figura1->Draw(); | 
| 726 | 
  | 
  | 
| 727 | 
  | 
        //finestra con figure C17,C18,C19  | 
| 728 | 
  | 
     figura3 = new TCanvas("Calorimeter_calthr_calvar_calbase", "Calorimeter_calthr_calvar_calbase", 750, 950); | 
| 729 | 
  | 
     figura3->SetFillColor(10); | 
| 730 | 
  | 
     figura3->Range(0,0,100,100); | 
| 731 | 
  | 
     // | 
| 732 | 
  | 
     ccalthr = (float)incalthr/((float)outcalthr + (float)incalthr); | 
| 733 | 
  | 
     Int_t f3pd1col = 10; | 
| 734 | 
  | 
     if ( ccalthr < ccalthrthr ) { //controlla % strip fuori soglia | 
| 735 | 
  | 
       check = true;      | 
| 736 | 
  | 
       f3pd1col = 45; | 
| 737 | 
  | 
     }; | 
| 738 | 
  | 
     // | 
| 739 | 
  | 
     ccalvar = (float)incalvar/((float)outcalvar + (float)incalvar); | 
| 740 | 
  | 
     Int_t f3pd2col = 10; | 
| 741 | 
  | 
     if ( ccalvar < ccalvarthr ) { //controlla strip con varianza fuori dai limiti | 
| 742 | 
  | 
       check = true;      | 
| 743 | 
  | 
       f3pd2col = 45; | 
| 744 | 
  | 
     }; | 
| 745 | 
  | 
     // | 
| 746 | 
  | 
     ccalbas = (float)incalbas/((float)outcalbas + (float)incalbas); | 
| 747 | 
  | 
     Int_t f3pd3col = 10; | 
| 748 | 
  | 
     if ( ccalbas < ccalbasthr ) { //controlla strip con baseline fuori dai limiti | 
| 749 | 
  | 
       check = true;      | 
| 750 | 
  | 
       f3pd3col = 45; | 
| 751 | 
  | 
     }; | 
| 752 | 
  | 
     // | 
| 753 | 
  | 
     TPad *f3pd1 = new TPad("f3pd1","This is f3pad1",0.02,0.684,0.98,0.95,f3pd1col);//prepara le pad di figura 3 | 
| 754 | 
  | 
     TPad *f3pd2 = new TPad("f3pd2","This is f3pad2",0.02,0.367,0.98,0.634,f3pd2col); | 
| 755 | 
  | 
     TPad *f3pd3 = new TPad("f3pd3","This is f3pad3",0.02,0.05,0.98,0.317,f3pd3col); | 
| 756 | 
  | 
     figura3->Clear();//cancella tutto in figura 3 | 
| 757 | 
  | 
     figura3->cd(); | 
| 758 | 
  | 
     f3pd1->SetTicks(); | 
| 759 | 
  | 
     f3pd2->SetTicks(); | 
| 760 | 
  | 
     f3pd3->SetTicks(); | 
| 761 | 
  | 
     f3pd1->Draw(); | 
| 762 | 
  | 
     f3pd2->Draw(); | 
| 763 | 
  | 
     f3pd3->Draw(); | 
| 764 | 
  | 
     figura3->Draw();        | 
| 765 | 
  | 
      | 
| 766 | 
  | 
  | 
| 767 | 
  | 
     //mette i titoli nella figura 1 | 
| 768 | 
  | 
     gStyle->SetOptStat("N"); | 
| 769 | 
  | 
     figura1->cd(); | 
| 770 | 
  | 
     gStyle->SetNdivisions(322,"x"); | 
| 771 | 
  | 
     t=new TLatex(); | 
| 772 | 
  | 
     t->SetTextFont(32); | 
| 773 | 
  | 
     t->SetTextColor(1); | 
| 774 | 
  | 
     t->SetTextSize(0.025); | 
| 775 | 
  | 
     t->SetTextAlign(12); | 
| 776 | 
  | 
     titolo.str(""); | 
| 777 | 
  | 
     titolo << "EXPERT - Calorimeter: calped/calrms/calgood - file "; | 
| 778 | 
  | 
     titolo << file; | 
| 779 | 
  | 
     titolo << " - calibration number "; | 
| 780 | 
  | 
     titolo << (i+1); | 
| 781 | 
  | 
     sottotitolo.str(""); | 
| 782 | 
  | 
     sottotitolo << "CPU OBT:" <<cpuobt; | 
| 783 | 
  | 
     sottotitolo << " | OBT pk1:" <<obt0; | 
| 784 | 
  | 
     sottotitolo << " - OBT pk2:"<<obt1; | 
| 785 | 
  | 
     sottotitolo << " - OBT pk3:"<<obt2; | 
| 786 | 
  | 
     sottotitolo << " - OBT pk4:"<<obt3; | 
| 787 | 
  | 
     t->DrawLatex(0.5,98.,titolo.str().c_str()); | 
| 788 | 
  | 
     t->SetTextSize(0.02); | 
| 789 | 
  | 
     t->DrawLatex(0.5,96.,sottotitolo.str().c_str()); | 
| 790 | 
  | 
     t->SetTextSize(0.03); | 
| 791 | 
  | 
     // | 
| 792 | 
  | 
     f1pd1->cd(); | 
| 793 | 
  | 
     //titoli al grafico calped | 
| 794 | 
  | 
     calped->GetXaxis()->SetNdivisions(322); | 
| 795 | 
  | 
     calped->SetXTitle("strip"); | 
| 796 | 
  | 
     calped->SetYTitle("ADC channels"); | 
| 797 | 
  | 
     calped->SetMaximum(3000.); | 
| 798 | 
  | 
     calped->SetMinimum(-3000.); | 
| 799 | 
  | 
 //disegna istogramma calped | 
| 800 | 
  | 
     calped->Draw(); | 
| 801 | 
  | 
     //disegna la banda di accettazione | 
| 802 | 
  | 
     TPolyLine *banda1; | 
| 803 | 
  | 
     Double_t xc[4] = {0.,4224.,4224.,0.}; | 
| 804 | 
  | 
     Double_t yc[4] = {-700.,-700.,700.,700.}; | 
| 805 | 
  | 
     banda1 = new TPolyLine(4,xc,yc); | 
| 806 | 
  | 
     banda1->SetLineColor(5); | 
| 807 | 
  | 
     banda1->SetFillColor(5); | 
| 808 | 
  | 
     banda1->SetLineWidth(1); | 
| 809 | 
  | 
     banda1->Draw("fSAME"); | 
| 810 | 
  | 
     //banda per le strip difettose | 
| 811 | 
  | 
     TPolyLine *banda2; | 
| 812 | 
  | 
     Double_t xc2[4] = {4031.5,4047.5,4047.5,4031.5}; | 
| 813 | 
  | 
     //  Double_t yc2[4] = {-2500.,-2500.,28000.,28000.}; | 
| 814 | 
  | 
     Double_t yc2[4] = {-3000.,-3000.,3000.,3000.}; | 
| 815 | 
  | 
     banda2 = new TPolyLine(4,xc2,yc2); | 
| 816 | 
  | 
     banda2->SetLineColor(5); | 
| 817 | 
  | 
     banda2->SetFillColor(5); | 
| 818 | 
  | 
     banda2->SetLineWidth(1); | 
| 819 | 
  | 
     banda2->Draw("fSAME"); | 
| 820 | 
  | 
  | 
| 821 | 
  | 
     calped->Draw("SAME"); | 
| 822 | 
  | 
     // | 
| 823 | 
  | 
     f1pd2->cd(); | 
| 824 | 
  | 
     //prepara grafico calrms | 
| 825 | 
  | 
     f1pd2->SetLogy(); | 
| 826 | 
  | 
     calrms->GetXaxis()->SetNdivisions(322); | 
| 827 | 
  | 
 //disegna istogramma calrms | 
| 828 | 
  | 
     calrms->Draw(); | 
| 829 | 
  | 
     //banda di accettazione | 
| 830 | 
  | 
     Double_t xd[4] = {0.,4224.,4224.,0.}; | 
| 831 | 
  | 
     Double_t yd[4] = {1.,1.,10.,10.}; | 
| 832 | 
  | 
     banda1 = new TPolyLine(4,xd,yd); | 
| 833 | 
  | 
     banda1->SetLineColor(5); | 
| 834 | 
  | 
     banda1->SetFillColor(5); | 
| 835 | 
  | 
     banda1->SetLineWidth(1); | 
| 836 | 
  | 
     banda1->Draw("fSAME"); | 
| 837 | 
  | 
  | 
| 838 | 
  | 
     Float_t minrm = calrms->GetMinimum(); | 
| 839 | 
  | 
     Float_t maxrm = calrms->GetMaximum(); | 
| 840 | 
  | 
     Double_t xrm2[4] = {3449.,3551.,3551.,3449.}; | 
| 841 | 
  | 
     Double_t yrm2[4] = {minrm,minrm,maxrm,maxrm}; | 
| 842 | 
  | 
     //banda per strip difettose | 
| 843 | 
  | 
     banda2 = new TPolyLine(4,xrm2,yrm2); | 
| 844 | 
  | 
     banda2->SetLineColor(5); | 
| 845 | 
  | 
     banda2->SetFillColor(5); | 
| 846 | 
  | 
     banda2->SetLineWidth(1); | 
| 847 | 
  | 
     banda2->Draw("fSAME"); | 
| 848 | 
  | 
  | 
| 849 | 
  | 
     calrms->SetXTitle("strip"); | 
| 850 | 
  | 
     calrms->SetYTitle("ADC channels"); | 
| 851 | 
  | 
  | 
| 852 | 
  | 
     calrms->Draw("SAME"); | 
| 853 | 
  | 
     //prepara grafico calbad | 
| 854 | 
  | 
     f1pd3->cd(); | 
| 855 | 
  | 
     gStyle->SetNdivisions(344,"x"); | 
| 856 | 
  | 
     calbad->GetXaxis()->SetNdivisions(322); | 
| 857 | 
  | 
 //disegna calbad | 
| 858 | 
  | 
     calbad->Draw(); | 
| 859 | 
  | 
     calbad->SetXTitle("strip"); | 
| 860 | 
  | 
     calbad->SetYTitle("0=good 255=bad"); | 
| 861 | 
  | 
     // | 
| 862 | 
  | 
     f1pd1->Update(); | 
| 863 | 
  | 
     f1pd2->Update(); | 
| 864 | 
  | 
     f1pd3->Update(); | 
| 865 | 
  | 
     figura1->Update(); | 
| 866 | 
  | 
     // | 
| 867 | 
  | 
  | 
| 868 | 
  | 
      | 
| 869 | 
  | 
 //pagina con figure C17,C18,C19 | 
| 870 | 
  | 
     figura3->cd(); | 
| 871 | 
  | 
     gStyle->SetNdivisions(644,"x"); | 
| 872 | 
  | 
     t=new TLatex(); | 
| 873 | 
  | 
     t->SetTextFont(32); | 
| 874 | 
  | 
     t->SetTextColor(1); | 
| 875 | 
  | 
     t->SetTextSize(0.025); | 
| 876 | 
  | 
     t->SetTextAlign(12); | 
| 877 | 
  | 
     titolo.str(""); | 
| 878 | 
  | 
     titolo << "EXPERT - Calorimeter: calthr/calvar/calbase - file "; | 
| 879 | 
  | 
     titolo << file; | 
| 880 | 
  | 
     titolo << " - calibration number "; | 
| 881 | 
  | 
     titolo << (i+1); | 
| 882 | 
  | 
     t->DrawLatex(0.5,98.,titolo.str().c_str()); | 
| 883 | 
  | 
     t->SetTextSize(0.02); | 
| 884 | 
  | 
     t->DrawLatex(0.5,96.,sottotitolo.str().c_str()); | 
| 885 | 
  | 
     t->SetTextSize(0.03); | 
| 886 | 
  | 
     // | 
| 887 | 
  | 
     f3pd1->cd(); | 
| 888 | 
  | 
     calthr->GetXaxis()->SetNdivisions(644); | 
| 889 | 
  | 
     calthr->SetXTitle("pre-amplifier"); | 
| 890 | 
  | 
     calthr->SetYTitle("ADC channels"); | 
| 891 | 
  | 
     calthr->Draw(); | 
| 892 | 
  | 
     Double_t xe[4] = {0.,264.,264.,0.}; | 
| 893 | 
  | 
     Double_t ye[4] = {12.,12.,25.,25.}; | 
| 894 | 
  | 
     banda1 = new TPolyLine(4,xe,ye); | 
| 895 | 
  | 
     banda1->SetLineColor(5); | 
| 896 | 
  | 
     banda1->SetFillColor(5); | 
| 897 | 
  | 
     banda1->SetLineWidth(1); | 
| 898 | 
  | 
     banda1->Draw("fSAME"); | 
| 899 | 
  | 
  | 
| 900 | 
  | 
     minrm = calthr->GetMinimum(); | 
| 901 | 
  | 
     maxrm = 1.05*calthr->GetMaximum(); | 
| 902 | 
  | 
     Double_t xth2[4] = {215.,221.,221.,215.}; | 
| 903 | 
  | 
     Double_t yth2[4] = {minrm,minrm,maxrm,maxrm}; | 
| 904 | 
  | 
     banda2 = new TPolyLine(4,xth2,yth2); | 
| 905 | 
  | 
     banda2->SetLineColor(5); | 
| 906 | 
  | 
     banda2->SetFillColor(5); | 
| 907 | 
  | 
     banda2->SetLineWidth(1); | 
| 908 | 
  | 
     banda2->Draw("fSAME"); | 
| 909 | 
  | 
     // | 
| 910 | 
  | 
     calthr->Draw("SAME"); | 
| 911 | 
  | 
  | 
| 912 | 
  | 
  | 
| 913 | 
  | 
     f3pd2->cd(); | 
| 914 | 
  | 
     //  gPad->SetLogy(); | 
| 915 | 
  | 
     //banda di soglia per calvar portata a 9, prima era a 8) | 
| 916 | 
  | 
     calvar->SetMaximum(25.); | 
| 917 | 
  | 
     calvar->GetXaxis()->SetNdivisions(644); | 
| 918 | 
  | 
     calvar->SetXTitle("pre-amplifier"); | 
| 919 | 
  | 
     calvar->SetYTitle("ADC channels"); | 
| 920 | 
  | 
     calvar->Draw(); | 
| 921 | 
  | 
     Double_t xt[4] = {0.,264.,264.,0.}; | 
| 922 | 
  | 
     Double_t yt[4] = {1.,1.,9.,9.}; | 
| 923 | 
  | 
     banda1 = new TPolyLine(4,xt,yt); | 
| 924 | 
  | 
     banda1->SetLineColor(5); | 
| 925 | 
  | 
     banda1->SetFillColor(5); | 
| 926 | 
  | 
     banda1->SetLineWidth(1); | 
| 927 | 
  | 
     banda1->Draw("fSAME"); | 
| 928 | 
  | 
  | 
| 929 | 
  | 
     minrm = calvar->GetMinimum(); | 
| 930 | 
  | 
     maxrm = 1.05*calvar->GetMaximum(); | 
| 931 | 
  | 
     Double_t xva2[4] = {215.,221.,221.,215.}; | 
| 932 | 
  | 
     Double_t yva2[4] = {minrm,minrm,maxrm,maxrm}; | 
| 933 | 
  | 
     banda2 = new TPolyLine(4,xva2,yva2); | 
| 934 | 
  | 
     banda2->SetLineColor(5); | 
| 935 | 
  | 
     banda2->SetFillColor(5); | 
| 936 | 
  | 
     banda2->SetLineWidth(1); | 
| 937 | 
  | 
     banda2->Draw("fSAME"); | 
| 938 | 
  | 
     // | 
| 939 | 
  | 
     calvar->Draw("SAME"); | 
| 940 | 
  | 
  | 
| 941 | 
  | 
  | 
| 942 | 
  | 
     f3pd3->cd(); | 
| 943 | 
  | 
     calbase->GetXaxis()->SetNdivisions(644); | 
| 944 | 
  | 
     calbase->SetXTitle("pre-amplifier"); | 
| 945 | 
  | 
     calbase->SetYTitle("ADC channels"); | 
| 946 | 
  | 
     calbase->Draw(); | 
| 947 | 
  | 
     Double_t xg[4] = {0.,264.,264.,0.}; | 
| 948 | 
  | 
     Double_t yg[4] = {2000.,2000.,5500.,5500.}; | 
| 949 | 
  | 
     banda1 = new TPolyLine(4,xg,yg); | 
| 950 | 
  | 
     banda1->SetLineColor(5); | 
| 951 | 
  | 
     banda1->SetFillColor(5); | 
| 952 | 
  | 
     banda1->SetLineWidth(1); | 
| 953 | 
  | 
     banda1->Draw("fSAME"); | 
| 954 | 
  | 
     calbase->Draw("SAME"); | 
| 955 | 
  | 
     // | 
| 956 | 
  | 
     f3pd1->Update(); | 
| 957 | 
  | 
     f3pd2->Update(); | 
| 958 | 
  | 
     f3pd3->Update(); | 
| 959 | 
  | 
     figura3->Update(); | 
| 960 | 
  | 
     // | 
| 961 | 
  | 
     //file output | 
| 962 | 
  | 
     if ( !strcmp(format,"ps") ) { | 
| 963 | 
  | 
       if ( figmatra ) { | 
| 964 | 
  | 
         figura2->Print(figsave.str().c_str(),"Portrait"); | 
| 965 | 
  | 
         if ( ci == minev ) { | 
| 966 | 
  | 
           figsave.str(""); | 
| 967 | 
  | 
           figsave << outdir << "/" ; | 
| 968 | 
  | 
           figsave << figrec << "_CaloCHKCALIB."; | 
| 969 | 
  | 
           figsave << format; | 
| 970 | 
         }; | 
         }; | 
| 971 | 
         // | 
       }; | 
| 972 | 
         TPad *f3pd1 = new TPad("f3pd1","This is f3pad1",0.02,0.684,0.98,0.95,f3pd1col); | 
       // | 
| 973 | 
         TPad *f3pd2 = new TPad("f3pd2","This is f3pad2",0.02,0.367,0.98,0.634,f3pd2col); | 
       figura1->Print(figsave.str().c_str(),"Portrait"); | 
| 974 | 
         TPad *f3pd3 = new TPad("f3pd3","This is f3pad3",0.02,0.05,0.98,0.317,f3pd3col); | 
       if ( ci == minev ) { | 
| 975 | 
         figura3->Clear(); | 
         figsave.str(""); | 
| 976 | 
         figura3->cd(); | 
         figsave << outdir << "/" ; | 
| 977 | 
         f3pd1->SetTicks(); | 
         figsave << figrec << "_CaloCHKCALIB."; | 
| 978 | 
         f3pd2->SetTicks(); | 
         figsave << format; | 
| 979 | 
         f3pd3->SetTicks(); | 
       }; | 
| 980 | 
         f3pd1->Draw(); | 
       //             | 
| 981 | 
         f3pd2->Draw(); | 
       figura3->Print(figsave.str().c_str(),"Portrait"); | 
| 982 | 
         f3pd3->Draw(); | 
       // | 
| 983 | 
         figura3->Draw();        | 
     } else { | 
| 984 | 
         // | 
       if ( figmatra ) { | 
| 985 | 
         gStyle->SetOptStat("N"); | 
         figsave.str(""); | 
| 986 | 
         figura1->cd(); | 
         figsave << outdir << "/" ; | 
| 987 | 
         gStyle->SetNdivisions(322,"x"); | 
         figsave << figrec << "_CaloCHKCALIB1_"; | 
| 988 | 
         t=new TLatex(); | 
         figsave << (i+1) << "."; | 
| 989 | 
         t->SetTextFont(32); | 
         figsave << format; | 
| 990 | 
         t->SetTextColor(1); | 
         figura2->SaveAs(figsave.str().c_str()); | 
| 991 | 
         t->SetTextSize(0.025); | 
       }; | 
| 992 | 
         t->SetTextAlign(12); | 
       // | 
| 993 | 
         titolo.str(""); | 
       figsave1.str(""); | 
| 994 | 
         titolo << "EXPERT - Calorimeter: calped/calrms/calgood - file "; | 
       figsave1 << outdir << "/" ; | 
| 995 | 
         titolo << file; | 
       figsave1 << figrec << "_CaloCHKCALIB2_"; | 
| 996 | 
         titolo << " - calibration number "; | 
       figsave1 << (i+1) << "."; | 
| 997 | 
         titolo << (i+1); | 
       figsave1 << format; | 
| 998 | 
         t->DrawLatex(0.5,97.,titolo.str().c_str()); | 
       figura1->SaveAs(figsave1.str().c_str()); | 
| 999 | 
         t->SetTextSize(0.03); | 
       // | 
| 1000 | 
         f1pd1->cd(); | 
       figsave2.str(""); | 
| 1001 | 
         // | 
       figsave2 << outdir << "/" ; | 
| 1002 | 
         calped->GetXaxis()->SetNdivisions(322); | 
       figsave2 << figrec << "_CaloCHKCALIB3_"; | 
| 1003 | 
         calped->SetXTitle("strip"); | 
       figsave2 << (i+1) << "."; | 
| 1004 | 
         calped->SetYTitle("ADC channels"); | 
       figsave2 << format; | 
| 1005 | 
         calped->Draw(); | 
       figura3->SaveAs(figsave2.str().c_str()); | 
| 1006 | 
         TPolyLine *banda1; | 
       // | 
| 1007 | 
         Double_t xc[4] = {0.,4224.,4224.,0.}; | 
     };  | 
| 1008 | 
         Double_t yc[4] = {-700.,-700.,700.,700.}; | 
     if ( iactive && w4i ){ | 
| 1009 | 
         banda1 = new TPolyLine(4,xc,yc); | 
       while ( gROOT->GetListOfCanvases()->FindObject(figura2) || gROOT->GetListOfCanvases()->FindObject(figura1) || gROOT->GetListOfCanvases()->FindObject(figura3) ){ | 
| 1010 | 
         banda1->SetLineColor(5); | 
         gSystem->ProcessEvents(); | 
| 1011 | 
         banda1->SetFillColor(5); | 
         gSystem->Sleep(10); | 
| 1012 | 
         banda1->SetLineWidth(1); | 
       }; | 
| 1013 | 
         banda1->Draw("fSAME"); | 
     }; | 
| 1014 | 
         TPolyLine *banda2; | 
   };//fine del loop sulle calibrazioni | 
| 1015 | 
         Double_t xc2[4] = {4031.5,4047.5,4047.5,4031.5}; | 
   // | 
| 1016 | 
         Double_t yc2[4] = {-2500.,-2500.,28000.,28000.}; | 
   // | 
| 1017 | 
         banda2 = new TPolyLine(4,xc2,yc2); | 
   // | 
| 1018 | 
         banda2->SetLineColor(5); | 
   // | 
| 1019 | 
         banda2->SetFillColor(5); | 
   //  report sheet: | 
| 1020 | 
         banda2->SetLineWidth(1); | 
   // | 
| 1021 | 
         banda2->Draw("fSAME"); | 
   stringstream errore; | 
| 1022 | 
         calped->Draw("SAME"); | 
   rapporto= new TCanvas("Calorimeter calibration report", "Calorimeter calibration report", 750, 950); | 
| 1023 | 
         f1pd2->cd(); | 
   rapporto->cd(); | 
| 1024 | 
         f1pd2->SetLogy(); | 
   rapporto->SetFillColor(10); | 
| 1025 | 
         calrms->GetXaxis()->SetNdivisions(322); | 
   rapporto->Range(0,0,100,100); | 
| 1026 | 
         calrms->Draw(); | 
   TLatex *t=new TLatex(); | 
| 1027 | 
         Double_t xd[4] = {0.,4224.,4224.,0.}; | 
   t->SetTextFont(32); | 
| 1028 | 
         Double_t yd[4] = {1.,1.,7.,7.}; | 
   t->SetTextColor(1); | 
| 1029 | 
         banda1 = new TPolyLine(4,xd,yd); | 
   t->SetTextSize(0.035); | 
| 1030 | 
         banda1->SetLineColor(5); | 
   t->SetTextAlign(12); | 
| 1031 | 
         banda1->SetFillColor(5); | 
   errore.str(""); | 
| 1032 | 
         banda1->SetLineWidth(1); | 
   errore << "BASIC - C20 - Calibrations in file: " << file; | 
| 1033 | 
         banda1->Draw("fSAME"); | 
   errore << " "; | 
| 1034 | 
         calrms->SetXTitle("strip"); | 
   t->SetTextSize(0.02); | 
| 1035 | 
         calrms->SetYTitle("ADC channels"); | 
   t->DrawLatex(2.,99.,errore.str().c_str()); | 
| 1036 | 
         calrms->Draw("SAME"); | 
   // | 
| 1037 | 
         f1pd3->cd(); | 
   TPad *pad1; | 
| 1038 | 
         gStyle->SetNdivisions(344,"x"); | 
   TPad *pad2; | 
| 1039 | 
         calbad->GetXaxis()->SetNdivisions(322); | 
   TPad *pad3; | 
| 1040 | 
         calbad->Draw(); | 
   TPad *pad4; | 
| 1041 | 
         calbad->SetXTitle("strip"); | 
   pad1 = new TPad("pad1","This is pad1",0.02,0.47,0.49,0.90,19); | 
| 1042 | 
         calbad->SetYTitle("0=good 255=bad"); | 
   pad2 = new TPad("pad2","This is pad2",0.51,0.47,0.98,0.90,19); | 
| 1043 | 
         f1pd1->Update(); | 
   pad3 = new TPad("pad3","This is pad3",0.02,0.02,0.49,0.45,19); | 
| 1044 | 
         f1pd2->Update(); | 
   pad4 = new TPad("pad4","This is pad4",0.51,0.02,0.98,0.45,19); | 
| 1045 | 
         f1pd3->Update(); | 
   pad1->Range(0,0,100,100); | 
| 1046 | 
         figura1->Update(); | 
   pad2->Range(0,0,100,100); | 
| 1047 | 
         // | 
   pad3->Range(0,0,100,100); | 
| 1048 | 
         figura3->cd(); | 
   pad4->Range(0,0,100,100); | 
| 1049 | 
         gStyle->SetNdivisions(644,"x"); | 
   // | 
| 1050 | 
         t=new TLatex(); | 
   pad1->Draw(); | 
| 1051 | 
         t->SetTextFont(32); | 
   pad2->Draw(); | 
| 1052 | 
         t->SetTextColor(1); | 
   pad3->Draw(); | 
| 1053 | 
         t->SetTextSize(0.025); | 
   pad4->Draw(); | 
| 1054 | 
         t->SetTextAlign(12); | 
   // | 
| 1055 | 
         titolo.str(""); | 
   const char *sezione = ""; | 
| 1056 | 
         titolo << "EXPERT - Calorimeter: calthr/calvar/calbase - file "; | 
   for (Int_t si = 0; si < 4; si++){ | 
| 1057 | 
         titolo << file; | 
     if (si == 2)  | 
| 1058 | 
         titolo << " - calibration number "; | 
       {  | 
| 1059 | 
         titolo << (i+1); | 
         pad1->cd() ;  | 
| 1060 | 
         t->DrawLatex(0.5,97.,titolo.str().c_str()); | 
         sezione = "** Section YE (x even) **"; | 
| 1061 | 
         t->SetTextSize(0.03); | 
       } | 
| 1062 | 
         // | 
     if (si == 3)  | 
| 1063 | 
         f3pd1->cd(); | 
       { | 
| 1064 | 
         calthr->GetXaxis()->SetNdivisions(644); | 
         pad2->cd(); | 
| 1065 | 
         calthr->SetXTitle("pre-amplifier"); | 
         sezione = "** Section YO (x odd) **"; | 
| 1066 | 
         calthr->SetYTitle("ADC channels"); | 
       } | 
| 1067 | 
         calthr->Draw(); | 
     if (si == 0) | 
| 1068 | 
         Double_t xe[4] = {0.,264.,264.,0.}; | 
       { | 
| 1069 | 
         Double_t ye[4] = {12.,12.,21.,21.}; | 
         pad3->cd(); | 
| 1070 | 
         banda1 = new TPolyLine(4,xe,ye); | 
         sezione = "** Section XE (y odd) **"; | 
| 1071 | 
         banda1->SetLineColor(5); | 
       } | 
| 1072 | 
         banda1->SetFillColor(5); | 
     if (si == 1) | 
| 1073 | 
         banda1->SetLineWidth(1); | 
       { | 
| 1074 | 
         banda1->Draw("fSAME"); | 
         pad4->cd(); | 
| 1075 | 
         calthr->Draw("SAME"); | 
         sezione = "** Section XO (y even) **"; | 
| 1076 | 
         f3pd2->cd(); | 
       } | 
| 1077 | 
         calvar->GetXaxis()->SetNdivisions(644); | 
     t->SetTextFont(32); | 
| 1078 | 
         calvar->SetXTitle("pre-amplifier"); | 
     t->SetTextColor(1);  | 
| 1079 | 
         calvar->SetYTitle("ADC channels"); | 
     t->SetTextSize(0.05);  | 
| 1080 | 
         calvar->Draw(); | 
     t->SetTextAlign(12); | 
| 1081 | 
         Double_t xt[4] = {0.,264.,264.,0.}; | 
     t->DrawLatex(33.,97.,sezione); | 
| 1082 | 
         Double_t yt[4] = {1.,1.,8.,8.}; | 
     t->SetTextSize(0.05);  | 
| 1083 | 
         banda1 = new TPolyLine(4,xt,yt); | 
  | 
| 1084 | 
         banda1->SetLineColor(5); | 
     //scorre ver cercando il j tipo di errore: 'si'=sezione    | 
| 1085 | 
         banda1->SetFillColor(5); | 
     for (Int_t j = 0; j < 23; j++){ | 
| 1086 | 
         banda1->SetLineWidth(1); | 
       if ( ver[si][j] ) {//controlla se le sezioni di ver[si][j] sonoe diverse da zero. | 
| 1087 | 
         banda1->Draw("fSAME"); | 
         t->SetTextColor(50); //controlla quali sono !=0 e assegna il rispettivo errore | 
| 1088 | 
         calvar->Draw("SAME"); | 
         if (j == 0) {//del calorimetro | 
| 1089 | 
         f3pd3->cd(); | 
           errore.str(""); | 
| 1090 | 
         calbase->GetXaxis()->SetNdivisions(644); | 
           errore << "* DSP ack error: " << ver[si][j]; | 
| 1091 | 
         calbase->SetXTitle("pre-amplifier"); | 
           errore << " time(s)"; | 
| 1092 | 
         calbase->SetYTitle("ADC channels"); | 
           t->DrawLatex(2.,30.,errore.str().c_str()); | 
| 1093 | 
         calbase->Draw(); | 
           check = true;  | 
| 1094 | 
         Double_t xg[4] = {0.,264.,264.,0.}; | 
         } | 
| 1095 | 
         Double_t yg[4] = {2000.,2000.,4500.,4500.}; | 
         if (j == 1) {//calorimetro | 
| 1096 | 
         banda1 = new TPolyLine(4,xg,yg); | 
           errore.str(""); | 
| 1097 | 
         banda1->SetLineColor(5); | 
           errore << "* Temperature alarm: " << ver[si][j]; | 
| 1098 | 
         banda1->SetFillColor(5); | 
           errore << " time(s)"; | 
| 1099 | 
         banda1->SetLineWidth(1); | 
           t->DrawLatex(2.,74.,errore.str().c_str()); | 
| 1100 | 
         banda1->Draw("fSAME"); | 
           check = true;  | 
| 1101 | 
         calbase->Draw("SAME"); | 
         } | 
| 1102 | 
         f3pd1->Update(); | 
         if (j == 2) {//calorimetro | 
| 1103 | 
         f3pd2->Update(); | 
           errore.str(""); | 
| 1104 | 
         f3pd3->Update(); | 
           errore << "* Latch up alarm: " << ver[si][j]; | 
| 1105 | 
         figura3->Update(); | 
           errore << " time(s)."; | 
| 1106 | 
         // | 
           t->DrawLatex(2.,65.,errore.str().c_str()); | 
| 1107 | 
         // | 
           check = true;  | 
| 1108 | 
         // | 
         } | 
| 1109 | 
         if ( ci == maxev-4 ) { | 
         if (j == 3) {//calorimetro | 
| 1110 | 
             // | 
           errore.str(""); | 
| 1111 | 
             //  report sheet: | 
           errore << "RAW mode: " << ver[si][j]; | 
| 1112 | 
             // | 
           errore << " time(s)"; | 
| 1113 | 
             stringstream errore; | 
           t->SetTextColor(38);  | 
| 1114 | 
             rapporto= new TCanvas("Calorimeter calibration report", "Calorimeter calibration report", 750, 950); | 
           t->DrawLatex(2.,90.,errore.str().c_str()); | 
| 1115 | 
             rapporto->cd(); | 
         } | 
| 1116 | 
             rapporto->SetFillColor(10); | 
         if (j == 4) {//calorimetro | 
| 1117 | 
             rapporto->Range(0,0,100,100); | 
           errore.str(""); | 
| 1118 | 
             t=new TLatex(); | 
           errore << "* CMD length error: " << ver[si][j]; | 
| 1119 | 
             t->SetTextFont(32); | 
           errore << " time(s)"; | 
| 1120 | 
             t->SetTextColor(1); | 
           t->DrawLatex(2.,66.,errore.str().c_str()); | 
| 1121 | 
             t->SetTextSize(0.035); | 
           check = true;  | 
| 1122 | 
             t->SetTextAlign(12); | 
         }               | 
| 1123 | 
             errore.str(""); | 
         if (j == 5) {//calorimetro | 
| 1124 | 
             errore << "BASIC - C20 - Calibrations in file: " << file; | 
           errore.str(""); | 
| 1125 | 
             errore << " "; | 
           errore << "* Execution error: " << ver[si][j]; | 
| 1126 | 
             t->SetTextSize(0.02); | 
           errore << " time(s)"; | 
| 1127 | 
             t->DrawLatex(2.,99.,errore.str().c_str()); | 
           t->DrawLatex(2.,62.,errore.str().c_str()); | 
| 1128 | 
             // | 
           check = true;  | 
| 1129 | 
             TPad *pad1; | 
         } | 
| 1130 | 
             TPad *pad2; | 
         if (j == 6) {//calorimetro | 
| 1131 | 
             TPad *pad3; | 
           errore.str(""); | 
| 1132 | 
             TPad *pad4; | 
           errore << "* CRC error (st. word): " << ver[si][j]; | 
| 1133 | 
             pad1 = new TPad("pad1","This is pad1",0.02,0.47,0.49,0.90,19); | 
           errore << " time(s)"; | 
| 1134 | 
             pad2 = new TPad("pad2","This is pad2",0.51,0.47,0.98,0.90,19); | 
           t->DrawLatex(2.,58.,errore.str().c_str()); | 
| 1135 | 
             pad3 = new TPad("pad3","This is pad3",0.02,0.02,0.49,0.45,19); | 
           check = true;  | 
| 1136 | 
             pad4 = new TPad("pad4","This is pad4",0.51,0.02,0.98,0.45,19); | 
         } | 
| 1137 | 
             pad1->Range(0,0,100,100); | 
         if (j == 7) { | 
| 1138 | 
             pad2->Range(0,0,100,100); | 
           errore.str(""); | 
| 1139 | 
             pad3->Range(0,0,100,100); | 
           errore << "View or command not recognized: " << ver[si][j]; | 
| 1140 | 
             pad4->Range(0,0,100,100); | 
           errore << " time(s)"; | 
| 1141 | 
             // | 
           t->DrawLatex(2.,54.,errore.str().c_str()); | 
| 1142 | 
             pad1->Draw(); | 
           check = true;  | 
| 1143 | 
             pad2->Draw(); | 
         } | 
| 1144 | 
             pad3->Draw(); | 
         // | 
| 1145 | 
             pad4->Draw(); | 
         if (j == 8) { | 
| 1146 | 
             // | 
           errore.str(""); | 
| 1147 | 
             char *sezione = 0; | 
           errore << "Missing section: " << ver[si][j]; | 
| 1148 | 
             for (Int_t si = 0; si < 4; si++){ | 
           errore << " time(s)"; | 
| 1149 | 
                 if (si == 2)  | 
           t->DrawLatex(2.,50.,errore.str().c_str()); | 
| 1150 | 
                     {  | 
           check = true;  | 
| 1151 | 
                         pad1->cd() ;  | 
         } | 
| 1152 | 
                         sezione = "** Section YE (x even) **"; | 
         if (j == 9) { | 
| 1153 | 
                     } | 
           errore.str(""); | 
| 1154 | 
                 if (si == 3)  | 
           errore << "RAW MODE COMMAND: " << ver[si][j]; | 
| 1155 | 
                     { | 
           errore << " time(s)"; | 
| 1156 | 
                         pad2->cd(); | 
           t->DrawLatex(2.,42.,errore.str().c_str()); | 
| 1157 | 
                         sezione = "** Section YO (x odd) **"; | 
         }  | 
| 1158 | 
                     } | 
         if (j == 11) { | 
| 1159 | 
                 if (si == 0) | 
           errore.str(""); | 
| 1160 | 
                     { | 
           errore << "CRC error (data): " << ver[si][j]; | 
| 1161 | 
                         pad3->cd(); | 
           errore << " time(s)"; | 
| 1162 | 
                         sezione = "** Section XE (y odd) **"; | 
           t->DrawLatex(2.,38.,errore.str().c_str()); | 
| 1163 | 
                     } | 
           check = true;  | 
| 1164 | 
                 if (si == 1) | 
         } | 
| 1165 | 
                     { | 
         if (j == 16) { | 
| 1166 | 
                         pad4->cd(); | 
           errore.str(""); | 
| 1167 | 
                         sezione = "** Section XO (y even) **"; | 
           errore << "Number of calibrations: " << ver[si][j]; | 
| 1168 | 
                     } | 
           t->SetTextColor(38);  | 
| 1169 | 
                 t->SetTextFont(32); | 
           t->DrawLatex(2.,86.,errore.str().c_str()); | 
| 1170 | 
                 t->SetTextColor(1);  | 
         } | 
| 1171 | 
                 t->SetTextSize(0.05);  | 
         if (j == 19) { | 
| 1172 | 
                 t->SetTextAlign(12); | 
           errore.str(""); | 
| 1173 | 
                 t->DrawLatex(33.,97.,sezione); | 
           errore << "Pedestal checksum wrong: " << ver[si][j]; | 
| 1174 | 
                 t->SetTextSize(0.05);  | 
           errore << " time(s)"; | 
| 1175 | 
                 for (Int_t j = 0; j < 23; j++){ | 
           t->DrawLatex(2.,14.,errore.str().c_str()); | 
| 1176 | 
                     if ( ver[si][j] ) { | 
           check = true;  | 
| 1177 | 
                         t->SetTextColor(50);  | 
         } | 
| 1178 | 
                         if (j == 0) { | 
         if (j == 20) { | 
| 1179 | 
                             errore.str(""); | 
           errore.str(""); | 
| 1180 | 
                             errore << "* DSP ack error: " << ver[si][j]; | 
           errore << "Thresholds checksum wrong: " << ver[si][j]; | 
| 1181 | 
                             errore << " time(s)"; | 
           errore << " time(s)"; | 
| 1182 | 
                             t->DrawLatex(2.,30.,errore.str().c_str()); | 
           t->DrawLatex(2.,10.,errore.str().c_str()); | 
| 1183 | 
                             check = true;        | 
           check = true;  | 
| 1184 | 
                         } | 
         } | 
| 1185 | 
                         if (j == 1) { | 
         if (j == 22) {  | 
| 1186 | 
                             errore.str(""); | 
           errore.str(""); | 
| 1187 | 
                             errore << "* Temperature alarm: " << ver[si][j]; | 
           errore << "Packet length is zero (YODA input error), skipped: " << ver[si][j]; | 
| 1188 | 
                             errore << " time(s)"; | 
           errore << " time(s)"; | 
| 1189 | 
                             t->DrawLatex(2.,74.,errore.str().c_str()); | 
           t->DrawLatex(2.,3.,errore.str().c_str()); | 
| 1190 | 
                             check = true;        | 
           check = true;  | 
 | 
                         } | 
  | 
 | 
                         if (j == 2) { | 
  | 
 | 
                             errore.str(""); | 
  | 
 | 
                             errore << "* Latch up alarm: " << ver[si][j]; | 
  | 
 | 
                             errore << " time(s)."; | 
  | 
 | 
                             t->DrawLatex(2.,65.,errore.str().c_str()); | 
  | 
 | 
                             check = true;        | 
  | 
 | 
                         } | 
  | 
 | 
                         if (j == 3) { | 
  | 
 | 
                             errore.str(""); | 
  | 
 | 
                             errore << "RAW mode: " << ver[si][j]; | 
  | 
 | 
                             errore << " time(s)"; | 
  | 
 | 
                             t->SetTextColor(38);  | 
  | 
 | 
                             t->DrawLatex(2.,90.,errore.str().c_str()); | 
  | 
 | 
                         } | 
  | 
 | 
                         if (j == 4) { | 
  | 
 | 
                             errore.str(""); | 
  | 
 | 
                             errore << "* CMD length error: " << ver[si][j]; | 
  | 
 | 
                             errore << " time(s)"; | 
  | 
 | 
                             t->DrawLatex(2.,66.,errore.str().c_str()); | 
  | 
 | 
                             check = true;        | 
  | 
 | 
                         }               | 
  | 
 | 
                         if (j == 5) { | 
  | 
 | 
                             errore.str(""); | 
  | 
 | 
                             errore << "* Execution error: " << ver[si][j]; | 
  | 
 | 
                             errore << " time(s)"; | 
  | 
 | 
                             t->DrawLatex(2.,62.,errore.str().c_str()); | 
  | 
 | 
                             check = true;        | 
  | 
 | 
                         } | 
  | 
 | 
                         if (j == 6) { | 
  | 
 | 
                             errore.str(""); | 
  | 
 | 
                             errore << "* CRC error (st. word): " << ver[si][j]; | 
  | 
 | 
                             errore << " time(s)"; | 
  | 
 | 
                             t->DrawLatex(2.,58.,errore.str().c_str()); | 
  | 
 | 
                             check = true;        | 
  | 
 | 
                         } | 
  | 
 | 
                         if (j == 7) { | 
  | 
 | 
                             errore.str(""); | 
  | 
 | 
                             errore << "View or command not recognized: " << ver[si][j]; | 
  | 
 | 
                             errore << " time(s)"; | 
  | 
 | 
                             t->DrawLatex(2.,54.,errore.str().c_str()); | 
  | 
 | 
                             check = true;        | 
  | 
 | 
                         } | 
  | 
 | 
                         // | 
  | 
 | 
                         if (j == 8) { | 
  | 
 | 
                             errore.str(""); | 
  | 
 | 
                             errore << "Missing section: " << ver[si][j]; | 
  | 
 | 
                             errore << " time(s)"; | 
  | 
 | 
                             t->DrawLatex(2.,50.,errore.str().c_str()); | 
  | 
 | 
                             check = true;        | 
  | 
 | 
                         } | 
  | 
 | 
                         if (j == 9) { | 
  | 
 | 
                             errore.str(""); | 
  | 
 | 
                             errore << "RAW MODE COMMAND: " << ver[si][j]; | 
  | 
 | 
                             errore << " time(s)"; | 
  | 
 | 
                             t->DrawLatex(2.,42.,errore.str().c_str()); | 
  | 
 | 
                         }  | 
  | 
 | 
                         if (j == 11) { | 
  | 
 | 
                             errore.str(""); | 
  | 
 | 
                             errore << "CRC error (data): " << ver[si][j]; | 
  | 
 | 
                             errore << " time(s)"; | 
  | 
 | 
                             t->DrawLatex(2.,38.,errore.str().c_str()); | 
  | 
 | 
                             check = true;        | 
  | 
 | 
                         } | 
  | 
 | 
                         if (j == 16) { | 
  | 
 | 
                             errore.str(""); | 
  | 
 | 
                             errore << "Number of calibrations: " << ver[si][j]; | 
  | 
 | 
                             t->SetTextColor(38);  | 
  | 
 | 
                             t->DrawLatex(2.,86.,errore.str().c_str()); | 
  | 
 | 
                         } | 
  | 
 | 
                         if (j == 19) { | 
  | 
 | 
                             errore.str(""); | 
  | 
 | 
                             errore << "Pedestal checksum wrong: " << ver[si][j]; | 
  | 
 | 
                             errore << " time(s)"; | 
  | 
 | 
                             t->DrawLatex(2.,14.,errore.str().c_str()); | 
  | 
 | 
                             check = true;        | 
  | 
 | 
                         } | 
  | 
 | 
                         if (j == 20) { | 
  | 
 | 
                             errore.str(""); | 
  | 
 | 
                             errore << "Thresholds checksum wrong: " << ver[si][j]; | 
  | 
 | 
                             errore << " time(s)"; | 
  | 
 | 
                             t->DrawLatex(2.,10.,errore.str().c_str()); | 
  | 
 | 
                             check = true;        | 
  | 
 | 
                         } | 
  | 
 | 
                         if (j == 22) {  | 
  | 
 | 
                             errore.str(""); | 
  | 
 | 
                             errore << "Packet length is zero (YODA input error), skipped: " << ver[si][j]; | 
  | 
 | 
                             errore << " time(s)"; | 
  | 
 | 
                             t->DrawLatex(2.,3.,errore.str().c_str()); | 
  | 
 | 
                             check = true;        | 
  | 
 | 
                         }; | 
  | 
 | 
                     }; | 
  | 
 | 
                 };  | 
  | 
 | 
             }; | 
  | 
 | 
             rapporto->cd(); | 
  | 
 | 
             t->SetTextFont(32); | 
  | 
 | 
             t->SetTextColor(1); | 
  | 
 | 
             t->SetTextSize(0.035); | 
  | 
 | 
             t->SetTextAlign(12); | 
  | 
 | 
             t->DrawLatex(7.,95.,"Calorimeter CALIBRATION quick look: "); | 
  | 
 | 
             //printf("vediamo: ccalped %f ccalrms %f ccalbad %f ccalthr %f ccalvar %f ccalbas %f \n",ccalped,ccalrms,ccalbad,ccalthr,ccalvar,ccalbas); | 
  | 
 | 
             if ( check ) { | 
  | 
 | 
                 t->SetTextColor(50); | 
  | 
 | 
                 t->DrawLatex(65.,95.,"WARNING, CHECK!");                 | 
  | 
 | 
                 t->SetTextColor(1); | 
  | 
 | 
             } else { | 
  | 
 | 
                 t->SetTextColor(38); | 
  | 
 | 
                 t->DrawLatex(65.,95.,"OK!"); | 
  | 
 | 
                 t->SetTextColor(1); | 
  | 
 | 
             };      | 
  | 
 | 
             rapporto->Update(); | 
  | 
 | 
         };    | 
  | 
 | 
         // | 
  | 
 | 
         if ( !strcmp(format,"ps") ) { | 
  | 
 | 
             if ( ci == minev ) { | 
  | 
 | 
                 figsave.str(""); | 
  | 
 | 
                 figsave << outdir << "/" ; | 
  | 
 | 
                 figsave << figrec << "_chkcalib."; | 
  | 
 | 
                 figsave << format; | 
  | 
 | 
                 figsave << "("; | 
  | 
 | 
             };               | 
  | 
 | 
             if ( figmatra ) { | 
  | 
 | 
                 figura2->Print(figsave.str().c_str(),"Portrait"); | 
  | 
 | 
                 if ( ci == minev ) { | 
  | 
 | 
                     figsave.str(""); | 
  | 
 | 
                     figsave << outdir << "/" ; | 
  | 
 | 
                     figsave << figrec << "_chkcalib."; | 
  | 
 | 
                     figsave << format; | 
  | 
 | 
                 }; | 
  | 
 | 
             }; | 
  | 
 | 
             // | 
  | 
 | 
             figura1->Print(figsave.str().c_str(),"Portrait"); | 
  | 
 | 
             if ( ci == minev ) { | 
  | 
 | 
                 figsave.str(""); | 
  | 
 | 
                 figsave << outdir << "/" ; | 
  | 
 | 
                 figsave << figrec << "_chkcalib."; | 
  | 
 | 
                 figsave << format; | 
  | 
 | 
             }; | 
  | 
 | 
             //       | 
  | 
 | 
             figura3->Print(figsave.str().c_str(),"Portrait"); | 
  | 
 | 
             // | 
  | 
 | 
             if ( ci == maxev-4 ) { | 
  | 
 | 
                 figsave.str(""); | 
  | 
 | 
                 figsave << outdir << "/" ; | 
  | 
 | 
                 figsave << figrec << "_chkcalib."; | 
  | 
 | 
                 figsave << format; | 
  | 
 | 
                 figsave << ")"; | 
  | 
 | 
                 rapporto->Print(figsave.str().c_str(),"Portrait"); | 
  | 
 | 
             };               | 
  | 
 | 
         } else { | 
  | 
 | 
             if ( figmatra ) { | 
  | 
 | 
                 figsave.str(""); | 
  | 
 | 
                 figsave << outdir << "/" ; | 
  | 
 | 
                 figsave << figrec << "_chkcalib1_"; | 
  | 
 | 
                 figsave << (i+1) << "."; | 
  | 
 | 
                 figsave << format; | 
  | 
 | 
                 figura2->SaveAs(figsave.str().c_str()); | 
  | 
 | 
             }; | 
  | 
 | 
             // | 
  | 
 | 
             figsave1.str(""); | 
  | 
 | 
             figsave1 << outdir << "/" ; | 
  | 
 | 
             figsave1 << figrec << "_chkcalib2_"; | 
  | 
 | 
             figsave1 << (i+1) << "."; | 
  | 
 | 
             figsave1 << format; | 
  | 
 | 
             figura1->SaveAs(figsave1.str().c_str()); | 
  | 
 | 
             // | 
  | 
 | 
             figsave2.str(""); | 
  | 
 | 
             figsave2 << outdir << "/" ; | 
  | 
 | 
             figsave2 << figrec << "_chkcalib3_"; | 
  | 
 | 
             figsave2 << (i+1) << "."; | 
  | 
 | 
             figsave2 << format; | 
  | 
 | 
             figura3->SaveAs(figsave2.str().c_str()); | 
  | 
 | 
             // | 
  | 
 | 
             if ( ci == maxev-4 ) { | 
  | 
 | 
                 figsave.str(""); | 
  | 
 | 
                 figsave << outdir << "/" ; | 
  | 
 | 
                 figsave << figrec << "_chkcalib_report."; | 
  | 
 | 
                 figsave << format; | 
  | 
 | 
                 rapporto->SaveAs(figsave.str().c_str()); | 
  | 
 | 
             };               | 
  | 
| 1191 | 
         }; | 
         }; | 
| 1192 | 
  | 
       }; | 
| 1193 | 
  | 
     };  | 
| 1194 | 
  | 
   }; | 
| 1195 | 
  | 
   rapporto->cd(); | 
| 1196 | 
  | 
   t->SetTextFont(32); | 
| 1197 | 
  | 
   t->SetTextColor(1); | 
| 1198 | 
  | 
   t->SetTextSize(0.035); | 
| 1199 | 
  | 
   t->SetTextAlign(12); | 
| 1200 | 
  | 
   t->DrawLatex(7.,95.,"Calorimeter CALIBRATION quick look: "); | 
| 1201 | 
  | 
   printf(" ccalped %f ccalrms %f ccalbad %f ccalthr %f ccalvar %f ccalbas %f \n",ccalped,ccalrms,ccalbad,ccalthr,ccalvar,ccalbas); | 
| 1202 | 
  | 
  | 
| 1203 | 
  | 
  | 
| 1204 | 
  | 
   if ( check ) { | 
| 1205 | 
  | 
     t->SetTextColor(50); | 
| 1206 | 
  | 
     t->DrawLatex(65.,95.,"WARNING, CHECK!");             | 
| 1207 | 
  | 
     t->SetTextColor(1); | 
| 1208 | 
  | 
   } else { | 
| 1209 | 
  | 
     t->SetTextColor(38); | 
| 1210 | 
  | 
     t->DrawLatex(65.,95.,"OK!"); | 
| 1211 | 
  | 
     t->SetTextColor(1); | 
| 1212 | 
  | 
   };      | 
| 1213 | 
  | 
   rapporto->Update(); | 
| 1214 | 
  | 
   // | 
| 1215 | 
  | 
   if ( !strcmp(format,"ps") ) { | 
| 1216 | 
  | 
     figsave.str(""); | 
| 1217 | 
  | 
     figsave << outdir << "/" ; | 
| 1218 | 
  | 
     figsave << figrec << "_CaloCHKCALIB."; | 
| 1219 | 
  | 
     figsave << format; | 
| 1220 | 
  | 
     figsave << ")"; | 
| 1221 | 
  | 
     rapporto->Print(figsave.str().c_str(),"Portrait"); | 
| 1222 | 
  | 
   } else { | 
| 1223 | 
  | 
     figsave.str(""); | 
| 1224 | 
  | 
     figsave << outdir << "/" ; | 
| 1225 | 
  | 
     figsave << figrec << "_CaloCHKCALIB_report."; | 
| 1226 | 
  | 
     figsave << format; | 
| 1227 | 
  | 
     rapporto->SaveAs(figsave.str().c_str()); | 
| 1228 | 
  | 
   }; | 
| 1229 | 
  | 
   if ( iactive && w4i ){ | 
| 1230 | 
  | 
     while ( gROOT->GetListOfCanvases()->FindObject(rapporto) ){ | 
| 1231 | 
  | 
       gSystem->ProcessEvents(); | 
| 1232 | 
  | 
       gSystem->Sleep(10); | 
| 1233 | 
     }; | 
     }; | 
| 1234 | 
     printf("\n");        | 
   }; | 
| 1235 | 
     return; | 
   printf("\n");  | 
| 1236 | 
  | 
   return; | 
| 1237 | 
 } | 
 } | 
| 1238 | 
  | 
          |