]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDQAChecker.cxx
Production file not written anymore
[u/mrichter/AliRoot.git] / FMD / AliFMDQAChecker.cxx
index e13abcf40146b6e0a2d1719365882c6ea622c388..4453d11d343b549ac20ebdee8696c2d86340148b 100644 (file)
@@ -157,6 +157,21 @@ namespace {
   }
 }
 
+namespace {
+  void FindMinMax(TH1* h, Double_t& min, Double_t& max)
+  {
+    Double_t tmin = 1e9;
+    Double_t tmax = 0;
+    for (Int_t i = 1; i <= h->GetNbinsX(); i++) { 
+      Double_t c = h->GetBinContent(i);
+      if (c < 1e-8) continue;
+      tmin = TMath::Min(tmin, c);
+      tmax = TMath::Max(tmax, c);
+    }
+    min = tmin;
+    max = tmax;
+  }
+}
 //____________________________________________________________________________ 
 void 
 AliFMDQAChecker::MakeImage(TObjArray** list, 
@@ -195,18 +210,24 @@ AliFMDQAChecker::MakeImage(TObjArray** list,
         nImages++; 
        TString name(hist->GetName());
        if (name.Contains("readouterrors", TString::kIgnoreCase)) continue;
-       Double_t hMax = hist->GetMaximum(); 
+
+       // Double_t hMax = hist->GetMaximum(); 
        // hist->GetBinContent(hist->GetMaximumBin());
-       Double_t hMin = hist->GetMinimum();
+       // Double_t hMin = hist->GetMinimum();
        // hist->GetBinContent(hist->GetMinimumBin());
+       Double_t hMax, hMin;
+       FindMinMax(hist, hMin, hMax);
        max = TMath::Max(max, hMax);
        min = TMath::Min(min, hMin);
+       AliInfoF("Min/max of %40s: %f/%f, global -> %f/%f", 
+                hist->GetName(), hMin, hMax, min, max);
       }
     }
     break ; 
   }
-  min = TMath::Max(0.1, min);
-  max = TMath::Max(1.0, max);
+  AliInfoF("Global min/max=%f/%f", min, max);
+  min = TMath::Max(1e-1, min);
+  max = TMath::Max(1e5,  max);
 
   // IF no images, go on. 
   if (nImages == 0) {
@@ -230,7 +251,7 @@ AliFMDQAChecker::MakeImage(TObjArray** list,
     if(!list[specie] || list[specie]->GetEntries() <= 0 || 
        nImages <= 0) continue;
 
-    // Form the title 
+   // Form the title 
     const Char_t * title = Form("QA_%s_%s_%s", GetName(), 
                                AliQAv1::GetTaskName(task).Data(), 
                                AliRecoParam::GetEventSpecieName(specie)); 
@@ -278,7 +299,9 @@ AliFMDQAChecker::MakeImage(TObjArray** list,
     // Divide canvas 
     Int_t nx = int(nImages + .5) / 2;
     Int_t ny = 2;
+    // if (fDoScale) 
     fImage[specie]->Divide(nx, ny, 0, 0);
+    // else fImage[specie]->Divide(nx, ny);
     
     
     // Loop over histograms 
@@ -292,6 +315,10 @@ AliFMDQAChecker::MakeImage(TObjArray** list,
       // Go to sub-pad 
       TVirtualPad* pad = fImage[specie]->cd(++j);
       pad->SetRightMargin(0.01);
+      if (!fDoScale) { 
+       pad->SetLeftMargin(0.10);
+       pad->SetBottomMargin(0.10);
+      }
 
       // Check for log scale 
       Int_t logOpts = 0;
@@ -305,15 +332,20 @@ AliFMDQAChecker::MakeImage(TObjArray** list,
       if (name.Contains("readouterrors", TString::kIgnoreCase)) {
        pad->SetRightMargin(0.15);
        pad->SetBottomMargin(0.10);
-       pad->SetTopMargin(0.02);
+       // pad->SetTopMargin(0.02);
        opt="COLZ";
       }
       else {
        pad->SetGridx();
        pad->SetGridy();
-       hist->SetMinimum(min);
-       hist->SetMaximum(max);
-
+       if (fDoScale) { 
+         hist->SetMinimum(min);
+         hist->SetMaximum(max);
+       }
+       else { 
+         hist->SetMinimum();
+         hist->SetMaximum();
+       }
       }
       // Draw (As a copy)
       hist->DrawCopy(opt);
@@ -325,7 +357,7 @@ AliFMDQAChecker::MakeImage(TObjArray** list,
        Double_t m = proj->GetMean(); 
        TLatex* l = new TLatex(kk, 30, Form("Mean: %f", m));
        l->SetTextAngle(90);
-       l->SetTextColor(m > 10 ? kRed+1 : m > 1 ? kOrange+2 :kGreen+2);
+       l->SetTextColor(m > 10 ? kRed+1 : m > .7 ? kOrange+2 :kGreen+2);
        l->Draw();
       }
       }
@@ -343,12 +375,11 @@ AliFMDQAChecker::MakeImage(TObjArray** list,
        if (logOpts & 0x1) insert->SetLogx();
        if (logOpts & 0x2) insert->SetLogy();
        if (logOpts & 0x4) insert->SetLogz();
-       hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetXmin(), 
-                                      hist->GetXaxis()->GetXmax()/8);
-       hist->DrawCopy(opt);
+       hist->GetXaxis()->SetRange(1, hist->GetNbinsX()/8);
+       TH1* copy = hist->DrawCopy(opt);
+       copy->GetXaxis()->SetNdivisions(408, false);
        // Restore full range 
-       hist->GetXaxis()->SetRangeUser(hist->GetXaxis()->GetXmin(), 
-                                      hist->GetXaxis()->GetXmax());
+       hist->GetXaxis()->SetRange(0, 0);
        gStyle->SetOptTitle(1);
       }
       pad->cd();
@@ -357,7 +388,7 @@ AliFMDQAChecker::MakeImage(TObjArray** list,
       RestoreLog(hist->GetYaxis(), logOpts & 0x2);
       RestoreLog(hist->GetZaxis(), logOpts & 0x4);
     }
-  // Print to a post-script file 
+    // Print to a post-script file 
     fImage[specie]->Print(outName, "ps");
   }
 }