/[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.10 by mocchiut, Mon May 29 12:08:13 2006 UTC revision 1.13 by mocchiut, Thu Aug 3 15:25:45 2006 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.08  (2006-05-29)  //   FCaloQLOOK.c      version 1.11  (2006-07-17)
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.07 - 1.08 (2006-05-29): Fixed bug in output filename when input is not in the form DW_YYMMDD_NNN.  //   1.09 - 1.11 (2006-07-17): Adapted to flight conditions.
11    //
12    //   1.07 - 1.09 (2006-05-29): Fixed bug in output filename when input is not in the form DW_YYMMDD_NNN. Bug in latchup alarm not coming from the status word, fixed.
13  //  //
14  //   1.06 - 1.07 (2006-05-23): Don't print warning in case of latchup not recognized from the status word, fixed. Added "expert" figures from 21 to 28 which appears only in the  //   1.06 - 1.07 (2006-05-23): Don't print warning in case of latchup not recognized from the status word, fixed. Added "expert" figures from 21 to 28 which appears only in the
15  //                             case of latchup alarm.  //                             case of latchup alarm.
# Line 83  TString getFilename(const TString filena Line 85  TString getFilename(const TString filena
85    return file2;    return file2;
86  }  }
87    
88  void FCaloQLOOK(TString filename, Int_t fromevent=0, Int_t toevent=0, TString outDir="", TString saveas = "ps"){  void FCaloQLOOK(TString filename, Int_t fromevent=0, Int_t toevent=0, TString outDir="", TString saveas = "png"){
89    gStyle->SetPaperSize(19.,25.);    gStyle->SetPaperSize(19.,25.);
90    const char* startingdir = gSystem->WorkingDirectory();    const char* startingdir = gSystem->WorkingDirectory();
91    //  printf(" basename is %s \n",gSystem->BaseName(filename.Data()));    //  printf(" basename is %s \n",gSystem->BaseName(filename.Data()));
# Line 112  void FCaloQLOOK(TString filename, Int_t Line 114  void FCaloQLOOK(TString filename, Int_t
114    Float_t ctshitthr = 0.65;    Float_t ctshitthr = 0.65;
115    Float_t cbasethr = 0.95;    Float_t cbasethr = 0.95;
116    Float_t cdexythr = 0.995;    Float_t cdexythr = 0.995;
117      //Float_t cdexythr = 0.90;
118    Float_t cdexycthr = 0.95;    Float_t cdexycthr = 0.95;
119      Float_t h1rth = 0.90;
120      Int_t calevnth = 13;
121    //    //
122    pamela::calorimeter::CalorimeterEvent *ce = 0;    pamela::calorimeter::CalorimeterEvent *ce = 0;
123    pamela::EventHeader *eh = 0;    pamela::EventHeader *eh = 0;
# Line 198  void FCaloQLOOK(TString filename, Int_t Line 203  void FCaloQLOOK(TString filename, Int_t
203    hdiff->SetBit(TH1F::kCanRebin);    hdiff->SetBit(TH1F::kCanRebin);
204    Baseline = new TH1F("C9","baselines",100,0,3);    Baseline = new TH1F("C9","baselines",100,0,3);
205    Baseline->SetBit(TH1F::kCanRebin);    Baseline->SetBit(TH1F::kCanRebin);
206    Dexy = new TH1F("C12","dexy",100,0.,37000.);    Dexy = new TH1F("C12","dexy",100,0.,10000.);
207    Dexyc = new TH1F("C10","dexyc",100,0,3);    Dexy->SetBit(TH1F::kCanRebin);
208    Dexyc->SetBit(TH1F::kCanRebin);    Dexyc = new TH1F("C10","dexyc",100,-100.,37000.);
209    //  Dexyc->SetBit(TH1F::kCanRebin);
210    Calstriphit = new TH1F("C11","calstriphit[1:4]",100,0.,200.);    Calstriphit = new TH1F("C11","calstriphit[1:4]",100,0.,200.);
211            
212    calev01 = new TH1F("C3","|calevnum(1)-calevnum(2)|",100,0,1);    calev01 = new TH1F("C3","|calevnum(1)-calevnum(2)|",100,0,1);
# Line 281  void FCaloQLOOK(TString filename, Int_t Line 287  void FCaloQLOOK(TString filename, Int_t
287    bool isRAW = 0;    bool isRAW = 0;
288    Int_t alldexy=0;    Int_t alldexy=0;
289    Int_t alldexy2=0;    Int_t alldexy2=0;
290    Int_t stri=0;    Int_t planebases=0;
291      //  Int_t stri=0;
292    Int_t fcheck = 0;    Int_t fcheck = 0;
293    Int_t cestw=0;    Int_t cestw=0;
294    Int_t cmask = 127 ;    Int_t cmask = 127 ;
# Line 309  void FCaloQLOOK(TString filename, Int_t Line 316  void FCaloQLOOK(TString filename, Int_t
316    Float_t headc = 0.;    Float_t headc = 0.;
317    Float_t headco = 0.;    Float_t headco = 0.;
318    Bool_t h1rcheck = false;    Bool_t h1rcheck = false;
319      Int_t h1rin = 0;
320      Int_t h1rout = 0;
321    Int_t intshit = 0;    Int_t intshit = 0;
322    Int_t outtshit = 0;    Int_t outtshit = 0;
323    Int_t incshit = 0;    Int_t incshit = 0;
# Line 344  void FCaloQLOOK(TString filename, Int_t Line 353  void FCaloQLOOK(TString filename, Int_t
353      headco = headc;      headco = headc;
354      headc = ph->GetCounter();      headc = ph->GetCounter();
355      obt = ph->GetOrbitalTime();      obt = ph->GetOrbitalTime();
356      calevn1 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[1]));      if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[1])) ) calevn1++;
357      calevn2 += (int)abs((int)(ce->calevnum[2]-ce->calevnum[3]));      if ( (int)abs((int)(ce->calevnum[2]-ce->calevnum[3])) ) calevn2++;
358      calevn3 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[3]));      if ( (int)abs((int)(ce->calevnum[0]-ce->calevnum[3])) ) calevn3++;
359        //    calevn1 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[1]));
360        //    calevn2 += (int)abs((int)(ce->calevnum[2]-ce->calevnum[3]));
361        //    calevn3 += (int)abs((int)(ce->calevnum[0]-ce->calevnum[3]));
362      calev01->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[1])));      calev01->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[1])));
363      calev23->Fill(abs((int)(ce->calevnum[2]-ce->calevnum[3])));      calev23->Fill(abs((int)(ce->calevnum[2]-ce->calevnum[3])));
364      calev03->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[3])));      calev03->Fill(abs((int)(ce->calevnum[0]-ce->calevnum[3])));
# Line 432  void FCaloQLOOK(TString filename, Int_t Line 444  void FCaloQLOOK(TString filename, Int_t
444              bdone = 0;              bdone = 0;
445              bl++;              bl++;
446              allbase = ce->base[l][ii][bl];              allbase = ce->base[l][ii][bl];
447                //      alldexy=0;
448                //      alldexy2=0;
449                //      stri=0;
450                //      for (Int_t e = 0; e < 16 ; e++ ){
451                //        stri = e + 16 * bl;
452                //        alldexy += (int)ce->dexyc[l][ii][stri];
453                //        alldexy2 += (int)ce->dexy[l][ii][stri];
454                //      };
455              };
456              //
457              if ( kk == 0 ){
458                planebases = 0;
459              alldexy=0;              alldexy=0;
460              alldexy2=0;              alldexy2=0;
461              stri=0;              for (Int_t e = 0; e < 96 ; e++ ){
462              for (Int_t e = 0; e < 16 ; e++ ){                if ( e < 6 ) planebases += (int)ce->base[l][ii][e];
463                stri = e + 16 * bl;                alldexy += (int)ce->dexyc[l][ii][e];
464                alldexy += (int)ce->dexyc[l][ii][stri];                alldexy2 += (int)ce->dexy[l][ii][e];
               alldexy2 += (int)ce->dexy[l][ii][stri];  
465              };              };
466            };            };
467              //
468            if ( !isRAW ) {            if ( !isRAW ) {
469              //              //
470              if ( !pdone ){              if ( !pdone ){
471                if ( (ce->base[l][ii][bl]>32000 || ce->base[l][ii][bl] == 0 ) && ( alldexy > 512000 ||  alldexy == 0) && ce->perror[se] == 0 ) {                //              if ( (ce->base[l][ii][bl]>32000 || ce->base[l][ii][bl] == 0 ) && ( alldexy > 512000 ||  alldexy == 0) && ce->perror[se] == 0 ) {
472                  if ( (planebases>192000 || planebases == 0 ) && ( alldexy > 3072000 ||  alldexy == 0) && ce->perror[se] == 0 ) {
473                  pdone = 1;                  pdone = 1;
474                  pshit[se][pl]++ ;                  pshit[se][pl]++ ;
475                  if ( (ce->stwerr[se] & (1 << 4)) == 0 ) {                  if ( (ce->stwerr[se] & (1 << 4)) == 0 ) {
# Line 512  void FCaloQLOOK(TString filename, Int_t Line 537  void FCaloQLOOK(TString filename, Int_t
537              //              //
538            } else {            } else {
539              if ( !pdone ){              if ( !pdone ){
540                if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) {                if ( ( alldexy2 > 3072000 ||  alldexy2 == 0) && ce->perror[se] == 0 ) {
541                    //            if ( (alldexy2>512000 || alldexy2 == 0) && ce->perror[se] == 0 ) {
542                  pdone = 1;                  pdone = 1;
543                  pshit[se][pl]++ ;                                          pshit[se][pl]++ ;                        
544                  if ( (ce->stwerr[se] & (1 << 4)) == 0 ){                  if ( (ce->stwerr[se] & (1 << 4)) == 0 ){
# Line 581  void FCaloQLOOK(TString filename, Int_t Line 607  void FCaloQLOOK(TString filename, Int_t
607          trshit += rshit[k][kk];          trshit += rshit[k][kk];
608        };        };
609      };        };  
610      Calstriphit->Fill(cshit);      if (isCOMP || isFULL){
611      if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){        Calstriphit->Fill(cshit);
612        incshit++;        //    if ( (cshit > 0 && cshit < 25) || (cshit > 40 && cshit < 80) ){
613      } else {        if ( (cshit > 10 && cshit < 100) ){
614        outcshit++;          incshit++;
615      };        } else {
616      if ( tshit>0 ) h1->Fill(tshit);          outcshit++;
617      if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){        };
618        intshit++;        //
619      } else {        if ( tshit>0 ) h1->Fill(tshit);
620        outtshit++;        //    if ( (tshit > 0 && tshit < 25) || (tshit > 40 && tshit < 80) ){
621          if ( (tshit > 10 && tshit < 100) ){
622            intshit++;
623          } else {
624            outtshit++;
625          };
626      };      };
627      if ( trshit>0 ) {      if ( trshit>0 ) {
628        h1r->Fill(trshit);        h1r->Fill(trshit);
629        if ( trshit < 4210 ){        if ( trshit < 4210 ){
630          h1rcheck = true;          h1rout++;
631          //              printf("ma come... trshit %i \n",trshit);          //              printf("ma come... trshit %i \n",trshit);
632          } else {
633            h1rin++;
634        };        };
635      };      };
636      if ( i%1000 == 0 && i > 0 ) printf("%iK\n",i/1000);      if ( i%1000 == 0 && i > 0 ) printf("%iK\n",i/1000);
637      i++;      i++;
638    };    };
639    printf("\n");    printf("\n");
640          if ( (float)h1rout/((float)h1rin+(float)h1rout) > h1rth ){
641        h1rcheck = true;
642      };    
643    //    //
644    //  output figures, first sheet:    //  output figures, first sheet:
645    //    //
# Line 670  void FCaloQLOOK(TString filename, Int_t Line 705  void FCaloQLOOK(TString filename, Int_t
705      h1->Draw();      h1->Draw();
706      //      //
707      h1max = h1->GetMaximum()*1.05;      h1max = h1->GetMaximum()*1.05;
708      Double_t xc[4] = {0.,25.,25.,0.};      Double_t xc[4] = {10.,100.,100.,10.};
709      Double_t yc[4] = {0.,0.,h1max,h1max};      Double_t yc[4] = {0.,0.,h1max,h1max};
710      banda1 = new TPolyLine(4,xc,yc);      banda1 = new TPolyLine(4,xc,yc);
711      banda1->SetLineColor(5);      banda1->SetLineColor(5);
712      banda1->SetFillColor(5);      banda1->SetFillColor(5);
713      banda1->SetLineWidth(1);      banda1->SetLineWidth(1);
714      banda1->Draw("fSAME");      banda1->Draw("fSAME");
715      Double_t xd[4] = {40.,80.,80.,40.};    //  Double_t xd[4] = {40.,80.,80.,40.};
716      Double_t yd[4] = {0.,0.,h1max,h1max};     // Double_t yd[4] = {0.,0.,h1max,h1max};
717      banda2 = new TPolyLine(4,xd,yd);     // banda2 = new TPolyLine(4,xd,yd);
718      banda2->SetLineColor(5);     // banda2->SetLineColor(5);
719      banda2->SetFillColor(5);     // banda2->SetFillColor(5);
720      banda2->SetLineWidth(1);     // banda2->SetLineWidth(1);
721      banda2->Draw("fSAME");      //banda2->Draw("fSAME");
722      h1->Draw("SAME");      h1->Draw("SAME");
723      //      //
724      figura->cd();      figura->cd();
# Line 720  void FCaloQLOOK(TString filename, Int_t Line 755  void FCaloQLOOK(TString filename, Int_t
755        h1->SetYTitle("Number of events");        h1->SetYTitle("Number of events");
756        h1->Draw();        h1->Draw();
757        h1max = h1->GetMaximum()*1.05;        h1max = h1->GetMaximum()*1.05;
758        Double_t xe[4] = {0.,25.,25.,0.};        Double_t xe[4] = {10.,100.,100.,10.};
759        Double_t ye[4] = {0.,0.,h1max,h1max};        Double_t ye[4] = {0.,0.,h1max,h1max};
760        banda1 = new TPolyLine(4,xe,ye);        banda1 = new TPolyLine(4,xe,ye);
761        banda1->SetLineColor(5);        banda1->SetLineColor(5);
762        banda1->SetFillColor(5);        banda1->SetFillColor(5);
763        banda1->SetLineWidth(1);        banda1->SetLineWidth(1);
764        banda1->Draw("fSAME");        banda1->Draw("fSAME");
765        Double_t xf[4] = {40.,80.,80.,40.};       // Double_t xf[4] = {40.,80.,80.,40.};
766        Double_t yf[4] = {0.,0.,h1max,h1max};       // Double_t yf[4] = {0.,0.,h1max,h1max};
767        banda2 = new TPolyLine(4,xf,yf);       // banda2 = new TPolyLine(4,xf,yf);
768        banda2->SetLineColor(5);       // banda2->SetLineColor(5);
769        banda2->SetFillColor(5);       // banda2->SetFillColor(5);
770        banda2->SetLineWidth(1);      //  banda2->SetLineWidth(1);
771        banda2->Draw("fSAME");       // banda2->Draw("fSAME");
772        h1->Draw("SAME");        h1->Draw("SAME");
773      };      };
774      if ( trshit !=0 ) {      if ( trshit !=0 ) {
# Line 763  void FCaloQLOOK(TString filename, Int_t Line 798  void FCaloQLOOK(TString filename, Int_t
798      };      };
799    };    };
800    if ( !errorfull ) {    if ( !errorfull ) {
801      if ( calevn1 || calevn2 || calevn3 ) {      if ( calevn1 > calevnth || calevn2 > calevnth || calevn3 > calevnth ) {
802        pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.24,0.98,45);        pd1 = new TPad("pd1","This is pad1",0.02,0.51,0.24,0.98,45);
803        pd2 = new TPad("pd2","This is pad2",0.26,0.51,0.49,0.98,45);        pd2 = new TPad("pd2","This is pad2",0.26,0.51,0.49,0.98,45);
804        pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.24,0.49,45);        pd3 = new TPad("pd3","This is pad3",0.02,0.02,0.24,0.49,45);
# Line 938  void FCaloQLOOK(TString filename, Int_t Line 973  void FCaloQLOOK(TString filename, Int_t
973      Dexyc->Draw("SAME");      Dexyc->Draw("SAME");
974      //      //
975      pd3->cd();      pd3->cd();
976    //    gPad->SetLogy();
977      Calstriphit->SetXTitle("Number of hit");      Calstriphit->SetXTitle("Number of hit");
978      Calstriphit->SetYTitle("Number of events");      Calstriphit->SetYTitle("Number of events");
979      Calstriphit->Draw();      Calstriphit->Draw();
980      h1max = Calstriphit->GetMaximum()*1.05;      h1max = Calstriphit->GetMaximum()*1.05;
981      Double_t xg[4] = {0.,25.,25.,0.};      Double_t xg[4] = {10.,100.,100.,10.};
982      Double_t yg[4] = {0.,0.,h1max,h1max};      Double_t yg[4] = {0.,0.,h1max,h1max};
983      banda1 = new TPolyLine(4,xg,yg);      banda1 = new TPolyLine(4,xg,yg);
984      banda1->SetLineColor(5);      banda1->SetLineColor(5);
985      banda1->SetFillColor(5);      banda1->SetFillColor(5);
986      banda1->SetLineWidth(1);      banda1->SetLineWidth(1);
987      banda1->Draw("fSAME");      banda1->Draw("fSAME");
988      Double_t xh[4] = {40.,80.,80.,40.};    //  Double_t xh[4] = {40.,80.,80.,40.};
989      Double_t yh[4] = {0.,0.,h1max,h1max};    //  Double_t yh[4] = {0.,0.,h1max,h1max};
990      banda2 = new TPolyLine(4,xh,yh);    //  banda2 = new TPolyLine(4,xh,yh);
991      banda2->SetLineColor(5);    //  banda2->SetLineColor(5);
992      banda2->SetFillColor(5);    //  banda2->SetFillColor(5);
993      banda2->SetLineWidth(1);    //  banda2->SetLineWidth(1);
994      banda2->Draw("fSAME");    //  banda2->Draw("fSAME");
995      Calstriphit->Draw("SAME");      Calstriphit->Draw("SAME");
996      //      //
997      pd4->cd();      pd4->cd();
998        gPad->SetLogy();
999      Dexy->SetXTitle("ADC channels");      Dexy->SetXTitle("ADC channels");
1000      Dexy->SetYTitle("Number of events");      Dexy->SetYTitle("Number of events");
1001      Dexy->Draw();      Dexy->Draw();
1002      h1max = Dexy->GetMaximum()*1.05;      //    h1max = Dexy->GetMaximum()*1.05;
1003        h1max = Dexy->GetMaximum()*2.05;
1004      Double_t xd[4] = {2000.,5000.,5000.,2000.};      Double_t xd[4] = {2000.,5000.,5000.,2000.};
1005      Double_t yd[4] = {0.,0.,h1max,h1max};      Double_t yd[4] = {0.,0.,h1max,h1max};
1006      banda1 = new TPolyLine(4,xd,yd);      banda1 = new TPolyLine(4,xd,yd);
# Line 998  void FCaloQLOOK(TString filename, Int_t Line 1036  void FCaloQLOOK(TString filename, Int_t
1036      pd4->Draw();      pd4->Draw();
1037      //      //
1038      pd4->cd();      pd4->cd();
1039        gPad->SetLogy();
1040      Dexy->SetXTitle("ADC channels");      Dexy->SetXTitle("ADC channels");
1041      Dexy->SetYTitle("Number of events");      Dexy->SetYTitle("Number of events");
1042      Dexy->Draw();      Dexy->Draw();
1043      h1max = Dexy->GetMaximum()*1.05;      //    h1max = Dexy->GetMaximum()*1.05;
1044        h1max = Dexy->GetMaximum()*2.05;
1045      Double_t xd[4] = {2000.,5000.,5000.,2000.};      Double_t xd[4] = {2000.,5000.,5000.,2000.};
1046      Double_t yd[4] = {0.,0.,h1max,h1max};      Double_t yd[4] = {0.,0.,h1max,h1max};
1047      banda1 = new TPolyLine(4,xd,yd);      banda1 = new TPolyLine(4,xd,yd);
# Line 1268  void FCaloQLOOK(TString filename, Int_t Line 1308  void FCaloQLOOK(TString filename, Int_t
1308            errore << "Missing section: " << ver[i][j];            errore << "Missing section: " << ver[i][j];
1309            errore << " time(s)";            errore << " time(s)";
1310            t->DrawLatex(2.,50.,errore.str().c_str());            t->DrawLatex(2.,50.,errore.str().c_str());
1311            check = true;            if ( ver[i][j] > 3 ) check = true;
1312          }          }
1313          if (j == 10) {          if (j == 10) {
1314            errore.str("");            errore.str("");
# Line 1282  void FCaloQLOOK(TString filename, Int_t Line 1322  void FCaloQLOOK(TString filename, Int_t
1322            errore << "CRC error (data): " << ver[i][j];            errore << "CRC error (data): " << ver[i][j];
1323            errore << " time(s)";            errore << " time(s)";
1324            t->DrawLatex(2.,38.,errore.str().c_str());            t->DrawLatex(2.,38.,errore.str().c_str());
1325            check = true;            if ( ver[i][j] > 10 ) check = true;
1326          }          }
1327          if (j == 12) {          if (j == 12) {
1328            errore.str("");            errore.str("");

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

  ViewVC Help
Powered by ViewVC 1.1.23