]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Update for the status code related to the task #23161
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 11 Oct 2011 16:15:03 +0000 (16:15 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 11 Oct 2011 16:15:03 +0000 (16:15 +0000)
TRD/AliTRDPreprocessorOffline.cxx
TRD/AliTRDPreprocessorOffline.h

index c4d6693195739f4323489eea1c83ca1c6a839dba..00b43745ff2999e0ba47d6b09868a7d758273bcb 100644 (file)
@@ -46,6 +46,7 @@
 #include "TH1I.h"
 #include "TH2F.h"
 #include "TH1F.h"
+#include "TMath.h"
 #include "TProfile2D.h"
 #include "AliTRDCalDet.h"
 #include "AliTRDCalPad.h"
@@ -92,7 +93,8 @@ ClassImp(AliTRDPreprocessorOffline)
   fBackCorrectVdrift(kTRUE),
   fNotEnoughStatisticsForTheGain(kFALSE),
   fNotEnoughStatisticsForTheVdriftLinear(kFALSE),
-  fStatus(0)
+  fStatusNeg(0),
+  fStatusPos(0)
 {
   //
   // default constructor
@@ -147,11 +149,11 @@ void AliTRDPreprocessorOffline::CalibVdriftT0(const Char_t* file, Int_t startRun
   // 4. validate OCDB entries
   //
   if(fSwitchOnValidation==kTRUE && ValidateVdrift()==kFALSE) { 
-    AliError("TRD vdrift OCDB parameters out of range!");
+    //AliError("TRD vdrift OCDB parameters out of range!");
     fVdriftValidated = kFALSE;
   }
   if(fSwitchOnValidation==kTRUE && ValidateT0()==kFALSE) { 
-    AliError("TRD t0 OCDB parameters out of range!");
+    //AliError("TRD t0 OCDB parameters out of range!");
     fT0Validated = kFALSE;
   }
   //
@@ -195,7 +197,7 @@ void AliTRDPreprocessorOffline::CalibGain(const Char_t* file, Int_t startRunNumb
   // 4. validate OCDB entries
   //
   if(fSwitchOnValidation==kTRUE && ValidateGain()==kFALSE) { 
-    AliError("TRD gain OCDB parameters out of range!");
+    //AliError("TRD gain OCDB parameters out of range!");
     return;
   }
   //
@@ -235,7 +237,7 @@ void AliTRDPreprocessorOffline::CalibPRF(const Char_t* file, Int_t startRunNumbe
   // 4. validate OCDB entries
   //
   if(fSwitchOnValidation==kTRUE && ValidatePRF()==kFALSE) { 
-    AliError("TRD prf OCDB parameters out of range!");
+    //AliError("TRD prf OCDB parameters out of range!");
     return;
   }
   //
@@ -270,7 +272,7 @@ void AliTRDPreprocessorOffline::CalibChamberStatus(Int_t startRunNumber, Int_t e
   // 4. validate OCDB entries
   //
   if(fSwitchOnValidation==kTRUE && ValidateChamberStatus()==kFALSE) { 
-    AliError("TRD Chamber status OCDB parameters not ok!");
+    //AliError("TRD Chamber status OCDB parameters not ok!");
     return;
   }
   //
@@ -307,7 +309,8 @@ Bool_t AliTRDPreprocessorOffline::Init(const Char_t* fileName){
 
   }
    
-  if((fVersionVdriftUsed == 0) && (fVersionGainUsed == 0)) fStatus = -1;
+  if(fVersionVdriftUsed == 0) fStatusPos = fStatusPos |kVdriftErrorOld;
+  if(fVersionGainUsed == 0) fStatusPos = fStatusPos | kGainErrorOld;
 
   return kTRUE;
   
@@ -470,14 +473,15 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeGain(){
        fPlots->AddAt(coefGain,kGain);
        // 
        ok = kTRUE;
-       fStatus += 1000000;
+       fStatusNeg = fStatusNeg | kGainNotEnoughStatsButFill;
       }
       else {
-       fStatus += 1000;
+       fStatusPos = fStatusPos | kGainErrorOld;
       }      
     }
     else {
-      fStatus += 1000;
+      if(gainoverallnotnormalized <= 0.0) fStatusNeg = fStatusNeg | kGainNotEnoughStatsNotFill;
+      if(!fCalDetGainUsed) fStatusPos = fStatusPos | kGainErrorOld;
     }
   }
   
@@ -537,7 +541,7 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeVdriftT0(){
     ok = kTRUE;
   }
   else {
-    fStatus += 100;
+    fStatusNeg = fStatusNeg | kTimeOffsetNotEnoughStatsNotFill;
   }
   calibra->ResetVectorFit();
  
@@ -609,11 +613,16 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeVdriftLinearFit(){
        fPlots->AddAt(coefDriftLinear,kVdriftLinear);
        // 
        ok = kTRUE;
-       fStatus += 10000;
+       fStatusNeg = fStatusNeg | kVdriftNotEnoughStatsButFill;
       }
-      else fStatus += 1;      
+      else {
+       fStatusPos = fStatusPos | kVdriftErrorOld;
+      }      
+    }
+    else {
+      if(vdriftoverall <= 0.0) fStatusNeg = fStatusNeg | kVdriftNotEnoughStatsNotFill;
+      if(!fCalDetVdriftUsed) fStatusPos = fStatusPos | kVdriftErrorOld;
     }
-    else fStatus += 1;
   }
   
   calibra->ResetVectorFit();
@@ -999,7 +1008,7 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeChamberStatus()
      if((mean > 0.2) && (mean < 1.4) && (rms < 0.5)) return kTRUE;
      //if((mean > 0.2) && (mean < 1.4)) return kTRUE;
      else {
-       fStatus += 1000000000;
+       fStatusPos = fStatusPos | kGainErrorRange;
        return kFALSE;
      }
    }
@@ -1025,7 +1034,7 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeChamberStatus()
      Double_t rms = calDet->GetRMSRobust();
      //printf("Vdrift::mean %f, rms %f\n",mean,rms);
      if(!((mean > 1.0) && (mean < 2.0) && (rms < 0.5))) {
-       fStatus += 10000000;
+       fStatusPos = fStatusPos | kVdriftErrorRange;
        ok = kFALSE;
      }
    }
@@ -1038,7 +1047,7 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeChamberStatus()
        Double_t rms = calPad->GetRMS();
        //printf("Vdrift::meanpad %f, rmspad %f\n",mean,rms);
        if(!((mean > 0.9) && (mean < 1.1) && (rms < 0.6))) {
-        fStatus += 10000000;
+        fStatusPos = fStatusPos | kVdriftErrorRange;
         ok = kFALSE;
        }
      }
@@ -1064,7 +1073,7 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeChamberStatus()
      //printf("T0::minimum %f, rmsdet %f,meanpad %f, rmspad %f\n",meandet,rmsdet,meanpad,rmspad);
      if((meandet > -1.5) && (meandet < 5.0) && (rmsdet < 4.0) && (meanpad < 5.0) && (meanpad > -0.5)) return kTRUE;
      else {
-       fStatus += 100000000;
+       fStatusPos = fStatusPos | kTimeOffsetErrorRange;
        return kFALSE;
      }
    }
@@ -1090,7 +1099,7 @@ Bool_t AliTRDPreprocessorOffline::AnalyzeChamberStatus()
 
  }
  //__________________________________________________________________________________________________________________________
-Bool_t AliTRDPreprocessorOffline::ValidateChamberStatus() const{
+Bool_t AliTRDPreprocessorOffline::ValidateChamberStatus(){
   //
   // Update OCDB entry
   //
@@ -1102,7 +1111,10 @@ Bool_t AliTRDPreprocessorOffline::ValidateChamberStatus() const{
       if(calChamberStatus->IsMasked(det)) detectormasked++;
     }
     //printf("Number of chambers masked %d\n",detectormasked);
-    if(detectormasked > 40) return kFALSE;
+    if(detectormasked > 40) {
+      fStatusPos = fStatusPos | kChamberStatusErrorRange;
+      return kFALSE;
+    }
     else return kTRUE;
   }
   else return kFALSE;
@@ -1199,4 +1211,52 @@ Int_t AliTRDPreprocessorOffline::GetFirstRun(TString name) const
   return -1;
 
 }
+//_____________________________________________________________________________
+Bool_t AliTRDPreprocessorOffline::CheckStatus(Int_t status, Int_t bitMask) const
+{
+  //
+  // Checks the status
+  //
+
+  return (status & bitMask) ? kTRUE : kFALSE;
+  
+}
+//_____________________________________________________________________________
+Int_t AliTRDPreprocessorOffline::GetStatus() const
+{
+  //
+  // Checks the status
+  // fStatusPos: errors
+  // fStatusNeg: only info
+  //
+
+  if(fStatusPos > 0) return fStatusPos;
+  else return (-TMath::Abs(fStatusNeg));
+  
+}
+//_____________________________________________________________________________
+void AliTRDPreprocessorOffline::PrintStatus() const
+{
+  //
+  // Do Summary
+  //
+
+  AliInfo(Form("The error status is %d",fStatusPos));
+  AliInfo(Form("IsGainErrorOld? %d",(Int_t)IsGainErrorOld()));
+  AliInfo(Form("IsVdriftErrorOld? %d",(Int_t)IsVdriftErrorOld()));
+  AliInfo(Form("IsGainErrorRange? %d",(Int_t)IsGainErrorRange()));
+  AliInfo(Form("IsVdriftErrorRange? %d",(Int_t)IsVdriftErrorRange()));
+  AliInfo(Form("IsTimeOffsetErrorRange? %d",(Int_t)IsTimeOffsetErrorRange()));
+  AliInfo(Form("IsChamberStatusErrorRange? %d",(Int_t)IsChamberStatusErrorRange()));
+
+  AliInfo(Form("The info status is %d",fStatusNeg));
+  AliInfo(Form("IsGainNotEnoughStatsButFill? %d",(Int_t)IsGainNotEnoughStatsButFill()));
+  AliInfo(Form("IsVdriftNotEnoughStatsButFill? %d",(Int_t)IsVdriftNotEnoughStatsButFill()));
+  AliInfo(Form("IsGainNotEnoughStatsNotFill? %d",(Int_t)IsGainNotEnoughStatsNotFill()));
+  AliInfo(Form("IsVdriftNotEnoughStatsNotFill? %d",(Int_t)IsVdriftNotEnoughStatsNotFill()));
+  AliInfo(Form("IsTimeOffsetNotEnoughStatsNotFill? %d",(Int_t)IsTimeOffsetNotEnoughStatsNotFill()));
+  
+}
+
 
index 895846677d1bed4bc89cdc49a5837a2f447bec68..6ce41bdc58f19e074e7d7d0441df992a770ec416 100644 (file)
@@ -35,10 +35,41 @@ public:
       kChamberStatus = 7,
       kPRF = 8
       };   
-  
+  enum { kGainNotEnoughStatsButFill = 2, kVdriftNotEnoughStatsButFill = 4, kGainNotEnoughStatsNotFill = 8, kVdriftNotEnoughStatsNotFill = 16, kTimeOffsetNotEnoughStatsNotFill = 32};  
+  enum { kGainErrorOld = 2, kVdriftErrorOld = 4, kGainErrorRange = 8, kVdriftErrorRange = 16, kTimeOffsetErrorRange = 32, kChamberStatusErrorRange = 64};  
+
+
   AliTRDPreprocessorOffline();
   virtual ~AliTRDPreprocessorOffline();
 
+  Bool_t      IsGainNotEnoughStatsButFill() const 
+    { return CheckStatus(fStatusNeg, kGainNotEnoughStatsButFill);  };
+  Bool_t      IsGainNotEnoughStatsNotFill() const 
+    { return CheckStatus(fStatusNeg, kGainNotEnoughStatsNotFill);  };
+  Bool_t      IsVdriftNotEnoughStatsButFill() const 
+    { return CheckStatus(fStatusNeg, kVdriftNotEnoughStatsButFill);  };
+  Bool_t      IsVdriftNotEnoughStatsNotFill() const 
+    { return CheckStatus(fStatusNeg, kVdriftNotEnoughStatsNotFill);  };
+  Bool_t      IsTimeOffsetNotEnoughStatsNotFill() const 
+    { return CheckStatus(fStatusNeg, kVdriftNotEnoughStatsNotFill);  };
+  
+  Bool_t      IsGainErrorOld() const 
+    { return CheckStatus(fStatusPos, kGainErrorOld);  };
+  Bool_t      IsVdriftErrorOld() const 
+    { return CheckStatus(fStatusPos, kVdriftErrorOld);  };
+  Bool_t      IsGainErrorRange() const 
+    { return CheckStatus(fStatusPos, kGainErrorRange);  };
+  Bool_t      IsVdriftErrorRange() const 
+    { return CheckStatus(fStatusPos, kVdriftErrorRange);  };
+  Bool_t      IsTimeOffsetErrorRange() const 
+    { return CheckStatus(fStatusPos, kTimeOffsetErrorRange);  };
+  Bool_t      IsChamberStatusErrorRange() const 
+    { return CheckStatus(fStatusPos, kChamberStatusErrorRange);  };
+  
+  Bool_t      CheckStatus(Int_t status, Int_t bitMask) const;
+  void PrintStatus() const;
+
+
   void SetLinearFitForVdrift(Bool_t methodsecond) { fMethodSecond = methodsecond;};
   Bool_t GetLinearFitForVdrift() const { return fMethodSecond;};
   void SetNameList(TString nameList) { fNameList = nameList;};
@@ -81,9 +112,11 @@ public:
   Bool_t ValidateVdrift();
   Bool_t ValidateT0();
   Bool_t ValidatePRF() const;
-  Bool_t ValidateChamberStatus() const;
+  Bool_t ValidateChamberStatus();
 
-  Int_t    GetStatus() const                                         { return fStatus;                 }
+  Int_t    GetStatus() const;
+  Int_t    GetStatusPos() const                                      { return fStatusPos;              }
+  Int_t    GetStatusNeg() const                                      { return fStatusNeg;              }
   Int_t    GetVersionGainUsed() const                                { return fVersionGainUsed;        }
   Int_t    GetSubVersionGainUsed() const                             { return fSubVersionGainUsed;     }
   Int_t    GetFirstRunVdriftUsed() const                             { return fFirstRunVdriftUsed;     }
@@ -128,7 +161,8 @@ public:
   Bool_t   fBackCorrectVdrift;            // Back correction afterwards vdrift
   Bool_t   fNotEnoughStatisticsForTheGain;// Take the chamber per chamber distribution from the default distribution
   Bool_t   fNotEnoughStatisticsForTheVdriftLinear;// Take the chamber per chamber distribution from the default distribution
-  Int_t    fStatus;                       // Status of the TRD offline preprocessor: -1 nothing but do not worry; 0 everything ok; 1 not enough stat vdrift, 2 not enough stat to, 3 not enough stat gain and chammber status, 4 not enough stat vdrift but could put a mean, 5 not enough stat gain but could put a mean
+  Int_t    fStatusNeg;                    // Info but ok
+  Int_t    fStatusPos;                    // Problems
 
 
   Int_t GetSubVersion(TString name) const;