]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
dont process if detector container not present in the qa file to avoid overwriting...
authormkrzewic <mikolaj.krzewicki@cern.ch>
Wed, 12 Mar 2014 23:22:50 +0000 (00:22 +0100)
committermkrzewic <mikolaj.krzewicki@cern.ch>
Wed, 12 Mar 2014 23:24:09 +0000 (00:24 +0100)
PWGPP/QA/scripts/runQA.sh
PWGPP/macros/simpleTrending.C

index 5767f6e046cce35720df672419a33775a7accb32..bbc467b6029b01dfec2d97ff3aced1a83f9cb1d2 100755 (executable)
@@ -69,6 +69,8 @@ updateQA()
   ################################################################
   #ze detector loop
   for detectorScript in $ALICE_ROOT/PWGPP/QA/detectorQAscripts/*; do
+    echo
+    echo "##############################################"
     unset planB
     [[ ! ${detectorScript} =~ .*\.sh$ ]] && continue
     detector=${detectorScript%.sh}
@@ -96,8 +98,6 @@ updateQA()
     cd ${tmpDetectorRunDir}
 
     tmpPrefix=${tmpDetectorRunDir}/${outputDir}
-    echo
-    echo "##############################################"
     echo "running QA for ${detector}"
     echo "  outputDir=$outputDir"
     echo "  tmpPrefix=$tmpPrefix"
@@ -114,6 +114,9 @@ updateQA()
     declare -A arrOfTouchedProductions
     while read qaFile; do
       echo
+      
+      #first check if input file exists
+      [[ ! -f ${qaFile%\#*} ]] && echo "file ${qaFile%\#*} not accessible" && continue
 
       if ! guessRunData ${qaFile}; then
         echo "could not guess run data from ${qaFile}"
@@ -129,8 +132,8 @@ updateQA()
       highPtTree=${qaFile}
 
       #maybe the input is not an archive, but a file
-      [[ "${qaFile}" =~ "QAresults.root" ]] && highPtTree=""
-      [[ "${qaFile}" =~ "FilterEvents_Trees.root" ]] && qaFile=""
+      [[ "${qaFile}" =~ QAresults.root$ ]] && highPtTree=""
+      [[ "${qaFile}" =~ FilterEvents_Trees.root$ ]] && qaFile=""
 
       #it is possible we get the highPt trees from somewhere else
       #search the list of high pt trees for the proper run number
@@ -164,9 +167,13 @@ updateQA()
         #perform some default actions:
         #if trending.root not created, create a default one
         if [[ ! -f trending.root ]]; then
-          aliroot -b -q -l "$ALICE_ROOT/PWGPP/macros/simpleTrending.C(\"${qaFile}\",${runNumber},\"${detector}\",\"trending.root\",\"trending\",\"recreate\")" &>> runLevelQA.log
+          aliroot -b -q -l "$ALICE_ROOT/PWGPP/macros/simpleTrending.C(\"${qaFile}\",${runNumber},\"${detector}\",\"trending.root\",\"trending\",\"recreate\")" 2>&1 | tee -a runLevelQA.log
+        fi
+        if [[ -f trending.root ]]; then
+          arrOfTouchedProductions[${tmpProductionDir}]=1
+        else
+          echo "trending.root not created"
         fi
-        arrOfTouchedProductions[${tmpProductionDir}]=1
       fi
       #expert QA based on high pt trees
       if [[ -n ${highPtTree} && $(type -t runLevelHighPtTreeQA) =~ "function" ]]; then
@@ -222,7 +229,7 @@ updateQA()
         mv -f ${dir} ${productionDir}
       done
    
-      #go to a temp dir to do the period level stuff
+      #go to a temp dir to do the period level stuff in a completely clean dir
       tmpPeriodLevelQAdir="${tmpProductionDir}/periodLevelQA"
       echo
       echo tmpPeriodLevelQAdir="${tmpProductionDir}/periodLevelQA"
@@ -282,7 +289,7 @@ updateQA()
     else
       executePlanB
     fi
-  done
+  done #end of detector loop
 
   #remove lock
   rm -f ${lockFile}
index 253a7299cca9cdcb1f50b7aa1eabe550406ab567..1683cf7aa99c83f8b04b14af42d7130e61f1d264 100644 (file)
@@ -1,10 +1,10 @@
-void processContainer(TObject* object, TTreeSRedirector* debugStreamer, TString name, TRegexp filterRegexp=".*");
+void processContainer(TObject* object, TTreeSRedirector* debugStreamer, TString name);
 void loadLibraries();
-void simpleTrending(TString inputFileName, Int_t run, TRegexp filterRegexp=".*", TString trendingFileName="trending.root", TString treeName="trending", TString fileOpenMode="update" );
+void simpleTrending(TString inputFileName, Int_t run, TString filterExpr=".*", TString trendingFileName="trending.root", TString treeName="trending", TString fileOpenMode="update" );
 
 TString treeName;
 
-void simpleTrending(TString inputFileName, Int_t run, TRegexp filterRegexp, TString trendingFileName, TString debugTreeName, TString fileOpenMode )
+void simpleTrending(TString inputFileName, Int_t run, TString filterExpr, TString trendingFileName, TString debugTreeName, TString fileOpenMode )
 {
 
   // Dump the statistical information about all histograms in the file
@@ -32,20 +32,41 @@ void simpleTrending(TString inputFileName, Int_t run, TRegexp filterRegexp, TStr
   
   TList * keyList = inputFile->GetListOfKeys();
   Int_t nkeys=keyList->GetEntries();
-  keyList->Print();
-  
-  TTreeSRedirector *pcstream = new TTreeSRedirector(trendingFileName,fileOpenMode);
-  (*pcstream)<<treeName.Data()<<"run="<<run;
+  TRegexp filterRegexp=filterExpr.Data();
 
-  //main loop over the top level objects, filtering is done here
+  //check if we have a matching container, only then create the output file
   TList* keyList=inputFile->GetListOfKeys();
   Int_t nkeys=keyList->GetEntries();
+  Bool_t containerExists=kFALSE;
+  for (Int_t i=0; i<nkeys; i++)
+  {
+    TObject* object=keyList->At(i);
+    if (!object) continue;
+    TString name=object->GetName();
+    if (name.Contains(filterRegexp))
+    {
+      containerExists=kTRUE;
+      break;
+    }
+  }
+  if (!containerExists) 
+  {
+    printf("container %s does not exist in %s\n",filterExpr.Data(),inputFileName.Data());
+    return;
+  }
+
+  TTreeSRedirector *pcstream = new TTreeSRedirector(trendingFileName,fileOpenMode);
+  (*pcstream)<<treeName.Data()<<"run="<<run;
+  
+  //main loop over the top level objects, filtering is done here
   for (Int_t i=0; i<nkeys; i++)
   {
     TObject * object = inputFile->Get(keyList->At(i)->GetName());
     if (!object) continue;
     TString name=object->GetName();
-    processContainer(object,pcstream,name,filterRegexp);
+    if (!name.Contains(filterRegexp)) continue;
+    processContainer(object,pcstream,name);
   }
   
   //
@@ -173,7 +194,7 @@ void simpleTrending(TString inputFileName, Int_t run, TRegexp filterRegexp, TStr
 
 }
 
-void processContainer(TObject* inputObject, TTreeSRedirector* pcstream, TString parentname, TRegexp filterRegexp)
+void processContainer(TObject* inputObject, TTreeSRedirector* pcstream, TString parentname)
 {
   //recursively process the contents of an object:
   //might be a TDirectory
@@ -185,7 +206,6 @@ void processContainer(TObject* inputObject, TTreeSRedirector* pcstream, TString
   TH1* inputHistogram=NULL;
   
   TString inputObjectName=inputObject->GetName();
-  if (!inputObjectName.Contains(filterRegexp)) return;
 
   //TDirectory* inputDir=dynamic_cast<TDirectory*>(inputObject);
   //TSeqCollection* inputCollection=dynamic_cast<TSeqCollection*>(inputObject);