From 8db5c9f95ac479e75e284228eb1ee74ff57e1f63 Mon Sep 17 00:00:00 2001 From: prino Date: Fri, 10 Sep 2010 16:03:28 +0000 Subject: [PATCH] Add QA image (M. Siciliano, A. Mastroserio) --- ITS/AliITSQAChecker.cxx | 42 +++++ ITS/AliITSQAChecker.h | 2 + ITS/AliITSQASDDChecker.cxx | 314 +++++++++++++++++++++++++++----- ITS/AliITSQASDDChecker.h | 63 ++++--- ITS/AliITSQASPDChecker.cxx | 135 +++++++++++++- ITS/AliITSQASPDChecker.h | 17 +- ITS/AliITSQASPDDataMakerRec.cxx | 12 +- ITS/AliITSQASSDChecker.h | 8 + ITS/AliITSQASSDDataMakerRec.cxx | 6 +- 9 files changed, 512 insertions(+), 87 deletions(-) diff --git a/ITS/AliITSQAChecker.cxx b/ITS/AliITSQAChecker.cxx index 7e006905e22..52440568e5f 100644 --- a/ITS/AliITSQAChecker.cxx +++ b/ITS/AliITSQAChecker.cxx @@ -24,6 +24,7 @@ // --- ROOT system --- #include "TH1.h" #include +#include "TStyle.h" // --- AliRoot header files --- #include "AliITSQAChecker.h" @@ -471,3 +472,44 @@ void AliITSQAChecker::SetQA(AliQAv1::ALITASK_t index, Double_t * value) const } +//__________________________________________________________________ +void AliITSQAChecker::MakeImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode) +{ + + //gStyle->SetPalette(1); + + //Int_t nImages = 0 ; + //Int_t imageindex=0; + for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) { + if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) ) + continue ; + //else imageindex=esIndex; + + TIter next(list[esIndex]) ; + TH1 * hdata = NULL ; + while ( (hdata=static_cast(next())) ) { + TString cln(hdata->ClassName()) ; + if ( ! cln.Contains("TH") ) + continue ; + if(cln.Contains("TH2")) hdata->SetOption("colz"); + } + break ; + } + + Bool_t retvalue=kFALSE; + + if(GetSubDet()==0) MakeITSImage(list,task, mode); + else if(GetSubDet()==1) + { + retvalue=fSPDChecker->MakeSPDImage(list,task, mode) ; + if(retvalue==kFALSE)AliQACheckerBase::MakeImage(list,task, mode); + } + else if(GetSubDet()==2){ retvalue=fSDDChecker->MakeSDDImage(list,task, mode) ;if(retvalue==kFALSE)AliQACheckerBase::MakeImage(list,task,mode); } + else if(GetSubDet()==3) + { + retvalue=fSSDChecker->MakeSSDImage(list,task, mode) ; + if(retvalue==kFALSE)AliQACheckerBase::MakeImage(list,task, mode); + } + +} + diff --git a/ITS/AliITSQAChecker.h b/ITS/AliITSQAChecker.h index f117b77e41e..002843c023b 100644 --- a/ITS/AliITSQAChecker.h +++ b/ITS/AliITSQAChecker.h @@ -52,6 +52,8 @@ public: virtual Int_t GetSDDHisto(){return fSDDHisto;} ; virtual Int_t GetSSDHisto(){return fSSDHisto;} ; + virtual void MakeImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode) ; + virtual void MakeITSImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode) { AliQACheckerBase::MakeImage(list,task, mode);} protected: virtual void Check(Double_t * test, AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * recoParam) ; diff --git a/ITS/AliITSQASDDChecker.cxx b/ITS/AliITSQASDDChecker.cxx index c7470718039..c3eae5804a3 100644 --- a/ITS/AliITSQASDDChecker.cxx +++ b/ITS/AliITSQASDDChecker.cxx @@ -25,6 +25,10 @@ #include "TH1.h" #include #include +#include "TCanvas.h" +#include "TPaveText.h" +#include "TPad.h" +//#include "TPaletteAxis.h" // --- AliRoot header files --- #include "AliITSQADataMakerRec.h" #include "AliITSQASDDChecker.h" @@ -33,6 +37,10 @@ #include "AliCDBManager.h" #include "AliITSCalibrationSDD.h" #include "AliITSgeomTGeo.h" +#include "AliQAManager.h" +#include "AliQAv1.h" +#include "AliQAChecker.h" +#include "AliQACheckerBase.h" ClassImp(AliITSQASDDChecker) @@ -69,6 +77,11 @@ AliITSQASDDChecker::~AliITSQASDDChecker() delete fCalibration; fCalibration=NULL; } + if(fImage) + { + delete []fImage; + fImage=NULL; + } } // dtor //__________________________________________________________________ @@ -256,63 +269,98 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l case AliQAv1::kREC: { - + Int_t uidrec=list->GetUniqueID(); AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index))); - - if (list->GetEntries() == 0){ //check if the list is empty - //printf("SDDQACheckerValue = %f \t value %f\n",SDDQACheckerValue,fHighSDDValue[AliQAv1::kFATAL]); - SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL]; - break; - }//end if getentries + if(uidrec==20){ + //recpoints + if (list->GetEntries() == 0){ //check if the list is empty + //printf("SDDQACheckerValue = %f \t value %f\n",SDDQACheckerValue,fHighSDDValue[AliQAv1::kFATAL]); + SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL]; + break; + }//end if getentries - while((hdata=dynamic_cast(next()))){ - if (hdata){ - TString hname=hdata->GetName(); - if(hname.Contains("_RelativeOccupancy")) { - Float_t threshold = hdata->GetMean() + 4*hdata->GetRMS(); - if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: L3 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS())); - if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: L4 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS())); - Int_t aboveThreshold = 0; - for(Int_t k=0; k<= ((Int_t)hdata->GetNbinsX()); k++) { - if(hdata->GetBinLowEdge(k) > threshold) aboveThreshold += (Int_t)(hdata->GetBinContent(k)); - } - Float_t fractionAboveThreshold = ((Float_t) aboveThreshold)/hdata->GetEntries(); - if(hname.Contains("L3")) AliInfo(Form("SDD check number 3, L3: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold)); - if(hname.Contains("L4")) AliInfo(Form("SDD check number 4, L4: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold)); - if(fractionAboveThreshold > fThresholdForRelativeOccupancy) { - SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING]; - if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: Set Warning (L3 RecPoints)")); - if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: Set Warning (L4 RecPoints)")); + while((hdata=dynamic_cast(next()))){ + if (hdata){ + TString hname=hdata->GetName(); + if(hname.Contains("_RelativeOccupancy")) { + Float_t threshold = hdata->GetMean() + 4*hdata->GetRMS(); + if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: L3 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS())); + if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: L4 mean: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS())); + Int_t aboveThreshold = 0; + for(Int_t k=0; k<= ((Int_t)hdata->GetNbinsX()); k++) { + if(hdata->GetBinLowEdge(k) > threshold) aboveThreshold += (Int_t)(hdata->GetBinContent(k)); + } + Float_t fractionAboveThreshold = ((Float_t) aboveThreshold)/hdata->GetEntries(); + if(hname.Contains("L3")) AliInfo(Form("SDD check number 3, L3: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold)); + if(hname.Contains("L4")) AliInfo(Form("SDD check number 4, L4: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold)); + if(fractionAboveThreshold > fThresholdForRelativeOccupancy) { + SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING]; + if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: Set Warning (L3 RecPoints)")); + if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: Set Warning (L4 RecPoints)")); + } } - } - if(hname.Contains("Rec2Raw") && !hname.Contains("2D")) { - //Float_t threshold = 0.; - if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: L3 R2R mean: %f, rms: ,%f",((TH1F *) hdata)->GetMean(),((TH1F *) hdata)->GetRMS())); - if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: L4 R2R mean: %f, rms: ,%f",((TH1F *) hdata)->GetMean(),((TH1F *) hdata)->GetRMS())); - Int_t belowThreshold = 0; - for(Int_t k=0; k<=((TH1F *)hdata)->GetNbinsX(); k++) { - if(((TH1F *) hdata)->GetBinLowEdge(k) < fThresholdForRecToRawRatio) belowThreshold += ((Int_t)((TH1F *) hdata)->GetBinContent(k)); + if(hname.Contains("Rec2Raw") && !hname.Contains("2D")) { + //Float_t threshold = 0.; + if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: L3 R2R mean: %f, rms: ,%f",((TH1F *) hdata)->GetMean(),((TH1F *) hdata)->GetRMS())); + if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: L4 R2R mean: %f, rms: ,%f",((TH1F *) hdata)->GetMean(),((TH1F *) hdata)->GetRMS())); + Int_t belowThreshold = 0; + for(Int_t k=0; k<=((TH1F *)hdata)->GetNbinsX(); k++) { + if(((TH1F *) hdata)->GetBinLowEdge(k) < fThresholdForRecToRawRatio) belowThreshold += ((Int_t)((TH1F *) hdata)->GetBinContent(k)); + } + Double_t fractionBelowThreshold =0.; + Double_t entries3=((TH1F *)hdata)->GetEntries(); + if(entries3>0.001)fractionBelowThreshold = ((Double_t)(belowThreshold))/entries3; + else{ AliWarning(Form("No entries on %s. The check will retuns zero.\n",hdata->GetName() )); } + if(hname.Contains("L3")) AliInfo(Form("SDD check number 5, L3: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold)); + if(hname.Contains("L4")) AliInfo(Form("SDD check number 6, L4: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold)); + if(fractionBelowThreshold > fThresholdForRelativeOccupancy) { + SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING]; + if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: Set Warning (L3 RecPoints2Raws)")); + if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: Set Warning (L4 RecPoints2Raws)")); + } } - Double_t fractionBelowThreshold =0.; - Double_t entries3=((TH1F *)hdata)->GetEntries(); - if(entries3>0.001)fractionBelowThreshold = ((Double_t)(belowThreshold))/entries3; - else{ AliWarning(Form("No entries on %s. The check will retuns zero.\n",hdata->GetName() )); } - if(hname.Contains("L3")) AliInfo(Form("SDD check number 5, L3: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold)); - if(hname.Contains("L4")) AliInfo(Form("SDD check number 6, L4: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold)); - if(fractionBelowThreshold > fThresholdForRelativeOccupancy) { - SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING]; - if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: Set Warning (L3 RecPoints2Raws)")); - if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: Set Warning (L4 RecPoints2Raws)")); + if(hname.Contains("dedx")) { + if(hname.Contains("L3")) AliInfo(Form("SDD check number 7: L3 average charge: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS())); + if(hname.Contains("L4")) AliInfo(Form("SDD check number 8: L4 average charge: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS())); } } - if(hname.Contains("dedx")) { - if(hname.Contains("L3")) AliInfo(Form("SDD check number 7: L3 average charge: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS())); - if(hname.Contains("L4")) AliInfo(Form("SDD check number 8: L4 average charge: %f, rms: ,%f",hdata->GetMean(),hdata->GetRMS())); - } - } - } + } - SDDQACheckerValue=1.; + SDDQACheckerValue=1.; + } + else if(uidrec==40) + { + //digitsr + if (list->GetEntries() == 0){ + SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL]; + break; + } else{ + + while( (hdata = dynamic_cast(next())) ){ + if (hdata){ + if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL]; + else { + TString hname=hdata->GetName(); + if(hname.Contains("SDD DIGITS Module Pattern")) { + //see raws + + SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO]; + } else if(hname.Contains("SDD Anode Distribution")) { + SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO]; + } else if(hname.Contains("SDD Tbin Distribution")) { + //to do as rp + SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO]; + } else if(hname.Contains("SDD ADC Counts Distribution")) { + SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO]; + }//end adc counts + + }//end entries !=0 + }//end hdata + }//end while + }//end else + SDDQACheckerValue=1.; + } + } break; case AliQAv1::kANA: @@ -468,4 +516,170 @@ void AliITSQASDDChecker::SetSDDLimits(const Float_t *lowvalue, const Float_t * } } +//__________________________________________________________________ +Bool_t AliITSQASDDChecker::MakeSDDImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode) +{ + Bool_t rval=kFALSE; + fImage=(TCanvas**)AliQAChecker::Instance()->GetDetQAChecker(0)->GetImage(); + //create the image for raws and recpoints. In the other case, the default methodof CheckerBase class will be used + switch(task) + { + case AliQAv1::kRAWS:{ + rval=MakeSDDRawsImage(list, task,mode); + } + break; + case AliQAv1::kRECPOINTS:{ rval=MakeSDDRecPointsImage(list, task,mode); } + break; + case AliQAv1::kHITS:; case AliQAv1::kESDS:; case AliQAv1::kDIGITS:;case AliQAv1::kDIGITSR:;case AliQAv1::kSDIGITS:;case AliQAv1::kTRACKSEGMENTS:;case AliQAv1::kRECPARTICLES:; default: + { + rval=kFALSE; + //AliQAChecker::Instance()->GetDetQAChecker(0)->MakeImage(list,task,mode); + } + break; + case AliQAv1::kNULLTASKINDEX:; case AliQAv1::kNTASKINDEX: + {AliWarning(Form("No histograms for this task ( %s ) \n", AliQAv1::GetTaskName(task).Data())); rval=kFALSE;} + break; + } +return rval; +} + + +//_______________________________________________________________________ +Bool_t AliITSQASDDChecker::MakeSDDRawsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode ) +{ + + for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) { + //printf("-------------------------> %i \n", esIndex); + if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0) + {//printf ("Nothing for %s \n", AliRecoParam::GetEventSpecieName(esIndex)); + continue; + } + else{ + const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)) ; + if ( !fImage[esIndex] ) { + fImage[esIndex] = new TCanvas(title, title,1280,980) ; + } + + fImage[esIndex]->Clear() ; + fImage[esIndex]->SetTitle(title) ; + fImage[esIndex]->cd(); + + TPaveText someText(0.015, 0.015, 0.98, 0.98); + someText.AddText(title); + someText.Draw(); + fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; + fImage[esIndex]->Clear() ; + Int_t nx =2; //TMath::Nint(TMath::Sqrt(nImages)); + Int_t ny =1; // nx ; + //if (nx < TMath::Sqrt(nImages)) + //ny++ ; + fImage[esIndex]->Divide(nx, ny) ; + TIter nexthist(list[esIndex]) ; + TH1* hist = NULL ; + Int_t npad = 1 ; + fImage[esIndex]->cd(npad); + fImage[esIndex]->cd(npad)->SetBorderMode(0) ; + while ( (hist=static_cast(nexthist())) ) { + //gPad=fImage[esIndex]->cd(npad)->GetPad(npad); + TString cln(hist->ClassName()) ; + if ( ! cln.Contains("TH") ) + continue ; + + if(hist->TestBit(AliQAv1::GetImageBit())) { + hist->GetXaxis()->SetTitleSize(0.02); + hist->GetYaxis()->SetTitleSize(0.02); + hist->GetXaxis()->SetLabelSize(0.02); + hist->GetYaxis()->SetLabelSize(0.02); + if(cln.Contains("TH2")) + { + gPad->SetRightMargin(0.15); + gPad->SetLeftMargin(0.05); + hist->SetStats(0); + hist->SetOption("colz") ; + //hist->GetListOfFunctions()->FindObject("palette")->SetLabelSize(0.025); + //gPad->Update(); + } + hist->DrawCopy() ; + fImage[esIndex]->cd(++npad) ; + fImage[esIndex]->cd(npad)->SetBorderMode(0) ; + } + } + fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; + } + } + return kTRUE; +} + + + + +//_______________________________________________________________________ +Bool_t AliITSQASDDChecker::MakeSDDRecPointsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode ) +{ + for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) { + if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0) + { + //printf ("Nothing for %s \n", AliQAv1::GetTaskName(task).Data()); + continue; + } + const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)) ; + if ( !fImage[esIndex] ) { + fImage[esIndex] = new TCanvas(title, title,1280,980) ; + } + fImage[esIndex]->Clear() ; + fImage[esIndex]->SetTitle(title) ; + fImage[esIndex]->cd(); + fImage[esIndex]->SetBorderMode(0) ; + TPaveText someText(0.015, 0.015, 0.98, 0.98); + someText.AddText(title); + someText.Draw(); + fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; + fImage[esIndex]->Clear() ; + Int_t nx =2; //TMath::Nint(TMath::Sqrt(nImages)); + Int_t ny =4; // nx ; + //if (nx < TMath::Sqrt(nImages)) + //ny++ ; + fImage[esIndex]->Divide(nx, ny) ; + TIter nexthist(list[esIndex]) ; + TH1* hist = NULL ; + Int_t npad = 1 ; + fImage[esIndex]->cd(npad) ; + fImage[esIndex]->cd(npad)->SetBorderMode(0) ; + while ( (hist=static_cast(nexthist())) ) { + //gPad=fImage[esIndex]->cd(npad)->GetPad(npad); + TString cln(hist->ClassName()) ; + //printf("=====================> Class name %s \n",cln.Data()); + if ( ! cln.Contains("TH") ) + continue ; + if(hist->TestBit(AliQAv1::GetImageBit())) { + hist->GetXaxis()->SetTitleSize(0.02); + hist->GetYaxis()->SetTitleSize(0.02); + hist->GetXaxis()->SetLabelSize(0.02); + hist->GetYaxis()->SetLabelSize(0.02); + if(cln.Contains("TH1")) + { + hist->SetFillColor(kOrange+7); + //SetFrameFillColor(kAzure-9); + //hist->DrawCopy() ; + } + if(cln.Contains("TH2")) + { + gPad->SetRightMargin(0.15); + gPad->SetLeftMargin(0.05); + hist->SetStats(0); + hist->SetOption("colz") ; + // TPaletteAxis *paletta =(TPaletteAxis*)hist->GetListOfFunctions()->FindObject("palette"); + //paletta->SetLabelSize(0.025); + //gPad->Update(); + } + hist->DrawCopy(); + fImage[esIndex]->cd(++npad) ; + fImage[esIndex]->cd(npad)->SetBorderMode(0) ; + } + } + fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; + } + // } + return kTRUE; +} diff --git a/ITS/AliITSQASDDChecker.h b/ITS/AliITSQASDDChecker.h index e48fb6d95c6..66b91a7e296 100644 --- a/ITS/AliITSQASDDChecker.h +++ b/ITS/AliITSQASDDChecker.h @@ -14,6 +14,7 @@ // #include "AliQAv1.h" +#include "TPad.h" // --- ROOT system --- class TFile; class TH2F; @@ -21,6 +22,7 @@ class TH2F; // --- AliRoot header files --- class AliQACheckerBase; +class AliQAChecker; class AliITSQAChecker; class AliITSCalibrationSDD; class AliITSLoader; @@ -29,18 +31,20 @@ class AliQAManager; class AliLog; class TF1; class TCanvas; +class AliQAv1; -class AliITSQASDDChecker: public TObject { +class AliITSQASDDChecker: public TObject{ public: AliITSQASDDChecker(): - fSubDetOffset(0), + fSubDetOffset(0), fStepBitSDD(NULL), fLowSDDValue(NULL), fHighSDDValue(NULL), fCalibration(NULL), fThresholdForRelativeOccupancy(0.01), - fThresholdForRecToRawRatio(0.04) + fThresholdForRecToRawRatio(0.04), + fImage(NULL) {;} // ctor AliITSQASDDChecker& operator = (const AliITSQASDDChecker& qac) ; //operator = virtual ~AliITSQASDDChecker(); // dtor @@ -49,31 +53,42 @@ public: virtual void SetStepBit(const Double_t *steprange); virtual Double_t *GetStepBit(){return fStepBitSDD;}; virtual void SetSDDLimits(const Float_t *lowvalue, const Float_t * highvalue); -private: - AliITSQASDDChecker(const AliITSQASDDChecker& qac):TObject(), - fSubDetOffset(qac.fSubDetOffset), - fStepBitSDD(qac.fStepBitSDD), - fLowSDDValue(qac.fLowSDDValue), - fHighSDDValue(qac.fHighSDDValue), - fCalibration(qac.fCalibration), - fThresholdForRelativeOccupancy(qac.fThresholdForRelativeOccupancy), - fThresholdForRecToRawRatio(qac.fThresholdForRecToRawRatio) - {;} // cpy ctor - Int_t fSubDetOffset; // checking operation starting point - Double_t *fStepBitSDD; //step size for each QAbit(kINFO, kWARNING,kERROR,kFATAL) - Float_t *fLowSDDValue; //low value of each QA bit range - Float_t *fHighSDDValue; //High value of each QA bit range - TObjArray *fCalibration; //TObjArray with Calibration SDD Objects - + virtual Bool_t MakeSDDImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode) ; + Bool_t MakeSDDRawsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode );//{AliInfo("The method for raw image has been called\n");} + Bool_t MakeSDDRecPointsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode);//{AliInfo("The method for recpoint image has been called\n");} + + + private: + + AliITSQASDDChecker(const AliITSQASDDChecker& qac):TObject(), + fSubDetOffset(qac.fSubDetOffset), + fStepBitSDD(qac.fStepBitSDD), + fLowSDDValue(qac.fLowSDDValue), + fHighSDDValue(qac.fHighSDDValue), + fCalibration(qac.fCalibration), + fThresholdForRelativeOccupancy(qac.fThresholdForRelativeOccupancy), + fThresholdForRecToRawRatio(qac.fThresholdForRecToRawRatio), + fImage(qac.fImage) + {;} // cpy ctor - Float_t fThresholdForRelativeOccupancy; // ThresholdForRelativeOccupancy (by module) - Float_t fThresholdForRecToRawRatio; // ThresholdForRecToRawRatio (by module) + Int_t fSubDetOffset; // checking operation starting point + Double_t *fStepBitSDD; //step size for each QAbit(kINFO, kWARNING,kERROR,kFATAL) + Float_t *fLowSDDValue; //low value of each QA bit range + Float_t *fHighSDDValue; //High value of each QA bit range + TObjArray *fCalibration; //TObjArray with Calibration SDD Objects + + + Float_t fThresholdForRelativeOccupancy; // ThresholdForRelativeOccupancy (by module) + Float_t fThresholdForRecToRawRatio; // ThresholdForRecToRawRatio (by module) + + TCanvas ** fImage ; //[AliRecoParam::kNSpecies] - static const Int_t fgknSDDmodules = 260; // number of SDD modules - static const Int_t fgkmodoffset = 240; // number of SPD modules - ClassDef(AliITSQASDDChecker,4) // description + static const Int_t fgknSDDmodules = 260; // number of SDD modules + static const Int_t fgkmodoffset = 240; // number of SPD modules + ClassDef(AliITSQASDDChecker,5) // description + }; #endif // AliITSQASDDChecker_H diff --git a/ITS/AliITSQASPDChecker.cxx b/ITS/AliITSQASPDChecker.cxx index 9c65a2d5678..72b0e1477c6 100644 --- a/ITS/AliITSQASPDChecker.cxx +++ b/ITS/AliITSQASPDChecker.cxx @@ -25,6 +25,7 @@ #include "TH1.h" #include "TString.h" #include "TList.h" +#include "TCanvas.h" // --- AliRoot header files --- #include "AliITSQASPDChecker.h" @@ -38,10 +39,11 @@ AliITSQASPDChecker::AliITSQASPDChecker() : fSubDetOffset(0), fStepBitSPD(NULL), fLowSPDValue(NULL), - fHighSPDValue(NULL) + fHighSPDValue(NULL), + fImage(NULL) { for(Int_t i=0; i<6 ; i++) { - fDisplayStatus[i] = new TPaveText(0.2,0.1,0.8,0.3,"NDC"); + fDisplayStatus[i] = new TPaveText(0.2,0.23,0.7,0.5,"NDC"); fDisplayStatus[i]->SetFillColor(kGreen); fDisplayStatus[i]->AddText("OK"); } @@ -59,6 +61,7 @@ AliITSQASPDChecker::~AliITSQASPDChecker() { if(fStepBitSPD) delete[] fStepBitSPD ; if(fLowSPDValue)delete[]fLowSPDValue; if(fHighSPDValue) delete[]fHighSPDValue; +if(fImage) delete[]fImage; for(Int_t i=0; i<6; i++){ delete fDisplayStatus[i]; } @@ -295,4 +298,132 @@ void AliITSQASPDChecker::SetSPDLimits(const Float_t *lowvalue, const Float_t * } } +//__________________________________________________________________ +Bool_t AliITSQASPDChecker::MakeSPDImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode) +{ + Bool_t val=kFALSE; + fImage=(TCanvas**)AliQAChecker::Instance()->GetDetQAChecker(0)->GetImage(); + //create the image for raws and recpoints. In the other case, the default methodof CheckerBase class will be used + switch(task) + { + case AliQAv1::kRAWS:{ + val = MakeSPDRawsImage(list, task,mode); + } + break; + case AliQAv1::kRECPOINTS:; + case AliQAv1::kHITS:; + case AliQAv1::kESDS:; + case AliQAv1::kDIGITS:; + case AliQAv1::kDIGITSR:; + case AliQAv1::kSDIGITS:; + case AliQAv1::kTRACKSEGMENTS:; + case AliQAv1::kRECPARTICLES:; + default: + { + //AliQAChecker::Instance()->GetDetQAChecker(0)->MakeImage(list,task,mode); + val = kFALSE; + } + break; + case AliQAv1::kNULLTASKINDEX:; case AliQAv1::kNTASKINDEX: + {AliWarning(Form("No histograms for these tasks ( %s ) \n", AliQAv1::GetTaskName(task).Data())); val = kFALSE;} + break; + } + return val; +} +//_______________________________________________________________________ +Bool_t AliITSQASPDChecker::MakeSPDRawsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode ) +{ + // + // create layout of the histograms used in the DQM + // + + + for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) { + //printf("-------------------------> %i \n", esIndex); + if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0) + {printf ("Nothing for %s \n", AliRecoParam::GetEventSpecieName(esIndex)); continue;} + else{ + const Char_t * title = Form("QA_%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(esIndex)) ; + if ( !fImage[esIndex] ) { + fImage[esIndex] = new TCanvas(title, title,1280,980) ; + } + + fImage[esIndex]->Clear() ; + fImage[esIndex]->SetTitle(title) ; + fImage[esIndex]->cd(); + + TPaveText someText(0.015, 0.015, 0.98, 0.98); + someText.AddText(title); + someText.Draw(); + fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; + fImage[esIndex]->Clear() ; + Int_t nx =3; + Int_t ny =2; + + fImage[esIndex]->Divide(nx, ny) ; + + TH1* hist = NULL ; + Int_t npad = 1 ; + fImage[esIndex]->cd(npad); + fImage[esIndex]->cd(npad)->SetBorderMode(0) ; + + TIter next(list[esIndex]); + + while ( (hist=static_cast(next())) ) { + //gPad=fImage[esIndex]->cd(npad)->GetPad(npad); + if(!hist->TestBit(AliQAv1::GetImageBit())) continue; + TString name(hist->GetName()); + if(name.Contains("SPDErrorsAll")) { + fImage[esIndex]->cd(1) ; + gPad->SetBorderMode(0) ; + gPad->SetRightMargin(0.25); + hist->SetStats(0); + hist->SetOption("colz") ; + hist->DrawCopy(); + } + if(name.Contains("MEB")) { + fImage[esIndex]->cd(2) ; + gPad->SetBorderMode(0) ; + gPad->SetBottomMargin(0.25); + hist->SetOption("colz") ; + hist->DrawCopy(); + } + if(name.Contains("SPDFastOrCorrelation")){ + fImage[esIndex]->cd(3) ; + gPad->SetBorderMode(0) ; + hist->SetOption("") ; + hist->DrawCopy(); + } + + if(name.Contains("SPDHitMapStaveChipInner")){ + fImage[esIndex]->cd(4) ; + gPad->SetBorderMode(0) ; + gPad->SetRightMargin(0.25); + hist->SetOption("colz") ; + hist->DrawCopy(); + } + if(name.Contains("SPDHitMapStaveChipOuter")){ + fImage[esIndex]->cd(5) ; + gPad->SetBorderMode(0) ; + gPad->SetRightMargin(0.25); + hist->SetOption("colz") ; + hist->DrawCopy(); + } + if(name.Contains("SPDFastOrMapStaveChip")){ + fImage[esIndex]->cd(6) ; + gPad->SetBorderMode(0) ; + gPad->SetRightMargin(0.25); + gPad->SetBottomMargin(0.25); + hist->SetOption("colz") ; + hist->DrawCopy(); + } + + + } + + fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), AliQAv1::GetModeName(mode), AliQAChecker::Instance()->GetRunNumber(), AliQAv1::GetImageFileFormat()), "ps") ; + } + } + return kTRUE; +} diff --git a/ITS/AliITSQASPDChecker.h b/ITS/AliITSQASPDChecker.h index 5211f45c991..e8a39a215f8 100644 --- a/ITS/AliITSQASPDChecker.h +++ b/ITS/AliITSQASPDChecker.h @@ -15,9 +15,15 @@ #include "AliQAv1.h" #include "TPaveText.h" +#include "AliQAChecker.h" +#include"AliQACheckerBase.h" +#include"AliQAManager.h" + +class TCanvas; class AliITSQASPDChecker: public TObject { + public: AliITSQASPDChecker(); AliITSQASPDChecker& operator = (const AliITSQASPDChecker& qac) ; //operator = @@ -29,17 +35,22 @@ public: void SetStepBit(const Double_t *steprange); Double_t *GetStepBit() const {return fStepBitSPD;}; void SetSPDLimits(const Float_t *lowvalue, const Float_t * highvalue); + + Bool_t MakeSPDImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode) ; + + Bool_t MakeSPDRawsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode ); private: - AliITSQASPDChecker(const AliITSQASPDChecker& qac):TObject(),fSubDetOffset(qac.fSubDetOffset),fStepBitSPD(qac.fStepBitSPD),fLowSPDValue(qac.fLowSPDValue),fHighSPDValue(qac.fHighSPDValue){;} // cpy ctor + AliITSQASPDChecker(const AliITSQASPDChecker& qac):TObject(),fSubDetOffset(qac.fSubDetOffset),fStepBitSPD(qac.fStepBitSPD),fLowSPDValue(qac.fLowSPDValue),fHighSPDValue(qac.fHighSPDValue),fImage(qac.fImage){;} // cpy ctor Int_t fSubDetOffset; // checking operation starting point Double_t *fStepBitSPD; // parameter interface for ITS final QA Float_t *fLowSPDValue; // lower limits for QA bit settings Float_t *fHighSPDValue; // lower limits for QA bit settings - + TCanvas ** fImage; //[AliRecoParam::kNSpecies] + TPaveText * fDisplayStatus[6]; //Online Comments for the DQM-shifter histos - ClassDef(AliITSQASPDChecker,3) // description + ClassDef(AliITSQASPDChecker,4) // description }; diff --git a/ITS/AliITSQASPDDataMakerRec.cxx b/ITS/AliITSQASPDDataMakerRec.cxx index 6eba299c2b3..acb71e2a750 100644 --- a/ITS/AliITSQASPDDataMakerRec.cxx +++ b/ITS/AliITSQASPDDataMakerRec.cxx @@ -213,7 +213,7 @@ Int_t AliITSQASPDDataMakerRec::InitRaws() // 5 TH2I *hSPDChipsMEB = new TH2I("SPDChipsMEB_OnlineSPD","Chips with MEB problem - SPD",60,-0.5,59.5,20,-0.2,19.5); - hSPDChipsMEB->GetXaxis()->SetTitle("Stave"); + // hSPDChipsMEB->GetXaxis()->SetTitle("Stave"); hSPDChipsMEB->GetXaxis()->SetNdivisions(60,kFALSE); hSPDChipsMEB->GetYaxis()->SetTitle("SIDE C -> SIDE A Chip"); hSPDChipsMEB->GetYaxis()->SetNdivisions(20,kFALSE); @@ -354,7 +354,7 @@ Int_t AliITSQASPDDataMakerRec::InitRaws() // 28 TH2F *hFastOrMapStaveChip = new TH2F("SPDFastOrMapStaveChip_SPD","FastOr map per Stave per Chip - SPD",60,-0.5,59.5,20,-0.5,19.5); - hFastOrMapStaveChip->GetXaxis()->SetTitle("Stave"); +// hFastOrMapStaveChip->GetXaxis()->SetTitle("Stave"); hFastOrMapStaveChip->GetYaxis()->SetTitle("SIDE C -> SIDE A Chip"); for(Int_t ibinx =0; ibinx< hFastOrMapStaveChip->GetNbinsX(); ibinx++){ if(ibinx%6==0) hFastOrMapStaveChip->GetXaxis()->SetBinLabel(ibinx+1,Form("Sector %i__%i",ibinx/6,ibinx%6)); @@ -378,7 +378,7 @@ Int_t AliITSQASPDDataMakerRec::InitRaws() TH2F *hHitMapHalfStaveChipInner = new TH2F("SPDHitMapStaveChipInner_SPD","Hit map per Stave per Chip Inner Layer- SPD",20,0.,20.,20,0.,20.); hHitMapHalfStaveChipInner->GetXaxis()->SetTitle("SIDE C SIDE A Chip"); - hHitMapHalfStaveChipInner->GetYaxis()->SetTitle("Stave in Sector S"); + //hHitMapHalfStaveChipInner->GetYaxis()->SetTitle("Stave in Sector S"); for(Int_t ibinx =0; ibinx< hHitMapHalfStaveChipInner->GetNbinsX(); ibinx++){ if(ibinx < 10) hHitMapHalfStaveChipInner->GetXaxis()->SetBinLabel(ibinx+1,Form("%i",ibinx)); else hHitMapHalfStaveChipInner->GetXaxis()->SetBinLabel(ibinx+1,Form("%i",20-(ibinx+1))); @@ -396,7 +396,7 @@ Int_t AliITSQASPDDataMakerRec::InitRaws() TH2F *hHitMapHalfStaveChipOuter = new TH2F("SPDHitMapStaveChipOuter_SPD","Hit map per Stave per Chip Outer Layer - SPD",20,0.,20.,40,0.,40.); hHitMapHalfStaveChipOuter->GetXaxis()->SetTitle("SIDE C SIDE A Chip"); - hHitMapHalfStaveChipOuter->GetYaxis()->SetTitle("Stave in Sector S"); + //hHitMapHalfStaveChipOuter->GetYaxis()->SetTitle("Stave in Sector S"); for(Int_t ibinx =0; ibinx< hHitMapHalfStaveChipOuter->GetNbinsX(); ibinx++){ if(ibinx < 10) hHitMapHalfStaveChipOuter->GetXaxis()->SetBinLabel(ibinx+1,Form("%i",ibinx)); else hHitMapHalfStaveChipOuter->GetXaxis()->SetBinLabel(ibinx+1,Form("%i",20-(ibinx+1))); @@ -424,7 +424,7 @@ Int_t AliITSQASPDDataMakerRec::InitRaws() fSPDhRawsTask++; // 34 TH1F *hHitMapStaveInnerPhi = new TH1F("SPDHitMapChipInnerPhi_SPD","Hit map per Stave in Phi Inner - SPD",20,0.,20.); - hHitMapStaveInnerPhi->GetXaxis()->SetTitle("Stave"); + //hHitMapStaveInnerPhi->GetXaxis()->SetTitle("Stave"); hHitMapStaveInnerPhi->GetYaxis()->SetTitle("Entries"); for(Int_t ibinx =0; ibinx< hHitMapStaveInnerPhi->GetNbinsX(); ibinx++){ if(ibinx%2==0) hHitMapStaveInnerPhi->GetXaxis()->SetBinLabel(ibinx+1,Form("%i___Sector %i",ibinx%2,ibinx/2)); @@ -434,7 +434,7 @@ Int_t AliITSQASPDDataMakerRec::InitRaws() fSPDhRawsTask++; // 35 TH1F *hHitMapStaveOuterPhi = new TH1F("SPDHitMapChipOuterPhi_SPD","Hit map per Stave in Phi Outer - SPD",40,0.,40.); - hHitMapStaveOuterPhi->GetXaxis()->SetTitle("Stave"); + //hHitMapStaveOuterPhi->GetXaxis()->SetTitle("Stave"); hHitMapStaveOuterPhi->GetYaxis()->SetTitle("Entries"); for(Int_t ibinx =0; ibinx< hHitMapStaveOuterPhi->GetNbinsX(); ibinx++){ if(ibinx%4==0) hHitMapStaveOuterPhi->GetXaxis()->SetBinLabel(ibinx+1,Form("%i___Sector %i ",ibinx%4+2,ibinx/4)); diff --git a/ITS/AliITSQASSDChecker.h b/ITS/AliITSQASSDChecker.h index 08aacda2938..4310d85e9eb 100644 --- a/ITS/AliITSQASSDChecker.h +++ b/ITS/AliITSQASSDChecker.h @@ -20,6 +20,10 @@ class TH2F ; // --- AliRoot header files --- #include "AliQAv1.h" +#include "AliQAChecker.h" +#include "AliQACheckerBase.h" + + class AliITSLoader ; class AliITSQASSDChecker: public TObject { @@ -38,6 +42,10 @@ public: void SetTaskOffset(Int_t TaskOffset); void SetSSDLimits(const Float_t *lowvalue, const Float_t * highvalue); + virtual Bool_t MakeSSDImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode) + { AliInfo(Form("Use default MakeImage method for the %s for task %s mode %s \n",list[0]->ClassName(), AliQAv1::GetTaskName(task).Data(), AliQAv1::GetModeName(mode))); return kFALSE;} + + private: diff --git a/ITS/AliITSQASSDDataMakerRec.cxx b/ITS/AliITSQASSDDataMakerRec.cxx index 3b8c3f30531..83d466b52b3 100644 --- a/ITS/AliITSQASSDDataMakerRec.cxx +++ b/ITS/AliITSQASSDDataMakerRec.cxx @@ -188,8 +188,10 @@ AliITSQASSDDataMakerRec::~AliITSQASSDDataMakerRec() { void AliITSQASSDDataMakerRec::StartOfDetectorCycle() { - if ( fAliITSQADataMakerRec->GetRawsData(0) == NULL ) // Raws not defined - return ; + if(fAliITSQADataMakerRec->ListExists(AliQAv1::kRAWS)==kFALSE)return; + + //if ( fAliITSQADataMakerRec->GetRawsData(0) == NULL ) // Raws not defined + //return ; //for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { //if (!AliQAv1::Instance()->IsEventSpecieSet(specie)) continue; -- 2.43.0