Int_t proof = 0,
Bool_t mc = false,
Bool_t centrality = true,
- const char* name = 0)
+ const char* name = 0,
+ bool debug = false)
{
// --- Possibly use plug-in for this -------------------------------
if ((name && name[0] != '\0') && gSystem->Load("libRAliEn") >= 0) {
t.SetDataDir(esddir);
t.SetDataSet("");
t.SetProofServer(Form("workers=%d",proof));
+ t.SetUseGDB(debug);
t.Run(proof > 0 ? "PROOF" : "LOCAL", "FULL", nEvents, mc, proof > 0);
return;
}
--- /dev/null
+#ifndef __CINT__
+# include <TSystemDirectory.h>
+# include <TObjArray.h>
+# include <TString.h>
+# include <TList.h>
+# include <TSystem.h>
+#else
+class TSystemDirectory;
+class TList;
+class TString;
+#endif
+
+//__________________________________________________________________
+/**
+ * Scan directory @a dir (possibly recursive) for tree files to add
+ * to the chain. This does not follow sym-links
+ *
+ * @param dir Directory to scan
+ * @param chain Chain to add to
+ * @param type Type of tree (ESD or AOD)
+ * @param recursive Whether to scan recursively
+ * @param mc Look also for MC files if true
+ *
+ * @return true if any files where added
+ */
+Bool_t ScanDirectory(const TString& pattern, TSystemDirectory* dir, TList& list,
+ Bool_t recursive=false)
+{
+ // Assume failure
+ Bool_t ret = false;
+
+ // Get list of files, and go back to old working directory
+ TString oldDir(gSystem->WorkingDirectory());
+ TList* files = dir->GetListOfFiles();
+ if (!gSystem->ChangeDirectory(oldDir)) {
+ Error("ScanDirectory", "Failed to go back to %s", oldDir.Data());
+ return false;
+ }
+ if (!files) return false;
+
+ // Sort list of files and check if we should add it
+ files->Sort();
+ TIter next(files);
+ TSystemFile* file = 0;
+ while ((file = static_cast<TSystemFile*>(next()))) {
+ TString name(file->GetName());
+ TString title(file->GetTitle());
+ TString full(gSystem->ConcatFileName(file->GetTitle(), name.Data()));
+ Bool_t isFile(!file->IsDirectory());
+ if (isFile) full = title;
+ // Ignore special links
+ if (name == "." || name == "..") {
+ // Info("ScanDirectory", "Ignoring %s", name.Data());
+ continue;
+ }
+
+ FileStat_t fs;
+ if (gSystem->GetPathInfo(full.Data(), fs)) {
+ Warning("ScanDirectory", "Cannot stat %s (%s)", full.Data(),
+ gSystem->WorkingDirectory());
+ continue;
+ }
+ // Check if this is a directory
+ if (!isFile) {
+ if (recursive) {
+ // if (title[0] == '/')
+ TSystemDirectory* d = new TSystemDirectory(file->GetName(),
+ full.Data());
+ if (ScanDirectory(pattern, d, list, recursive))
+ ret = true;
+ delete d;
+ }
+ continue;
+ }
+
+ // If this is not a root file, ignore
+ if (!name.EndsWith(".root")) continue;
+
+ // If this file does not contain AliESDs, ignore
+ if (!name.Contains(pattern)) {
+ // Info("ScanDirectory", "%s does not match pattern %s",
+ // name.Data(), fnPattern.Data());
+ continue;
+ }
+
+ // Add
+ // Info("ScanDirectory", "Adding %s", full.Data());
+ list.Add(new TObjString(full));
+ }
+
+ if (list.GetEntries() > 0) ret = true;
+
+ gSystem->ChangeDirectory(oldDir);
+ return ret;
+}
+
+//__________________________________________________________________
+struct EventInfo
+{
+ int fRunNo;
+} event;
+
+
+//__________________________________________________________________
+void MakeTrendTree(const char* dir=".", const char* pattern="trending")
+{
+ TList files;
+
+ TSystemDirectory* top = new TSystemDirectory(dir, dir);
+ if (!ScanDirectory(pattern, top, files)) {
+ return;
+ }
+
+ TFile* out = TFile::Open("trending_tree.root", "RECREATE");
+ if (!out) {
+ Error("MakeTrendTree", "Failed to open output file");
+ return;
+ }
+
+ TTree* tree = new TTree("T", "T");
+ tree->Branch("event", "runno/I", &event);
+}
+
+//__________________________________________________________________
+//
+// EOF
+//
#!/bin/bash
-# --------------------------------------------------------------------
-uid=`id -u`
-genv_file=/tmp/gclient_env_${uid}
-
-if test ! -f ${genv_file} ; then
- echo "No such file: ${genv_file}, please do alien-token-init" >/dev/stderr
- exit 1
-fi
-alien-token-info | grep -q "Token is still valid"
-if test $? -ne 0 ; then
- echo "Token not valid, please re-new" > /dev/stderr
- exit 1
-fi
-
# --------------------------------------------------------------------
verb=0
-p,--production IDENTIFIER Production identifier [$prod]
-y,--year YEAR Year of production [$year]
-P,--pass NUMBER Reconstruction pass number [$pass]
+ -Q,--pre-pass STRING Prefix to pass identifier [${prep}]
+ -R,--post-pass STRING Postfix to pass identifier [$post]
-d,--destination DIRECTORY Directory to store result in [$dest]
-r,--run NUMBER Run number [$runn]
-q,--qa NUMBER QA number
cat <<EOF > ${scr}.C
void ${scr}()
{
+ int ret = 0;
gSystem->Load("libANALYSIS");
gSystem->Load("libANALYSISalice");
gSystem->Load("libTENDER");
if (!file) {
Error("${scr}", "No such file ${inp}");
exit(1);
- return false;
}
TObject* forward1 = file->Get("Forward");
if (!forward1) {
Error("${scr}", "No Forward object found in ${inp}");
- exit(2);
- ret = false;
+ ret |= 2;
}
TObject* forward2 = file->Get("ForwardResults");
if (!forward2) {
Error("${scr}", "No ForwardResults object found in ${inp}");
- exit(4);
+ ret |= 4;
}
- exit(0);
+ exit(ret);
}
EOF
# cat ${scr}.C
}
# --------------------------------------------------------------------
-year=
-prod=
-pass=1
-qual=
+year=""
+prod=""
+pass=-1
+prep=""
+post=""
dest=.
runn=0
qano=0
noac=0
arch=0
+file=QAresults.root
while test $# -gt 0 ; do
case $1 in
-v|--verbose) let verb=$verb+1 ;;
-p|--production) prod=$2 ; shift ;;
-P|--pass) pass=$2 ; shift ;;
- -Q|--prepass) qual=$2 ; shift ;;
+ -Q|--prepass) prep=$2 ; shift ;;
+ -R|--postpass) post=$2 ; shift ;;
-y|--year) year=$2 ; shift ;;
-d|--destination) dest=$2 ; shift ;;
-r|--run) runn=$2 ; shift ;;
-q|--qa) qano=$2 ; shift ;;
+ -f|--file) file=$2 ; shift ;;
-n|--no-action) noac=1 ;;
-a|--archives) arch=1 ;;
*) echo "$0: Unknown option $1" > /dev/stderr ; exit 2 ;;
shift
done
+# --------------------------------------------------------------------
+uid=`id -u`
+genv_file=/tmp/gclient_env_${uid}
+
+if test ! -f ${genv_file} ; then
+ echo "No such file: ${genv_file}, please do alien-token-init" >/dev/stderr
+ exit 1
+fi
+. ${genv_file}
+alien-token-info | grep -q "Token is still valid"
+if test $? -ne 0 ; then
+ echo "Token not valid, please re-new" > /dev/stderr
+ exit 1
+fi
+
+
# --------------------------------------------------------------------
if test "x$prod" = "x" ; then
echo "No production identifier given" > /dev/stderr
exit 2
fi
fi
+lett=`echo $prod | sed -e "s/LHC${year}\(.\).*/\1/"`
+suff=`echo $prod | sed -e "s/LHC${year}${lett}//"`
redir="/dev/null"
-if test $verb -gt 1 ; then redir1=/dev/stderr ; fi
+if test $verb -gt 1 ; then redir=/dev/stderr ; fi
# --------------------------------------------------------------------
-path=/alice/data/20${year}/${prod}/
-store=${dest}/${prod}/${qual}pass${pass}
-search="ESDs/${qual}pass${pass}/"
+if test "x$post" != "x" ; then
+ case $post in
+ _*) ;;
+ *) post="_${post}" ;;
+ esac
+fi
+if test ${pass} -ge 0 ; then
+ paid=pass${pass}
+fi
+datd=data
+esdd=ESDs/
+if test "x${suff}" != "x" ; then
+ datd=sim
+ esdd=
+fi
+path=/alice/${datd}/20${year}/${prod}/
+store=${dest}/${prod}/${prep}${paid}${post}
+search="${esdd}${prep}${paid}${post}"
if test $runn -gt 0 ; then
- path=`printf "${path}%09d/ESDs/${qual}pass${pass}/" $runn`
+ path=`printf "${path}%09d/ESDs/${prep}${paid}${pass}${post}/" $runn`
store=`printf "${store}/%09d" $runn`
search=
fi
if test $qano -gt 0 ; then
- path=`printf "%sQA%02d/" $path $qano`
+ if test $runn -gt 0 ; then
+ path=`printf "%sQA%02d/" $path $qano`
+ else
+ if test "x$search" != "x" ; then search=${search}/ ; fi
+ search=${search}QA`printf %02d ${qano}`/
+ fi
fi
if test $arch -gt 0 ; then
- search="${search}QA_archive.zip"
-else
- search="${search}QAresults.root"
+ file=QA_archive.zip
fi
+base=`basename $file .root`
+if test "x$search" != "x" ; then search=${search}/ ; fi
+search="${search}${file}"
+# --------------------------------------------------------------------
cat <<EOF
Settings:
Production: $prod
Year: $year
+ Letter: $lett
+ Suffix: $suff
Pass: $pass
- Pass qualifier: $qual
+ Pass prefix: $prep
+ Pass postfix: $post
+ File: $file
Path: $path
Destination: $dest
Store: $store
Run number: $runn
Search string: $search
+ Verbosity: $verb
+ Redirection: $redir
EOF
# --------------------------------------------------------------------
if test $runn -gt 0 ; then
r=`echo $b | sed -e "s,[0-9]*${runn}\([0-9.]*\)/.*,\1," | tr '.' '_'`
if test $arch -lt 1 ; then
- o=${store}/QAresults_${r}.zip
+ o=${store}/${base}_${r}.root
else
d=${store}/${r}
mkdir -p $d
- o=${d}/QAarchive.zip
+ o=${d}/${file}
fi
else
r=`echo $b | sed -e "s,/.*,,"`
- o=${store}/QAresults_${r}.root
+ o=${store}/${base}_${r}.root
fi
runs="$runs $r"
mess "$i -> $o"
fESDPass(3),
fPassPostfix(""),
fEscapedName(name),
- fAllowOverwrite(kFALSE)
+ fAllowOverwrite(kFALSE),
+ fUseGDB(kFALSE)
{
char c[] = { ' ', '/', '@', 0 };
char* p = c;
*/
void SetPassPostfix(const char* postfix) { fPassPostfix = postfix; }
//__________________________________________________________________
+ /**
+ * Use GDB to wrap PROOF slaves
+ *
+ * @param use Whether to use GDB or not
+ */
+ void SetUseGDB(Bool_t use=kTRUE) { fUseGDB = use; }
+ //__________________________________________________________________
/**
* Add a source file to be copied and byte compiled on slaves
*
fProofServer.Data(), userName.Data());
return false;
}
+ if (fUseGDB) {
+ TProof::AddEnvVar("PROOF_WRAPPERCMD",
+ "gdb --batch -ex run -ex bt --args ");
+ }
if (lite) return true;
}
TList fListOfLibraries; // List of libraries to load
TList fListOfExtras; // List of extra files to upload
Int_t fNReplica; // Storage replication
- Int_t fESDPass;
+ Int_t fESDPass; // ESD pass number
TString fPassPostfix; // Possible pass postfix
- TString fEscapedName;
- Bool_t fAllowOverwrite;
+ TString fEscapedName; // Name escaped for special chars
+ Bool_t fAllowOverwrite; // Allow overwriting output dir
+ Bool_t fUseGDB; // Wrap PROOF slaves in GDB
};