]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Finished copy of the CPass0 macros into CPass1
authormarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 28 Mar 2012 13:22:29 +0000 (13:22 +0000)
committermarian <marian@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 28 Mar 2012 13:22:29 +0000 (13:22 +0000)
PWGPP/CalibMacros/CPass1/CPass1.jdl [new file with mode: 0644]
PWGPP/CalibMacros/CPass1/ConfigCalibTrain.C [new file with mode: 0644]
PWGPP/CalibMacros/CPass1/LoadLibraries.C [new file with mode: 0644]
PWGPP/CalibMacros/CPass1/makeOCDB.C [new file with mode: 0644]
PWGPP/CalibMacros/CPass1/makeOCDB.byComponent.C [new file with mode: 0644]
PWGPP/CalibMacros/CPass1/runCPass1.sh [new file with mode: 0644]
PWGPP/CalibMacros/CPass1/runCalibTrain.C [new file with mode: 0644]
PWGPP/CalibMacros/CPass1/validation.sh [new file with mode: 0644]
PWGPP/CalibMacros/CPass1/validationMerging.sh [new file with mode: 0755]

diff --git a/PWGPP/CalibMacros/CPass1/CPass1.jdl b/PWGPP/CalibMacros/CPass1/CPass1.jdl
new file mode 100644 (file)
index 0000000..833d633
--- /dev/null
@@ -0,0 +1,41 @@
+Executable="/alice/cern.ch/user/j/jotwinow/bin/runCPass0.sh";
+
+Packages= { "VO_ALICE@AliRoot::v5-02-Rev-04",
+           "VO_ALICE@ROOT::v5-30-06-1",        
+            "VO_ALICE@APISCONFIG::V1.1x"
+};
+
+Jobtag = { "Test CPass0 Calibration Train" };
+
+GUIDFILE="guid.txt";
+TTL = "28000";
+Price = 1;
+
+Validationcommand ="/alice/cern.ch/user/j/jotwinow/CPass0/CalibMacros/validation.sh";
+
+Split="file";
+
+JDLVariables={"Packages", "OutputDir"};
+GUIDFILE="guid.txt";
+
+
+SplitArguments = {"/alice/data/2010/LHC10d/$1/raw/#alienfilename#"};
+Workdirectorysize={"6000MB"};
+
+InputFile={"LF:/alice/cern.ch/user/j/jotwinow/CPass0/CalibMacros/recCPass0.C",
+           "LF:/alice/cern.ch/user/j/jotwinow/CPass0/CalibMacros/ConfigCalibTrain.C",
+           "LF:/alice/cern.ch/user/j/jotwinow/CPass0/CalibMacros/runCalibTrain.C",
+           "LF:/alice/cern.ch/user/j/jotwinow/CPass0/CalibMacros/AddTaskTPCCalib.C",
+           "LF:/alice/cern.ch/user/j/jotwinow/CPass0/CalibMacros/AddTaskTRDCalib.C",
+           "LF:/alice/cern.ch/user/j/jotwinow/CPass0/CalibMacros/AddTaskT0Calib.C",
+           "LF:/alice/cern.ch/user/j/jotwinow/CPass0/CalibMacros/AddTOFAnalysisTaskCalibPass0.C",
+           "LF:/alice/cern.ch/user/j/jotwinow/CPass0/CalibMacros/LoadLibraries.C"
+};
+
+InputDataCollection="LF:/alice/data/2010/LHC10d/$1/collection,nodownload";
+
+OutputDir="/alice/cern.ch/user/j/jotwinow/CPass0/output/$1/#alienfilename/.root//#";
+
+OutputArchive={"log_archive:*.log@disk=1",
+              "root_archive.zip:AliESDfriends_v1.root,@disk=1"};
+
diff --git a/PWGPP/CalibMacros/CPass1/ConfigCalibTrain.C b/PWGPP/CalibMacros/CPass1/ConfigCalibTrain.C
new file mode 100644 (file)
index 0000000..fd57b11
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+
+ Macro to initialize: 
+ - the OCDB (run number required as input argument)
+ - the geometry (expected to be in the current directory)
+ to run the Calibration train.
+ Example:
+ .L $ALICE_ROOT/ANALYSIS/CalibMacros/MergeCalibration/ConfigCalibTrain.C
+ ConfigCalibTrain(129160,"raw://");
+
+*/
+
+void ConfigCalibTrain(Int_t run, const char *ocdb="raw://"){
+
+  // OCDB
+  printf("setting run to %d\n",run);
+  AliCDBManager::Instance()->SetDefaultStorage(ocdb);
+  AliCDBManager::Instance()->SetRun(run); 
+  if (gSystem->AccessPathName("OCDB.root", kFileExists)==0) {  
+    AliCDBManager::Instance()->InitFromSnapshot("OCDB.root");
+  }
+  // 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"); 
+    }
+  }
+
+  // geometry
+  printf("Loading geometry...\n");
+  AliGeomManager::LoadGeometry();
+  if( !AliGeomManager::ApplyAlignObjsFromCDB("GRP ITS TPC") ) {
+    printf("Problem with align objects\n"); 
+  }
+
+}
diff --git a/PWGPP/CalibMacros/CPass1/LoadLibraries.C b/PWGPP/CalibMacros/CPass1/LoadLibraries.C
new file mode 100644 (file)
index 0000000..e662314
--- /dev/null
@@ -0,0 +1,25 @@
+void LoadLibraries() {
+    //
+    // load libraries needed for CPass0
+    //
+    gSystem->Load("libSTAT");
+    gSystem->Load("libANALYSIS");
+    gSystem->Load("libANALYSISalice");
+    gSystem->Load("libANALYSIScalib");
+    //
+    // detector libraries
+    //    
+    gSystem->Load("libTPCcalib");
+    gSystem->Load("libTRDcalib");
+    gSystem->Load("libT0calib");
+    gSystem->Load("libTOFcalib");
+    //
+    // PWGPP libraries
+    //    
+    gSystem->Load("libANALYSISalice.so");
+    gSystem->Load("libANALYSIScalib.so");
+    gSystem->Load("libTENDER.so");
+    gSystem->Load("libPWGPP.so");
+    //gSystem->Load("libPWG4PartCorrBase.so");
+    //gSystem->Load("libHMPIDbase.so");
+}
diff --git a/PWGPP/CalibMacros/CPass1/makeOCDB.C b/PWGPP/CalibMacros/CPass1/makeOCDB.C
new file mode 100644 (file)
index 0000000..2df6b9b
--- /dev/null
@@ -0,0 +1,97 @@
+/*
+  macro to extract the OCDB entries
+
+  input: CalibObjects.root
+  ouput: TimeGain and TimeVdrift calibration objects for TPC and TRD
+
+  Example:
+  .L $ALICE_ROOT/PWGPP/CalibMacros/CPass0/makeOCDB.C
+  makeOCDB("105160");
+
+*/
+
+void makeOCDB(TString runNumberString, TString  ocdbStorage="")
+{
+  //
+  // extract TPC OCDB entries
+  //
+  gROOT->Macro("LoadLibraries.C");
+  gROOT->LoadMacro("ConfigCalibTrain.C");
+
+  // switch off log info
+  AliLog::SetClassDebugLevel("AliESDEvent",0);
+
+  // config GRP
+  Int_t runNumber = runNumberString.Atoi();
+  printf("runNumber from runCalibTrain = %d\n",runNumber);
+  ConfigCalibTrain(runNumber, "raw://");
+
+  // Steering Tasks - set output storage
+  // DefaultStorage set already before - in ConfigCalibTrain.C
+//ocdbStorage+="?se=ALICE::CERN::SE";
+
+  AliCDBManager::Instance()->SetSpecificStorage("*/*/*",ocdbStorage.Data());
+
+  // set OCDB storage
+  if (ocdbStorage.Length()==0) ocdbStorage+="local://"+gSystem->GetFromPipe("pwd")+"/OCDB";
+
+  // TPC part
+  TFile fcalib("CalibObjects.root");
+  AliTPCPreprocessorOffline proces;
+
+  // switch on parameter validation
+  proces.SetTimeGainRange(0.5,3.0);
+  proces.SwitchOnValidation();
+
+  // Make timegain calibration
+  //proces.CalibTimeGain("CalibObjects.root", runNumber,AliCDBRunRange::Infinity(),ocdbStorage);
+  proces.CalibTimeGain("CalibObjects.root", runNumber,runNumber,ocdbStorage);
+
+  // Make vdrift calibration
+  //proces.CalibTimeVdrift("CalibObjects.root",runNumber,AliCDBRunRange::Infinity(),ocdbStorage);
+  proces.CalibTimeVdrift("CalibObjects.root",runNumber,runNumber,ocdbStorage);
+  //
+  // TOF part
+  //
+  AliTOFAnalysisTaskCalibPass0 calibTask;
+  Printf("Calibrating TOF");
+  calibTask.ProcessOutput("CalibObjects.root", ocdbStorage);
+//
+//
+
+// T0 part
+  AliT0PreprocessorOffline procesT0;
+  // Make  calibration of channels offset
+   procesT0.Process("CalibObjects.root",runNumber, runNumber, ocdbStorage);
+
+
+
+   //TRD part
+   AliTRDPreprocessorOffline procestrd;
+   procestrd.SetLinearFitForVdrift(kTRUE);
+   procestrd.SetMinStatsVdriftT0PH(600*10);
+   procestrd.SetMinStatsVdriftLinear(50);
+   procestrd.SetMinStatsGain(600);
+   procestrd.SetLimitValidateNoData(40);
+   procestrd.SetLimitValidateBadCalib(40);
+   procestrd.SetAlternativeDriftVelocityFit(kTRUE);
+   procestrd.Init("CalibObjects.root");
+   Int_t versionVdriftUsed = procestrd.GetVersionVdriftUsed();
+   Int_t subversionVdriftUsed = procestrd.GetSubVersionVdriftUsed();
+   Int_t versionGainUsed = procestrd.GetVersionGainUsed();
+   Int_t subversionGainUsed = procestrd.GetSubVersionGainUsed();
+   Int_t versionExBUsed = procestrd.GetVersionExBUsed();
+   Int_t subversionExBUsed = procestrd.GetSubVersionExBUsed();
+   printf("version and subversion vdrift %d and %d\n",versionVdriftUsed,subversionVdriftUsed);
+   printf("version and subversion gain %d and %d\n",versionGainUsed,subversionGainUsed);
+   printf("version and subversion exb %d and %d\n",versionExBUsed,subversionExBUsed);
+   procestrd.Process("CalibObjects.root",runNumber,runNumber,ocdbStorage);
+   Int_t trdstatus = procestrd.GetStatus();
+  
+  
+  //Mean Vertex
+  AliMeanVertexPreprocessorOffline procesMeanVtx;
+  procesMeanVtx.ProcessOutput("CalibObjects.root", ocdbStorage, runNumber);
+       
+  return;
+}
diff --git a/PWGPP/CalibMacros/CPass1/makeOCDB.byComponent.C b/PWGPP/CalibMacros/CPass1/makeOCDB.byComponent.C
new file mode 100644 (file)
index 0000000..8cf1374
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+  macro to extract the OCDB entries
+
+  input: CalibObjects.root
+  ouput: TimeGain and TimeVdrift calibration objects for TPC and TRD
+
+  Example:
+  .L $ALICE_ROOT/PWGPP/CalibMacros/CPass0/makeOCDB.C
+  makeOCDB("105160");
+
+*/
+
+//__________________________________________________________________
+
+void makeOCDB(TString runNumberString, TString ocdbStorage = "")
+{
+  makeOCDB("CalibObjects.root", "ALL", runNumberString, ocdbStorage);
+}
+
+//___________________________________________________________________
+
+void makeOCDB(const Char_t *filename, TString component, TString runNumberString, TString ocdbStorage = "")
+{
+  //
+  // extract TPC OCDB entries
+  //
+  gROOT->Macro("LoadLibraries.C");
+  gROOT->LoadMacro("ConfigCalibTrain.C");
+
+  // switch off log info
+  AliLog::SetClassDebugLevel("AliESDEvent",0);
+
+  // config GRP
+  Int_t runNumber = runNumberString.Atoi();
+  printf("runNumber from runCalibTrain = %d\n",runNumber);
+
+  /* configCalibTrain only if needed */
+  if (component == "TPC" || component == "TRD" || component == "ALL")
+    ConfigCalibTrain(runNumber, "raw://");
+  else
+    AliCDBManager::Instance()->SetDefaultStorage("raw://");
+  
+  // Steering Tasks - set output storage
+  // DefaultStorage set already before - in ConfigCalibTrain.C
+//ocdbStorage+="?se=ALICE::CERN::SE";
+
+  AliCDBManager::Instance()->SetSpecificStorage("*/*/*",ocdbStorage.Data());
+
+  // set OCDB storage
+  if (ocdbStorage.Length()==0) ocdbStorage+="local://"+gSystem->GetFromPipe("pwd")+"/OCDB";
+
+  
+  /* makeOCDB for selected component */
+  if (component == "TPC" || component == "ALL")
+    makeOCDB_TPC(filename, runNumber, ocdbStorage);
+  if (component == "TOF" || component == "ALL")
+    makeOCDB_TOF(filename, runNumber, ocdbStorage);
+  if (component == "T0" || component == "ALL")
+    makeOCDB_T0(filename, runNumber, ocdbStorage);
+  if (component == "TRD" || component == "ALL")
+    makeOCDB_TRD(filename, runNumber, ocdbStorage);
+  if (component == "MeanVertex" || component == "ALL")
+    makeOCDB_MeanVertex(filename, runNumber, ocdbStorage);
+  
+  gSystem->Exec(Form("touch %s_ocdb_done", component.Data()));
+  return;
+}
+
+//___________________________________________________________________
+
+void makeOCDB_TPC(const Char_t *filename, Int_t runNumber, TString ocdbStorage)
+{
+
+  // TPC part
+  TFile fcalib(filename);
+  AliTPCPreprocessorOffline proces;
+
+  // switch on parameter validation
+  proces.SetTimeGainRange(0.5,3.0);
+  proces.SwitchOnValidation();
+
+  // Make timegain calibration
+  //proces.CalibTimeGain(filename, runNumber,AliCDBRunRange::Infinity(),ocdbStorage);
+  proces.CalibTimeGain(filename, runNumber,runNumber,ocdbStorage);
+
+  // Make vdrift calibration
+  //proces.CalibTimeVdrift(filename,runNumber,AliCDBRunRange::Infinity(),ocdbStorage);
+  proces.CalibTimeVdrift(filename,runNumber,runNumber,ocdbStorage);
+
+}
+
+//___________________________________________________________________
+
+void makeOCDB_TOF(const Char_t *filename, Int_t runNumber, TString ocdbStorage)
+{
+  AliTOFAnalysisTaskCalibPass0 calibTask;
+  Printf("Calibrating TOF");
+  calibTask.ProcessOutput(filename, ocdbStorage);
+}
+
+//___________________________________________________________________
+
+void makeOCDB_T0(const Char_t *filename, Int_t runNumber, TString ocdbStorage)
+{
+  // T0 part
+  AliT0PreprocessorOffline procesT0;
+  // Make  calibration of channels offset
+  procesT0.Process(filename,runNumber, runNumber, ocdbStorage);
+}
+
+//___________________________________________________________________
+
+void makeOCDB_TRD(const Char_t *filename, Int_t runNumber, TString ocdbStorage)
+{
+   //TRD part
+   AliTRDPreprocessorOffline procestrd;
+   procestrd.SetLinearFitForVdrift(kTRUE);
+   procestrd.SetMinStatsVdriftT0PH(600*10);
+   procestrd.SetMinStatsVdriftLinear(50);
+   procestrd.SetMinStatsGain(600);
+   procestrd.Init(filename);
+   Int_t versionVdriftUsed = procestrd.GetVersionVdriftUsed();
+   Int_t subversionVdriftUsed = procestrd.GetSubVersionVdriftUsed();
+   Int_t versionGainUsed = procestrd.GetVersionGainUsed();
+   Int_t subversionGainUsed = procestrd.GetSubVersionGainUsed();
+   Int_t versionExBUsed = procestrd.GetVersionExBUsed();
+   Int_t subversionExBUsed = procestrd.GetSubVersionExBUsed();
+   printf("version and subversion vdrift %d and %d\n",versionVdriftUsed,subversionVdriftUsed);
+   printf("version and subversion gain %d and %d\n",versionGainUsed,subversionGainUsed);
+   printf("version and subversion exb %d and %d\n",versionExBUsed,subversionExBUsed);
+   procestrd.Process(filename,runNumber,runNumber,ocdbStorage);
+   Int_t trdstatus = procestrd.GetStatus();
+
+}
+
+//___________________________________________________________________
+
+void makeOCDB_MeanVertex(const Char_t *filename, Int_t runNumber, TString ocdbStorage)
+{
+  //Mean Vertex
+  AliMeanVertexPreprocessorOffline procesMeanVtx;
+  procesMeanVtx.ProcessOutput(filename, ocdbStorage, runNumber);
+}
+
+//___________________________________________________________________
+
diff --git a/PWGPP/CalibMacros/CPass1/runCPass1.sh b/PWGPP/CalibMacros/CPass1/runCPass1.sh
new file mode 100644 (file)
index 0000000..ec16b56
--- /dev/null
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+# Script to run:
+#    1. reconstruction
+#    2. calibration and friend track filtering
+#
+# Files assumed to be in working directory:
+# recCPass0.C          - reconstruction macro
+# runCalibTrain.C     - calibration/filtering macro
+# Arguments (run locally):
+#    1  - raw data file name
+#    2  - number of events to be processed
+#    3  - run number 
+
+# example:
+# runCPass0.sh raw.root  50  104892
+
+#ALIEN setting
+# $1 = raw input filename
+runNum=`echo $1 | cut -d "/" -f 6`
+if [ $# -eq 1 ] ; then
+  # alien Setup
+  nEvents=99999999
+  fileName="alien://"$1
+  ocdbPath="raw://"
+fi;
+if [ $# -eq 4 ] ; then
+  # local setup
+  nEvents=$2
+  runNum=$3
+  fileName=$1
+  ocdbPath=$4
+fi
+
+echo xxxxxxxxxxxxxxxxxxxxxxxxxxx
+echo runCPass0.sh Input arguments
+echo fileName=$fileName
+echo nEvents=$nEvents
+echo runNum=$runNum
+echo ocdbPath=$ocdbPath
+echo xxxxxxxxxxxxxxxxxxxxxxxxxxx
+
+if [ -f Run0_999999999_v3_s0.root ]; then
+    mkdir -p TPC/Calib/Correction
+    mv Run0_999999999_v3_s0.root TPC/Calib/Correction/
+fi
+
+
+
+echo File to be  processed $1
+echo Number of events to be processed $nEvents
+
+echo ">>>>>>>>> PATH is..."
+echo $PATH
+echo ">>>>>>>>> LD_LIBRARY_PATH is..."
+echo $LD_LIBRARY_PATH
+echo ">>>>>>>>> recCPass0.C is..."
+#cat recCPass0.C
+echo
+
+echo ">>>>>>> Running AliRoot to reconstruct $1. Run number is $runNum..."
+
+aliroot -l -b -q recCPass0.C\(\""$fileName\", $nEvents, \"$ocdbPath"\"\) 2>&1 | tee rec.log
+mv syswatch.log syswatch_rec.log
+
+echo ">>>>>>> Running AliRoot to make calibration..."
+aliroot -l -b -q  runCalibTrain.C\(\""$runNum\",\"AliESDs.root\",\"$ocdbPath"\"\)   2>&1 | tee calib.log
+mv syswatch.log syswatch_calib.log
diff --git a/PWGPP/CalibMacros/CPass1/runCalibTrain.C b/PWGPP/CalibMacros/CPass1/runCalibTrain.C
new file mode 100644 (file)
index 0000000..e32f027
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+  Template of calibration/filtering macro using ESD:
+  - requires AliESDs.root and AliESDfriend.root
+  - requires OCDB access (default set to "raw://")
+  - requires run number as argument to init OCDB
+  - calls LoadLibraries.C, ConfigCalibTrain.C and AddTaskTPCCalib.C macros
+  - output AliESDfriends_v1.root with TPC and TRD calibration objects are created
+
+  Example:
+  .L $ALICE_ROOT/ANALYSIS/macros/runCalibTrain.C
+  runCalibTrain("104892");
+*/
+
+void runCalibTrain(TString runNumberString, const char *inFileName = "AliESDs.root", const char *ocdb="raw://")
+{
+  //
+  // macro to run TPC calibration train 
+  //
+  AliLog::SetGlobalLogLevel(AliLog::kError); 
+  gROOT->Macro("LoadLibraries.C");
+  gROOT->LoadMacro("ConfigCalibTrain.C");
+
+  // detector tasks
+  gROOT->LoadMacro("AddTaskTPCCalib.C");
+  gROOT->LoadMacro("AddTaskTRDCalib.C");
+  gROOT->LoadMacro("AddTOFAnalysisTaskCalibPass0.C");
+  gROOT->LoadMacro("AddTaskT0Calib.C");
+  gROOT->LoadMacro("AddTaskMeanVertexCalib.C");
+  gROOT->LoadMacro("AddTaskSDDCalib.C"); 
+
+  // switch off debug 
+  AliLog::SetClassDebugLevel("AliESDEvent",0);
+  
+  // steering input chain
+  TChain *chain = new TChain("esdTree");
+  chain->Add(inFileName);
+
+  // config calibration train
+  // setting geometry and B-field from GRP
+  Int_t runNumber = runNumberString.Atoi();
+  printf("runNumber from runCalibTrain = %d\n",runNumber);
+  printf("ocdb from runCalibTrain = %s\n",ocdb);
+  ConfigCalibTrain(runNumber, ocdb);
+  
+  //
+  // setup analysis
+  //
+  AliAnalysisManager *mgr  = new AliAnalysisManager("ESD to ESD", "Analysis Manager");
+  // mgr->SetDebugLevel(3);
+  
+  // Input
+  AliESDInputHandler* inpHandler = new AliESDInputHandler();
+  inpHandler->SetReadFriends(1);
+  mgr->SetInputEventHandler(inpHandler);
+  
+  // Output
+  const char *outFile = "AliESDfriends_v1.root";
+  AliESDHandler* esdHandler   = new AliESDHandler();
+  mgr->SetOutputEventHandler(esdHandler);
+  esdHandler->SetOutputFileName(outFile);
+  mgr->SetCommonFileName(outFile);
+  //  
+  // Detector Tasks
+  AliAnalysisTask* tTPC = AddTaskTPCCalib(runNumber);
+  AliAnalysisTask* tTRD = AddTaskTRDCalib(runNumber);
+  AliTOFAnalysisTaskCalibPass0 *thisTask = AddTOFAnalysisTaskCalibPass0();
+  AliAnalysisTask* tT0 = AddTaskT0Calib(runNumber);
+  AliMeanVertexCalibTask *tMeanVtx = AddTaskMeanVertexCalib();
+  AliAnalysisTaskITSAlignQA *itsAlign = AddTaskSDDCalib();
+
+  // Run the analysis
+  if (!mgr->InitAnalysis()) {
+    printf("Analysis cannot be started, returning\n");
+    return;
+  }
+  
+  mgr->PrintStatus();
+  mgr->StartAnalysis("local", chain);
+  
+  return;
+}
diff --git a/PWGPP/CalibMacros/CPass1/validation.sh b/PWGPP/CalibMacros/CPass1/validation.sh
new file mode 100644 (file)
index 0000000..cadafcc
--- /dev/null
@@ -0,0 +1,75 @@
+#!/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;
+
+cp stdout stdout.log
+cp stderr stderr.log
+
+##################################################
+if [ -f rec.log ] && [ -f calib.log ] && [ -f AliESDs.root ] && [ -f AliESDfriends_v1.root ]  
+then 
+sv=`grep -i  "Segmentation violation" *.log`
+if [ "$sv" = "" ]
+    then
+    sf=`grep -i  "Segmentation fault" *.log`
+    if [ "$sf" = "" ]
+        then
+        be=`grep -i  "Bus error" *.log`
+        if [ "$be" = "" ]
+           then
+           ab=`grep -i "Break" *.log`
+           if [ "$ab" = "" ]
+               then
+               fp=`grep -i  "Floating point exception" *.log`
+               if [ "$fp" = "" ]
+                   then
+                   kl=`grep -i  "Killed" *.log`
+                   if [ "$kl" = "" ]
+                       then
+                       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 rec.log or calib.log or AliESDs.root  && AliESDfriends.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 -
+exit $error
diff --git a/PWGPP/CalibMacros/CPass1/validationMerging.sh b/PWGPP/CalibMacros/CPass1/validationMerging.sh
new file mode 100755 (executable)
index 0000000..ba89c09
--- /dev/null
@@ -0,0 +1,84 @@
+
+#!/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;
+
+cp stdout stdout.log
+cp stderr stderr.log
+
+##################################################
+if [ -f merge.log ] && [ -f CalibObjects.root ] 
+then 
+sv=`grep -i  "Segmentation violation" *.log`
+if [ "$sv" = "" ]
+    then
+    sf=`grep -i  "Segmentation fault" *.log`
+    if [ "$sf" = "" ]
+        then
+        be=`grep -i  "Bus error" *.log`
+        if [ "$be" = "" ]
+           then
+           ab=`grep -i "Break" *.log`
+           if [ "$ab" = "" ]
+               then
+               fp=`grep -i  "Floating point exception" *.log`
+               if [ "$fp" = "" ]
+                   then
+                   kl=`grep -i  "Killed" *.log`
+                   if [ "$kl" = "" ]
+                       then
+                       bf=`grep -i "busy flag cleared" *.log`
+                       if [ "$bf" = "" ]
+                            then
+                               es=`grep -i "E-AliCDBGrid::PutEntry:" *.log`
+                                if [ "$es" = "" ]
+                                  then
+                                   fg=`grep -i "F-AliCDBGrid::" *.log`
+                                    if [ "$fg" = "" ]
+                                      then
+                                   echo "* ----------------   Job Validated  ------------------*" >> stdout;
+                                   error="0";
+                                  else
+                                    echo "* #             Check Macro failed !                  #" >> stdout;
+                               fi
+                            fi
+                        fi
+                   fi
+               fi
+            fi
+        fi
+    fi
+fi
+else
+    echo "* ########## Job not validated - no merge.log or CalibObjects.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 -
+exit $error