X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STEER%2FAliQADataMaker.cxx;h=7c77dfc1eca0089d229b630a3828b50c9ea3838a;hb=583e63b8cc5bcb315a36593ccc48f486c2907bbf;hp=1250f2c9ff52c5df04f4aba1f372defaa027e90f;hpb=eca4fa66e575b53a72c027046dc9ea60487c3240;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliQADataMaker.cxx b/STEER/AliQADataMaker.cxx index 1250f2c9ff5..7c77dfc1eca 100644 --- a/STEER/AliQADataMaker.cxx +++ b/STEER/AliQADataMaker.cxx @@ -25,8 +25,6 @@ // --- ROOT system --- #include -#include -#include #include #include #include @@ -70,14 +68,12 @@ AliQADataMaker::AliQADataMaker(const Char_t * name, const Char_t * title) : fParameterList(new TList*[AliRecoParam::kNSpecies]), fRun(0), fEventSpecie(AliRecoParam::kDefault), - fImage(new TCanvas*[AliRecoParam::kNSpecies]), - fPrintImage(kTRUE) + fDigitsArray(NULL) { // ctor fDetectorDirName = GetName() ; for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { fParameterList[specie] = NULL ; - fImage[specie] = NULL ; } } @@ -93,16 +89,14 @@ AliQADataMaker::AliQADataMaker(const AliQADataMaker& qadm) : fWriteExpert(qadm.fWriteExpert), fParameterList(qadm.fParameterList), fRun(qadm.fRun), - fEventSpecie(qadm.fEventSpecie), - fImage(qadm.fImage), - fPrintImage(kTRUE) - + fEventSpecie(qadm.fEventSpecie), + fDigitsArray(NULL) { //copy ctor fDetectorDirName = GetName() ; for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { fParameterList[specie] = qadm.fParameterList[specie] ; - fImage[specie] = qadm.fImage[specie] ; + // fImage[specie] = qadm.fImage[specie] ; } } @@ -110,13 +104,15 @@ AliQADataMaker::AliQADataMaker(const AliQADataMaker& qadm) : AliQADataMaker::~AliQADataMaker() { for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) { - if ( fImage[esIndex] ) - delete fImage[esIndex] ; if (fParameterList[esIndex] ) delete fParameterList[esIndex] ; } - delete[] fImage ; delete[] fParameterList ; + + if (fDigitsArray) { + fDigitsArray->Clear() ; + delete fDigitsArray ; + } } //____________________________________________________________________________ @@ -130,8 +126,8 @@ Int_t AliQADataMaker::Add2List(TH1 * hist, const Int_t index, TObjArray ** list, TString className(classType->GetName()) ; if( ! className.BeginsWith("T") && ! classType->InheritsFrom("TH1") ) { AliError(Form("QA data Object must be a generic ROOT object and derive fom TH1 and not %s", className.Data())) ; - } else if ( index > 10000 ) { - AliError("Max number of authorized QA objects is 10000") ; + } else if ( index > AliQAv1::GetMaxQAObj() ) { + AliError(Form("Max number of authorized QA objects is %d", AliQAv1::GetMaxQAObj())) ; } else { hist->SetDirectory(0) ; if (expert) @@ -191,7 +187,7 @@ void AliQADataMaker::Finish() const //____________________________________________________________________________ TObject * AliQADataMaker::GetData(TObjArray ** list, const Int_t index) { - // Returns the QA object at index. Limit is 100. + // Returns the QA object at index. Limit is AliQAv1::GetMaxQAObj() if ( ! list ) { AliError("Data list is NULL !!") ; return NULL ; @@ -200,12 +196,31 @@ TObject * AliQADataMaker::GetData(TObjArray ** list, const Int_t index) SetEventSpecie(fEventSpecie) ; Int_t esindex = AliRecoParam::AConvert(fEventSpecie) ; TH1 * histClone = NULL ; - if (list[esindex]) { - if ( index > 10000 ) { - AliError("Max number of authorized QA objects is 10000") ; + TObjArray * arr = list[esindex] ; + if (arr) { + if ( ! arr->GetEntriesFast() ) { + // Initializes the histograms + TString arrName(arr->GetName()) ; + if (arrName.Contains(AliQAv1::GetTaskName(AliQAv1::kRAWS))) + InitRaws() ; + else if (arrName.Contains(AliQAv1::GetTaskName(AliQAv1::kHITS))) + InitHits() ; + else if (arrName.Contains(AliQAv1::GetTaskName(AliQAv1::kSDIGITS))) + InitSDigits() ; + else if (arrName.Contains(AliQAv1::GetTaskName(AliQAv1::kDIGITS))) + InitDigits() ; + else if (arrName.Contains(AliQAv1::GetTaskName(AliQAv1::kDIGITSR))) + InitDigits() ; + else if (arrName.Contains(AliQAv1::GetTaskName(AliQAv1::kRECPOINTS))) + InitRecPoints() ; + else if (arrName.Contains(AliQAv1::GetTaskName(AliQAv1::kESDS))) + InitESDs() ; + } + if ( index > AliQAv1::GetMaxQAObj() ) { + AliError(Form("Max number of authorized QA objects is %d", AliQAv1::GetMaxQAObj())) ; } else { - if ( list[esindex]->At(index) ) { - histClone = static_cast(list[esindex]->At(index)) ; + if ( arr->At(index) ) { + histClone = static_cast(arr->At(index)) ; } } } @@ -221,57 +236,13 @@ TObjArray* AliQADataMaker::Init(AliQAv1::TASKINDEX_t task, AliRecoParam::EventS } //____________________________________________________________________________ -void AliQADataMaker::MakeTheImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, const Char_t * mode) +Bool_t AliQADataMaker::IsValidEventSpecie(Int_t eventSpecieIndex, TObjArray ** list) { - // makes the QA image for sim and rec - TIter next(list[AliRecoParam::AConvert(fEventSpecie)]) ; - TH1 * hdata = NULL ; - Int_t nImages = 0 ; - while ( (hdata=static_cast(next())) ) { - TString cln(hdata->ClassName()) ; - if ( ! cln.Contains("TH1") ) - continue ; - if ( hdata->TestBit(AliQAv1::GetImageBit()) ) - nImages++; - } - if ( nImages == 0 ) { - AliWarning(Form("No histogram will be plotted for %s %s\n", GetName(), AliQAv1::GetTaskName(task).Data())) ; - } else { - AliDebug(AliQAv1::GetQADebugLevel(), Form("%d histograms will be plotted for %s %s\n", nImages, GetName(), AliQAv1::GetTaskName(task).Data())) ; - for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) { - if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) ) - 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) ; - } - 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(), mode, fRun, AliQAv1::GetImageFileFormat())) ; - fImage[esIndex]->Clear() ; - Int_t nx = TMath::Sqrt(nImages) ; - Int_t ny = 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) ; - while ( (hist=static_cast(nexthist())) ) { - TString cln(hist->ClassName()) ; - if ( ! cln.Contains("TH1") ) - continue ; - if(hist->TestBit(AliQAv1::GetImageBit())) { - hist->Draw() ; - fImage[esIndex]->cd(++npad) ; - } - } - fImage[esIndex]->Print(Form("%s%s%d.%s", AliQAv1::GetImageFileName(), mode, fRun, AliQAv1::GetImageFileFormat())) ; - } - } + // check if event specie was present in current run or + // if histograms of this event specie have been created + if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(eventSpecieIndex)) || ! list[eventSpecieIndex]->GetEntriesFast() ) + return kFALSE ; + else + return kTRUE ; } +