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