* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
-
-
-
-
//...
// Checks the quality assurance.
// By comparing with reference data
// Skeleton for T0
+//---------------------------------------------
+//checkig without reference data:
+//for RAW QA all histograms should have approximatly the same
+//number of entries as RefPoint
+//for Rec Points checks
+// - amplitude measured by 2 methos
+// - online and offline T0 measurements
+// for ESD quality of reconstruction ( and measurements):
+// RMS of vertex and T0 less than 75ps
+//
+// Alla.Maevskaya@cern.ch
//...
// --- ROOT system ---
#include <Riostream.h>
#include <TClass.h>
#include <TH1F.h>
-#include <TH1I.h>
+#include <TF1.h>
+#include <TFitResultPtr.h>
+#include <TH2.h>
#include <TIterator.h>
#include <TKey.h>
#include <TFile.h>
#include <TMath.h>
+#include <TString.h>
+#include <TPaveText.h>
// --- Standard library ---
// --- AliRoot header files ---
#include "AliLog.h"
-#include "AliQA.h"
+#include "AliQAv1.h"
#include "AliQAChecker.h"
+#include "AliCDBEntry.h"
+#include "AliQAManager.h"
#include "AliT0QAChecker.h"
ClassImp(AliT0QAChecker)
+//____________________________________________________________________________
+AliT0QAChecker::AliT0QAChecker() :
+AliQACheckerBase("T0","T0 Quality Assurance Checker")
+
+{
+ // Standard constructor
+
+}
+//____________________________________________________________________________
+AliT0QAChecker::AliT0QAChecker(const AliT0QAChecker& qac):
+ AliQACheckerBase(qac.GetName(), qac.GetTitle())
+{
+ // copy constructor
+ AliError("Copy should not be used with this class\n");
+}
+//____________________________________________________________________________
+AliT0QAChecker& AliT0QAChecker::operator=(const AliT0QAChecker& qac){
+ // assignment operator
+ this->~AliT0QAChecker();
+ new(this)AliT0QAChecker(qac);
+ return *this;
+}
+
+
+//____________________________________________________________________________
+AliT0QAChecker::~AliT0QAChecker(){
+ // destructor
+
+}
//__________________________________________________________________
-const Double_t AliT0QAChecker::Check(AliQA::ALITASK_t index,TObjArray * list)
+void AliT0QAChecker::Check(Double_t * test, AliQAv1::ALITASK_t index, TObjArray ** list, const AliDetectorRecoParam * /*recoParam*/)
{
// Super-basic check on the QA histograms on the input list:
// look whether they are empty!
+
+ char * detOCDBDir = Form("T0/%s/%s", AliQAv1::GetRefOCDBDirName(), AliQAv1::GetRefDataDirName()) ;
- cout<<" GetAliTaskName "<<AliQA::GetAliTaskName(index)<<" index "<<index<<endl;
-
-
- Double_t test = 10.0 ;
-
- Int_t count = 0 ;
- Double_t nent[200], nentraw[200];
- TString hname[200];
- const char *cname;
- memset(nent,0,200*sizeof(Double_t));
- Double_t w[200];
- memset(w,1,200*sizeof(Double_t));
- TH1 *fhRecLEDAmp[24]; TH1 * fhRecQTC[24];
- TH1 *fhOnlineMean = 0x0;
- TH1 * fhRecMean = 0x0;
- TH1 *fhESDMean = 0x0;
- TH1 *fhESDVertex = 0x0;
- TString dataType = AliQA::GetAliTaskName(index);
-
- if (list->GetEntries() == 0){
- test = 1. ; // nothing to check
+ AliCDBEntry *QARefRec = AliQAManager::QAManager()->Get(detOCDBDir);
+ // QARefRec->Dump();
+ if( !QARefRec){
+ AliInfo("QA reference data NOT retrieved for Reconstruction check. No T0 reference distribution");
}
- else {
-
- TIter next(list) ;
- TH1 * hdata ;
-
- count = 0 ;
- while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
- if (hdata) {
- nent[count] = hdata->GetEntries();
- cname = hdata->GetName();
- hname[count] = cname;
- AliDebug(10,Form("count %i %s -> %f",count, hname[count].Data(),nent[count])) ;
-
- if(index==2){
- if(count>23 && count<48)fhRecLEDAmp[count-24] = hdata;
- if(count>47 && count<72)fhRecQTC[count-48] = hdata;
- if(count == 72) fhOnlineMean = hdata;
- if(count == 73) fhRecMean = hdata;
- }
-
-
- if(index==3){
- printf(" check ESD count %i \n",count);
- if(count=0) fhESDMean = hdata;
- if(count=1) fhESDVertex = hdata;
- if(count>1){
- AliWarning("Unknowm ESD QA histograms");
- return 0;
- }
- }
- count++ ;
-
- Double_t rv = 0.;
- if(hdata->GetEntries()>0) rv = 1;
- // AliInfo(Form("%s -> %f", hdata->GetName(), rv)) ;
- test += rv ;
-
- }
- else{
- AliError("Data type cannot be processed") ;
- }
+
+ for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++)
+ test[specie] = 10.0 ;
+ for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+ // TString dataType = AliQAv1::GetAliTaskName(index);
+ if (!(AliQAv1::Instance()->IsEventSpecieSet(specie) && list[specie]) || list[specie]->GetEntries() == 0) {
+ test[specie] = 1. ; // nothing to check
+ continue;
}
-
- if (count != 0) {
- if (test==0) {
- AliWarning("Histograms are there, but they are all empty: setting flag to kWARNING");
- test = 0.5; //upper limit value to set kWARNING flag for a task
+ if (index == AliQAv1::kRAW && AliRecoParam::ConvertIndex(specie) == AliRecoParam::kCalib)
+ // if (index == AliQAv1::kRAW )
+ {
+ test[specie] = CheckRaw(list[specie]);
}
- else {
-
- if(index == 2){
- if ( TMath::Abs(fhRecMean->GetMean() - fhOnlineMean->GetMean()) > 5)
- AliWarning(Form("rec mean %f -> online mean %f",fhRecMean->GetMean(), fhOnlineMean->GetMean())) ;
- Double_t meanLED, meanQTC;
- for (Int_t idet=0; idet<24; idet++) {
- meanLED = fhRecLEDAmp[idet]->GetMean();
- meanQTC = fhRecQTC[idet]->GetMean();
- if (TMath::Abs(meanLED-meanQTC)> 1.)
- AliWarning(Form("Amplitude measurements are different in channel %i : Amp LED %f -> Amp QTC %f",idet,meanLED, meanQTC)) ;
- }
- }
-
-
- if (index == 0) {
- Int_t realNumber = Int_t(nent[0]);
- for (Int_t i=77; i<count; i++)
- {
- Double_t diff = TMath::Abs(nent[i]-realNumber);
- if (diff > 0.1*realNumber )
- AliWarning(Form("Problem in Number of entried in hist %s is %f\n",hname[i].Data() , nent[i])) ;
- }
- }
- if (index == 3) {
- Double_t rmsMeanTime = fhESDMean->GetRMS();
- if (rmsMeanTime>3)
- AliWarning(Form("Mean time with bad resolution, RMS= %f",rmsMeanTime)) ;
- Double_t rmsVertex = fhESDVertex->GetRMS();
- if (rmsVertex>3)
- AliWarning(Form("Vertex with bad resolution, RMS= %f",rmsVertex)) ;
- }
+ if (index == AliQAv1::kESD && AliRecoParam::Convert(specie) != AliRecoParam::kCalib)
+ test[specie] = CheckESD(list[specie]);
+ //
+ }
+}
+
+//--------------------------------------------------------------------------
+Double_t AliT0QAChecker::CheckRaw(TObjArray *listrec) const
+{
+ Float_t checkr = 0;
+
+ TString hname[10];
+ TH1*hdata;
+ const char *cname;
+ TH1 *fhRawEff[10];
+ Int_t nh=0;
- }
-
+
+ // Int_t nnn[4] = { 420, 458, 459, 460};
+ Int_t nnn[4] = { 170, 208, 209, 210};
+ for (Int_t ir=0; ir<4; ir++)
+ {
+ hdata = (TH1*) listrec->UncheckedAt(nnn[ir]);
+ if(hdata) {
+ cname = hdata->GetName();
+ hname[ir] = cname;
+ fhRawEff[nh] = hdata;
+ nh++;
+ }
}
+
+ TLine *linelowyellow = new TLine(0, 0.7, 24, 0.7);
+ linelowyellow->SetLineColor(5);
+ linelowyellow->SetLineStyle(3);
+ linelowyellow->SetLineWidth(4);
+ TLine *linelowred = new TLine(0, 0.2, 24, 0.2);
+ linelowred->SetLineColor(2);
+ linelowred->SetLineStyle(3);
+ linelowred->SetLineWidth(4);
+ Float_t thryell = 0.7;
+ // TPaveText* text = new TPaveText(0.30,0.50,0.99,0.99,"NDC");
+ Float_t thrred = 0.2;
+ Float_t chcont =0;
+ for (Int_t ih= 0; ih<4; ih++)
+ {
+ fhRawEff[ih]->SetLineWidth(2);
+ fhRawEff[ih]->SetMaximum(2.);
+ fhRawEff[ih]->SetMinimum(0.);
+ fhRawEff[ih]->GetListOfFunctions()->Add(linelowyellow);
+ fhRawEff[ih]->GetListOfFunctions()->Add(linelowred);
- } // if (list->GetEntries() != 0
-
- AliInfo(Form("Test Result = %f", test)) ;
+ Int_t nbins= fhRawEff[ih]->GetNbinsX();
+ Bool_t yell = kFALSE;
+ Bool_t red = kFALSE;
+ for (Int_t in=1; in<nbins-1; in++)
+ {
+ if(ih==0 && in==5) continue;
+ chcont=fhRawEff[ih]->GetBinContent(in);
+ if (chcont < thryell ) yell = kTRUE;
+ if (chcont < thrred ) red = kTRUE;
+ }
+
+ if (! yell && !red) {
+ AliDebug(AliQAv1::GetQADebugLevel(), Form(" efficiency in all channes %s is good", fhRawEff[ih]->GetName() ));
+ checkr=1.;
+ // text->AddText(Form("T0 RUN %d ",AliCDBManager::Instance()->GetRun()));
+ // text->AddText(Form(" No problems "));
+ // text->SetFillColor(3);
+ }
+
+ if(red ) {
+ checkr = 0.;
+ AliDebug(AliQAv1::GetQADebugLevel(), Form(" efficiency in all channes %s is not so good", fhRawEff[ih]->GetName() ));
+ // text->AddText(Form("T0 RUN %d ",AliCDBManager::Instance()->GetRun()));
+ // text->AddText(Form("Very serious problem, call expert "));
+ // text->SetFillColor(2);
+ }
+
+ if ( yell && !red) {
+ AliDebug(AliQAv1::GetQADebugLevel(), Form(" efficiency in all channes %s is not so good", fhRawEff[ih]->GetName() ));
+ checkr=0.75;
+ // text->AddText(Form("T0 RUN %d ",AliCDBManager::Instance()->GetRun()));
+ // text->AddText(Form("Some problems "));
+ // text->SetFillColor(5);
+ }
+ // fhRawEff[ih]->GetListOfFunctions()->Add(text);
- return test ;
+ }
+ return checkr;
+
}
+
+//--------------------------------------------------------------------------
+Double_t AliT0QAChecker::CheckESD(TObjArray *listrec ) const
+{
+ Float_t checkr = 0;
+ TH1 *fhESD;
+
+ fhESD = (TH1*) listrec->UncheckedAt(2);
+ if(fhESD){
+ AliDebug(AliQAv1::GetQADebugLevel(), Form("count %s ", fhESD->GetName()) );
+ TF1 *f1 = new TF1("f1","gaus",-1,1);
+ fhESD->Fit("f1","R","Q", -1,1);
+ Double_t par[3];
+ f1->GetParameters(&par[0]);
+
+ TPaveText* text = new TPaveText(0.30,0.50,0.99,0.99,"NDC");
+
+ text->AddText(Form("T0 RUN %d ",AliCDBManager::Instance()->GetRun()));
+
+ AliDebug(AliQAv1::GetQADebugLevel(), Form("numentries %d mean %f #sigma %f", (int)fhESD->GetEntries(),par[1], par[2]));
+
+
+ if (par[2] > 0.07 && par[2] < 1.) {
+ checkr=0.5;
+ text->AddText(Form("not good resolution :\n %f ns\n", par[2] ));
+ text->SetFillColor(5);
+ printf("T0 detector resolution is not good enouph: %f ns\n",par[2] );
+ }
+ if(TMath::Abs(par[1])>0.05) {
+ checkr = 0.5;
+ text->AddText(Form(" Check clock shift on %f ns", par[1]));
+ text->SetFillColor(5);
+ }
+ if (par[2] > 1. || TMath::Abs(par[1])>0.1) {
+ checkr = 0.25;
+ text->AddText(Form(" Bad resolution:\n mean %f ns sigma %f ns", par[1], par[2]));
+ text->SetFillColor(2);
+
+ fhESD->GetListOfFunctions()->Add(text);
+ AliDebug(AliQAv1::GetQADebugLevel(),
+ Form("Please, check calibration: shift= %f resolution %f test=%f\n",
+ par[1], par[2], checkr) ) ;
+ }
+ }
+ else
+ {
+ AliDebug(AliQAv1::GetQADebugLevel(),
+ Form("No ESD QA histogram found, nothing to check"));
+ checkr=0;
+ }
+
+
+ return checkr;
+}