X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STEER%2FAliQADataMaker.cxx;h=7c77dfc1eca0089d229b630a3828b50c9ea3838a;hb=583e63b8cc5bcb315a36593ccc48f486c2907bbf;hp=7a96edf30082cfcd1764e13e2d1313484839011f;hpb=71f27f1f5965080b240b4d24f2592e38489e674c;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliQADataMaker.cxx b/STEER/AliQADataMaker.cxx index 7a96edf3008..7c77dfc1eca 100644 --- a/STEER/AliQADataMaker.cxx +++ b/STEER/AliQADataMaker.cxx @@ -24,7 +24,7 @@ // // --- ROOT system --- -#include +#include #include #include #include @@ -56,7 +56,7 @@ ClassImp(AliQADataMaker) //____________________________________________________________________________ -AliQADataMaker::AliQADataMaker(const char * name, const char * title) : +AliQADataMaker::AliQADataMaker(const Char_t * name, const Char_t * title) : TNamed(name, title), fOutput(0x0), fDetectorDir(0x0), @@ -68,14 +68,12 @@ AliQADataMaker::AliQADataMaker(const char * name, const char * title) : fParameterList(new TList*[AliRecoParam::kNSpecies]), fRun(0), fEventSpecie(AliRecoParam::kDefault), - fImage(new TCanvas*[AliRecoParam::kNSpecies]), - fPrintImage(kFALSE) + fDigitsArray(NULL) { // ctor fDetectorDirName = GetName() ; for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { fParameterList[specie] = NULL ; - fImage[specie] = NULL ; } } @@ -91,26 +89,30 @@ AliQADataMaker::AliQADataMaker(const AliQADataMaker& qadm) : fWriteExpert(qadm.fWriteExpert), fParameterList(qadm.fParameterList), fRun(qadm.fRun), - fEventSpecie(qadm.fEventSpecie), - fImage(qadm.fImage), - fPrintImage(kFALSE) - + 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] ; + } } //____________________________________________________________________________ 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 ; + } } //____________________________________________________________________________ @@ -124,29 +126,26 @@ 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 { + } else if ( index > AliQAv1::GetMaxQAObj() ) { + AliError(Form("Max number of authorized QA objects is %d", AliQAv1::GetMaxQAObj())) ; + } else { + hist->SetDirectory(0) ; if (expert) hist->SetBit(AliQAv1::GetExpertBit()) ; if (image) hist->SetBit(AliQAv1::GetImageBit()) ; - TH1 * histClone[AliRecoParam::kNSpecies] ; - for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { - histClone[specie] = CloneMe(hist, specie) ; - histClone[specie]->SetDirectory(0) ; - list[specie]->AddAtAndExpand(histClone[specie], index) ; - if(saveForCorr) { - char * name = Form("%s_%s", list[AliRecoParam::AConvert(AliRecoParam::kDefault)]->GetName(), hist->GetName()) ; - TParameter * p = new TParameter(name, 9999.9999) ; - if ( fParameterList[specie] == NULL ) - fParameterList[specie] = new TList() ; - fParameterList[specie]->Add(p) ; - } + const Char_t * name = Form("%s_%s", AliRecoParam::GetEventSpecieName(fEventSpecie), hist->GetName()) ; + hist->SetName(name) ; + if(saveForCorr) { + const Char_t * cname = Form("%s_%s", list[AliRecoParam::AConvert(AliRecoParam::kDefault)]->GetName(), hist->GetName()) ; + TParameter * p = new TParameter(cname, 9999.9999) ; + if ( fParameterList[AliRecoParam::AConvert(fEventSpecie)] == NULL ) + fParameterList[AliRecoParam::AConvert(fEventSpecie)] = new TList() ; + fParameterList[AliRecoParam::AConvert(fEventSpecie)]->Add(p) ; } - rv = list[AliRecoParam::kDefault]->GetLast() ; + list[AliRecoParam::AConvert(fEventSpecie)]->AddAtAndExpand(hist, index) ; + rv = list[AliRecoParam::AConvert(fEventSpecie)]->GetLast() ; } - delete hist ; return rv ; } @@ -154,8 +153,8 @@ Int_t AliQADataMaker::Add2List(TH1 * hist, const Int_t index, TObjArray ** list, TH1 * AliQADataMaker::CloneMe(TH1 * hist, Int_t specie) const { // clones a histogram - char * name = Form("%s_%s", AliRecoParam::GetEventSpecieName(specie), hist->GetName()) ; - TH1 * hClone = dynamic_cast(hist->Clone(name)) ; + const Char_t * name = Form("%s_%s", AliRecoParam::GetEventSpecieName(specie), hist->GetName()) ; + TH1 * hClone = static_cast(hist->Clone(name)) ; if ( hist->TestBit(AliQAv1::GetExpertBit()) ) hClone->SetBit(AliQAv1::GetExpertBit()) ; if ( hist->TestBit(AliQAv1::GetImageBit()) ) @@ -188,31 +187,62 @@ 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 ; } SetEventSpecie(fEventSpecie) ; - if ( GetRecoParam() ) { - if ( AliRecoParam::Convert(GetRecoParam()->GetEventSpecie()) != AliRecoParam::kDefault) { - SetEventSpecie(GetRecoParam()->GetEventSpecie()) ; - } else { - AliError(Form("Event Specie from RecoParam of %s is = %d\n", GetName(), fEventSpecie)); + Int_t esindex = AliRecoParam::AConvert(fEventSpecie) ; + TH1 * histClone = NULL ; + 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 (list[AliRecoParam::AConvert(fEventSpecie)]) { - if ( index > 10000 ) { - AliError("Max number of authorized QA objects is 10000") ; - return NULL ; + if ( index > AliQAv1::GetMaxQAObj() ) { + AliError(Form("Max number of authorized QA objects is %d", AliQAv1::GetMaxQAObj())) ; } else { - Int_t esindex = AliRecoParam::AConvert(fEventSpecie) ; - return list[esindex]->At(index) ; - } - } else { - AliError("Data list is NULL !!") ; - return NULL ; - } + if ( arr->At(index) ) { + histClone = static_cast(arr->At(index)) ; + } + } + } + return histClone ; +} + +//____________________________________________________________________________ +TObjArray* AliQADataMaker::Init(AliQAv1::TASKINDEX_t task, AliRecoParam::EventSpecie_t es, Int_t cycles) +{ + // Initialializes and returns the QAData list for a given event specie + TObjArray ** ar = Init(task, cycles) ; + return ar[AliRecoParam::AConvert(es)] ; +} + +//____________________________________________________________________________ +Bool_t AliQADataMaker::IsValidEventSpecie(Int_t eventSpecieIndex, TObjArray ** list) +{ + // 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 ; }