]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ANALYSIS/AliAnalysisGrid.cxx
tracklets accessible from ESD and AOD events via virtual class: https://alice.its...
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisGrid.cxx
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"
24 #include "TError.h"
25 #include "AliAnalysisGrid.h"
26
27 ClassImp(AliAnalysisGrid)
28
29 //______________________________________________________________________________
30 AliAnalysisGrid::AliAnalysisGrid(const AliAnalysisGrid& other)
31                 :TNamed(other), fSpecialBits(0)
32 {
33 // Copy ctor.
34 }
35
36 //______________________________________________________________________________
37 AliAnalysisGrid &AliAnalysisGrid::operator=(const AliAnalysisGrid& other)
38 {
39 // Assignment.
40    if (this != &other) {
41       TNamed::operator=(other);
42       fSpecialBits = other.fSpecialBits;
43    }
44    return *this;
45 }
46
47 //______________________________________________________________________________
48 Bool_t AliAnalysisGrid::CreateToken(const char *)
49 {
50 // Check if a valid token exists - if not create one
51    ::Warning("AliAnalysisGrid::CreateToken()", "**** !!!! Obsolete method. Please remove the line calling this in your plugin configuration !!!! ****\n");
52    return kTRUE;
53 }
54
55 //______________________________________________________________________________
56 AliAnalysisGrid::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 //______________________________________________________________________________
67 void 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);
102       SetUseCopy(kFALSE);
103       SetCheckCopy(kFALSE);
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 }