#include "AliQAChecker.h"
#include "AliVZEROQAChecker.h"
#include "AliVZEROQADataMakerRec.h"
-//#include "AliCDBEntry.h"
-//#include "AliCDBManager.h"
ClassImp(AliVZEROQAChecker)
-//____________________________________________________________________________
-Double_t * AliVZEROQAChecker::Check(AliQAv1::ALITASK_t /*index*/)
+//__________________________________________________________________
+AliVZEROQAChecker::AliVZEROQAChecker() : AliQACheckerBase("VZERO","VZERO Quality Assurance Data Checker"),
+ fLowEventCut(1000),
+ fORvsANDCut(0.2),
+ fBGvsBBCut(0.2)
{
- Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ;
- for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
- rv[specie] = 0.0 ;
- return rv ;
+ // Default constructor
+ // Nothing else here
}
//__________________________________________________________________
-Double_t * AliVZEROQAChecker::Check(AliQAv1::ALITASK_t index, TObjArray ** list)
+void AliVZEROQAChecker::Check(Double_t * check, AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/)
{
+ // Main check function: Depending on the TASK, different checks will be applied
+ // Check for missing channels and check on the trigger type for raw data
+ // Check for missing disk or rings for esd (to be redone)
-// Main check function: Depending on the TASK, different checks will be applied
-// Check for empty histograms
-
-// AliDebug(AliQAv1::GetQADebugLevel(),Form("AliVZEROChecker"));
-// AliCDBEntry *QARefRec = AliCDBManager::Instance()->Get("VZERO/QARef/RAW");
-// if( !QARefRec){
-// AliDebug(AliQAv1::GetQADebugLevel(), "QA reference data NOT retrieved for QA check...");
-// return 1.;
-// }
-
-// Check that histos are filled - (FATAL) set if empty
- Double_t * check = new Double_t[AliRecoParam::kNSpecies] ;
for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
- check[specie] = 1.0 ;
+ check[specie] = 1.0;
+ // no check on cosmic or calibration events
+ if (AliRecoParam::ConvertIndex(specie) == AliRecoParam::kCosmic || AliRecoParam::ConvertIndex(specie) == AliRecoParam::kCalib)
+ continue;
if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) )
- continue ;
- if(CheckEntries(list[specie]) == 0.0){
- check[specie] = CheckEntries(list[specie]);
- } else {
- // Check for one disk missing (FATAL) or one ring missing (ERROR) in ESDs
- if(index == AliQAv1::kESD)
- check[specie] = CheckEsds(list[specie]);
+ continue;
+ if (index == AliQAv1::kRAW) {
+ check[specie] = CheckRaws(list[specie]);
+ } else if (index == AliQAv1::kESD) {
+ // Check for one disk missing (FATAL) or one ring missing (ERROR) in ESDs (to be redone)
+ check[specie] = CheckEsds(list[specie]);
}
}
- return check;
}
//_________________________________________________________________
-Double_t AliVZEROQAChecker::CheckEntries(TObjArray * list) const
+Double_t AliVZEROQAChecker::CheckRaws(TObjArray * list) const
{
- // check on the QA histograms on the input list: list
-// list->Print();
-
- Double_t test = 0.0 ;
- Int_t count = 0 ;
+ // Check on the QA histograms on the raw-data input list:
+ // Two things are checked: the presence of data in all channels and
+ // the ratio between different trigger types
+ Double_t test = 1.0;
if (list->GetEntries() == 0){
- test = 1.0;
- AliDebug(AliQAv1::GetQADebugLevel(), Form("There are NO ENTRIES to be checked..."));
+ AliWarning("There are no histograms to be checked");
} else {
- TIter next(list) ;
- TH1 * hdata ;
- count = 0 ;
- while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
- if (hdata) {
- Double_t rv = 0.0;
- if(hdata->GetEntries()>0) rv=1.0;
-// AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv));
- count++ ; // number of histos
- test += rv ; // number of histos filled
- }else{
- AliError(Form("Data type cannot be processed"));
- }
- }
- if (count != 0) {
- if (test==0.0) {
- AliWarning(Form("Histograms are BOOKED for this specific task, but they are all EMPTY"));
- } else {
- test /= count;
- }
- }
+ TH1F *hTriggers = (TH1F*)list->At(AliVZEROQADataMakerRec::kTriggers);
+ if (!hTriggers) {
+ AliWarning("Trigger type histogram is not found");
+ }
+ else if (hTriggers->GetEntries() < fLowEventCut) {
+ AliInfo("Not enough events to perform QA checks");
+ }
+ else {
+ Double_t nANDs = hTriggers->GetBinContent(hTriggers->FindBin(0));
+ Double_t nORs = hTriggers->GetBinContent(hTriggers->FindBin(1));
+ Double_t nBGAs = hTriggers->GetBinContent(hTriggers->FindBin(2));
+ Double_t nBGCs = hTriggers->GetBinContent(hTriggers->FindBin(3));
+ if ((nORs - nANDs) > fORvsANDCut*nANDs) test = 0.001;
+ if ((nBGAs + nBGCs) > fBGvsBBCut*nANDs) test = 0.002;
+ }
+ TH1F *hBBflags = (TH1F*)list->At(AliVZEROQADataMakerRec::kBBFlagsPerChannel);
+ if (!hBBflags) {
+ AliWarning("BB-flags per channel histogram is not found");
+ }
+ else if (hBBflags->GetEntries() < fLowEventCut) {
+ AliInfo("Not enough events to perform QA checks");
+ }
+ else {
+ for(Int_t iBin = 1; iBin <= 64; ++iBin) {
+ if (hBBflags->GetBinContent(iBin) < 1.0) test = -1.0;
+ }
+ }
}
return test ;
}
{
// check the ESDs for missing disk or ring
-
// printf(" Number of entries in ESD list = %d\n", list->GetEntries());
// list->Print();
Double_t test = 1.0; // initialisation to OK
- Int_t histo_nb = 0;
- Double_t Mult_V0A = 0.0;
- Double_t Mult_V0C = 0.0;
- Double_t V0A_BB_Ring[4], V0C_BB_Ring[4];
- Double_t V0A_BG_Ring[4], V0C_BG_Ring[4];
+ Int_t histonb = 0;
+ Double_t multV0A = 0.0;
+ Double_t multV0C = 0.0;
+ Double_t v0ABBRing[4], v0CBBRing[4];
+ Double_t v0ABGRing[4], v0CBGRing[4];
for (Int_t i=0; i<4; i++) {
- V0A_BB_Ring[i]= V0C_BB_Ring[i]= 0.0;
- V0A_BG_Ring[i]= V0C_BG_Ring[i]= 0.0;
+ v0ABBRing[i]= v0CBBRing[i]= 0.0;
+ v0ABGRing[i]= v0CBGRing[i]= 0.0;
}
TIter next(list) ;
TH1 * hdata ;
while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
if (hdata) {
- switch (histo_nb) {
+ switch (histonb) {
case AliVZEROQADataMakerRec::kCellMultiV0A:
- Mult_V0A = hdata->GetMean();
+ multV0A = hdata->GetMean();
break;
case AliVZEROQADataMakerRec::kCellMultiV0C:
- Mult_V0C = hdata->GetMean();
+ multV0C = hdata->GetMean();
break;
case AliVZEROQADataMakerRec::kBBFlag:
for (Int_t i=0; i<8; i++) {
- if(i<4) V0C_BB_Ring[i] = hdata->Integral((i*8)+1, (i*8) +8);
- else V0A_BB_Ring[i-4] = hdata->Integral((i*8)+1, (i*8) +8);
+ if(i<4) v0CBBRing[i] = hdata->Integral((i*8)+1, (i*8) +8);
+ else v0ABBRing[i-4] = hdata->Integral((i*8)+1, (i*8) +8);
}
break;
case AliVZEROQADataMakerRec::kBGFlag:
for (Int_t i=0; i<8; i++) {
- if(i<4) V0C_BG_Ring[i] = hdata->Integral((i*8)+1, (i*8) +8);
- else V0A_BG_Ring[i-4] = hdata->Integral((i*8)+1, (i*8) +8);
+ if(i<4) v0CBGRing[i] = hdata->Integral((i*8)+1, (i*8) +8);
+ else v0ABGRing[i-4] = hdata->Integral((i*8)+1, (i*8) +8);
}
break;
}
}
- histo_nb++;
+ histonb++;
}
- if(Mult_V0A == 0.0 || Mult_V0C == 0.0) {
+ if(multV0A == 0.0 || multV0C == 0.0) {
AliWarning(Form("One of the two disks is missing !") );
test = 0.0; // bit FATAL set
}
- if( V0A_BB_Ring[0]+V0A_BG_Ring[0] == 0.0 ||
- V0A_BB_Ring[1]+V0A_BG_Ring[1] == 0.0 ||
- V0A_BB_Ring[2]+V0A_BG_Ring[2] == 0.0 ||
- V0A_BB_Ring[3]+V0A_BG_Ring[3] == 0.0 ||
- V0C_BB_Ring[0]+V0C_BG_Ring[0] == 0.0 ||
- V0C_BB_Ring[1]+V0C_BG_Ring[1] == 0.0 ||
- V0C_BB_Ring[2]+V0C_BG_Ring[2] == 0.0 ||
- V0C_BB_Ring[3]+V0C_BG_Ring[3] == 0.0 ){
+ if( v0ABBRing[0]+v0ABGRing[0] == 0.0 ||
+ v0ABBRing[1]+v0ABGRing[1] == 0.0 ||
+ v0ABBRing[2]+v0ABGRing[2] == 0.0 ||
+ v0ABBRing[3]+v0ABGRing[3] == 0.0 ||
+ v0CBBRing[0]+v0CBGRing[0] == 0.0 ||
+ v0CBBRing[1]+v0CBGRing[1] == 0.0 ||
+ v0CBBRing[2]+v0CBGRing[2] == 0.0 ||
+ v0CBBRing[3]+v0CBGRing[3] == 0.0 ){
AliWarning(Form("One ring is missing !") );
test = 0.1; // bit ERROR set
}
lowValue[AliQAv1::kFATAL] = -1.0 ;
hiValue[AliQAv1::kFATAL] = 0.0 ;
SetHiLo(hiValue, lowValue) ;
+ delete [] hiValue;
+ delete [] lowValue;
}
//______________________________________________________________________________