X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=STEER%2FAliQADataMakerRec.cxx;h=3f6fc9f4c1ef80e9e8243634a2e6cf4302720bad;hb=9533b54d51c0b05c12f5b4ddf7be6c4739e1c9c9;hp=7dba4387462ae3ced00a3468c7f354c038c80ca6;hpb=fb6e511e9418c799d0f0c75473103dae56f79ce5;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliQADataMakerRec.cxx b/STEER/AliQADataMakerRec.cxx index 7dba4387462..3f6fc9f4c1e 100644 --- a/STEER/AliQADataMakerRec.cxx +++ b/STEER/AliQADataMakerRec.cxx @@ -39,6 +39,7 @@ #include "AliLog.h" #include "AliQADataMakerRec.h" +#include "AliQAManager.h" #include "AliESDEvent.h" #include "AliRawReader.h" @@ -47,11 +48,13 @@ ClassImp(AliQADataMakerRec) //____________________________________________________________________________ AliQADataMakerRec::AliQADataMakerRec(const char * name, const char * title) : AliQADataMaker(name, title), + fDigitsQAList(NULL), fESDsQAList(NULL), fRawsQAList(NULL), fRecPointsQAList(NULL), fCorrNt(NULL), - fRecoParam(NULL) + fRecoParam(NULL), + fRecPointsArray(NULL) { // ctor fDetectorDirName = GetName() ; @@ -60,11 +63,13 @@ AliQADataMakerRec::AliQADataMakerRec(const char * name, const char * title) : //____________________________________________________________________________ AliQADataMakerRec::AliQADataMakerRec(const AliQADataMakerRec& qadm) : AliQADataMaker(qadm.GetName(), qadm.GetTitle()), + fDigitsQAList(qadm.fDigitsQAList), fESDsQAList(qadm.fESDsQAList), fRawsQAList(qadm.fRawsQAList), fRecPointsQAList(qadm.fRecPointsQAList), fCorrNt(qadm.fCorrNt), - fRecoParam(qadm.fRecoParam) + fRecoParam(qadm.fRecoParam), + fRecPointsArray(NULL) { //copy ctor SetName(qadm.GetName()) ; @@ -79,7 +84,6 @@ AliQADataMakerRec::~AliQADataMakerRec() if ( fESDsQAList ) { for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { if ( fESDsQAList[specie] ) { - if ( fESDsQAList[specie]->IsOwner() ) fESDsQAList[specie]->Delete() ; } } @@ -88,21 +92,31 @@ AliQADataMakerRec::~AliQADataMakerRec() if ( fRawsQAList ) { for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { if ( fRawsQAList[specie] ) { - if ( fRawsQAList[specie]->IsOwner() ) - fRawsQAList[specie]->Delete() ; + fRawsQAList[specie]->Delete() ; } } delete[] fRawsQAList ; + } + if ( fDigitsQAList ) { + for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { + if ( fDigitsQAList[specie] ) { + fDigitsQAList[specie]->Delete() ; + } + } + delete[] fDigitsQAList ; } if ( fRecPointsQAList ) { for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { if ( fRecPointsQAList[specie] ) { - if ( fRecPointsQAList[specie]->IsOwner() ) - fRecPointsQAList[specie]->Delete() ; + fRecPointsQAList[specie]->Delete() ; } } delete[] fRecPointsQAList ; - } + } + if (fRecPointsArray) { + fRecPointsArray->Clear() ; + delete fRecPointsArray ; + } } //__________________________________________________________________ @@ -118,24 +132,28 @@ AliQADataMakerRec& AliQADataMakerRec::operator = (const AliQADataMakerRec& qadm void AliQADataMakerRec::EndOfCycle() { // Finishes a cycle of QA for all the tasks - EndOfCycle(AliQA::kRAWS) ; - EndOfCycle(AliQA::kRECPOINTS) ; - EndOfCycle(AliQA::kESDS) ; + EndOfCycle(AliQAv1::kRAWS) ; + EndOfCycle(AliQAv1::kDIGITSR) ; + EndOfCycle(AliQAv1::kRECPOINTS) ; + EndOfCycle(AliQAv1::kESDS) ; ResetCycle() ; } //____________________________________________________________________________ -void AliQADataMakerRec::EndOfCycle(AliQA::TASKINDEX_t task) +void AliQADataMakerRec::EndOfCycle(AliQAv1::TASKINDEX_t task) { // Finishes a cycle of QA - TObjArray ** list = NULL ; + + TObjArray ** list = NULL ; - if ( task == AliQA::kRAWS ) + if ( task == AliQAv1::kRAWS ) list = fRawsQAList ; - else if ( task == AliQA::kRECPOINTS ) + else if ( task == AliQAv1::kDIGITSR ) + list = fDigitsQAList ; + else if ( task == AliQAv1::kRECPOINTS ) list = fRecPointsQAList ; - else if ( task == AliQA::kESDS ) + else if ( task == AliQAv1::kESDS ) list = fESDsQAList ; @@ -143,71 +161,90 @@ void AliQADataMakerRec::EndOfCycle(AliQA::TASKINDEX_t task) return ; //DefaultEndOfDetectorCycle(task) ; EndOfDetectorCycle(task, list) ; - TDirectory * subDir = NULL ; - if (fDetectorDir) - subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ; - if ( subDir ) { - subDir->cd() ; - for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { - TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(specie)) ; - if (eventSpecieDir) { - eventSpecieDir->cd() ; - if (list[specie]) { - TIter next(list[specie]) ; - TObject * obj ; + + if (! AliQAManager::QAManager(AliQAv1::kRECMODE)->IsSaveData()) + return ; + + fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ; + if (!fDetectorDir) + fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ; + TDirectory * subDir = fDetectorDir->GetDirectory(AliQAv1::GetTaskName(task)) ; + if (!subDir) + subDir = fDetectorDir->mkdir(AliQAv1::GetTaskName(task)) ; + subDir->cd() ; + for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { // skip Default + if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(specie)) || AliRecoParam::ConvertIndex(specie) == AliRecoParam::kDefault) + continue ; + TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(specie)) ; + if (!eventSpecieDir) + eventSpecieDir = subDir->mkdir(AliRecoParam::GetEventSpecieName(specie)) ; + eventSpecieDir->cd() ; + if (list) { + if (list[specie]) { + TIter next(list[specie]) ; + TObject * obj ; + while( (obj = next()) ) { + if (!obj->TestBit(AliQAv1::GetExpertBit())) + obj->Write() ; + } + if (WriteExpert()) { + TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQAv1::GetExpert()) ; + if (!expertDir) + expertDir = eventSpecieDir->mkdir(AliQAv1::GetExpert()) ; + expertDir->cd() ; + next.Reset() ; while( (obj = next()) ) { - if (!obj->TestBit(AliQA::GetExpertBit())) - obj->Write() ; - } - if (WriteExpert()) { - TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQA::GetExpert()) ; - if ( expertDir ) { // Write only if requested - expertDir->cd() ; - next.Reset() ; - while( (obj = next()) ) { - if (!obj->TestBit(AliQA::GetExpertBit())) - continue ; - obj->Write() ; - } - } - } + if (!obj->TestBit(AliQAv1::GetExpertBit())) + continue ; + obj->Write() ; + } } - if ( !fCorrNt ) - continue ; - if (fCorrNt[specie] && AliQA::GetDetIndex(GetName()) == AliQA::kCORR) { + } + } + else if ( fCorrNt ) { + if (fCorrNt[specie] && AliQAv1::GetDetIndex(GetName()) == AliQAv1::kCORR) { + if (fCorrNt[specie]->GetNvar() != 0) { eventSpecieDir->cd() ; fCorrNt[specie]->Write() ; } } + fOutput->Save() ; } - fOutput->Save() ; - } + } } - + //____________________________________________________________________________ -void AliQADataMakerRec::Exec(AliQA::TASKINDEX_t task, TObject * data) +void AliQADataMakerRec::Exec(AliQAv1::TASKINDEX_t task, TObject * data) { // creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs) - if ( task == AliQA::kRAWS ) { - AliDebug(1, "Processing Raws QA") ; - AliRawReader * rawReader = dynamic_cast(data) ; + if ( task == AliQAv1::kRAWS ) { + AliDebug(AliQAv1::GetQADebugLevel(), "Processing Raws QA") ; + AliRawReader * rawReader = static_cast(data) ; if (rawReader) MakeRaws(rawReader) ; else - AliInfo("Raw data are not processed") ; - } else if ( task == AliQA::kRECPOINTS ) { - AliDebug(1, "Processing RecPoints QA") ; - TTree * tree = dynamic_cast(data) ; - if (tree) { + AliDebug(AliQAv1::GetQADebugLevel(), "Raw data are not processed") ; + } else if ( task == AliQAv1::kDIGITSR ) { + AliDebug(AliQAv1::GetQADebugLevel(), "Processing Digits QA") ; + TTree * tree = static_cast(data) ; + if (strcmp(tree->ClassName(), "TTree") == 0) { + MakeDigits(tree) ; + } else { + AliWarning("data are not a TTree") ; + } + } else if ( task == AliQAv1::kRECPOINTS ) { + AliDebug(AliQAv1::GetQADebugLevel(), "Processing RecPoints QA") ; + TTree * tree = static_cast(data) ; + if (strcmp(tree->ClassName(), "TTree") == 0) { MakeRecPoints(tree) ; } else { AliWarning("data are not a TTree") ; } - } else if ( task == AliQA::kESDS ) { - AliDebug(1, "Processing ESDs QA") ; - AliESDEvent * esd = dynamic_cast(data) ; - if (esd) + } else if ( task == AliQAv1::kESDS ) { + AliDebug(AliQAv1::GetQADebugLevel(), "Processing ESDs QA") ; + AliESDEvent * esd = static_cast(data) ; + if (strcmp(esd->ClassName(), "AliESDEvent") == 0) MakeESDs(esd) ; else AliError("Wrong type of esd container") ; @@ -215,7 +252,7 @@ void AliQADataMakerRec::Exec(AliQA::TASKINDEX_t task, TObject * data) } //____________________________________________________________________________ -TObjArray ** AliQADataMakerRec::Init(AliQA::TASKINDEX_t task, Int_t cycles) +TObjArray ** AliQADataMakerRec::Init(AliQAv1::TASKINDEX_t task, Int_t cycles) { // general intialisation InitRecoParams() ; @@ -224,34 +261,40 @@ TObjArray ** AliQADataMakerRec::Init(AliQA::TASKINDEX_t task, Int_t cycles) if (cycles > 0) SetCycle(cycles) ; - if ( task == AliQA::kRAWS ) { + if ( task == AliQAv1::kRAWS ) { if (! fRawsQAList ) { fRawsQAList = new TObjArray *[AliRecoParam::kNSpecies] ; for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { - fRawsQAList[specie] = new TObjArray(100) ; - fRawsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQA::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ; + fRawsQAList[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ; + fRawsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ; } - InitRaws() ; } rv = fRawsQAList ; - } else if ( task == AliQA::kRECPOINTS ) { + } else if ( task == AliQAv1::kDIGITSR ) { + if ( ! fDigitsQAList ) { + fDigitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ; + for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { + fDigitsQAList[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ; + fDigitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ; + } + } + rv = fDigitsQAList ; + } else if ( task == AliQAv1::kRECPOINTS ) { if ( ! fRecPointsQAList ) { fRecPointsQAList = new TObjArray *[AliRecoParam::kNSpecies] ; for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { - fRecPointsQAList[specie] = new TObjArray(100) ; - fRecPointsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQA::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ; + fRecPointsQAList[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ; + fRecPointsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ; } - InitRecPoints() ; - } + } rv = fRecPointsQAList ; - } else if ( task == AliQA::kESDS ) { + } else if ( task == AliQAv1::kESDS ) { if ( ! fESDsQAList ) { fESDsQAList = new TObjArray *[AliRecoParam::kNSpecies] ; for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) { - fESDsQAList[specie] = new TObjArray(100) ; - fESDsQAList[specie]->SetName(Form("%s_%s", GetName(), AliQA::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ; + fESDsQAList[specie] = new TObjArray(AliQAv1::GetMaxQAObj()) ; + fESDsQAList[specie]->SetName(Form("%s_%s", GetName(), AliQAv1::GetTaskName(task).Data())); //, AliRecoParam::GetEventSpecieName(specie))) ; } - InitESDs() ; } rv = fESDsQAList ; } @@ -259,7 +302,7 @@ TObjArray ** AliQADataMakerRec::Init(AliQA::TASKINDEX_t task, Int_t cycles) } //____________________________________________________________________________ -void AliQADataMakerRec::Init(AliQA::TASKINDEX_t task, TObjArray ** list, Int_t run, Int_t cycles) +void AliQADataMakerRec::Init(AliQAv1::TASKINDEX_t task, TObjArray ** list, Int_t run, Int_t cycles) { // Intialisation by passing the list of QA data booked elsewhere @@ -268,11 +311,13 @@ void AliQADataMakerRec::Init(AliQA::TASKINDEX_t task, TObjArray ** list, Int_t r if (cycles > 0) SetCycle(cycles) ; - if ( task == AliQA::kRAWS ) { + if ( task == AliQAv1::kRAWS ) { fRawsQAList = list ; - } else if ( task == AliQA::kRECPOINTS ) { + } else if ( task == AliQAv1::kDIGITSR ) { + fDigitsQAList = list ; + } else if ( task == AliQAv1::kRECPOINTS ) { fRecPointsQAList = list ; - } else if ( task == AliQA::kESDS ) { + } else if ( task == AliQAv1::kESDS ) { fESDsQAList = list ; } } @@ -280,22 +325,35 @@ void AliQADataMakerRec::Init(AliQA::TASKINDEX_t task, TObjArray ** list, Int_t r //____________________________________________________________________________ void AliQADataMakerRec::InitRecoParams() { + // Get the recoparam form the OCDB if (!fRecoParam) { - AliInfo(Form("Loading reconstruction parameter objects for detector %s", GetName())); + AliDebug(AliQAv1::GetQADebugLevel(), Form("Loading reconstruction parameter objects for detector %s", GetName())); AliCDBPath path(GetName(),"Calib","RecoParam"); AliCDBEntry *entry=AliCDBManager::Instance()->Get(path.GetPath()); if(!entry) { fRecoParam = NULL ; - AliWarning(Form("Couldn't find RecoParam entry in OCDB for detector %s",GetName())); + AliDebug(AliQAv1::GetQADebugLevel(), Form("Couldn't find RecoParam entry in OCDB for detector %s",GetName())); } else { TObject * recoParamObj = entry->GetObject() ; - if (dynamic_cast(recoParamObj)) { - // The detector has only onse set of reco parameters + if ( strcmp(recoParamObj->ClassName(), "TObjArray") == 0 ) { + // The detector has only one set of reco parameters + AliDebug(AliQAv1::GetQADebugLevel(), Form("Array of reconstruction parameters found for detector %s",GetName())); + TObjArray *recoParamArray = static_cast(recoParamObj) ; + for (Int_t iRP=0; iRPGetEntriesFast(); iRP++) { + fRecoParam = static_cast(recoParamArray->At(iRP)) ; + if (!fRecoParam) + break ; + else if (fRecoParam->IsDefault()) + break ; + } + } + else if (recoParamObj->InheritsFrom("AliDetectorRecoParam")) { + // The detector has only one set of reco parameters // Registering it in AliRecoParam - AliInfo(Form("Single set of reconstruction parameters found for detector %s",GetName())); - dynamic_cast(recoParamObj)->SetAsDefault(); - fRecoParam = dynamic_cast(recoParamObj) ; + AliDebug(AliQAv1::GetQADebugLevel(), Form("Single set of reconstruction parameters found for detector %s",GetName())); + fRecoParam = static_cast(recoParamObj) ; + static_cast(recoParamObj)->SetAsDefault(); } else { AliError(Form("No valid RecoParam object found in the OCDB for detector %s",GetName())); } @@ -303,19 +361,52 @@ void AliQADataMakerRec::InitRecoParams() } } +//____________________________________________________________________________ +void AliQADataMakerRec::ResetDetector(AliQAv1::TASKINDEX_t task) +{ + // default reset that resets all the QA objects. + // to be overloaded by detectors, if necessary + + TObjArray ** list = NULL ; + if ( task == AliQAv1::kRAWS ) { + list = fRawsQAList ; + } else if ( task == AliQAv1::kDIGITSR ) { + list = fDigitsQAList ; + } else if ( task == AliQAv1::kRECPOINTS ) { + list = fRecPointsQAList ; + } else if ( task == AliQAv1::kESDS ) { + list = fESDsQAList ; + } + //list was not initialized, skip + if (!list) + return ; + + for (int spec = 0; spec < AliRecoParam::kNSpecies; spec++) { + if (!AliQAv1::Instance()->IsEventSpecieSet(AliRecoParam::ConvertIndex(spec))) + continue; + TIter next(list[spec]) ; + TH1 * histo = NULL ; + while ( (histo = dynamic_cast (next())) ) { + histo->Reset("ICE") ; + histo->ResetStats() ; + } + } +} + //____________________________________________________________________________ void AliQADataMakerRec::StartOfCycle(Int_t run) { // Finishes a cycle of QA for all the tasks Bool_t samecycle = kFALSE ; - StartOfCycle(AliQA::kRAWS, run, samecycle) ; + StartOfCycle(AliQAv1::kRAWS, run, samecycle) ; samecycle = kTRUE ; - StartOfCycle(AliQA::kRECPOINTS, run, samecycle) ; - StartOfCycle(AliQA::kESDS, run, samecycle) ; + StartOfCycle(AliQAv1::kDIGITSR, run, samecycle) ; + StartOfCycle(AliQAv1::kRECPOINTS, run, samecycle) ; + StartOfCycle(AliQAv1::kESDS, run, samecycle) ; } //____________________________________________________________________________ -void AliQADataMakerRec::StartOfCycle(AliQA::TASKINDEX_t task, Int_t run, const Bool_t sameCycle) +void AliQADataMakerRec::StartOfCycle(AliQAv1::TASKINDEX_t task, Int_t run, const Bool_t sameCycle) { // Finishes a cycle of QA data acquistion if ( run > 0 ) @@ -324,26 +415,27 @@ void AliQADataMakerRec::StartOfCycle(AliQA::TASKINDEX_t task, Int_t run, const B ResetCycle() ; if (fOutput) fOutput->Close() ; - fOutput = AliQA::GetQADataFile(GetName(), fRun) ; + if (AliQAManager::QAManager(AliQAv1::kRECMODE)->IsSaveData()) + fOutput = AliQAv1::GetQADataFile(GetName(), fRun) ; } - AliInfo(Form(" Run %d Cycle %d task %s file %s", - fRun, fCurrentCycle, AliQA::GetTaskName(task).Data(), fOutput->GetName() )) ; - - fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ; - if (!fDetectorDir) - fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ; + AliDebug(AliQAv1::GetQADebugLevel(), Form(" Run %d Cycle %d task %s file %s", + fRun, fCurrentCycle, AliQAv1::GetTaskName(task).Data(), fOutput->GetName() )) ; - TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ; - if (!subDir) - subDir = fDetectorDir->mkdir(AliQA::GetTaskName(task)) ; - - for ( Int_t specie = AliRecoParam::kDefault ; specie < AliRecoParam::kNSpecies ; specie++ ) { - TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(specie)) ; - if (!eventSpecieDir) - eventSpecieDir = subDir->mkdir(AliRecoParam::GetEventSpecieName(specie)) ; - TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQA::GetExpert()) ; - if (!expertDir) - expertDir = eventSpecieDir->mkdir(AliQA::GetExpert()) ; - } +// fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ; +// if (!fDetectorDir) +// fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ; +// +// TDirectory * subDir = fDetectorDir->GetDirectory(AliQAv1::GetTaskName(task)) ; +// if (!subDir) +// subDir = fDetectorDir->mkdir(AliQAv1::GetTaskName(task)) ; +// +// for ( Int_t specie = AliRecoParam::kDefault ; specie < AliRecoParam::kNSpecies ; specie++ ) { +// TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(specie)) ; +// if (!eventSpecieDir) +// eventSpecieDir = subDir->mkdir(AliRecoParam::GetEventSpecieName(specie)) ; +// TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQAv1::GetExpert()) ; +// if (!expertDir) +// expertDir = eventSpecieDir->mkdir(AliQAv1::GetExpert()) ; +// } StartOfDetectorCycle() ; }