#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>
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];
// 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;
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,
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());
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);
// 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);
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);
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()));
}
}
// 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++) {
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
#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);
+}
+
//_____________________________________________________________________