]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - T0/AliT0QAChecker.cxx
add AliT0TriggerParameters
[u/mrichter/AliRoot.git] / T0 / AliT0QAChecker.cxx
index 7e52865a44a7523533a22e6b99773d4934d31e24..5fbfc2f114588e8fddc13241dc2837bb4d0f26a7 100644 (file)
  * 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 <TH2.h> 
 #include <TIterator.h> 
 #include <TKey.h> 
 #include <TFile.h> 
 #include <TMath.h>
+#include <TString.h>
 
 // --- Standard library ---
 
 // --- AliRoot header files ---
 #include "AliLog.h"
-#include "AliQA.h"
+#include "AliQAv1.h"
 #include "AliQAChecker.h"
 #include "AliT0QAChecker.h"
 
 ClassImp(AliT0QAChecker)
 
-//__________________________________________________________________
-AliT0QAChecker& AliT0QAChecker::operator = (const AliT0QAChecker& qac )
+
+//____________________________________________________________________________
+Double_t * AliT0QAChecker::Check(AliQAv1::ALITASK_t /*index*/)
 {
-  // Equal operator.
-  this->~AliT0QAChecker();
-  new(this) AliT0QAChecker(qac);
-  return *this;
+  Double_t * rv = new Double_t[AliRecoParam::kNSpecies] ; 
+  for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) 
+    rv[specie] = 0.0 ; 
+  return rv ;  
 }
-//__________________________________________________________________
 
-const Double_t AliT0QAChecker::Check(TObjArray * list)
+//__________________________________________________________________
+Double_t * AliT0QAChecker::Check(AliQAv1::ALITASK_t index,TObjArray ** list)
 {
 
   // Super-basic check on the QA histograms on the input list:
   // look whether they are empty!
 
-  Double_t test = 0.0  ;
-  Int_t count = 0 ;
-  Double_t nent[100];
-  memset(nent,0,100*sizeof(Double_t));
-  Double_t w[100];
-  memset(w,1.,100*sizeof(Double_t));
-
-
-  if (list->GetEntries() == 0){
-    test = 1. ; // nothing to check
-  }
-  else {
-    
-    TIter next(list) ;
+  Double_t * test = new Double_t[AliRecoParam::kNSpecies] ; 
+  for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) 
+    test[specie]    = 10.0 ; 
+
+  Double_t nent[250];
+  TString hname[250];
+  const char *cname;
+  memset(nent,0,250*sizeof(Double_t));
+  Double_t w[250];
+  memset(w,1,250*sizeof(Double_t));
+  TH2 *fhRecDiff[3];  
+  TH2 *fhRawEff[250];
+  TH1 *fhESD[2];
+  
+  for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+    //  TString dataType = AliQAv1::GetAliTaskName(index);
+    if (list[specie]->GetEntries() == 0){
+      test[specie] = 1. ; // nothing to check
+    }
+    else {
+    TIter next(list[specie]) ;
     TH1 * hdata ;
-    count = 0 ;
-    while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
-      if (hdata) {
-       nent[count] = hdata->GetEntries();
-               AliDebug(1,Form("count %i %s -> %f",count, hdata->GetName(),nent[count])) ;
-
-        Double_t rv = 0.;
-        if(hdata->GetEntries()>0) rv = 1;
-        count++ ;
-        test += rv ;
-       
+    TH2 * h ;
+    //  AliDebug(AliQAv1::GetQADebugLevel(), Form(" data type %i %s nentries %i\n",
+    //    index,dataType.Data(),list->GetEntries()));
+    for (Int_t ir=0; ir<list[specie]->GetEntries(); ir++) {
+      //raw
+      if(index==0 ){
+        /*
+         if(ir < 205) {
+         hdata = (TH1*) list[specie]->UncheckedAt(ir);
+         if(hdata) {
+         cname = hdata->GetName();
+         hname[ir] = cname;
+         AliDebug(AliQAv1::GetQADebugLevel(),Form("count %i %s \n",ir, hname[ir].Data())) ;
+         fhRaw[ir] = hdata;
+         }
+         }*/
+        if(ir > 204) {
+          //     else{
+          h = (TH2*) list[specie]->UncheckedAt(ir);
+          AliDebug(AliQAv1::GetQADebugLevel(), Form(" index %i ir %i \n", index,ir));
+          if(h) {
+            cname = h->GetName();
+            hname[ir] = cname;
+            AliDebug(AliQAv1::GetQADebugLevel(),Form("count %i %s \n",ir, hname[ir].Data())) ;
+            fhRawEff[ir] = h;
+          }
+        }
       }
-      else{
-        AliError("Data type cannot be processed") ;
+     
+      //rec
+      if(index==2){
+        h = (TH2*) list[specie]->UncheckedAt(ir);
+        if(h) {
+          cname = h->GetName();
+          hname[ir] = cname;
+          AliDebug(AliQAv1::GetQADebugLevel(), Form("count %i %s \n",ir, hname[ir].Data())) ;
+          fhRecDiff[ir] = h;
+        }
+      }
+      //esd
+      if(index==3){
+       // cout<<" ir "<<ir<<endl;
+        hdata = (TH1*) list[specie]->UncheckedAt(ir);
+        if(hdata){
+          fhESD[ir] = hdata;
+          AliDebug(AliQAv1::GetQADebugLevel(), Form("count %i %s ",ir, hname[ir].Data()) );
+        }
       }
-
     }
-
-    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 == 0) {
+        //raw data
+       
+        for (Int_t icase=205; icase<207; icase++) {
+          for (Int_t idet=0; idet<24; idet++) {
+            Double_t mean = fhRawEff[icase]->ProjectionY(Form("%s_py_%i_%i",
+                                                              fhRawEff[icase]->GetName(), idet,icase),
+                                                              idet,idet+1)->GetMean();
+            Double_t rms= fhRawEff[icase]->ProjectionY(Form("%s_py%i_%i", 
+                                                            fhRawEff[icase]->GetName(), idet,icase),
+                                                            idet,idet+1)->GetRMS();
+            AliDebug(AliQAv1::GetQADebugLevel(), Form("name %s icase %i idet %i mean %f, rms %f\n",
+                    fhRawEff[icase]->GetName(), icase, idet, mean,rms));
+            if (mean<1.2 && mean> 0.8 ) {
+              test[specie] = 1;
+              AliDebug(AliQAv1::GetQADebugLevel(), Form("All channels works meane efficieny %f with rms %f test %f",  mean, rms, test[specie])) ; 
+            }
+            if (mean<=0.8 && mean>= 0.5 ){
+              test[specie] = 0.5;
+              AliDebug(AliQAv1::GetQADebugLevel(), Form("%s problem in channel %i  efficieny %f test %f",
+                              fhRawEff[icase]->GetName(), idet,  mean, test[specie])) ; 
+            }
+            if (mean<0.5 ) { 
+              test[specie] = 0.25;
+              AliDebug(AliQAv1::GetQADebugLevel(), Form("%s big problem in channel %i  efficieny %f test %f",
+                              fhRawEff[icase]->GetName(), idet,  mean, test[specie])) ; 
+            }
+          }
+        }
       }
-      else {
-        test /= count ;
-       AliDebug(10,Form(" MaxElement %f ", TMath::MaxElement(count,nent)));    
-       if(TMath::MaxElement(count,nent) > 1000) {
-       Double_t mean = TMath::Mean(count,nent,w);
-       AliDebug(10,Form(" Mean %f ", mean));   
-       for (Int_t i=0; i<count; i++) 
-         {
-           Double_t diff = TMath::Abs(nent[i]-mean);
-           if (diff > 0.1*mean )
-             AliInfo(Form("Problem in Number of entried in hist %i  is %f\n", i, nent[i])) ; 
-         }
-       }
+      if(index == 2){
+        //rec points
+        for (Int_t icase=0; icase<2; icase++) {
+          for (Int_t idet=0; idet<24; idet++) {
+            Double_t mean = fhRecDiff[icase]->
+            ProjectionY(Form("%s_py", fhRecDiff[icase]->GetName()),
+                        idet,idet+1)->GetMean();
+            Double_t rms= fhRecDiff[icase]->
+            ProjectionY(Form("%s_py", fhRecDiff[icase]->GetName()),
+                        idet,idet+1)->GetRMS();
+            AliDebug(AliQAv1::GetQADebugLevel(), Form("name %s icase %i idet %i mean %f, rms %f\n",
+                         fhRecDiff[icase]->GetName(), icase, idet, mean,rms)); 
+                 
+            if(TMath::Abs(mean) >1.5 || rms >1){
+              AliDebug(AliQAv1::GetQADebugLevel(), Form(" calibration is nor perfect; test=%f", test)) ;
+              test[specie]=0.25;
+            }
+            if(mean>3 || rms >5) {
+              test[specie] = 0.1;
+              AliDebug(AliQAv1::GetQADebugLevel(), Form(" wrong calibration test=%f", test[specie])) ;
+            } 
+          }
+        }       
       }
-    }
-  }
-  AliInfo(Form("Test Result = %f", test)) ;
+      if (index == 3) {
+        //ESD
+        for (Int_t icase=0; icase<2; icase++) {
+          Double_t rmsVertex = fhESD[icase]->GetRMS();
+          Double_t meanVertex = fhESD[icase]->GetMean();
+          test[specie]=1;
+          AliDebug(AliQAv1::GetQADebugLevel(), Form("numentries %d meanVertex %f rmsVertex %f", fhESD[icase]->GetEntries(), meanVertex, rmsVertex));
+          if (TMath::Abs(rmsVertex)>3) {
+            test[specie]=0.25;
+            AliDebug(AliQAv1::GetQADebugLevel(), Form("Vertex position resolution not good  , rms= %f test=%f",
+                            rmsVertex, test[specie])) ; 
+          }
+          if (TMath::Abs(meanVertex)>3) {
+            test[specie]=0.25;
+            AliDebug(AliQAv1::GetQADebugLevel(), Form("Vertex position bad calibrated  , Mean= %f test=%f",
+                            meanVertex, test[specie])) ; 
+          }
+        }
+      }
+    } //  if (list->GetEntries() != 0
+    AliDebug(AliQAv1::GetQADebugLevel(), Form("Test Result = %f", test[specie])) ;
+  } 
   return test ;
 }
+