]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added new 'status' histogram to the DQM data maker and checker. This histogram
authorcholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 3 Sep 2012 12:31:39 +0000 (12:31 +0000)
committercholm <cholm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 3 Sep 2012 12:31:39 +0000 (12:31 +0000)
contains the per ring per cycle fit status.  The QA is set by how many times
the fits have failed or failed miserably.

Perhaps this needs to be pushed to the release.

FMD/AliFMDQAChecker.cxx
FMD/AliFMDQADataMakerRec.cxx
FMD/AliFMDQADataMakerRec.h

index 1d60b187da089b6daca78455c079b9d7959c8c2e..e397c3c3dd60aa2bea08abfa9441dcbf4ff112c3 100644 (file)
 #include <TFitResult.h>
 #include <TParameter.h>
 #include <TMacro.h>
+#include <TPaveText.h>
 
 // --- AliRoot header files ---
 #include "AliLog.h"
 #include "AliQAv1.h"
 #include "AliQAChecker.h"
 #include "AliFMDQAChecker.h"
+#include "AliFMDQADataMakerRec.h"
 #include "AliRecoParam.h"
 #include <AliCDBManager.h>
 #include <AliCDBEntry.h>
@@ -756,14 +758,41 @@ void AliFMDQAChecker::Check(Double_t*                   rv,
     
     if(!list[specie]) continue;
     
-    TH1* hist  = 0;
-    Int_t nHist = list[specie]->GetEntriesFast();
-    UShort_t ret = 0;
+    TH1*     hist  = 0;
+    Int_t    nHist = list[specie]->GetEntriesFast();
+
+    // Find the status histogram if any 
+    TH2*  status  = 0;
+    Int_t istatus = AliFMDQADataMakerRec::GetHalfringIndex(4, 'i', 0, 0);
+    if (istatus < nHist) 
+      status = dynamic_cast<TH2*>(list[specie]->At(istatus));
+      
+    UShort_t ret   = 0;
     for(Int_t i= 0; i< nHist; i++) {
       if (!(hist = static_cast<TH1*>(list[specie]->At(i)))) continue;
+      if (hist == status) continue;
+      
       Int_t qual = CheckOne(what, AliRecoParam::ConvertIndex(specie), hist);
       hist->SetUniqueID(Quality2Bit(qual));
       ret += qual;
+
+      if (!status) continue;
+
+      // AliFMDQADataMakerRec::GetHalfringFromIndex(i, d, r, b, mm);
+      // AliWarningF("Got index %2d -> halfring FMD%d%c %s", i, d, r, 
+      //             hist->GetName());
+      TString nme(hist->GetName());
+      Char_t cD   = nme[nme.Length()-2];
+      Char_t cR   = nme[nme.Length()-1];
+      Int_t  xbin = 0;
+      switch (cD) { 
+      case '1': xbin = 1; break;
+      case '2': xbin = 2 + ((cR == 'i' || cR == 'I') ? 0 : 1); break;
+      case '3': xbin = 4 + ((cR == 'i' || cR == 'I') ? 0 : 1); break;
+      }
+      if (xbin == 0) continue;
+      status->Fill(xbin, qual);
+                  
     } // for (int i ...)
     rv[specie] = ret;
     // if      (ret > kWhatTheFk) rv[specie] = fLowTestValue[AliQAv1::kFATAL];
@@ -772,6 +801,33 @@ void AliFMDQAChecker::Check(Double_t*                   rv,
     // else                       rv[specie] = fUpTestValue[AliQAv1::kINFO]; 
     AliDebugF(3, "Combined sum is %d -> %f", ret, rv[specie]);
 
+    if (status) { 
+      Int_t qual = 0;
+      for (Int_t i = 1; i < status->GetXaxis()->GetNbins(); i++) { 
+       if (status->GetBinContent(i, 3) > 1) qual++;
+       if (status->GetBinContent(i, 4) > 0) qual++;
+      }
+      status->SetUniqueID(Quality2Bit(qual));
+      TPaveText* text = new TPaveText(.6, .8, .95, .95, "brNDC");
+      Int_t   bg  = kGreen-10;
+      Int_t   fg  = kBlack;
+      TString msg = "OK";
+      if      (qual >= kWhatTheFk) { bg = kRed+1; fg = kWhite; msg = "Argh!"; }
+      else if (qual >= kBad)       { bg = kRed-3; fg = kWhite; msg = "Bad"; }
+      else if (qual >= kProblem)   { bg = kOrange-4; msg = "Warning"; }
+      text->AddText(msg);
+      text->SetTextFont(62);
+      text->SetTextColor(fg);
+      text->SetFillColor(bg);
+
+      TList*   ll  = status->GetListOfFunctions(); 
+      TObject* old = ll->FindObject(text->GetName());
+      if (old) { 
+       ll->Remove(old);
+       delete old;
+      }
+      ll->Add(text);
+    }
     // if (count != 0) rv[specie] /= count;
   }
   // return rv;
@@ -818,6 +874,22 @@ namespace {
     max = tmax;
   }
 }
+
+namespace { 
+  Int_t GetHalfringPad(TH1* h) {
+    TString nme(h->GetName());
+    Char_t cD   = nme[nme.Length()-2];
+    Char_t cR   = nme[nme.Length()-1];
+    Int_t  xbin = 0;
+    switch (cD) { 
+    case '1': xbin = 1; break;
+    case '2': xbin = ((cR == 'i' || cR == 'I') ? 2 : 5); break;
+    case '3': xbin = ((cR == 'i' || cR == 'I') ? 3 : 6); break;
+    }
+    return xbin;
+  }
+}
+
 //____________________________________________________________________________ 
 void 
 AliFMDQAChecker::MakeImage(TObjArray** list, 
@@ -855,7 +927,8 @@ AliFMDQAChecker::MakeImage(TObjArray** list,
       if (hist && hist->TestBit(AliQAv1::GetImageBit())) {
         nImages++; 
        TString name(hist->GetName());
-       if (name.Contains("readouterrors", TString::kIgnoreCase)) continue;
+       if (name.Contains("readouterrors", TString::kIgnoreCase) || 
+           name.Contains("status", TString::kIgnoreCase)) continue;
 
        // Double_t hMax = hist->GetMaximum(); 
        // hist->GetBinContent(hist->GetMaximumBin());
@@ -940,25 +1013,54 @@ AliFMDQAChecker::MakeImage(TObjArray** list,
     topText->SetTextColor(kBlue+3);
     topText->SetNDC();
     topText->Draw();
-                                
+
+    // Find the status histogram if any 
+    TH2*  status  = 0;
+    Int_t istatus = AliFMDQADataMakerRec::GetHalfringIndex(4, 'i', 0, 0);
+    if (istatus < list[specie]->GetEntriesFast()) 
+      status = dynamic_cast<TH2*>(list[specie]->At(istatus));
+
     // Divide canvas 
-    Int_t nx = int(nImages + .5) / 2;
-    Int_t ny = 2;
     // if (fDoScale) 
-    fImage[specie]->Divide(nx, ny, 0, 0);
+    TVirtualPad* plots = fImage[specie];
+    TVirtualPad* stat  = 0;
+    if (status) {
+      // AliWarning("Drawing plots sub-pad");
+      TPad* pM = new TPad("plots", "Plots Pad", 0, .2, 1., .9, 0, 0);
+      fImage[specie]->cd();
+      pM->Draw();
+      plots = pM;
+      // AliWarning("Drawing status sub-pad");
+      TPad* pS = new TPad("status", "Status Pad", 0, 0, 1., .2, 0, 0);
+      fImage[specie]->cd();
+      pS->Draw();
+      pS->SetLogz();
+      stat = pS;
+      // status->DrawCopy("colz");
+    }
+    // AliWarningF("fImage[specie]=%p, plots=%p", fImage[specie], plots);
+    // plots->cd();
+    Int_t nx = 3;
+    Int_t ny = (nImages + .5) / nx;
+    plots->Divide(nx, ny, 0, 0);
     // else fImage[specie]->Divide(nx, ny);
     
     
     // Loop over histograms 
     TH1*  hist  = 0;
     Int_t nHist = list[specie]->GetEntriesFast();
-    Int_t j     = 0;
     for (Int_t i = 0; i < nHist; i++) { 
       hist = static_cast<TH1*>(list[specie]->At(i));
       if (!hist || !hist->TestBit(AliQAv1::GetImageBit())) continue;
+      if (hist == status) continue;
+      TString name(hist->GetName());
+      Bool_t isROE = name.Contains("readouterrors", TString::kIgnoreCase);
 
       // Go to sub-pad 
-      TVirtualPad* pad = fImage[specie]->cd(++j);
+      TVirtualPad* pad = 0;
+      if      (isROE) pad = plots->cd(4);
+      else            pad = plots->cd(GetHalfringPad(hist));
+      
       pad->SetRightMargin(0.01);
       if (!fDoScale) { 
        pad->SetLeftMargin(0.10);
@@ -973,8 +1075,7 @@ AliFMDQAChecker::MakeImage(TObjArray** list,
 
       // Figure out special cases 
       TString opt("");
-      TString name(hist->GetName());
-      if (name.Contains("readouterrors", TString::kIgnoreCase)) {
+      if (isROE) {
        pad->SetRightMargin(0.15);
        pad->SetBottomMargin(0.10);
        // pad->SetTopMargin(0.02);
@@ -1011,7 +1112,7 @@ AliFMDQAChecker::MakeImage(TObjArray** list,
       else {
        gStyle->SetOptTitle(0);
        TPad* insert = new TPad("insert", "Zoom", 
-                               .4,.4, .99, .95, 0, 0, 0);
+                               .5,.5, .99, .95, 0, 0, 0);
        insert->SetTopMargin(0.01);
        insert->SetRightMargin(0.01);
        insert->SetFillColor(0);
@@ -1035,13 +1136,16 @@ AliFMDQAChecker::MakeImage(TObjArray** list,
       RestoreLog(hist->GetYaxis(), logOpts & 0x2);
       RestoreLog(hist->GetZaxis(), logOpts & 0x4);
     }
+    if (status && stat) {
+      stat->cd();
+      status->DrawCopy("BOX TEXT");
+    }
     // Print to a post-script file 
     fImage[specie]->Print(outName, "ps");
-#if 0
-    fImage[specie]->Print(Form("%s_%d.png", 
-                              AliRecoParam::GetEventSpecieName(specie), 
-                              AliQAChecker::Instance()->GetRunNumber()));
-#endif
+    if (AliDebugLevel() > 1) 
+      fImage[specie]->Print(Form("%s_%d.png", 
+                                AliRecoParam::GetEventSpecieName(specie), 
+                                AliQAChecker::Instance()->GetRunNumber()));
   }
 }
 
index 40c7ee3513aebee456094f2ff99e376e81ef625c..e660c2c08c168c63ea6b8e3592dc080a0735fc06 100644 (file)
@@ -255,6 +255,25 @@ void AliFMDQADataMakerRec::InitRaws()
     // AliLog::SetModuleDebugLevel("FMD", oldDbg);
   }
 
+  TH2* status = new TH2D("status", "Status per cycle", 
+                         5, .5, 5.5, 4, -.5, 3.5);
+  status->SetDirectory(0);
+  status->SetXTitle("Detector");
+  status->SetYTitle("Status");
+  status->SetZTitle("N_{cycles} [LOG]");
+  status->GetXaxis()->SetBinLabel(1, "FMD1i");
+  status->GetXaxis()->SetBinLabel(2, "FMD2i");
+  status->GetXaxis()->SetBinLabel(3, "FMD2o");
+  status->GetXaxis()->SetBinLabel(4, "FMD3i");
+  status->GetXaxis()->SetBinLabel(5, "FMD3o");
+  status->GetYaxis()->SetBinLabel(1, "OK");
+  status->GetYaxis()->SetBinLabel(2, "Problem");
+  status->GetYaxis()->SetBinLabel(3, "Bad");
+  status->GetYaxis()->SetBinLabel(4, "What the ...?");
+  status->SetStats(0);
+  Add2RawsList(status, GetHalfringIndex(4, 'i', 0, 0), 
+              !expert, image, !saveCorr);
+              
   TH1* hist;
   Int_t idx = 0;
   for(UShort_t d = 1; d<=3; d++) {
@@ -530,7 +549,7 @@ void AliFMDQADataMakerRec::StartOfDetectorCycle()
 Int_t AliFMDQADataMakerRec::GetHalfringIndex(UShort_t det, 
                                             Char_t ring, 
                                             UShort_t board, 
-                                            UShort_t monitor) const
+                                            UShort_t monitor)
 {
   // 
   // Get the half-ring index
@@ -556,6 +575,19 @@ Int_t AliFMDQADataMakerRec::GetHalfringIndex(UShort_t det,
 #endif
   return index-2;
 }
+//_____________________________________________________________________ 
+void AliFMDQADataMakerRec::GetHalfringFromIndex(Int_t     idx, 
+                                               UShort_t& det, 
+                                               Char_t&   ring, 
+                                               UShort_t& board, 
+                                               UShort_t& monitor)
+{
+  det     = ((idx >> 3) & 0x3) + 1;
+  ring    = ((idx >> 2) & 0x1) == 1 ? 'I' : 'O';
+  board   = ((idx >> 1) & 0x1);
+  monitor = ((idx >> 0) & 0x1);
+}
+
 
 //_____________________________________________________________________ 
 
index b8813f0b1e4db60f9b92725c8471d840c60bc7d0..bfba1687bcaf1bcc78fed1bd1b0ceadd29981ea9 100644 (file)
@@ -43,6 +43,23 @@ public:
    * Destrcutor 
    */
   virtual ~AliFMDQADataMakerRec();
+  /** 
+   * Get the half-ring index
+   * 
+   * @param det      Detector
+   * @param ring     Ring
+   * @param board    Board number
+   * @param monitor  Monitor 
+   * 
+   * @return Half ring index
+   */
+  static Int_t GetHalfringIndex(UShort_t det, Char_t ring, 
+                               UShort_t board, UShort_t monitor = 0);
+  static void GetHalfringFromIndex(Int_t     idx, 
+                                  UShort_t& det, 
+                                  Char_t&   ring, 
+                                  UShort_t& board, 
+                                  UShort_t& monitor);
 private:
   static TH1* MakeADCHist(UShort_t d=0, Char_t r='\0', Short_t b=-1);
   static TH1* MakeELossHist(UShort_t d=0, Char_t r='\0', Short_t b=-1);
@@ -103,18 +120,6 @@ private:
    * 
    */
   virtual void   StartOfDetectorCycle(); 
-  /** 
-   * Get the half-ring index
-   * 
-   * @param det      Detector
-   * @param ring     Ring
-   * @param board    Board number
-   * @param monitor  Monitor 
-   * 
-   * @return Half ring index
-   */
-  Int_t GetHalfringIndex(UShort_t det, Char_t ring, 
-                        UShort_t board, UShort_t monitor = 0) const;
   TClonesArray fRecPointsArray; // Rec points
   AliFMDReconstructor* fReconstructor;
   Bool_t               fUseReconstructor;