return NULL;
}
+/**
+ * Helper function to make @c outputs_valid file
+ *
+ */
+void ValidateOutput()
+{
+ std::ofstream out;
+ out.open("outputs_valid", ios::out);
+ out.close();
+}
//====================================================================
/**
* Merge AOD output
*
+ * @param dir Directory
+ * @param stage The merging stage
*/
-void AODMerge()
+void AODMerge(const char* dir, Int_t stage)
{
// Merging method. No staging and no terminate phase.
TStopwatch timer; timer.Start();
- TString outputDir = "wn.xml";
+ TString outputDir = dir;
TObjArray outputFiles;
- outputFiles.Add(new TObjString("EventStat_temp.root,"));
- outputFiles.Add(new TObjString("AODQA.root,"));
- outputFiles.Add(new TObjString("AliAOD.root,"));
- if (aodCfg->UsePWGHFvertexing())
- outputFiles.Add(new TObjString("AliAOD.VertexingHF.root,"));
- if (aodCfg->UseESDfilter() &&
- aodCfg->UseMUONcopyAOD() &&
- detCfg->UseMUON())
- outputFiles.Add(new TObjString("AliAOD.Muons.root,"));
- if (aodCfg->UseJETAN())
- outputFiles.Add(new TObjString("AliAOD.Jets.root,"));
- if (aodCfg->UsePWGDQJPSIfilter())
- outputFiles.Add(new TObjString("AliAOD.Dielectron.root,"));
+ // outputFiles.Add(new TObjString("EventStat_temp.root"));
+ outputFiles.Add(new TObjString("AODQA.root"));
outputFiles.Add(new TObjString("pyxsec_hists.root"));
+
+ Bool_t mergeTrees = stage <= 1;
+ if (mergeTrees) {
+ outputFiles.Add(new TObjString("AliAOD.root"));
+ if (aodCfg->UsePWGHFvertexing())
+ outputFiles.Add(new TObjString("AliAOD.VertexingHF.root"));
+ if (aodCfg->UseESDfilter() &&
+ aodCfg->UseMUONcopyAOD() &&
+ detCfg->UseMUON())
+ outputFiles.Add(new TObjString("AliAOD.Muons.root"));
+ if (aodCfg->UseJETAN())
+ outputFiles.Add(new TObjString("AliAOD.Jets.root"));
+ if (aodCfg->UsePWGDQJPSIfilter())
+ outputFiles.Add(new TObjString("AliAOD.Dielectron.root"));
+ }
+
TString mergeExcludes = "";
TIter iter(&outputFiles);
TObjString* str = 0;
TString& outputFile = str->GetString();
// Skip already merged outputs
if (!gSystem->AccessPathName(outputFile)) {
- printf("Output file <%s> found. Not merging again.",outputFile.Data());
+ ::Warning("Merge","Output file <%s> found. Not merging again.",
+ outputFile.Data());
continue;
}
if (mergeExcludes.Contains(outputFile.Data())) continue;
- merged = AliAnalysisAlien::MergeOutput(outputFile, outputDir, 10, 0);
+ merged = AliAnalysisAlien::MergeOutput(outputFile,
+ outputDir,
+ 10,
+ stage);
if (!merged) {
- printf("ERROR: Cannot merge %s\n", outputFile.Data());
+ ::Error("Merge", "Cannot merge %s\n", outputFile.Data());
continue;
}
}
+
// all outputs merged, validate
- ofstream out;
- out.open("outputs_valid", ios::out);
- out.close();
+ if (!outputDir.Contains("stage")) {
+ ValidateOutput();
+ timer.Print();
+ return;
+ }
+
+ // --- set up to run terminate -------------------------------------
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ mgr->SetSkipTerminate(kFALSE);
+ if (!mgr->InitAnalysis()) return;
+
+ mgr->PrintStatus();
+ mgr->SetGridHandler(new AliAnalysisAlien);
+ mgr->StartAnalysis("gridterminate",0);
+ ValidateOutput();
timer.Print();
+
}
//====================================================================
//
// --- Analysis manager and load libraries -------------------------
AliAnalysisManager *mgr = new AliAnalysisManager("Filter","Production train");
+ mgr->SetRunFromPath(grp->run);
if (aodCfg->UseSysInfo()) mgr->SetNSysInfo(100);
if (!LoadAnalysisLibraries()) {
::Error("AnalysisTrain", "Could not load analysis libraries");
mgr->SetOutputEventHandler(aodHandler);
}
- // --- Debugging if needed -----------------------------------------
- if (aodCfg->UseDBG()) mgr->SetDebugLevel(3);
-
// === Set up tasks ================================================
//
// --- Create tasks ------------------------------------------------
AddAnalysisTasks(cdbPath);
+ // --- Debugging if needed -----------------------------------------
+ if (aodCfg->UseDBG()) mgr->SetDebugLevel(3);
+
+
// --- If merging, do so here and exit -----------------------------
if (stage > 0) {
- AODMerge();
- mgr->InitAnalysis();
- mgr->SetGridHandler(new AliAnalysisAlien);
- mgr->StartAnalysis("gridterminate",0);
+ AODMerge(xmlfile, stage);
return;
}
// === Run the analysis ============================================
// --- Run the thing -----------------------------------------------
TStopwatch timer;
timer.Start();
+ if (!mgr->InitAnalysis()) return;
+
+
+ mgr->PrintStatus();
mgr->SetSkipTerminate(kTRUE);
- if (mgr->InitAnalysis()) {
- mgr->PrintStatus();
- mgr->StartAnalysis("local", chain);
- }
+ mgr->StartAnalysis("local", chain);
timer.Print();
}
*
*
*/
+//====================================================================
/**
* Base class for detector configuration. By default, everything is on
* except ACORDE.
/** Global variable */
VirtualDetCfg* detCfg = 0;
+//====================================================================
/**
* Base class for the OCDG configration
*/
/** Global variable */
VirtualOCDBCfg* ocdbCfg = 0;
+//====================================================================
+/**
+ * Event generator configuration
+ *
+ */
struct VirtualEGCfg
{
TString runType;
/** Global variable */
VirtualEGCfg* egCfg = 0;
+//====================================================================
+/**
+ * Base class for trains
+ *
+ */
+struct VirtualTrain
+{
+
+
+ /**
+ * Run this train
+ *
+ * @param run
+ * @param xmlFile
+ * @param stage
+ * @param cdb
+ *
+ * @return
+ */
+ Bool_t Run(UInt_t run,
+ const char* xmlFile = "wn.xml",
+ Int_t stage = 0,
+ const char* cdb = "raw://")
+ {
+ // --- Load configuration script ---------------------------------
+ LoadConfig();
+
+ // --- Set-up for CDB access through Grid ------------------------
+ TString cdbString(cdb);
+ if (cdbString.Contains("raw://")) {
+ TGrid::Connect("alien://");
+ if (!gGrid || !gGrid->IsConnected()) {
+ ::Error("Run", "No grid connection");
+ return false;
+ }
+ }
+
+ // --- Some environment variables --------------------------------
+ // Temp dir is here, and compilation is here too
+ gSystem->Setenv("TMPDIR", gSystem->pwd());
+ gSystem->SetBuildDir(gSystem->pwd(), kTRUE);
+
+ // --- Now load common libraries ---------------------------------
+ LoadBaseLibraries();
+
+ // --- Now create and configure manager --------------------------
+ AliAnalysisManager *mgr = new AliAnalysisManager(GetName(),
+ "Production train");
+ mgr->SetRunFromPath(grp->run);
+
+ // --- Create ESD input handler ------------------------------------
+ AliESDInputHandlerRP *esdHandler = new AliESDInputHandlerRP();
+ mgr->SetInputEventHandler(esdHandler);
+ if (UseFriends()) {
+ esdHandler->SetReadFriends(kTRUE);
+ esdHandler->SetActiveBranches("ESDfriend");
+ }
+
+ // --- Monte Carlo handler -----------------------------------------
+ if (UseMC()) {
+ AliMCEventHandler* mcHandler = new AliMCEventHandler();
+ mgr->SetMCtruthEventHandler(mcHandler);
+ mcHandler->SetPreReadMode(1);
+ mcHandler->SetReadTR(true);
+ }
+ // --- AOD output handler ----------------------------------------
+ if (MakeAOD()) {
+ AliAODHandler* aodHandler = new AliAODHandler();
+ aodHandler->SetOutputFileName("AliAOD.root");
+ mgr->SetOutputEventHandler(aodHandler);
+ }
+
+ // --- Call user routine for adding tasks ------------------------
+ if (!AddTasks()) return false;
+
+ // --- Check if we are to merge ----------------------------------
+ if (stage > 0)
+ return Merge(xmlfile, stage);
+
+ // --- Otherwise run the train -----------------------------------
+ TChain* chain = CreateChain();
+ if (!chain) return false;
+
+ TStopwatch timer;
+ timer.Start();
+ if (!mgr->InitAnalysis()) {
+ ::Error("Run", "Failed to initialize the train");
+ return false;
+ }
+
+ mgr->PrintStatus();
+ mgr->SetSkipTerminate(kTRUE);
+ mgr->StartAnalysis("local", chain);
+ timer.Print();
+
+ }
+ /**
+ * Merge requested files
+ *
+ * @param dir Output directory
+ * @param stage Stage
+ *
+ * @return true on success
+ */
+ Bool_t Merge(const char* dir, Int_t stage)
+ {
+
+ TStopwatch timer;
+ timer.Start();
+ TString outputDir = dir;
+ Bool_t final = outputDir.Contains("Stage");
+ TCollection* outputFiles = GetFilesToMerge(stage, final);
+ if (!outputFiles) {
+ ::Warning("Merge", "Nothing to merge");
+ return true;
+ }
+ TIter iter(outputFiles);
+ TObjString* str = 0;
+ Bool_t merged = kTRUE;
+ while((str = static_cast<TObjString*>(iter()))) {
+ TString& outputFile = str->GetString();
+ // Skip already merged outputs
+ if (!gSystem->AccessPathName(outputFile)) {
+ ::Warning("Merge","Output file <%s> found. Not merging again.",
+ outputFile.Data());
+ continue;
+ }
+ merged = AliAnalysisAlien::MergeOutput(outputFile,
+ outputDir,
+ 10,
+ stage);
+ if (merged) continue;
+
+ ::Error("Merge", "Cannot merge %s\n", outputFile.Data());
+ }
+ // --- possible merge file information files ---------------------
+ if (MergeFileInfo()) {
+ TString infolog = "fileinfo.log";
+ AliAnalysisAlien::MergeInfo(infolog, dir);
+ }
+
+ // --- If not final stage, get out here --------------------------
+ if (!final) {
+ ValidateOutput();
+ timer.Print();
+ return true;
+ }
+
+ // --- set up and run termiante ----------------------------------
+ AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
+ mgr->SetSkipTerminate(kFALSE);
+ if (!mgr->InitAnalysis()) {
+ ::Error("Merge", "Failed to initialize the train");
+ return false;
+ }
+
+ mgr->PrintStatus();
+ mgr->StartAnalysis("gridterminate", (TTree*)0);
+ ValidateOutput();
+ timer.Print();
+
+ return true;
+ }
+
+ /**
+ * Load a library/module
+ *
+ * @param module Library/module name
+ *
+ * @return true on success
+ */
+ Bool_t LoadLibrary(const char *module)
+ {
+ // Load a module library in a given mode. Reports success.
+ Int_t result = 0;
+ TString mod(module);
+ ::Info("LoadLibrary", "Loading %s", module);
+ gROOT->IncreaseDirLevel();
+
+ if (mod.IsNull()) {
+ ::Error("AnalysisTrainNew.C::LoadLibrary", "Empty module name");
+ gROOT->DecreaseDirLevel();
+ return kFALSE;
+ }
+
+ // If a library is specified, just load it
+ if (mod.EndsWith(".so")) {
+ mod.Remove(mod.Index(".so"));
+ ::Info("LoadLibrary", "Loading .so: %s", mod.Data());
+ result = gSystem->Load(mod);
+ if (result < 0) {
+ ::Error("AnalysisTrainNew.C::LoadLibrary",
+ "Could not load library %s", module);
+ }
+ gROOT->DecreaseDirLevel();
+ return (result >= 0);
+ }
+ // Check if the library is already loaded
+ if (strlen(gSystem->GetLibraries(Form("%s.so", module), "", kFALSE)) > 0) {
+ ::Info("LoadLibrary", "Module %s.so already loaded", module);
+ gROOT->DecreaseDirLevel();
+ return kTRUE;
+ }
+
+ ::Info("LoadLibrary", "Trying to load lib%s.so", module);
+ result = gSystem->Load(Form("lib%s.so", module));
+ if (result < 0)
+ ::Error("AnalysisTrainNew.C::LoadLibrary",
+ "Could not load module %s", module);
+ ::Info("LoadLibrary", "Module %s, successfully loaded", module);
+ gROOT->DecreaseDirLevel();
+ return (result >= 0);
+ }
+ /**
+ * Load common libraries
+ *
+ * @return true on sucess
+ */
+ virtual Bool_t LoadBaseLibraries()
+ {
+ // Load common analysis libraries.
+ if (!gSystem->Getenv("ALICE_ROOT")) {
+ ::Error("LoadBaseLibraries",
+ "Analysis trains requires that analysis libraries are "
+ "compiled with a local AliRoot");
+ return false;
+ }
+
+ Bool_t success = true;
+ // Load framework classes. Par option ignored here.
+ success &= LoadLibrary("libSTEERBase.so");
+ success &= LoadLibrary("libESD.so");
+ success &= LoadLibrary("libAOD.so");
+ success &= LoadLibrary("libANALYSIS.so");
+ success &= LoadLibrary("libOADB.so");
+ success &= LoadLibrary("libANALYSISalice.so");
+ success &= LoadLibrary("libESDfilter.so");
+ success &= LoadLibrary("libCORRFW.so");
+ success &= LoadLibrary("libPWGPP.so");
+ gROOT->ProcessLine(".include $ALICE_ROOT/include");
+ if (success) {
+ ::Info("LoadBaseLibraries",
+ "Load common libraries: SUCCESS");
+ ::Info("LoadBaseLibraries",
+ "Include path for Aclic compilation:\n%s",
+ gSystem->GetIncludePath());
+ } else {
+ ::Info("LoadBaseLibraries",
+ "Load common libraries: FAILED");
+ }
+ return success;
+ }
+ /**
+ * Create the input chain
+ *
+ * @return Pointer to newly allocated train
+ */
+ TChain* CreateChain()
+ {
+ if (gSystem->AccessPathName("AliESDs.root")) {
+ ::Error("CreateChain",
+ "File: AliESDs.root not in ./data dir");
+ return 0;
+ }
+
+ // Create the input chain
+ TChain* chain = new TChain("esdTree");
+ chain->Add("AliESDs.root");
+ if (!chain->GetNtrees()) {
+ delete chain;
+ chain = 0;
+ }
+
+ return chain;
+ }
+ /**
+ * Helper function to make @c outputs_valid file
+ *
+ */
+ void ValidateOutput()
+ {
+ std::ofstream out;
+ out.open("outputs_valid", ios::out);
+ out.close();
+ }
+
+ /**
+ * @{
+ * @name Functions to overload
+ */
+ /**
+ * Load the configuration script. Override to load specific script.
+ */
+ virtual void LoadConfig() {};
+ /**
+ * Override to set a name of the analysis manager
+ *
+ * @return Name of analysis manager
+ */
+ virtual const char* GetName() const { return "dummy"; }
+ /**
+ * Override to return true if friends are needed.
+ *
+ * @return false
+ */
+ virtual Bool_t UseFriends() const { return false; }
+ /**
+ * Override to return true if MC info is needed
+ *
+ * @return false
+ */
+ virtual Bool_t UseMC() const { return false; }
+ /**
+ * Override to return true if AODs should be made
+ *
+ * @return false
+ */
+ virtual Bool_t MakeAOD() const { return false; }
+ /**
+ * User rountine for adding tasks. Override to add tasks to the
+ * train.
+ *
+ * @return true
+ */
+ virtual Bool_t AddTasks() const { return true; }
+ /**
+ * Override to return true to merge file information files.
+ *
+ * @return false
+ */
+ virtual Bool_t MergFileInfo() const { return false; }
+ /**
+ * Return the list of ouput files (TObjString objects)
+ *
+ * @param stage Merge stage
+ * @param final Final merging (also terminate)
+ *
+ * @return Pointer to TCollection.
+ */
+ virtual TCollection* GetFilesToMerge(Int_t stage, Bool_t final) const
+ {
+ return 0;
+ }
+};
+
+
+//====================================================================
/**
* A function so that we can do TROOT::Macro. Does nothing but print a message.
*
};
OutputDir = "@out@/$3/$1";
OutputArchive = {
- "$4_merge_log_archive.zip:std*,fileinfo*.log@disk=1",
- "$4_merge_archive.zip:*$4*.root,*.stat*@disk=2"
+ "$4_merge_log_archive.zip:std*,*.log,fileinfo*.log@disk=1",
+ "$4_merge_archive.zip:Ali$4*.root,$4*.root,trending.root,EventStat_temp.root,pyxsec_hists.root,*.stat*@disk=2"
};
TTL = "36000";
Price = "1";
InputDataList="wn.xml";
OutputDir="@out@/$3/$1/$4_Stage_$2/#alien_counter_03i#";
OutputArchive={
- "$4_log_archive.zip:std*,fileinfo*.log@disk=1",
- "$4_archive.zip:EventStat_temp.root,*$4*.root,*.stat*@disk=2"
+ "$4_log_archive.zip:std*,*.log@disk=1",
+ "$4_archive.zip:EventStat_temp.root,pyxsec_hists.root,Ali$4*.root,$4*.root,*.stat*@disk=2"
};
Split="se";
SplitMaxInputFileNumber="20";
qaFBFCE->SelectCollisionCandidates(AliVEvent::kCentral);
}
}
+/**
+ * Helper function to make @c outputs_valid file
+ *
+ */
+void ValidateOutput()
+{
+ std::ofstream out;
+ out.open("outputs_valid", ios::out);
+ out.close();
+}
//====================================================================
/**
// Merging method
TStopwatch timer; timer.Start();
TString outputDir = dir;
- TString outputFiles = "QAresults.root,EventStat_temp.root";
+ TObjArray outputFiles;
+ outputFiles.Add(new TObjString("QAresults.root"));
+ outputFiles.Add(new TObjString("EventStat_temp.root"));
+
TString mergeExcludes = "";
- TObjArray* tokens = outputFiles.Tokenize(",");
- TIter iter(tokens);
+ TIter iter(&outputFiles);
TObjString* str = 0;
- TString outputFile;
Bool_t merged = kTRUE;
while((str = static_cast<TObjString*>(iter()))) {
- outputFile = str->GetString();
+ TString& outputFile = str->GetString();
// Skip already merged outputs
if (!gSystem->AccessPathName(outputFile)) {
- printf("Output file <%s> found. Not merging again.",
- outputFile.Data());
+ ::Warning("Merge","Output file <%s> found. Not merging again.",
+ outputFile.Data());
continue;
}
if (mergeExcludes.Contains(outputFile.Data())) continue;
10,
stage);
if (!merged) {
- printf("ERROR: Cannot merge %s\n", outputFile.Data());
- continue;
+ ::Error("Merge", "Cannot merge %s\n", outputFile.Data());
+ continue;
}
}
TString infolog = "fileinfo.log";
AliAnalysisAlien::MergeInfo(infolog, dir);
if (!outputDir.Contains("Stage")) {
- ofstream out;
- out.open("outputs_valid", ios::out);
- out.close();
+ ValidateOutput();
+ timer.Print();
return;
}
// --- Set up to run terminate -------------------------------------
AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
- mgr->SetRunFromPath(mgr->GetRunFromAlienPath(dir));
mgr->SetSkipTerminate(kFALSE);
if (!mgr->InitAnalysis()) return;
+
mgr->PrintStatus();
- AliLog::SetGlobalLogLevel(AliLog::kError);
- TTree *tree = NULL;
- gROOT->cd();
- mgr->StartAnalysis("gridterminate", tree);
- ofstream out;
- out.open("outputs_valid", ios::out);
- out.close();
+ mgr->StartAnalysis("gridterminate", (TTree*)0);
+ ValidateOutput();
timer.Print();
}
// --- Run the thing -----------------------------------------------
TStopwatch timer;
timer.Start();
- if (mgr->InitAnalysis()) {
- mgr->PrintStatus();
- mgr->SetSkipTerminate(kTRUE);
- mgr->SetNSysInfo(1);
- mgr->StartAnalysis("local", chain);
- }
+ if (!mgr->InitAnalysis()) return;
+
+ mgr->PrintStatus();
+ mgr->SetSkipTerminate(kTRUE);
+ mgr->SetNSysInfo(1);
+ mgr->StartAnalysis("local", chain);
timer.Print();
}
/** @return NEEDS MCtruth */
virtual Bool_t DoV0() const { return false; }
/** @return Get Debug level */
- virtual Int_t DebugLevel() const { return 1; }
+ virtual Int_t DebugLevel() const { return 3; }
};
/**
#!/bin/bash
-version=5
+version=6
tag=
id=
run=
geant=""
minmerge=30
noact=0
+inp=
# --- Display help message -------------------------------------------
usage()
-r|--root RELEASE Set ROOT release [*] ($root)
-g|--geant RELEASE Set GEANT3 release [*] ($geant)
-f|--final NUMBER Run final merging when down to this ($minmerge)
+ -I|--input DIR Directory of production
[*] Only make sense with option -c
[**] Only make sense for stage 0
log_end cp.log $?
}
+
+# --- Do a search ----------------------------------------------------
+find()
+{
+ local dir=$1
+ local pat=$2
+ local out=$3
+ local tmp=$4
+ local max=1000
+ log_msg "" "Searching \e[33m$dir\e[0m for \e[33m$pat"
+
+ local nfiles=`alien_find "$dir" "$pat" | grep "files found"`
+ local ret=$?
+ if test $ret -ne 0 || test "x$nfiles" = "x" ; then
+ log_end "" $ret "Not found"
+ return 1
+ fi
+ nfiles=`echo "$nfiles" | sed -e 's/^ *//' -e 's/ *files found//'`
+ log_msg "" "\e[34m$nfiles"
+ if test $nfiles -le $max ; then
+ alien_find -x "$out" "$dir" "$pat" > $tmp 2> find.log
+ ret=$?
+ log_end "" $? " Got $nfiles in \e[33m${tmp}"
+ fi
+
+ o=0
+ rm -f find.log
+ rm -f ${tmp}.tmp
+ while test $o -lt $nfiles ; do
+ let e=$o+$max
+ log_msg "" "${o}"
+ alien_find -l $max -o $o -x "$out" "$dir" "$pat" > ${tmp}.$o 2>>find.log
+ ret=$?
+ if test $ret -ne 0 ; then break; fi
+
+ if test "x$o" = "x" ; then o=0 ; fi
+
+ let p1=$o/10
+ let p2=$p1/10
+ let p3=$p2/10
+ if test $o -eq 0 ; then
+ p1=
+ p2=
+ p3=
+ fi
+
+ # printf "%5d: %-16s '%-4s' '%-4s' '%-4s'\n" $o $i $p1 $p2 $p3
+
+ t=`basename $i .log`.tmp
+ sed -e '/<?xml version="1.0"?>/d' \
+ -e '/<\/*alien>/d' \
+ -e '/<\/*collection.*/d' \
+ -e '/<info .*/d' \
+ -e '/^[[:space:]]*$/d' \
+ -e "s/event name=\"\([0-9][0-9][0-9]\)\"/event name=\"$p3\1\"/g" \
+ -e "s/event name=\"\([0-9][0-9]\)\"/event name=\"$p2\1\"/g" \
+ -e "s/event name=\"\([0-9]\)\"/event name=\"$p1\1\"/g" \
+ < ${tmp}.$o >> ${tmp}.tmp
+ let o=$o+$max
+ done
+ if test $o -eq 0 ; then
+ log_end "" 1 "No files found"
+ return 1
+ fi
+ sed -n -e '/<?xml.*?>/p' \
+ -e '/<alien>/p' \
+ -e '/<collection .*/p' \
+ < ${tmp}.0 > $tmp
+ cat ${tmp}.tmp >> $tmp
+ sed -n -e '/<info.*>/p' \
+ -e '/<\/alien>/p' \
+ -e '/<\/collection/p' \
+ < ${tmp}.0 >> $tmp
+
+ log_end "" 0 " Got $nfiles ($o) in \e[33m${tmp}"
+}
+
# --- Run merging jpb ------------------------------------------------
merge()
{
local what=$1
local stage=$2
local dir=$3
- local out=$4
+ local aout=$4
local tag=$5
local run=$6
local tmpdir=`mktemp -d`
local pre=$what
- if test "x$what" = "xAOD" ; then
- pre="aod";
+ local sub=
+ if test "x$what" = "xAOD"; then
+ echo "AOD run $run pre=$pre sub=$sub"
+ if test "x$run" = "x138190" ; then
+ echo "Special for PbPb simulation"
+ pre="aod"
+ else
+ pre="AOD";
+ sub="AOD/";
+ fi
fi
- local top=${out}/${tag}/${run}
+ local out=${aout}/${tag}/${run}
+ local top=${aout}/${tag}/${run}
local bse=${what}_Stage_${stage}.xml
local xml=${tmpdir}/${bse}
local arc=${pre}_archive.zip
local jdl=Merge.jdl
local ret=0
-
+ if test "x$inp" != "x" ; then
+ out=${inp}/${tag}/${run}
+ fi
+
rm -f cp.log
- log_msg cp.log "Creating XML file \e[33m${xml}"
+ if test $noact -gt 0 && test -f ${bse} ; then
+ log_msg cp.log "Dummy XML from ${bse}"
+ cp ${bse} ${xml}
+ fi
+
+ log_msg cp.log "Creating XML file"
if test $stage -eq 1 ; then
- rm -f ${xml}
- alien_find -x ${top}/${bse} ${top} */${arc} > ${xml} 2>>cp.log
+ if test $noact -lt 1 || test ! -f $xml ; then
+ rm -f ${xml}
+ find ${out} ${sub}*/${arc} ${top}/${bse} ${xml}
+ fi
ret=$?
else
let prev=$stage-1
- rm -f ${xml}
- alien_find -x ${top}/${bse} ${top}/${what}_Stage_${prev} */${arc} \
- > ${xml} 2>>cp.log
+ if test $noact -lt 1 || test ! -f $xml ; then
+ rm -f ${xml}
+ find ${top}/${what}_Stage_${prev} */${arc} ${sub}*/${arc} ${top}/${bse} ${xml}
+ fi
ret=$?
fi
log_end cp.log $ret
fi
echo -e "\e[33m$n\e[0m input files for \e[32m${what} stage ${stage}\e[0m"
+ if test $noact -lt 1 ; then
+ alien_mkdir -p ${top}
+ fi
copy ${xml} ${top} del
log_msg "" "Submitting merging job \e[33m${jdl}"
if test $noact -lt 1 ; then
alien_submit alien:${dir}/${jdl} ${run} ${stage} ${tag} ${what}
+ else
+ log_msg "" "alien_submit alien:${dir}/${jdl} ${run} ${stage} ${tag} ${what}"
fi
log_end "" $?
}
# --- Determine the next stage ---------------------------------------
progress()
{
- local out=$1
+ local aout=$1
+ local id=$2
+ local run=$3
+ local inp=$4
+ local what=$5
+ local out=${aout}/${id}/${run}
+ local first=$out
+ if test "x$inp" != "x" ; then
+ first=${inp}/${id}/${run}
+ fi
+ case $what:$run in
+ AOD:138190) ;;
+ AOD:*) first=${first}/AOD ;;
+ *) ;;
+ esac
+
log_msg "" "Deduce next stage for \e[33m$out"
# First, check for final merge result
- # echo -e "\nCheck of ${out}/QA_merge_archive.zip"
- alien_ls ${out}/QA_merge_archive.zip > /dev/null 2>&1
+ log_msg "" "\nCheck of \e[33m${out}/${what}_merge_archive.zip"
+ alien_ls ${out}/${what}_merge_archive.zip > /dev/null 2>&1
if test $? -eq 0 ; then
+ echo "Forcing 6"
stage=6
else
# Then check for production data
- # echo -e "\nCheck of ${out}/001"
- alien_ls ${out}/001 > /dev/null 2>&1
+ log_msg "" "\nCheck of \e[33m${first}/001"
+ alien_ls ${first}/001 > /dev/null 2>&1
ret=$?
# echo "ret=$ret"
if test $ret -ne 0 ; then
- # echo "No output, stage 0 to be done"
+ echo "No output, stage 0 to be done"
stage=0
else
# Finally, check each merge stage
tmp=0
stage=0
for i in 4 3 2 1; do
- # echo -e "\nCheck of ${out}/QA_Stage_${i}"
- alien_ls ${out}/QA_Stage_${i} > /dev/null 2>&1
+ log_msg "" "\nCheck of \e[33m${out}/${what}_Stage_${i}"
+ alien_ls ${out}/${what}_Stage_${i} > /dev/null 2>&1
if test $? -ne 0 ; then
tmp=$i
else
AOD.C \
Check.C \
Config.C \
+ BaseConfig.C \
+ DetConfig.C \
+ EGConfig.C \
doit.sh \
Final.jdl.in \
GRP.C \
-g|--geant) geant=$2 ; shift ;;
-f|--final) minmerge=$2 ; shift ;;
-A|--archive) archive ; exit 0 ;;
- -x|--dry-run) noact=1 ;;
+ -x|--dry-run|--no-act) noact=1 ;;
+ -I|--input) inp=$2 ; shift ;;
--) shift ; break ;;
*) log_err "Unknown option" "$1" ; exit 1 ;;
esac
fi
case $stage in
0|1|2|3|4|5) : ;;
- 6) progress $aout/$id/$run ;;
+ 6)
+ for s in $stages ; do
+ progress $aout $id $run $inp $s
+ done
+ ;;
*) log_err "Invalid stage" "$stage" ; exit 1 ;;
esac
if test $stage -ge 6 ; then
log_msg "" "Submitting \e[33mRun.jdl\e[0m for \e[34m$id run\e[0m (\e[34m$jobs\e[0m jobs w/\e[34m$events)"
if test $noact -lt 1 ; then
echo "alien_submit alien:${adir}/Run.jdl ${run} ${jobs} ${events} ${id} $@"
- alien_submit alien:${adir}/Run.jdl ${run} ${jobs} ${events} ${id} "$@"
+ if test $# -gt 0 ; then
+ opt=$1
+ else
+ opt=0
+ fi
+ alien_submit alien:${adir}/Run.jdl ${run} ${jobs} ${events} ${id} "$opt"
ret=$?
fi
log_end "" $ret
`which aliroot`
`ulimit -a`
`free -m`
+Content of directory
+`ls -al`
=========================================
EOF
exit 1
fi
ARG="${which}.C($run,\"$dir\",$stage)"
+echo "Running aliroot -b -q -x $ARG"
time aliroot -b -q -x $ARG
exitcode=$?