]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Moving the OCDBscan scripts to the subdirectory
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 11 Mar 2010 15:30:04 +0000 (15:30 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 11 Mar 2010 15:30:04 +0000 (15:30 +0000)
Alien implementation not yet done.
For the moment local and batch farm implementation.

(Marian Ivanov)

TPC/scripts/OCDBscan/ConfigOCDB.C [new file with mode: 0644]
TPC/scripts/OCDBscan/README [new file with mode: 0644]
TPC/scripts/OCDBscan/gui [new file with mode: 0755]
TPC/scripts/OCDBscan/guiEnv.sh [new file with mode: 0755]
TPC/scripts/OCDBscan/guiTime [new file with mode: 0755]
TPC/scripts/OCDBscan/loadTPCcalib.C [new file with mode: 0644]
TPC/scripts/OCDBscan/loadlibsREC.C [new file with mode: 0644]
TPC/scripts/OCDBscan/makeCalibTree.sh [new file with mode: 0755]
TPC/scripts/OCDBscan/makeCalibTreeList [new file with mode: 0755]

diff --git a/TPC/scripts/OCDBscan/ConfigOCDB.C b/TPC/scripts/OCDBscan/ConfigOCDB.C
new file mode 100644 (file)
index 0000000..5cfdc56
--- /dev/null
@@ -0,0 +1,114 @@
+//
+// Macro to Setup OCDB  
+// This is just example macro
+// Responsible: marian.ivanov@cern.ch
+// To be used:
+// 1. Before invocation of the calibration - in the calibration trains
+// 2. To setup calibration viewer.
+//  
+// ConfigOCDB  - setup default and specific data storage
+// SetupCustom - user sepcific configuration 
+//             - Values in local cache of OCDB are overwritten
+
+
+
+void SetupCustom(Int_t run);
+
+void ConfigOCDB(Int_t crun=-1){
+  // 
+  printf("SETUP OCBD for TPC\n");
+  //
+  AliCDBManager::Instance()->SetDefaultStorage("local:///lustre/alice/alien/alice/data/2009/OCDB/");
+  
+  //
+  // custom calibration to test before committing
+  //
+
+ AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/GainFactorDedx","local:///lustre/alice/akalweit/OCDB"); 
+ AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/ClusterParam","local:///lustre/alice/akalweit/OCDB");
+ AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/TimeGainKrypton","local:///lustre/alice/miranov/OCDB");
+ AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/TimeDrift","local:///lustre/alice/miranov/rec/LHC09c/calibAlienNoDrift/mergerunMagAll.list/OCDB");
+ // AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/TimeGain","local:///lustre/alice/akalweit/OCDB");  
+ AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/TimeGain","local:///lustre/alice/miranov/rec/LHC09c/calibAlienNoDrift/mergerunMagN0.list");
+AliCDBManager::Instance()->SetSpecificStorage("TPC/Calib/Ref","local://$ALICE_ROOT/OCDB");
+
+  Int_t run =crun;
+  if (run<0) run =0;
+  AliCDBManager::Instance()->SetRun(run);
+  SetupCustom(run);
+}
+
+
+void SetupCustom(Int_t run){
+  //
+  //
+  // Custom part - to be empty once we are happy with the calibration
+  //
+  //
+  // Setup magnetic field
+  //
+  AliGRPObject *grp = AliTPCcalibDB::GetGRP(run);
+  Float_t current = 0;
+  Float_t bz      = 0;
+  if (grp){
+    current = grp->GetL3Current((AliGRPObject::Stats)0);
+    bz = 5*current/30000.;
+    printf("Run%d\tL3 current%f\tBz\t%f\n",run,current,bz);
+  }
+  else{
+    printf("Run%d\tL3 current%f\tBz\t%f\n",run,current,bz);
+  }
+  AliMagF::BMap_t smag = AliMagF::k5kG;
+  Double_t bzfac = bz/5;
+  if (bzfac==0) {  // force default magnetic field if 0 field used
+    bzfac=1;
+    bz=5;
+  }
+  AliMagF * magF = new AliMagF("Maps","Maps", 2, bzfac, 1., 10., smag);
+  TGeoGlobalMagField::Instance()->SetField(magF);
+  printf("\n\nSET EXB FIELD\t%f\n\n", );
+  AliTPCcalibDB::Instance()->SetExBField(magF);
+  //
+  //
+  // import geometry
+  //
+  //
+  TGeoManager::Import("/u/miranov/proof/geometry.root");
+  AliGeomManager::LoadGeometry("/u/miranov/proof/geometry.root");
+
+  AliTPCClusterParam * paramCl = AliTPCcalibDB::Instance()->GetClusterParam(); 
+  AliTPCParam   * paramTPC = AliTPCcalibDB::Instance()->GetParameters();
+  paramCl->SetInstance(paramCl);
+
+  //
+  // Setup reco param
+  //
+  AliTPCTransform *transform     = AliTPCcalibDB::Instance()->GetTransform() ;
+  AliTPCRecoParam * tpcRecoParam = AliTPCRecoParam::GetCosmicTestParam(kTRUE);
+  transform->SetCurrentRecoParam(tpcRecoParam);
+  tpcRecoParam->SetUseRPHICorrection(kTRUE);
+  //
+  tpcRecoParam->SetUseRadialCorrection(kFALSE);
+  tpcRecoParam->SetUseQuadrantAlignment(kTRUE);
+  //
+  tpcRecoParam->SetUseSectorAlignment(kFALSE);
+  tpcRecoParam->SetUseDriftCorrectionTime(kFALSE);
+  tpcRecoParam->SetUseDriftCorrectionGY(kTRUE);
+  tpcRecoParam->SetUseGainCorrectionTime(kFALSE);
+  tpcRecoParam->SetUseFieldCorrection(kFALSE);
+  tpcRecoParam->SetUseExBCorrection(kTRUE);
+  //
+  //
+  //
+  TFile fposcor("~/OCDB/calibUnlin.root");
+  AliTPCPointCorrection *pcorr = fposcor.Get("correction");
+  if (pcorr) pcorr->SetInstance(pcorr); 
+  //
+  //
+  //
+  printf("END of SETUP OCBD for TPC\n");
+}
+
+
diff --git a/TPC/scripts/OCDBscan/README b/TPC/scripts/OCDBscan/README
new file mode 100644 (file)
index 0000000..c7e2a0c
--- /dev/null
@@ -0,0 +1,129 @@
+cdABOUT:
+Authors: Jens Wiechula 
+         Marian Ivanov (marian.ivanov@cern.ch)
+Scripts for viusalization and analysis of the TPC OCDB entries and visualization of trends.
+For visualization and analisys purposes root trees and queries on top of trees are used.
+
+Algorithm:
+1. Creation of the run lists.   (Expert operation) 
+2. Making a calibration trees.  (Expert operation)
+3. OCDB visualization analysis. (Non /software/ expert mode) 
+
+Requiroments:
+1. AliRoot installed.
+2. Alien   installed + valid alien certificate
+3. In some cases (only to speed up tree creation process) the batch farm can be used.  
+4. Alien configuration/jobs to be included soon (Work in progress)
+
+----------
+Quickstart
+-----------
+
+Without thinking, you can do the following to create a tree with calibration entries.
+The default settings should work, however you might want to change them for 'better' 
+performance. 
+
+Do the following:
+1. Setup environment
+   1.a) gui dependend variables
+        export SCRIPTDIR=$ALICE_ROOT/TPC/scripts/OCDBscan
+            or your local scriptdir if you want to modify it
+        e.g:
+        export SCRIPTDIR=/lustre/alice/miranov/calibPass0/OCDBscan/scripts
+        
+        export PATH=$SCRIPTDIR:$PATH
+       source $SCRIPTDIR/guiEnv.sh
+        
+   1.b) Modify your guiEnv.sh script in $SCRIPTDIR
+   1.c) Run: source guiEnv.sh debug    
+   1.d) Check the output of script. All checks has to be OK.
+     
+2. Run tree creation (Jens Wiechula scripts) Options:
+   2.a)  Run on a list of run numbers with name 'list.txt', one run number per line
+         makeCalibTree -l list.txt
+   2.b) Run on a range of run numbers:
+        makeCalibTree -r 75000-80000
+   2.c) Run automatic tree creation for all runs in the
+        data taking period which was set up (see below)
+        !!!WARNING!!! this will take quite some time
+        makeCalibTree -a
+
+3. Run tree creation for extended statistic. This part can be run only if batchcommand specified.  (Marian Ivanov part of scripts)
+   WARNING  this is just example usage of expert mode:
+   bgroup=/bgui
+   ifirst=100000       
+   ilast=103000
+   step=250
+   runList=`pwd`/run.list
+   bgadd $bgroup
+   for ((  startRun=$ifirst; startRun<$ilast; startRun=startRun+$step )) ; do 
+      let endRun=$startRun+$step 
+      echo $startRun $endRun   
+       echo $BATCHCOMMAND -g $bgroup -oo $GUI_OUTDIR/logs/out$startRun.log -eo $GUI_OUTDIR/logs/err$startRun.log makeCalibTree.sh $runList $startRun $endRun;
+    $BATCHCOMMAND -g $bgroup -oo $GUI_OUTDIR/logs/out$startRun.log -eo $GUI_OUTDIR/logs/err$startRun.log  makeCalibTree.sh $runList $startRun $endRun;    
+   done;
+
+4. Start the GUI browser. This should work always (even on your laptop). 
+guiTime
+
+
+
+-------------------
+General information
+-------------------
+The macros and shell scripts used are stored in $ALICE_ROOT/TPC/CalibMacros/guiTime
+If you would like to modify some setting (see below), but do not have write access to this
+directory, you can copy the complete directory somewhere else and setup the environment
+variables accordingly:
+
+export SCRIPTDIR=path_to_my_directory
+export PATH=$SCRIPTDIR:$PATH
+
+- setup scripts
+All user relevant setup is done the shell script 'guiEnv' and the root macro 'ConfigOCDB.C'
+All other files don't need to be modified by the user.
+
+- scripts for the tree creation:
+makeCalibTree:        Steering script to launch the tree creation
+makeCalibTreeList:    script running the actual root process to create the tree
+
+- scripts to start the gui:
+gui 'filename':       Start the CalibViewerGUI using the tree in file 'filename'. Invokes the script
+                      startGUI.C
+guiTime ['filename']: Start the CalibViewerGUItime. Optionally a filename containing the calibration
+                      calibration tree can be specified. Otherwise the trees from the directory setup
+                      in guiEnv will be used (see below). Invokes the script startGUItime.C
+
+-oter scripts:
+loadlibsREC.C:        Root macro to load only libraries needed to start the gui and tree creation.
+
+
+----------------
+Customised setup
+----------------
+
+- Defining the OCDB directories (ConfigOCDB.C):
+Before starting the tree creation or gui the macro 'ConfigOCDB.C' is exectued. This macro should contain
+all the setup needed to point to the proper OCDB directories. If alien is used, alien needs also to be
+setup in the macro. Open the macro for examples.
+
+- General output information (guiEnv):
+In the 'guiEnv' script environment variables defining default output directories etc. See comments in the
+file for explanations.
+
+
+Troubleshouting:
+
+1. Check your environment.
+   source guiEnv.sh debug
+   1.a) If not execuitng check your $PATH
+   1.b) Check the output of script. All checks should be indicated OK.
+2. Modify environment if neccessary
+3. Missing ConfigOCDB.C macro. This macro is not provided by default.
+   It is setup specific. You should contact experts to get it.   
+4. Wrong ConfigOCDB.C macro, tests:
+   4.a) ls $SCRIPTDIR/ConfigOCDB.C  - file should exist
+   4.b) run ConfigOCDB.C macro in aliroot session. Check the output.
+
+In case of further problems, please inform authors.
\ No newline at end of file
diff --git a/TPC/scripts/OCDBscan/gui b/TPC/scripts/OCDBscan/gui
new file mode 100755 (executable)
index 0000000..d6277cf
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/bash
+if [ $# -ne 1 ]; then
+  echo one file neede das input!
+  exit 1
+fi
+if [ "x$SCRIPTDIR" == "x" ]; then
+  echo
+  echo please run:
+  echo export SCRIPTDIR=whatever_is_your_path
+  echo
+  exit 1
+fi
+source $SCRIPTDIR/guiEnv.sh
+root.exe $SCRIPTDIR/loadlibsREC.C $SCRIPTDIR/startGUI.C\(\"$1\"\)
diff --git a/TPC/scripts/OCDBscan/guiEnv.sh b/TPC/scripts/OCDBscan/guiEnv.sh
new file mode 100755 (executable)
index 0000000..7f7ebcf
--- /dev/null
@@ -0,0 +1,112 @@
+#
+# setup aliroot environment
+# to be modified by users
+# This is example setup which is used at GSI
+# In order to use it on your laptop 
+# AliRoot, Destination directories and the AUTOFILES has to be modified
+# (Jens Wiechula, Marian Ivanov)
+#
+#
+# parameters
+# 1  - debug flag
+
+#
+# set your aliroot and  alien environment
+#
+#source $HOME/.balice64HEAD0108
+source $HOME/.balice
+echo YOU HAVE TO MODIFY ALIROOT SETUP
+echo IT  IS ENVIRNMENT SPECIFIC 
+#
+#output directory
+#
+export GUI_OUTDIR=/lustre/alice/TPCgui
+echo YOU HAVE TO MODIFY DESTINATION DIRECTORY
+echo IT  IS ENVIRONMENT SPECIFIC 
+
+#usually the next two can stay as they are. If you are not happy with where the output is written
+#feel free to change them
+export GUI_OUTDIR_TIME=$GUI_OUTDIR/time
+export GUI_OUTDIR_RUNS=$GUI_OUTDIR/runs
+
+#command for batch processing
+# see also TMPLISTDIR!!!
+export BATCHCOMMAND="bsub -q alice-t3_8h"
+
+#directory for the temporary list files
+#for batch processing this dir needs to be accessable from the batch nodes!!!
+export TMPLISTDIR=$GUI_OUTDIR/guiTreeLists
+
+#path to reference tree. Consider to use one!
+#see README to understand how to create them
+export REF_DATA_FILE=$GUI_OUTDIR/ref/RefCalPads.root
+export REF_DATA_TREE=$GUI_OUTDIR/ref/RefTree.root
+
+#whether alien path is used in OCDB
+#export WITHALIEN=1
+export WITHALIEN=0
+
+#where to look for files in automatic tree creation
+#it assumes a path to an OCDB directory and uses the
+#run numbers of the file names:
+#Run([0-9]{5})_.*
+export AUTOFILES=/lustre/alice/alien/alice/data/2009/OCDB/TPC/Calib/HighVoltage
+echo YOU HAVE TO MODIFY AUTOFILES DIRECTORY
+echo IT  IS ENVIRONMENT SPECIFIC 
+
+#number of files per chunk in automatic tree creation
+export NFILES=25
+
+
+echo Test guiEnv setup
+
+errorCode=0;
+goodPass=0;
+testROOT=`which root`
+if [ -z testROOT ];  then
+   echo Check root setup"      ":FALSE
+   let errorCode=errorCode+1
+ else
+   echo Check root setup"      ":OK"    "-  $testROOT
+fi;
+#
+# test GUIdir
+#
+if [ -d $GUI_OUTDIR ];  then
+   echo Check GUI_OUTDIR"      ":OK"    "-  $GUI_OUTDIR
+  else
+   echo Check GUI_OUTDIR"      ":FALSE"" -  $GUI_OUTDIR
+   let errorCode=errorCode+2
+fi;
+#
+#
+#
+if [ -r $GUI_OUTDIR_TIME ];  then
+    echo Check GUI_OUTDIR_TIME" ":OK"    "-  $GUI_OUTDIR_TIME
+  else
+    echo Check GUI_OUTDIR_TIME" ":FALSE" "-  Does not exist or not readable           
+    let errorCode=errorCode+4
+fi;
+
+if [ -r $GUI_OUTDIR_RUNS ];  then
+   echo Check GUI_OUTDIR_RUNS" ":OK"    "-  $GUI_OUTDIR_RUNS
+  else
+   echo Check GUI_OUTDIR_RUNS" ":FALSE" "-  Does not exist or not readable           
+   let errorCode=errorCode+8
+fi;
+
+if [ -r $GUI_OUTDIR/guiTreeLists ];  then
+   echo Check GUI_OUTDIR/guiTreeLists" ":OK"    "-  $GUI_OUTDIR/guiTreeLists
+  else
+   echo Check GUI_OUTDIR/guiTreeLists" ":FALSE" "-  Does not exist or not readable           
+   let errorCode=errorCode+16
+fi;
+
+if [ -z `which aliensh` -a WITHALIEN!=0 ]; then
+   echo Alien not properly initialized
+   let errorCode=errorCode+32
+fi;
+
+
+echo $errorCode
diff --git a/TPC/scripts/OCDBscan/guiTime b/TPC/scripts/OCDBscan/guiTime
new file mode 100755 (executable)
index 0000000..e7f04c4
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/bash
+if [ "x$SCRIPTDIR" == "x" ]; then
+  echo 
+  echo please run:
+  echo export SCRIPTDIR=whatever is you path
+  echo
+  exit 1
+fi
+source $SCRIPTDIR/guiEnv.sh
+test -d $GUI_OUTDIR_RUNS || mkdir -p $GUI_OUTDIR_RUNS
+root.exe $SCRIPTDIR/loadlibsREC.C $SCRIPTDIR/ConfigOCDB.C $SCRIPTDIR/startGUItime.C\(\"$1\"\) $ALICE_ROOT/TPC/CalibMacros/guiAlias.C
diff --git a/TPC/scripts/OCDBscan/loadTPCcalib.C b/TPC/scripts/OCDBscan/loadTPCcalib.C
new file mode 100644 (file)
index 0000000..329b7db
--- /dev/null
@@ -0,0 +1,9 @@
+void loadTPCcalib(){
+  //
+  //
+  //
+  gROOT->Macro("~/NimStyle.C");
+  gSystem->Load("libANALYSIS");
+  gSystem->Load("libTPCcalib");
+  printf("LOAD TPC calibration libraries\n\n");
+}
diff --git a/TPC/scripts/OCDBscan/loadlibsREC.C b/TPC/scripts/OCDBscan/loadlibsREC.C
new file mode 100644 (file)
index 0000000..40be969
--- /dev/null
@@ -0,0 +1,31 @@
+void loadlibsREC ()
+{
+  gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/ -I$ALICE_ROOT/include -I$ALICE_ROOT/STEER  -I$ALICE_ROOT/TPC -I$ALICE_ROOT/TPC/CalibMacros -I$ALICE_ROOT/ITS -I$ALICE_ROOT/TRD ");
+  gSystem->Load("libCore");
+  gSystem->Load("libPhysics");
+  gSystem->Load("libMinuit");
+  gSystem->Load("libGui.so");
+
+  gSystem->Load("libGeom");
+  gSystem->Load("libVMC");
+
+  gSystem->Load("libNet");
+  gSystem->Load("libTree");
+  gSystem->Load("libProof");
+
+  gSystem->Load("libSTEERBase");
+  gSystem->Load("libESD");
+  gSystem->Load("libCDB");
+  gSystem->Load("libRAWDatabase");
+  gSystem->Load("libRAWDatarec");
+  gSystem->Load("libSTEER");
+  gSystem->Load("libANALYSIS");
+  
+  gSystem->Load("libTPCbase");
+  gSystem->Load("libTPCrec");
+  gSystem->Load("libTPCcalib");
+  
+  gSystem->Load("libSTAT");
+  
+  gSystem->Load("libThread");
+}
diff --git a/TPC/scripts/OCDBscan/makeCalibTree.sh b/TPC/scripts/OCDBscan/makeCalibTree.sh
new file mode 100755 (executable)
index 0000000..ff8fcc5
--- /dev/null
@@ -0,0 +1,27 @@
+# Aruments
+# 1   -  run list
+# 2   -  start run
+# 3   -  end run
+
+runList=$1
+startRun=$2
+endRun=$3
+echo runList=$runList
+echo startRun=$startRun
+echo endRun=$endRun
+#
+workdir=${GUI_OUTDIR}/tmp/tmp${startRun}-${endRun}
+backupdir=`pwd`/
+mkdirhier $workdir
+cd $workdir
+source guiEnv.sh
+source halloWorld.sh
+#
+aliroot -q -b $SCRIPTDIR/ConfigOCDB.C  $ALICE_ROOT/TPC/CalibMacros/CalibEnv.C+\(\"$runList\",$startRun,$endRun\)
+echo End of job:
+echo pwd=`pwd`
+echo ls=
+ls -alrt
+echo cp dcsTime.root $GUI_OUTDIR/time/calibTreeTime_$startRun_$endRun.root
+cp dcsTime.root $GUI_OUTDIR/time/calibTreeTime_$startRun_$endRun.root
+cd $backupdir
diff --git a/TPC/scripts/OCDBscan/makeCalibTreeList b/TPC/scripts/OCDBscan/makeCalibTreeList
new file mode 100755 (executable)
index 0000000..e2e6be8
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+#parameters
+#1: listfile
+#2: outfile
+#3: bindir
+
+. $3/guiEnv.sh
+
+#temporary working directory
+dirID=/tmp/$(whoami)/$(date +%F.%H.%M.%S.%N)_$(basename $1)
+
+test -d $dirID || mkdir -p $dirID
+cd $dirID
+root.exe -q -b $3/loadlibsREC.C $3/ConfigOCDB.C $ALICE_ROOT/TPC/CalibMacros/CalibEnv.C+\(\"$1\"\)
+mv dcsTime.root $2
+rmdir $dirID