/[PAMELA software]/calo/flight/FQLOOK/macros/FCaloCHKCALIB.cxx
ViewVC logotype

Diff of /calo/flight/FQLOOK/macros/FCaloCHKCALIB.cxx

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.23