]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Creation of the calibration summary files on Alien
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 8 Jul 2010 14:41:05 +0000 (14:41 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 8 Jul 2010 14:41:05 +0000 (14:41 +0000)
(Stefan)

TPC/scripts/OCDBscan/jdl/CalibSummary.jdl [new file with mode: 0644]
TPC/scripts/OCDBscan/jdl/ConfigOCDB.C [new file with mode: 0644]
TPC/scripts/OCDBscan/jdl/HowTo-CalibSummary.txt [new file with mode: 0644]
TPC/scripts/OCDBscan/jdl/runCalibSummary.C [new file with mode: 0644]
TPC/scripts/OCDBscan/jdl/runCalibSummary.sh [new file with mode: 0755]
TPC/scripts/OCDBscan/jdl/validation.sh [new file with mode: 0755]

diff --git a/TPC/scripts/OCDBscan/jdl/CalibSummary.jdl b/TPC/scripts/OCDBscan/jdl/CalibSummary.jdl
new file mode 100644 (file)
index 0000000..da5983b
--- /dev/null
@@ -0,0 +1,24 @@
+
+Executable="/alice/cern.ch/user/s/srossegg/bin/runCalibSummary.sh";
+
+Packages = "VO_ALICE@AliRoot::v4-19-19-AN";
+
+JDLVariables={"Packages", "OutputDir"};
+
+TTL = "7200";
+Price = 1;
+
+Validationcommand ="/alice/cern.ch/user/s/srossegg/CalibSummary/validation.sh";
+
+Arguments = "$1";
+
+InputFile={"LF:/alice/cern.ch/user/s/srossegg/CalibSummary/runCalibSummary.C", 
+           "LF:/alice/cern.ch/user/s/srossegg/CalibSummary/ConfigOCDB.C"
+};
+
+OutputDir="/alice/cern.ch/user/s/srossegg/CalibSummary/output/$1/";
+
+OutputFile = {"*.root"};
+
+OutputArchive={"log_archive:*.log@disk=1",
+              "root_archive.zip:*.root,@disk=1"};
diff --git a/TPC/scripts/OCDBscan/jdl/ConfigOCDB.C b/TPC/scripts/OCDBscan/jdl/ConfigOCDB.C
new file mode 100644 (file)
index 0000000..a5aff48
--- /dev/null
@@ -0,0 +1,41 @@
+//
+// Macro to Setup OCDB for calibration scan
+// By default - all entries taken from the AliEn OCDB storage 
+// This is just example macro
+// Responsible: marian.ivanov@cern.ch
+
+
+void ConfigOCDB(Int_t run=-1){
+  // 
+  printf("SETUP OCBD for TPC\n");
+  //
+  AliCDBManager::Instance()->SetDefaultStorage("raw://");  
+
+  printf("setting run to %d\n",run);
+  if (run<0) run =0;
+  AliCDBManager::Instance()->SetRun(run);
+
+  // magnetic field
+  if ( !TGeoGlobalMagField::Instance()->GetField() ) {
+    printf("Loading field map...\n");
+    AliGRPManager grpMan;
+    if( !grpMan.ReadGRPEntry() ) {
+      printf("Cannot get GRP entry\n");
+    }
+    if( !grpMan.SetMagField() ) {
+      printf("Problem with magnetic field setup\n");
+    }
+  }
+  if ( !TGeoGlobalMagField::Instance()->GetField()){
+    AliMagF::BMap_t smag = AliMagF::k5kG;
+    Double_t bzfac = 1;
+    AliMagF* magF= new AliMagF("Maps","Maps", bzfac, 1., smag);
+    TGeoGlobalMagField::Instance()->SetField(magF);
+  }
+
+  AliTPCcalibDB::Instance()->SetRun(run); 
+}
+
+
+
diff --git a/TPC/scripts/OCDBscan/jdl/HowTo-CalibSummary.txt b/TPC/scripts/OCDBscan/jdl/HowTo-CalibSummary.txt
new file mode 100644 (file)
index 0000000..d71f5e4
--- /dev/null
@@ -0,0 +1,97 @@
+NOTE: for all the steps, you need a valid alien certificate (obviously ;-) )
+alien-token-init
+source /tmp/gclient_env_$USERID
+
+
++++++++ STEP 1 +++++++++++++
+
+Create a run.list file which contains the run number in which you 
+are interested in:
+
+see for example: $ALICE_ROOT/TPC/scripts/OCDBscan/makeRunList.sh
+
+####################
+#!/bin/sh
+# find a list of runs which have the following OCDB entries
+# GRP, HV, ALTRO
+
+prefix=/alice/data/2010/OCDB/
+
+alien_find $prefix/GRP/GRP/Data Run > grpAlien.txt
+alien_find $prefix/TPC/Calib/HighVoltage Run > hvAlien.txt
+alien_find $prefix/TPC/Calib/AltroConfig Run > altroAlien.txt
+
+cat grpAlien.txt | sed s/_/\ /g | gawk '{ print $2}' | sort > grp.txt
+cat hvAlien.txt | sed s/_/\ /g | gawk '{ print $2}'  | sort > hv.txt
+cat altroAlien.txt | sed s/_/\ /g | gawk '{ print $2}'  | sort > altro.txt
+
+for run in `cat hv.txt | sort`; do
+   grun=`cat grp.txt | grep -c $run`
+   arun=`cat altro.txt | grep -c $run`   
+   if [ $grun -gt 0 ] && [ $arun -gt 0 ]; then
+      echo $run
+   fi 
+done > runList.txt
+# clean up
+rm grpAlien.txt hvAlien.txt altroAlien.txt grp.txt hv.txt altro.txt
+
+###################
+
++++++++ STEP 2 +++++++++++++
+
+Submit the alienjobs (one job per run)
+but skip already existing entries ...
+Note1: PATHtoOUTPUT is usually defined in your jdl!
+
+Note2: check your job status with e.g. `alien_ps`
+
+
+####################
+#!/bin/sh
+# submit an alienjob per entry in the runList.txt
+
+PATHtoOUTPUT="/alice/cern.ch/user/s/srossegg/CalibSummary/output/"
+
+for RUN in `cat runList.txt`; do
+alien_find $PATHtoOUTPUT run$RUN       
+    entry=`alien_find $PATHtoOUTPUT run$RUN`
+    if [ "$entry" = "" ]
+       then
+       echo "Submitting job to produce the calib summary for run $RUN"
+       alien_submit CalibSummary.jdl $RUN
+    else
+       echo "The calib summary for run $RUN was already created! Skipping entry ..."
+    fi
+
+done;
+
+###################
+
++++++++ STEP 3 +++++++++++++
+
+print a list of all the produced calibSummary entries and copy them to 
+a local directory (if wished)
+
+###################
+#!/bin/sh
+# list and copy the created calibSummary files ...
+
+PATHtoOUTPUT="/alice/cern.ch/user/s/srossegg/CalibSummary/output/"
+alien_find $PATHtoOUTPUT calibSum
+
+# copy them to one direcotory
+ENTRIES=`alien_find $PATHtoOUTPUT calibSum | grep calibSum`
+COPYPATH="./"
+for ENTRY in $ENTRIES; do
+    alien_cp alien:$ENTRY $COPYPATH 
+done;
+
+##### don't do the following if you are not sure #######
+
+# or delete the entries on alien
+ENTRIES=`alien_find $PATHtoOUTPUT calibSum | grep calibSum`
+for ENTRY in $ENTRIES; do
+    alien_erase $ENTRY
+done;
+
+###################
diff --git a/TPC/scripts/OCDBscan/jdl/runCalibSummary.C b/TPC/scripts/OCDBscan/jdl/runCalibSummary.C
new file mode 100644 (file)
index 0000000..f5727fd
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+
+  runCalibSummary.C
+  Macro to extract TPC calibration summary information
+  Example:
+  .L runCalibSummary.C
+  runCalibSummary(119037);
+
+*/
+
+void runCalibSummary(TString runNumberString ="0")
+{
+
+  Int_t irun = runNumberString.Atoi();
+
+  // Load libraries
+  gSystem->Load("libANALYSIS");
+  gSystem->Load("libTPCcalib");
+
+  // Configure OCDB
+  gROOT->LoadMacro("ConfigOCDB.C");
+  ConfigOCDB(irun); 
+  // run extraction of the calibration summary ...
+  AliTPCcalibSummary *calibSummary = new AliTPCcalibSummary;
+  calibSummary->ProcessRun(irun);
+  delete calibSummary;
+  
+  return;
+}
diff --git a/TPC/scripts/OCDBscan/jdl/runCalibSummary.sh b/TPC/scripts/OCDBscan/jdl/runCalibSummary.sh
new file mode 100755 (executable)
index 0000000..02de6b7
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# Script to run Calibration Summary Extraction for the TPC :
+# Arguments:
+#    1  - run number 
+
+# example:
+# runCalibSummary.sh 119037
+
+runnum=$1
+
+echo
+echo Run number to be processed $runnum
+echo
+export GCLIENT_SERVER_LIST="pcapiserv04.cern.ch:10000|pcapiserv05.cern.ch:10000|pcapiserv06.cern.ch:10000|pcapiserv07.cern.ch:10000"
+echo ===========================
+echo ">>>>>>>>> PATH is..."
+echo $PATH
+echo ">>>>>>>>> ROOTSYS is..."
+echo $ROOTSYS
+echo ">>>>>>>>> LD_LIBRARY_PATH is..."
+echo $LD_LIBRARY_PATH
+echo ==========================
+echo
+
+echo ">>>>>>> Running AliRoot to extract calibration summary..."
+aliroot -l -b -q  ./runCalibSummary.C\(\"$runnum\"\)   2>&1 | tee calib.log
+
+if [ -f dcsTime.log ]
+    then
+    mv dcsTime.root calibSummary_run$runnum.root
+else
+    echo
+    echo "dcsTime.root file was not created - job failure"
+fi
diff --git a/TPC/scripts/OCDBscan/jdl/validation.sh b/TPC/scripts/OCDBscan/jdl/validation.sh
new file mode 100755 (executable)
index 0000000..1eeafe0
--- /dev/null
@@ -0,0 +1,101 @@
+#!/bin/sh
+##################################################
+validateout=`dirname $0`
+validatetime=`date`
+validated="0";
+error=1
+
+if [ -z $validateout ]
+then
+    validateout="."
+fi
+cd $validateout;
+validateworkdir=`pwd`;
+
+echo "*******************************************************" >> stdout;
+echo "* AliRoot Validation Script V1.0                      *" >> stdout;
+echo "* Time:    $validatetime " >> stdout;
+echo "* Dir:     $validateout" >> stdout;
+echo "* Workdir: $validateworkdir" >> stdout;
+echo "* ----------------------------------------------------*" >> stdout;
+ls -la ./ >> stdout;
+echo "* ----------------------------------------------------*" >> stdout;
+
+##################################################
+
+echo "... testing if the suppossed output was created ">> stdout
+if [ -f calib.log ] && [ -f calib*.root ] 
+    then 
+    echo "ok">> stdout
+    echo "... testing for Segmentation violation">> stdout
+    sv=`grep -i  "Segmentation violation" *.log`
+    if [ "$sv" = "" ]
+       then
+       echo "ok">> stdout
+       echo "... testing for Segmentation fault">> stdout
+       sf=`grep -i  "Segmentation fault" *.log`
+       if [ "$sf" = "" ]
+           then
+           echo "ok">> stdout
+           echo "... testing for Bus error">> stdout
+           be=`grep -i  "Bus error" *.log`
+           if [ "$be" = "" ]
+               then
+               echo "ok">> stdout
+               echo "... testing for Break">> stdout
+               ab=`grep -i "Break" *.log`
+               if [ "$ab" = "" ]
+                   then
+                   echo "ok">> stdout
+                   echo "... testing for Floating point exception">> stdout
+                   fp=`grep -i  "Floating point exception" *.log`
+                   if [ "$fp" = "" ]
+                       then
+                       echo "ok">> stdout
+                       echo "... testing for Killed">> stdout
+                       kl=`grep -i  "Killed" *.log`
+                       if [ "$kl" = "" ]
+                           then
+                           echo "ok">> stdout
+                           echo "... testing for busy flag cleared">> stdout
+                           bf=`grep -i "busy flag cleared" *.log`
+                           if [ "$bf" = "" ]
+                               then
+                               echo "* ----------------   Job Validated  ------------------*" >> stdout;
+                               error="0";
+                            else
+                               echo "* #             Check Macro failed !                  #" >> stdout;
+                           fi
+                       fi
+                   fi
+               fi
+           fi
+       fi
+    fi
+else
+    echo "* ########## Job not validated - no calib.log or calibSummary.root ###" >> stdout;
+    echo "* ########## Removing all ROOT files from the local directory, leaving only the logs ###" >> stdout;
+    rm -rf *.root
+fi
+
+
+if [ "$error" = "1" ] 
+    then
+    echo "* ################   Job not validated ################" >> stdout;
+fi
+
+
+echo "* ----------------------------------------------------*" >> stdout;
+echo "*******************************************************" >> stdout;
+
+
+sleep 15;
+cd -
+
+cp stdout stdout.log
+if [ -f stderr ]
+    then
+    cp stderr stderr.log
+fi
+
+exit $error