Updates.
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisAlien.h
CommitLineData
c57f56b7 1#ifndef ALIANALYSISALIEN_H
2#define ALIANALYSISALIEN_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6// Author: Mihaela Gheata, 01/09/2008
7
8//==============================================================================
9// AliAnalysisAlien - AliEn utility class. Provides interface for creating
10// a personalized JDL, finding and creating a dataset.
11//==============================================================================
12
13#ifndef ALIANALYSISGRID_H
14#include "AliAnalysisGrid.h"
15#endif
16
17#ifndef ROOT_TString
18#include <TString.h>
19#endif
20
21class TGridJDL;
22
23class AliAnalysisAlien : public AliAnalysisGrid {
24
25public:
26
27 AliAnalysisAlien();
28 AliAnalysisAlien(const char *name);
29 virtual ~AliAnalysisAlien();
30 AliAnalysisAlien(const AliAnalysisAlien& other);
31 AliAnalysisAlien& operator=(const AliAnalysisAlien& other);
32// Setters
f965131e 33 virtual void AddIncludePath(const char *path);
c57f56b7 34 virtual void AddRunNumber(Int_t run);
ee75cfc3 35 virtual void AddRunNumber(const char *run);
c57f56b7 36 virtual void AddDataFile(const char *lfn);
648174cf 37 virtual void AddExternalPackage(const char *name);
c57f56b7 38 virtual void SetExecutable(const char *name="analysis.sh") {fExecutable = name;}
0a1c1f7f 39 virtual void SetExecutableCommand(const char *command="root -b -q") {fExecutableCommand = command;}
c57f56b7 40 virtual void SetArguments(const char *name="") {fArguments = name;}
631c0b05 41 virtual void SetExecutableArgs(const char *name="") {fExecutableArgs = name;}
c57f56b7 42 virtual void SetAnalysisMacro(const char *name="myAnalysis.C") {fAnalysisMacro = name;}
43 virtual void SetAnalysisSource(const char *name="myAnalysisClass.cxx") {fAnalysisSource = name;}
44 virtual void SetAdditionalLibs(const char *list) {fAdditionalLibs = list;}
d5c6455a 45 virtual void SetAdditionalRootLibs(const char *list) {fAdditionalRootLibs = list;}
c57f56b7 46 virtual void SetPrice(Int_t price=1) {fPrice = price;}
a8739e8a 47 virtual void SetRunRange(Int_t min, Int_t max) {fRunRange[0] = min; fRunRange[1] = max;}
c6cb3634 48 virtual void SetJobTag(const char *tag="") {fJobTag = tag;}
319593fb 49 virtual void SetNrunsPerMaster(Int_t nruns=1) {fNrunsPerMaster = nruns;}
16a4353c 50 virtual void SetMaxMergeFiles(Int_t nfiles) {fMaxMergeFiles = nfiles;}
c57f56b7 51 virtual void SetSplitMode(const char *type="se") {fSplitMode = type;}
52 virtual void SetSplitMaxInputFileNumber(Int_t nfiles=100) {fSplitMaxInputFileNumber = nfiles;}
53 virtual void SetAPIVersion(const char *version="V2.4") {fAPIVersion = version;}
54 virtual void SetROOTVersion(const char *version="v5-21-01-alice") {fROOTVersion = version;}
55 virtual void SetAliROOTVersion(const char *version="v4-14-Rev-02") {fAliROOTVersion=version;}
56 virtual void SetUser(const char *user) {fUser = user;}
57 virtual void SetTTL(Int_t ttl=30000) {fTTL = ttl;}
58 virtual void SetGridWorkingDir(const char *name="workdir") {fGridWorkingDir = name;}
59 virtual void SetGridDataDir(const char *name) {fGridDataDir = name;}
60 virtual void SetDataPattern(const char *pattern="*AliESDs.root") {fDataPattern = pattern;}
0df6ccf2 61 virtual void SetFriendChainName(const char *name="") {fFriendChainName = name;}
bb885a9e 62 virtual void SetDefaultOutputs(Bool_t flag);
c57f56b7 63 virtual void SetGridOutputDir(const char *name="output") {fGridOutputDir = name;}
64 virtual void SetOutputArchive(const char *list="log_archive.zip:stdout,stderr root_archive.zip:*.root") {fOutputArchive = list;}
65 virtual void SetOutputFiles(const char *list) {fOutputFiles = list;}
cd11251e 66 virtual void SetOutputToRunNo(Int_t mode=1) {fOutputToRunNo = mode;}
c57f56b7 67 virtual void SetInputFormat(const char *format="xml-single") {fInputFormat = format;}
68 virtual void SetMaxInitFailed(Int_t nfail=5) {fMaxInitFailed = nfail;}
bb885a9e 69 virtual void SetMergeExcludes(const char *list) {fMergeExcludes = list;};
c57f56b7 70 virtual void SetMasterResubmitThreshold(Int_t percentage) {fMasterResubmitThreshold = percentage;}
bb885a9e 71 virtual void SetNtestFiles(Int_t nfiles) {fNtestFiles = nfiles;}
c57f56b7 72 virtual void SetJDLName(const char *name="analysis.jdl") {fJDLName = name;}
43da816a 73 virtual void SetPreferedSE(const char *se) {fCloseSE = se;}
a3e84053 74 virtual void SetProductionMode(Int_t mode=1) {fProductionMode = mode;}
5fce53f4 75 virtual void SetRunPrefix(const char *prefix) {fRunPrefix = prefix;}
648174cf 76 virtual void SetOutputSingleFolder(const char *folder) {fOutputSingle = folder; fSplitMode="file"; fSplitMaxInputFileNumber=1;}
c57f56b7 77
78 TGridJDL *GetGridJDL() {return fGridJDL;}
5513444a 79 const char *GetGridOutputDir() const {return fGridOutputDir;}
c57f56b7 80//Utilities
81 virtual Bool_t CreateDataset(const char *pattern);
82 virtual Bool_t CreateJDL();
4e5c5506 83 virtual void EnablePackage(const char *package);
923e2ca5 84 static Bool_t DirectoryExists(const char *lfn);
5513444a 85 static Bool_t FileExists(const char *lfn);
d2a409b2 86 static const char *GetJobStatus(Int_t jobidstart, Int_t lastid, Int_t &nrunning, Int_t &nwaiting, Int_t &nerror, Int_t &ndone);
c57f56b7 87 virtual Bool_t MergeOutputs();
16a4353c 88 virtual void Print(Option_t *option="") const;
5513444a 89 virtual Bool_t StartAnalysis(Long64_t nentries=123456789, Long64_t firstentry=0);
d2a409b2 90 virtual void Submit();
c57f56b7 91 virtual void WriteAnalysisFile();
92 virtual void WriteAnalysisMacro();
93 virtual void WriteExecutable();
5513444a 94 virtual Bool_t WriteJDL(Bool_t copy);
95 virtual void WriteProductionFile(const char *filename) const;
c57f56b7 96 virtual void WriteValidationScript();
97
98protected:
99 void CdWork();
100 Bool_t CheckInputData();
101 void CheckDataType(const char *lfn, Bool_t &is_collection, Bool_t &is_xml, Bool_t &use_tags);
102 virtual Bool_t Connect();
103 virtual void SetDefaults();
d2a409b2 104 void SubmitNext();
c57f56b7 105
c57f56b7 106 Bool_t IsCollection(const char *lfn) const;
fe2d7fc2 107 virtual Bool_t IsSingleOutput() const;
c57f56b7 108 Bool_t IsUsingTags() const {return TObject::TestBit(AliAnalysisGrid::kUseTags);}
109
110private:
111 TGridJDL *fGridJDL; //! JDL maker
112 Int_t fPrice; // Grid price for the job;
113 Int_t fTTL; // Time to live.
114 Int_t fSplitMaxInputFileNumber; // Maximum number of files to be processed per subjob
115 Int_t fMaxInitFailed; // Maximum initial consecutive subjobs accepted to fail
116 Int_t fMasterResubmitThreshold; // Failed jobs will be resubmitted until this DONE ratio
bb885a9e 117 Int_t fNtestFiles; // Number of files used in the testing case
a8739e8a 118 Int_t fRunRange[2]; // Run range
319593fb 119 Int_t fNrunsPerMaster; // Number of runs per masterjob
16a4353c 120 Int_t fMaxMergeFiles; // Maximum number of files to be merged in one chunk
d2a409b2 121 Int_t fNsubmitted; // Number of jobs submitted
a3e84053 122 Int_t fProductionMode; // Production mode (0-off, 1-on)
cd11251e 123 Int_t fOutputToRunNo; // Use run number as output directory
c57f56b7 124 TString fRunNumbers; // List of runs to be processed
125 TString fExecutable; // Executable script for AliEn job
0a1c1f7f 126 TString fExecutableCommand; // Command(s) to be executed in the executable script
c57f56b7 127 TString fArguments; // Arguments for the executable script
631c0b05 128 TString fExecutableArgs; // arguments added to the executable script after the analysis macro
c57f56b7 129 TString fAnalysisMacro; // Root macro steering the analysis
130 TString fAnalysisSource; // User analysis implementation (.cxx) file(s)
d5c6455a 131 TString fAdditionalRootLibs; // List (separated by blacs) of additional libraries needed for/before analysis libs/par file compilation
132 TString fAdditionalLibs; // List (separated by blacs) of additional libraries needed for the analysis loaded AFTER all par files
c57f56b7 133 TString fSplitMode; // Job split mode
134 TString fAPIVersion; // API version
135 TString fROOTVersion; // ROOT version
136 TString fAliROOTVersion; // AliROOT version
648174cf 137 TString fExternalPackages; // External packages
c57f56b7 138 TString fUser; // AliEn user name
139 TString fGridWorkingDir; // AliEn directory containing the input packages
140 TString fGridDataDir; // AliEn data production directory
141 TString fDataPattern; // Data pattern for 'find' command
142 TString fGridOutputDir; // AliEn directory (wrt work dir) where the output should be written
143 TString fOutputArchive; // List of output archives separated by blancs
144 TString fOutputFiles; // List of output files separated by blancs
145 TString fInputFormat; // Input format (xml-single)
146 TString fDatasetName; // Dataset xml file to be created
147 TString fJDLName; // JDL file to be generated
bb885a9e 148 TString fMergeExcludes; // List of output files excluded from merging
f965131e 149 TString fIncludePath; // Include path
bb885a9e 150 TString fCloseSE; // Preffered storage element. Taken from alien_CLOSE_SE environment.
0df6ccf2 151 TString fFriendChainName; // File name to construct friend chain (for AOD)
c6cb3634 152 TString fJobTag; // Job tag
648174cf 153 TString fOutputSingle; // Directory name for the output when split is per file
5fce53f4 154 TString fRunPrefix; // Run prefix to be applied to run numbers
c57f56b7 155 TObjArray *fInputFiles; // List of input files to be processed by the job
4e5c5506 156 TObjArray *fPackages; // List of packages to be used
c57f56b7 157
d5c6455a 158 ClassDef(AliAnalysisAlien, 10) // Class providing some AliEn utilities
c57f56b7 159};
160#endif