Changes for new automatized QA framework
authorcholm <Christian.Holm.Christensen@cern.ch>
Mon, 22 Sep 2014 13:15:24 +0000 (15:15 +0200)
committercholm <Christian.Holm.Christensen@cern.ch>
Mon, 22 Sep 2014 13:15:24 +0000 (15:15 +0200)
PWGLF/FORWARD/analysis2/qa/CheckQAFile.C
PWGLF/FORWARD/analysis2/qa/PeriodQA.C
PWGLF/FORWARD/analysis2/qa/QABase.h
PWGLF/FORWARD/analysis2/qa/QATrender.C
PWGLF/FORWARD/analysis2/qa/RunQA.C
PWGLF/FORWARD/analysis2/qa/RunQAMT.sh
PWGLF/FORWARD/analysis2/qa/periodQA.sh
PWGLF/FORWARD/analysis2/qa/runQA.sh

index 92dbdca..ad1a41e 100644 (file)
@@ -14,7 +14,7 @@
  * 
  * @ingroup pwglf_forward_qa_scripts
  */
-void CheckQAFile(const char* filename)
+void CheckQAFile(const char* filename, const char* type="")
 {
   int    ret  = 0;
   TFile* file = TFile::Open(filename, "READ");
@@ -22,15 +22,29 @@ void CheckQAFile(const char* filename)
     Error("CheckQAFile", "No such file %s", filename);
     exit(1);
   }
-  TObject* forward1 = file->Get("Forward");
+  TString check    = Form("Forward%s",type);
+  TString check2;
+  TObject* forward1 = file->Get(check);
   if (!forward1) {
-    Error("CheckQAFile", "No Forward object found in %s", filename);
-    ret |= 2;
+    check2    = Form("Forward%sSums",type);
+    forward1 = file->Get(Form("Forward%sSums",type));
+    if (!forward1) {
+      Error("CheckQAFile", "No %s or %s object found in %s", 
+           check.Data(),check2.Data(), filename);
+      ret |= 2;
+    }
   } 
-  TObject* forward2 = file->Get("ForwardResults");
+  check = Form("Forward%sResults", type);
+  TObject* forward2 = file->Get(check);
   if (!forward2) {
-    Error("CheckQAFile", "No ForwardResults object found in %s", filename);
-    ret |= 4;
+    check2   = Form("forward%sResults",type);
+    forward2 = file->Get(check2);
+    if (!forward2) { 
+      Error("CheckQAFile", "No %s or %s object found in %s", 
+           check.Data(), check2.Data(), filename);
+      file->ls();
+      ret |= 4;
+    }
   } 
   file->Close();
   exit(ret);
index fc2c36d..305c476 100644 (file)
@@ -41,12 +41,20 @@ PeriodQA(const char* input,
         const char* pass) 
 {
   Bool_t useVar = true;
-  gROOT->SetMacroPath(Form(".:$(ANA_SRC)/qa:$(ANA_SRC)/corrs:"
-                          "$(ALICE_ROOT)/PWGLF/FORWARD/analysis2/qa:"
-                          "$(ALICE_ROOT)/PWGLF/FORWARD/analysis2/corrs:"
-                          "%s",
-                          gROOT->GetMacroPath()));
-  gSystem->AddIncludePath("-I${ALICE_ROOT}/PWGLF/FORWARD/analysis2/qa");
+  TString fwd(gSystem->Getenv("QA_FWD"));
+  TString mac(gROOT->GetMacroPath());
+  if (!fwd.IsNull()) {
+    mac.Prepend(Form(".:%s:",fwd.Data()));
+    gSystem->AddIncludePath(Form("-I%s", fwd.Data()));
+  }
+  else { 
+    fwd = gSystem->Getenv("ANA_SRC");
+    if (fwd.IsNull()) 
+      fwd = "$(ALICE_ROOT)/PWGLF/FORWARD/analysis2";
+    mac.Prepend(Form(".:%s/qa:%s/corrs:",fwd.Data(), fwd.Data()));
+    gSystem->AddIncludePath(Form("-I%s/qa", fwd.Data()));
+  }
+  gROOT->SetMacroPath(mac);
   gSystem->Load("libGpad");
   gSystem->Load("libTree");
 
index 44c993b..28dbb15 100644 (file)
@@ -421,7 +421,7 @@ struct QABase
           << "</ul>" << std::endl;
     if (fPeriod.IsNull()) return;
     Bool_t isMC = (fDataType.EqualTo("sim", TString::kIgnoreCase) || 
-                  fPass.StartsWith("passMC", TString::kIgnoreCase));
+                  fPass.BeginsWith("passMC", TString::kIgnoreCase));
     *fHtml << "<ul>\n"
           << " <li><a href='https://alimonitor.cern.ch/" 
           <<  (isMC ? "job_details.jsp" : "production/raw.jsp") 
index 1815fb9..8097310 100644 (file)
@@ -754,7 +754,13 @@ public:
   void CleanStack(THStack* stack, const char* what)
   {
     TList*   l = stack->GetHists();
-
+    if (!l || l->GetEntries() <= 0) {
+      Warning("CleanStack", "No histograms in stack %s", stack->GetName());
+      return;
+    }
+    Printf("Stack to clean %s", stack->GetName());
+    l->ls();
+    
     // Clean up list of histogram.  Histograms with no entries or 
     // no functions are deleted.  We have to do this using the TObjLink 
     // objects stored in the list since ROOT cannot guaranty the validity 
@@ -804,6 +810,10 @@ public:
       THStack* stacks[] = { chi2, c, delta, xi, sigma, 0 };
       for (int i = 0; i < 5; i++) { 
        THStack*     stack = stacks[i];
+       if (!stack->GetHists() || stack->GetHists()->GetEntries() < 0) {
+         Warning("", "No histograms in stack %s", stack->GetName());
+         continue;
+       }
        TVirtualPad* p     = GetPad(i+1);
        // stack->GetHists()->ls();
 
@@ -1165,9 +1175,17 @@ public:
     const char* folder = "ForwardResults";
     TList* forward = static_cast<TList*>(fCurrentFile->Get(folder));
     if (!forward) { 
-      Error("GetLists", "List %s not found in %s", folder, 
-           fCurrentFile->GetName());
-      return false;
+      const char* folder2 = "ForwardQAResults";
+      forward = static_cast<TList*>(fCurrentFile->Get(folder2));
+      if (!forward) { 
+       const char* folder3 = "forwardQAResults";
+       forward = static_cast<TList*>(fCurrentFile->Get(folder3));
+       if (!forward) {
+         Error("GetLists", "List %s/%s/%s not found in %s", 
+               folder, folder2, folder3, fCurrentFile->GetName());
+         return false;
+       }
+      }
     }
     
     fEventInspector    = GetSubList(forward, "fmdEventInspector");
index 54cf415..4d39686 100644 (file)
@@ -43,12 +43,20 @@ RunQA(const char* input,
       Long_t      runNo) 
 {
   Bool_t keep = true;
-  gROOT->SetMacroPath(Form(".:$(ANA_SRC)/qa:$(ANA_SRC)/corrs:"
-                          "$(ALICE_ROOT)/PWGLF/FORWARD/analysis2/qa:"
-                          "$(ALICE_ROOT)/PWGLF/FORWARD/analysis2/corrs:"
-                          "%s",
-                          gROOT->GetMacroPath()));
-  gSystem->AddIncludePath("-I${ALICE_ROOT}/PWGLF/FORWARD/analysis2/qa");
+  TString fwd(gSystem->Getenv("QA_FWD"));
+  TString mac(gROOT->GetMacroPath());
+  if (!fwd.IsNull()) {
+    mac.Prepend(Form(".:%s:",fwd.Data()));
+    gSystem->AddIncludePath(Form("-I%s", fwd.Data()));
+  }
+  else { 
+    fwd = gSystem->Getenv("ANA_SRC");
+    if (fwd.IsNull()) 
+      fwd = "$(ALICE_ROOT)/PWGLF/FORWARD/analysis2";
+    mac.Prepend(Form(".:%s/qa:%s/corrs:",fwd.Data(), fwd.Data()));
+    gSystem->AddIncludePath(Form("-I%s/qa", fwd.Data()));
+  }
+  gROOT->SetMacroPath(mac);
   gSystem->Load("libGpad");
   gSystem->Load("libTree");
 
index e38f6f2..641cf9f 100755 (executable)
@@ -1,16 +1,19 @@
 #!/bin/bash
 #
-# This script runs the Forward QA for the specified production number
+# This script runs the Forwardqq QA for the specified production number
 #
 # The scripts downloads and runs the single run QA in parallel 
 #
 
 # --- Some aux files -------------------------------------------------
-style=$ALICE_ROOT/PWGLF/FORWARD/analysis2/qa/style.css 
-favicon=$ALICE_ROOT/PWGLF/FORWARD/analysis2/qa/fmd_favicon.png
-logo=$ALICE_ROOT/PWGLF/FORWARD/analysis2/qa/fmd_logo.png
-script=$ALICE_ROOT/PWGLF/FORWARD/analysis2/qa/script.js
-topmk=$ALICE_ROOT/PWGLF/FORWARD/analysis2/qa/makeIndex.sh
+if test "X$QA_FWD" = "X" ; then 
+    QA_FWD=$ALICE_ROOT/PWGLF/FORWARD/analysis2/qa
+fi 
+style=${QA_FWD}/style.css 
+favicon=${QA_FWD}/fmd_favicon.png
+logo=${QA_FWD}/fmd_logo.png
+script=${QA_FWD}/script.js
+topmk=${QA_FWD}/makeIndex.sh
 
 # --- Check AliEn token ----------------------------------------------
 check_token()
@@ -184,8 +187,19 @@ get_filelist()
        esdd= 
     fi 
 
+    local post=${passpost}
+    case x$post in 
+       x_*) ;; 
+       x) ;; 
+       *) post="_${post}" ;; 
+    esac
+
     local paid=
-    if echo "$passno" | grep -q -E '^[0-9]*[.]?[0-9]*$' ; then 
+    if test "x${passpre}pass${passno}${post}" != "x$passfull" ; then 
+       passpre=
+       paid=${passfull}
+       post=
+    elif echo "$passno" | grep -q -E '^[0-9]*[.]?[0-9]*$' ; then 
        if test "x$passfull" != "x" && test $passno -gt 0 ; then 
            paid=pass${passno}
        fi
@@ -196,12 +210,6 @@ get_filelist()
     fi
     passid=${paid}
     if test $mc -gt 0 ; then passid="passMC" ; fi 
-    local post=${passpost}
-    case x$post in 
-       x_*) ;; 
-       x) ;; 
-       *) post="_${post}" ;; 
-    esac
 
     local search=
     if test "x$path" = "x" ; then 
@@ -263,8 +271,8 @@ check_file()
 {
     if test $docheck -lt 1 ; then return 0; fi 
     root -l -b  <<EOF >> ${redir} 2>&1 
-.L $ALICE_ROOT/PWGLF/FORWARD/analysis2/qa/CheckQAFile.C
-CheckQAFile("$1");
+.L ${QA_FWD}/CheckQAFile.C
+CheckQAFile("$1","QA");
 .q
 EOF
     local ret=$? 
@@ -296,9 +304,10 @@ analyse_file()
     mess 3 "runQA.sh '$inp' '$type' '$prodyear' '$prodfull' '$passid' '$r'"
     (cd $dir 
        for i in QABase QAPlotter QARing QAStructs QATrender ; do 
+           rm -f ${i}*
            ln -s ../${i}* . 
        done 
-       $ALICE_ROOT/PWGLF/FORWARD/analysis2/qa/runQA.sh \
+       ${QA_FWD}/runQA.sh \
            "$inp" "$type" $prodyear "$prodfull" "$passid" "$r" > runQA.log 2>&1
        ret=$? ) 
     if test ! -f $dir/trending.root ; then ret=1 ; fi
@@ -469,7 +478,7 @@ make_trend()
        rm -f trending.root 
        hadd -k trending.root 000*/trending.root 
        if test $? -eq 0 && test -f trending.root ; then 
-         $ALICE_ROOT/PWGLF/FORWARD/analysis2/qa/periodQA.sh trending.root 
+         ${QA_FWD}/periodQA.sh trending.root 
          ret=$?
        else 
          ret=1
@@ -641,7 +650,7 @@ fi
 
 # --- Copy scripts to target and compile -----------------------------
 for i in QABase.h QAPlotter.C QARing.h QAStructs.h QATrender.C ; do
-    cp $ALICE_ROOT/PWGLF/FORWARD/analysis2/qa/$i ${store}/${i}
+    cp ${QA_FWD}/$i ${store}/${i}
     rm -f ${store}/`echo $i | tr '.' '_'`.{so,d}
     fix_perm ${store}/${i}
 done
index ddca54a..3163ab0 100755 (executable)
@@ -1,17 +1,18 @@
 #!/bin/sh
-fwd=${ALICE_ROOT}/PWGLF/FORWARD/analysis2
-fwd=$ANA_SRC
+if test "X$QA_FWD" = "X" ; then 
+    QA_FWD=$ALICE_ROOT/PWGLF/FORWARD/analysis2/qa
+fi 
 
 # 1: file
 # 2: data type 
 # 3: year
 # 4: period
 # 5: pass 
-aliroot -l -b -q ${fwd}/qa/PeriodQA.C\(\"$1\",\"\",0,\"\",\"\"\)
-cp ${fwd}/qa/style.css .
-cp ${fwd}/qa/script.js .
-cp ${fwd}/qa/fmd_favicon.png . 
-cp ${fwd}/qa/fmd_logo.png .
+aliroot -l -b -q ${QA_FWD}/PeriodQA.C\(\"$1\",\"\",0,\"\",\"\"\)
+cp ${QA_FWD}/style.css .
+cp ${QA_FWD}/script.js .
+cp ${QA_FWD}/fmd_favicon.png . 
+cp ${QA_FWD}/fmd_logo.png .
 
 
 #
index e2a2b19..78aa413 100755 (executable)
@@ -1,8 +1,7 @@
 #!/bin/sh
-fwd=${ALICE_ROOT}/PWGLF/FORWARD/analysis2
-if test "X$ANA_SRC" != "X" ; then 
-    fwd=$ANA_SRC
-fi
+if test "X$QA_FWD" = "X" ; then 
+    QA_FWD=$ALICE_ROOT/PWGLF/FORWARD/analysis2/qa
+fi 
 
 # 1: file
 # 2: data type 
@@ -10,11 +9,11 @@ fi
 # 4: period
 # 5: pass 
 # 6: run
-aliroot -l -b -q ${fwd}/qa/RunQA.C\(\"$1\",\"$2\",$3,\"$4\",\"$5\",$6\)
-cp ${fwd}/qa/style.css .
-cp ${fwd}/qa/script.js .
-cp ${fwd}/qa/fmd_favicon.png . 
-cp ${fwd}/qa/fmd_logo.png .
+aliroot -l -b -q ${QA_FWD}/RunQA.C\(\"$1\",\"$2\",$3,\"$4\",\"$5\",$6\)
+cp ${QA_FWD}/style.css .
+cp ${QA_FWD}/script.js .
+cp ${QA_FWD}/fmd_favicon.png . 
+cp ${QA_FWD}/fmd_logo.png .
 
 #
 # EOF