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

Diff of /quicklook/calo/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.17 by mocchiut, Tue Aug 11 14:19:52 2009 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 31  Line 33 
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>
# Line 49  Line 53 
53  #include <TApplication.h>  #include <TApplication.h>
54  //  //
55  #include <CalibCalPedEvent.h>  #include <CalibCalPedEvent.h>
56    #include <PamelaRun.h>
57  //  //
58  using namespace std;  using namespace std;
59  //  //
# Line 88  TString getFilename(const TString filena Line 93  TString getFilename(const TString filena
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];
# Line 100  typedef struct Calib { Line 105  typedef struct Calib {
105    Float_t calpuls[2][22][96];    Float_t calpuls[2][22][96];
106  } calib;  } calib;
107    
108    
109    
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){  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.);    gStyle->SetPaperSize(19.,25.);
114    //    //
115    TApplication *app = 0;    TApplication *app = 0; //crea un ambiente root (app)
116    if ( iactive ) app = new TApplication("app",0,0);    if ( iactive ) app = new TApplication("app",0,0);//verifica se deve essere interattivo
117    Float_t ccalrmsthr=0.99;    //
118    Float_t ccalpedthr=0.99;    //definizione delle soglie per valutare problemi nell calibrazione
119    Float_t ccalbadthr=0.03;// 0.005    Float_t ccalrmsthr=0.95;// numero di strip con rms entro i limiti (99%)
120    Float_t ccalthrthr=0.98;    Float_t ccalpedthr=0.95;// numero di strip con piedistallo entro i limiti(99%)
121    Float_t ccalvarthr=0.99;    Float_t ccalbadthr=0.03;// 0.005 numero massimo di strip non utilizzate (3%)  per calibrare
122    Float_t ccalbasthr=0.99;    Float_t ccalthrthr=0.95;
123    //    Float_t ccalvarthr=0.95;
124    Float_t ccalrms;    Float_t ccalbasthr=0.95;
125    Float_t ccalped;    //
126    Float_t ccalbad;    Float_t ccalrms = 0.;
127    Float_t ccalthr;    Float_t ccalped = 0.;
128    Float_t ccalvar;    Float_t ccalbad = 0.;
129    Float_t ccalbas;    Float_t ccalthr = 0.;
130      Float_t ccalvar = 0.;
131      Float_t ccalbas = 0.;
132    //    //
133    struct Calib calib;    struct Calib calib;
134    stringstream titolo;    stringstream titolo, sottotitolo;
135    stringstream xviewev;    stringstream xviewev;
136    stringstream yviewev;    stringstream yviewev;
137      
138      //directory di lavoro
139    const char* startingdir = gSystem->WorkingDirectory();    const char* startingdir = gSystem->WorkingDirectory();
140    if ( !strcmp(outDir.Data(),"") ) outDir = startingdir;    if ( !strcmp(outDir.Data(),"") ) outDir = startingdir;
141      
142      //nome del file
143    TString fififile =  getFilename(filename);    TString fififile =  getFilename(filename);
144    const char *file;    const char *file;
145    file = fififile;    file = fififile;
146    //    
147      //verifica se esiste il file
148    ifstream myfile;    ifstream myfile;
149    myfile.open(filename.Data());    myfile.open(filename.Data());
150    if ( !myfile ){    if ( !myfile ){
# Line 136  void FCaloCHKCALIB(TString filename, Lon Line 152  void FCaloCHKCALIB(TString filename, Lon
152      return;      return;
153    };    };
154    myfile.close();    myfile.close();
155    //  //
156    
157      //apre il file in 'File'
158    TFile *File = new TFile(filename.Data());    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");    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 ) {    if ( !tr ) {
166      printf(" CalibCalPed : no such tree in %s \n",filename.Data());      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");      printf(" Exiting, are you sure this is a LEVEL0 not corrupted file? \n\n");
168      return;      return;
169    };    };
170    
171    pamela::CalibCalPedEvent *ce = 0;    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;    //UInt_t found;
178    tr->SetBranchStatus("*",0,&found); //disable all branches    UInt_t  cpuobt=0, obt=0, obt0=0, obt1=0, obt2=0, obt3=0;
179    //  
180    found = 0;  //  tr->SetBranchStatus("*",0,&found); //disable all branches
181    tr->SetBranchStatus("iev*",1,&found);  //
182    found = 0;  //   found = 0;
183    tr->SetBranchStatus("cstwerr*",1,&found);  //   tr->SetBranchStatus("iev*",1,&found);
184    //    printf("enabled %i branches \n",found);  //   found = 0;
185    found = 0;  //   tr->SetBranchStatus("cstwerr*",1,&found);
186    tr->SetBranchStatus("cperror*",1,&found);  //   //    printf("enabled %i branches \n",found);
187    //printf("enabled %i branches \n",found);  //   found = 0;
188    found = 0;  //   tr->SetBranchStatus("cperror*",1,&found);
189    tr->SetBranchStatus("cal*",1,&found);  //   //printf("enabled %i branches \n",found);
190    //printf("enabled %i branches \n",found);  //   found = 0;
191    found = 0;  //   tr->SetBranchStatus("cal*",1,&found);
192    tr->SetBranchStatus("CalibCalPed*",1,&found);  //   //printf("enabled %i branches \n",found);
193    //   found = 0;
194    //   tr->SetBranchStatus("CalibCalPed*",1,&found);
195    //printf("enabled %i branches \n",found);    //printf("enabled %i branches \n",found);
196    //    //
197    tr->SetBranchAddress("CalibCalPed", &ce);    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    Long64_t ncalibs    = tr->GetEntries();    cpuhe->SetBranchAddress("Header",&ch);
201    if ( ncalibs == 0 ){    //
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");      printf(" No calibrations in this files! \n Exiting... \n");
205      return;      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);    printf("\n This file contains %i entries which corrispond to %i calibrations \n\n",(int)ncalibs,(int)ncalibs/4);
220    Long64_t minev = 0;    Long64_t minev = 0;
221    Long64_t maxev = ncalibs;    Long64_t maxev = ncalibs;
222    if ( calibnumber ){    if ( calibnumber ){//calibnumber e' in ingresso nel main
223      minev = (calibnumber - 1)* 4;      minev = (calibnumber - 1)* 4;
224      maxev = minev + 4;      maxev = minev + 4;
225    };    };
226    TCanvas *figura1;    TCanvas *figura1;//finestra grafica che posso suddividere in piu' aree (pads)
227    TCanvas *figura2 = 0;    TCanvas *figura2 = 0;
228    TCanvas *figura3;    TCanvas *figura3;
229    TCanvas *rapporto = 0;    TCanvas *rapporto = 0;
230    Int_t cmask = 127 ;    Int_t cmask = 127 ;//maschera per selezionare i Byte di errore dall'header
231    Int_t cestw = 0;    Int_t cestw = 0;   //variabile per contenere i Byte di errore del calorimetro estratti dall'header
232    Int_t ver[4][23];    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++ ){    for (Int_t k = 0; k < 4; k++ ){
236      for (Int_t m = 0; m < 23 ; m++ ){      for (Int_t m = 0; m < 23 ; m++ ){
237        ver[k][m] = 0 ;        ver[k][m] = 0 ;
# Line 208  void FCaloCHKCALIB(TString filename, Lon Line 253  void FCaloCHKCALIB(TString filename, Lon
253    //    //
254    const char *outdir = outDir;    const char *outdir = outDir;
255    const char *format = saveas;    const char *format = saveas;
256    stringstream figsave;        stringstream figsave;    //definisco stringhe i/o
257    stringstream figsave1;        stringstream figsave1;    
258    stringstream figsave2;        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...    // to check or not to check? this is the problem...
270    
271      Bool_t check = false;//azzera flag presenza errori
272      
273    //    //
274    Bool_t check = false;    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){    //  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;      Int_t incalrms = 0;
281      Int_t outcalrms = 0;      Int_t outcalrms = 0;
282      Int_t totcalbad = 0;      Int_t totcalbad = 0;
# Line 229  void FCaloCHKCALIB(TString filename, Lon Line 288  void FCaloCHKCALIB(TString filename, Lon
288      Int_t outcalvar = 0;      Int_t outcalvar = 0;
289      Int_t incalbas = 0;      Int_t incalbas = 0;
290      Int_t outcalbas = 0;      Int_t outcalbas = 0;
291      //      //dall'albero calibheader, cerco obt dell cpu
292      for ( Int_t s=0 ; s<4 ;s++  ){      //    cpuhe->GetEntry(ci/4);
293        tr->GetEntry(ci+s);      hi++;
294        calib.iev = ce->iev;      //    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        //inizio loop su i 4 pacchetti per ogni calibrazione (scorre 4 successivi)
313        //    for ( Int_t s=0 ; s<4 ;s++  ){
314        Int_t s = 0;
315        obt = cpuhead[hi];
316        //    printf(" qui cpu header : %i hi %i entry %i \n",obt,hi,ci);
317        if ( !obt ) break;
318        while ( (labs((Int_t)(obt-cpuhead[hi])) < 100000 && ci < maxev) || !cpuobt ){
319    
320          tr->GetEntry(ci);//sceglie la entry (calibrazione)del tree in cui ho tutte le sottostrutture
321          //      tr->GetEntry(ci+s);//sceglie la entry (calibrazione)del tree in cui ho tutte le sottostrutture
322          
323          //trovo l'OBT della entry (pacchetto)
324          obt=eh->GetPscuHeader()->GetOrbitalTime();//cerca orbitaltime all'interno di Pscu
325        //        //
326        cestw = 0;        //printf(" qui pkt header : %i  \n",obt);
327        if ( ce->cstwerr[s] ){  
328          cestw =  ce->cstwerr[s] & cmask ;        ci++;
329          ver[s][16]++;        
330        };        if ( labs((Int_t)(obt-cpuhead[hi])) < 100000 ){
331        if ( cestw ){  
332          if ( cestw & (1 << 0) ) ver[s][6]++ ;          //      s++;
333          if ( cestw & (1 << 1) ) ver[s][5]++ ;          if ( ce->cstwerr[0] ) s = 0;
334          if ( cestw & (1 << 2) ) ver[s][4]++ ;          if ( ce->cstwerr[1] ) s = 1;
335          if ( cestw & (1 << 3) ) ver[s][3]++ ;          if ( ce->cstwerr[2] ) s = 2;
336          if ( cestw & (1 << 4) ) ver[s][2]++ ;          if ( ce->cstwerr[3] ) s = 3;
337          if ( cestw & (1 << 5) ) ver[s][1]++ ;          //printf(" qua pkt header : %i s = %i hi %i \n",obt,s,hi);
338          if ( cestw & (1 << 6) ) ver[s][0]++ ;                    //
339        };          calib.iev = ce->iev;
340        if ( ce->cperror[s] != 0. ){          cestw = 0;
341          if (ce->cperror[s] == 128) ver[s][7]++ ;          //cstwerr e' tutto l'header della sezione, mi interessano gli ultimi 2 Byte(errori del calorimetro)
342          if (ce->cperror[s] == 129) ver[s][8]++ ;          if ( ce->cstwerr[s] ){
343          if (ce->cperror[s] == 130) {            cestw =  ce->cstwerr[s] & cmask ; //confronto con la maschera per tenere solo gli
344            ver[s][9]++ ;            ver[s][16]++;//                     ultimi 2 Byte (assegnati a cestw)
           ver[s][16]--;  
345          };          };
346          if (ce->cperror[s] == 132) ver[s][11]++ ;          if ( cestw ){//errori dal calorimetro
347          if (ce->cperror[s] == 140) ver[s][19]++ ;            if ( cestw & (1 << 0) ) ver[s][6]++ ;//spostati di uno e confronto se diverso 0
348          if (ce->cperror[s] == 141) ver[s][20]++ ;            if ( cestw & (1 << 1) ) ver[s][5]++ ;
349          if (ce->cperror[s] == 142) ver[s][22]++ ;            if ( cestw & (1 << 2) )       ver[s][4]++ ;
350        };            if ( cestw & (1 << 3) ) ver[s][3]++ ;
351        //            if ( cestw & (1 << 4) ) ver[s][2]++ ;
352        for ( Int_t d=0 ; d<11 ;d++  ){            if ( cestw & (1 << 5) ) ver[s][1]++ ;
353          Int_t pre = -1;            if ( cestw & (1 << 6) ) ver[s][0]++ ;        
354          for ( Int_t j=0; j<96 ;j++){          };
355            if ( j%16 == 0 ) pre++;          if ( ce->cperror[s] != 0. ){//errori dallo spacchettamento
356            if ( s == 2 ){            if (ce->cperror[s] == 128) ver[s][7]++ ;
357              calib.calped[0][2*d+1][j] = ce->calped[3][d][j];            if (ce->cperror[s] == 129) ver[s][8]++ ;
358              calib.cstwerr[3] = ce->cstwerr[3];            if (ce->cperror[s] == 130) {
359              calib.cperror[3] = ce->cperror[3];              ver[s][9]++ ;
360              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];  
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)
     //  
     // Book the histograms:  
424      //      //
425        //fine CHECK
426        
427      //      //
428      Int_t i = (ci-minev)/4;      // Book the histograms:
429        //    Int_t i = (ci-minev)/4;
430        Int_t i = hi;
431      xviewev.str("");      xviewev.str("");
432      xviewev << "x-view event " << (i+1);      xviewev << "x-view event " << (i+1);
433      yviewev.str("");      yviewev.str("");
434      yviewev << "y-view event " << (i+1);      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);      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);      TH2F *Yview = new TH2F(yviewev.str().c_str(),"",96,-0.5,95.5,22,-0.5,21.5);
437      //    
438      // figures:  
439      //  
440        //prepara gli istogrammi figures:
441      gDirectory->Delete("C14");      gDirectory->Delete("C14");
442      gDirectory->Delete("C15");      gDirectory->Delete("C15");
443      gDirectory->Delete("C16");      gDirectory->Delete("C16");
444      //TH1F *calped = new TH1F("C14","calped",4230,-3.5,4227.5);      //TH1F *calped = new TH1F("C14","calped",4230,-3.5,4227.5);
445      //  TH1F *calrms = new TH1F("C15","calrms",4230,-3.5,4228.5);      //  TH1F *calrms = new TH1F("C15","calrms",4230,-3.5,4228.5);
446      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
447      //  TH1F *calrms = new TH1F("C15","calrms",264,-2.,4226.);      //  TH1F *calrms = new TH1F("C15","calrms",264,-2.,4226.);
448      TH1F *calrms = new TH1F("C15","calrms",2112,-3.5,4228.5);      TH1F *calrms = new TH1F("C15","C15 calrms",2112,-3.5,4228.5);
449      TH1F *calbad = new TH1F("C16","calgood",4230,-3.5,4228.5);      TH1F *calbad = new TH1F("C16","C16 calgood",4230,-3.5,4228.5);
450      //      //
451      gDirectory->Delete("C17");      gDirectory->Delete("C17");
452      gDirectory->Delete("C18");      gDirectory->Delete("C18");
453      gDirectory->Delete("C19");      gDirectory->Delete("C19");
454      TH1F *calthr = new TH1F("C17","calthr",271,-4.5,268.5);      TH1F *calthr = new TH1F("C17","C17 calthr",271,-4.5,268.5);
455      TH1F *calvar = new TH1F("C18","calvar",271,-4.5,268.5);      TH1F *calvar = new TH1F("C18","C18 calvar",271,-4.5,268.5);
456      TH1F *calbase = new TH1F("C19","calbase",271,-4.5,268.5);      TH1F *calbase = new TH1F("C19","C19 calbase",271,-4.5,268.5);
457      //      //
458      Int_t bgcolor = 10;      Int_t bgcolor = 10;
459      TPad *pd1 = 0;      TPad *pd1 = 0;
460      TPad *pd2 = 0;      TPad *pd2 = 0;
461      TPad *palette = 0;      TPad *palette = 0;
462      TLatex *t=new TLatex();      TLatex *t=new TLatex();
463      if ( figmatra ){  
464        //
465        //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);        figura2 = new TCanvas("Calorimeter:_strip_RMS", "Calorimeter:_strip_RMS", 750, 650);
468        figura2->SetFillColor(10);        figura2->SetFillColor(10);
469        figura2->Range(0,0,100,100);        figura2->Range(0,0,100,100);
# Line 436  void FCaloCHKCALIB(TString filename, Lon Line 553  void FCaloCHKCALIB(TString filename, Lon
553      };      };
554      //      //
555      // run over views and planes      // run over views and planes
556      //      //verifica quali strip sono state utilizzate per la calibrazione
557      Int_t j = 0;      Int_t j = 0;
558      Int_t g = 0;      Int_t g = 0;
559      gStyle->SetOptStat("");      gStyle->SetOptStat("");
560      for (Int_t m = 0; m < 22; m++){      for (Int_t m = 0; m < 22; m++){//loop sui piani
561        for (Int_t l = 0; l < 2; l++){        for (Int_t l = 0; l < 2; l++){//loop x y
562          for (Int_t n = 0; n < 96; n++){          for (Int_t n = 0; n < 96; n++){ //loop sulle strip
563            //            //controlla quante strip hanno piedistallo fuori dai limiti (escludendo quelle difettose)
564            calped->Fill((float)j,calib.calped[l][m][n]);                                        calped->Fill((float)j,calib.calped[l][m][n]);                            
565            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) ){
566              outcalped++;              outcalped++;
567            } else {            } else {
568              incalped++;              incalped++;
569            };            };
570              //controlla quali strip hanno rms fuori dai limiti (ponendo un limite diverso(piu' alto) per quelle difettose
571            calrms->Fill((float)j,(calib.calrms[l][m][n]/4.));                                            calrms->Fill((float)j,(calib.calrms[l][m][n]/4.));                                
572            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.)) ){
573              outcalrms++;              outcalrms++;
574            } else {            } else {
575              incalrms++;              incalrms++;
576            };            };//controlla (conta) quali strip sono state escluse dalla calibrazione
577            calbad->Fill((float)j,(float)calib.calgood[l][m][n]);                                        calbad->Fill((float)j,(float)calib.calgood[l][m][n]);                            
578            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
579            //            //  
580              //preamplificatori(soglia max di calvar portata a 9, prima era 8)
581            if ( n < 6 ){                            if ( n < 6 ){                
582              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)
583              if ( (calib.calthr[l][m][n] > 21. || calib.calthr[l][m][n] < 12.) && (g < 215 || g > 221) ){                                                                  //(quelle difettose)
584                if ( (calib.calthr[l][m][n] > 25. || calib.calthr[l][m][n] < 12.) && (g < 215 || g > 221) ){
585                outcalthr++;                outcalthr++;
586              } else {              } else {
587                incalthr++;                incalthr++;
588              };              };
589              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)
590              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) ){
591                outcalvar++;                outcalvar++;
592              } else {              } else {
593                incalvar++;                incalvar++;
594              };              };
595              calbase->Fill((float)g,(float)calib.calbase[l][m][n]);                                                                    calbase->Fill((float)g,(float)calib.calbase[l][m][n]);//controlla baseline                                                  
596              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. ){
597                outcalbas++;                outcalbas++;
598              } else {              } else {
599                incalbas++;                incalbas++;
600              };              };
601              g++;              g++;//contatore preamplificatoripassa alla strip successiva (0-286)
602            };            };
603            //            //
604            j++;            j++;//contatore strip
605            //            
606              //istogrammi (solo se ci sono stati problemi)
607            if ( figmatra ){                                  if ( figmatra ){                      
608              figura2->cd();              figura2->cd();
609              xviewev.str("");              xviewev.str("");
# Line 495  void FCaloCHKCALIB(TString filename, Lon Line 616  void FCaloCHKCALIB(TString filename, Lon
616              yviewev << " event " << n;              yviewev << " event " << n;
617              yviewev << " " << m;              yviewev << " " << m;
618              yviewev << " " << l;              yviewev << " " << l;
619              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
620              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);                    
621              if ( calib.calrms[l][m][n] > 0 ){              if ( calib.calrms[l][m][n] > 0 ){
622                Xview->SetFillColor(38);                Xview->SetFillColor(38);
# Line 535  void FCaloCHKCALIB(TString filename, Lon Line 656  void FCaloCHKCALIB(TString filename, Lon
656                pd2->cd();                pd2->cd();
657                Yview->Draw("box same");                Yview->Draw("box same");
658              };                            };              
659            };            };//fine istogrammi
660          };          };//fine loop strip per piano
661        };        };//fine loop x y
662      };      };//fine loop piani
663    
664        //disega la figura
665      if ( figmatra ){      if ( figmatra ){
666        figura2->cd();        figura2->cd();
667        gStyle->SetOptStat("");        gStyle->SetOptStat("");
# Line 558  void FCaloCHKCALIB(TString filename, Lon Line 681  void FCaloCHKCALIB(TString filename, Lon
681        pd2->Update();        pd2->Update();
682        figura2->Update();        figura2->Update();
683      };      };
684        //fine pagina visualizzata solo se ci sono problemi
685      //      //
686      figura1 = new TCanvas("Calorimeter_calped_calrms_calgood", "Calorimeter_calped_calrms_calgood", 750, 950);  
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);      figura1->SetFillColor(10);
691      figura1->Range(0,0,100,100);      figura1->Range(0,0,100,100);
692      //      //
693      ccalped = (float)incalped/((float)outcalped + (float)incalped);      ccalped = (float)incalped/((float)outcalped + (float)incalped);
694      Int_t f1pd1col = 10;      Int_t f1pd1col = 10;//costante=10
695      if ( ccalped < ccalpedthr ) {      if ( ccalped < ccalpedthr ) { //se % strip con piedistallo buono < numero minimo segna soglia  
696        check = true;            check = true;     //flag per segnalare errori
697        f1pd1col = 45;        f1pd1col = 45;    // (se ci sono problemi, cambia colore)
698      };      };
699      //      //
700      ccalrms = (float)incalrms/((float)outcalrms + (float)incalrms);      ccalrms = (float)incalrms/((float)outcalrms + (float)incalrms);
701      Int_t f1pd2col = 10;      Int_t f1pd2col = 10;
702      if ( ccalrms < ccalrmsthr ) {      if ( ccalrms < ccalrmsthr ) { //se % strip con rms buono< numero minimo segna errore
703        check = true;            check = true;    
704        f1pd2col = 45;        f1pd2col = 45;
705      };      };
706      //      //
707      ccalbad = (float)totcalbad/4224.;      ccalbad = (float)totcalbad/4224.;
708      Int_t f1pd3col = 10;      Int_t f1pd3col = 10;
709      if ( ccalbad > ccalbadthr ) {      if ( ccalbad > ccalbadthr ) { //se il numero di strip escluse dalla calibrazione e' troppo alto segna errore
710        check = true;            check = true;    
711        f1pd3col = 45;        f1pd3col = 45;
712      };      };
713      //      //
714      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
715      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);
716      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);
717      figura1->Clear();      figura1->Clear();
# Line 596  void FCaloCHKCALIB(TString filename, Lon Line 723  void FCaloCHKCALIB(TString filename, Lon
723      f1pd2->Draw();      f1pd2->Draw();
724      f1pd3->Draw();      f1pd3->Draw();
725      figura1->Draw();      figura1->Draw();
726    
727           //finestra con figure C17,C18,C19
728      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);
729      figura3->SetFillColor(10);      figura3->SetFillColor(10);
730      figura3->Range(0,0,100,100);      figura3->Range(0,0,100,100);
731      //      //
732      ccalthr = (float)incalthr/((float)outcalthr + (float)incalthr);      ccalthr = (float)incalthr/((float)outcalthr + (float)incalthr);
733      Int_t f3pd1col = 10;      Int_t f3pd1col = 10;
734      if ( ccalthr < ccalthrthr ) {      if ( ccalthr < ccalthrthr ) { //controlla % strip fuori soglia
735        check = true;            check = true;    
736        f3pd1col = 45;        f3pd1col = 45;
737      };      };
738      //      //
739      ccalvar = (float)incalvar/((float)outcalvar + (float)incalvar);      ccalvar = (float)incalvar/((float)outcalvar + (float)incalvar);
740      Int_t f3pd2col = 10;      Int_t f3pd2col = 10;
741      if ( ccalvar < ccalvarthr ) {      if ( ccalvar < ccalvarthr ) { //controlla strip con varianza fuori dai limiti
742        check = true;            check = true;    
743        f3pd2col = 45;        f3pd2col = 45;
744      };      };
745      //      //
746      ccalbas = (float)incalbas/((float)outcalbas + (float)incalbas);      ccalbas = (float)incalbas/((float)outcalbas + (float)incalbas);
747      Int_t f3pd3col = 10;      Int_t f3pd3col = 10;
748      if ( ccalbas < ccalbasthr ) {      if ( ccalbas < ccalbasthr ) { //controlla strip con baseline fuori dai limiti
749        check = true;            check = true;    
750        f3pd3col = 45;        f3pd3col = 45;
751      };      };
752      //      //
753      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
754      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);
755      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);
756      figura3->Clear();      figura3->Clear();//cancella tutto in figura 3
757      figura3->cd();      figura3->cd();
758      f3pd1->SetTicks();      f3pd1->SetTicks();
759      f3pd2->SetTicks();      f3pd2->SetTicks();
# Line 633  void FCaloCHKCALIB(TString filename, Lon Line 762  void FCaloCHKCALIB(TString filename, Lon
762      f3pd2->Draw();      f3pd2->Draw();
763      f3pd3->Draw();      f3pd3->Draw();
764      figura3->Draw();            figura3->Draw();      
765      //      
766    
767        //mette i titoli nella figura 1
768      gStyle->SetOptStat("N");      gStyle->SetOptStat("N");
769      figura1->cd();      figura1->cd();
770      gStyle->SetNdivisions(322,"x");      gStyle->SetNdivisions(322,"x");
# Line 647  void FCaloCHKCALIB(TString filename, Lon Line 778  void FCaloCHKCALIB(TString filename, Lon
778      titolo << file;      titolo << file;
779      titolo << " - calibration number ";      titolo << " - calibration number ";
780      titolo << (i+1);      titolo << (i+1);
781      t->DrawLatex(0.5,97.,titolo.str().c_str());      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);      t->SetTextSize(0.03);
     f1pd1->cd();  
791      //      //
792        f1pd1->cd();
793        //titoli al grafico calped
794      calped->GetXaxis()->SetNdivisions(322);      calped->GetXaxis()->SetNdivisions(322);
795      calped->SetXTitle("strip");      calped->SetXTitle("strip");
796      calped->SetYTitle("ADC channels");      calped->SetYTitle("ADC channels");
797      calped->SetMaximum(3000.);      calped->SetMaximum(3000.);
798      calped->SetMinimum(-3000.);      calped->SetMinimum(-3000.);
799    //disegna istogramma calped
800      calped->Draw();      calped->Draw();
801        //disegna la banda di accettazione
802      TPolyLine *banda1;      TPolyLine *banda1;
803      Double_t xc[4] = {0.,4224.,4224.,0.};      Double_t xc[4] = {0.,4224.,4224.,0.};
804      Double_t yc[4] = {-700.,-700.,700.,700.};      Double_t yc[4] = {-700.,-700.,700.,700.};
# Line 665  void FCaloCHKCALIB(TString filename, Lon Line 807  void FCaloCHKCALIB(TString filename, Lon
807      banda1->SetFillColor(5);      banda1->SetFillColor(5);
808      banda1->SetLineWidth(1);      banda1->SetLineWidth(1);
809      banda1->Draw("fSAME");      banda1->Draw("fSAME");
810        //banda per le strip difettose
811      TPolyLine *banda2;      TPolyLine *banda2;
812      Double_t xc2[4] = {4031.5,4047.5,4047.5,4031.5};      Double_t xc2[4] = {4031.5,4047.5,4047.5,4031.5};
813      //  Double_t yc2[4] = {-2500.,-2500.,28000.,28000.};      //  Double_t yc2[4] = {-2500.,-2500.,28000.,28000.};
# Line 674  void FCaloCHKCALIB(TString filename, Lon Line 817  void FCaloCHKCALIB(TString filename, Lon
817      banda2->SetFillColor(5);      banda2->SetFillColor(5);
818      banda2->SetLineWidth(1);      banda2->SetLineWidth(1);
819      banda2->Draw("fSAME");      banda2->Draw("fSAME");
820    
821      calped->Draw("SAME");      calped->Draw("SAME");
822        //
823      f1pd2->cd();      f1pd2->cd();
824        //prepara grafico calrms
825      f1pd2->SetLogy();      f1pd2->SetLogy();
826      calrms->GetXaxis()->SetNdivisions(322);      calrms->GetXaxis()->SetNdivisions(322);
827    //disegna istogramma calrms
828      calrms->Draw();      calrms->Draw();
829        //banda di accettazione
830      Double_t xd[4] = {0.,4224.,4224.,0.};      Double_t xd[4] = {0.,4224.,4224.,0.};
831      Double_t yd[4] = {1.,1.,7.,7.};      Double_t yd[4] = {1.,1.,10.,10.};
832      banda1 = new TPolyLine(4,xd,yd);      banda1 = new TPolyLine(4,xd,yd);
833      banda1->SetLineColor(5);      banda1->SetLineColor(5);
834      banda1->SetFillColor(5);      banda1->SetFillColor(5);
835      banda1->SetLineWidth(1);      banda1->SetLineWidth(1);
836      banda1->Draw("fSAME");      banda1->Draw("fSAME");
837    
838      Float_t minrm = calrms->GetMinimum();      Float_t minrm = calrms->GetMinimum();
839      Float_t maxrm = calrms->GetMaximum();      Float_t maxrm = calrms->GetMaximum();
840      Double_t xrm2[4] = {3449.,3551.,3551.,3449.};      Double_t xrm2[4] = {3449.,3551.,3551.,3449.};
841      Double_t yrm2[4] = {minrm,minrm,maxrm,maxrm};      Double_t yrm2[4] = {minrm,minrm,maxrm,maxrm};
842        //banda per strip difettose
843      banda2 = new TPolyLine(4,xrm2,yrm2);      banda2 = new TPolyLine(4,xrm2,yrm2);
844      banda2->SetLineColor(5);      banda2->SetLineColor(5);
845      banda2->SetFillColor(5);      banda2->SetFillColor(5);
846      banda2->SetLineWidth(1);      banda2->SetLineWidth(1);
847      banda2->Draw("fSAME");      banda2->Draw("fSAME");
848    
849      calrms->SetXTitle("strip");      calrms->SetXTitle("strip");
850      calrms->SetYTitle("ADC channels");      calrms->SetYTitle("ADC channels");
851    
852      calrms->Draw("SAME");      calrms->Draw("SAME");
853        //prepara grafico calbad
854      f1pd3->cd();      f1pd3->cd();
855      gStyle->SetNdivisions(344,"x");      gStyle->SetNdivisions(344,"x");
856      calbad->GetXaxis()->SetNdivisions(322);      calbad->GetXaxis()->SetNdivisions(322);
857    //disegna calbad
858      calbad->Draw();      calbad->Draw();
859      calbad->SetXTitle("strip");      calbad->SetXTitle("strip");
860      calbad->SetYTitle("0=good 255=bad");      calbad->SetYTitle("0=good 255=bad");
861        //
862      f1pd1->Update();      f1pd1->Update();
863      f1pd2->Update();      f1pd2->Update();
864      f1pd3->Update();      f1pd3->Update();
865      figura1->Update();      figura1->Update();
866      //      //
867    
868        
869    //pagina con figure C17,C18,C19
870      figura3->cd();      figura3->cd();
871      gStyle->SetNdivisions(644,"x");      gStyle->SetNdivisions(644,"x");
872      t=new TLatex();      t=new TLatex();
# Line 721  void FCaloCHKCALIB(TString filename, Lon Line 879  void FCaloCHKCALIB(TString filename, Lon
879      titolo << file;      titolo << file;
880      titolo << " - calibration number ";      titolo << " - calibration number ";
881      titolo << (i+1);      titolo << (i+1);
882      t->DrawLatex(0.5,97.,titolo.str().c_str());      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);      t->SetTextSize(0.03);
886      //      //
887      f3pd1->cd();      f3pd1->cd();
# Line 730  void FCaloCHKCALIB(TString filename, Lon Line 890  void FCaloCHKCALIB(TString filename, Lon
890      calthr->SetYTitle("ADC channels");      calthr->SetYTitle("ADC channels");
891      calthr->Draw();      calthr->Draw();
892      Double_t xe[4] = {0.,264.,264.,0.};      Double_t xe[4] = {0.,264.,264.,0.};
893      Double_t ye[4] = {12.,12.,21.,21.};      Double_t ye[4] = {12.,12.,25.,25.};
894      banda1 = new TPolyLine(4,xe,ye);      banda1 = new TPolyLine(4,xe,ye);
895      banda1->SetLineColor(5);      banda1->SetLineColor(5);
896      banda1->SetFillColor(5);      banda1->SetFillColor(5);
897      banda1->SetLineWidth(1);      banda1->SetLineWidth(1);
898      banda1->Draw("fSAME");      banda1->Draw("fSAME");
899      //  
900      minrm = calthr->GetMinimum();      minrm = calthr->GetMinimum();
901      maxrm = 1.05*calthr->GetMaximum();      maxrm = 1.05*calthr->GetMaximum();
902      Double_t xth2[4] = {215.,221.,221.,215.};      Double_t xth2[4] = {215.,221.,221.,215.};
# Line 748  void FCaloCHKCALIB(TString filename, Lon Line 908  void FCaloCHKCALIB(TString filename, Lon
908      banda2->Draw("fSAME");      banda2->Draw("fSAME");
909      //      //
910      calthr->Draw("SAME");      calthr->Draw("SAME");
911    
912    
913      f3pd2->cd();      f3pd2->cd();
914      //  gPad->SetLogy();      //  gPad->SetLogy();
915        //banda di soglia per calvar portata a 9, prima era a 8)
916      calvar->SetMaximum(25.);      calvar->SetMaximum(25.);
917      calvar->GetXaxis()->SetNdivisions(644);      calvar->GetXaxis()->SetNdivisions(644);
918      calvar->SetXTitle("pre-amplifier");      calvar->SetXTitle("pre-amplifier");
919      calvar->SetYTitle("ADC channels");      calvar->SetYTitle("ADC channels");
920      calvar->Draw();      calvar->Draw();
921      Double_t xt[4] = {0.,264.,264.,0.};      Double_t xt[4] = {0.,264.,264.,0.};
922      Double_t yt[4] = {1.,1.,8.,8.};      Double_t yt[4] = {1.,1.,9.,9.};
923      banda1 = new TPolyLine(4,xt,yt);      banda1 = new TPolyLine(4,xt,yt);
924      banda1->SetLineColor(5);      banda1->SetLineColor(5);
925      banda1->SetFillColor(5);      banda1->SetFillColor(5);
926      banda1->SetLineWidth(1);      banda1->SetLineWidth(1);
927      banda1->Draw("fSAME");      banda1->Draw("fSAME");
928      //  
929      minrm = calvar->GetMinimum();      minrm = calvar->GetMinimum();
930      maxrm = 1.05*calvar->GetMaximum();      maxrm = 1.05*calvar->GetMaximum();
931      Double_t xva2[4] = {215.,221.,221.,215.};      Double_t xva2[4] = {215.,221.,221.,215.};
# Line 774  void FCaloCHKCALIB(TString filename, Lon Line 937  void FCaloCHKCALIB(TString filename, Lon
937      banda2->Draw("fSAME");      banda2->Draw("fSAME");
938      //      //
939      calvar->Draw("SAME");      calvar->Draw("SAME");
940    
941    
942      f3pd3->cd();      f3pd3->cd();
943      calbase->GetXaxis()->SetNdivisions(644);      calbase->GetXaxis()->SetNdivisions(644);
944      calbase->SetXTitle("pre-amplifier");      calbase->SetXTitle("pre-amplifier");
945      calbase->SetYTitle("ADC channels");      calbase->SetYTitle("ADC channels");
946      calbase->Draw();      calbase->Draw();
947      Double_t xg[4] = {0.,264.,264.,0.};      Double_t xg[4] = {0.,264.,264.,0.};
948      Double_t yg[4] = {2000.,2000.,4500.,4500.};      Double_t yg[4] = {2000.,2000.,5500.,5500.};
949      banda1 = new TPolyLine(4,xg,yg);      banda1 = new TPolyLine(4,xg,yg);
950      banda1->SetLineColor(5);      banda1->SetLineColor(5);
951      banda1->SetFillColor(5);      banda1->SetFillColor(5);
952      banda1->SetLineWidth(1);      banda1->SetLineWidth(1);
953      banda1->Draw("fSAME");      banda1->Draw("fSAME");
954      calbase->Draw("SAME");      calbase->Draw("SAME");
955        //
956      f3pd1->Update();      f3pd1->Update();
957      f3pd2->Update();      f3pd2->Update();
958      f3pd3->Update();      f3pd3->Update();
959      figura3->Update();      figura3->Update();
960      //      //
961        //file output
962      if ( !strcmp(format,"ps") ) {      if ( !strcmp(format,"ps") ) {
       if ( ci == minev ) {  
         figsave.str("");  
         figsave << outdir << "/" ;  
         figsave << figrec << "_CaloCHKCALIB.";  
         figsave << format;  
         figsave << "(";  
       };                      
963        if ( figmatra ) {        if ( figmatra ) {
964          figura2->Print(figsave.str().c_str(),"Portrait");          figura2->Print(figsave.str().c_str(),"Portrait");
965          if ( ci == minev ) {          if ( ci == minev ) {
# Line 851  void FCaloCHKCALIB(TString filename, Lon Line 1011  void FCaloCHKCALIB(TString filename, Lon
1011          gSystem->Sleep(10);          gSystem->Sleep(10);
1012        };        };
1013      };      };
1014   };    };//fine del loop sulle calibrazioni
1015    //    //
1016    //    //
1017    //    //
# Line 892  void FCaloCHKCALIB(TString filename, Lon Line 1052  void FCaloCHKCALIB(TString filename, Lon
1052    pad3->Draw();    pad3->Draw();
1053    pad4->Draw();    pad4->Draw();
1054    //    //
1055    char *sezione = 0;    const char *sezione = "";
1056    for (Int_t si = 0; si < 4; si++){    for (Int_t si = 0; si < 4; si++){
1057      if (si == 2)      if (si == 2)
1058        {        {
# Line 920  void FCaloCHKCALIB(TString filename, Lon Line 1080  void FCaloCHKCALIB(TString filename, Lon
1080      t->SetTextAlign(12);      t->SetTextAlign(12);
1081      t->DrawLatex(33.,97.,sezione);      t->DrawLatex(33.,97.,sezione);
1082      t->SetTextSize(0.05);      t->SetTextSize(0.05);
1083    
1084        //scorre ver cercando il j tipo di errore: 'si'=sezione  
1085      for (Int_t j = 0; j < 23; j++){      for (Int_t j = 0; j < 23; j++){
1086        if ( ver[si][j] ) {        if ( ver[si][j] ) {//controlla se le sezioni di ver[si][j] sonoe diverse da zero.
1087          t->SetTextColor(50);          t->SetTextColor(50); //controlla quali sono !=0 e assegna il rispettivo errore
1088          if (j == 0) {          if (j == 0) {//del calorimetro
1089            errore.str("");            errore.str("");
1090            errore << "* DSP ack error: " << ver[si][j];            errore << "* DSP ack error: " << ver[si][j];
1091            errore << " time(s)";            errore << " time(s)";
1092            t->DrawLatex(2.,30.,errore.str().c_str());            t->DrawLatex(2.,30.,errore.str().c_str());
1093            check = true;            check = true;
1094          }          }
1095          if (j == 1) {          if (j == 1) {//calorimetro
1096            errore.str("");            errore.str("");
1097            errore << "* Temperature alarm: " << ver[si][j];            errore << "* Temperature alarm: " << ver[si][j];
1098            errore << " time(s)";            errore << " time(s)";
1099            t->DrawLatex(2.,74.,errore.str().c_str());            t->DrawLatex(2.,74.,errore.str().c_str());
1100            check = true;            check = true;
1101          }          }
1102          if (j == 2) {          if (j == 2) {//calorimetro
1103            errore.str("");            errore.str("");
1104            errore << "* Latch up alarm: " << ver[si][j];            errore << "* Latch up alarm: " << ver[si][j];
1105            errore << " time(s).";            errore << " time(s).";
1106            t->DrawLatex(2.,65.,errore.str().c_str());            t->DrawLatex(2.,65.,errore.str().c_str());
1107            check = true;            check = true;
1108          }          }
1109          if (j == 3) {          if (j == 3) {//calorimetro
1110            errore.str("");            errore.str("");
1111            errore << "RAW mode: " << ver[si][j];            errore << "RAW mode: " << ver[si][j];
1112            errore << " time(s)";            errore << " time(s)";
1113            t->SetTextColor(38);            t->SetTextColor(38);
1114            t->DrawLatex(2.,90.,errore.str().c_str());            t->DrawLatex(2.,90.,errore.str().c_str());
1115          }          }
1116          if (j == 4) {          if (j == 4) {//calorimetro
1117            errore.str("");            errore.str("");
1118            errore << "* CMD length error: " << ver[si][j];            errore << "* CMD length error: " << ver[si][j];
1119            errore << " time(s)";            errore << " time(s)";
1120            t->DrawLatex(2.,66.,errore.str().c_str());            t->DrawLatex(2.,66.,errore.str().c_str());
1121            check = true;            check = true;
1122          }                        }              
1123          if (j == 5) {          if (j == 5) {//calorimetro
1124            errore.str("");            errore.str("");
1125            errore << "* Execution error: " << ver[si][j];            errore << "* Execution error: " << ver[si][j];
1126            errore << " time(s)";            errore << " time(s)";
1127            t->DrawLatex(2.,62.,errore.str().c_str());            t->DrawLatex(2.,62.,errore.str().c_str());
1128            check = true;            check = true;
1129          }          }
1130          if (j == 6) {          if (j == 6) {//calorimetro
1131            errore.str("");            errore.str("");
1132            errore << "* CRC error (st. word): " << ver[si][j];            errore << "* CRC error (st. word): " << ver[si][j];
1133            errore << " time(s)";            errore << " time(s)";
# Line 1036  void FCaloCHKCALIB(TString filename, Lon Line 1198  void FCaloCHKCALIB(TString filename, Lon
1198    t->SetTextSize(0.035);    t->SetTextSize(0.035);
1199    t->SetTextAlign(12);    t->SetTextAlign(12);
1200    t->DrawLatex(7.,95.,"Calorimeter CALIBRATION quick look: ");    t->DrawLatex(7.,95.,"Calorimeter CALIBRATION quick look: ");
1201    //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);
1202    
1203    
1204    if ( check ) {    if ( check ) {
1205      t->SetTextColor(50);      t->SetTextColor(50);
1206      t->DrawLatex(65.,95.,"WARNING, CHECK!");                  t->DrawLatex(65.,95.,"WARNING, CHECK!");            
# Line 1071  void FCaloCHKCALIB(TString filename, Lon Line 1235  void FCaloCHKCALIB(TString filename, Lon
1235    printf("\n");    printf("\n");
1236    return;    return;
1237  }  }
1238            

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

  ViewVC Help
Powered by ViewVC 1.1.23