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

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

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

revision 1.15 by mocchiut, Fri Sep 22 13:38:58 2006 UTC revision 1.21 by mocchiut, Wed Jul 18 07:57:13 2007 UTC
# Line 1  Line 1 
1  //  //
2  //   Check for possible errors and shows raw distribution of variables coming from the DSP (no calibrations needed) - Emiliano Mocchiutti  //   Check for possible errors and shows raw distribution of variables coming from the DSP (no calibrations needed) - Emiliano Mocchiutti
3  //  //
4  //   FCaloQLOOK.c      version 1.12  (2006-09-22)  //   FCaloQLOOK.c      version 1.14  (2006-09-29)
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.13 - 1.14 (2006-09-29): Flag the last entry in the txt file, count missing section when checking for DSP entries correspondence.
11    //
12    //   1.12 - 1.13 (2006-09-28): Give wrong number of events in compress mode, fixed.
13    //
14  //   1.11 - 1.12 (2006-09-22): Check for different number of events, put output in a file and write down errors for each event. Fixed jumpev bug.  //   1.11 - 1.12 (2006-09-22): Check for different number of events, put output in a file and write down errors for each event. Fixed jumpev bug.
15  //  //
16  //   1.09 - 1.11 (2006-07-17): Adapted to flight conditions.  //   1.09 - 1.11 (2006-07-17): Adapted to flight conditions.
# Line 82  TString getFilename(const TString filena Line 86  TString getFilename(const TString filena
86    } else {    } else {
87      Int_t posiz2 = 0;      Int_t posiz2 = 0;
88      stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz);      stringcopy(file2,gSystem->BaseName(filename.Data()),posiz2,posiz);
89      TString pdat(".dat");      TString pdat(".pam");
90      stringappend(file2,pdat);        stringappend(file2,pdat);  
91    };    };
92    return file2;    return file2;
# Line 94  void sighandler(UInt_t pkt_num, UInt_t o Line 98  void sighandler(UInt_t pkt_num, UInt_t o
98      printf("PSCU-Pkt N. %u - OBT %u ms\n",pkt_num,obt);      printf("PSCU-Pkt N. %u - OBT %u ms\n",pkt_num,obt);
99      printf("Total events %u\n",totev);      printf("Total events %u\n",totev);
100      printf("(ROOT-tree entry %u )\n",entry);      printf("(ROOT-tree entry %u )\n",entry);
101        if ( (totev-1) == entry ) printf("NOTICE: this is last entry! \n");
102      printf("=================================================\n");      printf("=================================================\n");
103      evdone = true;      evdone = true;
104    };    };
# Line 135  void FCaloQLOOK(TString filename, Int_t Line 140  void FCaloQLOOK(TString filename, Int_t
140    //    //
141    Float_t ctshitthr = 0.65;    Float_t ctshitthr = 0.65;
142    Float_t cbasethr = 0.95;    Float_t cbasethr = 0.95;
143    Float_t cdexythr = 0.995;    //  Float_t cdexythr = 0.995;
144      Float_t cdexythr = 0.95;
145    //Float_t cdexythr = 0.90;    //Float_t cdexythr = 0.90;
146    Float_t cdexycthr = 0.95;    Float_t cdexycthr = 0.95;
147    Float_t h1rth = 0.90;    Float_t h1rth = 0.90;
# Line 186  void FCaloQLOOK(TString filename, Int_t Line 192  void FCaloQLOOK(TString filename, Int_t
192    };    };
193    Int_t const size = nevents;    Int_t const size = nevents;
194    Double_t iev2[size+1];    Double_t iev2[size+1];
195    Int_t ver[4][23], lver[4][23],shit[4][11], rshit[4][11], se,bl, pl, fulldiff[4],cshit, cpre[4],nullsh[4][11], lalarm[4];    //aumentata la lunghezza di ver, prima era 23
196      Int_t ver[4][24], lver[4][23],shit[4][11], rshit[4][11], se,bl, pl, fulldiff[4],cshit, cpre[4],nullsh[4][11], lalarm[4];
197    se = 0;    se = 0;
198    pl = 0;        pl = 0;    
199    Float_t allbase = 0.;    Float_t allbase = 0.;
# Line 288  void FCaloQLOOK(TString filename, Int_t Line 295  void FCaloQLOOK(TString filename, Int_t
295        maxevent = fromevent - 1;        maxevent = fromevent - 1;
296      };      };
297    };    };
298          //azzera i tipi di errore
299    for (Int_t k = 0; k < 4; k++ ){    for (Int_t k = 0; k < 4; k++ ){
300      for (Int_t m = 0; m < 23 ; m++ ){      for (Int_t m = 0; m < 23 ; m++ ){
301        ver[k][m] = 0 ;        ver[k][m] = 0 ;
# Line 300  void FCaloQLOOK(TString filename, Int_t Line 307  void FCaloQLOOK(TString filename, Int_t
307        };        };
308        lalarm[k] = 0;        lalarm[k] = 0;
309      };      };
310        //il 23 lo azzero cosi per non modificare le altre variabili
311        ver[k][23]=0;
312    };    };
313    Int_t pdone, bdone;    Int_t pdone, bdone;
314    pdone = 0;    pdone = 0;
315    bdone = 0;    bdone = 0;
316    bool isCOMP = 0;    bool isCOMP = false;
317    bool isFULL = 0;    bool isFULL = false;
318    bool isRAW = 0;    bool isRAW = false;
319    Int_t alldexy=0;    Int_t alldexy=0;
320    Int_t alldexy2=0;    Int_t alldexy2=0;
321    Int_t planebases=0;    Int_t planebases=0;
# Line 373  void FCaloQLOOK(TString filename, Int_t Line 382  void FCaloQLOOK(TString filename, Int_t
382      tshit = 0;      tshit = 0;
383      trshit = 0;      trshit = 0;
384      tr->GetEntry(i);      tr->GetEntry(i);
385    
386      iev2[i] = ce->iev;          iev2[i] = ce->iev;    
387      //      //
388      ph = eh->GetPscuHeader();      ph = eh->GetPscuHeader();
389      headco = headc;      headco = headc;
390      headc = ph->GetCounter();      headc = ph->GetCounter();
391      obt = ph->GetOrbitalTime();      obt = ph->GetOrbitalTime();
392    
393      if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])) ) calevn1++;      if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])) ) calevn1++;
394      if ( (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])) ) calevn2++;      if ( (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])) ) calevn2++;
395      if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])) ) calevn3++;      if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])) ) calevn3++;
# Line 435  void FCaloQLOOK(TString filename, Int_t Line 446  void FCaloQLOOK(TString filename, Int_t
446            sighandler(headc,obt,i,3,nevents,evdone);            sighandler(headc,obt,i,3,nevents,evdone);
447            printf(" jump in the counter calev is %i oldcalev was %i \n",calev3,oldcalev3);            printf(" jump in the counter calev is %i oldcalev was %i \n",calev3,oldcalev3);
448          };          };
449        }        };
450      };      };
451      //  jumpprintout:      //  jumpprintout:
452      memcpy(shit, nullsh, sizeof(nullsh));      memcpy(shit, nullsh, sizeof(nullsh));
# Line 461  void FCaloQLOOK(TString filename, Int_t Line 472  void FCaloQLOOK(TString filename, Int_t
472            se = 1;            se = 1;
473            pl = (ii-1)/2;            pl = (ii-1)/2;
474            pdone = 0;            pdone = 0;
475          };          };              
476                            isCOMP = false;
477          isCOMP = 0;          isFULL = false;
478          isFULL = 0;          isRAW = false;
479          isRAW = 0;          if ( ce->stwerr[se] & (1 << 16) ) isCOMP = true;
480          if ( ce->stwerr[se] & (1 << 16) ) isCOMP = 1;          if ( ce->stwerr[se] & (1 << 17) ) isFULL = true;
481          if ( ce->stwerr[se] & (1 << 17) ) isFULL = 1;          if ( ce->stwerr[se] & (1 << 3) ) isRAW = true;
         if ( ce->stwerr[se] & (1 << 3) ) isRAW = 1;  
482          bl = -1;          bl = -1;
483          for (Int_t kk = 0; kk < 96 ; kk++ ){          for (Int_t kk = 0; kk < 96 ; kk++ ){
484            if ( kk%16 == 0 ){            if ( kk%16 == 0 ){
# Line 517  void FCaloQLOOK(TString filename, Int_t Line 527  void FCaloQLOOK(TString filename, Int_t
527              //              //
528              if ( !bdone ){              if ( !bdone ){
529                Baseline->Fill(ce->base[l][ii][bl]);                Baseline->Fill(ce->base[l][ii][bl]);
530                if ( ce->base[l][ii][bl] > 2000. && ce->base[l][ii][bl] < 4500. ){                if ( ce->base[l][ii][bl] > 2000. && ce->base[l][ii][bl] < 5500. ){
531                  inbase++;                  inbase++;
532                } else {                } else {
533                  outbase++;                  outbase++;
# Line 575  void FCaloQLOOK(TString filename, Int_t Line 585  void FCaloQLOOK(TString filename, Int_t
585            } else {            } else {
586              if ( !pdone ){              if ( !pdone ){
587                if ( ( alldexy2 > 3072000 ||  alldexy2 == 0) && ce->perror[se] == 0 ) {                if ( ( alldexy2 > 3072000 ||  alldexy2 == 0) && ce->perror[se] == 0 ) {
588                  //            if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) {                  //            if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 )
589                  pdone = 1;                  pdone = 1;
590                  pshit[se][pl]++ ;                                          pshit[se][pl]++ ;                        
591                  if ( (ce->stwerr[se] & (1 << 4)) == 0 ){                  if ( (ce->stwerr[se] & (1 << 4)) == 0 ){
# Line 605  void FCaloQLOOK(TString filename, Int_t Line 615  void FCaloQLOOK(TString filename, Int_t
615      };      };
616      cshit = 0;      cshit = 0;
617      for (Int_t k = 0; k < 4 ; k++ ){      for (Int_t k = 0; k < 4 ; k++ ){
618        isCOMP = 0;        isCOMP = false;
619        isFULL = 0;        isFULL = false;
620        if ( ce->stwerr[se] & (1 << 16) ) isCOMP = 1;        cestw=0;// queste righe qui
621        if ( ce->stwerr[se] & (1 << 17) ) isFULL = 1;        if ( ce->stwerr[k] ) cestw =  ce->stwerr[k] & cmask ;//
622          if ( ce->stwerr[k] & (1 << 16) && !(cestw & (1 << 3)) ) isCOMP = true;
623          if ( ce->stwerr[k] & (1 << 17) && !(cestw & (1 << 3)) ) isFULL = true;
624          //
625        if ( isCOMP ) ver[k][16]++;        if ( isCOMP ) ver[k][16]++;
626        if ( isFULL ) ver[k][17]++;        if ( isFULL ) ver[k][17]++;
627        cshit += (int)ce->calstriphit[k];        cshit += (int)ce->calstriphit[k];
       cestw=0;  
       if ( ce->stwerr[k] ) cestw =  ce->stwerr[k] & cmask ;  
628        if ( cestw ){        if ( cestw ){
629          if ( cestw & (1 << 0) ){          if ( cestw & (1 << 0) ){
630            ver[k][6]++ ;            ver[k][6]++ ;
# Line 649  void FCaloQLOOK(TString filename, Int_t Line 660  void FCaloQLOOK(TString filename, Int_t
660            sighandler(headc,obt,i,k,nevents,evdone);            sighandler(headc,obt,i,k,nevents,evdone);
661            printf(" DSP ack error \n");            printf(" DSP ack error \n");
662          };          };
663        };        };// controllo se ci sono errori crc se perr=0 ok!
664        if (  ce->stwerr[k] == 0 && ce->perror[k] == 0 ) ver[k][8]++ ;        if (  ce->stwerr[k] == 0 && ce->perror[k] == 0 ) ver[k][8]++ ;
665        if ( ce->perror[k] != 0. ){        if ( ce->perror[k] != 0. ){
666          if (ce->perror[k] == 128){          if (ce->perror[k] == 128){
# Line 715  void FCaloQLOOK(TString filename, Int_t Line 726  void FCaloQLOOK(TString filename, Int_t
726            sighandler(headc,obt,i,k,nevents,evdone);            sighandler(headc,obt,i,k,nevents,evdone);
727            printf(" packet length is zero (YODA input error), skipped\n");            printf(" packet length is zero (YODA input error), skipped\n");
728          };          };
729            //aggiunto questo errore
730            if (ce->perror[k] == 143){
731              ver[k][23]++ ;
732              sighandler(headc,obt,i,k,nevents,evdone);
733              printf(" corrupted packet lenght \n");
734            };
735        };        };
736        for (Int_t kk = 0; kk < 11 ; kk++ ){        for (Int_t kk = 0; kk < 11 ; kk++ ){
737          tshit += shit[k][kk];          tshit += shit[k][kk];
# Line 724  void FCaloQLOOK(TString filename, Int_t Line 741  void FCaloQLOOK(TString filename, Int_t
741      if (isCOMP || isFULL){      if (isCOMP || isFULL){
742        Calstriphit->Fill(cshit);        Calstriphit->Fill(cshit);
743        //    if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){        //    if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){
744        if ( (cshit > 10 && cshit < 100) ){        //
745          //cambiata la banda di soglia  ora 5  prima era 10
746          //
747          if ( (cshit > 5 && cshit < 100) ){
748          incshit++;          incshit++;
749        } else {        } else {
750          outcshit++;          outcshit++;
# Line 732  void FCaloQLOOK(TString filename, Int_t Line 752  void FCaloQLOOK(TString filename, Int_t
752        //        //
753        if ( tshit>0 ) h1->Fill(tshit);        if ( tshit>0 ) h1->Fill(tshit);
754        //    if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){        //    if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){
755        if ( (tshit > 10 && tshit < 100) ){        //cambiata la soglia ora 5  prima era 10
756          if ( (tshit > 5 && tshit < 100) ){
757          intshit++;          intshit++;
758        } else {        } else {
759          outtshit++;          outtshit++;
# Line 820  void FCaloQLOOK(TString filename, Int_t Line 841  void FCaloQLOOK(TString filename, Int_t
841      h1->Draw();      h1->Draw();
842      //      //
843      h1max = h1->GetMaximum()*1.05;      h1max = h1->GetMaximum()*1.05;
844      Double_t xc[4] = {10.,100.,100.,10.};  
845        //cambiata banda  prima era 10  ora 5
846        Double_t xc[4] = {5.,100.,100.,5.};
847      Double_t yc[4] = {0.,0.,h1max,h1max};      Double_t yc[4] = {0.,0.,h1max,h1max};
848      banda1 = new TPolyLine(4,xc,yc);      banda1 = new TPolyLine(4,xc,yc);
849      banda1->SetLineColor(5);      banda1->SetLineColor(5);
# Line 870  void FCaloQLOOK(TString filename, Int_t Line 893  void FCaloQLOOK(TString filename, Int_t
893        h1->SetYTitle("Number of events");        h1->SetYTitle("Number of events");
894        h1->Draw();        h1->Draw();
895        h1max = h1->GetMaximum()*1.05;        h1max = h1->GetMaximum()*1.05;
896        Double_t xe[4] = {10.,100.,100.,10.};        //cambiato banda, prima era 10,ora 5
897          Double_t xe[4] = {5.,100.,100.,5.};
898        Double_t ye[4] = {0.,0.,h1max,h1max};        Double_t ye[4] = {0.,0.,h1max,h1max};
899        banda1 = new TPolyLine(4,xe,ye);        banda1 = new TPolyLine(4,xe,ye);
900        banda1->SetLineColor(5);        banda1->SetLineColor(5);
# Line 1056  void FCaloQLOOK(TString filename, Int_t Line 1080  void FCaloQLOOK(TString filename, Int_t
1080      Baseline->SetYTitle("Number of events");      Baseline->SetYTitle("Number of events");
1081      Baseline->Draw();      Baseline->Draw();
1082      h1max = Baseline->GetMaximum()*1.05;      h1max = Baseline->GetMaximum()*1.05;
1083      Double_t xc[4] = {2000.,4500.,4500.,2000.};      Double_t xc[4] = {2000.,5500.,5500.,2000.};
1084      Double_t yc[4] = {0.,0.,h1max,h1max};      Double_t yc[4] = {0.,0.,h1max,h1max};
1085      banda1 = new TPolyLine(4,xc,yc);      banda1 = new TPolyLine(4,xc,yc);
1086      banda1->SetLineColor(5);      banda1->SetLineColor(5);
# Line 1093  void FCaloQLOOK(TString filename, Int_t Line 1117  void FCaloQLOOK(TString filename, Int_t
1117      Calstriphit->SetYTitle("Number of events");      Calstriphit->SetYTitle("Number of events");
1118      Calstriphit->Draw();      Calstriphit->Draw();
1119      h1max = Calstriphit->GetMaximum()*1.05;      h1max = Calstriphit->GetMaximum()*1.05;
1120      Double_t xg[4] = {10.,100.,100.,10.};  
1121        //banda di sogla portata a 5, prima era a 10
1122        Double_t xg[4] = {5.,100.,100.,5.};
1123      Double_t yg[4] = {0.,0.,h1max,h1max};      Double_t yg[4] = {0.,0.,h1max,h1max};
1124      banda1 = new TPolyLine(4,xg,yg);      banda1 = new TPolyLine(4,xg,yg);
1125      banda1->SetLineColor(5);      banda1->SetLineColor(5);
# Line 1303  void FCaloQLOOK(TString filename, Int_t Line 1329  void FCaloQLOOK(TString filename, Int_t
1329    //    //
1330    Bool_t redevent = true;    Bool_t redevent = true;
1331    //    //
1332    if ( ver[0][3]+ver[0][16]+ver[0][17] == ver[1][3]+ver[1][16]+ver[1][17] && ver[1][3]+ver[1][16]+ver[1][17] == ver[2][3]+ver[2][16]+ver[2][17] && ver[2][3]+ver[2][16]+ver[2][17] == ver[3][3]+ver[3][16]+ver[3][17] ){    if ( ver[0][3]+ver[0][16]+ver[0][17]+ver[0][8] == ver[1][3]+ver[1][16]+ver[1][17]+ver[1][8] && ver[1][3]+ver[1][16]+ver[1][17]+ver[1][8] == ver[2][3]+ver[2][16]+ver[2][17]+ver[2][8] && ver[2][3]+ver[2][16]+ver[2][17]+ver[2][8] == ver[3][3]+ver[3][16]+ver[3][17]+ver[3][8] ){
1333      redevent = false;      redevent = false;
1334    };    };
1335    if ( redevent ) check = true;    if ( redevent ) check = true;
# Line 1335  void FCaloQLOOK(TString filename, Int_t Line 1361  void FCaloQLOOK(TString filename, Int_t
1361      t->SetTextAlign(12);      t->SetTextAlign(12);
1362      t->DrawLatex(33.,97.,sezione);      t->DrawLatex(33.,97.,sezione);
1363      t->SetTextSize(0.05);      t->SetTextSize(0.05);
1364      for (Int_t j = 0; j < 23; j++){      //aggiunto un errore jmax=23
1365        for (Int_t j = 0; j < 24; j++){
1366        if ( ver[i][j] || lver[i][j] ) {        if ( ver[i][j] || lver[i][j] ) {
1367          t->SetTextColor(50);          t->SetTextColor(50);
1368          if (j == 0) {          if (j == 0) {
# Line 1437  void FCaloQLOOK(TString filename, Int_t Line 1464  void FCaloQLOOK(TString filename, Int_t
1464            errore << "Calevnum jump: " << ver[i][j];            errore << "Calevnum jump: " << ver[i][j];
1465            errore << " time(s)";            errore << " time(s)";
1466            t->DrawLatex(2.,42.,errore.str().c_str());            t->DrawLatex(2.,42.,errore.str().c_str());
1467            check = true;            if ( ver[i][j] > 3 ) check = true;
1468          }          }
1469          if (j == 11) {          if (j == 11) {
1470            errore.str("");            errore.str("");
# Line 1523  void FCaloQLOOK(TString filename, Int_t Line 1550  void FCaloQLOOK(TString filename, Int_t
1550            t->DrawLatex(2.,3.,errore.str().c_str());            t->DrawLatex(2.,3.,errore.str().c_str());
1551            check = true;            check = true;
1552          };          };
1553        };          //aggiunto questo errore
1554      };          if (j == 23) {
1555              errore.str("");
1556              errore << "Corrupted packet lenght " << ver[i][j];
1557              errore << " time(s) ";
1558              t->DrawLatex(2.,2.,errore.str().c_str());
1559              check = true;
1560            };
1561          };
1562        };
1563      t->SetTextColor(50);      t->SetTextColor(50);
1564      if ( fulldiff[i] !=0 ) {      if ( fulldiff[i] !=0 ) {
1565        check = true;        check = true;
# Line 1551  void FCaloQLOOK(TString filename, Int_t Line 1586  void FCaloQLOOK(TString filename, Int_t
1586    if ( check ){    if ( check ){
1587      t->SetTextColor(50);      t->SetTextColor(50);
1588      t->DrawLatex(60.,95.," WARNING, CHECK! ");        t->DrawLatex(60.,95.," WARNING, CHECK! ");  
     printf("cdexyc %f cdexy %f ctshit %f cbase %f \n",cdexyc,cdexy,ctshit,cbase);  
1589    } else {    } else {
1590      t->SetTextColor(32);      t->SetTextColor(32);
1591      t->DrawLatex(60.,95.," OK! ");            t->DrawLatex(60.,95.," OK! ");      
1592    };    };
1593      printf("cdexyc %f cdexy %f ctshit %f cbase %f \n",cdexyc,cdexy,ctshit,cbase);
1594    //    //
1595    //  const string fil = (const char*)filename;    //  const string fil = (const char*)filename;
1596    //  Int_t posiz = fil.find("dw_");    //  Int_t posiz = fil.find("dw_");
# Line 1638  void FCaloQLOOK(TString filename, Int_t Line 1673  void FCaloQLOOK(TString filename, Int_t
1673      };      };
1674    };    };
1675  }  }
   

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.21

  ViewVC Help
Powered by ViewVC 1.1.23