Changeset 8455 for trunk/MagicSoft


Ignore:
Timestamp:
04/27/07 14:01:08 (17 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mjobs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.cc

    r8452 r8455  
    238238    fDisplay->AddTab(name);
    239239    obj->DrawClone(opt);
     240}
     241
     242void MJCalibration::DrawBadPixel(TPaveText &pave, const MHCamera &h, Int_t n, Float_t f, const char *str) const
     243{
     244    Int_t cnt = 0;
     245    for (UInt_t pix=0; pix<h.GetNumPixels(); pix++)
     246        if (TMath::Nint(h.GetPixContent(pix)) == n)
     247            cnt++;
     248
     249    const TString txt = Form(n<10?"  %d) %s%3i pixels":"%d) %s%3i pixels", n, str, cnt);
     250
     251    TText *p = pave.AddText(txt);
     252    p->SetTextColor(gStyle->GetColorPalette(TMath::FloorNint((n-1)*f)));
     253    p->SetTextAlign(12);
    240254}
    241255
     
    804818      TCanvas &c4 = fDisplay->AddTab("Defect");
    805819      c4.Divide(2,2, 0.005, 0.005);
    806      
     820
    807821      c4.cd(1);
    808822      gPad->SetBorderMode(0);
    809823      gPad->SetTicks();
     824
    810825      MHCamera *obj8=(MHCamera*)disp24.DrawCopy("hist");
    811       //
    812       // for the datacheck, fix the ranges!!
    813       //
     826
     827      gStyle->SetPalette(1);
     828      const Int_t numcol = gStyle->GetNumberOfColors();
     829
     830      const Double_t min = 1;
    814831      const Double_t max = 12.;
    815       obj8->SetMinimum(0.);
     832      const Double_t f   = (numcol-1)/(max-min);
     833
     834      obj8->SetStats(kFALSE);
     835      obj8->SetMinimum(min);
    816836      obj8->SetMaximum(max);
     837
    817838      //
    818839      // Set the datacheck sizes:
    819840      //
    820841      FixDataCheckHist((TH1D*)obj8);
    821       obj8->SetStats(kFALSE);
    822 
    823       gStyle->SetPalette(1);
    824       const Int_t numcol = gStyle->GetNumberOfColors()-3;
    825      
     842
    826843      TPaveText *pave = new TPaveText(0.05,0.02,0.975,0.999);
    827844      pave->SetBit(kCanDelete);
     
    829846      pave->SetTextSize(0.045);
    830847      pave->AddText("  ");
    831       TText *t1 = pave->AddText(Form("Signal smaller 4.5 Pedestal RMS:               %3i pixels",
    832                                        CountBadPixels(&disp24,1)));
    833       t1->SetTextColor(gStyle->GetColorPalette(Int_t(1./max*numcol)));
    834       t1->SetTextAlign(12);
    835       TText *t4 = pave->AddText(Form("Low Gain Saturation:                                   %3i pixels",
    836                                        CountBadPixels(&disp24,2)));
    837       t4->SetTextColor(gStyle->GetColorPalette(Int_t(2./max*numcol)));
    838       t4->SetTextAlign(12);
    839       TText *t5 = pave->AddText(Form("Mean Arr. Time In First Extraction Bin:      %3i pixels",
    840                                        CountBadPixels(&disp24,3)));
    841       t5->SetTextColor(gStyle->GetColorPalette(Int_t(3./max*numcol)));
    842       t5->SetTextAlign(12);
    843       TText *t6 = pave->AddText(Form("Mean Arr. Time In Last 2 Extraction Bins:  %3i pixels",
    844                                        CountBadPixels(&disp24,4)));
    845       t6->SetTextColor(gStyle->GetColorPalette(Int_t(4./max*numcol)));
    846       t6->SetTextAlign(12);
    847       TText *t10= pave->AddText(Form("High-Gain Histogram Overflow:                  %3i pixels",
    848                                        CountBadPixels(&disp24,5 )));
    849       t10->SetTextColor(gStyle->GetColorPalette(Int_t(5./max*numcol)));
    850       t10->SetTextAlign(12);
    851       TText *t11= pave->AddText(Form("Low-Gain Histogram Overflow:                   %3i pixels",
    852                                        CountBadPixels(&disp24,6 )));
    853       t11->SetTextColor(gStyle->GetColorPalette(Int_t(6./max*numcol)));
    854       t11->SetTextAlign(12);
    855       TText *t12= pave->AddText(Form("Presumably dead from Ped. Rms:              %3i pixels",
    856                                        CountBadPixels(&disp24,7 )));
    857       t12->SetTextColor(gStyle->GetColorPalette(Int_t(7./max*numcol)));
    858       t12->SetTextAlign(12);
    859       TText *t13= pave->AddText(Form("Fluctuating Pulse Arrival Times:                 %3i pixels",
    860                                        CountBadPixels(&disp24,8 )));
    861       t13->SetTextColor(gStyle->GetColorPalette(Int_t(8./max*numcol)));
    862       t13->SetTextAlign(12);
    863       TText *t17 = pave->AddText(Form("Deviating Number of Photo-electrons:       %3i pixels",
    864                                        CountBadPixels(&disp24,9 )));
    865       t17->SetTextColor(gStyle->GetColorPalette(Int_t(9./max*numcol)));
    866       t17->SetTextAlign(12);
    867       TText *t18 = pave->AddText(Form("Deviating Rel. Arrival Time RMS:                %3i pixels",
    868                                        CountBadPixels(&disp24,10 )));
    869       t18->SetTextColor(gStyle->GetColorPalette(Int_t(10./max*numcol)));
    870       t18->SetTextAlign(12);
    871       TText *t15= pave->AddText(Form("Too many Low-Gain Blackout Events:       %3i pixels",
    872                                        CountBadPixels(&disp24,11 )));
    873       t15->SetTextColor(gStyle->GetColorPalette(Int_t(11./max*numcol)));
    874       t15->SetTextAlign(12);
    875       TText *t14= pave->AddText(Form("Previously Excluded:                                   %3i pixels",
    876                                        CountBadPixels(&disp24,12)));
    877       t14->SetTextColor(gStyle->GetColorPalette(Int_t(12./max*numcol)));
    878       t14->SetTextAlign(12);
     848      DrawBadPixel(*pave, disp24,  1, f, "Signal smaller 4.5 Pedestal RMS:               ");
     849      DrawBadPixel(*pave, disp24,  2, f, "Low Gain Saturation:                                   ");
     850      DrawBadPixel(*pave, disp24,  3, f, "Mean Arr. Time In First Extraction Bin:      ");
     851      DrawBadPixel(*pave, disp24,  4, f, "Mean Arr. Time In Last 2 Extraction Bins:  ");
     852      DrawBadPixel(*pave, disp24,  5, f, "High-Gain Histogram Overflow:                  ");
     853      DrawBadPixel(*pave, disp24,  6, f, "Low-Gain Histogram Overflow:                   ");
     854      DrawBadPixel(*pave, disp24,  7, f, "Presumably dead from Ped. Rms:              ");
     855      DrawBadPixel(*pave, disp24,  8, f, "Fluctuating Pulse Arrival Times:                 ");
     856      DrawBadPixel(*pave, disp24,  9, f, "Deviating Number of Photo-electrons:       ");
     857      DrawBadPixel(*pave, disp24, 10, f, "Deviating Rel. Arrival Time RMS:                ");
     858      DrawBadPixel(*pave, disp24, 11, f, "Too many Low-Gain Blackout Events:       ");
     859      DrawBadPixel(*pave, disp24, 12, f, "Previously Excluded:                                   ");
    879860      pave->Draw();
    880861
    881862      c4.cd(3);
    882863      gPad->SetBorderMode(0);
     864      obj8->SetPrettyPalette();
    883865      obj8->Draw();
    884       obj8->SetPrettyPalette();
    885866
    886867      //
    887868      // UNRELIABLE PIXELS
    888869      //
    889      
    890870      c4.cd(2);
    891871      gPad->SetBorderMode(0);
    892872      gPad->SetTicks();
    893873      MHCamera *obj9=(MHCamera*)disp25.DrawCopy("hist");
    894       //
    895       // for the datacheck, fix the ranges!!
    896       //
    897       const Double_t max2 = 9.;
    898       obj9->SetMinimum(0.);
     874
     875      const Double_t min2 = 1;
     876      const Double_t max2 = 8;
     877      const Double_t f2   = (numcol-1)/(max2-min2);
     878      obj9->SetMinimum(min2);
    899879      obj9->SetMaximum(max2);
    900       //
    901       // Set the datacheck sizes:
    902       //
     880      obj9->SetStats(kFALSE);
     881
    903882      FixDataCheckHist((TH1D*)obj9);
    904       obj9->SetStats(kFALSE);
    905883
    906884      gStyle->SetPalette(1);
    907      
     885
    908886      TPaveText *pave2 = new TPaveText(0.025,0.02,0.95,0.999);
    909887      pave2->SetBit(kCanDelete);
     
    911889      pave2->SetTextSize(0.05);
    912890      pave2->AddText("  ");
    913       TText *t3 = pave2->AddText(Form("Signal Sigma smaller Pedestal RMS:      %3i pixels",
    914                                        CountBadPixels(&disp25,1)));
    915       t3->SetTextColor(gStyle->GetColorPalette(Int_t(1./max2*numcol)));
    916       t3->SetTextAlign(12);
    917       TText *tt1 = pave2->AddText(Form("High Gain Signals could not be fitted:    %3i pixels",
    918                                        CountBadPixels(&disp25,3)));
    919       tt1->SetTextColor(gStyle->GetColorPalette(Int_t(3./max2*numcol)));
    920       tt1->SetTextAlign(12);
    921       TText *tt2 = pave2->AddText(Form("Low  Gain Signals could not be fitted:    %3i pixels",
    922                                        CountBadPixels(&disp25,4)));
    923       tt2->SetTextColor(gStyle->GetColorPalette(Int_t(4./max2*numcol)));
    924       tt2->SetTextAlign(12);
    925       TText *tt3 = pave2->AddText(Form("Relative Arr. Times could not be fitted:   %3i pixels",
    926                                        CountBadPixels(&disp25,5)));
    927       tt3->SetTextColor(gStyle->GetColorPalette(Int_t(5./max2*numcol)));
    928       tt3->SetTextAlign(12);
    929       TText *tt4 = pave2->AddText(Form("High Gain Signals Oscillation:                 %3i pixels",
    930                                        CountBadPixels(&disp25,6)));
    931       tt4->SetTextColor(gStyle->GetColorPalette(Int_t(6./max2*numcol)));
    932       tt4->SetTextAlign(12);
    933       TText *tt5 = pave2->AddText(Form("Low  Gain Signals Oscillation:                %3i pixels",
    934                                        CountBadPixels(&disp25,7)));
    935       tt5->SetTextColor(gStyle->GetColorPalette(Int_t(7./max2*numcol)));
    936       tt5->SetTextAlign(12);
    937       TText *tt6 = pave2->AddText(Form("Relative Arr. Times Oscillation:               %3i pixels",
    938                                        CountBadPixels(&disp25,8)));
    939       tt6->SetTextColor(gStyle->GetColorPalette(Int_t(8./max2*numcol)));
    940       tt6->SetTextAlign(12);
    941       TText *tt8 = pave2->AddText(Form("Deviating global F-Factor:                       %3i pixels",
    942                                        CountBadPixels(&disp25,9)));
    943       tt8->SetTextColor(gStyle->GetColorPalette(Int_t(9./max2*numcol)));
    944       tt8->SetTextAlign(12);
     891      DrawBadPixel(*pave2, disp25,  1, f2, "Signal Sigma smaller Pedestal RMS:      ");
     892      DrawBadPixel(*pave2, disp25,  2, f2, "High Gain Signals could not be fitted:    ");
     893      DrawBadPixel(*pave2, disp25,  3, f2, "Low  Gain Signals could not be fitted:    ");
     894      DrawBadPixel(*pave2, disp25,  4, f2, "Relative Arr. Times could not be fitted:   ");
     895      DrawBadPixel(*pave2, disp25,  5, f2, "High Gain Signals Oscillation:                 ");
     896      DrawBadPixel(*pave2, disp25,  6, f2, "Low  Gain Signals Oscillation:                ");
     897      DrawBadPixel(*pave2, disp25,  7, f2, "Relative Arr. Times Oscillation:               ");
     898      DrawBadPixel(*pave2, disp25,  8, f2, "Deviating global F-Factor:                       ");
    945899      pave2->Draw();
    946900
     
    13411295}
    13421296
    1343 const Int_t MJCalibration::CountBadPixels(MHCamera *cam, const Int_t what) const
    1344 {
    1345     Int_t cnt = 0;
    1346 
    1347     for (UInt_t pix=0; pix<cam->GetNumPixels(); pix++)
    1348         if (TMath::Nint(cam->GetPixContent(pix)) == what)
    1349             cnt++;
    1350 
    1351     return cnt;
    1352 }
    1353 
    13541297// --------------------------------------------------------------------------
    13551298//
  • trunk/MagicSoft/Mars/mjobs/MJCalibration.h

    r8428 r8455  
    2828
    2929class TH1D;
     30class TPaveText;
    3031
    3132class MTask;
     
    7677  Float_t  fRefArrivalTimeRmsInner;        //! Reference value for the arrival time - inner
    7778  Float_t  fRefArrivalTimeRmsOuter;        //! Reference value for the arrival time - outer
    78   Float_t  fRefTimeOffsetInner;            //! Reference value for the time offset - inner
    7979  Float_t  fRefTimeOffsetOuter;            //! Reference value for the time offset - outer
    8080  Float_t  fRefTimeResolutionInner;        //! Reference value for the time resolution - inner
     
    116116  Bool_t IsDebug        () const { return TESTBIT(fFlags,kDebug);          }
    117117
    118   void   DrawTab(MParList &plist, const char *cont, const char *name, Option_t *opt);
     118  void DrawBadPixel(TPaveText &pave, const MHCamera &h, Int_t n, Float_t f, const char *str) const;
     119  void DrawTab(MParList &plist, const char *cont, const char *name, Option_t *opt);
    119120 
    120121  void   DisplayResult        ( MParList &plist );
     
    122123  void   DisplayOutliers      ( TH1D     *hist, const char* whatsmall, const char* whatbig ) const;
    123124  void   DisplayDoubleProject ( MHCamera *cam , const char* whatsmall, const char* whatbig ) const;
    124   const  Int_t CountBadPixels ( MHCamera *cam , const Int_t what                           ) const;
    125125  void   FixDataCheckHist     ( TH1D     *hist  ) const;
    126126
Note: See TracChangeset for help on using the changeset viewer.