]>
Commit | Line | Data |
---|---|---|
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 | ||
149d288c | 21 | #ifndef ROOT_TMath |
22 | #include <TMath.h> | |
23 | #endif | |
24 | ||
28ce6c9c | 25 | #ifndef ROOT_TMap |
26 | #include <TMap.h> | |
27 | #endif | |
28 | ||
105631b5 | 29 | class AliAnalysisManager; |
c57f56b7 | 30 | class TGridJDL; |
31 | ||
32 | class AliAnalysisAlien : public AliAnalysisGrid { | |
33 | ||
34 | public: | |
35 | ||
36 | AliAnalysisAlien(); | |
37 | AliAnalysisAlien(const char *name); | |
38 | virtual ~AliAnalysisAlien(); | |
39 | AliAnalysisAlien(const AliAnalysisAlien& other); | |
40 | AliAnalysisAlien& operator=(const AliAnalysisAlien& other); | |
41 | // Setters | |
f965131e | 42 | virtual void AddIncludePath(const char *path); |
c57f56b7 | 43 | virtual void AddRunNumber(Int_t run); |
ee75cfc3 | 44 | virtual void AddRunNumber(const char *run); |
98690895 | 45 | virtual void AddRunList(const char *runList); |
c57f56b7 | 46 | virtual void AddDataFile(const char *lfn); |
648174cf | 47 | virtual void AddExternalPackage(const char *name); |
c57f56b7 | 48 | virtual void SetExecutable(const char *name="analysis.sh") {fExecutable = name;} |
0a1c1f7f | 49 | virtual void SetExecutableCommand(const char *command="root -b -q") {fExecutableCommand = command;} |
c57f56b7 | 50 | virtual void SetArguments(const char *name="") {fArguments = name;} |
631c0b05 | 51 | virtual void SetExecutableArgs(const char *name="") {fExecutableArgs = name;} |
c57f56b7 | 52 | virtual void SetAnalysisMacro(const char *name="myAnalysis.C") {fAnalysisMacro = name;} |
53 | virtual void SetAnalysisSource(const char *name="myAnalysisClass.cxx") {fAnalysisSource = name;} | |
d3b18c4c | 54 | virtual void SetValidationScript(const char *name="validation.sh") {fValidationScript = name;} |
c57f56b7 | 55 | virtual void SetAdditionalLibs(const char *list) {fAdditionalLibs = list;} |
d5c6455a | 56 | virtual void SetAdditionalRootLibs(const char *list) {fAdditionalRootLibs = list;} |
c57f56b7 | 57 | virtual void SetPrice(Int_t price=1) {fPrice = price;} |
a8739e8a | 58 | virtual void SetRunRange(Int_t min, Int_t max) {fRunRange[0] = min; fRunRange[1] = max;} |
c6cb3634 | 59 | virtual void SetJobTag(const char *tag="") {fJobTag = tag;} |
319593fb | 60 | virtual void SetNrunsPerMaster(Int_t nruns=1) {fNrunsPerMaster = nruns;} |
16a4353c | 61 | virtual void SetMaxMergeFiles(Int_t nfiles) {fMaxMergeFiles = nfiles;} |
b3e07543 | 62 | virtual void SetMaxMergeStages(Int_t nstages) {fMaxMergeStages = nstages;} |
c57f56b7 | 63 | virtual void SetSplitMode(const char *type="se") {fSplitMode = type;} |
64 | virtual void SetSplitMaxInputFileNumber(Int_t nfiles=100) {fSplitMaxInputFileNumber = nfiles;} | |
149d288c | 65 | virtual void SetAPIVersion(const char *version) {fAPIVersion = version;} |
66 | virtual void SetROOTVersion(const char *version) {fROOTVersion = version;} | |
67 | virtual void SetAliROOTVersion(const char *version) {fAliROOTVersion=version;} | |
c57f56b7 | 68 | virtual void SetUser(const char *user) {fUser = user;} |
69 | virtual void SetTTL(Int_t ttl=30000) {fTTL = ttl;} | |
70 | virtual void SetGridWorkingDir(const char *name="workdir") {fGridWorkingDir = name;} | |
71 | virtual void SetGridDataDir(const char *name) {fGridDataDir = name;} | |
72 | virtual void SetDataPattern(const char *pattern="*AliESDs.root") {fDataPattern = pattern;} | |
0df6ccf2 | 73 | virtual void SetFriendChainName(const char *name="") {fFriendChainName = name;} |
bb885a9e | 74 | virtual void SetDefaultOutputs(Bool_t flag); |
c57f56b7 | 75 | virtual void SetGridOutputDir(const char *name="output") {fGridOutputDir = name;} |
149d288c | 76 | virtual void SetOutputArchive(const char *list="log_archive.zip:std*@disk=1 root_archive.zip:*.root@disk=2"); |
77 | virtual void SetOutputFiles(const char *list); | |
cd11251e | 78 | virtual void SetOutputToRunNo(Int_t mode=1) {fOutputToRunNo = mode;} |
c57f56b7 | 79 | virtual void SetInputFormat(const char *format="xml-single") {fInputFormat = format;} |
80 | virtual void SetMaxInitFailed(Int_t nfail=5) {fMaxInitFailed = nfail;} | |
d3b18c4c | 81 | virtual void SetTerminateFiles(const char *list) {fTerminateFiles = list;} |
bb885a9e | 82 | virtual void SetMergeExcludes(const char *list) {fMergeExcludes = list;}; |
0f389141 | 83 | virtual void SetMergeViaJDL(Bool_t on=kTRUE) {fMergeViaJDL = on ? 1 : 0;} |
f47d5cb4 | 84 | virtual void SetMergeDirName(const char *name) {fMergeDirName = name;} |
c57f56b7 | 85 | virtual void SetMasterResubmitThreshold(Int_t percentage) {fMasterResubmitThreshold = percentage;} |
bb885a9e | 86 | virtual void SetNtestFiles(Int_t nfiles) {fNtestFiles = nfiles;} |
149d288c | 87 | virtual void SetNumberOfReplicas(Int_t ncopies) {fNreplicas = TMath::Min(ncopies,4);} |
c57f56b7 | 88 | virtual void SetJDLName(const char *name="analysis.jdl") {fJDLName = name;} |
149d288c | 89 | virtual void SetPreferedSE(const char *se); |
a3e84053 | 90 | virtual void SetProductionMode(Int_t mode=1) {fProductionMode = mode;} |
74013535 | 91 | virtual void SetRunPrefix(const char *prefix); |
648174cf | 92 | virtual void SetOutputSingleFolder(const char *folder) {fOutputSingle = folder; fSplitMode="file"; fSplitMaxInputFileNumber=1;} |
0f389141 | 93 | virtual void SetFastReadOption(Bool_t on=kTRUE) {fFastReadOption = on ? 1 : 0;} |
94 | virtual void SetOverwriteMode(Bool_t on=kTRUE) {fOverwriteMode = on ? 1 : 0;} | |
c57f56b7 | 95 | |
0f389141 | 96 | TGridJDL *GetGridJDL() const {return fGridJDL;} |
97 | TGridJDL *GetMergingJDL() const {return fMergingJDL;} | |
5513444a | 98 | const char *GetGridOutputDir() const {return fGridOutputDir;} |
c57f56b7 | 99 | //Utilities |
348be253 | 100 | Bool_t CheckFileCopy(const char *alienpath); |
c57f56b7 | 101 | virtual Bool_t CreateDataset(const char *pattern); |
102 | virtual Bool_t CreateJDL(); | |
4e5c5506 | 103 | virtual void EnablePackage(const char *package); |
923e2ca5 | 104 | static Bool_t DirectoryExists(const char *lfn); |
5513444a | 105 | static Bool_t FileExists(const char *lfn); |
a03be957 | 106 | static const char *GetJobStatus(Int_t jobidstart, Int_t lastid, Int_t &nrunning, Int_t &nwaiting, Int_t &nerror, Int_t &ndone); |
f790bc1b | 107 | const char *GetListOfFiles(const char *type); |
b3e07543 | 108 | Bool_t CheckMergedFiles(const char *filename, const char *aliendir, Int_t nperchunk, const char *jdl=""); |
105631b5 | 109 | static AliAnalysisManager *LoadAnalysisManager(const char *fname); |
b3e07543 | 110 | static Bool_t MergeOutput(const char *output, const char *basedir, Int_t nmaxmerge, Int_t stage=0); |
c57f56b7 | 111 | virtual Bool_t MergeOutputs(); |
16a4353c | 112 | virtual void Print(Option_t *option="") const; |
5513444a | 113 | virtual Bool_t StartAnalysis(Long64_t nentries=123456789, Long64_t firstentry=0); |
0f389141 | 114 | static Bool_t SetupPar(const char *package); |
a03be957 | 115 | virtual Bool_t Submit(); |
116 | virtual Bool_t SubmitMerging(); | |
7c2cd90a | 117 | static Int_t SubmitSingleJob(const char *query); |
c57f56b7 | 118 | virtual void WriteAnalysisFile(); |
119 | virtual void WriteAnalysisMacro(); | |
0f389141 | 120 | virtual void WriteMergingMacro(); |
121 | virtual void WriteMergeExecutable(); | |
c57f56b7 | 122 | virtual void WriteExecutable(); |
5513444a | 123 | virtual Bool_t WriteJDL(Bool_t copy); |
124 | virtual void WriteProductionFile(const char *filename) const; | |
0f389141 | 125 | virtual void WriteValidationScript(Bool_t merge=kFALSE); |
c57f56b7 | 126 | |
3bdcb562 | 127 | // PROOF mode |
128 | virtual void SetProofCluster(const char *cluster) {fProofCluster = cluster;} | |
129 | virtual void SetProofDataSet(const char *dataset) {fProofDataSet = dataset;} | |
130 | virtual const char *GetProofDataSet() const {return fProofDataSet.Data();} | |
28ce6c9c | 131 | virtual void SetProofParameter(const char *pname, const char *value); |
132 | const char *GetProofParameter(const char *pname) const; | |
3bdcb562 | 133 | virtual void SetProofReset(Int_t mode) {fProofReset = mode;} |
134 | virtual void SetNproofWorkers(Int_t nworkers) {fNproofWorkers = nworkers;} | |
27734f0e | 135 | virtual void SetNproofWorkersPerSlave(Int_t nworkers) {fNproofWorkersPerSlave = nworkers;} |
3bdcb562 | 136 | virtual void SetRootVersionForProof(const char *version) {fRootVersionForProof = version;} |
137 | virtual void SetAliRootMode(const char *mode) {fAliRootMode = mode;} | |
138 | // .txt file containing the list of files to be chained in test mode | |
139 | virtual void SetFileForTestMode(const char *filename) {fFileForTestMode = filename;} | |
140 | virtual TChain *GetChainForTestMode(const char *treeName) const; | |
141 | ||
c57f56b7 | 142 | protected: |
143 | void CdWork(); | |
144 | Bool_t CheckInputData(); | |
145 | void CheckDataType(const char *lfn, Bool_t &is_collection, Bool_t &is_xml, Bool_t &use_tags); | |
146 | virtual Bool_t Connect(); | |
147 | virtual void SetDefaults(); | |
a03be957 | 148 | Bool_t SubmitNext(); |
c57f56b7 | 149 | |
c57f56b7 | 150 | Bool_t IsCollection(const char *lfn) const; |
fe2d7fc2 | 151 | virtual Bool_t IsSingleOutput() const; |
c57f56b7 | 152 | Bool_t IsUsingTags() const {return TObject::TestBit(AliAnalysisGrid::kUseTags);} |
153 | ||
154 | private: | |
155 | TGridJDL *fGridJDL; //! JDL maker | |
0f389141 | 156 | TGridJDL *fMergingJDL; //! JDL maker |
c57f56b7 | 157 | Int_t fPrice; // Grid price for the job; |
158 | Int_t fTTL; // Time to live. | |
159 | Int_t fSplitMaxInputFileNumber; // Maximum number of files to be processed per subjob | |
160 | Int_t fMaxInitFailed; // Maximum initial consecutive subjobs accepted to fail | |
161 | Int_t fMasterResubmitThreshold; // Failed jobs will be resubmitted until this DONE ratio | |
bb885a9e | 162 | Int_t fNtestFiles; // Number of files used in the testing case |
a8739e8a | 163 | Int_t fRunRange[2]; // Run range |
319593fb | 164 | Int_t fNrunsPerMaster; // Number of runs per masterjob |
16a4353c | 165 | Int_t fMaxMergeFiles; // Maximum number of files to be merged in one chunk |
b3e07543 | 166 | Int_t fMaxMergeStages; // Maximum number of merging stages |
d2a409b2 | 167 | Int_t fNsubmitted; // Number of jobs submitted |
a3e84053 | 168 | Int_t fProductionMode; // Production mode (0-off, 1-on) |
cd11251e | 169 | Int_t fOutputToRunNo; // Use run number as output directory |
0f389141 | 170 | Int_t fMergeViaJDL; // Enable merging via automatic JDL |
171 | Int_t fFastReadOption; // Use xrootd tweaks to reduce timeouts in file access | |
172 | Int_t fOverwriteMode; // Overwrite existing files if any | |
149d288c | 173 | Int_t fNreplicas; // Number of replicas for the output files |
3bdcb562 | 174 | Int_t fNproofWorkers; // Number of workers in proof mode |
27734f0e | 175 | Int_t fNproofWorkersPerSlave; // Max number of workers per slave in proof mode |
3bdcb562 | 176 | Int_t fProofReset; // Proof reset mode: 0=no reset, 1=soft, 2=hard |
c57f56b7 | 177 | TString fRunNumbers; // List of runs to be processed |
178 | TString fExecutable; // Executable script for AliEn job | |
0a1c1f7f | 179 | TString fExecutableCommand; // Command(s) to be executed in the executable script |
c57f56b7 | 180 | TString fArguments; // Arguments for the executable script |
631c0b05 | 181 | TString fExecutableArgs; // arguments added to the executable script after the analysis macro |
c57f56b7 | 182 | TString fAnalysisMacro; // Root macro steering the analysis |
183 | TString fAnalysisSource; // User analysis implementation (.cxx) file(s) | |
d3b18c4c | 184 | TString fValidationScript; // Name of the validation script |
d5c6455a | 185 | TString fAdditionalRootLibs; // List (separated by blacs) of additional libraries needed for/before analysis libs/par file compilation |
186 | TString fAdditionalLibs; // List (separated by blacs) of additional libraries needed for the analysis loaded AFTER all par files | |
c57f56b7 | 187 | TString fSplitMode; // Job split mode |
188 | TString fAPIVersion; // API version | |
189 | TString fROOTVersion; // ROOT version | |
190 | TString fAliROOTVersion; // AliROOT version | |
648174cf | 191 | TString fExternalPackages; // External packages |
c57f56b7 | 192 | TString fUser; // AliEn user name |
193 | TString fGridWorkingDir; // AliEn directory containing the input packages | |
194 | TString fGridDataDir; // AliEn data production directory | |
195 | TString fDataPattern; // Data pattern for 'find' command | |
196 | TString fGridOutputDir; // AliEn directory (wrt work dir) where the output should be written | |
197 | TString fOutputArchive; // List of output archives separated by blancs | |
198 | TString fOutputFiles; // List of output files separated by blancs | |
199 | TString fInputFormat; // Input format (xml-single) | |
200 | TString fDatasetName; // Dataset xml file to be created | |
201 | TString fJDLName; // JDL file to be generated | |
d3b18c4c | 202 | TString fTerminateFiles; // List of output files produced during Terminate |
bb885a9e | 203 | TString fMergeExcludes; // List of output files excluded from merging |
f965131e | 204 | TString fIncludePath; // Include path |
bb885a9e | 205 | TString fCloseSE; // Preffered storage element. Taken from alien_CLOSE_SE environment. |
0df6ccf2 | 206 | TString fFriendChainName; // File name to construct friend chain (for AOD) |
c6cb3634 | 207 | TString fJobTag; // Job tag |
648174cf | 208 | TString fOutputSingle; // Directory name for the output when split is per file |
5fce53f4 | 209 | TString fRunPrefix; // Run prefix to be applied to run numbers |
3bdcb562 | 210 | TString fProofCluster; // Proof cluster name |
211 | TString fProofDataSet; // Proof dataset to be used | |
212 | TString fFileForTestMode; // .txt file for the chain to be used in PROOF test mode | |
213 | TString fRootVersionForProof; // ROOT version to be used in PROOF mode. The default one taken if empty. | |
214 | TString fAliRootMode; // AliRoot mode among the list supported by the proof cluster | |
f47d5cb4 | 215 | TString fMergeDirName; // Name of the directory that should be added to the output directory |
c57f56b7 | 216 | TObjArray *fInputFiles; // List of input files to be processed by the job |
4e5c5506 | 217 | TObjArray *fPackages; // List of packages to be used |
28ce6c9c | 218 | TMap fProofParam; // Key-value pairs for proof mode |
c57f56b7 | 219 | |
28ce6c9c | 220 | ClassDef(AliAnalysisAlien, 18) // Class providing some AliEn utilities |
c57f56b7 | 221 | }; |
222 | #endif |