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

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.23