]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/RESONANCES/macros/mini/runPlugin.C
PWG2/SPECTRA -> PWGLF/SPECTRA migration
[u/mrichter/AliRoot.git] / PWG2 / RESONANCES / macros / mini / runPlugin.C
1 //
2 // This is an example steering macro for running RSN analysis task
3 // with the AliEn plugin to launch a multiple analysis.
4 //
5 // Inputs:
6 //
7 //   - runMode     = AliEn plugin run mode
8 //   - suffix      = eventual suffix which is attached to the automatic name created for outputs
9 //   - partname    = a string which defines the resonance name (used for output)
10 //   - runList     = configuration file whith gives list of runs, pattern, prefix, options and AliEn path
11 //   - split       = corresponding JDL value
12 //   - nmerge      = number of outputs to be merged per stage
13 //
14 //   - taskList    = a string containin all the 'add-task' macros to be used
15 //   - taskPath    = the uniqu pathe where all 'add-task' macros (and all their needs) are stored
16 //
17 //   - workDirBase = path of the working directory (starting from AliEn home)
18 //   - outDir      = path of the output directory (w.r. to workDir)
19 //
20 // Notes:
21 //
22 //   - in case the source is an ESD, and if inputs are a MC production
23 //     the MC input handler is created by default
24 //
25 //
26 void runPlugin
27 (
28    const char *runMode,
29    const char *options,
30    const char *alienDir,
31    const char *addLibs,
32    const char *addPars,
33    
34    const char *alienJobName,
35    const char *alienRunPath,
36    const char *alienRunPrefix,
37    const char *alienRunPattern,
38    const char *alienRunList,
39    
40    Int_t       nmix,
41    Int_t       split,
42    Int_t       nmerge,
43    const char *macroPath,
44    Int_t       runsPerMaster
45 )
46 {
47    //
48    // === PREPARATION ==============================================================================
49    //
50    
51    // execute the general setup from the apposite macro
52    // it returns also a TString value with the input tree name
53    gROOT->LoadMacro("../AnalysisSetupRsnMini.C");
54    TString out = Setup(nmix, options, "analysis.root", macroPath);
55    if (out.Length() < 1) return;
56    
57    //
58    // === PLUGIN CONFIGURATION =====================================================================
59    //
60
61    // load macro for plugin setup
62    gSystem->AddIncludePath("-I$ALICE_ROOT/include");
63    gROOT->LoadMacro("SetupPlugin.C++g");
64    
65    // define inputs
66    PluginSetup::alienInputRuns = kTRUE;
67    PluginSetup::nRunsPerMaster = runsPerMaster;
68    PluginSetup::runPath        = alienRunPath;
69    PluginSetup::runPrefix      = alienRunPrefix;
70    PluginSetup::runPattern     = alienRunPattern;
71    PluginSetup::runList        = alienRunList;
72    PluginSetup::split          = split;
73    PluginSetup::maxMergeFiles  = nmerge;
74
75    // define output path
76    PluginSetup::workDir  = "analysis/RSNpackage/mini/";
77    PluginSetup::workDir += alienDir;
78    
79    // define common root for all generated files
80    PluginSetup::jobName = alienJobName;
81    
82    // define additional libraries
83    PluginSetup::addLibs = addLibs;
84    PluginSetup::addPar  = addPars;
85    
86    // additional modalities
87    PluginSetup::rootVersion = "v5-28-00d";
88    PluginSetup::aliVersion = "v4-21-25-AN";
89    
90    // create the plugin (need to know if we want tender)
91    if (!PluginSetup::CreatePlugin()) return;
92    PluginSetup::plugin->SetRunMode(runMode);
93
94    //
95    // === ANALYSIS EXECUTION =======================================================================
96    //
97    
98    // add plugin to analysis manager
99    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
100    if (!mgr) return;
101    mgr->SetGridHandler(PluginSetup::plugin);
102    
103    // initialize and start analysis
104    if (!mgr->InitAnalysis()) {
105       ::Error("runPlugin.C", "Failed to init analysis");
106       return;
107    }
108    mgr->PrintStatus();
109    mgr->StartAnalysis("grid");
110 }