]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ITS/AliITSQASPDChecker.cxx
Avoid numerical problems in calc. if eff. mass.
[u/mrichter/AliRoot.git] / ITS / AliITSQASPDChecker.cxx
index 4fb407fe611d847ba1cf51f0b5769067a7b99bff..d0c96557f867d974876c7b583e38c1be8187ef09 100644 (file)
@@ -27,6 +27,7 @@
 
 // --- AliRoot header files ---
 #include "AliITSQASPDChecker.h"
+#include "AliITSQADataMakerRec.h"
 #include "AliLog.h"
 
 ClassImp(AliITSQASPDChecker)
@@ -41,13 +42,20 @@ AliITSQASPDChecker& AliITSQASPDChecker::operator = (const AliITSQASPDChecker& qa
 
 
 //__________________________________________________________________
-const Double_t AliITSQASPDChecker::Check(AliQA::ALITASK_t /*index*/, TObjArray * list)
+Double_t AliITSQASPDChecker::Check(AliQAv1::ALITASK_t index, TObjArray * list, const AliDetectorRecoParam * /*recoParam*/)
 {
-  AliDebug(1,Form("AliITSQASPDChecker called with offset: %d\n", fSubDetOffset));
+//
+// General methods for SPD Cheks to be used in RAWS and REC ALITASK_t
+//
+
+  AliDebug(2, Form("AliITSQASPDChecker called with offset: %d\n", fSubDetOffset));
 
   Double_t test = 0.0;
   Int_t count = 0;
-
+  // Checks for ALITASK_t AliQAv1::kRAW
+  if(index == AliQAv1::kRAW) {
+  return CheckRawData(list);
+  } else {
   if (list->GetEntries() == 0) {
     test = 1.; // nothing to check
   }
@@ -64,10 +72,10 @@ const Double_t AliITSQASPDChecker::Check(AliQA::ALITASK_t /*index*/, TObjArray *
         if (histName.Contains("LayPattern")) {
          if (hdata->GetBinContent(1)) {
            Double_t ratio=hdata->GetBinContent(2)/hdata->GetBinContent(1);
-           AliInfo(Form("%s: ratio RecPoints lay2 / lay1 = %f", hdata->GetName(), ratio));
+           AliDebug(2, Form("%s: ratio RecPoints lay2 / lay1 = %f", hdata->GetName(), ratio));
          }
          else
-           AliInfo("No RecPoints in lay1");
+           AliDebug(AliQAv1::GetQADebugLevel(), "No RecPoints in lay1");
        }
         else if(histName.Contains("ModPattern")) {
            Int_t ndead=0;
@@ -75,7 +83,7 @@ const Double_t AliITSQASPDChecker::Check(AliQA::ALITASK_t /*index*/, TObjArray *
              if(histName.Contains("SPD1") && ibin<80 && hdata->GetBinContent(ibin+1)>0) ndead++;
              if(histName.Contains("SPD2") && ibin>79 && hdata->GetBinContent(ibin+1)>0) ndead++;
            }
-           AliInfo(Form("%s: Entries = %d  number of empty modules = %d", 
+           AliDebug(2, Form("%s: Entries = %d  number of empty modules = %d", 
                         hdata->GetName(),(Int_t)hdata->GetEntries(),ndead));
         }
         else if(histName.Contains("SizeYvsZ")) {
@@ -83,14 +91,14 @@ const Double_t AliITSQASPDChecker::Check(AliQA::ALITASK_t /*index*/, TObjArray *
            Double_t meany=hdata->GetMean(2);
            Double_t rmsz=hdata->GetRMS(1);
            Double_t rmsy=hdata->GetRMS(2);
-           AliInfo(Form("%s: Cluster sizeY mean = %f  rms = %f", hdata->GetName(),meany,rmsy));
-           AliInfo(Form("%s: Cluster sizeZ mean = %f  rms = %f", hdata->GetName(),meanz,rmsz));
+           AliDebug(AliQAv1::GetQADebugLevel(), Form("%s: Cluster sizeY mean = %f  rms = %f", hdata->GetName(),meany,rmsy));
+           AliDebug(AliQAv1::GetQADebugLevel(), Form("%s: Cluster sizeZ mean = %f  rms = %f", hdata->GetName(),meanz,rmsz));
         }
-        else if(histName.Contains("Multiplicity")) {
-           AliInfo(Form("%s: Events = %d  mean = %f  rms = %f",
+        else if(histName.Contains("SPDMultiplicity")) {
+           AliDebug(2, Form("%s: Events = %d  mean = %f  rms = %f",
                         hdata->GetName(),(Int_t)hdata->GetEntries(),hdata->GetMean(),hdata->GetRMS()));}
 
-        // else AliInfo(Form("%s -> %f", hdata->GetName(), rv));
+       // else AliDebug(AliQAv1::GetQADebugLevel(), Form("%s -> %f", hdata->GetName(), rv));
         count++;
         test += rv;
       }
@@ -100,23 +108,111 @@ const Double_t AliITSQASPDChecker::Check(AliQA::ALITASK_t /*index*/, TObjArray *
     }
 
     if (count != 0) {
-      if (test==0) {
+      if (AliITSQADataMakerRec::AreEqual(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
+        test = fHighSPDValue[AliQAv1::kWARNING];  //upper limit value to set kWARNING flag for a task
       }
       else {
         test /= count;
       }
     }
   }
-
-  AliInfo(Form("Test Result = %f", test));
+}
+  AliDebug(AliQAv1::GetQADebugLevel(), Form("Test Result = %f", test));
   return test ;
 
 }
+//__________________________________________________________________
+Double_t AliITSQASPDChecker::CheckRawData(const TObjArray * list) {
+//
+// Checks on the raw data histograms [ preliminary version ]
+// The output of this method is the fraction of SPD histograms which are processed by the checker. 
+// The methods returns fHighSPDValue[AliQAv1::kFATAL] in case of data format errors or MEB errors
+// 
+// A. Mastroserio
+
+Double_t test =0;
+
+// basic checks on input data
+if(!list) {
+ AliError("NO histogram list for RAWS");
+ return test;
+ }
+
+ if(list->GetEntries() == 0) {
+ AliWarning("No histograms in RAW list \n");
+ return test;
+ }
+
+// loop over the raw data histograms
+TIter next(list);
+TH1 * hdata;
+Double_t totalHistos = 0;
+Double_t goodHistos = 0; // number of histograms which passed the checks
+Double_t response =0;
+Bool_t fatalProblem = kFALSE;
+
+while ( (hdata = dynamic_cast<TH1 *>(next())) ) {
+if (hdata) {
+        TString histName = hdata->GetName();
+        if(!histName.Contains("SPD")) continue;
+        totalHistos++;
+        // data format error
+        if(histName.Contains("SPDErrorsAll")){
+        if(hdata->Integral(0,hdata->GetNbinsX())>0){
+           response = fHighSPDValue[AliQAv1::kFATAL];
+          fatalProblem=kTRUE;
+           break;
+         }
+        }
+        // MEB error
+        if(histName.Contains("MEB")){
+          if(hdata->GetEntries()>0){
+          AliWarning("************* MEB ERROR!!!! ****************\n");
+           response = fHighSPDValue[AliQAv1::kFATAL];
+          fatalProblem=kTRUE;
+           break;
+          }
+         }
+        goodHistos++;
+        }
+}
+    if(!fatalProblem) response = goodHistos/totalHistos;
+   // printf("n histos %f - good ones %f ----> ratio %f , fatal response %i\n",totalHistos,goodHistos,goodHistos/totalHistos,(Int_t)fatalProblem);
+    return response;
+}
 
 //__________________________________________________________________
 void AliITSQASPDChecker::SetTaskOffset(Int_t TaskOffset)
 {
+// Offset for SPD within ITS QA
   fSubDetOffset = TaskOffset;
 }
+
+//__________________________________________________________________
+void AliITSQASPDChecker::SetStepBit(const Double_t *steprange) 
+{
+// Step bit for SPD within ITS QA
+  fStepBitSPD = new Double_t[AliQAv1::kNBIT];
+  for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
+    {
+      fStepBitSPD[bit]=steprange[bit];
+    }
+}
+
+
+//__________________________________________________________________
+void  AliITSQASPDChecker::SetSPDLimits(const Float_t *lowvalue, const Float_t * highvalue)
+{
+// SPD limints for QA bit within general ITS QA
+  fLowSPDValue = new Float_t[AliQAv1::kNBIT];
+  fHighSPDValue= new Float_t[AliQAv1::kNBIT];
+
+  for(Int_t bit=0;bit<AliQAv1::kNBIT;bit++)
+    {
+      fLowSPDValue[bit]=lowvalue[bit];
+      fHighSPDValue[bit]= highvalue[bit];
+    }
+
+}
+