Fix bug in building local list of valid files.
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisGrid.cxx
CommitLineData
c57f56b7 1/**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16// Author: Mihaela Gheata, 01/09/2008
17
18//==============================================================================
19// AliAnalysisGrid - Base grid utility class. Provides interface for creating
20// a personalized JDL, finding and creating a dataset.
21//==============================================================================
22
23#include "TSystem.h"
08d5b699 24#include "TError.h"
c57f56b7 25#include "AliAnalysisGrid.h"
26
27ClassImp(AliAnalysisGrid)
28
29//______________________________________________________________________________
30AliAnalysisGrid::AliAnalysisGrid(const AliAnalysisGrid& other)
348be253 31 :TNamed(other), fSpecialBits(0)
c57f56b7 32{
33// Copy ctor.
34}
35
36//______________________________________________________________________________
37AliAnalysisGrid &AliAnalysisGrid::operator=(const AliAnalysisGrid& other)
38{
39// Assignment.
40 if (this != &other) {
41 TNamed::operator=(other);
348be253 42 fSpecialBits = other.fSpecialBits;
c57f56b7 43 }
44 return *this;
45}
46
47//______________________________________________________________________________
499b6d5d 48Bool_t AliAnalysisGrid::CreateToken(const char *)
c57f56b7 49{
50// Check if a valid token exists - if not create one
08d5b699 51 ::Warning("AliAnalysisGrid::CreateToken()", "**** !!!! Obsolete method. Please remove the line calling this in your plugin configuration !!!! ****\n");
52 return kTRUE;
c57f56b7 53}
54
55//______________________________________________________________________________
56AliAnalysisGrid::EPluginRunMode AliAnalysisGrid::GetRunMode() const
57{
58// Get the current run mode.
59 if (TObject::TestBit(kTest)) return AliAnalysisGrid::kTest;
60 if (TObject::TestBit(kOffline)) return AliAnalysisGrid::kOffline;
61 if (TObject::TestBit(kSubmit)) return AliAnalysisGrid::kSubmit;
62 if (TObject::TestBit(kMerge)) return AliAnalysisGrid::kMerge;
63 return AliAnalysisGrid::kFull;
64}
65
66//______________________________________________________________________________
67void AliAnalysisGrid::SetRunMode(const char *mode)
68{
69// Set the alien plugin run mode. All modes require presence of a valid token
70// and sourcing the AliEn environment. Supported modes are:
71// - full (default): Generates requested datasets, locally generates the JDL,
72// saves existing analysis manager to the file analysis.root,
73// generates analysis macro, execution and validation scripts,
74// copies all these files to AliEn working space and submits
75// the job leaving user in an AliEn shell.
76// - test : Generates only 10 entries of the first requested dataset and
77// copies this locally as wn.xml, generates all files from the
78// full run mode except the JDL and executes the analysis locally.
79// This mode can be used to test if the analysis may run in grid.
80// - offline : No dataset is produced, but all other files are locally generated.
81// No file is copied in AliEn workspace. This mode can be used to
82// customize the automatic JDL/analysis macro.
83// - submit : Datasets are generated in AliEn but the JDL and all the other
84// files are supposed to exist in the local directory. The files
85// are copied to AliEn and the job is submitted. This mode should
86// be used in correlation with "offline mode" to submit customized
87// analysis macro/jdl.
88// - merge : Only MergeOutputs() method called to merge the registered
89// outputs of a job that finished.
90 TString smode(mode);
91 smode.ToLower();
92 TObject::SetBit(kTest, kFALSE);
93 TObject::SetBit(kOffline, kFALSE);
94 TObject::SetBit(kSubmit, kFALSE);
95 TObject::SetBit(kMerge, kFALSE);
96 if (smode.Contains("test")) {
97 TObject::SetBit(kTest, kTRUE);
98 return;
99 }
100 if (smode.Contains("offline")) {
101 TObject::SetBit(kOffline, kTRUE);
348be253 102 SetUseCopy(kFALSE);
103 SetCheckCopy(kFALSE);
c57f56b7 104 return;
105 }
106 if (smode.Contains("submit")) {
107 TObject::SetBit(kSubmit, kTRUE);
108 return;
109 }
110 if (smode.Contains("merge") || smode.Contains("terminate")) {
111 TObject::SetBit(kMerge, kTRUE);
112 return;
113 }
114 if (!smode.Contains("full")) {
115 Warning("SetRunMode","Run mode \"%s\" not known. Supported modes: \"full\", \"test\", \"offline\", \"submit\" and \"merge\"", mode);
116 Warning("SetRunMode","Run mode set to FULL");
117 }
118}