// --- ROOT system ---
#include <TFile.h>
#include <TTree.h>
+#include <TNtupleD.h>
+#include <TObjArray.h>
// --- Standard library ---
// --- AliRoot header files ---
+#include "AliCDBPath.h"
+#include "AliCDBEntry.h"
+#include "AliDetectorRecoParam.h"
+#include "AliCDBManager.h"
+
#include "AliLog.h"
#include "AliQADataMakerRec.h"
#include "AliESDEvent.h"
fESDsQAList(NULL),
fRawsQAList(NULL),
fRecPointsQAList(NULL),
- fObject(NULL),
+ fCorrNt(NULL),
fRecoParam(NULL)
{
// ctor
fESDsQAList(qadm.fESDsQAList),
fRawsQAList(qadm.fRawsQAList),
fRecPointsQAList(qadm.fRecPointsQAList),
- fObject(qadm.fObject),
+ fCorrNt(qadm.fCorrNt),
fRecoParam(qadm.fRecoParam)
{
//copy ctor
{
//dtor: delete the TObjArray and thei content
if ( fESDsQAList ) {
- if ( fESDsQAList->IsOwner() )
- fESDsQAList->Delete() ;
- delete fESDsQAList ;
+ for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+ if ( fESDsQAList[specie] ) {
+ if ( fESDsQAList[specie]->IsOwner() )
+ fESDsQAList[specie]->Delete() ;
+ }
+ }
+ delete[] fESDsQAList ;
}
if ( fRawsQAList ) {
- if ( fRawsQAList->IsOwner() )
- fRawsQAList->Delete() ;
- delete fRawsQAList ;
- }
+ for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+ if ( fRawsQAList[specie] ) {
+ if ( fRawsQAList[specie]->IsOwner() )
+ fRawsQAList[specie]->Delete() ;
+ }
+ }
+ delete[] fRawsQAList ;
+ }
if ( fRecPointsQAList ) {
- if ( fRecPointsQAList->IsOwner() )
- fRecPointsQAList->Delete() ;
- delete fRecPointsQAList ;
+ for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+ if ( fRecPointsQAList[specie] ) {
+ if ( fRecPointsQAList[specie]->IsOwner() )
+ fRecPointsQAList[specie]->Delete() ;
+ }
+ }
+ delete[] fRecPointsQAList ;
}
}
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::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::kRECPOINTS )
list = fRecPointsQAList ;
- else if ( task == AliQA::kESDS )
+ else if ( task == AliQAv1::kESDS )
list = fESDsQAList ;
- if ( ! list && ! fObject )
+ if ( ! list && ! fCorrNt )
return ;
//DefaultEndOfDetectorCycle(task) ;
EndOfDetectorCycle(task, list) ;
TDirectory * subDir = NULL ;
if (fDetectorDir)
- subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
+ subDir = fDetectorDir->GetDirectory(AliQAv1::GetTaskName(task)) ;
if ( subDir ) {
subDir->cd() ;
- if (list)
- list->Write() ;
- if (fObject) {
- fObject->Write() ;
+ 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 ;
+ while( (obj = next()) ) {
+ if (!obj->TestBit(AliQAv1::GetExpertBit()))
+ obj->Write() ;
+ }
+ if (WriteExpert()) {
+ TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQAv1::GetExpert()) ;
+ if ( expertDir ) { // Write only if requested
+ expertDir->cd() ;
+ next.Reset() ;
+ while( (obj = next()) ) {
+ if (!obj->TestBit(AliQAv1::GetExpertBit()))
+ continue ;
+ obj->Write() ;
+ }
+ }
+ }
+ }
+ if ( !fCorrNt )
+ continue ;
+ if (fCorrNt[specie] && AliQAv1::GetDetIndex(GetName()) == AliQAv1::kCORR) {
+ eventSpecieDir->cd() ;
+ fCorrNt[specie]->Write() ;
+ }
+ }
}
+ 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 ) {
+ if ( task == AliQAv1::kRAWS ) {
AliDebug(1, "Processing Raws QA") ;
AliRawReader * rawReader = dynamic_cast<AliRawReader *>(data) ;
if (rawReader)
MakeRaws(rawReader) ;
else
AliInfo("Raw data are not processed") ;
- } else if ( task == AliQA::kRECPOINTS ) {
+ } else if ( task == AliQAv1::kRECPOINTS ) {
AliDebug(1, "Processing RecPoints QA") ;
TTree * tree = dynamic_cast<TTree *>(data) ;
if (tree) {
} else {
AliWarning("data are not a TTree") ;
}
- } else if ( task == AliQA::kESDS ) {
+ } else if ( task == AliQAv1::kESDS ) {
AliDebug(1, "Processing ESDs QA") ;
AliESDEvent * esd = dynamic_cast<AliESDEvent *>(data) ;
if (esd)
}
//____________________________________________________________________________
-TObjArray * AliQADataMakerRec::Init(AliQA::TASKINDEX_t task, Int_t cycles)
+TObjArray ** AliQADataMakerRec::Init(AliQAv1::TASKINDEX_t task, Int_t cycles)
{
// general intialisation
-
- TObjArray * rv = NULL ;
+ InitRecoParams() ;
+ TObjArray ** rv = NULL ;
if (cycles > 0)
SetCycle(cycles) ;
- if ( task == AliQA::kRAWS ) {
+ if ( task == AliQAv1::kRAWS ) {
if (! fRawsQAList ) {
- fRawsQAList = new TObjArray(100) ;
- fRawsQAList->SetName(Form("%s_%s", GetName(), AliQA::GetTaskName(task).Data())) ;
+ 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(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
+ }
InitRaws() ;
}
rv = fRawsQAList ;
- } else if ( task == AliQA::kRECPOINTS ) {
+ } else if ( task == AliQAv1::kRECPOINTS ) {
if ( ! fRecPointsQAList ) {
- fRecPointsQAList = new TObjArray(100) ;
- fRecPointsQAList->SetName(Form("%s_%s", GetName(), AliQA::GetTaskName(task).Data())) ;
- InitRecPoints() ;
+ 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(), 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(100) ;
- fESDsQAList->SetName(Form("%s_%s", GetName(), AliQA::GetTaskName(task).Data())) ;
+ 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(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
+ }
InitESDs() ;
}
rv = fESDsQAList ;
}
-
return rv ;
}
//____________________________________________________________________________
-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
- fRun = run ;
+ InitRecoParams() ;
+ fRun = run ;
if (cycles > 0)
SetCycle(cycles) ;
- if ( task == AliQA::kRAWS ) {
+ if ( task == AliQAv1::kRAWS ) {
fRawsQAList = list ;
- } else if ( task == AliQA::kRECPOINTS ) {
+ } else if ( task == AliQAv1::kRECPOINTS ) {
fRecPointsQAList = list ;
- } else if ( task == AliQA::kESDS ) {
+ } else if ( task == AliQAv1::kESDS ) {
fESDsQAList = list ;
}
}
+//____________________________________________________________________________
+void AliQADataMakerRec::InitRecoParams()
+{
+ if (!fRecoParam) {
+ AliInfo(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()));
+ }
+ else {
+ TObject * recoParamObj = entry->GetObject() ;
+ if (dynamic_cast<TObjArray*>(recoParamObj)) {
+ // The detector has only one set of reco parameters
+ AliInfo(Form("Array of reconstruction parameters found for detector %s",GetName()));
+ TObjArray *recoParamArray = dynamic_cast<TObjArray*>(recoParamObj) ;
+ for (Int_t iRP=0; iRP<recoParamArray->GetEntriesFast(); iRP++) {
+ fRecoParam = dynamic_cast<AliDetectorRecoParam*>(recoParamArray->At(iRP)) ;
+ if (fRecoParam->IsDefault()) break;
+ }
+ }
+ else if (dynamic_cast<AliDetectorRecoParam*>(recoParamObj)) {
+ // The detector has only onse set of reco parameters
+ // Registering it in AliRecoParam
+ AliInfo(Form("Single set of reconstruction parameters found for detector %s",GetName()));
+ dynamic_cast<AliDetectorRecoParam*>(recoParamObj)->SetAsDefault();
+ fRecoParam = dynamic_cast<AliDetectorRecoParam*>(recoParamObj) ;
+ } else {
+ AliError(Form("No valid RecoParam object found in the OCDB for detector %s",GetName()));
+ }
+ }
+ AliCDBManager::Instance()->UnloadFromCache(path.GetPath());
+ }
+}
+
//____________________________________________________________________________
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::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 )
ResetCycle() ;
if (fOutput)
fOutput->Close() ;
- fOutput = AliQA::GetQADataFile(GetName(), fRun) ;
+ fOutput = AliQAv1::GetQADataFile(GetName(), fRun) ;
}
AliInfo(Form(" Run %d Cycle %d task %s file %s",
- fRun, fCurrentCycle, AliQA::GetTaskName(task).Data(), fOutput->GetName() )) ;
+ fRun, fCurrentCycle, AliQAv1::GetTaskName(task).Data(), fOutput->GetName() )) ;
fDetectorDir = fOutput->GetDirectory(GetDetectorDirName()) ;
if (!fDetectorDir)
fDetectorDir = fOutput->mkdir(GetDetectorDirName()) ;
- TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
+ TDirectory * subDir = fDetectorDir->GetDirectory(AliQAv1::GetTaskName(task)) ;
if (!subDir)
- subDir = fDetectorDir->mkdir(AliQA::GetTaskName(task)) ;
- subDir->cd() ;
-
+ 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() ;
}