Added support for copying the outputs of the analysis in an AliEn folder from a
[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);
35 virtual void AddDataFile(const char *lfn);
36 virtual void SetExecutable(const char *name="analysis.sh") {fExecutable = name;}
37 virtual void SetArguments(const char *name="") {fArguments = name;}
38 virtual void SetAnalysisMacro(const char *name="myAnalysis.C") {fAnalysisMacro = name;}
39 virtual void SetAnalysisSource(const char *name="myAnalysisClass.cxx") {fAnalysisSource = name;}
40 virtual void SetAdditionalLibs(const char *list) {fAdditionalLibs = list;}
41 virtual void SetPrice(Int_t price=1) {fPrice = price;}
42 virtual void SetSplitMode(const char *type="se") {fSplitMode = type;}
43 virtual void SetSplitMaxInputFileNumber(Int_t nfiles=100) {fSplitMaxInputFileNumber = nfiles;}
44 virtual void SetAPIVersion(const char *version="V2.4") {fAPIVersion = version;}
45 virtual void SetROOTVersion(const char *version="v5-21-01-alice") {fROOTVersion = version;}
46 virtual void SetAliROOTVersion(const char *version="v4-14-Rev-02") {fAliROOTVersion=version;}
47 virtual void SetUser(const char *user) {fUser = user;}
48 virtual void SetTTL(Int_t ttl=30000) {fTTL = ttl;}
49 virtual void SetGridWorkingDir(const char *name="workdir") {fGridWorkingDir = name;}
50 virtual void SetGridDataDir(const char *name) {fGridDataDir = name;}
51 virtual void SetDataPattern(const char *pattern="*AliESDs.root") {fDataPattern = pattern;}
bb885a9e 52 virtual void SetDefaultOutputs(Bool_t flag);
c57f56b7 53 virtual void SetGridOutputDir(const char *name="output") {fGridOutputDir = name;}
54 virtual void SetOutputArchive(const char *list="log_archive.zip:stdout,stderr root_archive.zip:*.root") {fOutputArchive = list;}
55 virtual void SetOutputFiles(const char *list) {fOutputFiles = list;}
56 virtual void SetInputFormat(const char *format="xml-single") {fInputFormat = format;}
57 virtual void SetMaxInitFailed(Int_t nfail=5) {fMaxInitFailed = nfail;}
bb885a9e 58 virtual void SetMergeExcludes(const char *list) {fMergeExcludes = list;};
c57f56b7 59 virtual void SetMasterResubmitThreshold(Int_t percentage) {fMasterResubmitThreshold = percentage;}
bb885a9e 60 virtual void SetNtestFiles(Int_t nfiles) {fNtestFiles = nfiles;}
c57f56b7 61 virtual void SetJDLName(const char *name="analysis.jdl") {fJDLName = name;}
43da816a 62 virtual void SetPreferedSE(const char *se) {fCloseSE = se;}
c57f56b7 63
64 TGridJDL *GetGridJDL() {return fGridJDL;}
65//Utilities
66 virtual Bool_t CreateDataset(const char *pattern);
67 virtual Bool_t CreateJDL();
4e5c5506 68 virtual void EnablePackage(const char *package);
c57f56b7 69 virtual Bool_t MergeOutputs();
70 virtual void StartAnalysis(Long64_t nentries=123456789, Long64_t firstentry=0);
71 virtual void WriteAnalysisFile();
72 virtual void WriteAnalysisMacro();
73 virtual void WriteExecutable();
74 virtual void WriteValidationScript();
75
76protected:
77 void CdWork();
78 Bool_t CheckInputData();
79 void CheckDataType(const char *lfn, Bool_t &is_collection, Bool_t &is_xml, Bool_t &use_tags);
80 virtual Bool_t Connect();
81 virtual void SetDefaults();
82
83 Bool_t FileExists(const char *lfn) const;
84 Bool_t IsCollection(const char *lfn) const;
85 Bool_t IsUsingTags() const {return TObject::TestBit(AliAnalysisGrid::kUseTags);}
86
87private:
88 TGridJDL *fGridJDL; //! JDL maker
89 Int_t fPrice; // Grid price for the job;
90 Int_t fTTL; // Time to live.
91 Int_t fSplitMaxInputFileNumber; // Maximum number of files to be processed per subjob
92 Int_t fMaxInitFailed; // Maximum initial consecutive subjobs accepted to fail
93 Int_t fMasterResubmitThreshold; // Failed jobs will be resubmitted until this DONE ratio
bb885a9e 94 Int_t fNtestFiles; // Number of files used in the testing case
c57f56b7 95 TString fRunNumbers; // List of runs to be processed
96 TString fExecutable; // Executable script for AliEn job
97 TString fArguments; // Arguments for the executable script
98 TString fAnalysisMacro; // Root macro steering the analysis
99 TString fAnalysisSource; // User analysis implementation (.cxx) file(s)
100 TString fAdditionalLibs; // List (separated by blacs) of additional libraries needed for the analysis
101 TString fSplitMode; // Job split mode
102 TString fAPIVersion; // API version
103 TString fROOTVersion; // ROOT version
104 TString fAliROOTVersion; // AliROOT version
105 TString fUser; // AliEn user name
106 TString fGridWorkingDir; // AliEn directory containing the input packages
107 TString fGridDataDir; // AliEn data production directory
108 TString fDataPattern; // Data pattern for 'find' command
109 TString fGridOutputDir; // AliEn directory (wrt work dir) where the output should be written
110 TString fOutputArchive; // List of output archives separated by blancs
111 TString fOutputFiles; // List of output files separated by blancs
112 TString fInputFormat; // Input format (xml-single)
113 TString fDatasetName; // Dataset xml file to be created
114 TString fJDLName; // JDL file to be generated
bb885a9e 115 TString fMergeExcludes; // List of output files excluded from merging
f965131e 116 TString fIncludePath; // Include path
bb885a9e 117 TString fCloseSE; // Preffered storage element. Taken from alien_CLOSE_SE environment.
c57f56b7 118 TObjArray *fInputFiles; // List of input files to be processed by the job
4e5c5506 119 TObjArray *fPackages; // List of packages to be used
c57f56b7 120
bb885a9e 121 ClassDef(AliAnalysisAlien, 2) // Class providing some AliEn utilities
c57f56b7 122};
123#endif