/* $Id$ */
-/*
- Base Class
- Produces the data needed to calculate the quality assurance.
- All data must be mergeable objects.
- Y. Schutz CERN July 2007
- x
- x
-*/
+//
+// Base Class
+// Produces the data needed to calculate the quality assurance.
+// All data must be mergeable objects.
+// Y. Schutz CERN July 2007
+//
// --- ROOT system ---
-//#include <TSystem.h>
#include <TFile.h>
-//#include <TList.h>
#include <TTree.h>
#include <TClonesArray.h>
// --- AliRoot header files ---
#include "AliLog.h"
#include "AliQADataMakerSim.h"
-//#include "AliQAChecker.h"
ClassImp(AliQADataMakerSim)
fDetectorDirName = GetName() ;
}
+//____________________________________________________________________________
+AliQADataMakerSim::~AliQADataMakerSim()
+{
+ //dtor: delete the TObjArray and thei content
+ if ( fDigitsQAList ) {
+ for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+ if ( fDigitsQAList[specie]->IsOwner() )
+ fDigitsQAList[specie]->Delete() ;
+ }
+ delete[] fDigitsQAList ;
+ }
+ if ( fHitsQAList ) {
+ for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+ if ( fHitsQAList[specie]->IsOwner() )
+ fHitsQAList[specie]->Delete() ;
+ }
+ delete[] fHitsQAList ;
+ }
+ if ( fSDigitsQAList ) {
+ for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+ if ( fSDigitsQAList[specie]->IsOwner() )
+ fSDigitsQAList[specie]->Delete() ;
+ }
+ delete[] fSDigitsQAList ;
+ }
+}
+
//__________________________________________________________________
AliQADataMakerSim& AliQADataMakerSim::operator = (const AliQADataMakerSim& qadm )
{
}
//____________________________________________________________________________
-void AliQADataMakerSim::EndOfCycle(AliQA::TASKINDEX task)
+void AliQADataMakerSim::EndOfCycle()
+{
+ // Finishes a cycle of QA for all tasks
+ EndOfCycle(AliQAv1::kHITS) ;
+ EndOfCycle(AliQAv1::kSDIGITS) ;
+ EndOfCycle(AliQAv1::kDIGITS) ;
+ ResetCycle() ;
+}
+
+//____________________________________________________________________________
+void AliQADataMakerSim::EndOfCycle(AliQAv1::TASKINDEX_t task)
{
// Finishes a cycle of QA data acquistion
- TObjArray * list = 0x0 ;
+ TObjArray ** list = NULL ;
- if ( task == AliQA::kHITS )
+ if ( task == AliQAv1::kHITS )
list = fHitsQAList ;
- else if ( task == AliQA::kSDIGITS )
+ else if ( task == AliQAv1::kSDIGITS )
list = fSDigitsQAList ;
- else if ( task == AliQA::kDIGITS )
+ else if ( task == AliQAv1::kDIGITS )
list = fDigitsQAList ;
-
+
+ if ( ! list )
+ return ;
EndOfDetectorCycle(task, list) ;
- TDirectory * subDir = fDetectorDir->GetDirectory(AliQA::GetTaskName(task)) ;
+ TDirectory * subDir = NULL ;
+ if (fDetectorDir)
+ subDir = fDetectorDir->GetDirectory(AliQAv1::GetTaskName(task)) ;
if (subDir) {
subDir->cd() ;
- list->Write() ;
- }
+ for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+ TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(specie)) ;
+ if (eventSpecieDir) {
+ eventSpecieDir->cd() ;
+ 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->cd() ;
+ next.Reset() ;
+ while ( (obj = next()) ) {
+ if (!obj->TestBit(AliQAv1::GetExpertBit()))
+ continue ;
+ obj->Write() ;
+ }
+ }
+ }
+ }
+ }
+ fOutput->Save() ;
+ }
+ ResetCycle() ;
}
//____________________________________________________________________________
-void AliQADataMakerSim::Exec(AliQA::TASKINDEX task, TObject * data)
+void AliQADataMakerSim::Exec(AliQAv1::TASKINDEX_t task, TObject * data)
{
// creates the quality assurance data for the various tasks (Hits, SDigits, Digits, ESDs)
- if ( task == AliQA::kHITS ) {
+ if ( task == AliQAv1::kHITS ) {
AliDebug(1, "Processing Hits QA") ;
TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
if (arr) {
AliWarning("data are neither a TClonesArray nor a TTree") ;
}
}
- } else if ( task == AliQA::kSDIGITS ) {
+ } else if ( task == AliQAv1::kSDIGITS ) {
AliDebug(1, "Processing SDigits QA") ;
TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
if (arr) {
AliWarning("data are neither a TClonesArray nor a TTree") ;
}
}
- } else if ( task == AliQA::kDIGITS ) {
+ } else if ( task == AliQAv1::kDIGITS ) {
AliDebug(1, "Processing Digits QA") ;
TClonesArray * arr = dynamic_cast<TClonesArray *>(data) ;
if (arr) {
}
//____________________________________________________________________________
-TObjArray * AliQADataMakerSim::Init(AliQA::TASKINDEX task, Int_t run, Int_t cycles)
+TObjArray ** AliQADataMakerSim::Init(AliQAv1::TASKINDEX_t task, Int_t cycles)
{
// general intialisation
- fRun = run ;
if (cycles > 0)
SetCycle(cycles) ;
- TObjArray * rv = NULL ;
- if ( task == AliQA::kHITS ) {
- fHitsQAList = new TObjArray(100) ;
- InitHits() ;
+ TObjArray ** rv = NULL ;
+ if ( task == AliQAv1::kHITS ) {
+ if ( ! fHitsQAList ) {
+ fHitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
+ for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+ fHitsQAList[specie] = new TObjArray(100) ;
+ fHitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
+ }
+ InitHits() ;
+ }
rv = fHitsQAList ;
- } else if ( task == AliQA::kSDIGITS ) {
- fSDigitsQAList = new TObjArray(100) ;
- InitSDigits() ;
+ } else if ( task == AliQAv1::kSDIGITS ) {
+ if ( ! fSDigitsQAList ) {
+ fSDigitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
+ for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+ fSDigitsQAList[specie] = new TObjArray(100) ;
+ fSDigitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
+ }
+ InitSDigits() ;
+ }
rv = fSDigitsQAList ;
- } else if ( task == AliQA::kDIGITS ) {
- fDigitsQAList = new TObjArray(100);
- InitDigits() ;
+ } else if ( task == AliQAv1::kDIGITS ) {
+ if ( ! fDigitsQAList ) {
+ fDigitsQAList = new TObjArray *[AliRecoParam::kNSpecies] ;
+ for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+ fDigitsQAList[specie] = new TObjArray(100) ;
+ fDigitsQAList[specie]->SetName(Form("%s_%s_%s", GetName(), AliQAv1::GetTaskName(task).Data(), AliRecoParam::GetEventSpecieName(specie))) ;
+ }
+ InitDigits() ;
+ }
rv = fDigitsQAList ;
}
}
//____________________________________________________________________________
-void AliQADataMakerSim::Init(AliQA::TASKINDEX task, TObjArray * list, Int_t run, Int_t cycles)
+void AliQADataMakerSim::Init(AliQAv1::TASKINDEX_t task, TObjArray ** list, Int_t run, Int_t cycles)
{
// Intialisation by passing the list of QA data booked elsewhere
if (cycles > 0)
SetCycle(cycles) ;
- if ( task == AliQA::kHITS ) {
+ if ( task == AliQAv1::kHITS ) {
fHitsQAList = list ;
- } else if ( task == AliQA::kSDIGITS) {
+ } else if ( task == AliQAv1::kSDIGITS) {
fSDigitsQAList = list ;
- } else if ( task == AliQA::kDIGITS ) {
+ } else if ( task == AliQAv1::kDIGITS ) {
fDigitsQAList = list ;
}
}
//____________________________________________________________________________
-void AliQADataMakerSim::StartOfCycle(AliQA::TASKINDEX task, const Bool_t sameCycle)
+void AliQADataMakerSim::StartOfCycle(Int_t run)
+{
+ // Finishes a cycle of QA for all tasks
+ Bool_t samecycle = kFALSE ;
+ StartOfCycle(AliQAv1::kHITS, run, samecycle) ;
+ samecycle = kTRUE ;
+ StartOfCycle(AliQAv1::kSDIGITS, run, samecycle) ;
+ StartOfCycle(AliQAv1::kDIGITS, run, samecycle) ;
+}
+
+//____________________________________________________________________________
+void AliQADataMakerSim::StartOfCycle(AliQAv1::TASKINDEX_t task, Int_t run, const Bool_t sameCycle)
{
// Finishes a cycle of QA data acquistion
+ if ( run > 0 )
+ fRun = run ;
if ( !sameCycle || fCurrentCycle == -1) {
ResetCycle() ;
if (fOutput)
fOutput->Close() ;
- fOutput = AliQA::GetQADataFile(GetName(), fRun, fCurrentCycle) ;
+ 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() ;
-
- TObjArray * list = 0x0 ;
+ subDir = fDetectorDir->mkdir(AliQAv1::GetTaskName(task)) ;
- if ( task == AliQA::kHITS )
- list = fHitsQAList ;
- else if ( task == AliQA::kSDIGITS )
- list = fSDigitsQAList ;
- else if ( task == AliQA::kDIGITS )
- list = fDigitsQAList ;
-
- TIter next(list) ;
- TH1 * h ;
- while ( (h = dynamic_cast<TH1 *>(next())) )
- h->Reset() ;
-
+ for ( Int_t index = AliRecoParam::kDefault ; index < AliRecoParam::kNSpecies ; index++ ) {
+ TDirectory * eventSpecieDir = subDir->GetDirectory(AliRecoParam::GetEventSpecieName(index)) ;
+ if (!eventSpecieDir)
+ eventSpecieDir = subDir->mkdir(AliRecoParam::GetEventSpecieName(index)) ;
+ TDirectory * expertDir = eventSpecieDir->GetDirectory(AliQAv1::GetExpert()) ;
+ if (!expertDir)
+ expertDir = eventSpecieDir->mkdir(AliQAv1::GetExpert()) ;
+ }
StartOfDetectorCycle() ;
}